Skip to content

Commit

Permalink
Avoding if statements and using === null as nano-optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Apr 24, 2015
1 parent 2a4b5ae commit 53a0817
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/Controller/Controller.php
Expand Up @@ -258,17 +258,10 @@ public function __construct(Request $request = null, Response $response = null,
$this->name = $name;
}

if (!($request instanceof Request)) {
$request = new Request();
}
$this->setRequest($request);

if (!($response instanceof Response)) {
$response = new Response();
}
$this->response = $response;
$this->setRequest($request !== null ? $request : new Request);
$this->response = $response !== null ? $response : new Response;

if ($eventManager) {
if ($eventManager !== null) {
$this->eventManager($eventManager);
}

Expand Down

0 comments on commit 53a0817

Please sign in to comment.