diff --git a/Utils/Git/Repository.php b/Utils/Git/Repository.php index 558e51e36..e6dde0a8e 100644 --- a/Utils/Git/Repository.php +++ b/Utils/Git/Repository.php @@ -379,14 +379,14 @@ class Repository /** * Get active Branch. * - * @return string + * @return Branch * * @since 1.0.0 * @author Dennis Eichhorn */ - public function getActiveBranch() : string + public function getActiveBranch() : Branch { - if (!isset($branch)) { + if (!isset($this->branch)) { $branches = $this->getBranches(); $active = preg_grep('/^\*/', $branches); reset($active); diff --git a/Utils/TaskSchedule/Cron.php b/Utils/TaskSchedule/Cron.php index d01abb2fd..93ec83ea9 100644 --- a/Utils/TaskSchedule/Cron.php +++ b/Utils/TaskSchedule/Cron.php @@ -19,7 +19,7 @@ namespace phpOMS\Utils\TaskSchedule; * Array utils. * * @category Framework - * @package Utils + * @package phpOMS\Utils\TaskSchedule * @author OMS Development Team * @author Dennis Eichhorn * @license OMS License 1.0 @@ -64,4 +64,9 @@ class Cron implements ScheduleInterface { } + + public function run(string $cmd) + { + // TODO: Implement run() method. + } } diff --git a/Utils/TaskSchedule/CronJob.php b/Utils/TaskSchedule/CronJob.php index 426a6874f..ba314f425 100644 --- a/Utils/TaskSchedule/CronJob.php +++ b/Utils/TaskSchedule/CronJob.php @@ -19,39 +19,25 @@ namespace phpOMS\Utils\TaskSchedule; * Array utils. * * @category Framework - * @package Utils + * @package phpOMS\Utils\TaskSchedule * @author OMS Development Team * @author Dennis Eichhorn * @license OMS License 1.0 * @link http://orange-management.com * @since 1.0.0 */ -class CronJob implements TaskInterface +class CronJob extends TaskAbstract { - /** - * Interval. - * - * @var Interval - * @since 1.0.0 - */ - private $interval = null; - private $command = ''; - public function __construct(Interval $interval = null, $cmd = '') { - $this->interval = $interval; - $this->command = $cmd; - } + if (!isset($interval)) { + $this->interval = new Interval(); + } else { + $this->interval = $interval; + } - public function setInterval(Interval $interval) - { - $this->interval = $interval; - } - - public function setCommand(string $command) - { - $this->command = $command; + $this->command = $cmd; } public function __toString() diff --git a/Utils/TaskSchedule/Interval.php b/Utils/TaskSchedule/Interval.php index 5302d5104..b5897cfe1 100644 --- a/Utils/TaskSchedule/Interval.php +++ b/Utils/TaskSchedule/Interval.php @@ -16,10 +16,10 @@ namespace phpOMS\Utils\TaskSchedule; /** - * Array utils. + * Interval class for tasks. * * @category Framework - * @package Utils + * @package phpOMS\Utils\TaskSchedule * @author OMS Development Team * @author Dennis Eichhorn * @license OMS License 1.0 @@ -29,8 +29,20 @@ namespace phpOMS\Utils\TaskSchedule; class Interval { + /** + * Start. + * + * @var \DateTime + * @since 1.0.0 + */ private $start = null; + /** + * End. + * + * @var \DateTime + * @since 1.0.0 + */ private $end = null; /** @@ -208,21 +220,57 @@ class Interval } + /** + * Set start. + * + * @param \DateTime $start Start date + * + * @return void + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ public function setStart(\DateTime $start) { $this->start = $start; } + /** + * Get start. + * + * @return \DateTime + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ public function getStart() : \DateTime { return $this->start; } + /** + * Get end. + * + * @return \DateTime + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ public function getEnd() { return $this->end; } + /** + * Set end. + * + * @param \DateTime $end End date + * + * @return void + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ public function setEnd(\DateTime $end) { $this->end = $end; diff --git a/Utils/TaskSchedule/InvalidTaskParameterExceltion.php b/Utils/TaskSchedule/InvalidTaskParameterExceltion.php index f63b88979..d721a6a81 100644 --- a/Utils/TaskSchedule/InvalidTaskParameterExceltion.php +++ b/Utils/TaskSchedule/InvalidTaskParameterExceltion.php @@ -21,7 +21,7 @@ namespace phpOMS\Utils\TaskSchedule; * Performing operations on the file system * * @category System - * @package Framework + * @package phpOMS\Utils\TaskSchedule * @author OMS Development Team * @author Dennis Eichhorn * @license OMS License 1.0 diff --git a/Utils/TaskSchedule/Schedule.php b/Utils/TaskSchedule/Schedule.php index c2a1d13a4..608cfc6d5 100644 --- a/Utils/TaskSchedule/Schedule.php +++ b/Utils/TaskSchedule/Schedule.php @@ -19,38 +19,26 @@ namespace phpOMS\Utils\TaskSchedule; * Array utils. * * @category Framework - * @package Utils + * @package phpOMS\Utils\TaskSchedule * @author OMS Development Team * @author Dennis Eichhorn * @license OMS License 1.0 * @link http://orange-management.com * @since 1.0.0 */ -class Schedule implements TaskInterface +class Schedule extends TaskAbstract { - - /** - * Interval. - * - * @var Interval - * @since 1.0.0 - */ - private $interval = null; - private $command = ''; + private $name = ''; public function __construct(Interval $interval = null, $cmd = '') { + if (!isset($interval)) { + $this->interval = new Interval(); + } else { + $this->interval = $interval; + } - } - - public function setInterval(Interval $interval) - { - $this->interval = $interval; - } - - public function setCommand(string $command) - { - $this->command = $command; + $this->command = $cmd; } public function __toString() diff --git a/Utils/TaskSchedule/ScheduleInterface.php b/Utils/TaskSchedule/ScheduleInterface.php index 57e4b3983..a56bf97ec 100644 --- a/Utils/TaskSchedule/ScheduleInterface.php +++ b/Utils/TaskSchedule/ScheduleInterface.php @@ -19,7 +19,7 @@ namespace phpOMS\Utils\TaskSchedule; * Array utils. * * @category Framework - * @package Utils + * @package phpOMS\Utils\TaskSchedule * @author OMS Development Team * @author Dennis Eichhorn * @license OMS License 1.0 @@ -39,4 +39,6 @@ interface ScheduleInterface public function set(TaskInterface $task); public function save(); + + public function run(string $cmd); } diff --git a/Utils/TaskSchedule/TaskAbstract.php b/Utils/TaskSchedule/TaskAbstract.php new file mode 100644 index 000000000..eb3e1641d --- /dev/null +++ b/Utils/TaskSchedule/TaskAbstract.php @@ -0,0 +1,102 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Utils\TaskSchedule; + +/** + * Abstract task class. + * + * @category Framework + * @package phpOMS\Utils\TaskSchedule + * @author OMS Development Team + * @author Dennis Eichhorn + * @license OMS License 1.0 + * @link http://orange-management.com + * @since 1.0.0 + */ +abstract class TaskAbstract +{ + /** + * Interval. + * + * @var Interval + * @since 1.0.0 + */ + protected $interval = null; + + /** + * Command. + * + * @var string + * @since 1.0.0 + */ + protected $command = ''; + + /** + * Set interval. + * + * @param Interval $interval Interval + * + * @return void + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function setInterval(Interval $interval) + { + $this->interval = $interval; + } + + /** + * Get interval. + * + * @return Interval + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function getInterval() : Interval + { + return $this->interval; + } + + /** + * Set command. + * + * @param string $command Command + * + * @return void + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function setCommand(string $command) + { + $this->command = $command; + } + + /** + * Get command. + * + * @return string + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function getCommand() : string + { + return $this->command; + } +} diff --git a/Utils/TaskSchedule/TaskInterface.php b/Utils/TaskSchedule/TaskInterface.php deleted file mode 100644 index e9ba8b65a..000000000 --- a/Utils/TaskSchedule/TaskInterface.php +++ /dev/null @@ -1,34 +0,0 @@ - - * @author Dennis Eichhorn - * @copyright 2013 Dennis Eichhorn - * @license OMS License 1.0 - * @version 1.0.0 - * @link http://orange-management.com - */ -namespace phpOMS\Utils\TaskSchedule; - -/** - * Array utils. - * - * @category Framework - * @package Utils - * @author OMS Development Team - * @author Dennis Eichhorn - * @license OMS License 1.0 - * @link http://orange-management.com - * @since 1.0.0 - */ -interface TaskInterface -{ - public function setInterval(Interval $interval); - - public function setCommand(string $command); -} diff --git a/Utils/TaskSchedule/TaskScheduler.php b/Utils/TaskSchedule/TaskScheduler.php index 048a1c168..8e4891830 100644 --- a/Utils/TaskSchedule/TaskScheduler.php +++ b/Utils/TaskSchedule/TaskScheduler.php @@ -19,7 +19,7 @@ namespace phpOMS\Utils\TaskSchedule; * Array utils. * * @category Framework - * @package Utils + * @package phpOMS\Utils\TaskSchedule * @author OMS Development Team * @author Dennis Eichhorn * @license OMS License 1.0 @@ -62,4 +62,9 @@ class TaskScheduler implements ScheduleInterface { } + + public function run(string $cmd) + { + // TODO: Implement run() method. + } }