/** * Inspects if given text is already normalized into slug form. * * @param string $text Text to be inspected * @return boolean */ public static function isNormalized($text) { $normalizer = new self($text); return ($text === $normalizer->normalize()); }
/** * Creates a job instance from a crontab string * * @param string $string * @return \axy\crontab\Job * @throws \axy\crontab\errors\InvalidJobString */ public static function createFromString($string) { $components = preg_split('~\\s+~', trim($string), 6); if (count($components) !== 6) { throw new InvalidJobString($string); } $job = new self(); $job->command = ltrim($components[5]); foreach (self::$keys as $i => $k) { $v = $components[$i]; $job->{$k} = $v; } $job->normalize(); return $job; }