protected function retrieve(Direction $direction, string $class): \ArrayIterator
    {
        $d = (string) $direction;

        $hydrate = function (EncapsulatedEdge $encapsulated): EdgeInterface {
            if(!$encapsulated->hydrated())
                return $this->master->edge($encapsulated->id());
            return $encapsulated->edge();
        };

        $filter_classes = function (EncapsulatedEdge $encapsulated) use ($class): bool {
            return in_array($class, $encapsulated->classes());
        };

        if(empty($class)) {
            return new \ArrayIterator(
                array_map($hydrate, $this->$d)
            );
        }

        return new \ArrayIterator(
            array_map($hydrate, 
                array_filter($this->$d, $filter_classes)
            )
        );
    }
protected function retrieve(Direction $direction, string $class): \ArrayIterator
    {
        $d = (string) $direction;

        $hydrate = function (EncapsulatedEdge $encapsulated): EdgeInterface {
            if(!$encapsulated->hydrated())
                return $this->master->edge($encapsulated->id());
            return $encapsulated->edge();
        };

        $filter_classes = function (EncapsulatedEdge $encapsulated) use ($class): bool {
            return in_array($class, $encapsulated->classes());
        };

        if(empty($class)) {
            return new \ArrayIterator(
                array_map($hydrate, $this->$d)
            );
        }

        return new \ArrayIterator(
            array_map($hydrate, 
                array_filter($this->$d, $filter_classes)
            )
        );
    }
protected function retrieve ( Direction $ direction , string $ class ) : \ ArrayIterator { $ d = ( string ) $ direction ; $ hydrate = function ( EncapsulatedEdge $ encapsulated ) : EdgeInterface { if ( ! $ encapsulated -> hydrated ( ) ) return $ this -> master -> edge ( $ encapsulated -> id ( ) ) ; return $ encapsulated -> edge ( ) ; } ; $ filter_classes = function ( EncapsulatedEdge $ encapsulated ) use ( $ class ) : bool { return in_array ( $ class , $ encapsulated -> classes ( ) ) ; } ; if ( empty ( $ class ) ) { return new \ ArrayIterator ( array_map ( $ hydrate , $ this -> $ d ) ) ; } return new \ ArrayIterator ( array_map ( $ hydrate , array_filter ( $ this -> $ d , $ filter_classes ) ) ) ; }
A helper method to retrieve edges.

@see out A method that uses this function
@see in A method that uses this function

@param Direction $direction Lets you choose to fetch incoming or outgoing edges.
@param string    $class     The type of edge (defined in edge class) to return

@return \ArrayIterator An array of EdgeInterface objects.
A helper method to retrieve edges .