Skip to content

Commit

Permalink
Make all methods for updating middleware queue accept middleware name…
Browse files Browse the repository at this point in the history
… as string.
  • Loading branch information
ADmad committed Jul 27, 2016
1 parent b4f1dd1 commit bdb6cf8
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/Http/MiddlewareQueue.php
Expand Up @@ -143,12 +143,12 @@ public function prepend($middleware)
* and the existing element will be shifted one index greater.
*
* @param int $index The index to insert at.
* @param callable $callable The callable to insert.
* @param callable|string $middleware The middleware to insert.
* @return $this
*/
public function insertAt($index, callable $callable)
public function insertAt($index, $middleware)
{
array_splice($this->queue, $index, 0, $callable);
array_splice($this->queue, $index, 0, $middleware);

return $this;
}
Expand All @@ -161,10 +161,10 @@ public function insertAt($index, callable $callable)
* this method will behave like add().
*
* @param string $class The classname to insert the middleware before.
* @param callable $callable The middleware to insert
* @param callable|string $middleware The middleware to insert.
* @return $this
*/
public function insertBefore($class, callable $callable)
public function insertBefore($class, $middleware)
{
$found = false;
foreach ($this->queue as $i => $object) {
Expand All @@ -174,7 +174,7 @@ public function insertBefore($class, callable $callable)
}
}
if ($found) {
return $this->insertAt($i, $callable);
return $this->insertAt($i, $middleware);
}
throw new LogicException(sprintf("No middleware matching '%s' could be found.", $class));
}
Expand All @@ -187,10 +187,10 @@ public function insertBefore($class, callable $callable)
* this method will behave like add().
*
* @param string $class The classname to insert the middleware before.
* @param callable $callable The middleware to insert
* @param callable|string $middleware The middleware to insert.
* @return $this
*/
public function insertAfter($class, callable $callable)
public function insertAfter($class, $middleware)
{
$found = false;
foreach ($this->queue as $i => $object) {
Expand All @@ -200,10 +200,10 @@ public function insertAfter($class, callable $callable)
}
}
if ($found) {
return $this->insertAt($i + 1, $callable);
return $this->insertAt($i + 1, $middleware);
}

return $this->add($callable);
return $this->add($middleware);
}

/**
Expand Down

0 comments on commit bdb6cf8

Please sign in to comment.