public function toItem($object): ? Item
    {
        foreach ($this->writeTransformers as $writeTransformer) {
            if ($writeTransformer->isValidObject($object)) {
                $item = $writeTransformer->toItem($object);
                $this
                    ->eventDispatcher
                    ->dispatch(
                        'apisearch.item_transformed',
                        new ItemTransformed(
                            $item,
                            $object
                        )
                    );

                return $item;
            }
        }

        return null;
    }
public function toItem($object): ? Item
    {
        foreach ($this->writeTransformers as $writeTransformer) {
            if ($writeTransformer->isValidObject($object)) {
                $item = $writeTransformer->toItem($object);
                $this
                    ->eventDispatcher
                    ->dispatch(
                        'apisearch.item_transformed',
                        new ItemTransformed(
                            $item,
                            $object
                        )
                    );

                return $item;
            }
        }

        return null;
    }
public function toItem ( $ object ) : ? Item { foreach ( $ this -> writeTransformers as $ writeTransformer ) { if ( $ writeTransformer -> isValidObject ( $ object ) ) { $ item = $ writeTransformer -> toItem ( $ object ) ; $ this -> eventDispatcher -> dispatch ( 'apisearch.item_transformed' , new ItemTransformed ( $ item , $ object ) ) ; return $ item ; } } return null ; }
Transform an object into an item.

@param mixed $object

@return Item|null
Transform an object into an item .