diff --git a/ANNOTATIONS.md b/ANNOTATIONS.md index 2f307c4f9..ae980cd2c 100644 --- a/ANNOTATIONS.md +++ b/ANNOTATIONS.md @@ -179,7 +179,7 @@ iValueObject. @var int policy age {@min 18} {@max 100} When an api method is returning or having one of the parameters as an instance -of a custom class @var comments can be used with properties of that class. +of a custom class @var comments can be used with properties of that class. They will be used for validation and documentation. Supported child attributes are same as that of @param so they are documented under [@param](PARAM.md) @@ -223,4 +223,4 @@ Specify the view file to be loaded by HtmlFormat for the given api method as rel Similar to the `@view` but only used when an exception is thrown ---------------- \ No newline at end of file +--------------- diff --git a/README.md b/README.md index efc20f328..390f5d1e5 100644 --- a/README.md +++ b/README.md @@ -298,7 +298,7 @@ They are documented in detail under [Annotations](ANNOTATIONS.md) ### 6. Authorize -In order to protect your api, authenticate and allow valid users +In order to protect your api, authenticate and allow valid users ```php _data); - if (!String::contains($data, $response)) + if (!Text::contains($data, $response)) throw new Exception("Response value does not contain '$response' only\n\n" . $this->echoLastResponse()); } diff --git a/public/annotations.html b/public/annotations.html index 9663ae22f..f6032c553 100644 --- a/public/annotations.html +++ b/public/annotations.html @@ -325,7 +325,7 @@

@format

Example:

-
@pformat HtmlFormat
+
@format HtmlFormat
 

IF you want to force the request and or response format for a specific api method @format comment can be used

@@ -364,4 +364,4 @@

@errorView

