/var/www/vhosts/ihelp.ro/httpdocs/vendor/cakephp/cakephp/src/I18n
Edit: /var/www/vhosts/ihelp.ro/httpdocs/vendor/cakephp/cakephp/src/I18n/ChainMessagesLoader.php (2322B)
*/
protected $_loaders = [];
/**
* Receives a list of callable functions or objects that will be executed
* one after another until one of them returns a non-empty translations package
*
* @param array
$loaders List of callables to execute
*/
public function __construct(array $loaders)
{
$this->_loaders = $loaders;
}
/**
* Executes this object returning the translations package as configured in
* the chain.
*
* @return \Cake\I18n\Package
* @throws \RuntimeException if any of the loaders in the chain is not a valid callable
*/
public function __invoke(): Package
{
foreach ($this->_loaders as $k => $loader) {
if (!is_callable($loader)) {
throw new RuntimeException(sprintf(
'Loader "%s" in the chain is not a valid callable',
$k
));
}
$package = $loader();
if (!$package) {
continue;
}
if (!($package instanceof Package)) {
throw new RuntimeException(sprintf(
'Loader "%s" in the chain did not return a valid Package object',
$k
));
}
return $package;
}
return new Package();
}
}