Created
September 17, 2012 02:30
-
-
Save alganet/3735253 to your computer and use it in GitHub Desktop.
Framework-style Respect\Rest controllers
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
<?php | |
class MyUser implements Routable, Routinable, ProxyableWhen | |
{ | |
public $path = '/users'; | |
//Routinable | |
public function applyRoutines(AbstractRoute $route) | |
{ | |
$route->userAgent(array('firefox' => function($data) { | |
return makeMoreAwesome($data); | |
})); | |
} | |
//ProxyableWhen | |
public function when() | |
{ | |
return isset($_GET['crazy_idea_key']); | |
} | |
public function get() | |
{ | |
return array("John", "Carl"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment