Ejemplo n.º 1
0
 public function __construct(Translation $translation = null, RuleSet $ruleSet = null)
 {
     $loader = new TranslationLoader();
     $this->translation = $translation ?: $loader->loadDefault();
     $this->ruleSet = $ruleSet ?: new DefaultRuleSet();
 }
Ejemplo n.º 2
0
 /**
  * Instantiate TimeAgo with the desired built-in translation
  *
  * @param  DateTime $dateTime
  * @param  string   $languageCode
  *
  * @return TimeAgo
  */
 public static function withTranslation(\DateTime $dateTime, $languageCode)
 {
     $translationLoader = new TranslationLoader();
     return new self($dateTime, new Translator($translationLoader->load($languageCode)));
 }