StackFormation\Helper\Div::flatten PHP Method

flatten() public static method

public static flatten ( array $array, $keyKey = 'Key', $valueKey = 'Value' )
$array array
    public static function flatten(array $array, $keyKey = 'Key', $valueKey = 'Value')
    {
        $tmp = [];
        foreach ($array as $item) {
            $tmp[$item[$keyKey]] = $item[$valueKey];
        }
        return $tmp;
    }

Usage Example

 /**
  * @test
  */
 public function getUnsresolvedParameter()
 {
     $blueprint = $this->getMockedBlueprint(['parameters' => ['Foo' => '{env:DONTRESOVLE}']]);
     $parameters = $blueprint->getParameters(false);
     $parameters = Div::flatten($parameters, 'ParameterKey', 'ParameterValue');
     $this->assertEquals('{env:DONTRESOVLE}', $parameters['Foo']);
 }
All Usage Examples Of StackFormation\Helper\Div::flatten