public function __construct(Translation $translation = null, RuleSet $ruleSet = null) { $loader = new TranslationLoader(); $this->translation = $translation ?: $loader->loadDefault(); $this->ruleSet = $ruleSet ?: new DefaultRuleSet(); }
/** * 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))); }