This commit is contained in:
Dennis Eichhorn 2015-12-18 17:44:23 +01:00
parent 7de136815a
commit 961a386e12
15 changed files with 939 additions and 38 deletions

View File

@ -34,4 +34,5 @@ abstract class AssetType extends Enum
{
const CSS = 'css';
const JS = 'js';
const JSLATE = 'jslate';
}

View File

@ -32,6 +32,7 @@ use phpOMS\System\FilePathException;
class FileLogger implements LoggerInterface
{
const MSG_BACKTRACE = '{datetime}; {level}; {ip}; {message}; {backtrace}';
const MSG_FULL = '{datetime}; {level}; {ip}; {line}; {version}; {os}; {message}; {file}; {backtrace}';
const MSG_SIMPLE = '{datetime}; {level}; {ip}; {message};';
/**
@ -76,21 +77,21 @@ class FileLogger implements LoggerInterface
*
* Creates the logging object and overwrites all default values.
*
* @param \string $path Path for logging
* @param \string $lpath Path for logging
*
* @since 1.0.0
* @author Dennis Eichhorn
*/
public function __construct(\string $path)
public function __construct(\string $lpath)
{
if(!file_exists($path)) {
mkdir($path);
if (!file_exists($lpath)) {
mkdir($lpath);
}
$path = realpath($path);
$path = realpath($lpath);
if (strpos($path, ROOT_PATH) === false) {
throw new FilePathException($path);
throw new FilePathException($lpath);
}
if (!file_exists($path)) {
@ -223,12 +224,11 @@ class FileLogger implements LoggerInterface
$backtrace = debug_backtrace();
if (isset($backtrace[0])) {
unset($backtrace[0]);
// Removing sensitive config data from logging
foreach ($backtrace as $key => $value) {
if (isset($value['args'])) {
unset($backtrace[$key]['args']);
}
if (isset($backtrace[1])) {
unset($backtrace[1]);
}
$backtrace = json_encode($backtrace);
@ -237,6 +237,8 @@ class FileLogger implements LoggerInterface
$replace['{datetime}'] = sprintf('%--19s', (new \DateTime('NOW'))->format('Y-m-d H:i:s'));
$replace['{level}'] = sprintf('%--12s', $level);
$replace['{ip}'] = sprintf('%--15s', $_SERVER['REMOTE_ADDR']);
$replace['{version}'] = sprintf('%--15s', PHP_VERSION);
$replace['{os}'] = sprintf('%--15s', PHP_OS);
return strtr($message, $replace);
}
@ -261,6 +263,16 @@ class FileLogger implements LoggerInterface
return ($a['time'] > $b['time']) ? -1 : 1;
}
/**
* Write to file.
*
* @param \string $message
*
* @return void
*
* @since 1.0.0
* @author Dennis Eichhorn
*/
private function write(\string $message)
{
$this->fp = fopen($this->path, 'a');
@ -275,6 +287,9 @@ class FileLogger implements LoggerInterface
* @param array $context
*
* @return null
*
* @since 1.0.0
* @author Dennis Eichhorn
*/
public function emergency(\string $message, array $context = [])
{
@ -291,7 +306,10 @@ class FileLogger implements LoggerInterface
* @param \string $message
* @param array $context
*
* @return null
* @return void
*
* @since 1.0.0
* @author Dennis Eichhorn
*/
public function alert(\string $message, array $context = [])
{
@ -307,7 +325,10 @@ class FileLogger implements LoggerInterface
* @param \string $message
* @param array $context
*
* @return null
* @return void
*
* @since 1.0.0
* @author Dennis Eichhorn
*/
public function critical(\string $message, array $context = [])
{
@ -322,7 +343,10 @@ class FileLogger implements LoggerInterface
* @param \string $message
* @param array $context
*
* @return null
* @return void
*
* @since 1.0.0
* @author Dennis Eichhorn
*/
public function error(\string $message, array $context = [])
{
@ -339,7 +363,10 @@ class FileLogger implements LoggerInterface
* @param \string $message
* @param array $context
*
* @return null
* @return void
*
* @since 1.0.0
* @author Dennis Eichhorn
*/
public function warning(\string $message, array $context = [])
{
@ -353,7 +380,10 @@ class FileLogger implements LoggerInterface
* @param \string $message
* @param array $context
*
* @return null
* @return void
*
* @since 1.0.0
* @author Dennis Eichhorn
*/
public function notice(\string $message, array $context = [])
{
@ -369,7 +399,10 @@ class FileLogger implements LoggerInterface
* @param \string $message
* @param array $context
*
* @return null
* @return void
*
* @since 1.0.0
* @author Dennis Eichhorn
*/
public function info(\string $message, array $context = [])
{
@ -383,7 +416,10 @@ class FileLogger implements LoggerInterface
* @param \string $message
* @param array $context
*
* @return null
* @return void
*
* @since 1.0.0
* @author Dennis Eichhorn
*/
public function debug(\string $message, array $context = [])
{
@ -398,7 +434,10 @@ class FileLogger implements LoggerInterface
* @param \string $message
* @param array $context
*
* @return null
* @return void
*
* @since 1.0.0
* @author Dennis Eichhorn
*/
public function log(\string $level, \string $message, array $context = [])
{
@ -530,8 +569,12 @@ class FileLogger implements LoggerInterface
$log['datetime'] = $line[0] ?? '';
$log['level'] = $line[1] ?? '';
$log['ip'] = $line[2] ?? '';
$log['message'] = $line[3] ?? '';
$log['backtrace'] = $line[4] ?? '';
$log['line'] = $line[3] ?? '';
$log['version'] = $line[4] ?? '';
$log['os'] = $line[5] ?? '';
$log['message'] = $line[6] ?? '';
$log['file'] = $line[7] ?? '';
$log['backtrace'] = $line[8] ?? '';
break;
}

View File

@ -0,0 +1,84 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
namespace phpOMS\Math\Algebra;
class PointPolygonIntersection
{
const EPSILON = 1E-6;
private function __construct()
{
}
public static function pointInPolygon(array $point, array $vertices) : \int
{
$length = count($vertices);
// Polygon has to start and end with same point
if ($vertices[0]['x'] !== $vertices[$length - 1]['x'] || $vertices[0]['y'] !== $vertices[$length - 1]['y']) {
$vertices[] = $vertices[0];
}
// On vertex?
if (self::isOnVertex($point, $vertices)) {
return 0;
}
// Inside or ontop?
$countIntersect = 0;
$vertices_count = count($vertices);
// todo: return based on highest possibility not by first match
for ($i = 1; $i < $vertices_count; $i++) {
$vertex1 = $vertices[$i - 1];
$vertex2 = $vertices[$i];
if (abs($vertex1['y'] - $vertex2['y']) < self::EPSILON && abs($vertex1['y'] - $point['y']) < self::EPSILON && $point['x'] > min($vertex1['x'], $vertex2['x']) && $point['x'] < max($vertex1['x'], $vertex2['x'])) {
return 0; // boundary
}
if ($point['y'] > min($vertex1['y'], $vertex2['y']) && $point['y'] <= max($vertex1['y'], $vertex2['y']) && $point['x'] <= max($vertex1['x'], $vertex2['x']) && abs($vertex1['y'] - $vertex2['y']) >= self::EPSILON) {
$xinters = ($point['y'] - $vertex1['y']) * ($vertex2['x'] - $vertex1['x']) / ($vertex2['y'] - $vertex1['y']) + $vertex1['x'];
if (abs($xinters - $point['x']) < self::EPSILON) {
return 0; // boundary
}
if (abs($vertex1['x'] - $vertex2['x']) < self::EPSILON || $point['x'] < $xinters) {
$countIntersect++;
}
}
}
if ($countIntersect % 2 != 0) {
return -1;
}
return 1;
}
private static function isOnVertex($point, $vertices)
{
foreach ($vertices as $vertex) {
if (abs($point['x'] - $vertex['x']) < self::EPSILON && abs($point['y'] - $vertex['y']) < self::EPSILON) {
return true;
}
}
return false;
}
}

View File

@ -315,4 +315,24 @@ class Head implements RenderableInterface
return $asset;
}
/**
* Render assets.
*
* @return \string
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function renderAssetsLate() : \string
{
$asset = '';
foreach ($this->assets as $uri => $type) {
if ($type === AssetType::JSLATE) {
$asset .= '<script src="' . $uri . '"></script>';
}
}
return $asset;
}
}

View File

@ -250,7 +250,7 @@ class ModuleManager
if (file_exists($path)) {
if(strpos($path, self::MODULE_PATH) === false) {
throw new FilePathException($path);
throw new FilePathException(self::MODULE_PATH . '/' . $files[$i] . '/info.json');
}
$json = json_decode(file_get_contents($path), true);
@ -300,7 +300,7 @@ class ModuleManager
if ($path !== false) {
if(strpos($path, self::MODULE_PATH) === false) {
throw new FilePathException($path);
throw new FilePathException(self::MODULE_PATH . '/' . $module . '/' . 'info.json');
}
$info = json_decode(file_get_contents($path), true);

View File

@ -55,6 +55,8 @@ class SystemUtils
{
$countSize = 0;
$count = 0;
if(is_readable($dir)) {
$dir_array = scandir($dir);
foreach ($dir_array as $key => $filename) {
@ -67,6 +69,7 @@ class SystemUtils
}
}
}
}
return (int) $countSize;
}

View File

@ -0,0 +1,61 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @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 <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class Cron implements ScheduleInterface
{
public function __construct() {
}
public function add(TaskInterface $task)
{
// TODO: Implement add() method.
}
public function remove($id)
{
// TODO: Implement remove() method.
}
public function get(\string $id)
{
// TODO: Implement get() method.
}
public function list()
{
$output = shell_exec('crontab -l');
return $output;
}
public function set(TaskInterface $task)
{
// TODO: Implement set() method.
}
}

View File

@ -0,0 +1,85 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @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 <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class CronJob implements TaskInterface
{
/**
* Interval.
*
* @var Interval
* @since 1.0.0
*/
private $interval = null;
private $command = '';
public function __construct(\string $cronjob)
{
}
public function setInterval(Interval $interval)
{
$this->interval = $interval;
}
public function setCommand(\string $command)
{
$this->command = $command;
}
public function __toString()
{
$minute = $this->printValue($this->interval->getMinute());
$hour = $this->printValue($this->interval->getHour());
$dayOfMonth = $this->printValue($this->interval->getDayOfMonth());
$month = $this->printValue($this->interval->getMonth());
$dayOfWeek = $this->printValue($this->interval->getDayOfWeek());
return $minute . ' ' . $hour . ' ' . $dayOfMonth . ' ' . $month . ' ' . $dayOfWeek . ' ' . $this->command;
}
private function printValue(array $value) : \string
{
if (($count = count($value['dayOfWeek'])) > 0) {
$parsed = implode(',', $value['dayOfWeek']);
} elseif ($value['start'] !== 0 && $value['end']) {
$parsed = $value['start'] . '-' . $value['end'];
$count = 2;
} else {
$parsed = '*';
$count = 1;
}
if ($count === 0 && $value['step'] !== 0) {
$parsed .= '/' . $value['step'];
}
return $parsed;
}
}

View File

@ -0,0 +1,375 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @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 <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class Interval
{
private $minute = [];
private $hour = [];
private $dayOfMonth = [];
private $month = [];
private $dayOfWeek = [];
private $year = [];
public function __construct(\string $interval)
{
$this->parse($interval);
}
public function parse(\string $interval)
{
$elements = explode(' ', $interval);
}
public function parseMinute(\string $minute) : array
{
}
public function parseHour(\string $hour) : array
{
}
public function parseDayOfMonth(\string $dayOfMonth) : array
{
}
public function parseMonth(\string $month) : array
{
}
public function parseDayOfWeek(\string $dayOfWeek) : array
{
}
public function parseYear(\string $year) : array
{
}
public function setMinute(array $min, \int $start = 0, \int $end = 0, \int $step = 0, \bool $any = false)
{
$this->minute = [
'minutes' => $min,
'start' => $start,
'end' => $end,
'step' => $step,
'any' => $any,
];
$this->validateMinute();
}
public function setHour(array $hour, \int $start = 0, \int $end = 0, \int $step = 0, \bool $any = false)
{
$this->hour = [
'hours' => $hour,
'start' => $start,
'end' => $end,
'step' => $step,
'any' => $any,
];
$this->validateHour();
}
public function setDayOfMonth(array $dayOfMonth, \int $start = 0, \int $end = 0, \int $step = 0, \bool $any = false, \bool $last = false, \int $nearest = 0)
{
$this->dayOfMonth = [
'dayOfMonth' => $dayOfMonth,
'start' => $start,
'end' => $end,
'step' => $step,
'any' => $any,
'last' => $last,
'nearest' => $nearest,
];
$this->validateDayOfMonth();
}
public function setMonth(array $month, \int $start = 0, \int $end = 0, \int $step = 0, \bool $any = false)
{
$this->month = [
'month' => $month,
'start' => $start,
'end' => $end,
'step' => $step,
'any' => $any,
];
$this->validateMonth();
}
public function setDayOfWeek(array $dayOfWeek, \int $start = 0, \int $end = 0, \int $step = 0, \bool $any = false, \bool $last = false)
{
$this->dayOfWeek = [
'dayOfWeek' => $dayOfWeek,
'start' => $start,
'end' => $end,
'step' => $step,
'any' => $any,
'last' => $last,
];
$this->validateDayOfWeek();
}
public function setYear(array $year, \int $start = 0, \int $end = 0, \int $step = 0, \bool $any = false)
{
$this->year = [
'year' => $year,
'start' => $start,
'end' => $end,
'step' => $step,
'any' => $any,
];
$this->validateYear();
}
public function getMinute() : array
{
return $this->minute;
}
public function getHour() : array
{
return $this->hour;
}
public function getDayOfMonth() : array
{
return $this->dayOfMonth;
}
public function getDayOfWeek() : array
{
return $this->dayOfWeek;
}
public function getMonth() : array
{
return $this->month;
}
public function getYear() : array
{
return $this->year;
}
public function validate() : \bool
{
if (!$this->validateMinute()) return false;
if (!$this->validateHour()) return false;
if (!$this->validateDayOfMonth()) return false;
if (!$this->validateMonth()) return false;
if (!$this->validateDayOfWeek()) return false;
if (!$this->validateYear()) return false;
return true;
}
private function validateMinute() : \bool
{
foreach ($this->minute['minutes'] as $minute) {
if ($minute > 59 || $minute < 0) return false;
}
if ($this->minute['start'] > 59 || $this->minute['start'] < 0) return false;
if ($this->minute['end'] > 59 || $this->minute['end'] < 0) return false;
if ($this->minute['step'] > 59 || $this->minute['step'] < 0) return false;
return true;
}
private function validateHour() : \bool
{
foreach ($this->hour['hours'] as $hour) {
if ($hour > 23 || $hour < 0) return false;
}
if ($this->hour['start'] > 23 || $this->hour['start'] < 0) return false;
if ($this->hour['end'] > 23 || $this->hour['end'] < 0) return false;
if ($this->hour['step'] > 23 || $this->hour['step'] < 0) return false;
return true;
}
private function validateDayOfMonth() : \bool
{
foreach ($this->dayOfMonth['dayOfMonth'] as $dayOfMonth) {
if ($dayOfMonth > 31 || $dayOfMonth < 1) return false;
}
if ($this->dayOfMonth['start'] > 31 || $this->dayOfMonth['start'] < 1) return false;
if ($this->dayOfMonth['end'] > 31 || $this->dayOfMonth['end'] < 1) return false;
if ($this->dayOfMonth['step'] > 31 || $this->dayOfMonth['step'] < 1) return false;
if ($this->dayOfMonth['nearest'] > 31 || $this->dayOfMonth['nearest'] < 1) return false;
return true;
}
private function validateMonth() : \bool
{
foreach ($this->month['month'] as $month) {
if ($month > 12 || $month < 1) return false;
}
if ($this->month['start'] > 12 || $this->month['start'] < 1) return false;
if ($this->month['end'] > 12 || $this->month['end'] < 1) return false;
if ($this->month['step'] > 12 || $this->month['step'] < 1) return false;
return true;
}
private function validateDayOfWeek() : \bool
{
foreach ($this->dayOfWeek['dayOfWeek'] as $dayOfWeek) {
if ($dayOfWeek > 7 || $dayOfWeek < 1) return false;
}
if ($this->dayOfWeek['start'] > 7 || $this->dayOfWeek['start'] < 1) return false;
if ($this->dayOfWeek['end'] > 7 || $this->dayOfWeek['end'] < 1) return false;
if ($this->dayOfWeek['step'] > 5 || $this->dayOfWeek['step'] < 1) return false;
return true;
}
private function validateYear() : \bool
{
return true;
}
public function __toString()
{
/* Parsing minutes */
if (($count = count($this->minute['minutes'])) > 0) {
$minute = implode(',', $this->minute['minutes']);
} elseif ($this->minute['start'] !== 0 && $this->minute['end']) {
$minute = $this->minute['start'] . '-' . $this->minute['end'];
$count = 2;
} else {
$minute = '*';
$count = 1;
}
if ($count === 0 && $this->minute['step'] !== 0) {
$minute .= '/' . $this->minute['step'];
}
/* Parsing hours */
if (($count = count($this->hour['hours'])) > 0) {
$hour = implode(',', $this->hour['hours']);
} elseif ($this->hour['start'] !== 0 && $this->hour['end']) {
$hour = $this->hour['start'] . '-' . $this->hour['end'];
$count = 2;
} else {
$hour = '*';
$count = 1;
}
if ($count === 0 && $this->hour['step'] !== 0) {
$hour .= '/' . $this->hour['step'];
}
/* Parsing day of month */
if (($count = count($this->dayOfMonth['dayOfMonth'])) > 0) {
$dayOfMonth = implode(',', $this->dayOfMonth['dayOfMonth']);
} elseif ($this->dayOfMonth['start'] !== 0 && $this->dayOfMonth['end']) {
$dayOfMonth = $this->dayOfMonth['start'] . '-' . $this->dayOfMonth['end'];
$count = 2;
} else {
$dayOfMonth = '*';
$count = 1;
}
if ($count === 0 && $this->dayOfMonth['step'] !== 0) {
$dayOfMonth .= '/' . $this->dayOfMonth['step'];
}
if ($this->dayOfMonth['last']) {
$dayOfMonth .= 'L';
}
/* Parsing month */
if (($count = count($this->month['month'])) > 0) {
$month = implode(',', $this->month['month']);
} elseif ($this->month['start'] !== 0 && $this->month['end']) {
$month = $this->month['start'] . '-' . $this->month['end'];
$count = 2;
} else {
$month = '*';
$count = 1;
}
if ($count === 0 && $this->month['step'] !== 0) {
$month .= '/' . $this->month['step'];
}
/* Parsing day of week */
if (($count = count($this->dayOfWeek['dayOfWeek'])) > 0) {
$dayOfWeek = implode(',', $this->dayOfWeek['dayOfWeek']);
} elseif ($this->dayOfWeek['start'] !== 0 && $this->dayOfWeek['end']) {
$dayOfWeek = $this->dayOfWeek['start'] . '-' . $this->dayOfWeek['end'];
$count = 2;
} else {
$dayOfWeek = '*';
$count = 1;
}
if ($count === 0 && $this->dayOfWeek['step'] !== 0) {
$dayOfWeek .= '#' . $this->dayOfWeek['step'];
}
if ($this->dayOfWeek['last']) {
$dayOfWeek .= 'L';
}
/* Parsing year */
if (($count = count($this->year['year'])) > 0) {
$year = implode(',', $this->year['year']);
} elseif ($this->year['start'] !== 0 && $this->year['end']) {
$year = $this->year['start'] . '-' . $this->year['end'];
$count = 2;
} else {
$year = '*';
$count = 1;
}
if ($count === 0 && $this->year['step'] !== 0) {
$year .= '/' . $this->year['step'];
}
return $minute . ' ' . $hour . ' ' . $dayOfMonth . ' ' . $month . ' ' . $dayOfWeek . ' ' . $year;
}
}

View File

@ -0,0 +1,37 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
namespace phpOMS\Utils\TaskSchedule;
/**
* Filesystem class.
*
* Performing operations on the file system
*
* @category System
* @package Framework
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class InvalidTaskParameterException extends \UnexpectedValueException
{
public function __construct($message, $code = 0, \Exception $previous = null)
{
parent::__construct('The parameter "' . $message . '" is not valid for this task.', $code, $previous);
}
}

View File

@ -0,0 +1,60 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @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 <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class Schedule implements TaskInterface
{
/**
* Interval.
*
* @var Interval
* @since 1.0.0
*/
private $interval = null;
private $command = '';
public function __construct(\string $cronjob)
{
}
public function setInterval(Interval $interval)
{
$this->interval = $interval;
}
public function setCommand(\string $command)
{
$this->command = $command;
}
public function __toString()
{
return '';
}
}

View File

@ -0,0 +1,40 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @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 <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
interface ScheduleInterface
{
public function add(TaskInterface $task);
public function remove($id);
public function get(\string $id);
public function list();
public function set(TaskInterface $task);
}

View File

@ -0,0 +1,33 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @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 <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @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);
}

View File

@ -0,0 +1,59 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @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 <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class TaskScheduler implements ScheduleInterface
{
public function __construct() {
}
public function add(TaskInterface $task)
{
// TODO: Implement add() method.
}
public function remove($id)
{
// TODO: Implement remove() method.
}
public function get(\string $id)
{
// TODO: Implement get() method.
}
public function list()
{
// TODO: Implement list() method.
}
public function set(TaskInterface $task)
{
// TODO: Implement set() method.
}
}

View File

@ -64,19 +64,19 @@ class Version
/**
* Loading version file.
*
* @param \string $path Path to version file
* @param \string $jpath Path to version file
*
* @return \string[]
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function getVersion(\string $path) : array
public static function getVersion(\string $jpath) : array
{
$path = realpath($path);
$path = realpath($jpath);
if(strpos($path, ROOT_PATH) === false || strpos($path, 'config.php') !== false) {
throw new FilePathException($path);
throw new FilePathException($jpath);
}
return json_decode(file_get_contents($path), true);