We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 94b88a3 commit c292062Copy full SHA for c292062
src/Iodev/Whois/Helpers/GroupSelector.php
@@ -26,14 +26,29 @@ public function getAll()
26
}
27
28
/**
29
+ * First item
30
* @param mixed $default
31
* @return mixed
32
*/
- public function getFirst($default = null)
33
+ public function getFirstItem($default = null)
34
{
35
return empty($this->items) ? $default : reset($this->items);
36
37
38
+ /**
39
+ * First non-array value
40
+ * @param mixed $default
41
+ * @return mixed
42
+ */
43
+ public function getFirst($default = null)
44
+ {
45
+ $first = $this->getFirstItem();
46
+ while (is_array($first)) {
47
+ $first = count($first) > 0 ? reset($first) : null;
48
+ }
49
+ return $first !== null ? $first : $default;
50
51
+
52
53
* @return $this
54
0 commit comments