src/ContextCollection.php
public function extract($parts = null) {
        if ($parts === null) {
            return $this->data;
        }

        if (is_array($parts)) {
            $result = array();

            foreach ($this->data as $match) {
                $row = array();
                foreach ($parts as $key) {
                    if (isset($match[$key])) {
                        $row[$key] = isset($match[$key])?$match[$key]:null;
                    }
                }

                $result[] = $row;
            }

            return $result;
        }

        $result = array();
        foreach ($this->data as $match) {
            $result[] = isset($match[$parts])?$match[$parts]:null;
        }

        return $result;
    }
public function extract($parts = null) {
        if ($parts === null) {
            return $this->data;
        }

        if (is_array($parts)) {
            $result = array();

            foreach ($this->data as $match) {
                $row = array();
                foreach ($parts as $key) {
                    if (isset($match[$key])) {
                        $row[$key] = isset($match[$key])?$match[$key]:null;
                    }
                }

                $result[] = $row;
            }

            return $result;
        }

        $result = array();
        foreach ($this->data as $match) {
            $result[] = isset($match[$parts])?$match[$parts]:null;
        }

        return $result;
    }
public function extract ( $ parts = null ) { if ( $ parts === null ) { return $ this -> data ; } if ( is_array ( $ parts ) ) { $ result = array ( ) ; foreach ( $ this -> data as $ match ) { $ row = array ( ) ; foreach ( $ parts as $ key ) { if ( isset ( $ match [ $ key ] ) ) { $ row [ $ key ] = isset ( $ match [ $ key ] ) ? $ match [ $ key ] : null ; } } $ result [ ] = $ row ; } return $ result ; } $ result = array ( ) ; foreach ( $ this -> data as $ match ) { $ result [ ] = isset ( $ match [ $ parts ] ) ? $ match [ $ parts ] : null ; } return $ result ; }
Extract result parts of the collection.
@param  mixed $parts
@return mixed
Extract result parts of the collection .