Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 9 |
ClassConfig\Exceptions\MissingConfigException | |
0.00% |
0 / 1 |
|
0.00% |
0 / 3 |
20 | |
0.00% |
0 / 9 |
__construct | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 7 |
|||
getKey | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
getTrail | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
<?php | |
namespace ClassConfig\Exceptions; | |
/** | |
* Class MissingConfigException | |
* @package ClassConfig\Exceptions | |
*/ | |
class MissingConfigException extends \RuntimeException | |
{ | |
/** | |
* @var string | |
*/ | |
protected $key; | |
/** | |
* @var string[] | |
*/ | |
protected $trail; | |
/** | |
* MissingConfigException constructor. | |
* | |
* @param string[] $trail | |
*/ | |
public function __construct(array $trail) | |
{ | |
$this->key = array_pop($trail); | |
$this->trail = $trail; | |
parent::__construct(sprintf( | |
'Missing required config entry: "%s"%s.', | |
$this->key, | |
0 < count($this->trail) ? sprintf(' (%s)', implode('.', array_merge($this->trail, [$this->key]))) : '' | |
)); | |
} | |
/** | |
* @return string | |
*/ | |
public function getKey(): string | |
{ | |
return $this->key; | |
} | |
/** | |
* @return string[] | |
*/ | |
public function getTrail(): array | |
{ | |
return $this->trail; | |
} | |
} |