Class luya\ConfigDefinition
Inheritance | luya\ConfigDefinition |
---|---|
Available since version | 1.0.21 |
Source Code | https://github.com/luyadev/luya/blob/master/core/ConfigDefinition.php |
Contains the defintion of a config element.
Public Methods
Method | Description | Defined By |
---|---|---|
__construct() | Consturctor | luya\ConfigDefinition |
consoleRuntime() | Set console runtime | luya\ConfigDefinition |
env() | Set env | luya\ConfigDefinition |
getConfig() | Getter method for config | luya\ConfigDefinition |
getGroup() | Getter method for group | luya\ConfigDefinition |
getKey() | Getter method for config key | luya\ConfigDefinition |
runtime() | Set runtime | luya\ConfigDefinition |
validateEnvs() | Validate whether given env exsts or not. | luya\ConfigDefinition |
validateRuntime() | Validate whether its given runtime or not | luya\ConfigDefinition |
webRuntime() | Set web runtime | luya\ConfigDefinition |
Constants
Constant | Value | Description | Defined By |
---|---|---|---|
GROUP_APPLICATIONS | 3 | luya\ConfigDefinition | |
GROUP_BOOTSTRAPS | 4 | luya\ConfigDefinition | |
GROUP_CALLABLE | 5 | luya\ConfigDefinition | |
GROUP_COMPONENTS | 1 | luya\ConfigDefinition | |
GROUP_MODULES | 2 | luya\ConfigDefinition |
Method Details
Consturctor
public void __construct ( $group, $key, $config ) | ||
$group | string | |
$key | string | |
$config | mixed |
public function __construct($group, $key, $config)
{
$this->_group = $group;
$this->_key = $key;
$this->_config = is_scalar($config) ? ['class' => $config] : $config;
}
Set console runtime
public static consoleRuntime ( ) |
public function consoleRuntime()
{
$this->_runtime = Config::RUNTIME_CONSOLE;
return $this;
}
Set env
public static env ( $env ) | ||
$env | string |
public function env($env)
{
$this->_env = $env;
return $this;
}
Getter method for config
public array getConfig ( ) |
public function getConfig()
{
return $this->_config;
}
Getter method for group
public string getGroup ( ) |
public function getGroup()
{
return $this->_group;
}
Getter method for config key
public string getKey ( ) |
public function getKey()
{
return $this->_key;
}
Set runtime
public static runtime ( $runtime ) | ||
$runtime | string |
public function runtime($runtime)
{
$this->_runtime = $runtime;
return $this;
}
Validate whether given env exsts or not.
public boolean validateEnvs ( array $envs ) | ||
$envs | array |
public function validateEnvs(array $envs)
{
return in_array($this->_env, $envs);
}
Validate whether its given runtime or not
public boolean validateRuntime ( $runtime ) | ||
$runtime | string |
public function validateRuntime($runtime)
{
return $this->_runtime == $runtime;
}
Set web runtime
public static webRuntime ( ) |
public function webRuntime()
{
$this->_runtime = Config::RUNTIME_WEB;
return $this;
}