src/CSDT/CollectionsBundle/TraitCollection/SubsetableCollectionTrait.php
public function getSubset($key)
    {
        $target = $this->newInstance();
        
        if (!($target instanceof ContainerCollectionInterface)) {
            throw new \LogicException(
                "The SubsetableCollectionTrait must be used".
                " into ContainerCollectionInterface childs"
            );
        }
        
        if ($this->has($key)) {
            $source = $this->get($key);
            
            if (is_array($source)) {
                $this->fromArray($source, $target);
            } else if ($source instanceof CollectionInterface) {
                $this->fromArray($source->toArray(), $target);
            }
        }
        
        return $target;
    }
public function getSubset($key)
    {
        $target = $this->newInstance();
        
        if (!($target instanceof ContainerCollectionInterface)) {
            throw new \LogicException(
                "The SubsetableCollectionTrait must be used".
                " into ContainerCollectionInterface childs"
            );
        }
        
        if ($this->has($key)) {
            $source = $this->get($key);
            
            if (is_array($source)) {
                $this->fromArray($source, $target);
            } else if ($source instanceof CollectionInterface) {
                $this->fromArray($source->toArray(), $target);
            }
        }
        
        return $target;
    }
Get subset

This method return a new ContainerCollectionInterface
containing the value of the given key, parsed
as ContainerCollectionInterface.

@param mixed $key The key whence create the subset

@throws \LogicException If the method is called with an instance that
don't match ContainerCollectionInterface
@return ContainerCollectionInterface