/** * @covers Brickoo\Component\IoC\Definition\Container\ArgumentDefinitionContainer::__construct * @covers Brickoo\Component\IoC\Definition\Container\DefinitionContainer::isEmpty */ public function testDefinitionContainerIsEmpty() { $definitionContainer = new ArgumentDefinitionContainer(); $this->assertTrue($definitionContainer->isEmpty()); $definitionContainer = new ArgumentDefinitionContainer([$this->getArgumentDefinitionStub()]); $this->assertFalse($definitionContainer->isEmpty()); }
/** * Collects the arguments from an argument definition. * @param \Brickoo\Component\IoC\Definition\Container\ArgumentDefinitionContainer $argumentsContainer * @return array the collected arguments */ protected function collectArguments(ArgumentDefinitionContainer $argumentsContainer) { if ($argumentsContainer->isEmpty()) { return []; } $collectedArguments = []; $arguments = $argumentsContainer->getAll(); foreach ($arguments as $index => $argument) { $argumentIndex = $this->getArgumentIndex($argument, $index); $collectedArguments[$argumentIndex] = $this->getArgumentValue($argument); } return $collectedArguments; }