/** * @param string $slug * @throws InvalidArgumentException */ protected function __construct($slug) { if (!is_string($slug)) { throw new InvalidArgumentException(sprintf('String expected but got [%s].', StringUtils::varToString($slug))); } if (!SlugUtils::isValid($slug, true) || !SlugUtils::containsDate($slug)) { throw new InvalidArgumentException(sprintf('The value [%s] is not a valid dated slug.', $slug)); } $this->slug = $slug; }
/** * @param string $slug * @throws \InvalidArgumentException */ protected function __construct($slug) { @trigger_error(sprintf('"%s" is deprecated. Use "Gdbots\\Pbj\\WellKnown\\DatedSlugIdentifier" from "gdbots/pbj" 1.1.x or later instead.', __CLASS__), E_USER_DEPRECATED); if (!is_string($slug)) { throw new \InvalidArgumentException(sprintf('String expected but got [%s].', StringUtils::varToString($slug))); } if (!SlugUtils::isValid($slug, true) || !SlugUtils::containsDate($slug)) { throw new \InvalidArgumentException(sprintf('The value [%s] is not a valid dated slug.', $slug)); } $this->slug = $slug; }