Skip to content
Permalink
Browse files

improve handling when meta value is not found

  • Loading branch information
flack committed Dec 14, 2019
1 parent 2d1013a commit 8de2d7408188bb2305fd504169723655c6587574
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/org/openpsa/httplib/helpers.php
@@ -20,10 +20,14 @@ class org_openpsa_httplib_helpers extends midcom_baseclasses_components_purecode
*
* @param string $html HTML to parse
* @param string $name Name of the meta tag to fetch
* @return ?string
*/
public static function get_meta_value($html, $name) : string
public static function get_meta_value($html, $name)
{
$crawler = new Crawler($html);
if ($crawler->filter('head meta[name="' . $name . '"]')->count() == 0) {
return null;
}
return (string) $crawler->filter('head meta[name="' . $name . '"]')->attr('content');
}

0 comments on commit 8de2d74

Please sign in to comment.
You can’t perform that action at this time.