Page MenuHomeWickedGov Phorge

ParsoidValidator.php
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

ParsoidValidator.php

<?php
declare( strict_types = 1 );
namespace Cite\Parsoid;
use Wikimedia\Parsoid\NodeData\DataMwError;
/**
* @license GPL-2.0-or-later
*/
class ParsoidValidator {
public function validateDir( string $refDir, RefGroupItem $ref ): ?DataMwError {
if ( $ref->dir !== '' && $ref->dir !== $refDir ) {
return new DataMwError( 'cite_error_ref_conflicting_dir', [ $ref->name ] );
}
return null;
}
public function validateName( string $name, ?RefGroup $refGroup, ReferencesData $referencesData ): ?DataMwError {
if ( !$refGroup->lookupRefByName( $name ) && $referencesData->inReferenceList() ) {
return new DataMwError(
'cite_error_references_missing_key',
[ $name ]
);
}
return null;
}
public function validateFollow( string $followName, ?RefGroup $refGroup ): ?DataMwError {
if ( !$refGroup->lookupRefByName( $followName ) ) {
// FIXME: This key isn't exactly appropriate since this
// is more general than just being in a <references>
// section and it's the $followName we care about, but the
// extension to the legacy parser doesn't have an
// equivalent key and just outputs something wacky.
return new DataMwError(
'cite_error_references_missing_key',
[ $followName ]
);
}
return null;
}
}

File Metadata

Mime Type
text/x-php
Expires
Oct 4 2026, 20:17 (6 w, 9 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
62/17/b59bba6a4e06d1bd9d615037a78f
Default Alt Text
ParsoidValidator.php (1 KB)

Event Timeline