Skip to content

Instantly share code, notes, and snippets.

@joshtronic
Created October 12, 2014 13:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshtronic/ff25c069a440c224abad to your computer and use it in GitHub Desktop.
Save joshtronic/ff25c069a440c224abad to your computer and use it in GitHub Desktop.
<?php
class v1_user extends \Pickles\Resource
{
/**
* Has to be broken out by request method as to not cause fall out. The other
* option could be to grab all of the method names, loop through and look for
* the largest revision number (if the revision is not specified and _METHOD()
* doesn't exist
**/
private $get_latest = 20141011;
public function GET_20140101()
{
// ...
}
public function GET_20140101()
{
// ...
}
public function GET_20141011()
{
// latest...
}
}
<?php
class v1_user extends \Pickles\Resource
{
public function GET()
{
switch ($revision)
{
case 20140101:
// ...
break;
case 20140601:
// ...
break;
case 20141011:
default:
// latest...
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment