-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from frederikbosch/master
Moved the resolveHandler method to a seperate class HandlerResolver.
- Loading branch information
Showing
3 changed files
with
51 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
namespace Phroute; | ||
|
||
class HandlerResolver implements HandlerResolverInterface { | ||
|
||
/** | ||
* Create an instance of the given handler. | ||
* | ||
* @param $handler | ||
* @return array | ||
*/ | ||
|
||
public function resolve ($handler) | ||
{ | ||
if(is_array($handler) and is_string($handler[0])) | ||
{ | ||
$handler[0] = new $handler[0]; | ||
} | ||
|
||
return $handler; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
namespace Phroute; | ||
|
||
interface HandlerResolverInterface { | ||
|
||
/** | ||
* Create an instance of the given handler. | ||
* | ||
* @param $handler | ||
* @return array | ||
*/ | ||
|
||
public function resolve($handler); | ||
} |