/**
  * Registers services on the given container.
  *
  * This method should only be used to configure services and parameters.
  * It should not get services.
  *
  * @param Container $pimple An Container instance
  */
 public function register(Container $pimple)
 {
     $pimple['interpolator.interpolator'] = function () use($pimple) {
         $interpolator = new Interpolator();
         $interpolator->setLogger($pimple['logger']);
         $interpolator->add('NOW', function () {
             $now = new \DateTime();
             return $now->format('Y-m-d H:i:s');
         });
         return $interpolator;
     };
 }
Esempio n. 2
0
 public function testCreateInterpolatesTaskOptionRecursive()
 {
     $task = array('name' => 'SomeCoolTaskName', 'task' => 'DemoTaskStub', 'interpolatedText' => array('key' => array('key' => 'Hello, my name is %NAME%.')), 'something' => 123456);
     $interpolator = new Interpolator();
     $interpolator->add('NAME', 'Kanoa');
     $factory = new TaskFactory($interpolator, $this->outputHandler, array('AndreasWeber\\Kanoa\\Test\\Task\\Task\\Stub'));
     $task = $factory->create($task);
     $interpolatedText = $task->getOption('interpolatedText');
     $this->assertSame('Hello, my name is Kanoa.', $interpolatedText['key']['key']);
 }