///
const REQUEST_METHOD_POST = 1;
const REQUEST_METHOD_GET = 2;
public function method($method = null) {
switch ($method) {
case null:
return function() {
if($_SERVER['REQUEST_METHOD'] === 'post') {
return self::REQUEST_METHOD_POST;
} elseif($_SERVER['REQUEST_METHOD'] === 'get') {
return self::REQUEST_METHOD_GET;
} else {
return false;
}
};
///