Mmoreram\PHPFormatter\Loader\ConfigLoader::loadConfigValues PHP Method

loadConfigValues() public method

* If an option is defined as a command parameter, this will be used * Otherwise, if an option is defined in the configuration file, this will be used. * Otherwise, default values will be used
public loadConfigValues ( string $commandName, array $configValues, array $commandValues = [], array $defaultValues = [] ) : array
$commandName string Command called
$configValues array Config values
$commandValues array Values defined in command
$defaultValues array Default values to use if these are not defined
return array $usableValues Usable values
    public function loadConfigValues($commandName, array $configValues, array $commandValues = [], array $defaultValues = [])
    {
        $configValues = isset($configValues[$commandName]) && is_array($configValues[$commandName]) ? $configValues[$commandName] : [];
        return array_merge($defaultValues, array_filter($configValues), array_filter($commandValues));
    }

Usage Example

 /**
  * Test load config values.
  *
  * @dataProvider dataLoadConfigValues
  */
 public function testLoadConfigValues($configValues, $commandValues, $defaultValues, $usableValues)
 {
     $configLoader = new ConfigLoader();
     $this->assertEquals($usableValues, $configLoader->loadConfigValues(UseSortCommand::COMMAND_NAME, $configValues, $commandValues, $defaultValues));
 }
All Usage Examples Of Mmoreram\PHPFormatter\Loader\ConfigLoader::loadConfigValues