src/Connection.php
public function setHandler(
        $message,
        $type,
        \fpoirotte\Pssht\HandlerInterface $handler
    ) {
        if (!is_int($type) || $type < 0 || $type > 255) {
            throw new \InvalidArgumentException();
        }

        if (!is_int($message)) {
            if (!($message instanceof \fpoirotte\Pssht\Messages\CHANNEL\REQUEST\Base)) {
                throw new \InvalidArgumentException();
            }
            $message = $message->getChannel();
        }

        $this->handlers[$message][$type] = $handler;
        return $this;
    }
public function setHandler(
        $message,
        $type,
        \fpoirotte\Pssht\HandlerInterface $handler
    ) {
        if (!is_int($type) || $type < 0 || $type > 255) {
            throw new \InvalidArgumentException();
        }

        if (!is_int($message)) {
            if (!($message instanceof \fpoirotte\Pssht\Messages\CHANNEL\REQUEST\Base)) {
                throw new \InvalidArgumentException();
            }
            $message = $message->getChannel();
        }

        $this->handlers[$message][$type] = $handler;
        return $this;
    }
public function setHandler ( $ message , $ type , \ fpoirotte \ Pssht \ HandlerInterface $ handler ) { if ( ! is_int ( $ type ) || $ type < 0 || $ type > 255 ) { throw new \ InvalidArgumentException ( ) ; } if ( ! is_int ( $ message ) ) { if ( ! ( $ message instanceof \ fpoirotte \ Pssht \ Messages \ CHANNEL \ REQUEST \ Base ) ) { throw new \ InvalidArgumentException ( ) ; } $ message = $ message -> getChannel ( ) ; } $ this -> handlers [ $ message ] [ $ type ] = $ handler ; return $ this ; }
Register a handler.

\param int|fpoirotte::Pssht::Messages::CHANNEL::REQUEST::Base $message
Either a message or the message's channel identifier.

\param int $type
Message type.

\param fpoirotte::Pssht::HandlerInterface $handler
Handler to associate with the message.
Register a handler .