original_string: public static function object_init($var, $class, array $arguments = null, array $requirements = null, $delay=0) {
          if (is_array($arguments)) {
              $arguments = array_map('json_encode', convert_to_array($arguments));
              $arguments = implode(', ', $arguments);
          }
  
          if ($var === null) {
              $js = "new $class(Y, $arguments);";
          } else if (strpos($var, '.')!==false) {
              $js = "$var = new $class(Y, $arguments);";
          } else {
              $js = "var $var = new $class(Y, $arguments);";
          }
  
          if ($delay) {
              $delay = $delay * 1000; // in miliseconds
              $js = "setTimeout(function() { $js }, $delay);";
          }
  
          if (count($requirements) > 0) {
              $requirements = implode("', '", $requirements);
              $js = "Y.use('$requirements', function(Y){ $js });";
          }
          return $js."\n";
      }
code: public static function object_init($var, $class, array $arguments = null, array $requirements = null, $delay=0) {
          if (is_array($arguments)) {
              $arguments = array_map('json_encode', convert_to_array($arguments));
              $arguments = implode(', ', $arguments);
          }
  
          if ($var === null) {
              $js = "new $class(Y, $arguments);";
          } else if (strpos($var, '.')!==false) {
              $js = "$var = new $class(Y, $arguments);";
          } else {
              $js = "var $var = new $class(Y, $arguments);";
          }
  
          if ($delay) {
              $delay = $delay * 1000; // in miliseconds
              $js = "setTimeout(function() { $js }, $delay);";
          }
  
          if (count($requirements) > 0) {
              $requirements = implode("', '", $requirements);
              $js = "Y.use('$requirements', function(Y){ $js });";
          }
          return $js."\n";
      }
code_tokens: public static function object_init ( $ var , $ class , array $ arguments = null , array $ requirements = null , $ delay = 0 ) { if ( is_array ( $ arguments ) ) { $ arguments = array_map ( 'json_encode' , convert_to_array ( $ arguments ) ) ; $ arguments = implode ( ', ' , $ arguments ) ; } if ( $ var === null ) { $ js = "new $class(Y, $arguments);" ; } else if ( strpos ( $ var , '.' ) !== false ) { $ js = "$var = new $class(Y, $arguments);" ; } else { $ js = "var $var = new $class(Y, $arguments);" ; } if ( $ delay ) { $ delay = $ delay * 1000 ; // in miliseconds $ js = "setTimeout(function() { $js }, $delay);" ; } if ( count ( $ requirements ) > 0 ) { $ requirements = implode ( "', '" , $ requirements ) ; $ js = "Y.use('$requirements', function(Y){ $js });" ; } return $ js . "\n" ; }
docstring: Returns JavaScript code to initialise a new object
  
  @param string $var If it is null then no var is assigned the new object.
  @param string $class The class to initialise an object for.
  @param array $arguments An array of args to pass to the init method.
  @param array $requirements Any modules required for this class.
  @param int $delay The delay before initialisation. 0 = no delay.
  @return string Some JS code
docstring_tokens: Returns JavaScript code to initialise a new object