Ejemplo n.º 1
0
 public function testCountItems()
 {
     $bag = new Bag();
     $bag->set("foo", "foo");
     $bag->set("bar", "bar");
     $this->assertEquals(2, $bag->count());
 }
Ejemplo n.º 2
0
 /**
  * Prepare arguments, rewrite parameters and options to properties
  *
  * @param array $argv
  */
 private function prepareArguments(array $argv)
 {
     $optionsCount = 0;
     foreach ($argv as $arg) {
         if (preg_match_all("/^--([a-zA-Z0-9.]+)=([^.*]+)\$/", $arg, $matches)) {
             $this->parameters->set($matches[1][0], $matches[2][0]);
         }
         if (preg_match_all("/^(-|)([a-zA-Z0-9.]+)/", $arg, $matches)) {
             $this->options->set($optionsCount, $matches[2][0]);
             $optionsCount++;
         }
     }
 }
Ejemplo n.º 3
0
 /**
  * @param ConsoleApplicationInterface $application
  */
 public function registerApplication(ConsoleApplicationInterface $application)
 {
     foreach ($application->getSubscribedEvents() as $event => $method) {
         $this->applications->set($event, $application);
     }
 }