protected function processHandlerFromResource(Attribute $definition, $value)
    {
        $type = $definition->getType();
        $handler = $this->handlers[$type];
        $parameters = $definition->getTypeParameters();

        if (! $definition->isMany()) {
            return $handler->fromResource($value, $type, $parameters);
        }

        if (! $value instanceof \Traversable && ! is_array($value)) {
            throw new NotIterableAttribute($definition, $value);
        }

        $collection = new \ArrayObject();

        foreach ($value as $item) {
            $collection[] = $handler->fromResource($item, $type, $parameters);
        }

        return $collection;
    }
protected function processHandlerFromResource(Attribute $definition, $value)
    {
        $type = $definition->getType();
        $handler = $this->handlers[$type];
        $parameters = $definition->getTypeParameters();

        if (! $definition->isMany()) {
            return $handler->fromResource($value, $type, $parameters);
        }

        if (! $value instanceof \Traversable && ! is_array($value)) {
            throw new NotIterableAttribute($definition, $value);
        }

        $collection = new \ArrayObject();

        foreach ($value as $item) {
            $collection[] = $handler->fromResource($item, $type, $parameters);
        }

        return $collection;
    }
protected function processHandlerFromResource ( Attribute $ definition , $ value ) { $ type = $ definition -> getType ( ) ; $ handler = $ this -> handlers [ $ type ] ; $ parameters = $ definition -> getTypeParameters ( ) ; if ( ! $ definition -> isMany ( ) ) { return $ handler -> fromResource ( $ value , $ type , $ parameters ) ; } if ( ! $ value instanceof \ Traversable && ! is_array ( $ value ) ) { throw new NotIterableAttribute ( $ definition , $ value ) ; } $ collection = new \ ArrayObject ( ) ; foreach ( $ value as $ item ) { $ collection [ ] = $ handler -> fromResource ( $ item , $ type , $ parameters ) ; } return $ collection ; }
Process value by registered data-type handler.
From resource to object.

@param  Attribute $definition
@param  mixed $value
@return mixed
@throws NotIterableAttribute
Process value by registered data - type handler . From resource to object .