Equip\Exception\MiddlewareException::notInvokable PHP Method

notInvokable() public static method

public static notInvokable ( string | object $spec ) : static
$spec string | object
return static
    public static function notInvokable($spec)
    {
        if (is_object($spec)) {
            $spec = get_class($spec);
        }
        return new static(sprintf('Middleware `%s` is not invokable', $spec));
    }

Usage Example

コード例 #1
0
ファイル: MiddlewareSet.php プロジェクト: equip/framework
 /**
  * @inheritDoc
  *
  * @throws MiddlewareException
  *  If $classes does not conform to type expectations.
  */
 protected function assertValid(array $classes)
 {
     parent::assertValid($classes);
     foreach ($classes as $middleware) {
         if (!(is_callable($middleware) || method_exists($middleware, '__invoke'))) {
             throw MiddlewareException::notInvokable($middleware);
         }
     }
 }
MiddlewareException