--- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/Format/github_AmfFormat.php
+++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/Format/client_AmfFormat.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 AmfFormat extends DependentFormat

 {

--- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/Format/github_CsvFormat.php
+++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/Format/client_CsvFormat.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 CsvFormat extends Format implements iDecodeStream

 {

--- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/Format/github_Format.php
+++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/Format/client_Format.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

  */

 abstract class Format implements iFormat

 {

--- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/Format/github_HtmlFormat.php
+++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/Format/client_HtmlFormat.php
@@ -1,5 +1,4 @@
 <?php

-

 namespace Luracast\Restler\Format;

 

 use Exception;

@@ -7,8 +6,8 @@
 use Illuminate\Filesystem\Filesystem;

 use Illuminate\View\Compilers\BladeCompiler;

 use Illuminate\View\Engines\CompilerEngine;

+use Illuminate\View\Engines\PhpEngine;

 use Illuminate\View\Engines\EngineResolver;

-use Illuminate\View\Engines\PhpEngine;

 use Illuminate\View\Factory;

 use Illuminate\View\FileViewFinder;

 use Illuminate\View\View;

@@ -19,10 +18,6 @@
 use Luracast\Restler\Scope;

 use Luracast\Restler\UI\Nav;

 use Luracast\Restler\Util;

-use Twig\Environment;

-use Twig\Extension\DebugExtension;

-use Twig\Loader\FilesystemLoader;

-use Twig\TwigFunction;

 

 /**

  * Html template format

@@ -34,14 +29,10 @@
  * @copyright  2010 Luracast

  * @license    http://www.opensource.org/licenses/lgpl-license.php LGPL

  * @link       http://luracast.com/products/restler/

- *

+ * @version    3.0.0rc6

  */

 class HtmlFormat extends DependentFormat

 {

-    const BLADE = 'Illuminate\View\View';

-    const TWIG = 'Twig\Environment';

-    const MUSTACHE = 'Mustache_Engine';

-

     public static $mime = 'text/html';

     public static $extension = 'html';

     public static $view;

@@ -93,12 +84,11 @@
         }

     }

 

-    public function getDependencyMap()

-    {

+    public function getDependencyMap(){

         return array(

-            self::BLADE    => 'illuminate/view:^8',

-            self::TWIG     => 'twig/twig:^3',

-            self::MUSTACHE => 'mustache/mustache:dev-master',

+            'Illuminate\View\View' => 'illuminate/view:4.2.*',

+            'Twig_Environment' => 'twig/twig:v1.13.*',

+            'Mustache_Engine' => 'mustache/mustache:dev-master',

         );

     }

 

@@ -111,7 +101,7 @@
         $resolver->register('blade', function () use ($engine) {

             return $engine;

         });

-        $phpEngine = new PhpEngine($files);

+        $phpEngine = new PhpEngine();

         $resolver->register('php', function () use ($phpEngine) {

             return $phpEngine;

         });

@@ -138,43 +128,32 @@
         return $view->render();

     }

 

-    /**

-     * @param array|object $data

-     * @param bool         $debug

-     *

-     * @return string

-     * @throws \Twig\Error\LoaderError

-     * @throws \Twig\Error\RuntimeError

-     * @throws \Twig\Error\SyntaxError

-     */

-    public static function twig($data, $debug = true)

-    {

-        $loader = new FilesystemLoader(static::$viewPath);

-        $twig = new Environment($loader, array(

-            'cache'                => is_string(static::$cacheDirectory)

-                ? static::$cacheDirectory : false,

-            'debug'                => $debug,

+    public static function twig(array $data, $debug = true)

+    {

+        $loader = new \Twig_Loader_Filesystem(static::$viewPath);

+        $twig = new \Twig_Environment($loader, array(

+            'cache' => static::$cacheDirectory,

+            'debug' => $debug,

             'use_strict_variables' => $debug,

         ));

-        if ($debug) {

-            $twig->addExtension(new DebugExtension());

-        }

+        if ($debug)

+            $twig->addExtension(new \Twig_Extension_Debug());

 

         $twig->addFunction(

-            new TwigFunction(

+            new \Twig_SimpleFunction(

                 'form',

                 'Luracast\Restler\UI\Forms::get',

                 array('is_safe' => array('html'))

             )

         );

         $twig->addFunction(

-            new TwigFunction(

+            new \Twig_SimpleFunction(

                 'form_key',

                 'Luracast\Restler\UI\Forms::key'

             )

         );

         $twig->addFunction(

-            new TwigFunction(

+            new \Twig_SimpleFunction(

                 'nav',

                 'Luracast\Restler\UI\Nav::get'

             )

@@ -185,7 +164,7 @@
                 isset(HtmlFormat::$data[$name]) &&

                 is_callable(HtmlFormat::$data[$name])

             ) {

-                return new TwigFunction(

+                return new \Twig_SimpleFunction(

                     $name,

                     HtmlFormat::$data[$name]

                 );

@@ -193,35 +172,21 @@
             return false;

         });

 

-        $template = $twig->load(static::getViewFile());

-        return $template->render((array)$data);

-    }

-

-    /**

-     * @param array|object $data

-     * @param bool         $debug

-     *

-     * @return string

-     */

-    public static function handlebar($data, $debug = true)

+        $template = $twig->loadTemplate(static::getViewFile());

+        return $template->render($data);

+    }

+

+    public static function handlebar(array $data, $debug = true)

     {

         return static::mustache($data, $debug);

     }

 

-    /**

-     * @param array|object $data

-     * @param bool         $debug

-     *

-     * @return string

-     */

-    public static function mustache($data, $debug = true)

-    {

-        $data = (array)$data;

-        if (!isset($data['nav'])) {

+    public static function mustache(array $data, $debug = true)

+    {

+        if (!isset($data['nav']))

             $data['nav'] = array_values(Nav::get());

-        }

         $options = array(

-            'loader'  => new \Mustache_Loader_FilesystemLoader(

+            'loader' => new \Mustache_Loader_FilesystemLoader(

                 static::$viewPath,

                 array('extension' => static::getViewExtension())

             ),

@@ -235,25 +200,16 @@
                 },

             )

         );

-        if (!$debug) {

+        if (!$debug)

             $options['cache'] = static::$cacheDirectory;

-        }

         $m = new \Mustache_Engine($options);

         return $m->render(static::getViewFile(), $data);

     }

 

-    /**

-     * @param array|object $data

-     * @param bool         $debug

-     *

-     * @return string

-     * @throws RestException

-     */

-    public static function php($data, $debug = true)

-    {

-        if (static::$view == 'debug') {

+    public static function php(array $data, $debug = true)

+    {

+        if (static::$view == 'debug')

             static::$viewPath = dirname(__DIR__) . '/views';

-        }

         $view = static::getViewFile(true);

 

         if (!is_readable($view)) {

@@ -266,26 +222,22 @@
 

         $path = static::$viewPath . DIRECTORY_SEPARATOR;

         $template = function ($view) use ($data, $path) {

-            $data = (array)$data;

             $form = function () {

                 return call_user_func_array(

                     'Luracast\Restler\UI\Forms::get',

                     func_get_args()

                 );

             };

-            if (!isset($data['form'])) {

+            if (!isset($data['form']))

                 $data['form'] = $form;

-            }

             $nav = function () {

                 return call_user_func_array(

                     'Luracast\Restler\UI\Nav::get',

                     func_get_args()

                 );

             };

-            if (!isset($data['nav'])) {

+            if (!isset($data['nav']))

                 $data['nav'] = $nav;

-            }

-

 

             $_ = function () use ($data, $path) {

                 extract($data);

@@ -302,7 +254,7 @@
                             ) {

                                 $str = '';

                                 foreach ($arrays as $arr) {

-                                    extract((array)$arr);

+                                    extract($arr);

                                     $str .= include $file;

                                 }

                                 return $str;

@@ -312,18 +264,15 @@
                         }

                         break;

                     case 'if':

-                        if (count($args) < 2) {

+                        if (count($args) < 2)

                             $args[1] = '';

-                        }

-                        if (count($args) < 3) {

+                        if (count($args) < 3)

                             $args[2] = '';

-                        }

                         return $args[0] ? $args[1] : $args[2];

                         break;

                     default:

-                        if (isset($data[$task]) && is_callable($data[$task])) {

+                        if (isset($data[$task]) && is_callable($data[$task]))

                             return call_user_func_array($data[$task], $args);

-                        }

                 }

                 return '';

             };

@@ -331,9 +280,8 @@
             return @include $view;

         };

         $value = $template($view);

-        if (is_string($value)) {

+        if (is_string($value))

             return $value;

-        }

     }

 

     /**

@@ -346,8 +294,8 @@
      *                                     Formatter has to make the encoded

      *                                     output more human readable

      *

+     * @throws \Exception

      * @return string encoded string

-     * @throws \Exception

      */

     public function encode($data, $humanReadable = false)

     {

@@ -369,9 +317,9 @@
                 'response' => static::$convertResponseToArray

                     ? Obj::toArray($data)

                     : $data,

-                'stages'   => $this->restler->getEvents(),

-                'success'  => $success,

-                'error'    => $error

+                'stages' => $this->restler->getEvents(),

+                'success' => $success,

+                'error' => $error

             );

             $info = $data['api'] = $this->restler->apiMethodInfo;

             $metadata = Util::nestedValue(

@@ -410,9 +358,7 @@
             if ($value) {

                 $data = Util::nestedValue($data, explode('.', $value));

             }

-            if (is_array($data)) {

-                $data += static::$data;

-            }

+            $data += static::$data;

             if (false === ($i = strrpos(self::$view, '.'))) {

                 $template = self::$template;

             } else {

@@ -423,18 +369,17 @@
                 static::$cacheDirectory = Defaults::$cacheDirectory . DIRECTORY_SEPARATOR . $template;

                 if (!file_exists(static::$cacheDirectory)) {

                     if (!mkdir(static::$cacheDirectory, 0770, true)) {

-                        throw new RestException(500,

-                            'Unable to create cache directory `' . static::$cacheDirectory . '`');

+                        throw new RestException(500, 'Unable to create cache directory `' . static::$cacheDirectory . '`');

                     }

                 }

             }

             if (method_exists($class = get_called_class(), $template)) {

                 if ($template == 'blade') {

-                    $this->checkDependency(self::BLADE);

+                    $this->checkDependency('Illuminate\View\View');

                 } elseif ($template == 'twig') {

-                    $this->checkDependency(self::TWIG);

+                    $this->checkDependency('Twig_Environment');

                 } elseif ($template == 'mustache' || $template == 'handlebar') {

-                    $this->checkDependency(self::MUSTACHE);

+                    $this->checkDependency('Mustache_Engine');

                 }

                 return call_user_func("$class::$template", $data, $humanReadable);

             }

@@ -471,9 +416,8 @@
     {

         $v = $fullPath ? static::$viewPath . '/' : '';

         $v .= static::$view;

-        if ($includeExtension) {

+        if ($includeExtension)

             $v .= '.' . static::getViewExtension();

-        }

         return $v;

     }

 

--- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/Format/github_JsFormat.php
+++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/Format/client_JsFormat.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 JsFormat extends JsonFormat

 {

--- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/Format/github_JsonFormat.php
+++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/Format/client_JsonFormat.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 JsonFormat extends Format

 {

--- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/Format/github_MultiFormat.php
+++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/Format/client_MultiFormat.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

  */

 abstract class MultiFormat implements iFormat

 {

--- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/Format/github_PlistFormat.php
+++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/Format/client_PlistFormat.php
@@ -18,7 +18,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 PlistFormat extends DependentMultiFormat

 {

--- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/Format/github_TsvFormat.php
+++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/Format/client_TsvFormat.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 TsvFormat extends CsvFormat

 {

--- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/Format/github_UploadFormat.php
+++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/Format/client_UploadFormat.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

  */

 class UploadFormat extends Format

 {

--- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/Format/github_UrlEncodedFormat.php
+++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/Format/client_UrlEncodedFormat.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 UrlEncodedFormat extends Format

 {

--- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/Format/github_XmlFormat.php
+++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/Format/client_XmlFormat.php
@@ -16,7 +16,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 XmlFormat extends Format

 {

--- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/Format/github_YamlFormat.php
+++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/Format/client_YamlFormat.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 YamlFormat extends DependentFormat

 {

--- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/Format/github_iDecodeStream.php
+++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/Format/client_iDecodeStream.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 iDecodeStream

 {

--- /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/Format/github_iFormat.php
+++ /tmp/dsg/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/Format/client_iFormat.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 iFormat

 {