Count SimpleXMLElement with the count method

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
Maurício Meneghini Fauth 2019-12-10 09:55:33 -03:00
parent ec22dd707a
commit 54f839f573
2 changed files with 3 additions and 3 deletions

View File

@ -192,7 +192,7 @@ class ImportOds extends ImportPlugin
continue;
}
/* Iterate over columns */
$cellCount = count($row);
$cellCount = $row->count();
$a = 0;
/** @var SimpleXMLElement $cell */
foreach ($row as $cell) {
@ -200,7 +200,7 @@ class ImportOds extends ImportPlugin
$text = $cell->children('text', true);
$cell_attrs = $cell->attributes('office', true);
if (count($text) != 0) {
if ($text->count() != 0) {
$attr = $cell->attributes('table', true);
$num_repeat = (int) $attr['number-columns-repeated'];
$num_iterations = $num_repeat ?: 1;

View File

@ -237,7 +237,7 @@ class ImportXml extends ImportPlugin
/**
* Only attempt to analyze/collect data if there is data present
*/
if ($xml && @count($xml->children())) {
if ($xml && $xml->children()->count()) {
$data_present = true;
/**