Neos\Flow\ObjectManagement\Configuration\Configuration::getArguments PHP Method

getArguments() public method

Returns a sorted array of constructor arguments indexed by position (starting with "1")
public getArguments ( ) : array
return array
    public function getArguments()
    {
        if (count($this->arguments) < 1) {
            return [];
        }
        asort($this->arguments);
        $lastArgument = end($this->arguments);
        $argumentsCount = $lastArgument->getIndex();
        $sortedArguments = [];
        for ($index = 1; $index <= $argumentsCount; $index++) {
            $sortedArguments[$index] = isset($this->arguments[$index]) ? $this->arguments[$index] : null;
        }
        return $sortedArguments;
    }

Usage Example

 /**
  * @test
  */
 public function passingAnEmptyArrayToSetArgumentsRemovesAllExistingArguments()
 {
     $someArguments = [1 => new Configuration\ConfigurationArgument(1, 'simple string'), 2 => new Configuration\ConfigurationArgument(2, 'another string')];
     $this->objectConfiguration->setArguments($someArguments);
     $this->assertEquals($someArguments, $this->objectConfiguration->getArguments(), 'The set arguments could not be retrieved again.');
     $this->objectConfiguration->setArguments([]);
     $this->assertEquals([], $this->objectConfiguration->getArguments(), 'The constructor arguments have not been cleared.');
 }
All Usage Examples Of Neos\Flow\ObjectManagement\Configuration\Configuration::getArguments