Skip to content

Commit

Permalink
PHP 7.1 : DomNodeList::count() was added in PHP 7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Progi1984 committed Sep 21, 2023
1 parent 0bbc0e3 commit 22f94cd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/Math/Reader/MathML.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected function getElement(DOMElement $nodeElement): Element\AbstractElement
case 'mfrac':
$element = new Element\Fraction();
$nodeList = $this->xpath->query('*', $nodeElement);
if ($nodeList->count() == 2) {
if ($nodeList->length == 2) {
$element
->setNumerator($this->getElement($nodeList->item(0)))
->setDenominator($this->getElement($nodeList->item(1)));
Expand All @@ -75,7 +75,7 @@ protected function getElement(DOMElement $nodeElement): Element\AbstractElement
if (empty($nodeValue)) {
$nodeList = $this->xpath->query('*', $nodeElement);
if (
$nodeList->count() == 1
$nodeList->length == 1
&& $nodeList->item(0)->nodeName == 'mchar'
&& $nodeList->item(0)->hasAttribute('name')
) {
Expand All @@ -88,7 +88,7 @@ protected function getElement(DOMElement $nodeElement): Element\AbstractElement
case 'msup':
$element = new Element\Superscript();
$nodeList = $this->xpath->query('*', $nodeElement);
if ($nodeList->count() == 2) {
if ($nodeList->length == 2) {
$element
->setBase($this->getElement($nodeList->item(0)))
->setSuperscript($this->getElement($nodeList->item(1)));
Expand Down
6 changes: 3 additions & 3 deletions src/Math/Reader/OfficeMathML.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected function getElement(DOMElement $nodeElement): Element\AbstractElement
$element = new Element\Fraction();
// Numerator
$nodeNumerator = $this->xpath->query('m:num/m:r/m:t', $nodeElement);
if ($nodeNumerator->count() == 1) {
if ($nodeNumerator->length == 1) {
$value = $nodeNumerator->item(0)->nodeValue;
if (is_numeric($value)) {
$element->setNumerator(new Element\Numeric($value));
Expand All @@ -77,7 +77,7 @@ protected function getElement(DOMElement $nodeElement): Element\AbstractElement
}
// Denominator
$nodeDenominator= $this->xpath->query('m:den/m:r/m:t', $nodeElement);
if ($nodeDenominator->count() == 1) {
if ($nodeDenominator->length == 1) {
$value = $nodeDenominator->item(0)->nodeValue;
if (is_numeric($value)) {
$element->setDenominator(new Element\Numeric($value));
Expand All @@ -88,7 +88,7 @@ protected function getElement(DOMElement $nodeElement): Element\AbstractElement
return $element;
case 'm:r':
$nodeText = $this->xpath->query('m:t', $nodeElement);
if ($nodeText->count() == 1) {
if ($nodeText->length == 1) {
$value = trim($nodeText->item(0)->nodeValue);
if (in_array($value, $this->operators)) {
return new Element\Operator($value);
Expand Down

0 comments on commit 22f94cd

Please sign in to comment.