src/Translator.php
private function getTemplate(string $key, string $rule): string
    {
        $keyrule = implode('.', [$key, $rule]);

        if (array_key_exists($keyrule, $this->templates)) {

            return $this->templates[$keyrule];

        }

        if (array_key_exists($rule, $this->templates)) {

            return $this->templates[$rule];

        }

        if (array_key_exists(self::DEFAULT_TEMPLATE_KEY, $this->templates)) {

            return $this->templates[self::DEFAULT_TEMPLATE_KEY];

        }

        return self::FALLBACK_TEMPLATE;
    }
private function getTemplate(string $key, string $rule): string
    {
        $keyrule = implode('.', [$key, $rule]);

        if (array_key_exists($keyrule, $this->templates)) {

            return $this->templates[$keyrule];

        }

        if (array_key_exists($rule, $this->templates)) {

            return $this->templates[$rule];

        }

        if (array_key_exists(self::DEFAULT_TEMPLATE_KEY, $this->templates)) {

            return $this->templates[self::DEFAULT_TEMPLATE_KEY];

        }

        return self::FALLBACK_TEMPLATE;
    }
private function getTemplate ( string $ key , string $ rule ) : string { $ keyrule = implode ( '.' , [ $ key , $ rule ] ) ; if ( array_key_exists ( $ keyrule , $ this -> templates ) ) { return $ this -> templates [ $ keyrule ] ; } if ( array_key_exists ( $ rule , $ this -> templates ) ) { return $ this -> templates [ $ rule ] ; } if ( array_key_exists ( self :: DEFAULT_TEMPLATE_KEY , $ this -> templates ) ) { return $ this -> templates [ self :: DEFAULT_TEMPLATE_KEY ] ; } return self :: FALLBACK_TEMPLATE ; }
Return a template from a rule key and a rule name. First look for a
'key.rule' template, then for a 'rule' template,then for a 'default'
template and finally return the fallback template when none was found.

@param string $key
@param string $rule
@return string
Return a template from a rule key and a rule name . First look for a key . rule template then for a rule template then for a default template and finally return the fallback template when none was found .