/** * @param PromotionSubjectInterface $subject * * @return bool */ protected function isSubjectValid(PromotionSubjectInterface $subject) { Assert::implementsInterface($subject, OrderInterface::class); return 0 !== $subject->countItems(); }
/** * {@inheritDoc} */ public function registerTagHandler($tagName, $handler) { Assert::stringNotEmpty($tagName); Assert::stringNotEmpty($handler); Assert::classExists($handler); Assert::implementsInterface($handler, StaticMethod::class); if (strpos($tagName, '\\') && $tagName[0] !== '\\') { throw new \InvalidArgumentException('A namespaced tag must have a leading backslash as it must be fully qualified'); } $this->tagHandlerMappings[$tagName] = $handler; }