Merge remote-tracking branch 'origin/develop' into develop

# Conflicts:
#	Datatypes/SmartDateTime.php
This commit is contained in:
Dennis Eichhorn 2017-01-06 12:01:07 +01:00
commit 40ee844dae
481 changed files with 9544 additions and 5514 deletions

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -159,6 +159,7 @@ class Account implements ArrayableInterface, \JsonSerializable
public function __construct(int $id = 0)
{
$this->createdAt = new \DateTime('now');
$this->lastActive = new \DateTime('now');
$this->id = $id;
$this->l11n = new NullLocalization();
}
@ -199,11 +200,24 @@ class Account implements ArrayableInterface, \JsonSerializable
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function setL11n(Localization $l11n)
public function setL11n(Localization $l11n) /* : void */
{
$this->l11n = $l11n;
}
/**
* Get name.
*
* @return string
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function getName() : string
{
return $this->login;
}
/**
* Get name1.
*
@ -312,6 +326,21 @@ class Account implements ArrayableInterface, \JsonSerializable
return $this->createdAt ?? new \DateTime('NOW');
}
/**
* Set name.
*
* @param string $name Name
*
* @return void
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function setName(string $name) /* : void */
{
$this->login = $name;
}
/**
* Set name1.
*
@ -322,7 +351,7 @@ class Account implements ArrayableInterface, \JsonSerializable
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function setName1(string $name)
public function setName1(string $name) /* : void */
{
$this->name1 = $name;
}
@ -337,7 +366,7 @@ class Account implements ArrayableInterface, \JsonSerializable
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function setName2(string $name)
public function setName2(string $name) /* : void */
{
$this->name2 = $name;
}
@ -352,7 +381,7 @@ class Account implements ArrayableInterface, \JsonSerializable
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function setName3(string $name)
public function setName3(string $name) /* : void */
{
$this->name3 = $name;
}
@ -367,7 +396,7 @@ class Account implements ArrayableInterface, \JsonSerializable
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function setEmail(string $email)
public function setEmail(string $email) /* : void */
{
if (!Email::isValid($email)) {
throw new \InvalidArgumentException();
@ -386,7 +415,7 @@ class Account implements ArrayableInterface, \JsonSerializable
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function setStatus(int $status)
public function setStatus(int $status) /* : void */
{
if (!AccountStatus::isValidValue($status)) {
throw new \InvalidArgumentException();
@ -405,7 +434,7 @@ class Account implements ArrayableInterface, \JsonSerializable
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function setType(int $type)
public function setType(int $type) /* : void */
{
if (!AccountType::isValidValue($type)) {
throw new \InvalidArgumentException();

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -25,7 +25,7 @@ class AccountMapper extends DataMapperAbstract
/**
* Columns.
*
* @var array<string, array>
* @var array
* @since 1.0.0
*/
protected static $columns = [

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -30,8 +30,8 @@ use phpOMS\Datatypes\Enum;
*/
abstract class AccountStatus extends Enum
{
const ACTIVE = 1;
const INACTIVE = 2;
const TIMEOUT = 3;
const BANNED = 4;
/* public */ const ACTIVE = 1;
/* public */ const INACTIVE = 2;
/* public */ const TIMEOUT = 3;
/* public */ const BANNED = 4;
}

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -30,6 +30,6 @@ use phpOMS\Datatypes\Enum;
*/
abstract class AccountType extends Enum
{
const USER = 0;
const GROUP = 1;
/* public */ const USER = 0;
/* public */ const GROUP = 1;
}

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -64,14 +64,20 @@ class Group implements ArrayableInterface, \JsonSerializable
protected $members = [];
/**
* Parents .
* Parents.
*
* @var int[]
* @since 1.0.0
*/
protected $parents = [];
private $status = GroupStatus::INACTIVE;
/**
* Group status.
*
* @var int
* @since 1.0.0
*/
protected $status = GroupStatus::INACTIVE;
/**
* Permissions.
@ -142,7 +148,7 @@ class Group implements ArrayableInterface, \JsonSerializable
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function setName(string $name)
public function setName(string $name) /* : void */
{
$this->name = $name;
}
@ -168,18 +174,35 @@ class Group implements ArrayableInterface, \JsonSerializable
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function setDescription(string $description)
public function setDescription(string $description) /* : void */
{
$this->description = $description;
}
/**
* Get group status.
*
* @return int Group status
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function getStatus() : int
{
return $this->status;
}
public function setStatus(int $status)
/**
* Set group status.
*
* @param int $status Group status
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function setStatus(int $status) /* : void */
{
// todo: check valid
$this->status = $status;
}

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -30,9 +30,9 @@ use phpOMS\Datatypes\Enum;
*/
abstract class GroupStatus extends Enum
{
const ACTIVE = 1;
/* public */ const ACTIVE = 1;
const INACTIVE = 2;
/* public */ const INACTIVE = 2;
const HIDDEN = 4;
/* public */ const HIDDEN = 4;
}

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -0,0 +1,34 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
namespace phpOMS\Algorithm;
use phpOMS\Datatypes\Enum;
/**
* Task status enum.
*
* @category Tasks
* @package Modules
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
abstract class AlgorithmType extends Enum
{
/* public */ const BRUTEFORCE = 0;
}

View File

@ -0,0 +1,91 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
namespace phpOMS\Algorithm\Knappsack;
use phpOMS\Algorithm\AlgorithmType;
/**
* Knappsack algorithm implementations
*
* @category Framework
* @package phpOMS\Auth
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class Backpack
{
private $costMaximum = 0;
private $value = 0;
private $cost = 0;
private $items = [];
private $population = [];
public function __construct(float $costMaximum)
{
$this->costMaximum = $costMaximum;
}
public function addPopulationItem(ItemInterface $item) : bool
{
if(isset($this->population[$item->getId()])) {
return false;
}
$this->population[$item->getId()] = $item;
return true;
}
public function setPopulationItem(ItemInterface $item) /* : void */
{
$this->population[$item->getId()] = $item;
}
public function setCostCalculation(\Closure $callback) /* : void */
{
}
public function setValueCalculation(\Closure $callback) /* : void */
{
}
public function setTestPopulationBuilder(\Closure $callback) /* : void */
{
}
public function pack(int $type)
{
switch($type) {
case AlgorithmType::BRUTEFORCE:
return $this->bruteforce();
default:
throw new \Exception('Invalid algorithm type');
}
}
public function bruteforce()
{
}
}

View File

@ -0,0 +1,32 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
namespace phpOMS\Algorithm\Knappsack;
/**
* Shape interface.
*
* @category Framework
* @package phpOMS\Math
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
interface ItemInterface
{
}

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -37,6 +37,14 @@ class ApplicationAbstract
*/
public $appName = '';
/**
* Config.
*
* @var array
* @since 1.0.0
*/
private $config = [];
/**
* Database object.
*

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -101,7 +101,7 @@ class AssetManager implements \Countable
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function get(string $id)
public function get(string $id) /* : ?string */
{
if (isset($this->assets[$id])) {
return $this->assets[$id];

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -30,7 +30,7 @@ use phpOMS\Datatypes\Enum;
*/
abstract class AssetType extends Enum
{
const CSS = 'css';
const JS = 'js';
const JSLATE = 'jslate';
/* public */ const CSS = 'css';
/* public */ const JS = 'js';
/* public */ const JSLATE = 'jslate';
}

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -32,14 +32,14 @@ use phpOMS\Datatypes\Enum;
*/
abstract class LoginReturnType extends Enum
{
const OK = 0; /* Everything is ok and the user got authed */
const FAILURE = 1; /* Authentication resulted in a unexpected failure */
const WRONG_PASSWORD = 2; /* Authentication with wrong password */
const WRONG_USERNAME = 3; /* Authentication with unknown user */
const WRONG_PERMISSION = 4; /* User doesn't have permission to authenticate */
const NOT_ACTIVATED = 5; /* The user is not activated yet */
const WRONG_INPUT_EXCEEDED = 6; /* Too many wrong logins recently */
const TIMEOUTED = 7; /* User received a timeout and can not log in until a certain date */
const BANNED = 8; /* User is banned */
const INACTIVE = 9; /* User is inactive */
/* public */ const OK = 0; /* Everything is ok and the user got authed */
/* public */ const FAILURE = 1; /* Authentication resulted in a unexpected failure */
/* public */ const WRONG_PASSWORD = 2; /* Authentication with wrong password */
/* public */ const WRONG_USERNAME = 3; /* Authentication with unknown user */
/* public */ const WRONG_PERMISSION = 4; /* User doesn't have permission to authenticate */
/* public */ const NOT_ACTIVATED = 5; /* The user is not activated yet */
/* public */ const WRONG_INPUT_EXCEEDED = 6; /* Too many wrong logins recently */
/* public */ const TIMEOUTED = 7; /* User received a timeout and can not log in until a certain date */
/* public */ const BANNED = 8; /* User is banned */
/* public */ const INACTIVE = 9; /* User is inactive */
}

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -44,7 +44,7 @@ class Autoloader
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function default_autoloader(string $class)
public static function default_autoloader(string $class) /* : void */
{
$class = ltrim($class, '\\');
$class = str_replace(['_', '\\'], '/', $class);

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -36,7 +36,7 @@ trait OptionsTrait
/**
* {@inheritdoc}
*/
public function exists($key)
public function exists($key) : bool
{
return isset($this->options[$key]);
}

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -39,7 +39,7 @@ abstract class SettingsAbstract implements OptionsInterface
/**
* Cache manager (pool).
*
* @var \phpOMS\DataStorage\Cache\Pool
* @var \phpOMS\DataStorage\Cache\CachePool
* @since 1.0.0
*/
protected $cache = null;
@ -131,7 +131,7 @@ abstract class SettingsAbstract implements OptionsInterface
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function set(array $options, bool $store = false)
public function set(array $options, bool $store = false) /* : void */
{
$this->setOptions($options);

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -32,7 +32,7 @@ use phpOMS\Datatypes\Enum;
*/
abstract class CacheStatus extends Enum
{
const ACTIVE = 0;
const INACTIVE = 1;
const ERROR = 2;
/* public */ const ACTIVE = 0;
/* public */ const INACTIVE = 1;
/* public */ const ERROR = 2;
}

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -32,11 +32,11 @@ use phpOMS\Datatypes\Enum;
*/
abstract class CacheType extends Enum
{
const _INT = 0; /* Data is integer */
const _STRING = 1; /* Data is string */
const _ARRAY = 2; /* Data is array */
const _SERIALIZABLE = 3; /* Data is object */
const _JSONSERIALIZABLE = 6;
const _FLOAT = 4; /* Data is float */
const _BOOL = 5; /* Data is float */
/* public */ const _INT = 0; /* Data is integer */
/* public */ const _STRING = 1; /* Data is string */
/* public */ const _ARRAY = 2; /* Data is array */
/* public */ const _SERIALIZABLE = 3; /* Data is object */
/* public */ const _JSONSERIALIZABLE = 6;
/* public */ const _FLOAT = 4; /* Data is float */
/* public */ const _BOOL = 5; /* Data is float */
}

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -22,7 +22,7 @@ use phpOMS\System\File\Local\File;
/**
* MemCache class.
*
* PHP Version 5.6
* PHP Version 7.1
*
* @category Framework
* @package phpOMS\DataStorage\Cache
@ -41,7 +41,15 @@ class FileCache implements CacheInterface
* @var string
* @since 1.0.0
*/
const DELIM = '$';
/* private */ const DELIM = '$';
/**
* File path sanitizer
*
* @var string
* @since 1.0.0
*/
/* private */ const SANITIZE = '~';
/**
* Cache path.
@ -136,15 +144,16 @@ class FileCache implements CacheInterface
/**
* {@inheritdoc}
*/
public function set($key, $value, int $expire = -1)
public function set($key, $value, int $expire = -1) /* : void */
{
if($this->status !== CacheStatus::ACTIVE) {
return false;
}
$path = File::sanitize($key, '~');
// todo: allow $key to contain / as char and create subdirectory if necessary. This is important for cleaner caching.
$path = File::sanitize($key, self::SANITIZE);
file_put_contents($this->cachePath . '/' . $path . '.cache', $this->build($value, $expire));
file_put_contents($this->cachePath . '/' . trim($path, '/') . '.cache', $this->build($value, $expire));
return false;
}
@ -158,8 +167,8 @@ class FileCache implements CacheInterface
return false;
}
$name = File::sanitize($key, '~');
$path = $this->cachePath . '/' . $path . '.cache';
$path = File::sanitize($key, self::SANITIZE);
$path = $this->cachePath . '/' . trim($path, '/') . '.cache';
if (!file_exists($path)) {
file_put_contents($path, $this->build($value, $expire));
@ -275,8 +284,8 @@ class FileCache implements CacheInterface
return null;
}
$name = File::sanitize($key, '~');
$path = $this->cachePath . '/' . $name . '.cache';
$name = File::sanitize($key, self::SANITIZE);
$path = $this->cachePath . '/' . trim($name, '/') . '.cache';
if(!file_exists($path)) {
return null;
@ -342,8 +351,8 @@ class FileCache implements CacheInterface
return false;
}
$name = File::sanitize($key, '~');
$path = $this->cachePath . '/' . $name . '.cache';
$name = File::sanitize($key, self::SANITIZE);
$path = $this->cachePath . '/' . trim($name, '/') . '.cache';
if ($expire < 0 && file_exists($path)) {
unlink($path);
@ -405,8 +414,8 @@ class FileCache implements CacheInterface
return false;
}
$name = File::sanitize($key, '~');
$path = $this->cachePath . '/' . $path . '.cache';
$name = File::sanitize($key, self::SANITIZE);
$path = $this->cachePath . '/' . trim($path, '/') . '.cache';
if (file_exists($path)) {
file_put_contents($path, $this->build($value, $expire));

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -74,7 +74,7 @@ class MemCache implements CacheInterface
/**
* {@inheritdoc}
*/
public function set($key, $value, CacheStatus $type = null, int $expire = 2592000)
public function set($key, $value, int $expire = -1) /* : void */
{
$this->memc->set($key, $value, false, $expire);
}
@ -82,7 +82,7 @@ class MemCache implements CacheInterface
/**
* {@inheritdoc}
*/
public function add($key, $value, CacheStatus $type = null, int $expire = 2592000) : bool
public function add($key, $value, int $expire = -1) : bool
{
return $this->memc->add($key, $value, false, $expire);
}
@ -90,7 +90,7 @@ class MemCache implements CacheInterface
/**
* {@inheritdoc}
*/
public function get($key, CacheStatus $type = null)
public function get($key, int $expire = -1)
{
return $this->memc->get($key);
}
@ -98,7 +98,7 @@ class MemCache implements CacheInterface
/**
* {@inheritdoc}
*/
public function delete($key, CacheStatus $type = null) : bool
public function delete($key, int $expire = -1) : bool
{
$this->memc->delete($key);
}
@ -106,15 +106,27 @@ class MemCache implements CacheInterface
/**
* {@inheritdoc}
*/
public function flush(CacheStatus $type = null)
public function flush(int $expire = 0) : bool
{
$this->memc->flush();
return true;
}
/**
* {@inheritdoc}
*/
public function replace($key, $value, CacheType $type = null, int $expire = -1) : bool
public function flushAll() : bool
{
$this->memc->flush();
return true;
}
/**
* {@inheritdoc}
*/
public function replace($key, $value, int $expire = -1) : bool
{
$this->memc->replace($key, $value, false, $expire);
}
@ -136,6 +148,14 @@ class MemCache implements CacheInterface
return $this->threshold;
}
/**
* {@inheritdoc}
*/
public function setStatus(int $status) /* : void */
{
$this->status = $status;
}
/**
* Destructor.
*

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -32,7 +32,7 @@ class NullCache implements CacheInterface
/**
* {@inheritdoc}
*/
public function set($key, $value, CacheStatus $type = null, int $expire = 2592000)
public function set($key, $value, int $expire = -1) /* : void */
{
// TODO: Implement set() method.
}
@ -40,7 +40,7 @@ class NullCache implements CacheInterface
/**
* {@inheritdoc}
*/
public function add($key, $value, CacheStatus $type = null, int $expire = 2592000) : bool
public function add($key, $value, int $expire = -1) : bool
{
// TODO: Implement add() method.
}
@ -48,7 +48,7 @@ class NullCache implements CacheInterface
/**
* {@inheritdoc}
*/
public function get($key, CacheStatus $type = null)
public function get($key, int $expire = -1)
{
// TODO: Implement get() method.
}
@ -56,7 +56,7 @@ class NullCache implements CacheInterface
/**
* {@inheritdoc}
*/
public function delete($key, CacheStatus $type = null) : bool
public function delete($key, int $expire = -1) : bool
{
// TODO: Implement delete() method.
}
@ -64,15 +64,27 @@ class NullCache implements CacheInterface
/**
* {@inheritdoc}
*/
public function flush(CacheStatus $type = null)
public function flush(int $expire = 0) : bool
{
// TODO: Implement flush() method.
return true;
}
/**
* {@inheritdoc}
*/
public function replace($key, $value, CacheType $type = null, int $expire = -1) : bool
public function flushAll() : bool
{
// TODO: Implement flush() method.
return true;
}
/**
* {@inheritdoc}
*/
public function replace($key, $value, int $expire = -1) : bool
{
// TODO: Implement replace() method.
}
@ -93,4 +105,11 @@ class NullCache implements CacheInterface
// TODO: Implement getThreshold() method.
}
/**
* {@inheritdoc}
*/
public function setStatus(int $status) /* : void */
{
// TODO: Implement setStatus() method.
}
}

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -34,7 +34,7 @@ class RedisCache implements CacheInterface
/**
* {@inheritdoc}
*/
public function set($key, $value, CacheStatus $type = null, int $expire = 2592000)
public function set($key, $value, int $expire = -1) /* : void */
{
// TODO: Implement set() method.
}
@ -42,7 +42,7 @@ class RedisCache implements CacheInterface
/**
* {@inheritdoc}
*/
public function add($key, $value, CacheStatus $type = null, int $expire = 2592000) : bool
public function add($key, $value, int $expire = -1) : bool
{
// TODO: Implement add() method.
}
@ -50,7 +50,7 @@ class RedisCache implements CacheInterface
/**
* {@inheritdoc}
*/
public function get($key, CacheStatus $type = null)
public function get($key, int $expire = -1)
{
// TODO: Implement get() method.
}
@ -58,7 +58,7 @@ class RedisCache implements CacheInterface
/**
* {@inheritdoc}
*/
public function delete($key, CacheStatus $type = null) : bool
public function delete($key, int $expire = -1) : bool
{
// TODO: Implement delete() method.
}
@ -66,15 +66,27 @@ class RedisCache implements CacheInterface
/**
* {@inheritdoc}
*/
public function flush(CacheStatus $type = null)
public function flush(int $expire = 0) : bool
{
// TODO: Implement flush() method.
return true;
}
/**
* {@inheritdoc}
*/
public function replace($key, $value, CacheType $type = null, int $expire = -1) : bool
public function flushAll() : bool
{
// TODO: Implement flush() method.
return true;
}
/**
* {@inheritdoc}
*/
public function replace($key, $value, int $expire = -1) : bool
{
// TODO: Implement replace() method.
}
@ -95,4 +107,11 @@ class RedisCache implements CacheInterface
// TODO: Implement getThreshold() method.
}
/**
* {@inheritdoc}
*/
public function setStatus(int $status) /* : void */
{
// TODO: Implement setStatus() method.
}
}

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -34,7 +34,7 @@ class WinCache implements CacheInterface
/**
* {@inheritdoc}
*/
public function set($key, $value, CacheStatus $type = null, int $expire = 2592000)
public function set($key, $value, int $expire = -1) /* : void */
{
// TODO: Implement set() method.
}
@ -42,7 +42,7 @@ class WinCache implements CacheInterface
/**
* {@inheritdoc}
*/
public function add($key, $value, CacheStatus $type = null, int $expire = 2592000) : bool
public function add($key, $value, int $expire = -1) : bool
{
// TODO: Implement add() method.
}
@ -50,7 +50,7 @@ class WinCache implements CacheInterface
/**
* {@inheritdoc}
*/
public function get($key, CacheStatus $type = null)
public function get($key, int $expire = -1)
{
// TODO: Implement get() method.
}
@ -58,7 +58,7 @@ class WinCache implements CacheInterface
/**
* {@inheritdoc}
*/
public function delete($key, CacheStatus $type = null) : bool
public function delete($key, int $expire = -1) : bool
{
// TODO: Implement delete() method.
}
@ -66,15 +66,27 @@ class WinCache implements CacheInterface
/**
* {@inheritdoc}
*/
public function flush(CacheStatus $type = null)
public function flush(int $expire = 0) : bool
{
// TODO: Implement flush() method.
return true;
}
/**
* {@inheritdoc}
*/
public function replace($key, $value, CacheType $type = null, int $expire = -1) : bool
public function flushAll() : bool
{
// TODO: Implement flush() method.
return true;
}
/**
* {@inheritdoc}
*/
public function replace($key, $value, int $expire = -1) : bool
{
// TODO: Implement replace() method.
}
@ -95,4 +107,11 @@ class WinCache implements CacheInterface
// TODO: Implement getThreshold() method.
}
/**
* {@inheritdoc}
*/
public function setStatus(int $status) /* : void */
{
// TODO: Implement setStatus() method.
}
}

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -63,7 +63,7 @@ class CookieJar
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function lock()
public static function lock() /* : void */
{
self::$isLocked = true;
}
@ -126,7 +126,7 @@ class CookieJar
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function delete(string $id)
public function delete(string $id) /* : void */
{
$this->remove($id);
setcookie($id, '', time() - 3600);
@ -156,10 +156,14 @@ class CookieJar
/**
* Save cookie
*
* @return void
*
* @throws LockException
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function save()
public function save() /* : void */
{
if (self::$isLocked) {
throw new LockException('CookieJar');

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -68,12 +68,12 @@ abstract class BuilderAbstract
*
* @param string $prefix Prefix
*
* @return $this
* @return BuilderAbstract
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function prefix(string $prefix)
public function prefix(string $prefix) : BuilderAbstract
{
$this->prefix = $prefix;

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -165,7 +165,7 @@ abstract class ConnectionAbstract implements ConnectionInterface
/**
* {@inheritdoc}
*/
public function close()
public function close() /* : void */
{
$this->con = null;
$this->status = DatabaseStatus::CLOSED;

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -44,7 +44,7 @@ interface ConnectionInterface
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function connect(array $dbdata);
public function connect(array $dbdata) /* : void */;
/**
* Get the database type.
@ -74,7 +74,7 @@ interface ConnectionInterface
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function close();
public function close() /* : void */;
/**
* Return grammar for this connection.

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -58,7 +58,7 @@ class MysqlConnection extends ConnectionAbstract
/**
* {@inheritdoc}
*/
public function connect(array $dbdata = null)
public function connect(array $dbdata = null) /* : void */
{
$this->close();

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -57,7 +57,7 @@ class SqlServerConnection extends ConnectionAbstract
/**
* {@inheritdoc}
*/
public function connect(array $dbdata = null)
public function connect(array $dbdata = null) /* : void */
{
$this->close();

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -70,7 +70,7 @@ class DataMapperAbstract implements DataMapperInterface
/**
* Columns.
*
* @var array<string, array>
* @var array
* @since 1.0.0
*/
protected static $columns = [];
@ -175,7 +175,7 @@ class DataMapperAbstract implements DataMapperInterface
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function setConnection(ConnectionAbstract $con)
public static function setConnection(ConnectionAbstract $con) /* : void */
{
self::$db = $con;
}
@ -216,7 +216,7 @@ class DataMapperAbstract implements DataMapperInterface
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
private static function extend($class)
private static function extend($class) /* : void */
{
/* todo: have to implement this in the queries, so far not used */
self::$collection['primaryField'][] = $class::$primaryField;
@ -264,7 +264,7 @@ class DataMapperAbstract implements DataMapperInterface
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function with(...$objects)
public static function with(...$objects) /* : void */
{
// todo: how to handle with of parent objects/extends/relations
@ -283,7 +283,7 @@ class DataMapperAbstract implements DataMapperInterface
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function clear()
public static function clear() /* : void */
{
self::$overwrite = true;
self::$primaryField = '';
@ -337,8 +337,6 @@ class DataMapperAbstract implements DataMapperInterface
*
* @return mixed
*
* @throws
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
@ -427,7 +425,7 @@ class DataMapperAbstract implements DataMapperInterface
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
private static function setObjectId(\ReflectionClass $reflectionClass, $obj, $objId)
private static function setObjectId(\ReflectionClass $reflectionClass, $obj, $objId) /* : void */
{
$reflectionProperty = $reflectionClass->getProperty(static::$columns[static::$primaryField]['internal']);
@ -452,7 +450,7 @@ class DataMapperAbstract implements DataMapperInterface
*
* @return void
*
* @throws
* @throws \Exception
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
@ -552,8 +550,6 @@ class DataMapperAbstract implements DataMapperInterface
*
* @return mixed
*
* @throws
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
@ -588,8 +584,6 @@ class DataMapperAbstract implements DataMapperInterface
*
* @return mixed
*
* @throws
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
@ -617,7 +611,7 @@ class DataMapperAbstract implements DataMapperInterface
/**
* Create relation table entry
*
* In cas of a many to many relation the relation has to be stored in a relation table
* In case of a many to many relation the relation has to be stored in a relation table
*
* @param string $propertyName Property name to initialize
* @param array $objsIds Object ids to insert
@ -625,15 +619,17 @@ class DataMapperAbstract implements DataMapperInterface
*
* @return mixed
*
* @throws
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
private static function createRelationTable(string $propertyName, array $objsIds, $objId)
{
/** @var string $table */
if (static::$hasMany[$propertyName]['table'] !== static::$table && static::$hasMany[$propertyName]['table'] !== static::$hasMany[$propertyName]['mapper']::$table) {
if (
!empty($objsIds)
&& static::$hasMany[$propertyName]['table'] !== static::$table
&& static::$hasMany[$propertyName]['table'] !== static::$hasMany[$propertyName]['mapper']::$table
) {
$relQuery = new Builder(self::$db);
$relQuery->prefix(self::$db->getPrefix())
->into(static::$hasMany[$propertyName]['table'])
@ -692,8 +688,6 @@ class DataMapperAbstract implements DataMapperInterface
*
* @return int
*
* @throws
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
@ -824,7 +818,7 @@ class DataMapperAbstract implements DataMapperInterface
}
$objects = $mapper::get($values);
$reflectionProperty->setValue($obj, $objects);
$reflectionProperty->setValue($obj, !is_array($objects) ? [$objects] : $objects);
if (!$accessible) {
$reflectionProperty->setAccessible(false);
@ -1152,7 +1146,7 @@ class DataMapperAbstract implements DataMapperInterface
{
$query = new Builder(self::$db);
$query->prefix(self::$db->getPrefix())
->random(static::$primaryKey)
->random(static::$primaryField)
->from(static::$table)
->limit($amount);
@ -1336,6 +1330,8 @@ class DataMapperAbstract implements DataMapperInterface
/**
* Get model based on request object
*
* @todo: change to graphql
*
* @param RequestAbstract $request Request object
*
* @return mixed

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -78,15 +78,15 @@ class DatabasePool
*
* @param mixed $key Database key
*
* @return ConnectionAbstract|false
* @return ConnectionAbstract|null
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function get(string $key = 'core')
public function get(string $key = 'core') /* : ?ConnectionAbstract */
{
if (!isset($this->pool[$key])) {
return false; /* todo: return nullconnection */
return null; /* todo: return nullconnection */
}
return $this->pool[$key];

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -32,10 +32,10 @@ use phpOMS\Datatypes\Enum;
*/
abstract class DatabaseStatus extends Enum
{
const OK = 0; /* Database connection successful */
const MISSING_DATABASE = 1; /* Couldn't find database */
const MISSING_TABLE = 2; /* One of the core tables couldn't be found */
const FAILURE = 3; /* Unknown failure */
const READONLY = 4; /* Database connection is in readonly (but ok) */
const CLOSED = 5; /* Database connection closed */
/* public */ const OK = 0; /* Database connection successful */
/* public */ const MISSING_DATABASE = 1; /* Couldn't find database */
/* public */ const MISSING_TABLE = 2; /* One of the core tables couldn't be found */
/* public */ const FAILURE = 3; /* Unknown failure */
/* public */ const READONLY = 4; /* Database connection is in readonly (but ok) */
/* public */ const CLOSED = 5; /* Database connection closed */
}

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -32,9 +32,9 @@ use phpOMS\Datatypes\Enum;
*/
abstract class DatabaseType extends Enum
{
const MYSQL = 0; /* MySQL */
const SQLITE = 1; /* SQLITE */
const PGSQL = 2; /* PostgreSQL */
const ORACLE = 3; /* Oracle */
const SQLSRV = 4; /* Microsoft SQL Server */
/* public */ const MYSQL = 0; /* MySQL */
/* public */ const SQLITE = 1; /* SQLITE */
/* public */ const PGSQL = 2; /* PostgreSQL */
/* public */ const ORACLE = 3; /* Oracle */
/* public */ const SQLSRV = 4; /* Microsoft SQL Server */
}

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -69,6 +69,12 @@ abstract class GrammarAbstract
*/
protected $or = 'OR';
/**
* Table prefix.
*
* @var string
* @since 1.0.0
*/
protected $tablePrefix = '';
/**
@ -78,8 +84,6 @@ abstract class GrammarAbstract
*
* @return string
*
* @throws
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
@ -97,19 +101,53 @@ abstract class GrammarAbstract
) . ';';
}
/**
* Compile query components.
*
* @param BuilderAbstract $query Builder
*
* @return array Parsed query components
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
abstract protected function compileComponents(BuilderAbstract $query) : array;
/**
* Get date format.
*
* @return string
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function getDateFormat() : string
{
return 'Y-m-d H:i:s';
}
/**
* Get table prefix.
*
* @return string
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function getTablePrefix() : string
{
return $this->tablePrefix;
}
public function setTablePrefix(string $prefix)
/**
* Set table prefix.
*
* @param string $prefix Table prefix
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function setTablePrefix(string $prefix) /* : void */
{
$this->tablePrefix = $prefix;
}

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -173,7 +173,7 @@ class Builder extends BuilderAbstract
* @var string[]
* @since 1.0.0
*/
const operators = [
/* public */ const operators = [
'=',
'<',
'>',
@ -226,7 +226,7 @@ class Builder extends BuilderAbstract
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function setConnection(ConnectionAbstract $connection)
public function setConnection(ConnectionAbstract $connection) /* : void */
{
$this->connection = $connection;
$this->grammar = $connection->getGrammar();
@ -429,7 +429,7 @@ class Builder extends BuilderAbstract
*
* @return Builder
*
* @throws
* @throws \InvalidArgumentException
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
@ -481,7 +481,7 @@ class Builder extends BuilderAbstract
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function andWhere(Where $where)
public function andWhere(Where $where) : Builder
{
$this->wheres[][] = [
'column' => $where,
@ -501,7 +501,7 @@ class Builder extends BuilderAbstract
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function orWhere(Where $where)
public function orWhere(Where $where) : Builder
{
$this->wheres[][] = [
'column' => $where,
@ -704,43 +704,103 @@ class Builder extends BuilderAbstract
return $this;
}
/**
* Lock query.
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function lock()
{
}
/**
* Lock for update query.
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function lockUpdate()
{
}
/**
* Create query string.
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function __toString()
{
return $this->grammar->compileQuery($this);
}
/**
* Find query.
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function find()
{
}
/**
* Count results.
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function count()
{
}
/**
* Check if exists.
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function exists()
{
}
/**
* Select minimum.
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function min()
{
}
/**
* Select maximum.
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function max()
{
}
/**
* Select sum.
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function sum()
{
}
/**
* Select average.
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function avg()
{
}
@ -821,6 +881,16 @@ class Builder extends BuilderAbstract
return $this;
}
/**
* Update columns.
*
* @param array $columns Column names to update
*
* @return Builder
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function update(...$columns) : Builder
{
$this->type = QueryType::UPDATE;
@ -832,44 +902,106 @@ class Builder extends BuilderAbstract
return $this;
}
/**
* Increment value.
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function increment()
{
}
/**
* Decrement value.
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function decrement()
{
}
/**
* Join.
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function join($table1, $table2, $column1, $opperator, $column2)
{
return $this;
}
/**
* Join where.
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function joinWhere()
{
}
/**
* Left join.
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function leftJoin()
{
}
/**
* Left join where.
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function leftJoinWhere()
{
}
/**
* Right join.
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function rightJoin()
{
}
/**
* Right join where.
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function rightJoinWhere()
{
}
/**
* Rollback.
*
* @return Builder
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function rollback()
{
return $this;
}
/**
* On.
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function on()
{
@ -892,6 +1024,14 @@ class Builder extends BuilderAbstract
return clone($this);
}
/**
* Execute query.
*
* @return mixed
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function execute()
{
$sth = $this->connection->con->prepare($this->toSql());

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -64,7 +64,7 @@ class Column
return $this->column;
}
public function setColumn(string $column)
public function setColumn(string $column) /* : void */
{
$this->column = $column;
}

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -98,7 +98,7 @@ class Grammar extends GrammarAbstract
*
* @return string[]
*
* @throws
* @throws \InvalidArgumentException
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
@ -214,6 +214,18 @@ class Grammar extends GrammarAbstract
return 'WHERE ' . $expression;
}
/**
* Compile where element.
*
* @param array $element Element data
* @param Builder $query Query builder
* @param bool $first Is first element (usefull for nesting)
*
* @return string
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
protected function compileWhereElement(array $element, Builder $query, bool $first = true) : string
{
$expression = '';
@ -265,6 +277,9 @@ class Grammar extends GrammarAbstract
return $value;
}
// todo: fix for injection
// todo: implement binding
return $this->valueQuotes . $value . $this->valueQuotes;
} elseif (is_int($value)) {
return $value;

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -30,15 +30,15 @@ use phpOMS\Datatypes\Enum;
*/
abstract class JoinType extends Enum
{
const JOIN = 'JOIN';
const LEFT_JOIN = 'LEFT JOIN';
const LEFT_OUTER_JOIN = 'LEFT OUTER JOIN';
const LEFT_INNER_JOIN = 'LEFT INNER JOIN';
const RIGHT_JOIN = 'RIGHT JOIN';
const RIGHT_OUTER_JOIN = 'RIGHT OUTER JOIN';
const RIGHT_INNER_JOIN = 'RIGHT INNER JOIN';
const OUTER_JOIN = 'OUTER JOIN';
const INNER_JOIN = 'INNER JOIN';
const CROSS_JOIN = 'CROSS JOIN';
const FULL_OUTER_JOIN = 'FULL OUTER JOIN';
/* public */ const JOIN = 'JOIN';
/* public */ const LEFT_JOIN = 'LEFT JOIN';
/* public */ const LEFT_OUTER_JOIN = 'LEFT OUTER JOIN';
/* public */ const LEFT_INNER_JOIN = 'LEFT INNER JOIN';
/* public */ const RIGHT_JOIN = 'RIGHT JOIN';
/* public */ const RIGHT_OUTER_JOIN = 'RIGHT OUTER JOIN';
/* public */ const RIGHT_INNER_JOIN = 'RIGHT INNER JOIN';
/* public */ const OUTER_JOIN = 'OUTER JOIN';
/* public */ const INNER_JOIN = 'INNER JOIN';
/* public */ const CROSS_JOIN = 'CROSS JOIN';
/* public */ const FULL_OUTER_JOIN = 'FULL OUTER JOIN';
}

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -30,10 +30,10 @@ use phpOMS\Datatypes\Enum;
*/
abstract class QueryType extends Enum
{
const SELECT = 0;
const INSERT = 1;
const UPDATE = 2;
const DELETE = 3;
const RANDOM = 4;
const RAW = 5;
/* public */ const SELECT = 0;
/* public */ const INSERT = 1;
/* public */ const UPDATE = 2;
/* public */ const DELETE = 3;
/* public */ const RANDOM = 4;
/* public */ const RAW = 5;
}

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -32,7 +32,7 @@ use phpOMS\Datatypes\Enum;
*/
abstract class RelationType extends Enum
{
const NONE = 0;
const NEWEST = 1;
const ALL = 2;
/* public */ const NONE = 0;
/* public */ const NEWEST = 1;
/* public */ const ALL = 2;
}

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -51,7 +51,7 @@ class Builder extends BuilderAbstract
$this->grammar = $connection->getSchemaGrammar();
}
public function select(...$table)
public function select(...$table) /* : void */
{
$this->type = QueryType::SELECT;
$this->table += $table;

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -32,8 +32,8 @@ use phpOMS\Datatypes\Enum;
*/
abstract class QueryType extends Enum
{
const SELECT = 0;
const CREATE = 1;
const DROP = 2;
const ALTER = 3;
/* public */ const SELECT = 0;
/* public */ const CREATE = 1;
/* public */ const DROP = 2;
/* public */ const ALTER = 3;
}

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -84,7 +84,7 @@ class ConsoleSession implements SessionInterface
/**
* {@inheritdoc}
*/
public function setSID($sid)
public function setSID($sid) /* : void */
{
$this->sid = $sid;
}

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -85,8 +85,6 @@ class HttpSession implements SessionInterface
$this->sid = session_id();
$this->setCsrfProtection();
self::$isLocked = true;
}
/**
@ -95,7 +93,7 @@ class HttpSession implements SessionInterface
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
private function setCsrfProtection()
private function setCsrfProtection() /* : void */
{
$this->set('UID', 0, false);
@ -129,12 +127,26 @@ class HttpSession implements SessionInterface
return $this->sessionData[$key] ?? null;
}
public static function lock()
/**
* Lock session from further adjustments.
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function lock()
{
self::$isLocked = true;
}
public static function isLocked()
/**
* Check if session is locked.
*
* @return bool Lock status
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function isLocked() : bool
{
return self::$isLocked;
}
@ -142,9 +154,12 @@ class HttpSession implements SessionInterface
/**
* {@inheritdoc}
*/
public function save()
public function save() /* : void */
{
if(!self::$isLocked) {
$_SESSION = $this->sessionData;
session_write_close();
}
}
/**
@ -172,15 +187,20 @@ class HttpSession implements SessionInterface
/**
* {@inheritdoc}
*/
public function setSID($sid)
public function setSID($sid) /* : void */
{
$this->sid = $sid;
}
/**
* Destruct session.
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function __destruct()
{
$_SESSION = $this->sessionData;
session_write_close();
$this->save();
}
}

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -79,7 +79,7 @@ interface SessionInterface
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function save();
public function save() /* : void */;
/**
* @return int|string
@ -97,6 +97,6 @@ interface SessionInterface
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function setSID($sid);
public function setSID($sid) /* : void */;
}

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -84,7 +84,7 @@ class SocketSession implements SessionInterface
/**
* {@inheritdoc}
*/
public function setSID($sid)
public function setSID($sid) /* : void */
{
$this->sid = $sid;
}
@ -92,7 +92,7 @@ class SocketSession implements SessionInterface
/**
* {@inheritdoc}
*/
public function save()
public function save() /* : void */
{
}

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -87,7 +87,7 @@ class Address implements \JsonSerializable
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function setRecipient(string $recipient)
public function setRecipient(string $recipient) /* : void */
{
$this->recipient = $recipient;
}
@ -115,7 +115,7 @@ class Address implements \JsonSerializable
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function setFAO(string $fao)
public function setFAO(string $fao) /* : void */
{
$this->fao = $fao;
}
@ -143,7 +143,7 @@ class Address implements \JsonSerializable
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function setLocation(Location $location)
public function setLocation(Location $location) /* : void */
{
$this->location = $location;
}

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -28,9 +28,9 @@ namespace phpOMS\Datatypes;
*/
abstract class AddressType extends Enum
{
const HOME = 1;
const BUSINESS = 2;
const SHIPPING = 3;
const BILLING = 4;
const WORK = 5;
/* public */ const HOME = 1;
/* public */ const BUSINESS = 2;
/* public */ const SHIPPING = 3;
/* public */ const BILLING = 4;
/* public */ const WORK = 5;
}

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -20,7 +20,7 @@ class ExactFloat
private static $length = 0;
public static function setLength($length)
public static function setLength($length) /* : void */
{
self::$length = (int) $length;
}

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -63,7 +63,7 @@ class Iban implements \Serializable
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
private function parse(string $iban)
private function parse(string $iban) /* : void */
{
$this->iban = self::normalize($iban);

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -106,7 +106,7 @@ class Location implements \JsonSerializable, \Serializable
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function setPostal(string $postal)
public function setPostal(string $postal) /* : void */
{
$this->postal = $postal;
}
@ -130,7 +130,7 @@ class Location implements \JsonSerializable, \Serializable
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function setCity(string $city)
public function setCity(string $city) /* : void */
{
$this->city = $city;
}
@ -154,7 +154,7 @@ class Location implements \JsonSerializable, \Serializable
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function setCountry(string $country)
public function setCountry(string $country) /* : void */
{
$this->country = $country;
}
@ -178,7 +178,7 @@ class Location implements \JsonSerializable, \Serializable
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function setAddress(string $address)
public function setAddress(string $address) /* : void */
{
$this->address = $address;
}
@ -202,7 +202,7 @@ class Location implements \JsonSerializable, \Serializable
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function setState(string $state)
public function setState(string $state) /* : void */
{
$this->state = $state;
}
@ -226,7 +226,7 @@ class Location implements \JsonSerializable, \Serializable
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function setGeo(array $geo)
public function setGeo(array $geo) /* : void */
{
$this->geo = $geo;
}

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -28,8 +28,8 @@ namespace phpOMS\Datatypes;
*/
abstract class PhoneType extends Enum
{
const HOME = 1;
const BUSINESS = 2;
const MOBILE = 3;
const WORK = 4;
/* public */ const HOME = 1;
/* public */ const BUSINESS = 2;
/* public */ const MOBILE = 3;
/* public */ const WORK = 4;
}

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -36,7 +36,7 @@ class SmartDateTime extends \DateTime
* @var string
* @since 1.0.0
*/
const FORMAT = 'Y-m-d hh:mm:ss';
/* public */ const FORMAT = 'Y-m-d hh:mm:ss';
/**
* Default timezone
@ -44,7 +44,7 @@ class SmartDateTime extends \DateTime
* @var string
* @since 1.0.0
*/
const TIMEZONE = 'UTC';
/* public */ const TIMEZONE = 'UTC';
/**
* {@inheritdoc}
@ -90,7 +90,7 @@ class SmartDateTime extends \DateTime
*/
public function smartModify(int $y, int $m = 0, int $d = 0, int $calendar = CAL_GREGORIAN) : SmartDateTime
{
$y_change = floor(((int) $this->format('m') - 1 + $m) / 12);
$y_change = (int) floor(((int) $this->format('m') - 1 + $m) / 12);
$y_change = ((int) $this->format('m') - 1 + $m) < 0 && ((int) $this->format('m') - 1 + $m) % 12 === 0 ? $y_change - 1 : $y_change;
$y_new = (int) $this->format('Y') + $y + $y_change;
$m_new = ((int) $this->format('m') + $m) % 12;

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -75,7 +75,7 @@ class EventManager implements Mediator
/**
* {@inheritdoc}
*/
public function trigger(string $group, string $id = '')
public function trigger(string $group, string $id = '', bool $reset = false) /* : void */
{
if (isset($this->groups[$group])) {
unset($this->groups[$group][$id]);
@ -117,7 +117,7 @@ class EventManager implements Mediator
/**
* {@inheritdoc}
*/
public function addGroup(string $group, string $id)
public function addGroup(string $group, string $id) /* : void */
{
if (!isset($this->groups[$group])) {
$this->groups[$group] = [];

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.0
* PHP Version 7.1
*
* @category TBD
* @package TBD
@ -30,13 +30,13 @@ use phpOMS\Datatypes\Enum;
*/
abstract class TagType extends Enum
{
const INPUT = 0; /* <input> */
const BUTTON = 1; /* <button> */
const LINK = 2; /* <a> */
const SYMMETRIC = 3; /* <span><div>... */
const TEXTAREA = 4; /* <textarea> */
const SELECT = 5; /* <select> */
const LABEL = 6; /* <label> */
const ULIST = 7; /* <ul> */
const OLIST = 8; /* <ul> */
/* public */ const INPUT = 0; /* <input> */
/* public */ const BUTTON = 1; /* <button> */
/* public */ const LINK = 2; /* <a> */
/* public */ const SYMMETRIC = 3; /* <span><div>... */
/* public */ const TEXTAREA = 4; /* <textarea> */
/* public */ const SELECT = 5; /* <select> */
/* public */ const LABEL = 6; /* <label> */
/* public */ const ULIST = 7; /* <ul> */
/* public */ const OLIST = 8; /* <ul> */
}

View File

@ -14,7 +14,7 @@
"light": "g",
"medium": "kg",
"heavy": "t",
"very_heavy": "t",
"very_heavy": "t"
},
"speed": {
"very_slow": "ms",
@ -56,6 +56,6 @@
"short": "m.y",
"medium": "d.m.Y",
"long": "d.m.Y h:i",
"very_long": "d.m.Y h:i:s",
"very_long": "d.m.Y h:i:s"
}
}

Some files were not shown because too many files have changed in this diff Show More