PhpStorm cleanup

This commit is contained in:
Dennis Eichhorn 2016-04-13 22:58:48 +02:00
parent 16320978d3
commit 669c3b7244
28 changed files with 219 additions and 178 deletions

View File

@ -55,6 +55,8 @@ class HttpSession implements SessionInterface
* @param int $liftetime Session life time * @param int $liftetime Session life time
* @param string|int|bool $sid Session id * @param string|int|bool $sid Session id
* *
* @throws \Exception
*
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */

View File

@ -20,7 +20,6 @@ use phpOMS\Message\RequestAbstract;
use phpOMS\Message\ResponseAbstract; use phpOMS\Message\ResponseAbstract;
use phpOMS\Module\ModuleAbstract; use phpOMS\Module\ModuleAbstract;
use phpOMS\System\File\PathException; use phpOMS\System\File\PathException;
use phpOMS\Views\ViewLayout;
/** /**
* Dispatcher class. * Dispatcher class.
@ -83,7 +82,6 @@ class Dispatcher
public function dispatch($controller, RequestAbstract $request, ResponseAbstract $response, $data = null) : array public function dispatch($controller, RequestAbstract $request, ResponseAbstract $response, $data = null) : array
{ {
$views = []; $views = [];
$type = ViewLayout::UNDEFINED;
if (is_array($controller) && isset($controller['dest'])) { if (is_array($controller) && isset($controller['dest'])) {
$controller = $controller['dest']; $controller = $controller['dest'];

View File

@ -122,7 +122,7 @@ class FileLogger implements LoggerInterface
* *
* @param string $path Logging path * @param string $path Logging path
* *
* @return self * @return FileLogger
* *
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>

View File

@ -14,6 +14,8 @@
* @link http://orange-management.com * @link http://orange-management.com
*/ */
namespace phpOMS\Message; namespace phpOMS\Message;
use phpOMS\DataStorage\Cookie\CookieJar;
use phpOMS\DataStorage\Session\HttpSession;
/** /**
* Response class. * Response class.
@ -26,7 +28,85 @@ namespace phpOMS\Message;
* @link http://orange-management.com * @link http://orange-management.com
* @since 1.0.0 * @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 <d.eichhorn@oms.com>
*/
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 <d.eichhorn@oms.com>
*/
abstract public function generate(string $statusCode);
/**
* Get header by key.
*
* @param string $key Header key
*
* @return array
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
abstract public function get(string $key) : array;
/**
* Header has key?
*
* @param string $key Header key
*
* @return bool
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
abstract public function has(string $key) : bool;
/**
* Set header locked.
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function lock()
{
CookieJar::lock();
HttpSession::lock();
self::$isLocked = true;
}
/**
* Is header locked?
*
* @return bool
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function isLocked() : bool
{
return self::$isLocked;
}
} }

View File

@ -16,9 +16,6 @@
namespace phpOMS\Message\Http; namespace phpOMS\Message\Http;
use phpOMS\Message\HeaderAbstract; use phpOMS\Message\HeaderAbstract;
use phpOMS\Utils\ArrayUtils;
use phpOMS\DataStorage\Cookie\CookieJar;
use phpOMS\DataStorage\Session\HttpSession;
/** /**
* Response class. * Response class.
@ -42,7 +39,13 @@ class Header extends HeaderAbstract
*/ */
private $header = []; private $header = [];
public function __constrct() /**
* Constructor.
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function __construct()
{ {
$this->set('Content-Type', 'text/html; charset=utf-8'); $this->set('Content-Type', 'text/html; charset=utf-8');
} }
@ -75,6 +78,8 @@ class Header extends HeaderAbstract
* *
* @return bool * @return bool
* *
* @throws \Exception
*
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
@ -93,26 +98,26 @@ class Header extends HeaderAbstract
return false; return false;
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function get(string $id) : array public function get(string $key) : array
{ {
return $this->header[$id] ?? []; return $this->header[$key] ?? [];
} }
/** /**
* {@inheritdoc} * {@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} * {@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) { if (self::$isLocked) {
throw new \Exception('Already locked'); throw new \Exception('Already locked');
@ -155,29 +160,7 @@ class Header extends HeaderAbstract
} }
/** /**
* Lock other header pushing models. * {@inheritdoc}
*
* @return array
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
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 <d.eichhorn@oms.com>
*/ */
public function generate(string $code) public function generate(string $code)
{ {

View File

@ -136,6 +136,8 @@ class Request extends RequestAbstract
* *
* @return void * @return void
* *
* @throws \Exception
*
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */

View File

@ -18,9 +18,7 @@ namespace phpOMS\Message\Http;
use phpOMS\System\MimeType; use phpOMS\System\MimeType;
use phpOMS\Contract\RenderableInterface; use phpOMS\Contract\RenderableInterface;
use phpOMS\Message\ResponseAbstract; use phpOMS\Message\ResponseAbstract;
use phpOMS\Utils\ArrayUtils; use phpOMS\Views\View;
use phpOMS\DataStorage\Cookie\CookieJar;
use phpOMS\DataStorage\Session\HttpSession;
/** /**
* Response class. * Response class.
@ -85,15 +83,13 @@ class Response extends ResponseAbstract implements RenderableInterface
* *
* @return bool * @return bool
* *
* @throws \Exception
*
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
public function remove(int $id) : bool public function remove(int $id) : bool
{ {
if (self::$isLocked) {
throw new \Exception('Already locked');
}
if (isset($this->response[$id])) { if (isset($this->response[$id])) {
unset($this->response[$id]); unset($this->response[$id]);
@ -149,7 +145,7 @@ class Response extends ResponseAbstract implements RenderableInterface
*/ */
private function getJson() : string 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 * @return string
* *
* @throws \Exception
*
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
@ -182,20 +180,15 @@ class Response extends ResponseAbstract implements RenderableInterface
} }
/** /**
* Generate response array from views. * {@inheritdoc}
*
* @return array
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
private function getArray() : array public function toArray() : array
{ {
$result = []; $result = [];
foreach($this->response as $key => $response) { foreach($this->response as $key => $response) {
if($reponse instanceof Views) { if($response instanceof View) {
$result += $response->getArray(); $result += $response->toArray();
} elseif(is_array($response)) { } elseif(is_array($response)) {
$result += $response; $result += $response;
} elseif(is_scalar($response)) { } elseif(is_scalar($response)) {

View File

@ -40,7 +40,7 @@ interface MessageInterface
/** /**
* Retrieves all message header values. * Retrieves all message header values.
* *
* @return array * @return HeaderAbstract
* *
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>

View File

@ -157,7 +157,7 @@ abstract class RequestAbstract implements MessageInterface
*/ */
public function setUri(UriInterface $uri) public function setUri(UriInterface $uri)
{ {
return $this->uri = $uri; $this->uri = $uri;
} }
/** /**

View File

@ -17,7 +17,6 @@ namespace phpOMS\Message;
use phpOMS\Localization\Localization; use phpOMS\Localization\Localization;
use phpOMS\Utils\ArrayUtils; use phpOMS\Utils\ArrayUtils;
use phpOMS\Message\Http\Header;
/** /**
* Response abstract class. * Response abstract class.
@ -65,6 +64,12 @@ abstract class ResponseAbstract implements MessageInterface
*/ */
protected $account = null; protected $account = null;
/**
* Header.
*
* @var HeaderAbstract
* @since 1.0.0
*/
protected $header = null; protected $header = null;
/** /**
@ -156,6 +161,18 @@ abstract class ResponseAbstract implements MessageInterface
return json_encode($this->toArray()); return json_encode($this->toArray());
} }
/**
* Generate response array from views.
*
* @return array
*
* @throws \Exception
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
abstract public function toArray() : array;
/** /**
* Get header. * Get header.
* *

View File

@ -173,7 +173,7 @@ class Meta implements RenderableInterface
/** /**
* Set description. * Set description.
* *
* @param string Descritpion * @param string $description Meta description
* *
* @return void * @return void
* *

View File

@ -17,7 +17,6 @@ namespace phpOMS\Module;
use phpOMS\System\File\PathException; use phpOMS\System\File\PathException;
use phpOMS\Utils\ArrayUtils; use phpOMS\Utils\ArrayUtils;
use phpOMS\Validation\Validator;
/** /**
* InfoManager class. * InfoManager class.
@ -54,7 +53,7 @@ class InfoManager
/** /**
* Object constructor. * Object constructor.
* *
* @param string $module Module name * @param string $path Info file path
* *
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn * @author Dennis Eichhorn

View File

@ -21,7 +21,6 @@ use phpOMS\Log\FileLogger;
use phpOMS\Message\Http\Request; use phpOMS\Message\Http\Request;
use phpOMS\System\File\PathException; use phpOMS\System\File\PathException;
use phpOMS\Autoloader; use phpOMS\Autoloader;
use phpOMS\Utils\IO\Json\InvalidJsonException;
/** /**
* Modules class. * Modules class.
@ -326,7 +325,7 @@ class ModuleManager
/** /**
* Register module in database. * Register module in database.
* *
* @param string $module Module name * @param InfoManager $info Module info
* *
* @return void * @return void
* *
@ -400,6 +399,8 @@ class ModuleManager
* *
* @return void * @return void
* *
* @throws \Exception
*
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn * @author Dennis Eichhorn
*/ */

