/** * Constructor. * * @param string $message Exception message * @param integer $code Exception code (type) */ public function __construct(string $message, int $code) { static $allowedUnits = [self::SECOND, self::MINUTE, self::HOUR, self::DAY, self::MONTH, self::YEAR, self::INVALID, self::NOT_COMPLETE]; if (!in_array($code, $allowedUnits)) { $code = self::UNKNOWN; } parent::__construct($message, $code); }