Пример #1
0
 /**
  * Handle usage of translator method belongs to TranslatorTrait.
  *
  * @param ReflectionCall $call
  */
 protected function indexTrait(ReflectionCall $call)
 {
     if (!in_array(TranslatorTrait::class, $this->tokenizer->getTraits($call->getClass()))) {
         return;
     }
     $string = $call->argument(0)->stringValue();
     if (substr($string, 0, 2) == Translator::I18N_PREFIX || substr($string, -2) == Translator::I18N_POSTFIX) {
         //This string was defined in class attributes
         $string = substr($string, 2, -2);
     }
     $this->translator->translate($call->getClass(), $string);
     $this->register($call->getFilename(), $call->getLine(), $call->getClass(), $string, $call->getClass());
 }