View File

@ -15,7 +15,6 @@
*/ */
namespace phpOMS\Router; namespace phpOMS\Router;
use phpOMS\Views\ViewLayout;
use phpOMS\Message\RequestAbstract; use phpOMS\Message\RequestAbstract;
/** /**
@ -62,6 +61,7 @@ class Router
*/ */
public function importFromFile(string $path) public function importFromFile(string $path)
{ {
/** @noinspection PhpIncludeInspection */
$this->routes += include $path; $this->routes += include $path;
} }
@ -113,9 +113,9 @@ class Router
* Match route and uri. * Match route and uri.
* *
* @param string $route Route * @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 $uri Uri
* @param string $verb Verb this request is using * @param string $remoteVerb Verb this request is using
* *
* @return bool * @return bool
* *

View File

@ -14,6 +14,7 @@
* @link http://orange-management.com * @link http://orange-management.com
*/ */
namespace phpOMS\Stdlib\Map; namespace phpOMS\Stdlib\Map;
use phpOMS\Utils\Permutation;
/** /**
* Multimap utils. * Multimap utils.
@ -51,7 +52,7 @@ class MultiMap implements \Countable
* @var int * @var int
* @since 1.0.0 * @since 1.0.0
*/ */
private $keyType = KeyType::MULTIPLE; private $keyType = KeyType::SINGLE;
/** /**
* Order type. * Order type.
@ -64,10 +65,13 @@ class MultiMap implements \Countable
/** /**
* Constructor. * 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 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
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->keyType = $key;
$this->orderType = $order; $this->orderType = $order;
@ -216,11 +220,9 @@ class MultiMap implements \Countable
{ {
if ($this->keyType === KeyType::MULTIPLE && is_array($key)) { if ($this->keyType === KeyType::MULTIPLE && is_array($key)) {
return $this->setMultiple($key, $value); return $this->setMultiple($key, $value);
} else {
return $this->setSingle($key, $value);
} }
return false; return $this->setSingle($key, $value);
} }
/** /**

View File

@ -177,12 +177,7 @@ class Http implements UriInterface
} }
/** /**
* Get scheme. * {@inheritdoc}
*
* @return string
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
public function getScheme() : string public function getScheme() : string
{ {
@ -190,12 +185,7 @@ class Http implements UriInterface
} }
/** /**
* Get host. * {@inheritdoc}
*
* @return string
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
public function getHost() : string public function getHost() : string
{ {
@ -203,12 +193,7 @@ class Http implements UriInterface
} }
/** /**
* Get port. * {@inheritdoc}
*
* @return int
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
public function getPort() : int public function getPort() : int
{ {
@ -229,12 +214,7 @@ class Http implements UriInterface
} }
/** /**
* Get path. * {@inheritdoc}
*
* @return string
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
public function getPath() : string public function getPath() : string
{ {
@ -242,14 +222,7 @@ class Http implements UriInterface
} }
/** /**
* Get query. * {@inheritdoc}
*
* @param null|string $key Query key
*
* @return string
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
public function getQuery(string $key = null) public function getQuery(string $key = null)
{ {
@ -257,12 +230,7 @@ class Http implements UriInterface
} }
/** /**
* Get fragment. * {@inheritdoc}
*
* @return string
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
public function getFragment() : string public function getFragment() : string
{ {
@ -270,12 +238,7 @@ class Http implements UriInterface
} }
/** /**
* Get base. * {@inheritdoc}
*
* @return string
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
public function getBase() : string public function getBase() : string
{ {
@ -283,16 +246,9 @@ class Http implements UriInterface
} }
/** /**
* Set uri. * {@inheritdoc}
*
* @param string $uri Uri
*
* @return void
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
private function set(string $uri) public function set(string $uri)
{ {
$this->uri = $uri; $this->uri = $uri;

View File

@ -142,4 +142,16 @@ interface UriInterface
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
public function getBase() : string; public function getBase() : string;
/**
* Set uri.
*
* @param string $uri Uri
*
* @return void
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function set(string $uri);
} }

View File

@ -26,8 +26,21 @@ namespace phpOMS\Utils\Encoding;
* @link http://orange-management.com * @link http://orange-management.com
* @since 1.0.0 * @since 1.0.0
*/ */
class Ceasar { class Caesar {
/**
* ASCII lower char limit.
*
* @var int
* @since 1.0.0
*/
const LIMIT_LOWER = 0; const LIMIT_LOWER = 0;
/**
* ASCII upper char limit.
*
* @var string
* @since 1.0.0
*/
const LIMIT_UPPER = 127; const LIMIT_UPPER = 127;
/** /**
@ -50,7 +63,7 @@ class Ceasar {
$ascii -= self::LIMIT_UPPER; $ascii -= self::LIMIT_UPPER;
} }
$result .= char($ascii); $result .= chr($ascii);
} }
return $result; return $result;
@ -76,7 +89,7 @@ class Ceasar {
$ascii += self::LIMIT_LOWER; $ascii += self::LIMIT_LOWER;
} }
$result .= char($ascii); $result .= chr($ascii);
} }
return $result; return $result;

View File

@ -38,7 +38,7 @@ interface EncodingInterface
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
public function decode($source); public function encode($source);
/** /**
* Dedecodes text * Dedecodes text

View File

@ -26,7 +26,7 @@ namespace phpOMS\Utils\Encoding;
* @link http://orange-management.com * @link http://orange-management.com
* @since 1.0.0 * @since 1.0.0
*/ */
class Xor { final class XorEncoding {
/** /**
* {@inheritdoc} * {@inheritdoc}
@ -43,7 +43,7 @@ class Xor {
} }
$ascii = ord($source[$i]) ^ ord($key[$j]); $ascii = ord($source[$i]) ^ ord($key[$j]);
$result .= char($ascii); $result .= chr($ascii);
} }
return $result; return $result;
@ -54,6 +54,6 @@ class Xor {
*/ */
public static function decode(string $raw, string $key) : string public static function decode(string $raw, string $key) : string
{ {
return self::encode($raw, $key) return self::encode($raw, $key);
} }
} }

View File

@ -30,25 +30,6 @@ namespace phpOMS\Utils\Parser\Php;
*/ */
class ArrayParser 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 <d.eichhorn@oms.com>
*/
public static function createFile(string $name, array $arr) : string
{
$out = '<' . '?php' . PHP_EOL
. '$' . $name . ' = ' . self::serializeArray($this->arr) . ';';
return $out;
}
/** /**
* Serializing array (recursively). * Serializing array (recursively).
* *

View File

@ -172,16 +172,16 @@ class ClassParser
public function addInclude(string $include) public function addInclude(string $include)
{ {
$this->include[] = $include; $this->includes[] = $include;
array_unique($this->include); array_unique($this->includes);
} }
public function addRequire(string $require) 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) public function addTrait(string $trait, string $as = null)
@ -267,7 +267,7 @@ class ClassParser
$class .= PHP_EOL; $class .= PHP_EOL;
} }
if ($this->isfinal) { if ($this->isFinal) {
$class .= 'final '; $class .= 'final ';
} }

View File

@ -146,44 +146,44 @@ class FunctionParser
public function parse() : string public function parse() : string
{ {
$function = ''; $function = '';
$member .= str_repeat(' ', ClassParser::INDENT); $function .= str_repeat(' ', ClassParser::INDENT);
if ($this->isFinal) { if ($this->isFinal) {
$member .= 'final '; $function .= 'final ';
} }
if ($this->isAbstract) { if ($this->isAbstract) {
$member .= 'abstract '; $function .= 'abstract ';
} }
$member .= $this->visibility . ' '; $function .= $this->visibility . ' ';
if ($this->isStatic) { if ($this->isStatic) {
$member .= 'static '; $function .= 'static ';
} }
$member .= 'function ' . $this->name . '('; $function .= 'function ' . $this->name . '(';
$parameters = ''; $parameters = '';
foreach ($this->parameters as $name => $para) { foreach ($this->parameters as $name => $para) {
$parameters = (isset($para['typehint']) ? $para['typehint'] . ' ' : '') . $para['name'] . (array_key_exists('default', $para) ? ' = ' . MemberParser::parseVariable($para['default']) : '') . ', '; $parameters = (isset($para['typehint']) ? $para['typehint'] . ' ' : '') . $para['name'] . (array_key_exists('default', $para) ? ' = ' . MemberParser::parseVariable($para['default']) : '') . ', ';
} }
$member .= rtrim($parameters, ', ') . ') '; $function .= rtrim($parameters, ', ') . ') ';
$member .= ($this->return ?? '') . PHP_EOL; $function .= ($this->return ?? '') . PHP_EOL;
if (isset($this->body)) { 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 { } 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) { foreach ($body as &$line) {
$line = str_repeat(' ', ClassParser::INDENT) . $line; $line = str_repeat(' ', ClassParser::INDENT) . $line;

View File

@ -100,7 +100,9 @@ class MemberParser
$member .= 'const '; $member .= 'const ';
} }
$member .= (!$this->isConst ? '$' : '') . $name . ' = ' . self::parseVariable($this->default) . ';'; $member .= (!$this->isConst ? '$' : '') . $this->name . ' = ' . self::parseVariable($this->default) . ';';
return $member;
} }
/** /**

View File

@ -30,7 +30,7 @@ use phpOMS\Datatypes\Enum;
* @link http://orange-management.com * @link http://orange-management.com
* @since 1.0.0 * @since 1.0.0
*/ */
abstract class MemberVisibility extends Enum abstract class Visibility extends Enum
{ {
const _PUBLIC = 'public'; const _PUBLIC = 'public';
const _PRIVATE = 'private'; const _PRIVATE = 'private';

View File

@ -51,7 +51,7 @@ class Permutation
$newres = $result; $newres = $result;
$newres[] = $val; $newres[] = $val;
unset($newArr[$key]); unset($newArr[$key]);
$permutations += permut($newArr, $newres); $permutations += self::permut($newArr, $newres);
} }
} }
@ -100,6 +100,8 @@ class Permutation
* *
* @return mixed * @return mixed
* *
* @throws \Exception
*
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
@ -114,8 +116,8 @@ class Permutation
} }
$i = 0; $i = 0;
for($key as $pos) { foreach($key as $pos) {
$temp = $toPermute[$i] $temp = $toPermute[$i];
$toPermute[$i] = $toPermute[$pos]; $toPermute[$i] = $toPermute[$pos];
$toPermute[$pos] = $temp; $toPermute[$pos] = $temp;
$i++; $i++;

View File

@ -14,8 +14,6 @@
* @link http://orange-management.com * @link http://orange-management.com
*/ */
namespace phpOMS\Version; namespace phpOMS\Version;
use phpOMS\System\File\PathException;
use phpOMS\Validation\Validator;
/** /**
* Version class. * Version class.

View File

@ -348,14 +348,14 @@ class View implements \Serializable
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
public function getArray() : array public function toArray() : array
{ {
$viewArray = []; $viewArray = [];
$viewArray[] = $this->render(); $viewArray[] = $this->render();
foreach($this->views as $key => $view) { 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) public function unserialize($raw)
{ {
// todo: implement
} }
} }