@@ -291,7 +291,6 @@ protected function parseSelector(string $selector) {
291291 $ join = null ;
292292 do {
293293 switch ($ token ['type ' ]) {
294-
295294 case 'id ' :
296295 $ parts [] = [
297296 'id ' => mb_substr ($ token ['value ' ], 1 ),
@@ -319,14 +318,14 @@ protected function parseSelector(string $selector) {
319318 case 'squareopen ' :
320319 $ item = ['join ' => $ join ];
321320 while (($ token = $ tokens ->next ()) !== false ) {
322- if ($ token ['type ' ] == 'squareclose ' ) {
321+ if ($ token ['type ' ] === 'squareclose ' ) {
323322 break ;
324323 } elseif (in_array ($ token ['type ' ], ['string ' , 'quotes ' ])) {
325324 if ($ token ['type ' ] == 'quotes ' ) {
326325 $ token ['value ' ] = stripslashes (mb_substr ($ token ['value ' ], 1 , -1 ));
327326 }
328327 $ item [isset ($ item ['attribute ' ]) ? 'value ' : 'attribute ' ] = $ token ['value ' ];
329- } elseif ($ token ['type ' ] == 'comparison ' ) {
328+ } elseif ($ token ['type ' ] === 'comparison ' ) {
330329 $ item ['comparison ' ] = $ token ['value ' ];
331330 }
332331 }
@@ -401,7 +400,7 @@ public function get(int $index = null) {
401400 // build children that are tags
402401 $ children = [];
403402 foreach ($ this ->children AS $ item ) {
404- if (get_class ($ item ) == 'hexydec \\html \\tag ' ) {
403+ if (get_class ($ item ) === 'hexydec \\html \\tag ' ) {
405404 $ children [] = $ item ;
406405 }
407406 }
@@ -435,7 +434,7 @@ public function find(string $selector) : htmldoc {
435434 // parse selector and find tags
436435 if (is_array ($ selector ) || ($ selector = $ this ->parseSelector ($ selector )) !== false ) {
437436 foreach ($ this ->children AS $ item ) {
438- if (get_class ($ item ) == 'hexydec \\html \\tag ' ) {
437+ if (get_class ($ item ) === 'hexydec \\html \\tag ' ) {
439438 foreach ($ selector AS $ value ) {
440439 if (($ items = $ item ->find ($ value )) !== false ) {
441440 $ found = array_merge ($ found , $ items );
@@ -505,7 +504,7 @@ public function children() : htmldoc {
505504 */
506505 public function attr (string $ key ) : ?string {
507506 foreach ($ this ->children AS $ item ) {
508- if (get_class ($ item ) == 'hexydec \\html \\tag ' ) {
507+ if (get_class ($ item ) === 'hexydec \\html \\tag ' ) {
509508 return $ item ->attr ($ key );
510509 }
511510 }
@@ -522,7 +521,7 @@ public function text() : string {
522521 foreach ($ this ->children AS $ item ) {
523522
524523 // only get text from these objects
525- if (in_array (get_class ($ item ), ['hexydec \\html \\tag ' , 'hexydec \\html \\text ' ])) {
524+ if (in_array (get_class ($ item ), ['hexydec \\html \\tag ' , 'hexydec \\html \\text ' ], true )) {
526525 $ value = $ item ->text ();
527526 $ text = array_merge ($ text , is_array ($ value ) ? $ value : [$ value ]);
528527 }
@@ -635,7 +634,7 @@ public function save(string $file = null, array $options = []) {
635634 if (!empty ($ options ['charset ' ])) {
636635
637636 // if not UTF-8, convert all applicable HTML entities
638- if ($ options ['charset ' ] != 'UTF-8 ' ) {
637+ if ($ options ['charset ' ] !== 'UTF-8 ' ) {
639638 $ html = $ this ->htmlentities ($ html , $ options ['charset ' ]);
640639 }
641640
0 commit comments