forked from hetao29/slightphp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSRestServer.php
More file actions
33 lines (33 loc) · 1.45 KB
/
SRestServer.php
File metadata and controls
33 lines (33 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
/*{{{LICENSE
+-----------------------------------------------------------------------+
| SlightPHP Framework |
+-----------------------------------------------------------------------+
| This program is free software; you can redistribute it and/or modify |
| it under the terms of the GNU General Public License as published by |
| the Free Software Foundation. You should have received a copy of the |
| GNU General Public License along with this program. If not, see |
| http://www.gnu.org/licenses/. |
| Copyright (C) 2008-2009. All Rights Reserved. |
+-----------------------------------------------------------------------+
| Supports: http://www.slightphp.com |
+-----------------------------------------------------------------------+
}}}*/
/**
* @package SlightPHP
*/
abstract class SRestServer{
private $_allowMethods=array("PUT","POST","GET","HEAD","DELETE","OPTIONS");
private $_method="GET";
public function __call($name,$arguments){
if(!empty($_SERVER['REQUEST_METHOD']) && in_array($_SERVER['REQUEST_METHOD'],$this->_allowMethods)){
$this->_method = $_SERVER['REQUEST_METHOD'];
}
$method=$this->_method.$arguments[0][2];
if(method_exists($this,$method)){
return call_user_func(array($this,$method),$arguments[0]);
}else{
return false;
}
}
}