src/MultilevelCollection.php
public function get(string $key)
    {
        $slug = $this->splitKey($key);

        if (is_string($slug)) {
            if (isset($this[$slug])) {
                return $this[$slug];
            }
            return null;
        }

        $array = $this->toArray();

        foreach ($slug as $search) {
            if (isset($array[$search])) {
                $array = $array[$search];
            } else {
                return;
            }
        }

        return $array;
    }
public function get(string $key)
    {
        $slug = $this->splitKey($key);

        if (is_string($slug)) {
            if (isset($this[$slug])) {
                return $this[$slug];
            }
            return null;
        }

        $array = $this->toArray();

        foreach ($slug as $search) {
            if (isset($array[$search])) {
                $array = $array[$search];
            } else {
                return;
            }
        }

        return $array;
    }
public function get ( string $ key ) { $ slug = $ this -> splitKey ( $ key ) ; if ( is_string ( $ slug ) ) { if ( isset ( $ this [ $ slug ] ) ) { return $ this [ $ slug ] ; } return null ; } $ array = $ this -> toArray ( ) ; foreach ( $ slug as $ search ) { if ( isset ( $ array [ $ search ] ) ) { $ array = $ array [ $ search ] ; } else { return ; } } return $ array ; }
Gets an item from collection.

@param string $key The item's key

@return mixed|void The item's value or void if the key doesn't exists.
Gets an item from collection .