mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 17:58:41 +00:00
Code base cleanup
This commit is contained in:
parent
49696d57df
commit
16320978d3
|
|
@ -23,7 +23,7 @@ use phpOMS\Validation\Base\Email;
|
|||
* Account manager class.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\Asset
|
||||
* @package phpOMS\Account
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace phpOMS\Account;
|
|||
* Account manager class.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\Asset
|
||||
* @package phpOMS\Account
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -18,10 +18,10 @@ namespace phpOMS\Account;
|
|||
use phpOMS\Datatypes\Enum;
|
||||
|
||||
/**
|
||||
* Account type enum.
|
||||
* Account status enum.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\DataStorage\Database
|
||||
* @package phpOMS\Account
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace phpOMS\Account;
|
|||
* Account group class.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\DataStorage\Database
|
||||
* @package phpOMS\Account
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace phpOMS\Account;
|
|||
* Null account class.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\Asset
|
||||
* @package phpOMS\Account
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -18,8 +18,6 @@ namespace phpOMS\Asset;
|
|||
/**
|
||||
* Asset manager class.
|
||||
*
|
||||
* Responsible for authenticating and initializing the connection
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\Asset
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
|
|
|
|||
|
|
@ -18,12 +18,10 @@ namespace phpOMS\Asset;
|
|||
use phpOMS\Datatypes\Enum;
|
||||
|
||||
/**
|
||||
* Login return types enum.
|
||||
*
|
||||
* These are possible answers to authentications.
|
||||
* Asset types enum.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\Auth
|
||||
* @package phpOMS\Asset
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -46,9 +46,9 @@ class Autoloader
|
|||
*/
|
||||
public static function default_autoloader(string $class)
|
||||
{
|
||||
if (($class = self::exists($class)) !== false) {
|
||||
if (($classNew = self::exists($class)) !== false) {
|
||||
/** @noinspection PhpIncludeInspection */
|
||||
include __DIR__ . '/../' . $class . '.php';
|
||||
include __DIR__ . '/../' . $classNew . '.php';
|
||||
} else {
|
||||
throw new \Exception($class);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,10 +18,10 @@ namespace phpOMS\DataStorage\Database;
|
|||
use phpOMS\DataStorage\Database\Schema\Exception\TableException;
|
||||
|
||||
/**
|
||||
* Path exception class.
|
||||
* Database exception factory.
|
||||
*
|
||||
* @category System
|
||||
* @package Framework
|
||||
* @category Framework
|
||||
* @package phpOMS\DataStorage\Database
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
@ -33,9 +33,9 @@ class DatabaseExceptionFactory
|
|||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $message Exception message
|
||||
* @param int $code Exception code
|
||||
* @param \Exception Previous exception
|
||||
* @param \PDOException $e Exception
|
||||
*
|
||||
* @return \PDOException
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
|
|
@ -50,6 +50,16 @@ class DatabaseExceptionFactory
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create table exception.
|
||||
*
|
||||
* @param \PDOException $e Exception
|
||||
*
|
||||
* @return \PDOException
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
private static function createTableViewException(\PDOException $e) : \PDOException
|
||||
{
|
||||
return new TableException(TableException::findTable($e->getMessage()));
|
||||
|
|
|
|||
|
|
@ -16,6 +16,17 @@
|
|||
|
||||
namespace phpOMS\DataStorage\Database;
|
||||
|
||||
/**
|
||||
* Grammar.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\DataStorage\Database
|
||||
* @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
|
||||
*/
|
||||
abstract class GrammarAbstract
|
||||
{
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace phpOMS\Datatypes;
|
|||
* Address type enum.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\DataStorage\Database
|
||||
* @package phpOMS\Datatypes
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ namespace phpOMS\Datatypes\Exception;
|
|||
*
|
||||
* Performing operations on the file system
|
||||
*
|
||||
* @category System
|
||||
* @package Framework
|
||||
* @category Framework
|
||||
* @package phpOMS\Datatypes
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ namespace phpOMS\Datatypes\Exception;
|
|||
*
|
||||
* Performing operations on the file system
|
||||
*
|
||||
* @category System
|
||||
* @package Framework
|
||||
* @category Framework
|
||||
* @package phpOMS\Datatypes
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace phpOMS\Datatypes;
|
|||
* Address type enum.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\DataStorage\Database
|
||||
* @package phpOMS\Datatypes
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ namespace phpOMS\Datatypes;
|
|||
*
|
||||
* Providing smarter datetimes
|
||||
*
|
||||
* @category Modules
|
||||
* @category Framework
|
||||
* @package phpOMS\Datatypes
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ use phpOMS\Views\ViewLayout;
|
|||
* Dispatcher class.
|
||||
*
|
||||
* @category Framework
|
||||
* @package Framework
|
||||
* @package phpOMS\Dispatcher
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
@ -102,7 +102,20 @@ class Dispatcher
|
|||
return $views;
|
||||
}
|
||||
|
||||
private function dispatchString(string $controller, RequestAbstract $request, ResponseAbstract $response, $data = null)
|
||||
/**
|
||||
* Dispatch string.
|
||||
*
|
||||
* @param string|array|\Closure $controller Controller string
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param mixed $data Data
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
private function dispatchString(string $controller, RequestAbstract $request, ResponseAbstract $response, $data = null) : array
|
||||
{
|
||||
$views =[];
|
||||
$dispatch = explode(':', $controller);
|
||||
|
|
@ -120,6 +133,19 @@ class Dispatcher
|
|||
return $views;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch array.
|
||||
*
|
||||
* @param string|array|\Closure $controller Controller string
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param mixed $data Data
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
private function dispatchArray(array $controller, RequestAbstract $request, ResponseAbstract $response, $data = null) : array
|
||||
{
|
||||
$views = [];
|
||||
|
|
@ -132,11 +158,34 @@ class Dispatcher
|
|||
return $views;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch closure.
|
||||
*
|
||||
* @param string|array|\Closure $controller Controller string
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param mixed $data Data
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
private function dispatchClosure(\Closure $controller, RequestAbstract $request, ResponseAbstract $response, $data = null)
|
||||
{
|
||||
return $controller($this->app, $request, $response, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch controller.
|
||||
*
|
||||
* @param string $controller Controller
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
private function getController(string $controller)
|
||||
{
|
||||
if (!isset($this->controllers[$controller])) {
|
||||
|
|
|
|||
|
|
@ -18,10 +18,14 @@ namespace phpOMS\Event;
|
|||
use phpOMS\Pattern\Mediator;
|
||||
|
||||
/**
|
||||
* EventManager class.
|
||||
* Dispatcher class.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\Event
|
||||
* @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
|
||||
*
|
||||
* @todo : make cachable + database storable -> can reload user defined listeners (persistent events)
|
||||
|
|
|
|||
|
|
@ -1,13 +1,17 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
* @copyright 2013
|
||||
* @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\Localization;
|
||||
|
||||
|
|
@ -15,7 +19,7 @@ namespace phpOMS\Localization;
|
|||
* Cities and geo locations
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\DataStorage\Database
|
||||
* @package phpOMS\Localization
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ use phpOMS\Datatypes\EnumArray;
|
|||
* Country codes ISO list.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\DataStorage\Database
|
||||
* @package phpOMS\Localization
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ use phpOMS\Datatypes\Enum;
|
|||
* Country codes ISO list.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\DataStorage\Database
|
||||
* @package phpOMS\Localization
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ use phpOMS\Datatypes\EnumArray;
|
|||
* Country codes ISO list.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\DataStorage\Database
|
||||
* @package phpOMS\Localization
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ use phpOMS\Datatypes\Enum;
|
|||
* Country codes ISO list.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\DataStorage\Database
|
||||
* @package phpOMS\Localization
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ use phpOMS\Datatypes\Enum;
|
|||
* Country codes ISO list.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\DataStorage\Database
|
||||
* @package phpOMS\Localization
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ use phpOMS\Datatypes\EnumArray;
|
|||
* Country codes ISO list.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\DataStorage\Database
|
||||
* @package phpOMS\Localization
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ use phpOMS\Datatypes\Enum;
|
|||
* Country codes ISO list.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\DataStorage\Database
|
||||
* @package phpOMS\Localization
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ use phpOMS\Datatypes\Enum;
|
|||
* Country codes ISO list.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\DataStorage\Database
|
||||
* @package phpOMS\Localization
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ use phpOMS\Datatypes\Enum;
|
|||
* Country codes ISO list.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\DataStorage\Database
|
||||
* @package phpOMS\Localization
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ use phpOMS\Datatypes\EnumArray;
|
|||
* Currency codes ISO list.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\DataStorage\Database
|
||||
* @package phpOMS\Localization
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ use phpOMS\Datatypes\Enum;
|
|||
* Country codes ISO list.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\DataStorage\Database
|
||||
* @package phpOMS\Localization
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ use phpOMS\Datatypes\Enum;
|
|||
* Country symbols ISO list.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\DataStorage\Database
|
||||
* @package phpOMS\Localization
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ use phpOMS\Datatypes\Enum;
|
|||
* Language codes ISO list.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\DataStorage\Database
|
||||
* @package phpOMS\Localization
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ use phpOMS\Datatypes\EnumArray;
|
|||
* Language codes ISO list.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\DataStorage\Database
|
||||
* @package phpOMS\Localization
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ use phpOMS\Datatypes\Enum;
|
|||
* Language codes ISO list.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\DataStorage\Database
|
||||
* @package phpOMS\Localization
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ use phpOMS\Datatypes\EnumArray;
|
|||
* contain all plausible datetime strings.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\DataStorage\Database
|
||||
* @package phpOMS\Localization
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -1,17 +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\Localization;
|
||||
|
||||
class Money implements Serialize {
|
||||
/**
|
||||
* Money class.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\Localization
|
||||
* @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 Money implements \Serializable
|
||||
{
|
||||
|
||||
/**
|
||||
* Max amount of decimals.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
const MAX_DECIMALS = 5;
|
||||
|
||||
/**
|
||||
* Currency symbol.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $currency = ISO4217CharEnum::C_USD;
|
||||
|
||||
/**
|
||||
* Thousands separator.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $thousands = ',';
|
||||
|
||||
/**
|
||||
* Decimal separator.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $decimal = '.';
|
||||
|
||||
/**
|
||||
* Value.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $value = 0;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $currency Currency symbol
|
||||
* @param string $thousands Thousands separator
|
||||
* @param string $decimal Decimal separator
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function __construct(string $currency = ISO4217CharEnum::C_USD, string $thousands = ',', string $decimal = '.')
|
||||
{
|
||||
$this->currency = $currency;
|
||||
|
|
@ -19,18 +86,60 @@ class Money implements Serialize {
|
|||
$this->decimal = $decimal;
|
||||
}
|
||||
|
||||
public function setInt(int $value) {
|
||||
/**
|
||||
* Set money value.
|
||||
*
|
||||
* @param int $value Value
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setInt(int $value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
public function getInt() : int {
|
||||
/**
|
||||
* Get money value.
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getInt() : int
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
public function setString(string $value) {
|
||||
/**
|
||||
* Set value by string.
|
||||
*
|
||||
* @param string $value Money value
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setString(string $value)
|
||||
{
|
||||
$this->value = self::toInt($value, $this->decimal);
|
||||
}
|
||||
|
||||
/**
|
||||
* Money to int.
|
||||
*
|
||||
* @param string $value Money value
|
||||
* @param string $decimal Decimal character
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function toInt(string $value, string $decimal = ',') : int
|
||||
{
|
||||
$split = explode($value, $decimal);
|
||||
|
|
@ -48,6 +157,16 @@ class Money implements Serialize {
|
|||
$this->value = (int) $left * 100000 + (int) $right;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get money.
|
||||
*
|
||||
* @param int $decimals Precision
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getAmount(int $decimals = 2) : string
|
||||
{
|
||||
if($decimals > ($dec = ISO4217DecimalEnum::${'C_' . strtoupper($this->currency)})) {
|
||||
|
|
@ -62,6 +181,16 @@ class Money implements Serialize {
|
|||
return ($decimals > 0) : number_format($left, 0, $this->thousands, $this->decimal); . $this->decimal . $right : (string) $left;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add money.
|
||||
*
|
||||
* @param Money|string|int|float $value
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function add($value)
|
||||
{
|
||||
if(is_string($value) || is_float($value)) {
|
||||
|
|
@ -73,6 +202,16 @@ class Money implements Serialize {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sub money.
|
||||
*
|
||||
* @param Money|string|int|float $value
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function sub($value)
|
||||
{
|
||||
if(is_string($value) || is_float($value)) {
|
||||
|
|
@ -84,6 +223,16 @@ class Money implements Serialize {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Mult.
|
||||
*
|
||||
* @param int|float $value
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function mult($value)
|
||||
{
|
||||
if(is_float($value) || is_int($value)) {
|
||||
|
|
@ -91,6 +240,16 @@ class Money implements Serialize {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Div.
|
||||
*
|
||||
* @param int|float $value
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function div($value)
|
||||
{
|
||||
if(is_float($value) || is_int($value)) {
|
||||
|
|
@ -98,12 +257,30 @@ class Money implements Serialize {
|
|||
}
|
||||
}
|
||||
|
||||
public function serialize() : int
|
||||
/**
|
||||
* Searialze.
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function serialize()
|
||||
{
|
||||
return $this->getInt();
|
||||
}
|
||||
|
||||
public function unserialize(int $value)
|
||||
/**
|
||||
* Unserialize.
|
||||
*
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function unserialize($value)
|
||||
{
|
||||
$this->setInt($value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,8 +15,6 @@
|
|||
*/
|
||||
namespace phpOMS\Localization;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Localization class.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ use phpOMS\Datatypes\Enum;
|
|||
* Country codes ISO list.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\DataStorage\Database
|
||||
* @package phpOMS\Localization
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ use phpOMS\Datatypes\EnumArray;
|
|||
* Currency codes ISO list.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\DataStorage\Database
|
||||
* @package phpOMS\Localization
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ use phpOMS\Datatypes\EnumArray;
|
|||
* PHP Time zones.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\DataStorage\Database
|
||||
* @package phpOMS\Localization
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ use phpOMS\Datatypes\Enum;
|
|||
/**
|
||||
* Log level enum.
|
||||
*
|
||||
* @category Log
|
||||
* @package Framework
|
||||
* @category Framework
|
||||
* @package phpOMS\Log
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -15,6 +15,17 @@
|
|||
*/
|
||||
namespace phpOMS\Log;
|
||||
|
||||
/**
|
||||
* Logging interface.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\Log
|
||||
* @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 LoggerInterface
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -44,9 +44,17 @@ class Header extends HeaderAbstract
|
|||
|
||||
public function __constrct()
|
||||
{
|
||||
$this->setHeader('Content-Type', 'text/html; charset=utf-8');
|
||||
$this->set('Content-Type', 'text/html; charset=utf-8');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all headers.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getHeaders() : array
|
||||
{
|
||||
return getallheaders();
|
||||
|
|
@ -146,6 +154,14 @@ class Header extends HeaderAbstract
|
|||
$this->lock();
|
||||
}
|
||||
|
||||
/**
|
||||
* Lock other header pushing models.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
private function lock()
|
||||
{
|
||||
CookieJar::lock();
|
||||
|
|
@ -173,6 +189,9 @@ class Header extends HeaderAbstract
|
|||
$this->generate406();
|
||||
break;
|
||||
case RequestStatus::R_407:
|
||||
$this->generate407();
|
||||
break;
|
||||
case RequestStatus::R_503:
|
||||
$this->generate503();
|
||||
break;
|
||||
default:
|
||||
|
|
@ -180,22 +199,59 @@ class Header extends HeaderAbstract
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate predefined header.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
private function generate403()
|
||||
{
|
||||
$this->setHeader('HTTP', 'HTTP/1.0 403 Forbidden');
|
||||
$this->setHeader('Status', 'Status: HTTP/1.0 403 Forbidden');
|
||||
$this->set('HTTP', 'HTTP/1.0 403 Forbidden');
|
||||
$this->set('Status', 'Status: HTTP/1.0 403 Forbidden');
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate predefined header.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
private function generate406()
|
||||
{
|
||||
$this->setHeader('HTTP', 'HTTP/1.0 406 Not acceptable');
|
||||
$this->setHeader('Status', 'Status: 406 Not acceptable');
|
||||
$this->set('HTTP', 'HTTP/1.0 406 Not acceptable');
|
||||
$this->set('Status', 'Status: 406 Not acceptable');
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate predefined header.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
private function generate503()
|
||||
{
|
||||
$this->setHeader('HTTP', 'HTTP/1.0 503 Service Temporarily Unavailable');
|
||||
$this->setHeader('Status', 'Status: 503 Service Temporarily Unavailable');
|
||||
$this->setHeader('Retry-After', 'Retry-After: 300');
|
||||
$this->set('HTTP', 'HTTP/1.0 503 Service Temporarily Unavailable');
|
||||
$this->set('Status', 'Status: 503 Service Temporarily Unavailable');
|
||||
$this->set('Retry-After', 'Retry-After: 300');
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate predefined header.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
private function generate407()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -60,6 +60,14 @@ class Request extends RequestAbstract
|
|||
*/
|
||||
protected $path = null;
|
||||
|
||||
/**
|
||||
* Request status.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $status = RequestStatus::R_200;
|
||||
|
||||
/**
|
||||
* Uploaded files.
|
||||
*
|
||||
|
|
@ -431,6 +439,14 @@ class Request extends RequestAbstract
|
|||
return $this->files;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get route verb for this request.
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getRouteVerb() : int
|
||||
{
|
||||
switch($this->getMethod()) {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
* @version 1.0.0
|
||||
* @link http://orange-management.com
|
||||
*/
|
||||
namespace phpOMS\Message;
|
||||
namespace phpOMS\Message\Http;
|
||||
|
||||
use phpOMS\Datatypes\Enum;
|
||||
|
||||
|
|
@ -120,7 +120,7 @@ class Response extends ResponseAbstract implements RenderableInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* Generate response.
|
||||
* Generate response based on header.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
|
|
@ -139,11 +139,27 @@ class Response extends ResponseAbstract implements RenderableInterface
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate json response.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
private function getJson() : string
|
||||
{
|
||||
return json_encode($this->getArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate raw response.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
private function getRaw() : string
|
||||
{
|
||||
$render = '';
|
||||
|
|
@ -165,6 +181,14 @@ class Response extends ResponseAbstract implements RenderableInterface
|
|||
return $render;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate response array from views.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
private function getArray() : array
|
||||
{
|
||||
$result = [];
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ abstract class RequestAbstract implements MessageInterface
|
|||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $status = RequestStatus::R_200;
|
||||
protected $status = null;
|
||||
|
||||
/**
|
||||
* Request hash.
|
||||
|
|
|
|||
|
|
@ -156,6 +156,14 @@ abstract class ResponseAbstract implements MessageInterface
|
|||
return json_encode($this->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get header.
|
||||
*
|
||||
* @return HeaderAbstract
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getHeader() : HeaderAbstract
|
||||
{
|
||||
return $this->header;
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ use phpOMS\Contract\RenderableInterface;
|
|||
*
|
||||
* Responsible for handling everything that's going on in the <head>
|
||||
*
|
||||
* @category Log
|
||||
* @package Framework
|
||||
* @category Framework
|
||||
* @package phpOMS/Model
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ use phpOMS\Contract\RenderableInterface;
|
|||
/**
|
||||
* Meta class.
|
||||
*
|
||||
* @category Log
|
||||
* @package Framework
|
||||
* @category Framework
|
||||
* @package phpOMS/Model
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ use phpOMS\Validation\Validator;
|
|||
*
|
||||
* Handling the info files for modules
|
||||
*
|
||||
* @category Module
|
||||
* @package Framework
|
||||
* @category Framework
|
||||
* @package phpOMS\Module
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
@ -64,6 +64,14 @@ class InfoManager
|
|||
$this->path = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load info data from path.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public function load()
|
||||
{
|
||||
if (($path = realpath($this->path)) === false) {
|
||||
|
|
@ -116,31 +124,79 @@ class InfoManager
|
|||
return $this->info;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get info data.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public function getInternalName() : string
|
||||
{
|
||||
return $this->info['name']['internal'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get info data.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public function getDependencies() : array
|
||||
{
|
||||
return $this->info['dependencies'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get info data.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public function getProviding() : array
|
||||
{
|
||||
return $this->info['providing'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get info data.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public function getDirectory() : string
|
||||
{
|
||||
return $this->info['directory'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get info data.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public function getVersion() : string
|
||||
{
|
||||
return $this->info['version'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get info data.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public function getLoad() : array
|
||||
{
|
||||
return $this->info['load'];
|
||||
|
|
|
|||
|
|
@ -52,17 +52,28 @@ class InstallerAbstract
|
|||
self::installRoutes(ROOT_PATH . '/Console/Routes.php', ROOT_PATH . '/Modules/' . $info->getDirectory() . '/Admin/Routes/console.php');
|
||||
}
|
||||
|
||||
private static function installRoutes(string $appRoutePath, string $moduleRoutePath)
|
||||
/**
|
||||
* Install routes.
|
||||
*
|
||||
* @param string $destRoutePath Destination route path
|
||||
* @param string $srcRoutePath Source route path
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
private static function installRoutes(string $destRoutePath, string $srcRoutePath)
|
||||
{
|
||||
if(file_exists($appRoutePath) && file_exists($moduleRoutePath)) {
|
||||
$appRoutes = include $appRoutePath;
|
||||
$moduleRoutes = include $moduleRoutePath;
|
||||
if(file_exists($destRoutePath) && file_exists($srcRoutePath)) {
|
||||
$appRoutes = include $destRoutePath;
|
||||
$moduleRoutes = include $srcRoutePath;
|
||||
$appRoutes = array_merge_recursive($appRoutes, $moduleRoutes);
|
||||
|
||||
if(is_writable($appRoutePath)) {
|
||||
file_put_contents($appRoutePath, '<?php return ' . ArrayParser::serializeArray($appRoutes) . ';', LOCK_EX);
|
||||
if(is_writable($destRoutePath)) {
|
||||
file_put_contents($destRoutePath, '<?php return ' . ArrayParser::serializeArray($appRoutes) . ';', LOCK_EX);
|
||||
} else {
|
||||
throw new PermissionException($appRoutePath);
|
||||
throw new PermissionException($destRoutePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ use phpOMS\ApplicationAbstract;
|
|||
*
|
||||
* Responsible for initializing modules as singletons
|
||||
*
|
||||
* @category Module
|
||||
* @package Framework
|
||||
* @category Framework
|
||||
* @package phpOMS\Module
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ use phpOMS\Utils\IO\Json\InvalidJsonException;
|
|||
*
|
||||
* General module functionality such as listings and initialization.
|
||||
*
|
||||
* @category Module
|
||||
* @package Framework
|
||||
* @category Framework
|
||||
* @package phpOMS\Module
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
@ -323,6 +323,16 @@ class ModuleManager
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register module in database.
|
||||
*
|
||||
* @param string $module Module name
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
private function registerInDatabase(InfoManager $info)
|
||||
{
|
||||
switch ($this->app->dbPool->get('core')->getType()) {
|
||||
|
|
@ -366,6 +376,16 @@ class ModuleManager
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Install module dependencies.
|
||||
*
|
||||
* @param array $dependencies Module dependencies
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
private function installDependencies(array $dependencies)
|
||||
{
|
||||
foreach ($dependencies as $key => $version) {
|
||||
|
|
@ -373,6 +393,16 @@ class ModuleManager
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Install module itself.
|
||||
*
|
||||
* @param InfoManager $info Module info
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
private function installModule(InfoManager $info)
|
||||
{
|
||||
$class = '\\Modules\\' . $info->getDirectory() . '\\Admin\\Installer';
|
||||
|
|
@ -385,6 +415,16 @@ class ModuleManager
|
|||
$class::install($this->app->dbPool, $info);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load info of module.
|
||||
*
|
||||
* @param string $module Module name
|
||||
*
|
||||
* @return InfoManager
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
private function loadInfo(string $module) : InfoManager
|
||||
{
|
||||
$path = realpath($oldPath = self::MODULE_PATH . '/' . $module . '/' . 'info.json');
|
||||
|
|
@ -465,6 +505,16 @@ class ModuleManager
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize array of modules.
|
||||
*
|
||||
* @param array $modules Modules
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
private function initModuleArray(array $modules)
|
||||
{
|
||||
foreach ($modules as $module) {
|
||||
|
|
@ -480,6 +530,18 @@ class ModuleManager
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize module.
|
||||
*
|
||||
* Also registers controller in the dispatcher
|
||||
*
|
||||
* @param string $module Module
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
private function initModuleController(string $module)
|
||||
{
|
||||
$this->running[$module] = ModuleFactory::getInstance($module, $this->app);
|
||||
|
|
|
|||
|
|
@ -1,34 +0,0 @@
|
|||
<?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\Router;
|
||||
|
||||
/**
|
||||
* Router class.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\Socket
|
||||
* @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 RouteAbstract
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -18,10 +18,10 @@ namespace phpOMS\Router;
|
|||
use phpOMS\Datatypes\Enum;
|
||||
|
||||
/**
|
||||
* View layout enum.
|
||||
* Route verb enum.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\Socket
|
||||
* @package phpOMS\Router
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ use phpOMS\Message\RequestAbstract;
|
|||
* Router class.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\Socket
|
||||
* @package phpOMS\Router
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
@ -50,9 +50,19 @@ class Router
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Add routes from file.
|
||||
*
|
||||
* @param string $path Route file path
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function importFromFile(string $path)
|
||||
{
|
||||
$this->routes = include $path;
|
||||
$this->routes += include $path;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -61,7 +71,6 @@ class Router
|
|||
* @param string $route Route regex
|
||||
* @param mixed $destination Destination e.g. Module:function & verb
|
||||
* @param string $verb Request verb
|
||||
* @param int $layout Result layout
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
|
|
@ -77,10 +86,9 @@ class Router
|
|||
}
|
||||
|
||||
/**
|
||||
* Route uri.
|
||||
* Route request.
|
||||
*
|
||||
* @param string $uri Uri to route
|
||||
* @param string $verb GET/POST etc.
|
||||
* @param RequestAbstract $request Request to route
|
||||
*
|
||||
* @return string[]
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
<?php
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* @version 1.0.0
|
||||
* @link http://orange-management.com
|
||||
*/
|
||||
namespace phpOMS\Utils;
|
||||
namespace phpOMS\Stdlib\Map;
|
||||
|
||||
use phpOMS\Datatypes\Enum;
|
||||
|
||||
|
|
@ -21,7 +21,7 @@ use phpOMS\Datatypes\Enum;
|
|||
* Account type enum.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\DataStorage\Database
|
||||
* @package phpOMS\Stdlib
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
@ -13,13 +13,13 @@
|
|||
* @version 1.0.0
|
||||
* @link http://orange-management.com
|
||||
*/
|
||||
namespace phpOMS\Utils;
|
||||
namespace phpOMS\Stdlib\Map;
|
||||
|
||||
/**
|
||||
* Multimap utils.
|
||||
*
|
||||
* @category Framework
|
||||
* @package Utils
|
||||
* @package phpOMS\Stdlib
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* @version 1.0.0
|
||||
* @link http://orange-management.com
|
||||
*/
|
||||
namespace phpOMS\Utils;
|
||||
namespace phpOMS\Stdlib\Map;
|
||||
|
||||
use phpOMS\Datatypes\Enum;
|
||||
|
||||
|
|
@ -21,7 +21,7 @@ use phpOMS\Datatypes\Enum;
|
|||
* Account type enum.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\DataStorage\Database
|
||||
* @package phpOMS\Stdlib
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
@ -13,13 +13,17 @@
|
|||
* @version 1.0.0
|
||||
* @link http://orange-management.com
|
||||
*/
|
||||
namespace phpOMS\Stdlib;
|
||||
namespace phpOMS\Stdlib\Queue;
|
||||
|
||||
/**
|
||||
* PriorityQueue class.
|
||||
* Router class.
|
||||
*
|
||||
* @category Stdlib
|
||||
* @package Framework
|
||||
* @category Framework
|
||||
* @package phpOMS\Stdlib
|
||||
* @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 PriorityQueue implements \Countable, \Serializable
|
||||
|
|
@ -20,8 +20,8 @@ namespace phpOMS\System\File;
|
|||
*
|
||||
* Performing operations on the file system
|
||||
*
|
||||
* @category System
|
||||
* @package Framework
|
||||
* @category Framework
|
||||
* @package phpOMS\System\File
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
@ -46,6 +46,42 @@ class Directory extends FileAbstract implements \Iterator, \ArrayAccess
|
|||
*/
|
||||
private $nodes = [];
|
||||
|
||||
/**
|
||||
* Get folder size recursively.
|
||||
*
|
||||
* This can become rather slow for large structures.
|
||||
*
|
||||
* @param string $dir Root dir to inspect
|
||||
* @param bool $recursive Get size recursive
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public static function getFolderSize(string $dir, bool $recursive = true) : int
|
||||
{
|
||||
$countSize = 0;
|
||||
$count = 0;
|
||||
|
||||
if (is_readable($dir)) {
|
||||
$dir_array = scandir($dir);
|
||||
|
||||
foreach ($dir_array as $key => $filename) {
|
||||
if ($filename != ".." && $filename != ".") {
|
||||
if (is_dir($dir . "/" . $filename) && $recursive) {
|
||||
$countSize += self::getFolderSize($dir . "/" . $filename, $recursive);
|
||||
} else if (is_file($dir . "/" . $filename)) {
|
||||
$countSize += filesize($dir . "/" . $filename);
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (int) $countSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get file count inside path.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ namespace phpOMS\System\File;
|
|||
*
|
||||
* Performing operations on the file system
|
||||
*
|
||||
* @category System
|
||||
* @package Framework
|
||||
* @category Framework
|
||||
* @package phpOMS\System\File
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ namespace phpOMS\System\File;
|
|||
*
|
||||
* Performing operations on the file system
|
||||
*
|
||||
* @category System
|
||||
* @package Framework
|
||||
* @category Framework
|
||||
* @package phpOMS\System\File
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ namespace phpOMS\System\File;
|
|||
*
|
||||
* Performing operations on the file system
|
||||
*
|
||||
* @category System
|
||||
* @package Framework
|
||||
* @category Framework
|
||||
* @package phpOMS\System\File
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ namespace phpOMS\System\File;
|
|||
/**
|
||||
* Path exception class.
|
||||
*
|
||||
* @category System
|
||||
* @package Framework
|
||||
* @category Framework
|
||||
* @package phpOMS\System\File
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ namespace phpOMS\System\File;
|
|||
/**
|
||||
* Permission exception class.
|
||||
*
|
||||
* @category System
|
||||
* @package Framework
|
||||
* @category Framework
|
||||
* @package phpOMS\System\File
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ use phpOMS\Datatypes\Enum;
|
|||
* Database types that are supported by the application
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\DataStorage\Database
|
||||
* @package phpOMS\System
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ namespace phpOMS\System;
|
|||
/**
|
||||
* Operating system class.
|
||||
*
|
||||
* @category System
|
||||
* @package Framework
|
||||
* @category Framework
|
||||
* @package phpOMS\System
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ use phpOMS\Datatypes\Enum;
|
|||
* Database types that are supported by the application
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\DataStorage\Database
|
||||
* @package phpOMS\System
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -13,13 +13,13 @@
|
|||
* @version 1.0.0
|
||||
* @link http://orange-management.com
|
||||
*/
|
||||
namespace phpOMS\Utils;
|
||||
namespace phpOMS\System;
|
||||
|
||||
/**
|
||||
* System utils
|
||||
*
|
||||
* @category Framework
|
||||
* @package Utils
|
||||
* @package phpOMS\System
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
@ -39,41 +39,6 @@ class SystemUtils
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Get folder size recursively.
|
||||
*
|
||||
* This can become rather slow for large structures.
|
||||
*
|
||||
* @param string $dir Root dir to inspect
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public static function getFolderSize(string $dir) : int
|
||||
{
|
||||
$countSize = 0;
|
||||
$count = 0;
|
||||
|
||||
if (is_readable($dir)) {
|
||||
$dir_array = scandir($dir);
|
||||
|
||||
foreach ($dir_array as $key => $filename) {
|
||||
if ($filename != ".." && $filename != ".") {
|
||||
if (is_dir($dir . "/" . $filename)) {
|
||||
$countSize += self::getFolderSize($dir . "/" . $filename);
|
||||
} else if (is_file($dir . "/" . $filename)) {
|
||||
$countSize += filesize($dir . "/" . $filename);
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (int) $countSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get system RAM.
|
||||
*
|
||||
|
|
@ -20,8 +20,8 @@ namespace phpOMS\Uri;
|
|||
*
|
||||
* Used in order to create and evaluate a uri
|
||||
*
|
||||
* @category Uri
|
||||
* @package Framework
|
||||
* @category Framework
|
||||
* @package phpOMS/Uri
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ namespace phpOMS\Uri;
|
|||
/**
|
||||
* Uri exception.
|
||||
*
|
||||
* @category Uri
|
||||
* @package Framework
|
||||
* @category Framework
|
||||
* @package phpOMS/Uri
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ namespace phpOMS\Uri;
|
|||
*
|
||||
* Used in order to create a uri
|
||||
*
|
||||
* @category Uri
|
||||
* @package Framework
|
||||
* @category Framework
|
||||
* @package phpOMS/Uri
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ namespace phpOMS\Uri;
|
|||
/**
|
||||
* Uri interface.
|
||||
*
|
||||
* @category Uri
|
||||
* @package Framework
|
||||
* @category Framework
|
||||
* @package phpOMS/Uri
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ use phpOMS\Datatypes\Enum;
|
|||
/**
|
||||
* Uri scheme.
|
||||
*
|
||||
* @category Uri
|
||||
* @package Framework
|
||||
* @category Framework
|
||||
* @package phpOMS/Uri
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace phpOMS\Utils;
|
|||
* Array utils.
|
||||
*
|
||||
* @category Framework
|
||||
* @package Utils
|
||||
* @package phpOMS\Utils
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -1,170 +0,0 @@
|
|||
<?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\Compiler\Php;
|
||||
|
||||
use phpOMS\Utils\ArrayUtils;
|
||||
|
||||
/**
|
||||
* Php enum compiler.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\DataStorage\Database
|
||||
* @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 ClassCompiler
|
||||
{
|
||||
private $path = null;
|
||||
|
||||
private $namespace = null;
|
||||
|
||||
private $class = null;
|
||||
|
||||
private $extends = null;
|
||||
|
||||
private $implements = [];
|
||||
|
||||
private $member = [];
|
||||
|
||||
public function __construct($path)
|
||||
{
|
||||
$this->path = (string) $path;
|
||||
}
|
||||
|
||||
public function getPath()
|
||||
{
|
||||
return $this->path;
|
||||
}
|
||||
|
||||
public function setPath($path)
|
||||
{
|
||||
$this->path = (string) $path;
|
||||
}
|
||||
|
||||
public function setNamesapce($namespace)
|
||||
{
|
||||
$this->namespace = $namespace;
|
||||
}
|
||||
|
||||
public function getNamesapce()
|
||||
{
|
||||
return $this->namespace;
|
||||
}
|
||||
|
||||
public function getClass()
|
||||
{
|
||||
return $this->class;
|
||||
}
|
||||
|
||||
public function setClass($class)
|
||||
{
|
||||
$this->class = $class;
|
||||
}
|
||||
|
||||
public function getExtends()
|
||||
{
|
||||
return $this->extends;
|
||||
}
|
||||
|
||||
public function setExtends($extends)
|
||||
{
|
||||
$this->extends = $extends;
|
||||
}
|
||||
|
||||
public function addImplements($implements)
|
||||
{
|
||||
$this->implements[] = $implements;
|
||||
}
|
||||
|
||||
public function getImplements()
|
||||
{
|
||||
return $this->implements;
|
||||
}
|
||||
|
||||
public function getMember($name)
|
||||
{
|
||||
return $this->member[$name];
|
||||
}
|
||||
|
||||
public function setMember($name, $default = null, $isString = false, $type = 'private', $static = false, $overwrite = true)
|
||||
{
|
||||
if ($overwrite || !isset($this->member[$name])) {
|
||||
$this->member[$name] = ['default' => $default,
|
||||
'isString' => $isString,
|
||||
'type' => $type,
|
||||
'static' => $static,];
|
||||
}
|
||||
}
|
||||
|
||||
public function removeMember($name)
|
||||
{
|
||||
unset($this->member[$name]);
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
$member = '';
|
||||
foreach ($this->member as $name => $value) {
|
||||
$member .= ' ' . ($value['static'] ? 'static ' : '')
|
||||
. $value['type'] . ' ' . $name;
|
||||
|
||||
if (isset($value['default'])) {
|
||||
$member .= ' = ';
|
||||
|
||||
if ($value['isString']) {
|
||||
$member .= $value['default'];
|
||||
} else {
|
||||
switch (gettype($value['default'])) {
|
||||
case 'array':
|
||||
$member .= ArrayUtils::stringify($value['default']);
|
||||
break;
|
||||
case 'integer':
|
||||
case 'float':
|
||||
case 'double':
|
||||
$member .= $value['default'];
|
||||
break;
|
||||
case 'string':
|
||||
$member .= '"' . $value['default'] . '"';
|
||||
break;
|
||||
case 'object':
|
||||
$member .= get_class($value['default']) . '()';
|
||||
// TODO: implement object with parameters -> Reflection
|
||||
break;
|
||||
case 'boolean':
|
||||
$member .= ($value['default'] ? 'true' : 'false');
|
||||
break;
|
||||
case 'NULL':
|
||||
$member .= 'null';
|
||||
break;
|
||||
default:
|
||||
throw new \Exception('Unknown default type');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$member .= ';' . PHP_EOL;
|
||||
}
|
||||
|
||||
return '<?php' . PHP_EOL
|
||||
. (isset($this->namespace) ? 'namespace ' . $this->namespace . ';' . PHP_EOL : '')
|
||||
. 'abstract class' . $this->class . (isset($this->extends) ? ' extends ' . $this->extends : '') . (isset($this->implements) ? ' implements ' . implode(',', $this->implements) : '') . ' {' . PHP_EOL
|
||||
. $member
|
||||
. '}';
|
||||
}
|
||||
}
|
||||
|
|
@ -19,7 +19,7 @@ namespace phpOMS\Utils\Converter;
|
|||
* Currency converter.
|
||||
*
|
||||
* @category Framework
|
||||
* @package Converter
|
||||
* @package phpOMS\Utils\Converter
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace phpOMS\Utils\Converter;
|
|||
* File converter.
|
||||
*
|
||||
* @category Framework
|
||||
* @package Converter
|
||||
* @package phpOMS\Utils\Converter
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace phpOMS\Utils\Converter;
|
|||
* Measurement converter.
|
||||
*
|
||||
* @category Framework
|
||||
* @package Converter
|
||||
* @package phpOMS\Utils\Converter
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace phpOMS\Utils\Converter;
|
|||
* Numeric converter.
|
||||
*
|
||||
* @category Framework
|
||||
* @package Converter
|
||||
* @package phpOMS\Utils\Converter
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ use phpOMS\Datatypes\Enum;
|
|||
* Temperature type enum.
|
||||
*
|
||||
* @category Framework
|
||||
* @package Converter
|
||||
* @package phpOMS\Utils\Converter
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
84
Utils/Encoding/Ceasar.php
Normal file
84
Utils/Encoding/Ceasar.php
Normal 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\Utils\Encoding;
|
||||
|
||||
/**
|
||||
* Gray encoding class
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\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 Ceasar {
|
||||
const LIMIT_LOWER = 0;
|
||||
const LIMIT_UPPER = 127;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function encode(string $source, string $key) : string
|
||||
{
|
||||
$result = '';
|
||||
$length = strlen($source);
|
||||
$keyLength = strlen($key)-1;
|
||||
|
||||
for($i = 0, $j = 0; $i < $length; $i++, $j++) {
|
||||
if($j > $keyLength) {
|
||||
$j = 0;
|
||||
}
|
||||
|
||||
$ascii = ord($source[$i]) + ord($key[$j]);
|
||||
|
||||
if($ascii > self::LIMIT_UPPER) {
|
||||
$ascii -= self::LIMIT_UPPER;
|
||||
}
|
||||
|
||||
$result .= char($ascii);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function decode(string $raw, string $key) : string
|
||||
{
|
||||
$result = '';
|
||||
$length = strlen($raw);
|
||||
$keyLength = strlen($key)-1;
|
||||
|
||||
for($i = 0, $j = 0; $i < $length; $i++, $j++) {
|
||||
if($j > $keyLength) {
|
||||
$j = 0;
|
||||
}
|
||||
|
||||
$ascii = ord($raw[$i]) - ord($key[$j]);
|
||||
|
||||
if($ascii < self::LIMIT_LOWER) {
|
||||
$ascii += self::LIMIT_LOWER;
|
||||
}
|
||||
|
||||
$result .= char($ascii);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
|
@ -19,7 +19,7 @@ namespace phpOMS\Utils\Encoding;
|
|||
* Encoding Interface
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\Asset
|
||||
* @package phpOMS\Utils
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace phpOMS\Utils\Encoding;
|
|||
* Gray encoding class
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\Asset
|
||||
* @package phpOMS\Utils
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
59
Utils/Encoding/Xor.php
Normal file
59
Utils/Encoding/Xor.php
Normal 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\Encoding;
|
||||
|
||||
/**
|
||||
* Gray encoding class
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\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 Xor {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function encode(string $source, string $key) : string
|
||||
{
|
||||
$result = '';
|
||||
$length = strlen($source);
|
||||
$keyLength = strlen($key)-1;
|
||||
|
||||
for($i = 0, $j = 0; $i < $length; $i++, $j++) {
|
||||
if($j > $keyLength) {
|
||||
$j = 0;
|
||||
}
|
||||
|
||||
$ascii = ord($source[$i]) ^ ord($key[$j]);
|
||||
$result .= char($ascii);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function decode(string $raw, string $key) : string
|
||||
{
|
||||
return self::encode($raw, $key)
|
||||
}
|
||||
}
|
||||
|
|
@ -15,8 +15,6 @@
|
|||
*/
|
||||
namespace phpOMS\Utils;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Json builder class.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ namespace phpOMS\Utils\Parser\Php;
|
|||
*
|
||||
* Parsing/serializing arrays to and from php file
|
||||
*
|
||||
* @category System
|
||||
* @package Framework
|
||||
* @category Framework
|
||||
* @package phpOMS\Utils\Parser
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ namespace phpOMS\Utils\Parser\Php;
|
|||
*
|
||||
* Parsing/serializing arrays to and from php file
|
||||
*
|
||||
* @category System
|
||||
* @package Framework
|
||||
* @category Framework
|
||||
* @package phpOMS\Utils\Parser
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user