Skip to content

Commit

Permalink
Remove expectations that argument is an array
Browse files Browse the repository at this point in the history
This allows use to pass in array-like objects too.
  • Loading branch information
lukemorton committed Feb 18, 2014
1 parent 89bcdb0 commit 5fed5db
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/Lily/Adapter/Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ private function shallowMergeRequests($r1, $r2)
return $mergedRequest;
}

public function run($handler, array $request = array())
public function run($handler, $request = array())
{
$originalRequest =
$this->shallowMergeRequests(
Expand Down
2 changes: 1 addition & 1 deletion src/Lily/Application/MiddlewareApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class MiddlewareApplication
{
private $middleware;

public function __construct(array $pipeline = NULL)
public function __construct($pipeline = NULL)
{
if ($pipeline !== NULL) {
$this->middleware = $pipeline;
Expand Down
4 changes: 2 additions & 2 deletions src/Lily/Application/RoutedApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class RoutedApplication

private $routes = array();

public function __construct(array $routes = NULL)
public function __construct($routes = NULL)
{
if ($routes !== NULL) {
$this->routes = $routes;
Expand Down Expand Up @@ -224,7 +224,7 @@ public function __invoke($request)
return Response::notFound();
}

public function uri($name, array $params = array())
public function uri($name, $params = array())
{
$routes = $this->routes();
$uri = $routes[$name][1];
Expand Down
2 changes: 1 addition & 1 deletion src/Lily/Middleware/Cookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static function unsign($request, $name, $originalValue, $salt)
private $defaults = array();
private $salt = 'a-salt';

public function __construct(array $config = NULL)
public function __construct($config = NULL)
{
if (isset($config['defaults'])) {
$this->defaults = $config['defaults'];
Expand Down
2 changes: 1 addition & 1 deletion src/Lily/Middleware/DefaultHeaders.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class DefaultHeaders
{
private $headers;

public function __construct(array $config)
public function __construct($config)
{
$this->headers = $config['headers'];
}
Expand Down
2 changes: 1 addition & 1 deletion src/Lily/Middleware/ExceptionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ExceptionHandler
{
private $handler;

public function __construct(array $config = array())
public function __construct($config = array())
{
if (isset($config['handler'])) {
$this->handler = $config['handler'];
Expand Down
2 changes: 1 addition & 1 deletion src/Lily/Middleware/Injection.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Injection
{
private $map;

public function __construct(array $config)
public function __construct($config)
{
$this->map = $config['inject'];
}
Expand Down
2 changes: 1 addition & 1 deletion src/Lily/Middleware/ResponseStatusHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class ResponseStatusHandler
{
private $statusHandlers;

public function __construct(array $config)
public function __construct($config)
{
$this->statusHandlers = $config['handlers'];
}
Expand Down
2 changes: 1 addition & 1 deletion src/Lily/Middleware/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Session
{
private $store;

public function __construct(array $config = NULL)
public function __construct($config = NULL)
{
if (isset($config['store'])) {
$this->store = $config['store'];
Expand Down
6 changes: 3 additions & 3 deletions src/Lily/Middleware/Session/CookieStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class CookieStore
private $name = '_session';
private $cookie = array();

public function __construct(array $config = NULL)
public function __construct($config = NULL)
{
if (isset($config['cookie'])) {
if (isset($config['cookie']['name'])) {
Expand All @@ -19,7 +19,7 @@ public function __construct(array $config = NULL)
}
}

public function get(array $request)
public function get($request)
{
if (isset($request['cookies'][$this->name])) {
$request['session'] =
Expand All @@ -31,7 +31,7 @@ public function get(array $request)
return $request;
}

public function set(array $response)
public function set($response)
{
if (isset($response['session'])) {
$response['cookies'][$this->name] =
Expand Down
4 changes: 2 additions & 2 deletions src/Lily/Middleware/Session/NativeStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ public function __construct()
}
}

public function get(array $request)
public function get($request)
{
$request['session'] = $_SESSION;
return $request;
}

public function set(array $response)
public function set($response)
{
if (isset($response['session'])) {
$_SESSION = $response['session'];
Expand Down

0 comments on commit 5fed5db

Please sign in to comment.