Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
fix static method call and code style
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiocarneiro committed Dec 21, 2015
1 parent ca20326 commit 1bdbf22
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/Exception/InvalidMiddlewareException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,21 @@
* @copyright Copyright (c) 2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license https://github.com/zendframework/zend-stratigility/blob/master/LICENSE.md New BSD License
*/

namespace Zend\Stratigility\Exception;

use InvalidArgumentException;

class InvalidMiddlewareException extends InvalidArgumentException
{
public static function fromValue($value) {
public static function fromValue($value)
{
$received = gettype($value);

if (is_object($value)) {
$received = get_class($value);
}

return new self(
sprintf(
'Middleware must be callable, %s found',
Expand All @@ -28,3 +29,4 @@ public static function fromValue($value) {
);
}
}

2 changes: 1 addition & 1 deletion src/MiddlewarePipe.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function pipe($path, $middleware = null)

// Ensure we have a valid handler
if (! is_callable($middleware)) {
throw InvalidMiddlewareException($middleware);
throw InvalidMiddlewareException::fromValue($middleware);
}

$this->pipeline->enqueue(new Route(
Expand Down

0 comments on commit 1bdbf22

Please sign in to comment.