mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-13 07:18:39 +00:00
PHP CS fixes
This commit is contained in:
parent
59d3f98110
commit
f2591bff06
|
|
@ -84,15 +84,6 @@ class Group implements ArrayableInterface, \JsonSerializable
|
||||||
*/
|
*/
|
||||||
protected $permissions = [];
|
protected $permissions = [];
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor.
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get group id.
|
* Get group id.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* PHP Version 7.2
|
* PHP Version 7.2
|
||||||
*
|
*
|
||||||
* @package TBD
|
* @package phpOMS\Business\Finance\Forecasting
|
||||||
* @copyright Dennis Eichhorn
|
* @copyright Dennis Eichhorn
|
||||||
* @license OMS License 1.0
|
* @license OMS License 1.0
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
|
|
@ -15,12 +15,40 @@ namespace phpOMS\Business\Finance\Forecasting;
|
||||||
|
|
||||||
use phpOMS\Math\Statistic\Average;
|
use phpOMS\Math\Statistic\Average;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Arima forecasting class.
|
||||||
|
*
|
||||||
|
* @package phpOMS\Business\Finance\Forecasting
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @link http://website.orange-management.de
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
class ARIMA
|
class ARIMA
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Data points
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
private $data = [];
|
private $data = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Intervals of the time series
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
private $order = 0;
|
private $order = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param array $data Data points
|
||||||
|
* @param int $order Data intervals (only 12 and 4 are valid).
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public function __construct(array $data, int $order = 12)
|
public function __construct(array $data, int $order = 12)
|
||||||
{
|
{
|
||||||
$this->data = $data;
|
$this->data = $data;
|
||||||
|
|
@ -31,6 +59,13 @@ class ARIMA
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return data decomposition.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public function getDecomposition() : array
|
public function getDecomposition() : array
|
||||||
{
|
{
|
||||||
$iteration1 = $this->getIteration($this->data);
|
$iteration1 = $this->getIteration($this->data);
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,12 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace phpOMS\DataStorage\Database\Connection;
|
namespace phpOMS\DataStorage\Database\Connection;
|
||||||
|
|
||||||
|
use phpOMS\DataStorage\Database\DatabaseStatus;
|
||||||
|
use phpOMS\DataStorage\Database\DatabaseType;
|
||||||
|
use phpOMS\DataStorage\Database\Query\Grammar\PostgresGrammar;
|
||||||
|
use phpOMS\DataStorage\Database\Schema\Grammar\PostgresGrammar as PostgresSchemaGrammar;
|
||||||
|
use phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database handler.
|
* Database handler.
|
||||||
*
|
*
|
||||||
|
|
@ -25,7 +31,50 @@ namespace phpOMS\DataStorage\Database\Connection;
|
||||||
* @link http://website.orange-management.de
|
* @link http://website.orange-management.de
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
final class PostgresConnection extends \Exception
|
final class PostgresConnection extends ConnectionAbstract
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Object constructor.
|
||||||
|
*
|
||||||
|
* Creates the database object and overwrites all default values.
|
||||||
|
*
|
||||||
|
* @param string[] $dbdata the basic database information for establishing a connection
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public function __construct(array $dbdata)
|
||||||
|
{
|
||||||
|
$this->type = DatabaseType::PGSQL;
|
||||||
|
$this->grammar = new PostgresGrammar();
|
||||||
|
$this->schemaGrammar = new PostgresSchemaGrammar();
|
||||||
|
$this->connect($dbdata); // todo: remove since this is a side effect that doesn't belong to constructor
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function connect(array $dbdata = null) : void
|
||||||
|
{
|
||||||
|
$this->dbdata = isset($dbdata) ? $dbdata : $this->dbdata;
|
||||||
|
|
||||||
|
if (!isset($this->dbdata['db'], $this->dbdata['host'], $this->dbdata['port'], $this->dbdata['database'], $this->dbdata['login'], $this->dbdata['password'])) {
|
||||||
|
throw new InvalidConnectionConfigException(json_encode($this->dbdata));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->close();
|
||||||
|
$this->prefix = $dbdata['prefix'] ?? '';
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->con = new \PDO($this->dbdata['db'] . ':host=' . $this->dbdata['host'] . ':' . $this->dbdata['port'] . ';dbname=' . $this->dbdata['database'] . ';charset=utf8', $this->dbdata['login'], $this->dbdata['password']);
|
||||||
|
$this->con->setAttribute(\PDO::ATTR_EMULATE_PREPARES, false);
|
||||||
|
$this->con->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
|
||||||
|
|
||||||
|
$this->status = DatabaseStatus::OK;
|
||||||
|
} catch (\PDOException $e) {
|
||||||
|
$this->status = DatabaseStatus::MISSING_DATABASE;
|
||||||
|
$this->con = null;
|
||||||
|
} finally {
|
||||||
|
$this->dbdata['password'] = '****';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -93,8 +93,8 @@ final class Dispatcher
|
||||||
/**
|
/**
|
||||||
* Dispatch string.
|
* Dispatch string.
|
||||||
*
|
*
|
||||||
* @param string $controller Controller string
|
* @param string $controller Controller string
|
||||||
* @param array|null $data Data
|
* @param array|null $data Data
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
*/
|
*/
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace phpOMS\Message\Http;
|
namespace phpOMS\Message\Console;
|
||||||
|
|
||||||
use phpOMS\Localization\Localization;
|
use phpOMS\Localization\Localization;
|
||||||
use phpOMS\Message\RequestAbstract;
|
use phpOMS\Message\RequestAbstract;
|
||||||
|
|
@ -29,7 +29,7 @@ use phpOMS\Router\RouteVerb;
|
||||||
*
|
*
|
||||||
* @SuppressWarnings(PHPMD.Superglobals)
|
* @SuppressWarnings(PHPMD.Superglobals)
|
||||||
*/
|
*/
|
||||||
class Request extends RequestAbstract
|
final class Request extends RequestAbstract
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* OS type.
|
* OS type.
|
||||||
|
|
@ -101,4 +101,53 @@ class Request extends RequestAbstract
|
||||||
|
|
||||||
return $this->os;
|
return $this->os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getOrigin() : string
|
||||||
|
{
|
||||||
|
// todo: maybe return execution path?
|
||||||
|
return '127.0.0.1';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getMethod() : string
|
||||||
|
{
|
||||||
|
if ($this->method === null) {
|
||||||
|
$this->method = RequestMethod::GET;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->method;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getBody() : string
|
||||||
|
{
|
||||||
|
// todo: implement
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getRouteVerb() : int
|
||||||
|
{
|
||||||
|
switch ($this->getMethod()) {
|
||||||
|
case RequestMethod::GET:
|
||||||
|
return RouteVerb::GET;
|
||||||
|
case RequestMethod::PUT:
|
||||||
|
return RouteVerb::PUT;
|
||||||
|
case RequestMethod::POST:
|
||||||
|
return RouteVerb::SET;
|
||||||
|
case RequestMethod::DELETE:
|
||||||
|
return RouteVerb::DELETE;
|
||||||
|
default:
|
||||||
|
throw new \Exception();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -391,14 +391,6 @@ final class Request extends RequestAbstract
|
||||||
return file_get_contents('php://input');
|
return file_get_contents('php://input');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function getRequestTarget() : string
|
|
||||||
{
|
|
||||||
return '/';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get files passed in request.
|
* Get files passed in request.
|
||||||
*
|
*
|
||||||
|
|
@ -412,13 +404,7 @@ final class Request extends RequestAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get route verb for this request.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @return int
|
|
||||||
*
|
|
||||||
* @throws \Exception
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
*/
|
||||||
public function getRouteVerb() : int
|
public function getRouteVerb() : int
|
||||||
{
|
{
|
||||||
|
|
@ -437,11 +423,7 @@ final class Request extends RequestAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get request type.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
*/
|
||||||
public function getMethod() : string
|
public function getMethod() : string
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -248,15 +248,6 @@ abstract class RequestAbstract implements MessageInterface
|
||||||
return $this->uri->__toString();
|
return $this->uri->__toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get request target.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
abstract public function getRequestTarget() : string;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get route verb.
|
* Get route verb.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -253,8 +253,6 @@ class Repository
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->run('init');
|
$this->run('init');
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user