public function all(array $collections = [], $groupByCollection = false)
    {
        if (count($collections) === 0) {
            if ($groupByCollection === false) {
                return $this->items;
            }

            return $this->itemCollections;
        }

        $result = [];

        foreach ($collections as $collection) {
            if (isset($this->itemCollections[$collection]) === false) {
                continue;
            }

            if ($groupByCollection === false) {
                $result = array_merge($result, $this->itemCollections[$collection]);

                continue;
            }

            $result[$collection] = $this->itemCollections[$collection];
        }

        return $result;
    }
public function all(array $collections = [], $groupByCollection = false)
    {
        if (count($collections) === 0) {
            if ($groupByCollection === false) {
                return $this->items;
            }

            return $this->itemCollections;
        }

        $result = [];

        foreach ($collections as $collection) {
            if (isset($this->itemCollections[$collection]) === false) {
                continue;
            }

            if ($groupByCollection === false) {
                $result = array_merge($result, $this->itemCollections[$collection]);

                continue;
            }

            $result[$collection] = $this->itemCollections[$collection];
        }

        return $result;
    }
public function all ( array $ collections = [ ] , $ groupByCollection = false ) { if ( count ( $ collections ) === 0 ) { if ( $ groupByCollection === false ) { return $ this -> items ; } return $ this -> itemCollections ; } $ result = [ ] ; foreach ( $ collections as $ collection ) { if ( isset ( $ this -> itemCollections [ $ collection ] ) === false ) { continue ; } if ( $ groupByCollection === false ) { $ result = array_merge ( $ result , $ this -> itemCollections [ $ collection ] ) ; continue ; } $ result [ $ collection ] = $ this -> itemCollections [ $ collection ] ; } return $ result ; }
Returns all items in this collection.

@param string[] $collections       The name of the item collections affected.
Array empty means all
@param bool     $groupByCollection First level of array is the collection name

@return array
Returns all items in this collection .