public function add($serializer)
    {
        if (!method_exists($serializer, 'serialize')) {
            throw new \Exception('The serializer '.get_class($serializer).' must implement the method serialize');
        }

        $this->serializers[] = $serializer;
    }
public function add($serializer)
    {
        if (!method_exists($serializer, 'serialize')) {
            throw new \Exception('The serializer '.get_class($serializer).' must implement the method serialize');
        }

        $this->serializers[] = $serializer;
    }
public function add ( $ serializer ) { if ( ! method_exists ( $ serializer , 'serialize' ) ) { throw new \ Exception ( 'The serializer ' . get_class ( $ serializer ) . ' must implement the method serialize' ) ; } $ this -> serializers [ ] = $ serializer ; }
Registers a new serializer.

@param mixed $serializer

@throws \Exception
Registers a new serializer .