Example #1
0
File: Repl.php Project: Vci/Libs
 /**
  * Starts the repl using the given config options
  * @param array $config 
  *  Example:
  *  <code>
  *      array(
  *          'locals' => array(
  *              'varname1' => 'value1',
  *              'varname2' => 'value2',
  *          ),
  *          'prompt' => 'promptstring> ',
  *      );
  *  </code>
  * @return void
  * @author David Hazel <*****@*****.**>
  **/
 public static function go(array $config = NULL)
 {
     if (!empty($config['prompt'])) {
         $prompt = $config['prompt'];
     } else {
         $prompt = 'php> ';
     }
     $boris = new self($prompt);
     if (!empty($config['locals'])) {
         foreach ($config['locals'] as $key => $value) {
             $boris->setLocal($key, $value);
         }
     }
     $boris->start();
 }