-
-
Save tiffany-taylor/7f99fe2ca348c23e8f90a5e50170e56e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
private function blahblahblah(\DOMXPath $xpath) | |
{ | |
$node = $xpath->query('/some/valid/xpath/query')->item(0); | |
if ($node === null) { | |
// log message stating node wasn't found | |
return ''; | |
} | |
$text = $node->textContent; | |
if ($text === '') { | |
// log message stating node was found, but it was empty | |
return ''; | |
} | |
// proceed with code that processes $text | |
} | |
// vs. | |
private function asfasdfasdf(\DOMXPath $xpath) | |
{ | |
$node = $xpath->query('/some/valid/xpath/query')->item(0); | |
if ($node === null || empty($node->textContent)) { | |
// log message that node wasn't found or it was empty | |
return ''; | |
} | |
$text = $node->textContent; | |
// proceed with code that processes $text | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment