WP_CLI
Configurator::__construct
Method of the class: Configurator{}
No Hooks.
Returns
null. Nothing (null).
Usage
$Configurator = new Configurator(); $Configurator->__construct( $path );
- $path(string) (required)
- Path to config spec file.
Configurator::__construct() Configurator:: construct code WP-CLI 2.13.0-alpha
public function __construct( $path ) {
$this->load_config_spec( $path );
$defaults = [
'runtime' => false,
'file' => false,
'synopsis' => '',
'default' => null,
'multiple' => false,
];
foreach ( $this->spec as $key => &$details ) {
$details = array_merge( $defaults, $details );
$this->config[ $key ] = $details['default'];
}
$env_files = getenv( 'WP_CLI_REQUIRE' )
? array_filter( array_map( 'trim', explode( ',', getenv( 'WP_CLI_REQUIRE' ) ) ) )
: [];
if ( ! empty( $env_files ) ) {
if ( ! isset( $this->config['require'] ) ) {
$this->config['require'] = [];
}
$this->config['require'] = array_unique( array_merge( $env_files, $this->config['require'] ) );
}
}