--- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/github_ApcCache.php +++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/client_ApcCache.php @@ -13,7 +13,7 @@ * @copyright 2013 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * + * @version 3.0.0rc6 */ class ApcCache implements iCache { --- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/github_AutoLoader.php +++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/client_AutoLoader.php @@ -12,7 +12,7 @@ * @subpackage helper * @author Nick Lombard * @copyright 2012 Luracast - * + * @version 3.0.0rc6 */ class AutoLoader { --- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/github_CommentParser.php +++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/client_CommentParser.php @@ -1,5 +1,4 @@ true, - 'select' => true, + 'choice' => true, + 'select' => true, 'properties' => true, ); @@ -221,7 +220,7 @@ */ private function parseParam($param, array $value, array $embedded) { - $data = &$this->_data; + $data = & $this->_data; $allowMultiple = false; switch ($param) { case 'param' : @@ -238,7 +237,7 @@ $value = $this->formatReturn($value); break; case 'class' : - $data = &$data[$param]; + $data = & $data[$param]; list ($param, $value) = $this->formatClass($value); break; case 'access' : @@ -295,7 +294,7 @@ += $data[$param][self::$embeddedDataName]; } if (!is_array($data[$param])) { - $data[$param] = array('description' => (string)$data[$param]); + $data[$param] = array('description' => (string) $data[$param]); } if (is_array($value)) { $data[$param] = $value + $data[$param]; @@ -321,24 +320,19 @@ $data['pattern'] = $matches[2]; } while (preg_match('/{@(\w+)\s?([^}]*)}/ms', $subject, $matches)) { - $name = $matches[1]; - $value = $matches[2]; $subject = str_replace($matches[0], '', $subject); - if ($name == 'pattern') { + if ($matches[1] == 'pattern') { throw new Exception('Inline pattern tag should follow {@pattern /REGEX_PATTERN_HERE/} format and can optionally include PCRE modifiers following the ending `/`'); - } elseif (isset(static::$allowsArrayValue[$name])) { - $value = explode(static::$arrayDelimiter, $value); - } elseif ($value == 'true' || $value == 'false') { - $value = $value == 'true'; - } elseif ($value == '') { - $value = true; - } elseif ($name == 'required') { - $value = explode(static::$arrayDelimiter, $value); - } - if (defined('Luracast\\Restler\\UI\\HtmlForm::'.$name)) { - $value = constant($value); - } - $data[$name] = $value; + } elseif (isset(static::$allowsArrayValue[$matches[1]])) { + $matches[2] = explode(static::$arrayDelimiter, $matches[2]); + } elseif ($matches[2] == 'true' || $matches[2] == 'false') { + $matches[2] = $matches[2] == 'true'; + } elseif ($matches[2] == '') { + $matches[2] = true; + } elseif ($matches[1] == 'required') { + $matches[2] = explode(static::$arrayDelimiter, $matches[2]); + } + $data[$matches[1]] = $matches[2]; } while (preg_match(self::$embeddedDataPattern, $subject, $matches)) { @@ -346,9 +340,9 @@ $str = $matches[self::$embeddedDataIndex]; if (isset ($this->restler) && self::$embeddedDataIndex > 1 - && !empty ($name) + && !empty ($matches[1]) ) { - $extension = $name; + $extension = $matches[1]; $formatMap = $this->restler->getFormatMap(); if (isset ($formatMap[$extension])) { /** @@ -403,15 +397,15 @@ { $code = 500; $exception = 'Exception'; - if (count($value) > 1) { + if(count($value)>1){ $v1 = $value[0]; $v2 = $value[1]; - if (is_numeric($v1)) { + if(is_numeric($v1)){ $code = $v1; $exception = $v2; array_shift($value); array_shift($value); - } elseif (is_numeric($v2)) { + } elseif(is_numeric($v2)){ $code = $v2; $exception = $v1; array_shift($value); @@ -420,17 +414,17 @@ $exception = $v1; array_shift($value); } - } elseif (count($value) && is_numeric($value[0])) { + } elseif(count($value) && is_numeric($value[0])) { $code = $value[0]; array_shift($value); } $message = implode(' ', $value); - if (!isset(RestException::$codes[$code])) { + if(!isset(RestException::$codes[$code])){ $code = 500; - } elseif (empty($message)) { + } elseif(empty($message)){ $message = RestException::$codes[$code]; } - return compact('code', 'message', 'exception'); + return compact('code','message','exception'); } private function formatClass(array $value) --- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/github_Compose.php +++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/client_Compose.php @@ -11,7 +11,7 @@ * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * + * @version 3.0.0rc6 */ class Compose implements iCompose { --- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/github_Defaults.php +++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/client_Defaults.php @@ -15,7 +15,7 @@ * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * + * @version 3.0.0rc6 */ class Defaults { --- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/github_EventDispatcher.php +++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/client_EventDispatcher.php @@ -9,7 +9,7 @@ * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * + * @version 3.0.0rc6 */ use Closure; --- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/github_Flash.php +++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/client_Flash.php @@ -15,7 +15,7 @@ * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * + * @version 3.0.0rc6 */ class Flash implements ArrayAccess { --- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/github_HumanReadableCache.php +++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/client_HumanReadableCache.php @@ -10,7 +10,7 @@ * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * + * @version 3.0.0rc6 */ class HumanReadableCache implements iCache { --- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/github_InvalidAuthCredentials.php +++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/client_InvalidAuthCredentials.php @@ -12,7 +12,7 @@ * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * + * @version 3.0.0rc6 */ --- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/github_PassThrough.php +++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/client_PassThrough.php @@ -10,7 +10,7 @@ * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * + * @version 3.0.0rc6 */ class PassThrough { --- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/github_Redirect.php +++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/client_Redirect.php @@ -12,7 +12,7 @@ * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * + * @version 3.0.0rc6 */ class Redirect { --- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/github_Resources.php +++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/client_Resources.php @@ -15,7 +15,7 @@ * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * + * @version 3.0.0rc6 */ class Resources implements iUseAuthentication, iProvideMultiVersionApi { --- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/github_RestException.php +++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/client_RestException.php @@ -14,7 +14,7 @@ * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * + * @version 3.0.0rc6 */ class RestException extends Exception --- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/github_Restler.php +++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/client_Restler.php @@ -15,14 +15,13 @@ * inspired by the RestServer code from * * - * * @category Framework * @package Restler * @author R.Arul Kumaran * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * + * @version 3.0.0rc6 * * @method static void onGet() onGet(Callable $function) fired before reading the request details * @method static void onRoute() onRoute(Callable $function) fired before finding the api method @@ -49,13 +48,10 @@ * @method void onRespond() onRespond(Callable $function) fired before sending response * @method void onComplete() onComplete(Callable $function) fired after sending response * @method void onMessage() onMessage(Callable $function) fired before composing error response - * - * @property bool|null _authenticated - * @property bool _authVerified */ class Restler extends EventDispatcher { - const VERSION = '3.1.0'; + const VERSION = '3.0.0rc6'; // ================================================================== // @@ -697,8 +693,6 @@ * - media type * - charset * - language - * - * @throws RestException */ protected function negotiate() { --- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/github_Routes.php +++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/client_Routes.php @@ -17,7 +17,7 @@ * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * + * @version 3.0.0rc6 */ class Routes { --- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/github_Scope.php +++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/client_Scope.php @@ -1,6 +1,4 @@ 'Luracast\Restler\Resources', 'Explorer' => 'Luracast\Restler\Explorer\v2\Explorer', - 'Explorer1' => 'Luracast\Restler\Explorer\v1\Explorer', - 'Explorer2' => 'Luracast\Restler\Explorer\v2\Explorer', + 'Explorer1' => 'Luracast\Restler\Explorer\v1\Explorer', + 'Explorer2' => 'Luracast\Restler\Explorer\v2\Explorer', //Cache classes 'HumanReadableCache' => 'Luracast\Restler\HumanReadableCache', @@ -122,7 +120,6 @@ $r = new $fullName(); static::$instances[$name] = (object)array('instance' => $r); if ($name != 'Restler') { - /** @var Restler restler */ $r->restler = static::get('Restler'); $m = Util::nestedValue($r->restler, 'apiMethodInfo', 'metadata'); if ($m) { @@ -141,14 +138,15 @@ } if ( $r instanceof iUseAuthentication && - $r->restler && $r->restler->_authVerified && + static::get('Restler')->_authVerified && !isset(static::$instances[$name]->authVerified) ) { static::$instances[$name]->authVerified = true; - $r->__setAuthenticationStatus($r->restler->_authenticated); + $r->__setAuthenticationStatus + (static::get('Restler')->_authenticated); } if (isset(static::$instances[$name]->initPending)) { - $m = Util::nestedValue($r->restler, 'apiMethodInfo', 'metadata'); + $m = Util::nestedValue(static::get('Restler'), 'apiMethodInfo', 'metadata'); $fullName = $name; if (class_exists($name)) { $shortName = Util::getShortName($name); @@ -196,15 +194,15 @@ */ public static function resolve($className, array $scope) { - if (empty($className) || !is_string($className)) { + if (empty($className) || !is_string($className)) return false; - } if (self::isPrimitiveDataType($className)) { return false; } $divider = '\\'; + $qualified = false; if ($className[0] == $divider) { $qualified = trim($className, $divider); } elseif (array_key_exists($className, $scope)) { @@ -212,21 +210,18 @@ } else { $qualified = $scope['*'] . $className; } - if (class_exists($qualified)) { + if (class_exists($qualified)) return $qualified; - } if (isset(static::$classAliases[$className])) { $qualified = static::$classAliases[$className]; - if (class_exists($qualified)) { + if (class_exists($qualified)) return $qualified; - } } return false; } /** * @param string $stringName - * * @return boolean */ private static function isPrimitiveDataType($stringName) --- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/github_User.php +++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/client_User.php @@ -11,7 +11,7 @@ * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * + * @version 3.0.0rc6 */ class User implements iIdentifyUser { --- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/github_Util.php +++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/client_Util.php @@ -1,7 +1,5 @@ 0) { + if (strlen($resourcePath) > 0) $resourcePath .= '/'; - } return $prefix . $resourcePath; } @@ -121,9 +114,8 @@ */ public static function removeCommonPath($fromPath, $usingPath, $char = '/') { - if (empty($fromPath)) { + if (empty($fromPath)) return ''; - } $fromPath = explode($char, $fromPath); $usingPath = explode($char, $usingPath); while (count($usingPath)) { @@ -153,9 +145,8 @@ */ public static function splitCommonPath($fromPath, $usingPath, $char = '/') { - if (empty($fromPath)) { + if (empty($fromPath)) return array('', ''); - } $fromPath = explode($char, $fromPath); $usingPath = explode($char, $usingPath); $commonPath = array(); @@ -222,18 +213,11 @@ $accepts = array($accepts); } foreach ($accepts as $pos => $accept) { - $parts = explode(';', $accept); - $type = trim(array_shift($parts)); - $parameters = []; - foreach ($parts as $part) { - $part = explode('=', $part); - if (2 !== count($part)) { - continue; - } - $key = strtolower(trim($part[0])); - $parameters[$key] = trim($part[1], ' "'); - } - $quality = isset($parameters['q']) ? (float)$parameters['q'] : (1000 - $pos) / 1000; + $parts = explode(';q=', trim($accept)); + $type = array_shift($parts); + $quality = count($parts) ? + floatval(array_shift($parts)) : + (1000 - $pos) / 1000; $acceptList[$type] = $quality; } arsort($acceptList); @@ -243,7 +227,8 @@ public static function getShortName($className) { // @CHANGE LDR - if (!is_string($className)) return; + if (! is_string($className)) return ''; + //var_dump($className); $className = explode('\\', $className); return end($className); --- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/github_iAuthenticate.php +++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/client_iAuthenticate.php @@ -11,7 +11,7 @@ * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * + * @version 3.0.0rc6 */ interface iAuthenticate extends iFilter { --- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/github_iCache.php +++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/client_iCache.php @@ -9,7 +9,7 @@ * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * + * @version 3.0.0rc6 */ interface iCache { --- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/github_iCompose.php +++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/client_iCompose.php @@ -13,7 +13,7 @@ * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * + * @version 3.0.0rc6 */ interface iCompose { /** --- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/github_iFilter.php +++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/client_iFilter.php @@ -12,7 +12,7 @@ * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * + * @version 3.0.0rc6 */ interface iFilter { --- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/github_iIdentifyUser.php +++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/client_iIdentifyUser.php @@ -12,7 +12,7 @@ * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * + * @version 3.0.0rc6 */ interface iIdentifyUser { --- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/github_iProvideMultiVersionApi.php +++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/client_iProvideMultiVersionApi.php @@ -5,7 +5,7 @@ * Interface iProvideMultiVersionApi * @package Luracast\Restler * - * + * @version 3.0.0rc6 */ interface iProvideMultiVersionApi { --- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/github_iUseAuthentication.php +++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/client_iUseAuthentication.php @@ -11,7 +11,7 @@ * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * + * @version 3.0.0rc6 */ interface iUseAuthentication {