@@ -309,7 +309,7 @@ private function addInfoClassId() {
309
309
$ nodes = array_merge ((array ) $ classes ,(array ) $ ids );
310
310
311
311
// Remove nodes for which all class names are ASCII
312
- if (count ($ nodes ) > 0 )
312
+ if ($ nodes && count ($ nodes ) > 0 )
313
313
$ nodes = array_filter ($ nodes , function ($ valArray ) {
314
314
$ valArray ['values ' ] = preg_filter ('/[^\x20-\x7E]/ ' , '$0 ' , $ valArray ['values ' ]);
315
315
if (empty ($ valArray ['values ' ]))
@@ -324,7 +324,7 @@ private function addInfoClassId() {
324
324
Information::addInfo ($ category , $ title , $ value , $ display_value );
325
325
326
326
// Remove nodes for which all class names are NFC
327
- if (count ($ nodes ) > 0 )
327
+ if ($ nodes && count ($ nodes ) > 0 )
328
328
// FIXME? case class="nonASCII nonNFC" may report two nonNFC names if $valArray[values] is not edited. the check should be value by value.
329
329
$ nodes = array_filter ($ nodes , function (&$ valArray ) {
330
330
if (is_array ($ valArray ['values ' ]))
@@ -892,7 +892,7 @@ private function hasValue ($array) {
892
892
893
893
private function getFirstCVP ($ array ) {
894
894
// returns the first code-value pair from an array of code-value pairs
895
- if (count ($ array ) > 0 ) { return $ array [0 ]; }
895
+ if ($ array && count ($ array ) > 0 ) { return $ array [0 ]; }
896
896
else return null ;
897
897
}
898
898
@@ -1111,7 +1111,7 @@ private function addReportLanguages() {
1111
1111
1112
1112
// ERROR: A lang attribute value did not match an xml:lang value when they appeared together on the same tag.
1113
1113
$ nonMatchingAttrs = array ();
1114
- if (count ($ htmlLangAttrs ) > 0 )
1114
+ if ($ htmlLangAttrs && count ($ htmlLangAttrs ) > 0 )
1115
1115
array_walk ($ htmlLangAttrs , function (&$ valArray , $ key ) use (&$ xmlLangAttrs , &$ nonMatchingAttrs ) {
1116
1116
$ code = $ valArray ['code ' ];
1117
1117
if (($ el = Utils::findCodeIn ($ code , $ xmlLangAttrs )) != null ) {
@@ -1139,7 +1139,7 @@ private function addReportDirValues() {
1139
1139
// ERROR: Incorrect values used for dir attribute
1140
1140
$ dirNodes = $ this ->doc ->getNodesWithAttr ('dir ' );
1141
1141
$ isXML = $ this ->doc ->isServedAsXML ;
1142
- if (count ($ dirNodes ) > 0 ) {
1142
+ if ($ dirNodes && count ($ dirNodes ) > 0 ) {
1143
1143
$ invalidDirNodes = array_filter ($ dirNodes , function ($ array ) use ($ isXML ) {
1144
1144
if (is_array ($ array ['values ' ])) { $ array ['values ' ] = implode (' ' ,$ array ['values ' ]); }
1145
1145
if (! $ isXML ) { $ array ['values ' ] = strtolower ($ array ['values ' ]); }
@@ -1191,14 +1191,14 @@ private function addReportDirValues() {
1191
1191
1192
1192
// WARNING: CSS is being used to set direction
1193
1193
$ styleNodes = $ this ->doc ->getNodesWithAttr ('style ' );
1194
- if (count ($ styleNodes ) > 0 ) {
1194
+ if ($ styleNodes && count ($ styleNodes ) > 0 ) {
1195
1195
$ invalidstyleNodes = array_filter ($ styleNodes , function ($ array ) {
1196
1196
if (is_array ($ array ['values ' ])) { $ array ['values ' ] = implode (' ' ,$ array ['values ' ]); }
1197
1197
$ array ['values ' ] = strtolower ($ array ['values ' ]);
1198
1198
if (preg_match ('/direction:\s*rtl/ ' ,$ array ['values ' ]) || preg_match ('/direction:\s*ltr/ ' ,$ array ['values ' ])) { return true ; }
1199
1199
return false ;
1200
1200
});
1201
- if (count ($ invalidstyleNodes ) > 0 )
1201
+ if ($ invalidstyleNodes && count ($ invalidstyleNodes ) > 0 )
1202
1202
Report::addReport (
1203
1203
'rep_markup_css_direction ' ,
1204
1204
'dir_category ' , REPORT_LEVEL_WARNING ,
@@ -1214,7 +1214,7 @@ private function addReportDirValues() {
1214
1214
private function addReportMisc () {
1215
1215
// WARNING: are there non-NFC class or id names?
1216
1216
$ nonNFCs = Information::getValues ('classId_non_nfc ' );
1217
- if (count ($ nonNFCs ) > 0 ) {
1217
+ if ($ nonNFCs && count ($ nonNFCs ) > 0 ) {
1218
1218
Report::addReport (
1219
1219
'rep_latin_non_nfc ' ,
1220
1220
'nonLatin_category ' , REPORT_LEVEL_WARNING ,
@@ -1488,4 +1488,4 @@ private function addReportMisc() {
1488
1488
}
1489
1489
}
1490
1490
1491
- Checker::_init ();
1491
+ Checker::_init ();
0 commit comments