public function testCountItems() { $bag = new Bag(); $bag->set("foo", "foo"); $bag->set("bar", "bar"); $this->assertEquals(2, $bag->count()); }
/** * 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++; } } }
/** * @param ConsoleApplicationInterface $application */ public function registerApplication(ConsoleApplicationInterface $application) { foreach ($application->getSubscribedEvents() as $event => $method) { $this->applications->set($event, $application); } }