src/Protocol/Role.php
public static function instance($role)
    {
        // @codeCoverageIgnoreStart
        if (!self::$instances) {
            self::$instances = [
                self::RESPONDER  => new self(self::RESPONDER),
                self::AUTHORIZER => new self(self::AUTHORIZER),
                self::FILTER     => new self(self::FILTER),
            ];
        }
        // @codeCoverageIgnoreEnd

        if (!array_key_exists($role, self::$instances)) {
            throw new \InvalidArgumentException("Invalid Role $role");
        }

        return self::$instances[$role];
    }
public static function instance($role)
    {
        // @codeCoverageIgnoreStart
        if (!self::$instances) {
            self::$instances = [
                self::RESPONDER  => new self(self::RESPONDER),
                self::AUTHORIZER => new self(self::AUTHORIZER),
                self::FILTER     => new self(self::FILTER),
            ];
        }
        // @codeCoverageIgnoreEnd

        if (!array_key_exists($role, self::$instances)) {
            throw new \InvalidArgumentException("Invalid Role $role");
        }

        return self::$instances[$role];
    }
public static function instance ( $ role ) { // @codeCoverageIgnoreStart if ( ! self :: $ instances ) { self :: $ instances = [ self :: RESPONDER => new self ( self :: RESPONDER ) , self :: AUTHORIZER => new self ( self :: AUTHORIZER ) , self :: FILTER => new self ( self :: FILTER ) , ] ; } // @codeCoverageIgnoreEnd if ( ! array_key_exists ( $ role , self :: $ instances ) ) { throw new \ InvalidArgumentException ( "Invalid Role $role" ) ; } return self :: $ instances [ $ role ] ; }
Returns an instance of the given role.

@param int $role

@throws \InvalidArgumentException

@return Role
Returns an instance of the given role .