@@ -21,10 +21,8 @@ public static function getMetas(\DOMDocument $html)
2121 foreach ($ html ->getElementsByTagName ('meta ' ) as $ meta ) {
2222 $ name = trim (strtolower ($ meta ->getAttribute ('property ' ) ?: $ meta ->getAttribute ('name ' )));
2323 $ value = $ meta ->getAttribute ('content ' ) ?: $ meta ->getAttribute ('value ' );
24-
2524 $ metas [] = [$ name , $ value , $ meta ];
2625 }
27-
2826 return $ metas ;
2927 }
3028
@@ -68,7 +66,6 @@ public static function getData(array $providers, $name, Url $url = null)
6866
6967 foreach ($ providers as $ key => $ provider ) {
7068 $ value = $ provider ->$ method ();
71-
7269 if (empty ($ value )) {
7370 continue ;
7471 }
@@ -92,7 +89,6 @@ public static function getData(array $providers, $name, Url $url = null)
9289 }
9390 }
9491 }
95-
9692 return array_values ($ values );
9793 }
9894
@@ -176,6 +172,28 @@ public static function getFirstValue(array $values, $returnKey = false)
176172 }
177173 }
178174
175+
176+ /**
177+ * Returns values as array
178+ *
179+ * @param array $values The array provided by self::getData()
180+ * @param bool $returnKey Whether or not return the key instead the value
181+ *
182+ * @return array
183+ */
184+ public static function getAllValues (array $ values , $ returnKey = false )
185+ {
186+ if ($ returnKey ){
187+ return array_keys ($ values );
188+ }
189+ $ return_value =[];
190+ foreach ($ values as $ value )
191+ {
192+ $ return_value []=$ value ['value ' ];
193+ }
194+ return $ return_value ;
195+ }
196+
179197 /**
180198 * Returns the most popular value in an array.
181199 *
0 commit comments