| 1 |
<?php |
| 2 |
declare( strict_types = 1 ); |
| 3 |
|
| 4 |
namespace Wikimedia\Parsoid\Ext\Gallery; |
| 5 |
|
| 6 |
use Wikimedia\Parsoid\Core\DomSourceRange; |
| 7 |
use Wikimedia\Parsoid\DOM\Element; |
| 8 |
use Wikimedia\Parsoid\Ext\DOMUtils; |
| 9 |
|
| 10 |
class ParsedLine { |
| 11 |
|
| 12 |
/** |
| 13 |
* DOM node representing the thumbnail image. |
| 14 |
* @var Element |
| 15 |
*/ |
| 16 |
public $thumb; |
| 17 |
|
| 18 |
/** |
| 19 |
* DOM node representing the caption (if any). |
| 20 |
* @var ?Element |
| 21 |
*/ |
| 22 |
public $gallerytext; |
| 23 |
|
| 24 |
/** |
| 25 |
* The `typeof` the thumbnail image. |
| 26 |
* @var string |
| 27 |
*/ |
| 28 |
public $rdfaType; |
| 29 |
|
| 30 |
/** |
| 31 |
* @var DomSourceRange |
| 32 |
*/ |
| 33 |
public $dsr; |
| 34 |
|
| 35 |
public bool $hasError; |
| 36 |
|
| 37 |
/** |
| 38 |
* Construct a new ParsedLine object. |
| 39 |
* @param Element $thumb |
| 40 |
* @param ?Element $gallerytext |
| 41 |
* @param string $rdfaType |
| 42 |
* @param DomSourceRange $dsr |
| 43 |
*/ |
| 44 |
public function __construct( |
| 45 |
Element $thumb, ?Element $gallerytext, string $rdfaType, DomSourceRange $dsr |
| 46 |
) { |
| 47 |
$this->thumb = $thumb; |
| 48 |
$this->gallerytext = $gallerytext; |
| 49 |
$this->rdfaType = $rdfaType; |
| 50 |
$this->dsr = $dsr; |
| 51 |
$this->hasError = DOMUtils::hasTypeOf( $thumb, 'mw:Error' ); |
| 52 |
} |
| 53 |
} |