- \ No newline at end of file + diff --git a/public/examples/_005_protected_api/SimpleAuth.php b/public/examples/_005_protected_api/SimpleAuth.php index 938d8ac67..e15686e71 100755 --- a/public/examples/_005_protected_api/SimpleAuth.php +++ b/public/examples/_005_protected_api/SimpleAuth.php @@ -5,12 +5,12 @@ class SimpleAuth implements iAuthenticate { const KEY = 'rEsTlEr2'; - function __isAllowed() + function isAllowed() { return isset($_GET['key']) && $_GET['key'] == SimpleAuth::KEY ? TRUE : FALSE; } - public function __getWWWAuthenticateString() + public function getWWWAuthenticateString() { return 'Query name="key"'; } @@ -19,4 +19,4 @@ function key() { return SimpleAuth::KEY; } -} \ No newline at end of file +} diff --git a/public/examples/_007_crud/DB/Session.php b/public/examples/_007_crud/DB/Session.php index 844c6650c..37244983a 100755 --- a/public/examples/_007_crud/DB/Session.php +++ b/public/examples/_007_crud/DB/Session.php @@ -55,7 +55,8 @@ function delete ($id) $index = $this->find($id); if ($index === FALSE) return FALSE; - return array_shift(array_splice($_SESSION['rs'], $index, 1)); + $record = array_splice($_SESSION['rs'], $index, 1); + return array_shift($record); } private function install () { diff --git a/public/examples/_009_rate_limiting/KeyAuth.php b/public/examples/_009_rate_limiting/KeyAuth.php index 0309040aa..a444e3e83 100755 --- a/public/examples/_009_rate_limiting/KeyAuth.php +++ b/public/examples/_009_rate_limiting/KeyAuth.php @@ -3,12 +3,12 @@ class KeyAuth implements iAuthenticate { - public function __isAllowed() + public function isAllowed() { return isset($_GET['api_key']) && $_GET['api_key'] == 'r3rocks'; } - public function __getWWWAuthenticateString() + public function getWWWAuthenticateString() { return 'Query name="api_key"'; } diff --git a/public/examples/_010_access_control/AccessControl.php b/public/examples/_010_access_control/AccessControl.php index b242d947b..cc548621e 100755 --- a/public/examples/_010_access_control/AccessControl.php +++ b/public/examples/_010_access_control/AccessControl.php @@ -8,7 +8,7 @@ class AccessControl implements iAuthenticate public static $requires = 'user'; public static $role = 'user'; - public function __isAllowed() + public function isAllowed() { //hardcoded api_key=>role for brevity $roles = array('12345' => 'user', '67890' => 'admin'); @@ -28,7 +28,7 @@ public function __isAllowed() return static::$requires == static::$role || static::$role == 'admin'; } - public function __getWWWAuthenticateString() + public function getWWWAuthenticateString() { return 'Query name="api_key"'; } diff --git a/public/examples/_011_versioning/index.php b/public/examples/_011_versioning/index.php index 4c972f419..4c9640774 100755 --- a/public/examples/_011_versioning/index.php +++ b/public/examples/_011_versioning/index.php @@ -38,7 +38,7 @@ Which will be `Luracast\WeightManagement\v2` for this example If a class remains the same across few versions of the api, we can implement -`iProvideMultiVersionApi` interface which is simply defining `__getMaximumSupportedVersion` +`iProvideMultiVersionApi` interface which is simply defining `getMaximumSupportedVersion` method which returns the maximum supported version. Take a look at `Resources` class for a sample implementation. @@ -111,4 +111,4 @@ class for a sample implementation. $r->setAPIVersion(2); $r->addAPIClass('BMI'); $r->addAPIClass('Resources'); -$r->handle(); \ No newline at end of file +$r->handle(); diff --git a/public/examples/_015_oauth2_server/Auth/Server.php b/public/examples/_015_oauth2_server/Auth/Server.php index e5fd11ab1..c3bed96dd 100644 --- a/public/examples/_015_oauth2_server/Auth/Server.php +++ b/public/examples/_015_oauth2_server/Auth/Server.php @@ -134,12 +134,12 @@ public function access() * * @return boolean true when api access is allowed; false otherwise */ - public function __isAllowed() + public function isAllowed() { return self::$server->verifyResourceRequest(static::$request); } - public function __getWWWAuthenticateString() + public function getWWWAuthenticateString() { return 'Bearer realm="example"'; } diff --git a/public/examples/_015_oauth2_server/index.php b/public/examples/_015_oauth2_server/index.php index 3f00fa7e7..edc82a1ad 100755 --- a/public/examples/_015_oauth2_server/index.php +++ b/public/examples/_015_oauth2_server/index.php @@ -12,7 +12,7 @@ 1. run composer update to make sure you have - twig template library - - bshaffer's oauth2 libaray + - bshaffer's oauth2 library 2. make sure `public/examples/_015_oauth2_server/cache` has write permissions to create the compiled template files 3. make sure `public/examples/_015_oauth2_server/Auth/db` has write permission, this is where `oauth.sqlite` file be created at run time @@ -51,7 +51,7 @@ - **Implicit**: typically for browser based or mobile apps - **Authorization Code**: typically for apps running on a server -- **Password Credentials**: typically used for apps that are owned by the same organisation as the OAuth service +- **Password Credentials**: typically used for apps that are owned by the same organization as the OAuth service provider (aka, the Twitter client, etc.) - **Client Credentials**: used by client's who want to update meta information about their site (URL's, logo's, etc.) - **JWT Auth Grant**: the client submits a *JSON Web Token* in a request to the token endpoint. An access token @@ -136,4 +136,4 @@ $r = new Restler(); $r->addAuthenticationClass('Auth\\Server', ''); $r->setOverridingFormats('JsonFormat', 'HtmlFormat', 'UploadFormat'); -$r->handle(); \ No newline at end of file +$r->handle(); diff --git a/public/examples/resources/getsource.php b/public/examples/resources/getsource.php index 0a2104888..efc1c55c2 100755 --- a/public/examples/resources/getsource.php +++ b/public/examples/resources/getsource.php @@ -4,15 +4,19 @@ $require_comments = $file[0] == '.'; $file = '../' . $file; $filepath = realpath($file); - $basepath = realpath('../../'); - if (strpos($basepath, $filepath) === 0) { + $basepath = realpath('../../examples'); + if (strpos($filepath, $basepath) !== 0) { #trying to get the source outside restler examples die('not allowed'); } - if (!file_exists($file)) die('file not found'); + if (!file_exists($file)) { + die('file not found'); + } $text = file_get_contents($file); $file = pathinfo($file, PATHINFO_FILENAME) . '.php'; - if (!$require_comments) $text = strip_comments($text); + if (!$require_comments) { + $text = strip_comments($text); + } die($file . '
' . htmlspecialchars($text) . "
"); } else { die('no file specified'); diff --git a/vendor/Luracast/Restler/AutoLoader.php b/vendor/Luracast/Restler/AutoLoader.php index 9bb34bad9..6e9a3dd17 100644 --- a/vendor/Luracast/Restler/AutoLoader.php +++ b/vendor/Luracast/Restler/AutoLoader.php @@ -263,7 +263,7 @@ private function loadAliases($className) * @return bool false unless className now exists */ private function loadLastResort($className, $loader = null) { - $loaders = array_unique(static::$rogueLoaders); + $loaders = array_unique(static::$rogueLoaders, SORT_REGULAR); if (isset($loader)) { if (false === array_search($loader, $loaders)) static::$rogueLoaders[] = $loader; diff --git a/vendor/Luracast/Restler/CommentParser.php b/vendor/Luracast/Restler/CommentParser.php index 839983b73..e86d1fbad 100644 --- a/vendor/Luracast/Restler/CommentParser.php +++ b/vendor/Luracast/Restler/CommentParser.php @@ -195,7 +195,7 @@ private function extractData($comment) list(, $param, $value) = preg_split('/\@|\s/', $line, 3) + array('', '', ''); list($value, $embedded) = $this->parseEmbeddedData($value); - $value = array_filter(preg_split('/\s+/msu', $value)); + $value = array_filter(preg_split('/\s+/msu', $value),'strlen'); $this->parseParam($param, $value, $embedded); } return $this->_data; diff --git a/vendor/Luracast/Restler/Data/Object.php b/vendor/Luracast/Restler/Data/Obj.php similarity index 99% rename from vendor/Luracast/Restler/Data/Object.php rename to vendor/Luracast/Restler/Data/Obj.php index b34f82f0b..5978dbae9 100644 --- a/vendor/Luracast/Restler/Data/Object.php +++ b/vendor/Luracast/Restler/Data/Obj.php @@ -13,7 +13,7 @@ * @link http://luracast.com/products/restler/ * @version 3.0.0rc5 */ -class Object +class Obj { /** * @var bool|string|callable diff --git a/vendor/Luracast/Restler/Data/String.php b/vendor/Luracast/Restler/Data/Text.php similarity index 99% rename from vendor/Luracast/Restler/Data/String.php rename to vendor/Luracast/Restler/Data/Text.php index 268ca40c1..803d9a761 100644 --- a/vendor/Luracast/Restler/Data/String.php +++ b/vendor/Luracast/Restler/Data/Text.php @@ -11,7 +11,7 @@ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ */ -class String +class Text { /** * Given haystack contains the needle or not? diff --git a/vendor/Luracast/Restler/Data/ValueObject.php b/vendor/Luracast/Restler/Data/ValueObject.php index 811c170ac..9b36235d1 100644 --- a/vendor/Luracast/Restler/Data/ValueObject.php +++ b/vendor/Luracast/Restler/Data/ValueObject.php @@ -45,7 +45,7 @@ public static function __set_state(array $properties) return $instance; } - public function __toArray() + public function toArray() { $r = get_object_vars($this); $methods = get_class_methods($this); diff --git a/vendor/Luracast/Restler/Defaults.php b/vendor/Luracast/Restler/Defaults.php index 98b972024..b6ec83272 100644 --- a/vendor/Luracast/Restler/Defaults.php +++ b/vendor/Luracast/Restler/Defaults.php @@ -233,7 +233,7 @@ class Defaults * @var string authentication method to be called in iAuthenticate * Interface */ - public static $authenticationMethod = '__isAllowed'; + public static $authenticationMethod = 'isAllowed'; /** * @var int time in milliseconds for bandwidth throttling, diff --git a/vendor/Luracast/Restler/Filter/RateLimit.php b/vendor/Luracast/Restler/Filter/RateLimit.php index 99539f70e..24daa9c81 100644 --- a/vendor/Luracast/Restler/Filter/RateLimit.php +++ b/vendor/Luracast/Restler/Filter/RateLimit.php @@ -74,7 +74,7 @@ public static function setLimit( is_null($authenticatedUsagePerUnit) ? $usagePerUnit : $authenticatedUsagePerUnit; } - public function __isAllowed() + public function isAllowed() { if (static::$authenticatedUsagePerUnit == static::$usagePerUnit @@ -82,7 +82,7 @@ public function __isAllowed() return null; } - public function __setAuthenticationStatus($isAuthenticated = false) + public function setAuthenticationStatus($isAuthenticated = false) { header('X-Auth-Status: ' . ($isAuthenticated ? 'true' : 'false')); $this->check($isAuthenticated); @@ -175,4 +175,4 @@ private function duration($secs) } return implode(' ', $ret); //." $unit."; } -} \ No newline at end of file +} diff --git a/vendor/Luracast/Restler/Format/CsvFormat.php b/vendor/Luracast/Restler/Format/CsvFormat.php index c0dedf1b5..265070562 100644 --- a/vendor/Luracast/Restler/Format/CsvFormat.php +++ b/vendor/Luracast/Restler/Format/CsvFormat.php @@ -2,7 +2,7 @@ namespace Luracast\Restler\Format; -use Luracast\Restler\Data\Object; +use Luracast\Restler\Data\Obj; use Luracast\Restler\RestException; /** @@ -44,10 +44,10 @@ class CsvFormat extends Format implements iDecodeStream */ public function encode($data, $humanReadable = false) { - $char = Object::$separatorChar; - Object::$separatorChar = false; - $data = Object::toArray($data); - Object::$separatorChar = $char; + $char = Obj::$separatorChar; + Obj::$separatorChar = false; + $data = Obj::toArray($data); + Obj::$separatorChar = $char; if (is_array($data) && array_values($data) == $data) { //if indexed array $lines = array(); @@ -109,10 +109,10 @@ public function decode($data) while (($row = static::getRow(array_shift($lines), $keys)) !== FALSE) $decoded [] = $row; - $char = Object::$separatorChar; - Object::$separatorChar = false; - $decoded = Object::toArray($decoded); - Object::$separatorChar = $char; + $char = Obj::$separatorChar; + Obj::$separatorChar = false; + $decoded = Obj::toArray($decoded); + Obj::$separatorChar = $char; return $decoded; } @@ -172,10 +172,10 @@ public function decodeStream($stream) while (($row = static::getRow(stream_get_line($stream, 0, PHP_EOL), $keys)) !== FALSE) $decoded [] = $row; - $char = Object::$separatorChar; - Object::$separatorChar = false; - $decoded = Object::toArray($decoded); - Object::$separatorChar = $char; + $char = Obj::$separatorChar; + Obj::$separatorChar = false; + $decoded = Obj::toArray($decoded); + Obj::$separatorChar = $char; return $decoded; } } \ No newline at end of file diff --git a/vendor/Luracast/Restler/Format/HtmlFormat.php b/vendor/Luracast/Restler/Format/HtmlFormat.php index 65d2bb627..c9679990d 100644 --- a/vendor/Luracast/Restler/Format/HtmlFormat.php +++ b/vendor/Luracast/Restler/Format/HtmlFormat.php @@ -11,7 +11,7 @@ use Illuminate\View\FileViewFinder; use Illuminate\View\View; use Luracast\Restler\Data\ApiMethodInfo; -use Luracast\Restler\Data\Object; +use Luracast\Restler\Data\Obj; use Luracast\Restler\Defaults; use Luracast\Restler\RestException; use Luracast\Restler\Restler; @@ -313,7 +313,7 @@ public function encode($data, $humanReadable = false) $success = is_null($exception); $error = $success ? null : $exception->getMessage(); $data = array( - 'response' => Object::toArray($data), + 'response' => Obj::toArray($data), 'stages' => $this->restler->getEvents(), 'success' => $success, 'error' => $error diff --git a/vendor/Luracast/Restler/Format/JsonFormat.php b/vendor/Luracast/Restler/Format/JsonFormat.php index 1b7fd938c..e853181af 100644 --- a/vendor/Luracast/Restler/Format/JsonFormat.php +++ b/vendor/Luracast/Restler/Format/JsonFormat.php @@ -1,7 +1,7 @@ formatJson($result); if (self::$unEscapedUnicode) { $result = preg_replace_callback('/\\\u(\w\w\w\w)/', @@ -110,7 +110,7 @@ public function decode($data) if (function_exists('json_last_error')) { switch (json_last_error()) { case JSON_ERROR_NONE : - return Object::toArray($decoded); + return Obj::toArray($decoded); break; case JSON_ERROR_DEPTH : $message = 'maximum stack depth exceeded'; @@ -137,7 +137,7 @@ public function decode($data) throw new RestException (400, 'Error parsing JSON'); } - return Object::toArray($decoded); + return Obj::toArray($decoded); } /** diff --git a/vendor/Luracast/Restler/Format/PlistFormat.php b/vendor/Luracast/Restler/Format/PlistFormat.php index 2c645eb0d..d01a1c338 100644 --- a/vendor/Luracast/Restler/Format/PlistFormat.php +++ b/vendor/Luracast/Restler/Format/PlistFormat.php @@ -1,7 +1,7 @@ toCFType( - Object::toArray($data) + Obj::toArray($data) ); $plist->add($guessedStructure); diff --git a/vendor/Luracast/Restler/Format/XmlFormat.php b/vendor/Luracast/Restler/Format/XmlFormat.php index 52fe50c67..172544806 100644 --- a/vendor/Luracast/Restler/Format/XmlFormat.php +++ b/vendor/Luracast/Restler/Format/XmlFormat.php @@ -1,7 +1,7 @@ openMemory(); $xml->startDocument('1.0', $this->charset); diff --git a/vendor/Luracast/Restler/Format/YamlFormat.php b/vendor/Luracast/Restler/Format/YamlFormat.php index d87ad7bbc..373247220 100644 --- a/vendor/Luracast/Restler/Format/YamlFormat.php +++ b/vendor/Luracast/Restler/Format/YamlFormat.php @@ -2,7 +2,7 @@ namespace Luracast\Restler\Format; use Symfony\Component\Yaml\Yaml; -use Luracast\Restler\Data\Object; +use Luracast\Restler\Data\Obj; /** * YAML Format for Restler Framework @@ -24,7 +24,7 @@ class YamlFormat extends Format public function encode($data, $humanReadable = false) { // require_once 'sfyaml.php'; - return @Yaml::dump(Object::toArray($data)); + return @Yaml::dump(Obj::toArray($data)); } public function decode($data) diff --git a/vendor/Luracast/Restler/Resources.php b/vendor/Luracast/Restler/Resources.php index 23d2407c4..f65a37510 100644 --- a/vendor/Luracast/Restler/Resources.php +++ b/vendor/Luracast/Restler/Resources.php @@ -1,7 +1,7 @@ _authenticated = $isAuthenticated; } @@ -226,14 +226,14 @@ public function get($id = '') continue; } $fullPath = $route['url']; - if ($fullPath !== $target && !String::beginsWith($fullPath, $target)) { + if ($fullPath !== $target && !Text::beginsWith($fullPath, $target)) { continue; } $fLen = strlen($fullPath); if ($tSlash) { - if ($fLen != $tLen && !String::beginsWith($fullPath, $target . '/')) + if ($fLen != $tLen && !Text::beginsWith($fullPath, $target . '/')) continue; - } elseif ($fLen > $tLen + 1 && $fullPath{$tLen + 1} != '{' && !String::beginsWith($fullPath, '{')) { + } elseif ($fLen > $tLen + 1 && $fullPath{$tLen + 1} != '{' && !Text::beginsWith($fullPath, '{')) { //when mapped to root exclude paths that have static parts //they are listed else where under that static part name continue; @@ -246,7 +246,7 @@ public function get($id = '') if (empty($exclude)) { if ($fullPath == $exclude) continue 2; - } elseif (String::beginsWith($fullPath, $exclude)) { + } elseif (Text::beginsWith($fullPath, $exclude)) { continue 2; } } @@ -891,7 +891,7 @@ public function index() } $this->_mapResources($allRoutes, $map, $version); foreach ($map as $path => $description) { - if (!String::contains($path, '{')) { + if (!Text::contains($path, '{')) { //add id $r->apis[] = array( 'path' => $path . $this->formatString, @@ -934,7 +934,7 @@ protected function _mapResources(array $allRoutes, array &$map, $version = 1) foreach ($allRoutes as $fullPath => $routes) { $path = explode('/', $fullPath); $resource = isset($path[0]) ? $path[0] : ''; - if ($resource == 'resources' || String::endsWith($resource, 'index')) + if ($resource == 'resources' || Text::endsWith($resource, 'index')) continue; foreach ($routes as $httpMethod => $route) { if (in_array($httpMethod, static::$excludedHttpMethods)) { @@ -948,7 +948,7 @@ protected function _mapResources(array $allRoutes, array &$map, $version = 1) if (empty($exclude)) { if ($fullPath == $exclude) continue 2; - } elseif (String::beginsWith($fullPath, $exclude)) { + } elseif (Text::beginsWith($fullPath, $exclude)) { continue 2; } } @@ -970,7 +970,7 @@ protected function _mapResources(array $allRoutes, array &$map, $version = 1) * Maximum api version supported by the api class * @return int */ - public static function __getMaximumSupportedVersion() + public static function getMaximumSupportedVersion() { return Scope::get('Restler')->getApiVersion(); } diff --git a/vendor/Luracast/Restler/Restler.php b/vendor/Luracast/Restler/Restler.php index 99c00a89e..65deec642 100644 --- a/vendor/Luracast/Restler/Restler.php +++ b/vendor/Luracast/Restler/Restler.php @@ -850,7 +850,7 @@ protected function preAuthFilter() throw new RestException ( 500, 'Filter Class ' . 'should implement iFilter'); - } else if (!($ok = $filterObj->__isAllowed())) { + } else if (!($ok = $filterObj->isAllowed())) { if (is_null($ok) && $filterObj instanceof iUseAuthentication ) { @@ -1080,7 +1080,7 @@ protected function respond() } if ($this->responseCode == 401) { $authString = count($this->authClasses) - ? Scope::get($this->authClasses[0])->__getWWWAuthenticateString() + ? Scope::get($this->authClasses[0])->getWWWAuthenticateString() : 'Unknown'; @header('WWW-Authenticate: ' . $authString, false); } @@ -1231,7 +1231,7 @@ public function addAPIClass($className, $resourcePath = null) $className = Scope::$classAliases[$className]; } if (!$this->cached) { - $maxVersionMethod = '__getMaximumSupportedVersion'; + $maxVersionMethod = 'getMaximumSupportedVersion'; if (class_exists($className)) { if (method_exists($className, $maxVersionMethod)) { $max = $className::$maxVersionMethod(); diff --git a/vendor/Luracast/Restler/Routes.php b/vendor/Luracast/Restler/Routes.php index 5b1128cb5..77209c7ac 100644 --- a/vendor/Luracast/Restler/Routes.php +++ b/vendor/Luracast/Restler/Routes.php @@ -2,7 +2,7 @@ namespace Luracast\Restler; use Luracast\Restler\Data\ApiMethodInfo; -use Luracast\Restler\Data\String; +use Luracast\Restler\Data\Text; use ReflectionClass; use ReflectionMethod; use ReflectionProperty; @@ -587,7 +587,7 @@ protected static function getTypeAndModel(ReflectionClass $class, array $scope) $children[$name] = $child; } } catch (Exception $e) { - if (String::endsWith($e->getFile(), 'CommentParser.php')) { + if (Text::endsWith($e->getFile(), 'CommentParser.php')) { throw new RestException(500, "Error while parsing comments of `$className` class. " . $e->getMessage()); } throw $e; diff --git a/vendor/Luracast/Restler/Scope.php b/vendor/Luracast/Restler/Scope.php index a6b1baae5..57dd4ac0f 100644 --- a/vendor/Luracast/Restler/Scope.php +++ b/vendor/Luracast/Restler/Scope.php @@ -17,45 +17,45 @@ class Scope { public static $classAliases = array( - //Core - 'Restler' => 'Luracast\Restler\Restler', + //Core + 'Restler' => 'Luracast\Restler\Restler', - //Format classes - 'AmfFormat' => 'Luracast\Restler\Format\AmfFormat', - 'JsFormat' => 'Luracast\Restler\Format\JsFormat', - 'JsonFormat' => 'Luracast\Restler\Format\JsonFormat', - 'HtmlFormat' => 'Luracast\Restler\Format\HtmlFormat', - 'PlistFormat' => 'Luracast\Restler\Format\PlistFormat', - 'UploadFormat' => 'Luracast\Restler\Format\UploadFormat', - 'UrlEncodedFormat' => 'Luracast\Restler\Format\UrlEncodedFormat', - 'XmlFormat' => 'Luracast\Restler\Format\XmlFormat', - 'YamlFormat' => 'Luracast\Restler\Format\YamlFormat', - 'CsvFormat' => 'Luracast\Restler\Format\CsvFormat', - 'TsvFormat' => 'Luracast\Restler\Format\TsvFormat', + //Format classes + 'AmfFormat' => 'Luracast\Restler\Format\AmfFormat', + 'JsFormat' => 'Luracast\Restler\Format\JsFormat', + 'JsonFormat' => 'Luracast\Restler\Format\JsonFormat', + 'HtmlFormat' => 'Luracast\Restler\Format\HtmlFormat', + 'PlistFormat' => 'Luracast\Restler\Format\PlistFormat', + 'UploadFormat' => 'Luracast\Restler\Format\UploadFormat', + 'UrlEncodedFormat' => 'Luracast\Restler\Format\UrlEncodedFormat', + 'XmlFormat' => 'Luracast\Restler\Format\XmlFormat', + 'YamlFormat' => 'Luracast\Restler\Format\YamlFormat', + 'CsvFormat' => 'Luracast\Restler\Format\CsvFormat', + 'TsvFormat' => 'Luracast\Restler\Format\TsvFormat', - //Filter classes - 'RateLimit' => 'Luracast\Restler\Filter\RateLimit', + //Filter classes + 'RateLimit' => 'Luracast\Restler\Filter\RateLimit', - //UI classes - 'Forms' => 'Luracast\Restler\UI\Forms', - 'Nav' => 'Luracast\Restler\UI\Nav', - 'Emmet' => 'Luracast\Restler\UI\Emmet', - 'T' => 'Luracast\Restler\UI\Tags', + //UI classes + 'Forms' => 'Luracast\Restler\UI\Forms', + 'Nav' => 'Luracast\Restler\UI\Nav', + 'Emmet' => 'Luracast\Restler\UI\Emmet', + 'T' => 'Luracast\Restler\UI\Tags', - //API classes - 'Resources' => 'Luracast\Restler\Resources', + //API classes + 'Resources' => 'Luracast\Restler\Resources', - //Cache classes - 'HumanReadableCache' => 'Luracast\Restler\HumanReadableCache', - 'ApcCache' => 'Luracast\Restler\ApcCache', + //Cache classes + 'HumanReadableCache' => 'Luracast\Restler\HumanReadableCache', + 'ApcCache' => 'Luracast\Restler\ApcCache', - //Utility classes - 'Object' => 'Luracast\Restler\Data\Object', - 'String' => 'Luracast\Restler\Data\String', - 'Arr' => 'Luracast\Restler\Data\Arr', + //Utility classes + 'Obj' => 'Luracast\Restler\Data\Obj', + 'String' => 'Luracast\Restler\Data\String', + 'Arr' => 'Luracast\Restler\Data\Arr', - //Exception - 'RestException' => 'Luracast\Restler\RestException' + //Exception + 'RestException' => 'Luracast\Restler\RestException' ); public static $properties = array(); protected static $instances = array(); @@ -116,7 +116,7 @@ public static function get($name) !isset(static::$instances[$name]->authVerified) ) { static::$instances[$name]->authVerified = true; - $r->__setAuthenticationStatus + $r->setAuthenticationStatus (static::get('Restler')->_authenticated); } if (isset(static::$instances[$name]->initPending)) { diff --git a/vendor/Luracast/Restler/UI/Forms.php b/vendor/Luracast/Restler/UI/Forms.php index 289f40b6f..6b8c67780 100644 --- a/vendor/Luracast/Restler/UI/Forms.php +++ b/vendor/Luracast/Restler/UI/Forms.php @@ -3,7 +3,7 @@ use Luracast\Restler\CommentParser; use Luracast\Restler\Data\ApiMethodInfo; -use Luracast\Restler\Data\String; +use Luracast\Restler\Data\Text; use Luracast\Restler\Data\ValidationInfo; use Luracast\Restler\Defaults; use Luracast\Restler\Format\UploadFormat; @@ -292,7 +292,7 @@ public static function field(ValidationInfo $p, $dataOnly = false) $options[] = $option; } } elseif ($p->type == 'boolean' || $p->type == 'bool') { - if (String::beginsWith($type, 'radio')) { + if (Text::beginsWith($type, 'radio')) { $options[] = array('name' => $p->name, 'text' => ' Yes ', 'value' => 'true'); $options[] = array('name' => $p->name, 'text' => ' No ', @@ -399,7 +399,7 @@ public static function key($method = 'POST', $action = null) * * @throws RestException 403 security violation */ - public function __isAllowed() + public function isAllowed() { if (session_id() == '') { session_start(); @@ -411,7 +411,7 @@ public function __isAllowed() if (empty($exclude)) { if ($url == $exclude) return true; - } elseif (String::beginsWith($url, $exclude)) { + } elseif (Text::beginsWith($url, $exclude)) { return true; } } @@ -431,4 +431,4 @@ public function __isAllowed() } return true; } -} \ No newline at end of file +} diff --git a/vendor/Luracast/Restler/compatibility/iAuthenticate.php b/vendor/Luracast/Restler/compatibility/iAuthenticate.php index 0463df948..ad0b4b0f9 100644 --- a/vendor/Luracast/Restler/compatibility/iAuthenticate.php +++ b/vendor/Luracast/Restler/compatibility/iAuthenticate.php @@ -6,5 +6,5 @@ */ interface iAuthenticate { - public function __isAuthenticated(); -} \ No newline at end of file + public function isAuthenticated(); +} diff --git a/vendor/Luracast/Restler/compatibility/restler2.php b/vendor/Luracast/Restler/compatibility/restler2.php index c985ae5bd..e9837c727 100644 --- a/vendor/Luracast/Restler/compatibility/restler2.php +++ b/vendor/Luracast/Restler/compatibility/restler2.php @@ -26,7 +26,7 @@ AutoLoader::seen($classMap); //changes in iAuthenticate -Defaults::$authenticationMethod = '__isAuthenticated'; +Defaults::$authenticationMethod = 'isAuthenticated'; include __DIR__ . '/iAuthenticate.php'; @@ -37,4 +37,4 @@ //changes in parsing embedded data in comments CommentParser::$embeddedDataPattern = '/\((\S+)\)/ms'; -CommentParser::$embeddedDataIndex = 1; \ No newline at end of file +CommentParser::$embeddedDataIndex = 1; diff --git a/vendor/Luracast/Restler/iAuthenticate.php b/vendor/Luracast/Restler/iAuthenticate.php index 6e71f0fc2..8908acc7f 100644 --- a/vendor/Luracast/Restler/iAuthenticate.php +++ b/vendor/Luracast/Restler/iAuthenticate.php @@ -21,5 +21,5 @@ interface iAuthenticate extends iFilter * @example Digest * @example OAuth */ - public function __getWWWAuthenticateString(); + public function getWWWAuthenticateString(); } diff --git a/vendor/Luracast/Restler/iFilter.php b/vendor/Luracast/Restler/iFilter.php index 40205e5de..4fd79676b 100644 --- a/vendor/Luracast/Restler/iFilter.php +++ b/vendor/Luracast/Restler/iFilter.php @@ -24,7 +24,7 @@ interface iFilter * @abstract * @return boolean true when api access is allowed false otherwise */ - public function __isAllowed(); + public function isAllowed(); } diff --git a/vendor/Luracast/Restler/iProvideMultiVersionApi.php b/vendor/Luracast/Restler/iProvideMultiVersionApi.php index ed74dd1b9..e9dd249fa 100644 --- a/vendor/Luracast/Restler/iProvideMultiVersionApi.php +++ b/vendor/Luracast/Restler/iProvideMultiVersionApi.php @@ -7,5 +7,5 @@ interface iProvideMultiVersionApi { * Maximum api version supported by the api class * @return int */ - public static function __getMaximumSupportedVersion(); -} \ No newline at end of file + public static function getMaximumSupportedVersion(); +} diff --git a/vendor/Luracast/Restler/iUseAuthentication.php b/vendor/Luracast/Restler/iUseAuthentication.php index e4e24c02a..e23962ace 100644 --- a/vendor/Luracast/Restler/iUseAuthentication.php +++ b/vendor/Luracast/Restler/iUseAuthentication.php @@ -27,6 +27,6 @@ interface iUseAuthentication * * @return mixed */ - public function __setAuthenticationStatus($isAuthenticated=false); + public function setAuthenticationStatus($isAuthenticated=false); }