Skip to content

Commit

Permalink
Merge pull request #2764 from mapogolions/code_reuse
Browse files Browse the repository at this point in the history
3.x - Reuse of base class code
  • Loading branch information
l0gicgate committed Jul 29, 2019
2 parents 95c967a + ea113d2 commit fcf84fb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 19 deletions.
10 changes: 10 additions & 0 deletions Slim/Routable.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ abstract class Routable
*/
protected $pattern;

/**
* @param string $pattern
* @param callable $callable
*/
public function __construct($pattern, $callable)
{
$this->pattern = $pattern;
$this->callable = $callable;
}

/**
* Get the middleware registered for the group
*
Expand Down
10 changes: 1 addition & 9 deletions Slim/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,6 @@ class Route extends Routable implements RouteInterface
*/
protected $savedArguments = [];

/**
* The callable payload
*
* @var callable
*/
protected $callable;

/**
* @param string|string[] $methods The route HTTP methods
* @param string $pattern The route pattern
Expand All @@ -88,9 +81,8 @@ class Route extends Routable implements RouteInterface
*/
public function __construct($methods, $pattern, $callable, $groups = [], $identifier = 0)
{
parent::__construct($pattern, $callable);
$this->methods = is_string($methods) ? [$methods] : $methods;
$this->pattern = $pattern;
$this->callable = $callable;
$this->groups = $groups;
$this->identifier = 'route' . $identifier;
}
Expand Down
10 changes: 0 additions & 10 deletions Slim/RouteGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,6 @@

class RouteGroup extends Routable implements RouteGroupInterface
{
/**
* @param string $pattern The pattern prefix for the group
* @param callable $callable The group callable
*/
public function __construct($pattern, $callable)
{
$this->pattern = $pattern;
$this->callable = $callable;
}

/**
* {@inheritdoc}
*/
Expand Down

0 comments on commit fcf84fb

Please sign in to comment.