Jyxo\Gettext\Parser::__call PHP Méthode

__call() public méthode

Makes getProperty methods available for retrieving property values Makes setProperty methods available for setting property values
public __call ( string $name, array $args ) : mixed
$name string Method name
$args array Method parameters
Résultat mixed Value of variable or \Jyxo\Gettext\Parser
    public function __call(string $name, array $args)
    {
        if (substr($name, 0, 3) == 'get' && ($var = substr($name, 3))) {
            $var = strtolower(substr($var, 0, 1)) . substr($var, 1);
            if (!isset($this->{$var})) {
                throw new Parser\Exception(sprintf('Non-existing method %s::%s() called in %s, line %s', __CLASS__, $name, __FILE__, __LINE__));
            }
            return $this->{$var};
        } elseif (substr($name, 0, 3) == 'set' && ($var = substr($name, 3))) {
            $var = strtolower(substr($var, 0, 1)) . substr($var, 1);
            if (!isset($this->{$var})) {
                throw new Parser\Exception(sprintf('Non-existing method %s::%s() called in %s, line %s', __CLASS__, $name, __FILE__, __LINE__));
            }
            $this->{$var} = $args[0];
            return $this;
        }
    }