From 669c3b72440d5f83cbe34d86cf683e549f8b6e12 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Wed, 13 Apr 2016 22:58:48 +0200 Subject: [PATCH] PhpStorm cleanup --- DataStorage/Session/HttpSession.php | 2 + Dispatcher/Dispatcher.php | 2 - Log/FileLogger.php | 2 +- Message/HeaderAbstract.php | 84 ++++++++++++++++++++++- Message/Http/Header.php | 49 +++++-------- Message/Http/Request.php | 2 + Message/Http/Response.php | 27 +++----- Message/MessageInterface.php | 2 +- Message/RequestAbstract.php | 2 +- Message/ResponseAbstract.php | 19 ++++- Model/Html/Meta.php | 2 +- Module/InfoManager.php | 3 +- Module/ModuleManager.php | 5 +- Router/Router.php | 6 +- Stdlib/Map/MultiMap.php | 12 ++-- Uri/Http.php | 62 +++-------------- Uri/UriInterface.php | 12 ++++ Utils/Encoding/{Ceasar.php => Caesar.php} | 19 ++++- Utils/Encoding/EncodingInterface.php | 2 +- Utils/Encoding/Xor.php | 6 +- Utils/Parser/Php/ArrayParser.php | 19 ----- Utils/Parser/Php/ClassParser.php | 10 +-- Utils/Parser/Php/FunctionParser.php | 26 +++---- Utils/Parser/Php/MemberParser.php | 4 +- Utils/Parser/Php/Visibility.php | 2 +- Utils/Permutation.php | 8 ++- Version/Version.php | 2 - Views/View.php | 6 +- 28 files changed, 219 insertions(+), 178 deletions(-) rename Utils/Encoding/{Ceasar.php => Caesar.php} (86%) diff --git a/DataStorage/Session/HttpSession.php b/DataStorage/Session/HttpSession.php index 364bf4874..6a4bbdcf9 100644 --- a/DataStorage/Session/HttpSession.php +++ b/DataStorage/Session/HttpSession.php @@ -55,6 +55,8 @@ class HttpSession implements SessionInterface * @param int $liftetime Session life time * @param string|int|bool $sid Session id * + * @throws \Exception + * * @since 1.0.0 * @author Dennis Eichhorn */ diff --git a/Dispatcher/Dispatcher.php b/Dispatcher/Dispatcher.php index c13114a15..90b75aef8 100644 --- a/Dispatcher/Dispatcher.php +++ b/Dispatcher/Dispatcher.php @@ -20,7 +20,6 @@ use phpOMS\Message\RequestAbstract; use phpOMS\Message\ResponseAbstract; use phpOMS\Module\ModuleAbstract; use phpOMS\System\File\PathException; -use phpOMS\Views\ViewLayout; /** * Dispatcher class. @@ -83,7 +82,6 @@ class Dispatcher public function dispatch($controller, RequestAbstract $request, ResponseAbstract $response, $data = null) : array { $views = []; - $type = ViewLayout::UNDEFINED; if (is_array($controller) && isset($controller['dest'])) { $controller = $controller['dest']; diff --git a/Log/FileLogger.php b/Log/FileLogger.php index 2284e2d68..344bddfeb 100644 --- a/Log/FileLogger.php +++ b/Log/FileLogger.php @@ -122,7 +122,7 @@ class FileLogger implements LoggerInterface * * @param string $path Logging path * - * @return self + * @return FileLogger * * @since 1.0.0 * @author Dennis Eichhorn diff --git a/Message/HeaderAbstract.php b/Message/HeaderAbstract.php index def6fb17c..fe8380fd6 100644 --- a/Message/HeaderAbstract.php +++ b/Message/HeaderAbstract.php @@ -14,6 +14,8 @@ * @link http://orange-management.com */ namespace phpOMS\Message; +use phpOMS\DataStorage\Cookie\CookieJar; +use phpOMS\DataStorage\Session\HttpSession; /** * Response class. @@ -26,7 +28,85 @@ namespace phpOMS\Message; * @link http://orange-management.com * @since 1.0.0 */ -class HeaderAbstract +abstract class HeaderAbstract { - private static $isLocked = false; + /** + * Responses. + * + * @var bool + * @since 1.0.0 + */ + protected static $isLocked = false; + + /** + * Set header. + * + * @param string $key Header key + * @param string $value Header value + * @param bool $overwrite Overwrite if key already exists + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + abstract public function set(string $key, string $value, bool $overwrite = false); + + /** + * Generate header based on status code. + * + * @param string $statusCode Status code + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + abstract public function generate(string $statusCode); + + /** + * Get header by key. + * + * @param string $key Header key + * + * @return array + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + abstract public function get(string $key) : array; + + /** + * Header has key? + * + * @param string $key Header key + * + * @return bool + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + abstract public function has(string $key) : bool; + + /** + * Set header locked. + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public static function lock() + { + CookieJar::lock(); + HttpSession::lock(); + self::$isLocked = true; + } + + /** + * Is header locked? + * + * @return bool + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public static function isLocked() : bool + { + return self::$isLocked; + } } \ No newline at end of file diff --git a/Message/Http/Header.php b/Message/Http/Header.php index 1d225aadf..730de3849 100644 --- a/Message/Http/Header.php +++ b/Message/Http/Header.php @@ -16,9 +16,6 @@ namespace phpOMS\Message\Http; use phpOMS\Message\HeaderAbstract; -use phpOMS\Utils\ArrayUtils; -use phpOMS\DataStorage\Cookie\CookieJar; -use phpOMS\DataStorage\Session\HttpSession; /** * Response class. @@ -42,7 +39,13 @@ class Header extends HeaderAbstract */ private $header = []; - public function __constrct() + /** + * Constructor. + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function __construct() { $this->set('Content-Type', 'text/html; charset=utf-8'); } @@ -75,6 +78,8 @@ class Header extends HeaderAbstract * * @return bool * + * @throws \Exception + * * @since 1.0.0 * @author Dennis Eichhorn */ @@ -93,26 +98,26 @@ class Header extends HeaderAbstract return false; } - /** + /** * {@inheritdoc} */ - public function get(string $id) : array + public function get(string $key) : array { - return $this->header[$id] ?? []; + return $this->header[$key] ?? []; } /** * {@inheritdoc} */ - public function has(string $name) : bool + public function has(string $key) : bool { - return array_key_exists($name, $this->header); + return array_key_exists($key, $this->header); } /** * {@inheritdoc} */ - public function set($key, string $header, bool $overwrite = false) : bool + public function set(string $key, string $header, bool $overwrite = false) : bool { if (self::$isLocked) { throw new \Exception('Already locked'); @@ -155,29 +160,7 @@ class Header extends HeaderAbstract } /** - * Lock other header pushing models. - * - * @return array - * - * @since 1.0.0 - * @author Dennis Eichhorn - */ - private function lock() - { - CookieJar::lock(); - HttpSession::lock(); - self::$isLocked = true; - } - - /** - * Generate header automatically based on code. - * - * @param string $code HTTP status code - * - * @return void - * - * @since 1.0.0 - * @author Dennis Eichhorn + * {@inheritdoc} */ public function generate(string $code) { diff --git a/Message/Http/Request.php b/Message/Http/Request.php index 1e17ac6be..2f36c20d9 100644 --- a/Message/Http/Request.php +++ b/Message/Http/Request.php @@ -136,6 +136,8 @@ class Request extends RequestAbstract * * @return void * + * @throws \Exception + * * @since 1.0.0 * @author Dennis Eichhorn */ diff --git a/Message/Http/Response.php b/Message/Http/Response.php index b0b8d63cd..9e5763225 100644 --- a/Message/Http/Response.php +++ b/Message/Http/Response.php @@ -18,9 +18,7 @@ namespace phpOMS\Message\Http; use phpOMS\System\MimeType; use phpOMS\Contract\RenderableInterface; use phpOMS\Message\ResponseAbstract; -use phpOMS\Utils\ArrayUtils; -use phpOMS\DataStorage\Cookie\CookieJar; -use phpOMS\DataStorage\Session\HttpSession; +use phpOMS\Views\View; /** * Response class. @@ -85,15 +83,13 @@ class Response extends ResponseAbstract implements RenderableInterface * * @return bool * + * @throws \Exception + * * @since 1.0.0 * @author Dennis Eichhorn */ public function remove(int $id) : bool { - if (self::$isLocked) { - throw new \Exception('Already locked'); - } - if (isset($this->response[$id])) { unset($this->response[$id]); @@ -149,7 +145,7 @@ class Response extends ResponseAbstract implements RenderableInterface */ private function getJson() : string { - return json_encode($this->getArray()); + return json_encode($this->toArray()); } /** @@ -157,6 +153,8 @@ class Response extends ResponseAbstract implements RenderableInterface * * @return string * + * @throws \Exception + * * @since 1.0.0 * @author Dennis Eichhorn */ @@ -182,20 +180,15 @@ class Response extends ResponseAbstract implements RenderableInterface } /** - * Generate response array from views. - * - * @return array - * - * @since 1.0.0 - * @author Dennis Eichhorn + * {@inheritdoc} */ - private function getArray() : array + public function toArray() : array { $result = []; foreach($this->response as $key => $response) { - if($reponse instanceof Views) { - $result += $response->getArray(); + if($response instanceof View) { + $result += $response->toArray(); } elseif(is_array($response)) { $result += $response; } elseif(is_scalar($response)) { diff --git a/Message/MessageInterface.php b/Message/MessageInterface.php index 853e4fd6f..ff64bb3b0 100644 --- a/Message/MessageInterface.php +++ b/Message/MessageInterface.php @@ -40,7 +40,7 @@ interface MessageInterface /** * Retrieves all message header values. * - * @return array + * @return HeaderAbstract * * @since 1.0.0 * @author Dennis Eichhorn diff --git a/Message/RequestAbstract.php b/Message/RequestAbstract.php index ef67340d5..de9d3640c 100644 --- a/Message/RequestAbstract.php +++ b/Message/RequestAbstract.php @@ -157,7 +157,7 @@ abstract class RequestAbstract implements MessageInterface */ public function setUri(UriInterface $uri) { - return $this->uri = $uri; + $this->uri = $uri; } /** diff --git a/Message/ResponseAbstract.php b/Message/ResponseAbstract.php index 78b9583e1..d84fd304d 100644 --- a/Message/ResponseAbstract.php +++ b/Message/ResponseAbstract.php @@ -17,7 +17,6 @@ namespace phpOMS\Message; use phpOMS\Localization\Localization; use phpOMS\Utils\ArrayUtils; -use phpOMS\Message\Http\Header; /** * Response abstract class. @@ -65,6 +64,12 @@ abstract class ResponseAbstract implements MessageInterface */ protected $account = null; + /** + * Header. + * + * @var HeaderAbstract + * @since 1.0.0 + */ protected $header = null; /** @@ -156,6 +161,18 @@ abstract class ResponseAbstract implements MessageInterface return json_encode($this->toArray()); } + /** + * Generate response array from views. + * + * @return array + * + * @throws \Exception + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + abstract public function toArray() : array; + /** * Get header. * diff --git a/Model/Html/Meta.php b/Model/Html/Meta.php index 07951c55e..6a0d5e0bb 100644 --- a/Model/Html/Meta.php +++ b/Model/Html/Meta.php @@ -173,7 +173,7 @@ class Meta implements RenderableInterface /** * Set description. * - * @param string Descritpion + * @param string $description Meta description * * @return void * diff --git a/Module/InfoManager.php b/Module/InfoManager.php index aed29e840..ce872dc4b 100644 --- a/Module/InfoManager.php +++ b/Module/InfoManager.php @@ -17,7 +17,6 @@ namespace phpOMS\Module; use phpOMS\System\File\PathException; use phpOMS\Utils\ArrayUtils; -use phpOMS\Validation\Validator; /** * InfoManager class. @@ -54,7 +53,7 @@ class InfoManager /** * Object constructor. * - * @param string $module Module name + * @param string $path Info file path * * @since 1.0.0 * @author Dennis Eichhorn diff --git a/Module/ModuleManager.php b/Module/ModuleManager.php index cd18d8cf3..754973bd2 100644 --- a/Module/ModuleManager.php +++ b/Module/ModuleManager.php @@ -21,7 +21,6 @@ use phpOMS\Log\FileLogger; use phpOMS\Message\Http\Request; use phpOMS\System\File\PathException; use phpOMS\Autoloader; -use phpOMS\Utils\IO\Json\InvalidJsonException; /** * Modules class. @@ -326,7 +325,7 @@ class ModuleManager /** * Register module in database. * - * @param string $module Module name + * @param InfoManager $info Module info * * @return void * @@ -400,6 +399,8 @@ class ModuleManager * * @return void * + * @throws \Exception + * * @since 1.0.0 * @author Dennis Eichhorn */ diff --git a/Router/Router.php b/Router/Router.php index c17d8f98a..a3ce9d256 100644 --- a/Router/Router.php +++ b/Router/Router.php @@ -15,7 +15,6 @@ */ namespace phpOMS\Router; -use phpOMS\Views\ViewLayout; use phpOMS\Message\RequestAbstract; /** @@ -62,6 +61,7 @@ class Router */ public function importFromFile(string $path) { + /** @noinspection PhpIncludeInspection */ $this->routes += include $path; } @@ -113,9 +113,9 @@ class Router * Match route and uri. * * @param string $route Route - * @param string $verb GET,POST for this route + * @param string $routeVerb GET,POST for this route * @param string $uri Uri - * @param string $verb Verb this request is using + * @param string $remoteVerb Verb this request is using * * @return bool * diff --git a/Stdlib/Map/MultiMap.php b/Stdlib/Map/MultiMap.php index 14555208e..650c29ba5 100644 --- a/Stdlib/Map/MultiMap.php +++ b/Stdlib/Map/MultiMap.php @@ -14,6 +14,7 @@ * @link http://orange-management.com */ namespace phpOMS\Stdlib\Map; +use phpOMS\Utils\Permutation; /** * Multimap utils. @@ -51,7 +52,7 @@ class MultiMap implements \Countable * @var int * @since 1.0.0 */ - private $keyType = KeyType::MULTIPLE; + private $keyType = KeyType::SINGLE; /** * Order type. @@ -64,10 +65,13 @@ class MultiMap implements \Countable /** * Constructor. * + * @param int $key Key type (all keys need to match or just one) + * @param int $order Order of the keys is important (only required for multiple keys) + * * @since 1.0.0 * @author Dennis Eichhorn */ - public function __construct(int $key = KeyType::MULTIPLE, int $order = OrderType::LOOSE) + public function __construct(int $key = KeyType::SINGLE, int $order = OrderType::LOOSE) { $this->keyType = $key; $this->orderType = $order; @@ -216,11 +220,9 @@ class MultiMap implements \Countable { if ($this->keyType === KeyType::MULTIPLE && is_array($key)) { return $this->setMultiple($key, $value); - } else { - return $this->setSingle($key, $value); } - return false; + return $this->setSingle($key, $value); } /** diff --git a/Uri/Http.php b/Uri/Http.php index dd2fb33b4..0d4dda084 100644 --- a/Uri/Http.php +++ b/Uri/Http.php @@ -177,12 +177,7 @@ class Http implements UriInterface } /** - * Get scheme. - * - * @return string - * - * @since 1.0.0 - * @author Dennis Eichhorn + * {@inheritdoc} */ public function getScheme() : string { @@ -190,12 +185,7 @@ class Http implements UriInterface } /** - * Get host. - * - * @return string - * - * @since 1.0.0 - * @author Dennis Eichhorn + * {@inheritdoc} */ public function getHost() : string { @@ -203,12 +193,7 @@ class Http implements UriInterface } /** - * Get port. - * - * @return int - * - * @since 1.0.0 - * @author Dennis Eichhorn + * {@inheritdoc} */ public function getPort() : int { @@ -229,12 +214,7 @@ class Http implements UriInterface } /** - * Get path. - * - * @return string - * - * @since 1.0.0 - * @author Dennis Eichhorn + * {@inheritdoc} */ public function getPath() : string { @@ -242,14 +222,7 @@ class Http implements UriInterface } /** - * Get query. - * - * @param null|string $key Query key - * - * @return string - * - * @since 1.0.0 - * @author Dennis Eichhorn + * {@inheritdoc} */ public function getQuery(string $key = null) { @@ -257,12 +230,7 @@ class Http implements UriInterface } /** - * Get fragment. - * - * @return string - * - * @since 1.0.0 - * @author Dennis Eichhorn + * {@inheritdoc} */ public function getFragment() : string { @@ -270,12 +238,7 @@ class Http implements UriInterface } /** - * Get base. - * - * @return string - * - * @since 1.0.0 - * @author Dennis Eichhorn + * {@inheritdoc} */ public function getBase() : string { @@ -283,16 +246,9 @@ class Http implements UriInterface } /** - * Set uri. - * - * @param string $uri Uri - * - * @return void - * - * @since 1.0.0 - * @author Dennis Eichhorn + * {@inheritdoc} */ - private function set(string $uri) + public function set(string $uri) { $this->uri = $uri; diff --git a/Uri/UriInterface.php b/Uri/UriInterface.php index 30596282e..2cf869db1 100644 --- a/Uri/UriInterface.php +++ b/Uri/UriInterface.php @@ -142,4 +142,16 @@ interface UriInterface * @author Dennis Eichhorn */ public function getBase() : string; + + /** + * Set uri. + * + * @param string $uri Uri + * + * @return void + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function set(string $uri); } diff --git a/Utils/Encoding/Ceasar.php b/Utils/Encoding/Caesar.php similarity index 86% rename from Utils/Encoding/Ceasar.php rename to Utils/Encoding/Caesar.php index 19705dc02..3f4ae01f9 100644 --- a/Utils/Encoding/Ceasar.php +++ b/Utils/Encoding/Caesar.php @@ -26,8 +26,21 @@ namespace phpOMS\Utils\Encoding; * @link http://orange-management.com * @since 1.0.0 */ -class Ceasar { +class Caesar { + /** + * ASCII lower char limit. + * + * @var int + * @since 1.0.0 + */ const LIMIT_LOWER = 0; + + /** + * ASCII upper char limit. + * + * @var string + * @since 1.0.0 + */ const LIMIT_UPPER = 127; /** @@ -50,7 +63,7 @@ class Ceasar { $ascii -= self::LIMIT_UPPER; } - $result .= char($ascii); + $result .= chr($ascii); } return $result; @@ -76,7 +89,7 @@ class Ceasar { $ascii += self::LIMIT_LOWER; } - $result .= char($ascii); + $result .= chr($ascii); } return $result; diff --git a/Utils/Encoding/EncodingInterface.php b/Utils/Encoding/EncodingInterface.php index 448e3a776..7e052e524 100644 --- a/Utils/Encoding/EncodingInterface.php +++ b/Utils/Encoding/EncodingInterface.php @@ -38,7 +38,7 @@ interface EncodingInterface * @since 1.0.0 * @author Dennis Eichhorn */ - public function decode($source); + public function encode($source); /** * Dedecodes text diff --git a/Utils/Encoding/Xor.php b/Utils/Encoding/Xor.php index 56dcf8c57..8eebe2a8a 100644 --- a/Utils/Encoding/Xor.php +++ b/Utils/Encoding/Xor.php @@ -26,7 +26,7 @@ namespace phpOMS\Utils\Encoding; * @link http://orange-management.com * @since 1.0.0 */ -class Xor { +final class XorEncoding { /** * {@inheritdoc} @@ -43,7 +43,7 @@ class Xor { } $ascii = ord($source[$i]) ^ ord($key[$j]); - $result .= char($ascii); + $result .= chr($ascii); } return $result; @@ -54,6 +54,6 @@ class Xor { */ public static function decode(string $raw, string $key) : string { - return self::encode($raw, $key) + return self::encode($raw, $key); } } \ No newline at end of file diff --git a/Utils/Parser/Php/ArrayParser.php b/Utils/Parser/Php/ArrayParser.php index dd9246c9f..01864a8ce 100644 --- a/Utils/Parser/Php/ArrayParser.php +++ b/Utils/Parser/Php/ArrayParser.php @@ -30,25 +30,6 @@ namespace phpOMS\Utils\Parser\Php; */ class ArrayParser { - /** - * Saving array to file. - * - * @param string $name Name of new array - * @param array $arr Array to parse - * - * @return void - * - * @since 1.0.0 - * @author Dennis Eichhorn - */ - public static function createFile(string $name, array $arr) : string - { - $out = '<' . '?php' . PHP_EOL - . '$' . $name . ' = ' . self::serializeArray($this->arr) . ';'; - - return $out; - } - /** * Serializing array (recursively). * diff --git a/Utils/Parser/Php/ClassParser.php b/Utils/Parser/Php/ClassParser.php index 523987588..2185f07e9 100644 --- a/Utils/Parser/Php/ClassParser.php +++ b/Utils/Parser/Php/ClassParser.php @@ -172,16 +172,16 @@ class ClassParser public function addInclude(string $include) { - $this->include[] = $include; + $this->includes[] = $include; - array_unique($this->include); + array_unique($this->includes); } public function addRequire(string $require) { - $this->require[] = $require; + $this->requires[] = $require; - array_unique($this->require); + array_unique($this->requires); } public function addTrait(string $trait, string $as = null) @@ -267,7 +267,7 @@ class ClassParser $class .= PHP_EOL; } - if ($this->isfinal) { + if ($this->isFinal) { $class .= 'final '; } diff --git a/Utils/Parser/Php/FunctionParser.php b/Utils/Parser/Php/FunctionParser.php index e205429a4..114293e03 100644 --- a/Utils/Parser/Php/FunctionParser.php +++ b/Utils/Parser/Php/FunctionParser.php @@ -146,44 +146,44 @@ class FunctionParser public function parse() : string { $function = ''; - $member .= str_repeat(' ', ClassParser::INDENT); + $function .= str_repeat(' ', ClassParser::INDENT); if ($this->isFinal) { - $member .= 'final '; + $function .= 'final '; } if ($this->isAbstract) { - $member .= 'abstract '; + $function .= 'abstract '; } - $member .= $this->visibility . ' '; + $function .= $this->visibility . ' '; if ($this->isStatic) { - $member .= 'static '; + $function .= 'static '; } - $member .= 'function ' . $this->name . '('; + $function .= 'function ' . $this->name . '('; $parameters = ''; foreach ($this->parameters as $name => $para) { $parameters = (isset($para['typehint']) ? $para['typehint'] . ' ' : '') . $para['name'] . (array_key_exists('default', $para) ? ' = ' . MemberParser::parseVariable($para['default']) : '') . ', '; } - $member .= rtrim($parameters, ', ') . ') '; - $member .= ($this->return ?? '') . PHP_EOL; + $function .= rtrim($parameters, ', ') . ') '; + $function .= ($this->return ?? '') . PHP_EOL; if (isset($this->body)) { - $member .= str_repeat(' ', ClassParser::INDENT) . '{' . PHP_EOL . $this->addIndent($this->body) . PHP_EOL . str_repeat(' ', ClassParser::INDENT) . '}'; + $function .= str_repeat(' ', ClassParser::INDENT) . '{' . PHP_EOL . $this->addIndent($this->body) . PHP_EOL . str_repeat(' ', ClassParser::INDENT) . '}'; } else { - $member .= ';'; + $function .= ';'; } - return $member; + return $function; } - private function addIndent($body) : string + private function addIndent(string $body) : string { - $body = preg_split('/\r\n|\r|\n/', $this->body); + $body = preg_split('/\r\n|\r|\n/', $body); foreach ($body as &$line) { $line = str_repeat(' ', ClassParser::INDENT) . $line; diff --git a/Utils/Parser/Php/MemberParser.php b/Utils/Parser/Php/MemberParser.php index d8d06f82f..d4eb9505d 100644 --- a/Utils/Parser/Php/MemberParser.php +++ b/Utils/Parser/Php/MemberParser.php @@ -100,7 +100,9 @@ class MemberParser $member .= 'const '; } - $member .= (!$this->isConst ? '$' : '') . $name . ' = ' . self::parseVariable($this->default) . ';'; + $member .= (!$this->isConst ? '$' : '') . $this->name . ' = ' . self::parseVariable($this->default) . ';'; + + return $member; } /** diff --git a/Utils/Parser/Php/Visibility.php b/Utils/Parser/Php/Visibility.php index 5a3cedccf..19d39840b 100644 --- a/Utils/Parser/Php/Visibility.php +++ b/Utils/Parser/Php/Visibility.php @@ -30,7 +30,7 @@ use phpOMS\Datatypes\Enum; * @link http://orange-management.com * @since 1.0.0 */ -abstract class MemberVisibility extends Enum +abstract class Visibility extends Enum { const _PUBLIC = 'public'; const _PRIVATE = 'private'; diff --git a/Utils/Permutation.php b/Utils/Permutation.php index 6fdf5d533..4bd1065f5 100644 --- a/Utils/Permutation.php +++ b/Utils/Permutation.php @@ -51,7 +51,7 @@ class Permutation $newres = $result; $newres[] = $val; unset($newArr[$key]); - $permutations += permut($newArr, $newres); + $permutations += self::permut($newArr, $newres); } } @@ -100,6 +100,8 @@ class Permutation * * @return mixed * + * @throws \Exception + * * @since 1.0.0 * @author Dennis Eichhorn */ @@ -114,8 +116,8 @@ class Permutation } $i = 0; - for($key as $pos) { - $temp = $toPermute[$i] + foreach($key as $pos) { + $temp = $toPermute[$i]; $toPermute[$i] = $toPermute[$pos]; $toPermute[$pos] = $temp; $i++; diff --git a/Version/Version.php b/Version/Version.php index 00d7a9a8b..a70aa57c4 100644 --- a/Version/Version.php +++ b/Version/Version.php @@ -14,8 +14,6 @@ * @link http://orange-management.com */ namespace phpOMS\Version; -use phpOMS\System\File\PathException; -use phpOMS\Validation\Validator; /** * Version class. diff --git a/Views/View.php b/Views/View.php index 2d0655dff..64d0bed3e 100644 --- a/Views/View.php +++ b/Views/View.php @@ -348,14 +348,14 @@ class View implements \Serializable * @since 1.0.0 * @author Dennis Eichhorn */ - public function getArray() : array + public function toArray() : array { $viewArray = []; $viewArray[] = $this->render(); foreach($this->views as $key => $view) { - $viewArray[$key] = $view->getArray(); + $viewArray[$key] = $view->toArray(); } } @@ -382,7 +382,7 @@ class View implements \Serializable */ public function unserialize($raw) { - + // todo: implement } }