public function build($type)
    {
        if (!isset(self::$mapping[$type])) {
            throw new UnknownPacketTypeException(sprintf('Unknown packet type %d.', $type));
        }

        $class = self::$mapping[$type];

        return new $class();
    }
public function build($type)
    {
        if (!isset(self::$mapping[$type])) {
            throw new UnknownPacketTypeException(sprintf('Unknown packet type %d.', $type));
        }

        $class = self::$mapping[$type];

        return new $class();
    }
public function build ( $ type ) { if ( ! isset ( self :: $ mapping [ $ type ] ) ) { throw new UnknownPacketTypeException ( sprintf ( 'Unknown packet type %d.' , $ type ) ) ; } $ class = self :: $ mapping [ $ type ] ; return new $ class ( ) ; }
Builds a packet object for the given type.

@param int $type

@throws UnknownPacketTypeException

@return Packet
Builds a packet object for the given type .