From aca0e8ff08d9616e236bddd74d124d689204e588 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 14 Aug 2016 20:57:57 +0200 Subject: [PATCH] Fixed for documentor --- Api/GitHub/Issues/AssigneesRequest.php | 0 Api/GitHub/Issues/CommentsReqeust.php | 0 Api/GitHub/Issues/LabelsRequest.php | 0 Api/GitHub/Issues/MilestonesRequest.php | 0 Api/GitHub/Organizations/MembersRequest.php | 0 Api/GitHub/Organizations/TeamsRequest.php | 0 .../Repositories/CollaboratorsRequest.php | 0 Api/GitHub/Repositories/CommentsReqeust.php | 0 Api/GitHub/Repositories/CommitsRequest.php | 0 Api/GitHub/Repositories/StatisticsRequest.php | 0 Api/GitHub/Repositories/StatusesRequest.php | 0 DataStorage/Cache/FileCache.php | 6 +- DataStorage/Cache/MemCache.php | 6 +- DataStorage/Cache/NullCache.php | 6 +- DataStorage/Cache/RedisCache.php | 6 +- DataStorage/Cache/WinCache.php | 6 +- .../Connection/ConnectionException.php | 21 ++ .../Connection/PostgresConnection.php | 21 ++ .../Connection/SqlServerConnection.php | 21 ++ .../Database/Connector/MysqlConnector.php | 21 ++ .../Database/Connector/PostgresConnector.php | 21 ++ .../Database/Connector/SQLiteConnector.php | 21 ++ .../Database/Connector/SqlServerConnector.php | 21 ++ DataStorage/Database/Query/Expression.php | 23 ++ .../Query/Grammar/GrammarInterface.php | 4 +- .../Schema/Grammar/GrammarInterface.php | 2 +- .../Schema/Grammar/PostgresGrammar.php | 21 ++ .../Database/Schema/Grammar/SQLiteGrammar.php | 21 ++ .../Schema/Grammar/SqlServerGrammar.php | 21 ++ Datatypes/ExactFloat.php | 8 +- Event/EventManager.php | 4 +- Localization/ISO4217SymbolEnum.php | 2 - Math/Finance/Depreciation.php | 21 ++ Math/Finance/Forecasting/AR.php | 6 + Math/Finance/Forecasting/ARCH.php | 6 + Math/Finance/Forecasting/ARFIMA.php | 6 + Math/Finance/Forecasting/ARIMA.php | 2 + Math/Finance/Forecasting/ARMA.php | 6 + .../Forecasting/ClassicalDecomposition.php | 14 +- .../Forecasting/ExponentialSmoothing.php | 6 + .../Forecasting/ForecastingInterface.php | 1 - Math/Finance/Forecasting/GARCH.php | 6 + Math/Finance/Forecasting/MA.php | 7 + Math/Finance/Forecasting/NAR.php | 7 + Math/Finance/Forecasting/NMA.php | 7 + Math/Finance/Forecasting/SARIMA.php | 8 + Math/Integral/Gauss.php | 22 ++ Math/Matrix/Cholesky.php | 22 ++ Math/Number/Irrational.php | 22 +- Math/Number/NumberType.php | 2 +- ...onInterface.php => OperationInterface.php} | 2 - Math/Number/Rational.php | 21 +- Math/Number/Real.php | 22 +- Math/Optimization/GaussianElimination.php | 3 +- Math/Optimization/Graph/FloydWarshall.php | 8 + Math/Optimization/Knappsack/Backpack.php | 8 + Math/Optimization/Knappsack/BruteForce.php | 8 + Math/Optimization/Knappsack/GA.php | 8 + Math/Optimization/Knappsack/Item.php | 8 + Math/Optimization/Knappsack/ItemPool.php | 8 + Math/Optimization/Knappsack/Population.php | 8 + .../ShiftScheduling/BruteForce.php | 8 + Math/Optimization/ShiftScheduling/GA.php | 8 + .../ShiftScheduling/Population.php | 8 + Math/Optimization/ShiftScheduling/Workday.php | 8 + Math/Optimization/ShiftScheduling/Worker.php | 8 + .../ShiftScheduling/WorkerPool.php | 8 + Math/Shape/D2/Quadrilateral.php | 7 + Math/Shape/D3/Prism.php | 7 + Math/Statistic/Average.php | 18 +- Math/Statistic/Forecast/Error.php | 4 +- Math/Statistic/Forecast/Forecasts.php | 4 +- .../Regression/MultipleLinearRegression.php | 2 + .../Regression/RegressionAbstract.php | 16 +- .../Distribution/BernoulliDistribution.php | 2 +- .../Distribution/BetaDistribution.php | 8 + .../Stochastic/Distribution/FDistribution.php | 8 + .../Distribution/GammaDistribution.php | 8 + .../HypergeometricDistribution.php | 8 + .../Distribution/LogDistribution.php | 8 + .../Distribution/LogNormalDistribution.php | 8 + .../Distribution/LogisticDistribution.php | 8 + .../Distribution/ParetoDistribution.php | 8 + .../Stochastic/Distribution/TDistribution.php | 8 + .../Distribution/WeibullDistribution.php | 8 + Message/Mail/OAuth.php | 8 + Message/Mail/Pop3.php | 8 + Message/Mail/Smtp.php | 8 + Message/Request/Lock/FileLock.php | 0 Message/Request/Lock/MemcacheLock.php | 0 Message/Request/Lock/SemLock.php | 0 Message/Request/Lock/SessionLock.php | 0 Message/Socket/Request.php | 8 + Message/Socket/Response.php | 8 + Message/UploadedFileInterface.php | 2 +- Stdlib/Collection/Collection.php | 2 +- System/File/Directory.php | 2 +- Utils/Barcode/C128c.php | 2 +- Utils/Barcode/C25.php | 2 +- Utils/Barcode/C39.php | 2 +- Utils/Barcode/Codebar.php | 2 +- Utils/Converter/EnergyPowerType.php | 33 ++ Utils/Excel/Excel.php | 2 +- Utils/IO/Csv/CsvDatabaseMapper.php | 2 - Utils/JobQueue/JobQueue.php | 125 ++++---- Utils/Parser/LaTex/Expressions/Product.php | 20 ++ Utils/Parser/LaTex/Expressions/Sum.php | 20 ++ .../Parser/LaTex/Expressions/Trigonometry.php | 20 ++ Utils/Parser/LaTex/LaTexParser.php | 20 ++ Utils/Parser/LaTex/Types/Interval.php | 20 ++ Utils/Parser/LaTex/Types/MathFunction.php | 20 ++ Utils/Parser/LaTex/Types/Variable.php | 20 ++ Utils/RnG/Address.php | 20 ++ Utils/RnG/City.php | 20 ++ Utils/RnG/Country.php | 20 ++ Utils/RnG/Currency.php | 20 ++ Utils/RnG/Email.php | 20 ++ Utils/RnG/IBAN.php | 20 ++ Utils/RnG/Numeric.php | 20 ++ Utils/RnG/PostalZip.php | 20 ++ ....php => InvalidTaskParameterException.php} | 0 Validation/Barcode/Barcode.php | 23 ++ Validation/Barcode/Barcode11.php | 23 ++ Validation/Barcode/Barcode128.php | 23 ++ Validation/Barcode/Barcode25.php | 23 ++ Validation/Barcode/Barcode39.php | 23 ++ Validation/Barcode/Barcode93.php | 23 ++ Validation/Barcode/BarcodeCodebar.php | 23 ++ Validation/Barcode/BarcodeDatamatrix.php | 23 ++ Validation/Barcode/BarcodeEAN.php | 23 ++ Validation/Barcode/BarcodeI25.php | 0 Validation/Barcode/BarcodeMSI.php | 23 ++ Validation/Barcode/QrCode.php | 23 ++ Validation/Base/BIC.php | 3 +- Validation/Base/CreditCard.php | 3 +- Validation/Base/Hostname.php | 3 +- Validation/Base/IP.php | 3 +- Validation/File/Crc32.php | 23 ++ Validation/File/Extension.php | 23 ++ Validation/File/FileSize.php | 23 ++ Validation/File/Hash.php | 23 ++ Validation/File/IsCompressed.php | 23 ++ Validation/File/IsExecutable.php | 23 ++ Validation/File/IsImage.php | 23 ++ Validation/File/IsPDF.php | 23 ++ Validation/File/MimeType.php | 23 ++ Views/View.php | 242 +-------------- Views/ViewAbstract.php | 292 ++++++++++++++++++ 148 files changed, 1886 insertions(+), 382 deletions(-) delete mode 100644 Api/GitHub/Issues/AssigneesRequest.php delete mode 100644 Api/GitHub/Issues/CommentsReqeust.php delete mode 100644 Api/GitHub/Issues/LabelsRequest.php delete mode 100644 Api/GitHub/Issues/MilestonesRequest.php delete mode 100644 Api/GitHub/Organizations/MembersRequest.php delete mode 100644 Api/GitHub/Organizations/TeamsRequest.php delete mode 100644 Api/GitHub/Repositories/CollaboratorsRequest.php delete mode 100644 Api/GitHub/Repositories/CommentsReqeust.php delete mode 100644 Api/GitHub/Repositories/CommitsRequest.php delete mode 100644 Api/GitHub/Repositories/StatisticsRequest.php delete mode 100644 Api/GitHub/Repositories/StatusesRequest.php delete mode 100644 Math/Finance/Forecasting/ForecastingInterface.php rename Math/Number/{OpperationInterface.php => OperationInterface.php} (98%) delete mode 100644 Message/Request/Lock/FileLock.php delete mode 100644 Message/Request/Lock/MemcacheLock.php delete mode 100644 Message/Request/Lock/SemLock.php delete mode 100644 Message/Request/Lock/SessionLock.php rename Utils/TaskSchedule/{InvalidTaskParameterExceltion.php => InvalidTaskParameterException.php} (100%) create mode 100644 Validation/Barcode/Barcode25.php delete mode 100644 Validation/Barcode/BarcodeI25.php create mode 100644 Views/ViewAbstract.php diff --git a/Api/GitHub/Issues/AssigneesRequest.php b/Api/GitHub/Issues/AssigneesRequest.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/Api/GitHub/Issues/CommentsReqeust.php b/Api/GitHub/Issues/CommentsReqeust.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/Api/GitHub/Issues/LabelsRequest.php b/Api/GitHub/Issues/LabelsRequest.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/Api/GitHub/Issues/MilestonesRequest.php b/Api/GitHub/Issues/MilestonesRequest.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/Api/GitHub/Organizations/MembersRequest.php b/Api/GitHub/Organizations/MembersRequest.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/Api/GitHub/Organizations/TeamsRequest.php b/Api/GitHub/Organizations/TeamsRequest.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/Api/GitHub/Repositories/CollaboratorsRequest.php b/Api/GitHub/Repositories/CollaboratorsRequest.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/Api/GitHub/Repositories/CommentsReqeust.php b/Api/GitHub/Repositories/CommentsReqeust.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/Api/GitHub/Repositories/CommitsRequest.php b/Api/GitHub/Repositories/CommitsRequest.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/Api/GitHub/Repositories/StatisticsRequest.php b/Api/GitHub/Repositories/StatisticsRequest.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/Api/GitHub/Repositories/StatusesRequest.php b/Api/GitHub/Repositories/StatusesRequest.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/DataStorage/Cache/FileCache.php b/DataStorage/Cache/FileCache.php index bf6850482..43c66af5d 100644 --- a/DataStorage/Cache/FileCache.php +++ b/DataStorage/Cache/FileCache.php @@ -59,7 +59,7 @@ class FileCache implements CacheInterface /** * {@inheritdoc} */ - public function add($key, $value, CacheStatus $type = null, int $expire = 2592000) + public function add($key, $value, CacheStatus $type = null, int $expire = 2592000) : bool { } @@ -73,7 +73,7 @@ class FileCache implements CacheInterface /** * {@inheritdoc} */ - public function delete($key, CacheStatus $type = null) + public function delete($key, CacheStatus $type = null) : bool { } @@ -88,7 +88,7 @@ class FileCache implements CacheInterface /** * {@inheritdoc} */ - public function replace($key, $value, CacheType $type = null, int $expire = -1) + public function replace($key, $value, CacheType $type = null, int $expire = -1) : bool { } diff --git a/DataStorage/Cache/MemCache.php b/DataStorage/Cache/MemCache.php index 7dc18a10d..f14d7bcda 100644 --- a/DataStorage/Cache/MemCache.php +++ b/DataStorage/Cache/MemCache.php @@ -82,7 +82,7 @@ class MemCache implements CacheInterface /** * {@inheritdoc} */ - public function add($key, $value, CacheStatus $type = null, int $expire = 2592000) + public function add($key, $value, CacheStatus $type = null, int $expire = 2592000) : bool { return $this->memc->add($key, $value, false, $expire); } @@ -98,7 +98,7 @@ class MemCache implements CacheInterface /** * {@inheritdoc} */ - public function delete($key, CacheStatus $type = null) + public function delete($key, CacheStatus $type = null) : bool { $this->memc->delete($key); } @@ -114,7 +114,7 @@ class MemCache implements CacheInterface /** * {@inheritdoc} */ - public function replace($key, $value, CacheType $type = null, int $expire = -1) + public function replace($key, $value, CacheType $type = null, int $expire = -1) : bool { $this->memc->replace($key, $value, false, $expire); } diff --git a/DataStorage/Cache/NullCache.php b/DataStorage/Cache/NullCache.php index 6f06ec0ac..404ee2cd2 100644 --- a/DataStorage/Cache/NullCache.php +++ b/DataStorage/Cache/NullCache.php @@ -40,7 +40,7 @@ class NullCache implements CacheInterface /** * {@inheritdoc} */ - public function add($key, $value, CacheStatus $type = null, int $expire = 2592000) + public function add($key, $value, CacheStatus $type = null, int $expire = 2592000) : bool { // TODO: Implement add() method. } @@ -56,7 +56,7 @@ class NullCache implements CacheInterface /** * {@inheritdoc} */ - public function delete($key, CacheStatus $type = null) + public function delete($key, CacheStatus $type = null) : bool { // TODO: Implement delete() method. } @@ -72,7 +72,7 @@ class NullCache implements CacheInterface /** * {@inheritdoc} */ - public function replace($key, $value, CacheType $type = null, int $expire = -1) + public function replace($key, $value, CacheType $type = null, int $expire = -1) : bool { // TODO: Implement replace() method. } diff --git a/DataStorage/Cache/RedisCache.php b/DataStorage/Cache/RedisCache.php index ab4ab51c7..e93fb1167 100644 --- a/DataStorage/Cache/RedisCache.php +++ b/DataStorage/Cache/RedisCache.php @@ -42,7 +42,7 @@ class RedisCache implements CacheInterface /** * {@inheritdoc} */ - public function add($key, $value, CacheStatus $type = null, int $expire = 2592000) + public function add($key, $value, CacheStatus $type = null, int $expire = 2592000) : bool { // TODO: Implement add() method. } @@ -58,7 +58,7 @@ class RedisCache implements CacheInterface /** * {@inheritdoc} */ - public function delete($key, CacheStatus $type = null) + public function delete($key, CacheStatus $type = null) : bool { // TODO: Implement delete() method. } @@ -74,7 +74,7 @@ class RedisCache implements CacheInterface /** * {@inheritdoc} */ - public function replace($key, $value, CacheType $type = null, int $expire = -1) + public function replace($key, $value, CacheType $type = null, int $expire = -1) : bool { // TODO: Implement replace() method. } diff --git a/DataStorage/Cache/WinCache.php b/DataStorage/Cache/WinCache.php index d44bf0764..0690cded2 100644 --- a/DataStorage/Cache/WinCache.php +++ b/DataStorage/Cache/WinCache.php @@ -42,7 +42,7 @@ class WinCache implements CacheInterface /** * {@inheritdoc} */ - public function add($key, $value, CacheStatus $type = null, int $expire = 2592000) + public function add($key, $value, CacheStatus $type = null, int $expire = 2592000) : bool { // TODO: Implement add() method. } @@ -58,7 +58,7 @@ class WinCache implements CacheInterface /** * {@inheritdoc} */ - public function delete($key, CacheStatus $type = null) + public function delete($key, CacheStatus $type = null) : bool { // TODO: Implement delete() method. } @@ -74,7 +74,7 @@ class WinCache implements CacheInterface /** * {@inheritdoc} */ - public function replace($key, $value, CacheType $type = null, int $expire = -1) + public function replace($key, $value, CacheType $type = null, int $expire = -1) : bool { // TODO: Implement replace() method. } diff --git a/DataStorage/Database/Connection/ConnectionException.php b/DataStorage/Database/Connection/ConnectionException.php index e69de29bb..6a26aeb8a 100644 --- a/DataStorage/Database/Connection/ConnectionException.php +++ b/DataStorage/Database/Connection/ConnectionException.php @@ -0,0 +1,21 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\DataStorage\Database\Connection; + +abstract class ConnectionException extends \Exception +{ + +} \ No newline at end of file diff --git a/DataStorage/Database/Connection/PostgresConnection.php b/DataStorage/Database/Connection/PostgresConnection.php index e69de29bb..57323f881 100644 --- a/DataStorage/Database/Connection/PostgresConnection.php +++ b/DataStorage/Database/Connection/PostgresConnection.php @@ -0,0 +1,21 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\DataStorage\Database\Connection; + +abstract class PostgresConnection extends \Exception +{ + +} \ No newline at end of file diff --git a/DataStorage/Database/Connection/SqlServerConnection.php b/DataStorage/Database/Connection/SqlServerConnection.php index e69de29bb..cd87d9ccf 100644 --- a/DataStorage/Database/Connection/SqlServerConnection.php +++ b/DataStorage/Database/Connection/SqlServerConnection.php @@ -0,0 +1,21 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\DataStorage\Database\Connection; + +abstract class SqlServerConnection extends \Exception +{ + +} \ No newline at end of file diff --git a/DataStorage/Database/Connector/MysqlConnector.php b/DataStorage/Database/Connector/MysqlConnector.php index e69de29bb..a694f4cc0 100644 --- a/DataStorage/Database/Connector/MysqlConnector.php +++ b/DataStorage/Database/Connector/MysqlConnector.php @@ -0,0 +1,21 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\DataStorage\Database\Connector; + +abstract class MysqlConnector extends \Exception +{ + +} \ No newline at end of file diff --git a/DataStorage/Database/Connector/PostgresConnector.php b/DataStorage/Database/Connector/PostgresConnector.php index e69de29bb..36a14c522 100644 --- a/DataStorage/Database/Connector/PostgresConnector.php +++ b/DataStorage/Database/Connector/PostgresConnector.php @@ -0,0 +1,21 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\DataStorage\Database\Connector; + +abstract class PostgresConnector extends \Exception +{ + +} \ No newline at end of file diff --git a/DataStorage/Database/Connector/SQLiteConnector.php b/DataStorage/Database/Connector/SQLiteConnector.php index e69de29bb..ba79d563d 100644 --- a/DataStorage/Database/Connector/SQLiteConnector.php +++ b/DataStorage/Database/Connector/SQLiteConnector.php @@ -0,0 +1,21 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\DataStorage\Database\Connector; + +abstract class SqliteConnector extends \Exception +{ + +} \ No newline at end of file diff --git a/DataStorage/Database/Connector/SqlServerConnector.php b/DataStorage/Database/Connector/SqlServerConnector.php index e69de29bb..07bf7aaf4 100644 --- a/DataStorage/Database/Connector/SqlServerConnector.php +++ b/DataStorage/Database/Connector/SqlServerConnector.php @@ -0,0 +1,21 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\DataStorage\Database\Connector; + +abstract class SqlServerConnector extends \Exception +{ + +} \ No newline at end of file diff --git a/DataStorage/Database/Query/Expression.php b/DataStorage/Database/Query/Expression.php index e69de29bb..5197d627d 100644 --- a/DataStorage/Database/Query/Expression.php +++ b/DataStorage/Database/Query/Expression.php @@ -0,0 +1,23 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ + +namespace phpOMS\DataStorage\Database\Query; + + +class Expression +{ + +} \ No newline at end of file diff --git a/DataStorage/Database/Query/Grammar/GrammarInterface.php b/DataStorage/Database/Query/Grammar/GrammarInterface.php index 1da09b5a1..741483ccc 100644 --- a/DataStorage/Database/Query/Grammar/GrammarInterface.php +++ b/DataStorage/Database/Query/Grammar/GrammarInterface.php @@ -16,8 +16,6 @@ namespace phpOMS\DataStorage\Database\Query\Grammar; -use phpOMS\DataStorage\Database\Grammar; - -class GrammarInterface extends Grammar +class GrammarInterface { } diff --git a/DataStorage/Database/Schema/Grammar/GrammarInterface.php b/DataStorage/Database/Schema/Grammar/GrammarInterface.php index a0c8d4f2f..be21d0dbe 100644 --- a/DataStorage/Database/Schema/Grammar/GrammarInterface.php +++ b/DataStorage/Database/Schema/Grammar/GrammarInterface.php @@ -13,7 +13,7 @@ * @version 1.0.0 * @link http://orange-management.com */ -namespace phpOMS\DataStorage\Database\Schema; +namespace phpOMS\DataStorage\Database\Schema\Grammar; interface GrammarInterface { diff --git a/DataStorage/Database/Schema/Grammar/PostgresGrammar.php b/DataStorage/Database/Schema/Grammar/PostgresGrammar.php index e69de29bb..47ee9f3f5 100644 --- a/DataStorage/Database/Schema/Grammar/PostgresGrammar.php +++ b/DataStorage/Database/Schema/Grammar/PostgresGrammar.php @@ -0,0 +1,21 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\DataStorage\Database\Schema\Grammar; + +class PostgresGrammar +{ + +} diff --git a/DataStorage/Database/Schema/Grammar/SQLiteGrammar.php b/DataStorage/Database/Schema/Grammar/SQLiteGrammar.php index e69de29bb..4065b2295 100644 --- a/DataStorage/Database/Schema/Grammar/SQLiteGrammar.php +++ b/DataStorage/Database/Schema/Grammar/SQLiteGrammar.php @@ -0,0 +1,21 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\DataStorage\Database\Schema\Grammar; + +class SQLiteGrammar +{ + +} diff --git a/DataStorage/Database/Schema/Grammar/SqlServerGrammar.php b/DataStorage/Database/Schema/Grammar/SqlServerGrammar.php index e69de29bb..c39775f1f 100644 --- a/DataStorage/Database/Schema/Grammar/SqlServerGrammar.php +++ b/DataStorage/Database/Schema/Grammar/SqlServerGrammar.php @@ -0,0 +1,21 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\DataStorage\Database\Schema\Grammar; + +class SqlServerGrammar +{ + +} diff --git a/Datatypes/ExactFloat.php b/Datatypes/ExactFloat.php index 7ea6dace6..41aa4efc3 100644 --- a/Datatypes/ExactFloat.php +++ b/Datatypes/ExactFloat.php @@ -13,7 +13,7 @@ * @version 1.0.0 * @link http://orange-management.com */ -namespace phpOMS\Datatypes\ExactFloat; +namespace phpOMS\Datatypes; class ExactFloat { @@ -121,10 +121,4 @@ class ExactFloat public static function div($a, $b, $length = null) { } - - public static function __toString() - { - return ''; - } - } diff --git a/Event/EventManager.php b/Event/EventManager.php index 6c38ca897..6606b3678 100644 --- a/Event/EventManager.php +++ b/Event/EventManager.php @@ -93,7 +93,7 @@ class EventManager implements Mediator /** * {@inheritdoc} */ - public function trigger(string $group, string $id = 0) + public function trigger(string $group, string $id = '') { if(isset($this->groups[$group])) { unset($this->groups[$group][$id]); @@ -119,7 +119,7 @@ class EventManager implements Mediator /** * {@inheritdoc} */ - public function addGroup(string $group, $id) + public function addGroup(string $group, string $id) { if(!isset($this->groups[$group])) { $this->groups[$group] = []; diff --git a/Localization/ISO4217SymbolEnum.php b/Localization/ISO4217SymbolEnum.php index 1b575d60e..3f3704cae 100644 --- a/Localization/ISO4217SymbolEnum.php +++ b/Localization/ISO4217SymbolEnum.php @@ -101,7 +101,6 @@ class ISO4217SymbolEnum extends Enum const _NZD = '$'; const _NIO = 'C$'; const _NGN = '₦'; - const _KPW = '₩'; const _NOK = 'kr'; const _OMR = '﷼'; const _PKR = '₨'; @@ -121,7 +120,6 @@ class ISO4217SymbolEnum extends Enum const _SBD = '$'; const _SOS = 'S'; const _ZAR = 'R'; - const _KRW = '₩'; const _LKR = '₨'; const _SEK = 'kr'; const _CHF = 'CHF'; diff --git a/Math/Finance/Depreciation.php b/Math/Finance/Depreciation.php index e69de29bb..b14cf7431 100644 --- a/Math/Finance/Depreciation.php +++ b/Math/Finance/Depreciation.php @@ -0,0 +1,21 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Math\Finance; + +class Depreciation +{ + +} \ No newline at end of file diff --git a/Math/Finance/Forecasting/AR.php b/Math/Finance/Forecasting/AR.php index 8b1378917..33bcaaabf 100644 --- a/Math/Finance/Forecasting/AR.php +++ b/Math/Finance/Forecasting/AR.php @@ -1 +1,7 @@ +mode = $mode; $this->data = $data; - $this->order = $this->order; + $this->order = $order; $this->dataSize = count($data); } @@ -20,7 +24,7 @@ class ClassicalDecomposition { public function getDecomposition() : array { $trendCycleComponent = self::computeTrendCycle($this->data, $this->order); $detrendedSeries = self::computeDetrendedSeries($this->data, $trendCycleComponent, $this->mode); - $seasonalComponent = $this->computeSeasonalComponent($detrended, $this->order); + $seasonalComponent = $this->computeSeasonalComponent($detrendedSeries, $this->order); $remainderComponent = $this->computeRemainderComponent($trendCycleComponent, $seasonalComponent); return [ @@ -32,9 +36,9 @@ class ClassicalDecomposition { } public static function computeTrendCycle(array $data, int $order) : array { - $mMA = Average::totalMovingAverage($data, $order, null true); + $mMA = Average::totalMovingAverage($data, $order, null, true); - return $this->order % 2 === 0 ? Average::totalMovingAverage($mMa, 2, null, true) : $mMA; + return $order % 2 === 0 ? Average::totalMovingAverage($mMA, 2, null, true) : $mMA; } public static function computeDetrendedSeries(array $data, array $trendCycleComponent, int $mode) : array { @@ -74,7 +78,7 @@ class ClassicalDecomposition { public static function computeRemainderComponent(array $trendCycleComponent, array $seasonalComponent) : array { $remainderComponent = []; - $count = count($trendedCycleComponent); + $count = count($trendCycleComponent); $start = self::getStartOfDecomposition($this->dataSize, $count); $seasons = count($seasonalComponent); diff --git a/Math/Finance/Forecasting/ExponentialSmoothing.php b/Math/Finance/Forecasting/ExponentialSmoothing.php index 8b1378917..3cea0a01f 100644 --- a/Math/Finance/Forecasting/ExponentialSmoothing.php +++ b/Math/Finance/Forecasting/ExponentialSmoothing.php @@ -1 +1,7 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ + +namespace phpOMS\Math\Integral; + +class Gauss +{ + +} \ No newline at end of file diff --git a/Math/Matrix/Cholesky.php b/Math/Matrix/Cholesky.php index e69de29bb..82e0598ec 100644 --- a/Math/Matrix/Cholesky.php +++ b/Math/Matrix/Cholesky.php @@ -0,0 +1,22 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ + +namespace phpOMS\Math\Matrix; + +class Cholesky +{ + +} \ No newline at end of file diff --git a/Math/Number/Irrational.php b/Math/Number/Irrational.php index 1548b8a79..1f6781558 100644 --- a/Math/Number/Irrational.php +++ b/Math/Number/Irrational.php @@ -1,2 +1,22 @@ -class Irrational implements Number { + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ + +namespace phpOMS\Math\Number; + +class Irrational +{ + } \ No newline at end of file diff --git a/Math/Number/NumberType.php b/Math/Number/NumberType.php index c1f034e8b..efe010e5e 100644 --- a/Math/Number/NumberType.php +++ b/Math/Number/NumberType.php @@ -29,7 +29,7 @@ use phpOMS\Datatypes\Enum; * @link http://orange-management.com * @since 1.0.0 */ -abstract class AccountType extends Enum +abstract class NumberType extends Enum { const INTEGER = 1; const NATURAL = 21; diff --git a/Math/Number/OpperationInterface.php b/Math/Number/OperationInterface.php similarity index 98% rename from Math/Number/OpperationInterface.php rename to Math/Number/OperationInterface.php index 93031d2de..f4173e2be 100644 --- a/Math/Number/OpperationInterface.php +++ b/Math/Number/OperationInterface.php @@ -91,8 +91,6 @@ interface OperationInterface /** * Abs of value. * - * @param mixed $x Value - * * @return mixed * * @since 1.0.0 diff --git a/Math/Number/Rational.php b/Math/Number/Rational.php index 594aa5b1f..891abb9c3 100644 --- a/Math/Number/Rational.php +++ b/Math/Number/Rational.php @@ -1,3 +1,22 @@ -class Rational implements Number { + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ + +namespace phpOMS\Math\Number; + +class Rational +{ } \ No newline at end of file diff --git a/Math/Number/Real.php b/Math/Number/Real.php index 4b99b7f3c..75feb3a07 100644 --- a/Math/Number/Real.php +++ b/Math/Number/Real.php @@ -1,2 +1,22 @@ -class Real implements Number { + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ + +namespace phpOMS\Math\Number; + +class Real +{ + } \ No newline at end of file diff --git a/Math/Optimization/GaussianElimination.php b/Math/Optimization/GaussianElimination.php index d0d5e49b3..67c2ca4cc 100644 --- a/Math/Optimization/GaussianElimination.php +++ b/Math/Optimization/GaussianElimination.php @@ -13,6 +13,7 @@ * @version 1.0.0 * @link http://orange-management.com */ +namespace phpOMS\Math\Optimization; use phpOMS\Math\Matrix\Matrix; @@ -59,7 +60,7 @@ class GaussianElimination } } - $this->swapRows($A, $b, $col, $j); + self::swapRows($A, $b, $col, $j); for ($i = $col + 1; $i < $limit; $i++) { $tmp = $A[$i][$col] / $A[$col][$col]; diff --git a/Math/Optimization/Graph/FloydWarshall.php b/Math/Optimization/Graph/FloydWarshall.php index e69de29bb..d127d73b6 100644 --- a/Math/Optimization/Graph/FloydWarshall.php +++ b/Math/Optimization/Graph/FloydWarshall.php @@ -0,0 +1,8 @@ + 0) { + $values = array_slice($values, $offset, -$offset); + } + + $count = count($values); + $sum = 0.0; + + foreach ($values as $value) { + if ($value === 0) { + throw new \Exception('Division zero'); } $sum += 1 / $value; diff --git a/Math/Statistic/Forecast/Error.php b/Math/Statistic/Forecast/Error.php index 644280674..84a6a0990 100644 --- a/Math/Statistic/Forecast/Error.php +++ b/Math/Statistic/Forecast/Error.php @@ -192,7 +192,7 @@ class Error } public static function getRBarSquared(float $R, int $observations, int $predictors) : float { - return 1 - (1 - $R * ($observations - 1) / ($observations - $predictors - 1); + return 1 - (1 - $R * ($observations - 1) / ($observations - $predictors - 1)); } /** @@ -208,7 +208,7 @@ class Error * * Correction for small amount of observations */ - public static function getCorrectedAkaikeInformationCriterion(float aic, int $observations, int $predictors) : float { + public static function getCorrectedAkaikeInformationCriterion(float $aic, int $observations, int $predictors) : float { return $aic + (2*($predictors +2)*($predictors + 3)) / ($observations - $predictors - 3); } diff --git a/Math/Statistic/Forecast/Forecasts.php b/Math/Statistic/Forecast/Forecasts.php index b016750e3..1ce035ce0 100644 --- a/Math/Statistic/Forecast/Forecasts.php +++ b/Math/Statistic/Forecast/Forecasts.php @@ -26,13 +26,11 @@ namespace phpOMS\Math\Statistic\Forecast; * @link http://orange-management.com * @since 1.0.0 */ -class Forecast +class Forecasts { /** * Get forecast interval. * - * - * * @param array $observed Dataset * @param array $forecasted Forecasted * diff --git a/Math/Statistic/Forecast/Regression/MultipleLinearRegression.php b/Math/Statistic/Forecast/Regression/MultipleLinearRegression.php index 29372af19..1c28b4588 100644 --- a/Math/Statistic/Forecast/Regression/MultipleLinearRegression.php +++ b/Math/Statistic/Forecast/Regression/MultipleLinearRegression.php @@ -1,5 +1,7 @@ filter = $filter; + $this->filter = ltrim($filter, '\\/'); parent::__construct($path); if (file_exists($this->path)) { diff --git a/Utils/Barcode/C128c.php b/Utils/Barcode/C128c.php index 64b0ab797..d7568c763 100644 --- a/Utils/Barcode/C128c.php +++ b/Utils/Barcode/C128c.php @@ -89,7 +89,7 @@ class C128c extends C128Abstract * @since 1.0.0 * @author Dennis Eichhorn */ - protected function generateCodeString() + protected function generateCodeString() : string { $keys = array_keys(self::$CODEARRAY); $values = array_flip($keys); diff --git a/Utils/Barcode/C25.php b/Utils/Barcode/C25.php index b9b494fca..e68099154 100644 --- a/Utils/Barcode/C25.php +++ b/Utils/Barcode/C25.php @@ -110,7 +110,7 @@ class C25 extends C128Abstract * @since 1.0.0 * @author Dennis Eichhorn */ - protected function generateCodeString() + protected function generateCodeString() : string { $codeString = ''; $length = strlen($this->content); diff --git a/Utils/Barcode/C39.php b/Utils/Barcode/C39.php index 3f919a594..0b6558c05 100644 --- a/Utils/Barcode/C39.php +++ b/Utils/Barcode/C39.php @@ -101,7 +101,7 @@ class C39 extends C128Abstract * @since 1.0.0 * @author Dennis Eichhorn */ - protected function generateCodeString() + protected function generateCodeString() : string { $codeString = ''; $length = strlen($this->content); diff --git a/Utils/Barcode/Codebar.php b/Utils/Barcode/Codebar.php index 02134ef71..a7be5d673 100644 --- a/Utils/Barcode/Codebar.php +++ b/Utils/Barcode/Codebar.php @@ -102,7 +102,7 @@ class Codebar extends C128Abstract * @since 1.0.0 * @author Dennis Eichhorn */ - protected function generateCodeString() + protected function generateCodeString() : string { $codeString = ''; $length = strlen($this->content); diff --git a/Utils/Converter/EnergyPowerType.php b/Utils/Converter/EnergyPowerType.php index e69de29bb..4ccb71417 100644 --- a/Utils/Converter/EnergyPowerType.php +++ b/Utils/Converter/EnergyPowerType.php @@ -0,0 +1,33 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Utils\Converter; + +use phpOMS\Datatypes\Enum; + +/** + * Speed type enum. + * + * @category Framework + * @package phpOMS\Utils\Converter + * @author OMS Development Team + * @author Dennis Eichhorn + * @license OMS License 1.0 + * @link http://orange-management.com + * @since 1.0.0 + */ +abstract class EnergyPowerType extends Enum +{ +} diff --git a/Utils/Excel/Excel.php b/Utils/Excel/Excel.php index 39f18447d..093fbc1c7 100644 --- a/Utils/Excel/Excel.php +++ b/Utils/Excel/Excel.php @@ -16,7 +16,7 @@ namespace phpOMS\Utils\Excel; /** @noinspection PhpIncludeInspection */ -require_once realpath(__DIR__ . '/../../../vendor/PHPExcel/Classes/PHPExcel.php'); +require_once realpath(__DIR__ . '/../../../Resources/phpexcel/Classes/PHPExcel.php'); /** * Excel class. diff --git a/Utils/IO/Csv/CsvDatabaseMapper.php b/Utils/IO/Csv/CsvDatabaseMapper.php index eabab036b..4882c7089 100644 --- a/Utils/IO/Csv/CsvDatabaseMapper.php +++ b/Utils/IO/Csv/CsvDatabaseMapper.php @@ -21,8 +21,6 @@ use phpOMS\Utils\IO\IODatabaseMapper; class CsvDatabaseMapper implements IODatabaseMapper { - use CsvSettingsTrait; - private $db = null; private $sources = []; diff --git a/Utils/JobQueue/JobQueue.php b/Utils/JobQueue/JobQueue.php index c5a1ff0d9..c0cace183 100644 --- a/Utils/JobQueue/JobQueue.php +++ b/Utils/JobQueue/JobQueue.php @@ -15,7 +15,7 @@ */ namespace phpOMS\Utils\JobQueue; -use \phpOMS\Stdlib\Queue\PriorityQueue; +use phpOMS\Stdlib\Queue\PriorityQueue; /** * Array utils. @@ -85,76 +85,65 @@ class JobQueue sleep(1); } -} -public -function setRunning(bool $run = true) -{ - $this->run = $run; - $this->suspended = $run; -} - -public -function isRunning() : bool -{ - return $this->run; -} - -public -function setSuspended(bool $suspended = true) -{ - $this->suspended = $suspended; -} - -public -function isSuspended() : bool -{ - return $this->suspended; -} - -public -function isTerminating() : bool -{ - return $this->isTerminating; -} - -public -function setTerminating(bool $terminating = true) -{ - $this->isTerminating = $terminating; -} - -public -function isDeamonized() : bool -{ - return $this->isDeamonized; -} - -public -function setDeamonized(bool $deamonized) -{ - $this->isDeamonized = $deamonized; -} - -private -function runAsDeamon() -{ - ob_end_clean(); - fclose(STDIN); - fclose(STDOUT); - fclose(STDERR); - - function shutdown() + public function setRunning(bool $run = true) { - posix_kill(posix_getpid(), SIGHUP); + $this->run = $run; + $this->suspended = $run; } - register_shutdown_function('shutdown'); -} + public function isRunning() : bool + { + return $this->run; + } -private -function savePid() -{ - // todo: save pid somewhere for kill -} + public function setSuspended(bool $suspended = true) + { + $this->suspended = $suspended; + } + + public function isSuspended() : bool + { + return $this->suspended; + } + + public function isTerminating() : bool + { + return $this->isTerminating; + } + + public function setTerminating(bool $terminating = true) + { + $this->isTerminating = $terminating; + } + + public function isDeamonized() : bool + { + return $this->isDeamonized; + } + + public function setDeamonized(bool $deamonized) + { + $this->isDeamonized = $deamonized; + } + + private function runAsDeamon() + { + ob_end_clean(); + fclose(STDIN); + fclose(STDOUT); + fclose(STDERR); + + function shutdown() + { + posix_kill(posix_getpid(), SIGHUP); + } + + register_shutdown_function('shutdown'); + } + + private function savePid() + { + // todo: save pid somewhere for kill + } } \ No newline at end of file diff --git a/Utils/Parser/LaTex/Expressions/Product.php b/Utils/Parser/LaTex/Expressions/Product.php index e69de29bb..31cc96b4d 100644 --- a/Utils/Parser/LaTex/Expressions/Product.php +++ b/Utils/Parser/LaTex/Expressions/Product.php @@ -0,0 +1,20 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Utils\Parser\LaTex\Expressions; + +class Product +{ +} diff --git a/Utils/Parser/LaTex/Expressions/Sum.php b/Utils/Parser/LaTex/Expressions/Sum.php index e69de29bb..f5b7e2dbe 100644 --- a/Utils/Parser/LaTex/Expressions/Sum.php +++ b/Utils/Parser/LaTex/Expressions/Sum.php @@ -0,0 +1,20 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Utils\Parser\LaTex\Expressions; + +class Sum +{ +} diff --git a/Utils/Parser/LaTex/Expressions/Trigonometry.php b/Utils/Parser/LaTex/Expressions/Trigonometry.php index e69de29bb..fe3e2684c 100644 --- a/Utils/Parser/LaTex/Expressions/Trigonometry.php +++ b/Utils/Parser/LaTex/Expressions/Trigonometry.php @@ -0,0 +1,20 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Utils\Parser\LaTex\Expressions; + +class Trigonometry +{ +} diff --git a/Utils/Parser/LaTex/LaTexParser.php b/Utils/Parser/LaTex/LaTexParser.php index e69de29bb..20f900ae7 100644 --- a/Utils/Parser/LaTex/LaTexParser.php +++ b/Utils/Parser/LaTex/LaTexParser.php @@ -0,0 +1,20 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Utils\Parser\LaTex; + +class LaTexParser +{ +} diff --git a/Utils/Parser/LaTex/Types/Interval.php b/Utils/Parser/LaTex/Types/Interval.php index e69de29bb..138ef79a9 100644 --- a/Utils/Parser/LaTex/Types/Interval.php +++ b/Utils/Parser/LaTex/Types/Interval.php @@ -0,0 +1,20 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Utils\Parser\LaTex\Types; + +class Interval +{ +} diff --git a/Utils/Parser/LaTex/Types/MathFunction.php b/Utils/Parser/LaTex/Types/MathFunction.php index e69de29bb..0e37c43af 100644 --- a/Utils/Parser/LaTex/Types/MathFunction.php +++ b/Utils/Parser/LaTex/Types/MathFunction.php @@ -0,0 +1,20 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Utils\Parser\LaTex\Types; + +class MathFunction +{ +} diff --git a/Utils/Parser/LaTex/Types/Variable.php b/Utils/Parser/LaTex/Types/Variable.php index e69de29bb..530342b80 100644 --- a/Utils/Parser/LaTex/Types/Variable.php +++ b/Utils/Parser/LaTex/Types/Variable.php @@ -0,0 +1,20 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Utils\Parser\LaTex\Types; + +class Variable +{ +} diff --git a/Utils/RnG/Address.php b/Utils/RnG/Address.php index e69de29bb..7442ec027 100644 --- a/Utils/RnG/Address.php +++ b/Utils/RnG/Address.php @@ -0,0 +1,20 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Utils\RnG; + +class Address +{ +} diff --git a/Utils/RnG/City.php b/Utils/RnG/City.php index e69de29bb..059ba9f51 100644 --- a/Utils/RnG/City.php +++ b/Utils/RnG/City.php @@ -0,0 +1,20 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Utils\RnG; + +class City +{ +} diff --git a/Utils/RnG/Country.php b/Utils/RnG/Country.php index e69de29bb..37a07b277 100644 --- a/Utils/RnG/Country.php +++ b/Utils/RnG/Country.php @@ -0,0 +1,20 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Utils\RnG; + +class Country +{ +} diff --git a/Utils/RnG/Currency.php b/Utils/RnG/Currency.php index e69de29bb..60d147b5e 100644 --- a/Utils/RnG/Currency.php +++ b/Utils/RnG/Currency.php @@ -0,0 +1,20 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Utils\RnG; + +class Currency +{ +} diff --git a/Utils/RnG/Email.php b/Utils/RnG/Email.php index e69de29bb..6c22ed883 100644 --- a/Utils/RnG/Email.php +++ b/Utils/RnG/Email.php @@ -0,0 +1,20 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Utils\RnG; + +class Email +{ +} diff --git a/Utils/RnG/IBAN.php b/Utils/RnG/IBAN.php index e69de29bb..27869b636 100644 --- a/Utils/RnG/IBAN.php +++ b/Utils/RnG/IBAN.php @@ -0,0 +1,20 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Utils\RnG; + +class IBAN +{ +} diff --git a/Utils/RnG/Numeric.php b/Utils/RnG/Numeric.php index e69de29bb..cfc21ba22 100644 --- a/Utils/RnG/Numeric.php +++ b/Utils/RnG/Numeric.php @@ -0,0 +1,20 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Utils\RnG; + +class Numeric +{ +} diff --git a/Utils/RnG/PostalZip.php b/Utils/RnG/PostalZip.php index e69de29bb..6e401a7c2 100644 --- a/Utils/RnG/PostalZip.php +++ b/Utils/RnG/PostalZip.php @@ -0,0 +1,20 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Utils\RnG; + +class PostalZip +{ +} diff --git a/Utils/TaskSchedule/InvalidTaskParameterExceltion.php b/Utils/TaskSchedule/InvalidTaskParameterException.php similarity index 100% rename from Utils/TaskSchedule/InvalidTaskParameterExceltion.php rename to Utils/TaskSchedule/InvalidTaskParameterException.php diff --git a/Validation/Barcode/Barcode.php b/Validation/Barcode/Barcode.php index e69de29bb..20c173af6 100644 --- a/Validation/Barcode/Barcode.php +++ b/Validation/Barcode/Barcode.php @@ -0,0 +1,23 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Validation\Barcode; + +use phpOMS\Validation\ValidatorAbstract; + +class Barcode extends ValidatorAbstract +{ + +} \ No newline at end of file diff --git a/Validation/Barcode/Barcode11.php b/Validation/Barcode/Barcode11.php index e69de29bb..8c44e9653 100644 --- a/Validation/Barcode/Barcode11.php +++ b/Validation/Barcode/Barcode11.php @@ -0,0 +1,23 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Validation\Barcode; + +use phpOMS\Validation\ValidatorAbstract; + +class Barcode11 extends ValidatorAbstract +{ + +} \ No newline at end of file diff --git a/Validation/Barcode/Barcode128.php b/Validation/Barcode/Barcode128.php index e69de29bb..25dc01ce8 100644 --- a/Validation/Barcode/Barcode128.php +++ b/Validation/Barcode/Barcode128.php @@ -0,0 +1,23 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Validation\Barcode; + +use phpOMS\Validation\ValidatorAbstract; + +class Barcode128 extends ValidatorAbstract +{ + +} \ No newline at end of file diff --git a/Validation/Barcode/Barcode25.php b/Validation/Barcode/Barcode25.php new file mode 100644 index 000000000..e9750213b --- /dev/null +++ b/Validation/Barcode/Barcode25.php @@ -0,0 +1,23 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Validation\Barcode; + +use phpOMS\Validation\ValidatorAbstract; + +class Barcode25 extends ValidatorAbstract +{ + +} \ No newline at end of file diff --git a/Validation/Barcode/Barcode39.php b/Validation/Barcode/Barcode39.php index e69de29bb..2cc2d5445 100644 --- a/Validation/Barcode/Barcode39.php +++ b/Validation/Barcode/Barcode39.php @@ -0,0 +1,23 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Validation\Barcode; + +use phpOMS\Validation\ValidatorAbstract; + +class Barcode39 extends ValidatorAbstract +{ + +} \ No newline at end of file diff --git a/Validation/Barcode/Barcode93.php b/Validation/Barcode/Barcode93.php index e69de29bb..e1e6c74c8 100644 --- a/Validation/Barcode/Barcode93.php +++ b/Validation/Barcode/Barcode93.php @@ -0,0 +1,23 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Validation\Barcode; + +use phpOMS\Validation\ValidatorAbstract; + +class Barcode93 extends ValidatorAbstract +{ + +} \ No newline at end of file diff --git a/Validation/Barcode/BarcodeCodebar.php b/Validation/Barcode/BarcodeCodebar.php index e69de29bb..95183502e 100644 --- a/Validation/Barcode/BarcodeCodebar.php +++ b/Validation/Barcode/BarcodeCodebar.php @@ -0,0 +1,23 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Validation\Barcode; + +use phpOMS\Validation\ValidatorAbstract; + +class BarcodeCodebar extends ValidatorAbstract +{ + +} \ No newline at end of file diff --git a/Validation/Barcode/BarcodeDatamatrix.php b/Validation/Barcode/BarcodeDatamatrix.php index e69de29bb..6085d1c68 100644 --- a/Validation/Barcode/BarcodeDatamatrix.php +++ b/Validation/Barcode/BarcodeDatamatrix.php @@ -0,0 +1,23 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Validation\Barcode; + +use phpOMS\Validation\ValidatorAbstract; + +class BarcodeDatamatrix extends ValidatorAbstract +{ + +} \ No newline at end of file diff --git a/Validation/Barcode/BarcodeEAN.php b/Validation/Barcode/BarcodeEAN.php index e69de29bb..dc947f31c 100644 --- a/Validation/Barcode/BarcodeEAN.php +++ b/Validation/Barcode/BarcodeEAN.php @@ -0,0 +1,23 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Validation\Barcode; + +use phpOMS\Validation\ValidatorAbstract; + +class BarcodeEAN extends ValidatorAbstract +{ + +} \ No newline at end of file diff --git a/Validation/Barcode/BarcodeI25.php b/Validation/Barcode/BarcodeI25.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/Validation/Barcode/BarcodeMSI.php b/Validation/Barcode/BarcodeMSI.php index e69de29bb..dcc4386ec 100644 --- a/Validation/Barcode/BarcodeMSI.php +++ b/Validation/Barcode/BarcodeMSI.php @@ -0,0 +1,23 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Validation\Barcode; + +use phpOMS\Validation\ValidatorAbstract; + +class BarcodeMSI extends ValidatorAbstract +{ + +} \ No newline at end of file diff --git a/Validation/Barcode/QrCode.php b/Validation/Barcode/QrCode.php index e69de29bb..7db5b6336 100644 --- a/Validation/Barcode/QrCode.php +++ b/Validation/Barcode/QrCode.php @@ -0,0 +1,23 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Validation\Barcode; + +use phpOMS\Validation\ValidatorAbstract; + +class QrCode extends ValidatorAbstract +{ + +} \ No newline at end of file diff --git a/Validation/Base/BIC.php b/Validation/Base/BIC.php index 1d19a75d6..5589039d0 100644 --- a/Validation/Base/BIC.php +++ b/Validation/Base/BIC.php @@ -13,8 +13,9 @@ * @version 1.0.0 * @link http://orange-management.com */ -namespace phpOMS\Validation; +namespace phpOMS\Validation\Base; +use phpOMS\Validation\ValidatorAbstract; /** * Validator abstract. diff --git a/Validation/Base/CreditCard.php b/Validation/Base/CreditCard.php index caa184593..c56719861 100644 --- a/Validation/Base/CreditCard.php +++ b/Validation/Base/CreditCard.php @@ -13,8 +13,9 @@ * @version 1.0.0 * @link http://orange-management.com */ -namespace phpOMS\Validation; +namespace phpOMS\Validation\Base; +use phpOMS\Validation\ValidatorAbstract; /** * Validator abstract. diff --git a/Validation/Base/Hostname.php b/Validation/Base/Hostname.php index 5dbf257a5..4abc95f05 100644 --- a/Validation/Base/Hostname.php +++ b/Validation/Base/Hostname.php @@ -13,8 +13,9 @@ * @version 1.0.0 * @link http://orange-management.com */ -namespace phpOMS\Validation; +namespace phpOMS\Validation\Base; +use phpOMS\Validation\ValidatorAbstract; /** * Validator abstract. diff --git a/Validation/Base/IP.php b/Validation/Base/IP.php index 818b3f4b9..a06883447 100644 --- a/Validation/Base/IP.php +++ b/Validation/Base/IP.php @@ -13,8 +13,9 @@ * @version 1.0.0 * @link http://orange-management.com */ -namespace phpOMS\Validation; +namespace phpOMS\Validation\Base; +use phpOMS\Validation\ValidatorAbstract; /** * Validator abstract. diff --git a/Validation/File/Crc32.php b/Validation/File/Crc32.php index e69de29bb..02ee62d10 100644 --- a/Validation/File/Crc32.php +++ b/Validation/File/Crc32.php @@ -0,0 +1,23 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Validation\File; + +use phpOMS\Validation\ValidatorAbstract; + +class Crc32 extends ValidatorAbstract +{ + +} \ No newline at end of file diff --git a/Validation/File/Extension.php b/Validation/File/Extension.php index e69de29bb..5b2cc2872 100644 --- a/Validation/File/Extension.php +++ b/Validation/File/Extension.php @@ -0,0 +1,23 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Validation\File; + +use phpOMS\Validation\ValidatorAbstract; + +class Extension extends ValidatorAbstract +{ + +} \ No newline at end of file diff --git a/Validation/File/FileSize.php b/Validation/File/FileSize.php index e69de29bb..b7f5c983c 100644 --- a/Validation/File/FileSize.php +++ b/Validation/File/FileSize.php @@ -0,0 +1,23 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Validation\File; + +use phpOMS\Validation\ValidatorAbstract; + +class FileSize extends ValidatorAbstract +{ + +} \ No newline at end of file diff --git a/Validation/File/Hash.php b/Validation/File/Hash.php index e69de29bb..cbdc26b1f 100644 --- a/Validation/File/Hash.php +++ b/Validation/File/Hash.php @@ -0,0 +1,23 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Validation\File; + +use phpOMS\Validation\ValidatorAbstract; + +class Hash extends ValidatorAbstract +{ + +} \ No newline at end of file diff --git a/Validation/File/IsCompressed.php b/Validation/File/IsCompressed.php index e69de29bb..d5cd853a1 100644 --- a/Validation/File/IsCompressed.php +++ b/Validation/File/IsCompressed.php @@ -0,0 +1,23 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Validation\File; + +use phpOMS\Validation\ValidatorAbstract; + +class IsCompressed extends ValidatorAbstract +{ + +} \ No newline at end of file diff --git a/Validation/File/IsExecutable.php b/Validation/File/IsExecutable.php index e69de29bb..cc2db3392 100644 --- a/Validation/File/IsExecutable.php +++ b/Validation/File/IsExecutable.php @@ -0,0 +1,23 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Validation\File; + +use phpOMS\Validation\ValidatorAbstract; + +class IsExecutable extends ValidatorAbstract +{ + +} \ No newline at end of file diff --git a/Validation/File/IsImage.php b/Validation/File/IsImage.php index e69de29bb..53fedce2c 100644 --- a/Validation/File/IsImage.php +++ b/Validation/File/IsImage.php @@ -0,0 +1,23 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Validation\File; + +use phpOMS\Validation\ValidatorAbstract; + +class IsImage extends ValidatorAbstract +{ + +} \ No newline at end of file diff --git a/Validation/File/IsPDF.php b/Validation/File/IsPDF.php index e69de29bb..c071166c3 100644 --- a/Validation/File/IsPDF.php +++ b/Validation/File/IsPDF.php @@ -0,0 +1,23 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Validation\File; + +use phpOMS\Validation\ValidatorAbstract; + +class IsPDF extends ValidatorAbstract +{ + +} \ No newline at end of file diff --git a/Validation/File/MimeType.php b/Validation/File/MimeType.php index e69de29bb..7c6c8f937 100644 --- a/Validation/File/MimeType.php +++ b/Validation/File/MimeType.php @@ -0,0 +1,23 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Validation\File; + +use phpOMS\Validation\ValidatorAbstract; + +class MimeType extends ValidatorAbstract +{ + +} \ No newline at end of file diff --git a/Views/View.php b/Views/View.php index dc8eae665..3aab87f38 100644 --- a/Views/View.php +++ b/Views/View.php @@ -33,25 +33,8 @@ use phpOMS\Utils\StringUtils; * @link http://orange-management.com * @since 1.0.0 */ -class View implements \Serializable +class View extends ViewAbstract { - - /** - * Template. - * - * @var string - * @since 1.0.0 - */ - protected $template = ''; - - /** - * Views. - * - * @var \phpOMS\Views\View[] - * @since 1.0.0 - */ - protected $views = []; - /** * View data. * @@ -110,144 +93,6 @@ class View implements \Serializable $this->l11n = $response->getL11n(); } - /** - * Sort views by order. - * - * @param array $a Array 1 - * @param array $b Array 2 - * - * @return int - * - * @since 1.0.0 - * @author Dennis Eichhorn - */ - private static function viewSort(array $a, array $b) : int - { - if ($a['order'] === $b['order']) { - return 0; - } - - return ($a['order'] < $b['order']) ? -1 : 1; - } - - /** - * Get the template. - * - * @return string - * - * @since 1.0.0 - * @author Dennis Eichhorn - */ - public function getTemplate() : string - { - return $this->template; - } - - /** - * Set the template. - * - * @param string $template - * - * @return void - * - * @since 1.0.0 - * @author Dennis Eichhorn - */ - public function setTemplate(string $template) - { - $this->template = $template; - } - - /** - * @return View[] - * - * @since 1.0.0 - * @author Dennis Eichhorn - */ - public function getViews() : array - { - return $this->views; - } - - /** - * @param string $id View ID - * - * @return false|View - * - * @since 1.0.0 - * @author Dennis Eichhorn - */ - public function getView($id) - { - if (!isset($this->views[$id])) { - return false; - } - - return $this->views[$id]; - } - - /** - * Remove view. - * - * @param string $id View ID - * - * @return bool - * - * @since 1.0.0 - * @author Dennis Eichhorn - */ - public function removeView(string $id) : bool - { - if (isset($this->views[$id])) { - unset($this->views[$id]); - - return true; - } - - return false; - } - - /** - * Edit view. - * - * @param string $id View ID - * @param View $view - * @param null|int $order Order of view - * - * @return void - * - * @since 1.0.0 - * @author Dennis Eichhorn - */ - public function editView(string $id, View $view, $order = null) - { - $this->addView($id, $view, $order, true); - } - - /** - * Add view. - * - * @param string $id View ID - * @param View $view - * @param int $order Order of view - * @param bool $overwrite Overwrite existing view - * - * @return void - * - * @since 1.0.0 - * @author Dennis Eichhorn - */ - public function addView(string $id, View $view, int $order = 0, bool $overwrite = true) - { - if ($overwrite || !isset($this->views[$id])) { - $this->views[$id] = $view; - - if ($order !== 0) { - uasort($this->views, ['\phpOMS\Views\View', 'viewSort']); - } - } - } - /** * @param string $id Data Id * @@ -353,89 +198,4 @@ class View implements \Serializable return $this->app->l11nManager->getText($this->l11n->getLanguage(), $module, $theme, $translation); } - /** - * Arrayify view and it's subviews. - * - * @return array - * - * @since 1.0.0 - * @author Dennis Eichhorn - */ - public function toArray() : array - { - $viewArray = []; - - if($this->template !== '') { - $viewArray[] = $this->render(); - } - - foreach ($this->views as $key => $view) { - $viewArray[$key] = $view->toArray(); - } - - return $viewArray; - } - - /** - * Get view/template response. - * - * @return string - * - * @since 1.0.0 - * @author Dennis Eichhorn - */ - public function render() : string - { - $path = realpath($oldPath = __DIR__ . '/../..' . $this->template . '.tpl.php'); - - if ($path === false || StringUtils::startsWith($path, ROOT_PATH) === false) { - throw new PathException($oldPath); - } - - ob_start(); - /** @noinspection PhpIncludeInspection */ - $data = include $path; - $ob = ob_get_clean(); - - if (is_array($data)) { - return $data; - } - - return $ob; - } - - /** - * Serialize view for rendering. - * - * @return string|array - * - * @since 1.0.0 - * @author Dennis Eichhorn - */ - public function serialize() - { - $path = realpath($oldPath = __DIR__ . '/../..' . $this->template . '.tpl.php'); - - if ($path === false || StringUtils::startsWith($path, ROOT_PATH) === false) { - return $this->toArray(); - } - - return $this->render(); - } - - /** - * Unserialize view. - * - * @param string $raw Raw data to parse - * - * @return void - * - * @since 1.0.0 - * @author Dennis Eichhorn - */ - public function unserialize($raw) - { - // todo: implement - } - } diff --git a/Views/ViewAbstract.php b/Views/ViewAbstract.php new file mode 100644 index 000000000..b465318c7 --- /dev/null +++ b/Views/ViewAbstract.php @@ -0,0 +1,292 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Views; + +use phpOMS\ApplicationAbstract; +use phpOMS\Localization\Localization; +use phpOMS\Message\RequestAbstract; +use phpOMS\Message\ResponseAbstract; +use phpOMS\System\File\PathException; +use phpOMS\Utils\StringUtils; + +/** + * List view. + * + * @category Framework + * @package phpOMS/Views + * @author OMS Development Team + * @author Dennis Eichhorn + * @license OMS License 1.0 + * @link http://orange-management.com + * @since 1.0.0 + */ +abstract class ViewAbstract implements \Serializable +{ + + /** + * Template. + * + * @var string + * @since 1.0.0 + */ + protected $template = ''; + + /** + * Views. + * + * @var \phpOMS\Views\View[] + * @since 1.0.0 + */ + protected $views = []; + + /** + * Constructor. + * + * @param ApplicationAbstract $app Application + * @param RequestAbstract $request Request + * @param ResponseAbstract $response Request + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function __construct() + { + } + + /** + * Get the template. + * + * @return string + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function getTemplate() : string + { + return $this->template; + } + + /** + * Set the template. + * + * @param string $template + * + * @return void + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function setTemplate(string $template) + { + $this->template = $template; + } + + /** + * Sort views by order. + * + * @param array $a Array 1 + * @param array $b Array 2 + * + * @return int + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + private static function viewSort(array $a, array $b) : int + { + if ($a['order'] === $b['order']) { + return 0; + } + + return ($a['order'] < $b['order']) ? -1 : 1; + } + + /** + * @return View[] + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function getViews() : array + { + return $this->views; + } + + /** + * @param string $id View ID + * + * @return false|View + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function getView($id) + { + if (!isset($this->views[$id])) { + return false; + } + + return $this->views[$id]; + } + + /** + * Remove view. + * + * @param string $id View ID + * + * @return bool + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function removeView(string $id) : bool + { + if (isset($this->views[$id])) { + unset($this->views[$id]); + + return true; + } + + return false; + } + + /** + * Edit view. + * + * @param string $id View ID + * @param View $view + * @param null|int $order Order of view + * + * @return void + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function editView(string $id, View $view, $order = null) + { + $this->addView($id, $view, $order, true); + } + + /** + * Add view. + * + * @param string $id View ID + * @param View $view + * @param int $order Order of view + * @param bool $overwrite Overwrite existing view + * + * @return void + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function addView(string $id, View $view, int $order = 0, bool $overwrite = true) + { + if ($overwrite || !isset($this->views[$id])) { + $this->views[$id] = $view; + + if ($order !== 0) { + uasort($this->views, ['\phpOMS\Views\View', 'viewSort']); + } + } + } + + /** + * Arrayify view and it's subviews. + * + * @return array + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function toArray() : array + { + $viewArray = []; + + if($this->template !== '') { + $viewArray[] = $this->render(); + } + + foreach ($this->views as $key => $view) { + $viewArray[$key] = $view->toArray(); + } + + return $viewArray; + } + + /** + * Get view/template response. + * + * @return string + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function render() : string + { + $path = realpath($oldPath = __DIR__ . '/../..' . $this->template . '.tpl.php'); + + if ($path === false) { + throw new PathException($oldPath); + } + + ob_start(); + /** @noinspection PhpIncludeInspection */ + $data = include $path; + $ob = ob_get_clean(); + + if (is_array($data)) { + return $data; + } + + return $ob; + } + + /** + * Serialize view for rendering. + * + * @return string|array + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function serialize() + { + $path = realpath($oldPath = __DIR__ . '/../..' . $this->template . '.tpl.php'); + + if ($path === false) { + return $this->toArray(); + } + + return $this->render(); + } + + /** + * Unserialize view. + * + * @param string $raw Raw data to parse + * + * @return void + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function unserialize($raw) + { + // todo: implement + } + +}