getConstructorArgs() public method

Returns the contructor args as an associative array
public getConstructorArgs ( ) : array
return array Contructor args
 /**
  * Test that constructor args were pulled properly
  */
 public function testInitConstructorArgs()
 {
     $expectedConstructorArgs = array();
     foreach ($this->getConstructorArgs() as $param) {
         $expectedConstructorArgs[$param->getName()] = $param;
     }
     $this->assertEquals($expectedConstructorArgs, $this->resolver->getConstructorArgs());
 }
 /**
  * Test that constructor args were pulled properly
  *
  * Notie that we need to deuplicate the CamelCase conversion here for old
  * fashioned classes
  */
 public function testInitConstructorArgs()
 {
     $expectedConstructorArgs = array();
     $nameConverter = new CamelCaseToSnakeCaseNameConverter();
     foreach ($this->getConstructorArgs() as $param) {
         $expectedConstructorArgs[$nameConverter->denormalize($param->getName())] = $param;
     }
     $this->assertEquals($expectedConstructorArgs, $this->resolver->getConstructorArgs());
 }
Exemplo n.º 3
0
 /**
  * Resolve options and returns them into 2 buckets:
  *   - constructor options and
  *   - extra options
  * Extra options are those that are not in the contructor. The constructor arguments determine
  * what goes into which bucket
  *
  * @return array array of constructorOptions and extraOptions
  */
 private function resolveOptions()
 {
     $constructorResolver = new ConstructorResolver($this->reflected);
     // Contructor options are only the ones matching the contructor args' names
     $constructorOptions = array_intersect_key($this->rawOptions, $constructorResolver->getConstructorArgs());
     // Extra options are everything else than contructor options
     $extraOptions = array_diff_key($this->rawOptions, $constructorOptions);
     $extraOptionsResolver = new ExtraOptionsResolver($this->reflected, array_keys($extraOptions));
     return array($constructorResolver->resolve($constructorOptions), $extraOptionsResolver->resolve($extraOptions, $this));
 }