public function select($name)
    {
        $group = null;
        $name = strtoupper($name);
        if (false !== strpos($name, '.')) {
            list($group, $name) = explode('.', $name, 2);
        }
        if ('' === $name) {
            $name = null;
        }

        if (!is_null($name)) {
            $result = isset($this->children[$name]) ? $this->children[$name] : [];

            if (is_null($group)) {
                return $result;
            } else {
                // If we have a group filter as well, we need to narrow it down
                // more.
                return array_filter(
                    $result,
                    function ($child) use ($group) {
                        return $child instanceof Property && strtoupper($child->group) === $group;
                    }
                );
            }
        }

        // If we got to this point, it means there was no 'name' specified for
        // searching, implying that this is a group-only search.
        $result = [];
        foreach ($this->children as $childGroup) {
            foreach ($childGroup as $child) {
                if ($child instanceof Property && strtoupper($child->group) === $group) {
                    $result[] = $child;
                }
            }
        }

        return $result;
    }
public function select($name)
    {
        $group = null;
        $name = strtoupper($name);
        if (false !== strpos($name, '.')) {
            list($group, $name) = explode('.', $name, 2);
        }
        if ('' === $name) {
            $name = null;
        }

        if (!is_null($name)) {
            $result = isset($this->children[$name]) ? $this->children[$name] : [];

            if (is_null($group)) {
                return $result;
            } else {
                // If we have a group filter as well, we need to narrow it down
                // more.
                return array_filter(
                    $result,
                    function ($child) use ($group) {
                        return $child instanceof Property && strtoupper($child->group) === $group;
                    }
                );
            }
        }

        // If we got to this point, it means there was no 'name' specified for
        // searching, implying that this is a group-only search.
        $result = [];
        foreach ($this->children as $childGroup) {
            foreach ($childGroup as $child) {
                if ($child instanceof Property && strtoupper($child->group) === $group) {
                    $result[] = $child;
                }
            }
        }

        return $result;
    }
public function select ( $ name ) { $ group = null ; $ name = strtoupper ( $ name ) ; if ( false !== strpos ( $ name , '.' ) ) { list ( $ group , $ name ) = explode ( '.' , $ name , 2 ) ; } if ( '' === $ name ) { $ name = null ; } if ( ! is_null ( $ name ) ) { $ result = isset ( $ this -> children [ $ name ] ) ? $ this -> children [ $ name ] : [ ] ; if ( is_null ( $ group ) ) { return $ result ; } else { // If we have a group filter as well, we need to narrow it down // more. return array_filter ( $ result , function ( $ child ) use ( $ group ) { return $ child instanceof Property && strtoupper ( $ child -> group ) === $ group ; } ) ; } } // If we got to this point, it means there was no 'name' specified for // searching, implying that this is a group-only search. $ result = [ ] ; foreach ( $ this -> children as $ childGroup ) { foreach ( $ childGroup as $ child ) { if ( $ child instanceof Property && strtoupper ( $ child -> group ) === $ group ) { $ result [ ] = $ child ; } } } return $ result ; }
Returns an array with elements that match the specified name.

This function is also aware of MIME-Directory groups (as they appear in
vcards). This means that if a property is grouped as "HOME.EMAIL", it
will also be returned when searching for just "EMAIL". If you want to
search for a property in a specific group, you can select on the entire
string ("HOME.EMAIL"). If you want to search on a specific property that
has not been assigned a group, specify ".EMAIL".

@param string $name

@return array
Returns an array with elements that match the specified name .