mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 09:48:40 +00:00
Remove namespace from scalar
This commit is contained in:
parent
7238e2cff1
commit
97687422eb
|
|
@ -36,7 +36,7 @@ class Account
|
|||
/**
|
||||
* Id.
|
||||
*
|
||||
* @var \int
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $id = 0;
|
||||
|
|
@ -44,7 +44,7 @@ class Account
|
|||
/**
|
||||
* Names.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $name1 = '';
|
||||
|
|
@ -52,7 +52,7 @@ class Account
|
|||
/**
|
||||
* Names.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $name2 = '';
|
||||
|
|
@ -60,7 +60,7 @@ class Account
|
|||
/**
|
||||
* Names.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $name3 = '';
|
||||
|
|
@ -68,7 +68,7 @@ class Account
|
|||
/**
|
||||
* Email.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $email = '';
|
||||
|
|
@ -78,7 +78,7 @@ class Account
|
|||
*
|
||||
* Used in order to make sure ips don't change
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $origin = '';
|
||||
|
|
@ -86,7 +86,7 @@ class Account
|
|||
/**
|
||||
* Login.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $login = '';
|
||||
|
|
@ -118,7 +118,7 @@ class Account
|
|||
/**
|
||||
* Groups.
|
||||
*
|
||||
* @var \int[]
|
||||
* @var int[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $groups = [];
|
||||
|
|
@ -160,12 +160,12 @@ class Account
|
|||
/**
|
||||
* Get account id.
|
||||
*
|
||||
* @return \int Account id
|
||||
* @return int Account id
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getId() : \int
|
||||
public function getId() : int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
|
@ -201,12 +201,12 @@ class Account
|
|||
/**
|
||||
* Get name1.
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getName1() : \string
|
||||
public function getName1() : string
|
||||
{
|
||||
return $this->name1;
|
||||
}
|
||||
|
|
@ -214,12 +214,12 @@ class Account
|
|||
/**
|
||||
* Get name2.
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getName2() : \string
|
||||
public function getName2() : string
|
||||
{
|
||||
return $this->name2;
|
||||
}
|
||||
|
|
@ -227,12 +227,12 @@ class Account
|
|||
/**
|
||||
* Get name3.
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getName3() : \string
|
||||
public function getName3() : string
|
||||
{
|
||||
return $this->name3;
|
||||
}
|
||||
|
|
@ -240,12 +240,12 @@ class Account
|
|||
/**
|
||||
* Get email.
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getEmail() : \string
|
||||
public function getEmail() : string
|
||||
{
|
||||
return $this->email;
|
||||
}
|
||||
|
|
@ -255,12 +255,12 @@ class Account
|
|||
*
|
||||
* AccountStatus
|
||||
*
|
||||
* @return \int
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getStatus() : \int
|
||||
public function getStatus() : int
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
|
@ -270,12 +270,12 @@ class Account
|
|||
*
|
||||
* AccountType
|
||||
*
|
||||
* @return \int
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getType() : \int
|
||||
public function getType() : int
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
|
@ -309,14 +309,14 @@ class Account
|
|||
/**
|
||||
* Set name1.
|
||||
*
|
||||
* @param \string $name Name
|
||||
* @param string $name Name
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setName1(\string $name)
|
||||
public function setName1(string $name)
|
||||
{
|
||||
$this->name1 = $name;
|
||||
}
|
||||
|
|
@ -324,14 +324,14 @@ class Account
|
|||
/**
|
||||
* Set name2.
|
||||
*
|
||||
* @param \string $name Name
|
||||
* @param string $name Name
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setName2(\string $name)
|
||||
public function setName2(string $name)
|
||||
{
|
||||
$this->name2 = $name;
|
||||
}
|
||||
|
|
@ -339,14 +339,14 @@ class Account
|
|||
/**
|
||||
* Set name3.
|
||||
*
|
||||
* @param \string $name Name
|
||||
* @param string $name Name
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setName3(\string $name)
|
||||
public function setName3(string $name)
|
||||
{
|
||||
$this->name3 = $name;
|
||||
}
|
||||
|
|
@ -354,14 +354,14 @@ class Account
|
|||
/**
|
||||
* Set email.
|
||||
*
|
||||
* @param \string $email Email
|
||||
* @param string $email Email
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setEmail(\string $email)
|
||||
public function setEmail(string $email)
|
||||
{
|
||||
if(!Email::isValid($email)) {
|
||||
throw new \InvalidArgumentException();
|
||||
|
|
@ -373,14 +373,14 @@ class Account
|
|||
/**
|
||||
* Get status.
|
||||
*
|
||||
* @param \int $status Status
|
||||
* @param int $status Status
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setStatus(\int $status)
|
||||
public function setStatus(int $status)
|
||||
{
|
||||
if(!AccountStatus::isValidValue($status)) {
|
||||
throw new \InvalidArgumentException();
|
||||
|
|
@ -392,14 +392,14 @@ class Account
|
|||
/**
|
||||
* Get type.
|
||||
*
|
||||
* @param \int $type Type
|
||||
* @param int $type Type
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setType(\int $type)
|
||||
public function setType(int $type)
|
||||
{
|
||||
if(!AccountType::isValidValue($type)) {
|
||||
throw new \InvalidArgumentException();
|
||||
|
|
|
|||
|
|
@ -50,14 +50,14 @@ class AccountManager
|
|||
/**
|
||||
* Get account.
|
||||
*
|
||||
* @param \int $id Account id
|
||||
* @param int $id Account id
|
||||
*
|
||||
* @return Account
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function get(\int $id) : Account
|
||||
public function get(int $id) : Account
|
||||
{
|
||||
return $this->accounts[$id] ?? new NullAccount();
|
||||
}
|
||||
|
|
@ -67,7 +67,7 @@ class AccountManager
|
|||
*
|
||||
* @param Account $account Account
|
||||
*
|
||||
* @return \int Account id
|
||||
* @return int Account id
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class Group
|
|||
/**
|
||||
* Account id.
|
||||
*
|
||||
* @var \int
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $id = 0;
|
||||
|
|
@ -40,7 +40,7 @@ class Group
|
|||
/**
|
||||
* Account name.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $name = '';
|
||||
|
|
@ -48,7 +48,7 @@ class Group
|
|||
/**
|
||||
* Account name.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $description = '';
|
||||
|
|
@ -56,7 +56,7 @@ class Group
|
|||
/**
|
||||
* Account name.
|
||||
*
|
||||
* @var \int
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $members = [];
|
||||
|
|
@ -64,7 +64,7 @@ class Group
|
|||
/**
|
||||
* Parents .
|
||||
*
|
||||
* @var \int[]
|
||||
* @var int[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $parents = [];
|
||||
|
|
@ -72,7 +72,7 @@ class Group
|
|||
/**
|
||||
* Permissions.
|
||||
*
|
||||
* @var \int[]
|
||||
* @var int[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $permissions = [];
|
||||
|
|
@ -90,12 +90,12 @@ class Group
|
|||
/**
|
||||
* Get group id.
|
||||
*
|
||||
* @return \int
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getId() : \int
|
||||
public function getId() : int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
|
@ -103,12 +103,12 @@ class Group
|
|||
/**
|
||||
* Get group name.
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getName() : \string
|
||||
public function getName() : string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
|
@ -116,12 +116,12 @@ class Group
|
|||
/**
|
||||
* Get group description.
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getDescription() : \string
|
||||
public function getDescription() : string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
|
@ -129,12 +129,12 @@ class Group
|
|||
/**
|
||||
* Set group name.
|
||||
*
|
||||
* @param \string $name Group name
|
||||
* @param string $name Group name
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setName(\string $name)
|
||||
public function setName(string $name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
|
@ -142,12 +142,12 @@ class Group
|
|||
/**
|
||||
* Set group description.
|
||||
*
|
||||
* @param \string $description Group description
|
||||
* @param string $description Group description
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setDescription(\string $description)
|
||||
public function setDescription(string $description)
|
||||
{
|
||||
$this->description = $description;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,16 +52,16 @@ class AssetManager implements \Countable
|
|||
/**
|
||||
* Add asset.
|
||||
*
|
||||
* @param \string $id Asset id
|
||||
* @param \string $asset Asset
|
||||
* @param \bool $overwrite Overwrite
|
||||
* @param string $id Asset id
|
||||
* @param string $asset Asset
|
||||
* @param bool $overwrite Overwrite
|
||||
*
|
||||
* @return \bool
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function set(\string $id, \string $asset, \bool $overwrite = true) : \bool
|
||||
public function set(string $id, string $asset, bool $overwrite = true) : bool
|
||||
{
|
||||
if ($overwrite || !isset($this->assets[$id])) {
|
||||
$this->assets[$id] = $asset;
|
||||
|
|
@ -75,14 +75,14 @@ class AssetManager implements \Countable
|
|||
/**
|
||||
* Remove asset.
|
||||
*
|
||||
* @param \string $id Asset id
|
||||
* @param string $id Asset id
|
||||
*
|
||||
* @return \bool
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function remove(\string $id) : \bool
|
||||
public function remove(string $id) : bool
|
||||
{
|
||||
if (isset($this->assets[$id])) {
|
||||
unset($this->assets[$id]);
|
||||
|
|
@ -96,14 +96,14 @@ class AssetManager implements \Countable
|
|||
/**
|
||||
* Get asset.
|
||||
*
|
||||
* @param \string $id Asset id
|
||||
* @param string $id Asset id
|
||||
*
|
||||
* @return mixed Asset
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function get(\string $id)
|
||||
public function get(string $id)
|
||||
{
|
||||
if (isset($this->assets[$id])) {
|
||||
return $this->assets[$id];
|
||||
|
|
@ -120,7 +120,7 @@ class AssetManager implements \Countable
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function count() : \int
|
||||
public function count() : int
|
||||
{
|
||||
return count($this->assets);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,12 +68,12 @@ class Auth
|
|||
/**
|
||||
* Authenticates user.
|
||||
*
|
||||
* @return \bool
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function authenticate() : \bool
|
||||
public function authenticate() : bool
|
||||
{
|
||||
$uid = $this->session->get('UID');
|
||||
|
||||
|
|
@ -87,15 +87,15 @@ class Auth
|
|||
/**
|
||||
* Login user.
|
||||
*
|
||||
* @param \string $login Username
|
||||
* @param \string $password Password
|
||||
* @param string $login Username
|
||||
* @param string $password Password
|
||||
*
|
||||
* @return \int Login code
|
||||
* @return int Login code
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function login(\string $login, \string $password) : \int
|
||||
public function login(string $login, string $password) : int
|
||||
{
|
||||
try {
|
||||
$result = null;
|
||||
|
|
@ -146,14 +146,14 @@ class Auth
|
|||
/**
|
||||
* Logout the given user.
|
||||
*
|
||||
* @param \int $uid User ID
|
||||
* @param int $uid User ID
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function logout(\int $uid = null)
|
||||
public function logout(int $uid = null)
|
||||
{
|
||||
// TODO: logout other users? If admin wants to kick a user for updates etc.
|
||||
$this->session->remove('UID');
|
||||
|
|
|
|||
|
|
@ -35,14 +35,14 @@ class Autoloader
|
|||
/**
|
||||
* Loading classes by namespace + class name.
|
||||
*
|
||||
* @param \string $class Class path
|
||||
* @param string $class Class path
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @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)
|
||||
{
|
||||
if (($class = self::exists($class)) !== false) {
|
||||
/** @noinspection PhpIncludeInspection */
|
||||
|
|
@ -53,14 +53,14 @@ class Autoloader
|
|||
/**
|
||||
* Check if class exists.
|
||||
*
|
||||
* @param \string $class Class path
|
||||
* @param string $class Class path
|
||||
*
|
||||
* @return false|string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function exists(\string $class)
|
||||
public static function exists(string $class)
|
||||
{
|
||||
$class = ltrim($class, '\\');
|
||||
$class = str_replace(['_', '\\'], DIRECTORY_SEPARATOR, $class);
|
||||
|
|
|
|||
|
|
@ -46,27 +46,27 @@ interface OptionsInterface
|
|||
*
|
||||
* @param mixed $key Unique option key
|
||||
* @param mixed $value Option value
|
||||
* @param \bool $overwrite Overwrite existing value
|
||||
* @param bool $overwrite Overwrite existing value
|
||||
*
|
||||
* @return \bool
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setOption($key, $value, \bool $overwrite = true) : \bool;
|
||||
public function setOption($key, $value, bool $overwrite = true) : bool;
|
||||
|
||||
/**
|
||||
* Updating or adding settings.
|
||||
*
|
||||
* @param array $pair Key value pair
|
||||
* @param \bool $overwrite Overwrite existing value
|
||||
* @param bool $overwrite Overwrite existing value
|
||||
*
|
||||
* @return \bool
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setOptions(array $pair, \bool $overwrite = true) : \bool;
|
||||
public function setOptions(array $pair, bool $overwrite = true) : bool;
|
||||
|
||||
/**
|
||||
* Get option by key.
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ trait OptionsTrait
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setOption($key, $value, \bool $overwrite = true) : \bool
|
||||
public function setOption($key, $value, bool $overwrite = true) : bool
|
||||
{
|
||||
if ($overwrite || !array_key_exists($key, $this->options)) {
|
||||
$this->options[$key] = $value;
|
||||
|
|
@ -66,7 +66,7 @@ trait OptionsTrait
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setOptions(array $pair, \bool $overwrite = true) : \bool
|
||||
public function setOptions(array $pair, bool $overwrite = true) : bool
|
||||
{
|
||||
if ($overwrite) {
|
||||
$this->options += $pair;
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ abstract class SettingsAbstract implements OptionsInterface
|
|||
/**
|
||||
* Settings table.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $table = null;
|
||||
|
|
@ -63,7 +63,7 @@ abstract class SettingsAbstract implements OptionsInterface
|
|||
/**
|
||||
* Columns to identify the value.
|
||||
*
|
||||
* @var \string[]
|
||||
* @var string[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $columns = [
|
||||
|
|
@ -73,7 +73,7 @@ abstract class SettingsAbstract implements OptionsInterface
|
|||
/**
|
||||
* Field where the actual value is stored.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $valueField = 'option';
|
||||
|
|
@ -81,7 +81,7 @@ abstract class SettingsAbstract implements OptionsInterface
|
|||
/**
|
||||
* Get option by key.
|
||||
*
|
||||
* @param \string[] $columns Column values for filtering
|
||||
* @param string[] $columns Column values for filtering
|
||||
*
|
||||
* @return mixed Option value
|
||||
*
|
||||
|
|
@ -114,15 +114,15 @@ abstract class SettingsAbstract implements OptionsInterface
|
|||
/**
|
||||
* Set option by key.
|
||||
*
|
||||
* @param \string[] $options Column values for filtering
|
||||
* @param \bool $store Save this Setting immediately to database
|
||||
* @param string[] $options Column values for filtering
|
||||
* @param bool $store Save this Setting immediately to database
|
||||
*
|
||||
* @return mixed Option value
|
||||
*
|
||||
* @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)
|
||||
{
|
||||
$this->setOptions($options);
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class CommandManager implements \Countable
|
|||
/**
|
||||
* Commands.
|
||||
*
|
||||
* @var \int
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $count = 0;
|
||||
|
|
@ -56,17 +56,17 @@ class CommandManager implements \Countable
|
|||
/**
|
||||
* Attach new command.
|
||||
*
|
||||
* @param \string $cmd Command ID
|
||||
* @param string $cmd Command ID
|
||||
* @param mixed $callback Function callback
|
||||
* @param mixed $source Provider
|
||||
* @param \bool $overwrite Overwrite existing
|
||||
* @param bool $overwrite Overwrite existing
|
||||
*
|
||||
* @return \bool
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public function attach(\string $cmd, $callback, $source, \bool $overwrite = true) : \bool
|
||||
public function attach(string $cmd, $callback, $source, bool $overwrite = true) : bool
|
||||
{
|
||||
if ($overwrite || !isset($this->commands[$cmd])) {
|
||||
$this->commands[$cmd] = [$callback, $source];
|
||||
|
|
@ -81,15 +81,15 @@ class CommandManager implements \Countable
|
|||
/**
|
||||
* Detach existing command.
|
||||
*
|
||||
* @param \string $cmd Command ID
|
||||
* @param string $cmd Command ID
|
||||
* @param mixed $source Provider
|
||||
*
|
||||
* @return \bool
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public function detach(\string $cmd, $source) : \bool
|
||||
public function detach(string $cmd, $source) : bool
|
||||
{
|
||||
if (array_key_exists($cmd, $this->commands)) {
|
||||
unset($this->commands[$cmd]);
|
||||
|
|
@ -104,7 +104,7 @@ class CommandManager implements \Countable
|
|||
/**
|
||||
* Trigger command.
|
||||
*
|
||||
* @param \string $cmd Command ID
|
||||
* @param string $cmd Command ID
|
||||
* @param mixed $para Parameters to pass
|
||||
*
|
||||
* @return mixed|bool
|
||||
|
|
@ -112,7 +112,7 @@ class CommandManager implements \Countable
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public function trigger(\string $cmd, $para)
|
||||
public function trigger(string $cmd, $para)
|
||||
{
|
||||
if (array_key_exists($cmd, $this->commands)) {
|
||||
return $this->commands[$cmd][0]($para);
|
||||
|
|
@ -124,12 +124,12 @@ class CommandManager implements \Countable
|
|||
/**
|
||||
* Count commands.
|
||||
*
|
||||
* @return \int
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public function count() : \int
|
||||
public function count() : int
|
||||
{
|
||||
return $this->count;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,13 +34,13 @@ interface JsonableInterface extends ArrayableInterface
|
|||
/**
|
||||
* Convert the object to its JSON representation.
|
||||
*
|
||||
* @param \int $options
|
||||
* @param int $options
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function toJson(\int $options = 0) : \string;
|
||||
public function toJson(int $options = 0) : string;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@ interface RenderableInterface
|
|||
/**
|
||||
* Get the evaluated contents of the object.
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function render() : \string;
|
||||
public function render() : string;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,14 +35,14 @@ interface CacheInterface
|
|||
* @param mixed $key Unique cache key
|
||||
* @param mixed $value Cache value
|
||||
* @param CacheStatus $type Cache type
|
||||
* @param \int $expire Valid duration (in s)
|
||||
* @param int $expire Valid duration (in s)
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function set($key, $value, CacheStatus $type = null, \int $expire = 2592000);
|
||||
public function set($key, $value, CacheStatus $type = null, int $expire = 2592000);
|
||||
|
||||
/**
|
||||
* Adding new data if it doesn't exist.
|
||||
|
|
@ -50,14 +50,14 @@ interface CacheInterface
|
|||
* @param mixed $key Unique cache key
|
||||
* @param mixed $value Cache value
|
||||
* @param CacheStatus $type Cache type
|
||||
* @param \int $expire Valid duration (in s)
|
||||
* @param int $expire Valid duration (in s)
|
||||
*
|
||||
* @return \bool
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function add($key, $value, CacheStatus $type = null, \int $expire = 2592000) : \bool;
|
||||
public function add($key, $value, CacheStatus $type = null, int $expire = 2592000) : bool;
|
||||
|
||||
/**
|
||||
* Get cache by key.
|
||||
|
|
@ -78,12 +78,12 @@ interface CacheInterface
|
|||
* @param mixed $key Unique cache key
|
||||
* @param CacheStatus $type Cache status/type
|
||||
*
|
||||
* @return \bool
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function delete($key, CacheStatus $type = null) : \bool;
|
||||
public function delete($key, CacheStatus $type = null) : bool;
|
||||
|
||||
/**
|
||||
* Removing all elements from cache (invalidate cache).
|
||||
|
|
@ -103,14 +103,14 @@ interface CacheInterface
|
|||
* @param mixed $key Unique cache key
|
||||
* @param mixed $value Cache value
|
||||
* @param CacheType $type Cache type
|
||||
* @param \int $expire Timestamp
|
||||
* @param int $expire Timestamp
|
||||
*
|
||||
* @return \bool
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function replace($key, $value, CacheType $type = null, \int $expire = -1) : \bool;
|
||||
public function replace($key, $value, CacheType $type = null, int $expire = -1) : bool;
|
||||
|
||||
/**
|
||||
* Requesting cache stats.
|
||||
|
|
@ -125,11 +125,11 @@ interface CacheInterface
|
|||
/**
|
||||
* Get the threshold required to cache data using this cache.
|
||||
*
|
||||
* @return \int Storage threshold
|
||||
* @return int Storage threshold
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getThreshold() : \int;
|
||||
public function getThreshold() : int;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class FileCache implements CacheInterface
|
|||
/**
|
||||
* Cache path.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
const CACHE_PATH = __DIR__ . '/../../../Cache';
|
||||
|
|
@ -44,7 +44,7 @@ class FileCache implements CacheInterface
|
|||
/**
|
||||
* Only cache if data is larger than threshold (0-100).
|
||||
*
|
||||
* @var \int
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $threshold = 50;
|
||||
|
|
@ -52,14 +52,14 @@ class FileCache implements CacheInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function set($key, $value, CacheStatus $type = null, \int $expire = 2592000)
|
||||
public function set($key, $value, CacheStatus $type = null, int $expire = 2592000)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function add($key, $value, CacheStatus $type = null, \int $expire = 2592000)
|
||||
public function add($key, $value, CacheStatus $type = null, int $expire = 2592000)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ class FileCache implements CacheInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function replace($key, $value, CacheType $type = null, \int $expire = -1)
|
||||
public function replace($key, $value, CacheType $type = null, int $expire = -1)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -108,7 +108,7 @@ class FileCache implements CacheInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getThreshold() : \int
|
||||
public function getThreshold() : int
|
||||
{
|
||||
return $this->threshold;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class MemCache implements CacheInterface
|
|||
/**
|
||||
* Only cache if data is larger than threshold (0-100).
|
||||
*
|
||||
* @var \int
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $threshold = 10;
|
||||
|
|
@ -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, CacheStatus $type = null, int $expire = 2592000)
|
||||
{
|
||||
$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)
|
||||
public function add($key, $value, CacheStatus $type = null, int $expire = 2592000)
|
||||
{
|
||||
return $this->memc->add($key, $value, false, $expire);
|
||||
}
|
||||
|
|
@ -114,7 +114,7 @@ class MemCache implements CacheInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function replace($key, $value, CacheType $type = null, \int $expire = -1)
|
||||
public function replace($key, $value, CacheType $type = null, int $expire = -1)
|
||||
{
|
||||
$this->memc->replace($key, $value, false, $expire);
|
||||
}
|
||||
|
|
@ -130,7 +130,7 @@ class MemCache implements CacheInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getThreshold() : \int
|
||||
public function getThreshold() : int
|
||||
{
|
||||
return $this->threshold;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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, CacheStatus $type = null, int $expire = 2592000)
|
||||
{
|
||||
// TODO: Implement set() method.
|
||||
}
|
||||
|
|
@ -40,7 +40,7 @@ class NullCache implements CacheInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function add($key, $value, CacheStatus $type = null, \int $expire = 2592000)
|
||||
public function add($key, $value, CacheStatus $type = null, int $expire = 2592000)
|
||||
{
|
||||
// TODO: Implement add() method.
|
||||
}
|
||||
|
|
@ -72,7 +72,7 @@ class NullCache implements CacheInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function replace($key, $value, CacheType $type = null, \int $expire = -1)
|
||||
public function replace($key, $value, CacheType $type = null, int $expire = -1)
|
||||
{
|
||||
// TODO: Implement replace() method.
|
||||
}
|
||||
|
|
@ -88,7 +88,7 @@ class NullCache implements CacheInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getThreshold() : \int
|
||||
public function getThreshold() : int
|
||||
{
|
||||
// TODO: Implement getThreshold() method.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,14 +83,14 @@ class Pool implements OptionsInterface
|
|||
/**
|
||||
* Requesting caching instance.
|
||||
*
|
||||
* @param \int $type Cache to request
|
||||
* @param int $type Cache to request
|
||||
*
|
||||
* @return \phpOMS\DataStorage\Cache\MemCache|\phpOMS\DataStorage\Cache\FileCache|null
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function get(\int $type = null)
|
||||
public function get(int $type = null)
|
||||
{
|
||||
if (($type === null || $type === CacheStatus::MEMCACHE) && $this->memc !== null) {
|
||||
return $this->memc;
|
||||
|
|
@ -114,7 +114,7 @@ class Pool implements OptionsInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function add(\int $type, CacheInterface $cache)
|
||||
public function add(int $type, CacheInterface $cache)
|
||||
{
|
||||
if (($type === null || $type === CacheStatus::MEMCACHE) && $this->memc !== null) {
|
||||
$this->memc = $cache;
|
||||
|
|
|
|||
|
|
@ -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, CacheStatus $type = null, int $expire = 2592000)
|
||||
{
|
||||
// TODO: Implement set() method.
|
||||
}
|
||||
|
|
@ -42,7 +42,7 @@ class RedisCache implements CacheInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function add($key, $value, CacheStatus $type = null, \int $expire = 2592000)
|
||||
public function add($key, $value, CacheStatus $type = null, int $expire = 2592000)
|
||||
{
|
||||
// TODO: Implement add() method.
|
||||
}
|
||||
|
|
@ -74,7 +74,7 @@ class RedisCache implements CacheInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function replace($key, $value, CacheType $type = null, \int $expire = -1)
|
||||
public function replace($key, $value, CacheType $type = null, int $expire = -1)
|
||||
{
|
||||
// TODO: Implement replace() method.
|
||||
}
|
||||
|
|
@ -90,7 +90,7 @@ class RedisCache implements CacheInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getThreshold() : \int
|
||||
public function getThreshold() : int
|
||||
{
|
||||
// TODO: Implement getThreshold() method.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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, CacheStatus $type = null, int $expire = 2592000)
|
||||
{
|
||||
// TODO: Implement set() method.
|
||||
}
|
||||
|
|
@ -42,7 +42,7 @@ class WinCache implements CacheInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function add($key, $value, CacheStatus $type = null, \int $expire = 2592000)
|
||||
public function add($key, $value, CacheStatus $type = null, int $expire = 2592000)
|
||||
{
|
||||
// TODO: Implement add() method.
|
||||
}
|
||||
|
|
@ -74,7 +74,7 @@ class WinCache implements CacheInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function replace($key, $value, CacheType $type = null, \int $expire = -1)
|
||||
public function replace($key, $value, CacheType $type = null, int $expire = -1)
|
||||
{
|
||||
// TODO: Implement replace() method.
|
||||
}
|
||||
|
|
@ -90,7 +90,7 @@ class WinCache implements CacheInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getThreshold() : \int
|
||||
public function getThreshold() : int
|
||||
{
|
||||
// TODO: Implement getThreshold() method.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class CookieJar
|
|||
$this->cookies = $_COOKIE;
|
||||
}
|
||||
|
||||
public function set($id, $value, \int $expiry = 86400, $path = '/', $domain = null, \bool $secure = false, \bool $httponly = true, \bool $overwrite = true) : \bool
|
||||
public function set($id, $value, int $expiry = 86400, $path = '/', $domain = null, bool $secure = false, bool $httponly = true, bool $overwrite = true) : bool
|
||||
{
|
||||
if ($overwrite || !isset($this->cookies[$id])) {
|
||||
$this->cookies[$id] = [
|
||||
|
|
@ -51,7 +51,7 @@ class CookieJar
|
|||
return false;
|
||||
}
|
||||
|
||||
public function remove($id) : \bool
|
||||
public function remove($id) : bool
|
||||
{
|
||||
if (isset($this->cookies[$id])) {
|
||||
unset($this->cookies[$id]);
|
||||
|
|
@ -62,7 +62,7 @@ class CookieJar
|
|||
return false;
|
||||
}
|
||||
|
||||
public function delete($id) : \bool
|
||||
public function delete($id) : bool
|
||||
{
|
||||
$this->remove($id);
|
||||
setcookie($id, '', time() - 3600);
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ abstract class BuilderAbstract
|
|||
/**
|
||||
* Prefix.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $prefix = '';
|
||||
|
|
@ -59,14 +59,14 @@ abstract class BuilderAbstract
|
|||
/**
|
||||
* Set prefix.
|
||||
*
|
||||
* @param \string $prefix Prefix
|
||||
* @param string $prefix Prefix
|
||||
*
|
||||
* @return BuilderAbstract
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function prefix(\string $prefix)
|
||||
public function prefix(string $prefix)
|
||||
{
|
||||
$this->prefix = $prefix;
|
||||
|
||||
|
|
@ -76,12 +76,12 @@ abstract class BuilderAbstract
|
|||
/**
|
||||
* Get prefix.
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getPrefix() : \string
|
||||
public function getPrefix() : string
|
||||
{
|
||||
return $this->prefix;
|
||||
}
|
||||
|
|
@ -89,12 +89,12 @@ abstract class BuilderAbstract
|
|||
/**
|
||||
* Get query type.
|
||||
*
|
||||
* @return \int
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getType() : \int
|
||||
public function getType() : int
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ abstract class ConnectionAbstract implements ConnectionInterface
|
|||
*
|
||||
* The database prefix name for unique table names
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public $prefix = '';
|
||||
|
|
@ -59,7 +59,7 @@ abstract class ConnectionAbstract implements ConnectionInterface
|
|||
/**
|
||||
* Database data.
|
||||
*
|
||||
* @var \string[]
|
||||
* @var string[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $dbdata = null;
|
||||
|
|
@ -99,7 +99,7 @@ abstract class ConnectionAbstract implements ConnectionInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getType() : \int
|
||||
public function getType() : int
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
|
@ -107,7 +107,7 @@ abstract class ConnectionAbstract implements ConnectionInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getStatus() : \int
|
||||
public function getStatus() : int
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
|
@ -115,12 +115,12 @@ abstract class ConnectionAbstract implements ConnectionInterface
|
|||
/**
|
||||
* Get table prefix.
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getPrefix() : \string
|
||||
public function getPrefix() : string
|
||||
{
|
||||
return $this->prefix;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class ConnectionFactory
|
|||
*
|
||||
* Overwrites current connection if existing
|
||||
*
|
||||
* @param \string[] $dbdata the basic database information for establishing a connection
|
||||
* @param string[] $dbdata the basic database information for establishing a connection
|
||||
*
|
||||
* @return ConnectionInterface
|
||||
*
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ interface ConnectionInterface
|
|||
*
|
||||
* Overwrites current connection if existing
|
||||
*
|
||||
* @param \string[] $dbdata the basic database information for establishing a connection
|
||||
* @param string[] $dbdata the basic database information for establishing a connection
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
|
|
@ -49,22 +49,22 @@ interface ConnectionInterface
|
|||
/**
|
||||
* Get the database type.
|
||||
*
|
||||
* @return \int
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getType() : \int;
|
||||
public function getType() : int;
|
||||
|
||||
/**
|
||||
* Get the database status.
|
||||
*
|
||||
* @return \int
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getStatus() : \int;
|
||||
public function getStatus() : int;
|
||||
|
||||
/**
|
||||
* Close database connection.
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class MysqlConnection extends ConnectionAbstract
|
|||
*
|
||||
* Creates the database object and overwrites all default values.
|
||||
*
|
||||
* @param \string[] $dbdata the basic database information for establishing a connection
|
||||
* @param string[] $dbdata the basic database information for establishing a connection
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class SqliteConnection extends ConnectionAbstract
|
|||
*
|
||||
* Creates the database object and overwrites all default values.
|
||||
*
|
||||
* @param \string[] $dbdata the basic database information for establishing a connection
|
||||
* @param string[] $dbdata the basic database information for establishing a connection
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ abstract class DataMapperAbstract implements DataMapperInterface
|
|||
/**
|
||||
* Overwriting extended values.
|
||||
*
|
||||
* @var \bool
|
||||
* @var bool
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $overwrite = true;
|
||||
|
|
@ -54,7 +54,7 @@ abstract class DataMapperAbstract implements DataMapperInterface
|
|||
/**
|
||||
* Primary field name.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $primaryField = '';
|
||||
|
|
@ -62,7 +62,7 @@ abstract class DataMapperAbstract implements DataMapperInterface
|
|||
/**
|
||||
* Primary field name.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $createdAt = '';
|
||||
|
|
@ -78,7 +78,7 @@ abstract class DataMapperAbstract implements DataMapperInterface
|
|||
/**
|
||||
* Relations.
|
||||
*
|
||||
* @var \string[]
|
||||
* @var string[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $hasMany = [];
|
||||
|
|
@ -86,7 +86,7 @@ abstract class DataMapperAbstract implements DataMapperInterface
|
|||
/**
|
||||
* Relations.
|
||||
*
|
||||
* @var \string[]
|
||||
* @var string[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $ownsMany = [];
|
||||
|
|
@ -94,7 +94,7 @@ abstract class DataMapperAbstract implements DataMapperInterface
|
|||
/**
|
||||
* Relations.
|
||||
*
|
||||
* @var \string[]
|
||||
* @var string[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $hasOne = [];
|
||||
|
|
@ -102,7 +102,7 @@ abstract class DataMapperAbstract implements DataMapperInterface
|
|||
/**
|
||||
* Extending relations.
|
||||
*
|
||||
* @var \string[]
|
||||
* @var string[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $extends = [];
|
||||
|
|
@ -110,7 +110,7 @@ abstract class DataMapperAbstract implements DataMapperInterface
|
|||
/**
|
||||
* Relations.
|
||||
*
|
||||
* @var \string[]
|
||||
* @var string[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $ownsOne = [];
|
||||
|
|
@ -118,7 +118,7 @@ abstract class DataMapperAbstract implements DataMapperInterface
|
|||
/**
|
||||
* Table.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $table = '';
|
||||
|
|
@ -512,7 +512,7 @@ abstract class DataMapperAbstract implements DataMapperInterface
|
|||
*
|
||||
* This will fall back to the insert id if no datetime column is present.
|
||||
*
|
||||
* @param \int $limit Newest limit
|
||||
* @param int $limit Newest limit
|
||||
* @param Builder $query Pre-defined query
|
||||
*
|
||||
* @return mixed
|
||||
|
|
@ -520,7 +520,7 @@ abstract class DataMapperAbstract implements DataMapperInterface
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getNewest(\int $limit = 1, Builder $query = null)
|
||||
public function getNewest(int $limit = 1, Builder $query = null)
|
||||
{
|
||||
if (!isset(static::$createdAt) || !isset(static::$columns[static::$createdAt])) {
|
||||
throw new \BadMethodCallException('Method "' . __METHOD__ . '" is not supported.');
|
||||
|
|
@ -591,14 +591,14 @@ abstract class DataMapperAbstract implements DataMapperInterface
|
|||
* Get object.
|
||||
*
|
||||
* @param mixed $primaryKey Key
|
||||
* @param \bool $relations Load relations
|
||||
* @param bool $relations Load relations
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function get($primaryKey, \bool $relations = true)
|
||||
public function get($primaryKey, bool $relations = true)
|
||||
{
|
||||
$obj = [];
|
||||
if (is_array($primaryKey)) {
|
||||
|
|
@ -740,12 +740,12 @@ abstract class DataMapperAbstract implements DataMapperInterface
|
|||
/**
|
||||
* Get primary field.
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getPrimaryField() : \string
|
||||
public function getPrimaryField() : string
|
||||
{
|
||||
return static::$primaryField;
|
||||
}
|
||||
|
|
@ -753,12 +753,12 @@ abstract class DataMapperAbstract implements DataMapperInterface
|
|||
/**
|
||||
* Get main table.
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getTable() : \string
|
||||
public function getTable() : string
|
||||
{
|
||||
return static::$table;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ abstract class GrammarAbstract
|
|||
/**
|
||||
* Comment style.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $comment = '--';
|
||||
|
|
@ -29,7 +29,7 @@ abstract class GrammarAbstract
|
|||
/**
|
||||
* String quotes style.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $valueQuotes = '\'';
|
||||
|
|
@ -37,7 +37,7 @@ abstract class GrammarAbstract
|
|||
/**
|
||||
* System identifier.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $systemIdentifier = '"';
|
||||
|
|
@ -45,7 +45,7 @@ abstract class GrammarAbstract
|
|||
/**
|
||||
* And operator.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $and = 'AND';
|
||||
|
|
@ -53,7 +53,7 @@ abstract class GrammarAbstract
|
|||
/**
|
||||
* Or operator.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $or = 'OR';
|
||||
|
|
@ -65,14 +65,14 @@ abstract class GrammarAbstract
|
|||
*
|
||||
* @param BuilderAbstract $query Builder
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @throws
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function compileQuery(BuilderAbstract $query) : \string
|
||||
public function compileQuery(BuilderAbstract $query) : string
|
||||
{
|
||||
return trim(
|
||||
implode(' ',
|
||||
|
|
@ -92,14 +92,14 @@ abstract class GrammarAbstract
|
|||
* Expressionize elements.
|
||||
*
|
||||
* @param array $elements Elements
|
||||
* @param \string $prefix Prefix for table
|
||||
* @param string $prefix Prefix for table
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
protected function expressionizeTableColumn(array $elements, \string $prefix = '') : \string
|
||||
protected function expressionizeTableColumn(array $elements, string $prefix = '') : string
|
||||
{
|
||||
$expression = '';
|
||||
|
||||
|
|
@ -123,15 +123,15 @@ abstract class GrammarAbstract
|
|||
/**
|
||||
* Compile system.
|
||||
*
|
||||
* @param array|\string $system System
|
||||
* @param \string $prefix Prefix for table
|
||||
* @param array|string $system System
|
||||
* @param string $prefix Prefix for table
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
protected function compileSystem($system, \string $prefix = '') : \string
|
||||
protected function compileSystem($system, string $prefix = '') : string
|
||||
{
|
||||
if (count($split = explode('.', $system)) == 2) {
|
||||
return $this->compileSystem($prefix . $split[0]) . '.' . $this->compileSystem($split[1]);
|
||||
|
|
@ -140,17 +140,17 @@ abstract class GrammarAbstract
|
|||
}
|
||||
}
|
||||
|
||||
public function getDateFormat() : \string
|
||||
public function getDateFormat() : string
|
||||
{
|
||||
return 'Y-m-d H:i:s';
|
||||
}
|
||||
|
||||
public function getTablePrefix() : \string
|
||||
public function getTablePrefix() : string
|
||||
{
|
||||
return $this->tablePrefix;
|
||||
}
|
||||
|
||||
public function setTablePrefix(\string $prefix)
|
||||
public function setTablePrefix(string $prefix)
|
||||
{
|
||||
$this->tablePrefix = $prefix;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,12 +57,12 @@ class Pool
|
|||
* @param mixed $key Database key
|
||||
* @param ConnectionAbstract $db Database
|
||||
*
|
||||
* @return \bool
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function add($key = 'core', ConnectionAbstract $db) : \bool
|
||||
public function add($key = 'core', ConnectionAbstract $db) : bool
|
||||
{
|
||||
if (isset($this->pool[$key])) {
|
||||
return false;
|
||||
|
|
@ -97,12 +97,12 @@ class Pool
|
|||
*
|
||||
* @param mixed $key Database key
|
||||
*
|
||||
* @return \bool
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function remove($key) : \bool
|
||||
public function remove($key) : bool
|
||||
{
|
||||
if (!isset($this->pool[$key])) {
|
||||
return false;
|
||||
|
|
@ -119,12 +119,12 @@ class Pool
|
|||
* @param mixed $key Database key
|
||||
* @param array $config Database config data
|
||||
*
|
||||
* @return \bool
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function create($key, array $config) : \bool
|
||||
public function create($key, array $config) : bool
|
||||
{
|
||||
if (isset($this->pool[$key])) {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ class Builder extends BuilderAbstract
|
|||
/**
|
||||
* Distinct.
|
||||
*
|
||||
* @var \bool
|
||||
* @var bool
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public $distinct = false;
|
||||
|
|
@ -149,7 +149,7 @@ class Builder extends BuilderAbstract
|
|||
/**
|
||||
* Lock.
|
||||
*
|
||||
* @var \bool
|
||||
* @var bool
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public $lock = false;
|
||||
|
|
@ -163,7 +163,7 @@ class Builder extends BuilderAbstract
|
|||
/**
|
||||
* Comparison operators.
|
||||
*
|
||||
* @var \string[]
|
||||
* @var string[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
const operators = [
|
||||
|
|
@ -242,7 +242,7 @@ class Builder extends BuilderAbstract
|
|||
/**
|
||||
* Bind parameter.
|
||||
*
|
||||
* @param \string|array|\Closure $binds Binds
|
||||
* @param string|array|\Closure $binds Binds
|
||||
*
|
||||
* @return Builder
|
||||
*
|
||||
|
|
@ -278,12 +278,12 @@ class Builder extends BuilderAbstract
|
|||
/**
|
||||
* Parsing to string.
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function toSql() : \string
|
||||
public function toSql() : string
|
||||
{
|
||||
return $this->grammar->compileQuery($this);
|
||||
}
|
||||
|
|
@ -291,7 +291,7 @@ class Builder extends BuilderAbstract
|
|||
/**
|
||||
* Make raw column selection.
|
||||
*
|
||||
* @param \string|\Closure $expression Raw expression
|
||||
* @param string|\Closure $expression Raw expression
|
||||
*
|
||||
* @return Builder
|
||||
*
|
||||
|
|
@ -346,7 +346,7 @@ class Builder extends BuilderAbstract
|
|||
/**
|
||||
* Make raw from.
|
||||
*
|
||||
* @param \string|array|\Closure $expression Expression
|
||||
* @param string|array|\Closure $expression Expression
|
||||
*
|
||||
* @return Builder
|
||||
*
|
||||
|
|
@ -363,16 +363,16 @@ class Builder extends BuilderAbstract
|
|||
/**
|
||||
* Or Where.
|
||||
*
|
||||
* @param \string|array|\Closure $columns Columns
|
||||
* @param \string $operator Operator
|
||||
* @param \string|array|\Closure $values Values
|
||||
* @param string|array|\Closure $columns Columns
|
||||
* @param string $operator Operator
|
||||
* @param string|array|\Closure $values Values
|
||||
*
|
||||
* @return Builder
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function orWhere($columns, \string $operator = null, $values = null) : Builder
|
||||
public function orWhere($columns, string $operator = null, $values = null) : Builder
|
||||
{
|
||||
return $this->where($columns, $operator, $values, 'or');
|
||||
}
|
||||
|
|
@ -380,10 +380,10 @@ class Builder extends BuilderAbstract
|
|||
/**
|
||||
* Where.
|
||||
*
|
||||
* @param \string|array|\Closure $columns Columns
|
||||
* @param \string|array $operator Operator
|
||||
* @param string|array|\Closure $columns Columns
|
||||
* @param string|array $operator Operator
|
||||
* @param mixed $values Values
|
||||
* @param \string|array $boolean Boolean condition
|
||||
* @param string|array $boolean Boolean condition
|
||||
*
|
||||
* @return Builder
|
||||
*
|
||||
|
|
@ -428,16 +428,16 @@ class Builder extends BuilderAbstract
|
|||
/**
|
||||
* Where in.
|
||||
*
|
||||
* @param \string|array|\Closure $column Column
|
||||
* @param string|array|\Closure $column Column
|
||||
* @param mixed $values Values
|
||||
* @param \string $boolean Boolean condition
|
||||
* @param string $boolean Boolean condition
|
||||
*
|
||||
* @return Builder
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function whereIn($column, $values = null, \string $boolean = 'and') : Builder
|
||||
public function whereIn($column, $values = null, string $boolean = 'and') : Builder
|
||||
{
|
||||
$this->where($column, 'in', $values, $boolean);
|
||||
|
||||
|
|
@ -447,15 +447,15 @@ class Builder extends BuilderAbstract
|
|||
/**
|
||||
* Where null.
|
||||
*
|
||||
* @param \string|array|\Closure $column Column
|
||||
* @param \string $boolean Boolean condition
|
||||
* @param string|array|\Closure $column Column
|
||||
* @param string $boolean Boolean condition
|
||||
*
|
||||
* @return Builder
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function whereNull($column, \string $boolean = 'and') : Builder
|
||||
public function whereNull($column, string $boolean = 'and') : Builder
|
||||
{
|
||||
$this->where($column, '=', null, $boolean);
|
||||
|
||||
|
|
@ -465,15 +465,15 @@ class Builder extends BuilderAbstract
|
|||
/**
|
||||
* Where not null.
|
||||
*
|
||||
* @param \string|array|\Closure $column Column
|
||||
* @param \string $boolean Boolean condition
|
||||
* @param string|array|\Closure $column Column
|
||||
* @param string $boolean Boolean condition
|
||||
*
|
||||
* @return Builder
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function whereNotNull($column, \string $boolean = 'and') : Builder
|
||||
public function whereNotNull($column, string $boolean = 'and') : Builder
|
||||
{
|
||||
$this->where($column, '!=', null, $boolean);
|
||||
|
||||
|
|
@ -483,7 +483,7 @@ class Builder extends BuilderAbstract
|
|||
/**
|
||||
* Group by.
|
||||
*
|
||||
* @param \string|array|\Closure $columns Grouping result
|
||||
* @param string|array|\Closure $columns Grouping result
|
||||
*
|
||||
* @return Builder
|
||||
*
|
||||
|
|
@ -506,7 +506,7 @@ class Builder extends BuilderAbstract
|
|||
/**
|
||||
* Order by newest.
|
||||
*
|
||||
* @param \string|\Closure $column Column
|
||||
* @param string|\Closure $column Column
|
||||
*
|
||||
* @return Builder
|
||||
*
|
||||
|
|
@ -523,7 +523,7 @@ class Builder extends BuilderAbstract
|
|||
/**
|
||||
* Order by oldest.
|
||||
*
|
||||
* @param \string|\Closure $column Column
|
||||
* @param string|\Closure $column Column
|
||||
*
|
||||
* @return Builder
|
||||
*
|
||||
|
|
@ -540,8 +540,8 @@ class Builder extends BuilderAbstract
|
|||
/**
|
||||
* Order by oldest.
|
||||
*
|
||||
* @param \string|array|\Closure $columns Columns
|
||||
* @param \string|string[] $order Orders
|
||||
* @param string|array|\Closure $columns Columns
|
||||
* @param string|string[] $order Orders
|
||||
*
|
||||
* @return Builder
|
||||
*
|
||||
|
|
@ -566,7 +566,7 @@ class Builder extends BuilderAbstract
|
|||
/**
|
||||
* Offset.
|
||||
*
|
||||
* @param \int|\Closure $offset Offset
|
||||
* @param int|\Closure $offset Offset
|
||||
*
|
||||
* @return Builder
|
||||
*
|
||||
|
|
@ -583,7 +583,7 @@ class Builder extends BuilderAbstract
|
|||
/**
|
||||
* Limit.
|
||||
*
|
||||
* @param \int|\Closure $limit Limit
|
||||
* @param int|\Closure $limit Limit
|
||||
*
|
||||
* @return Builder
|
||||
*
|
||||
|
|
@ -600,7 +600,7 @@ class Builder extends BuilderAbstract
|
|||
/**
|
||||
* Limit.
|
||||
*
|
||||
* @param \string|\phpOMS\DataStorage\Database\Query\Builder $query Query
|
||||
* @param string|\phpOMS\DataStorage\Database\Query\Builder $query Query
|
||||
*
|
||||
* @return Builder
|
||||
*
|
||||
|
|
@ -683,7 +683,7 @@ class Builder extends BuilderAbstract
|
|||
/**
|
||||
* Table to insert into.
|
||||
*
|
||||
* @param \string|\Closure $table Table
|
||||
* @param string|\Closure $table Table
|
||||
*
|
||||
* @return Builder
|
||||
*
|
||||
|
|
@ -724,7 +724,7 @@ class Builder extends BuilderAbstract
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function value($value, \string $type = 'string') : Builder
|
||||
public function value($value, string $type = 'string') : Builder
|
||||
{
|
||||
end($this->values);
|
||||
$key = key($this->values);
|
||||
|
|
|
|||
|
|
@ -41,12 +41,12 @@ class Column
|
|||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param \string $column Column
|
||||
* @param string $column Column
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function __construct(\string $column)
|
||||
public function __construct(string $column)
|
||||
{
|
||||
$this->column = $column;
|
||||
}
|
||||
|
|
@ -59,12 +59,12 @@ class Column
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getColumn() : \string
|
||||
public function getColumn() : string
|
||||
{
|
||||
return $this->column;
|
||||
}
|
||||
|
||||
public function setColumn(\string $column)
|
||||
public function setColumn(string $column)
|
||||
{
|
||||
$this->column = $column;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class Grammar extends GrammarAbstract
|
|||
/**
|
||||
* Select components.
|
||||
*
|
||||
* @var \string[]
|
||||
* @var string[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $selectComponents = [
|
||||
|
|
@ -59,7 +59,7 @@ class Grammar extends GrammarAbstract
|
|||
/**
|
||||
* Insert components.
|
||||
*
|
||||
* @var \string[]
|
||||
* @var string[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $insertComponents = [
|
||||
|
|
@ -71,7 +71,7 @@ class Grammar extends GrammarAbstract
|
|||
/**
|
||||
* Update components.
|
||||
*
|
||||
* @var \string[]
|
||||
* @var string[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $updateComponents = [
|
||||
|
|
@ -85,7 +85,7 @@ class Grammar extends GrammarAbstract
|
|||
*
|
||||
* @param BuilderAbstract $query Builder
|
||||
*
|
||||
* @return \string[]
|
||||
* @return string[]
|
||||
*
|
||||
* @throws
|
||||
*
|
||||
|
|
@ -129,12 +129,12 @@ class Grammar extends GrammarAbstract
|
|||
* @param Builder $query Builder
|
||||
* @param array $columns Columns
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
protected function compileSelects(Builder $query, array $columns) : \string
|
||||
protected function compileSelects(Builder $query, array $columns) : string
|
||||
{
|
||||
$expression = $this->expressionizeTableColumn($columns, $query->getPrefix());
|
||||
|
||||
|
|
@ -151,12 +151,12 @@ class Grammar extends GrammarAbstract
|
|||
* @param Builder $query Builder
|
||||
* @param array $table Tables
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
protected function compileFrom(Builder $query, array $table) : \string
|
||||
protected function compileFrom(Builder $query, array $table) : string
|
||||
{
|
||||
$expression = $this->expressionizeTableColumn($table, $query->getPrefix());
|
||||
|
||||
|
|
@ -172,14 +172,14 @@ class Grammar extends GrammarAbstract
|
|||
*
|
||||
* @param Builder $query Builder
|
||||
* @param array $wheres Where elmenets
|
||||
* @param \bool $first Is first element (usefull for nesting)
|
||||
* @param bool $first Is first element (usefull for nesting)
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
protected function compileWheres(Builder $query, array $wheres, \bool $first = true) : \string
|
||||
protected function compileWheres(Builder $query, array $wheres, bool $first = true) : string
|
||||
{
|
||||
$expression = '';
|
||||
|
||||
|
|
@ -222,16 +222,16 @@ class Grammar extends GrammarAbstract
|
|||
* Compile value.
|
||||
*
|
||||
* @param array|string|\Closure $value Value
|
||||
* @param \string $prefix Prefix in case value is a table
|
||||
* @param string $prefix Prefix in case value is a table
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
protected function compileValue($value, $prefix = '') : \string
|
||||
protected function compileValue($value, $prefix = '') : string
|
||||
{
|
||||
if (is_string($value)) {
|
||||
return $this->valueQuotes . $value . $this->valueQuotes;
|
||||
|
|
@ -262,14 +262,14 @@ class Grammar extends GrammarAbstract
|
|||
* Compile limit.
|
||||
*
|
||||
* @param Builder $query Builder
|
||||
* @param \int $limit Limit
|
||||
* @param int $limit Limit
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
protected function compileLimit(Builder $query, $limit) : \string
|
||||
protected function compileLimit(Builder $query, $limit) : string
|
||||
{
|
||||
return 'LIMIT ' . $limit;
|
||||
}
|
||||
|
|
@ -278,14 +278,14 @@ class Grammar extends GrammarAbstract
|
|||
* Compile offset.
|
||||
*
|
||||
* @param Builder $query Builder
|
||||
* @param \int $offset Offset
|
||||
* @param int $offset Offset
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
protected function compileOffset(Builder $query, $offset) : \string
|
||||
protected function compileOffset(Builder $query, $offset) : string
|
||||
{
|
||||
return 'OFFSET ' . $offset;
|
||||
}
|
||||
|
|
@ -301,7 +301,7 @@ class Grammar extends GrammarAbstract
|
|||
* @param Builder $query Builder
|
||||
* @param array $groups Groups
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
|
|
@ -325,12 +325,12 @@ class Grammar extends GrammarAbstract
|
|||
* @param Builder $query Builder
|
||||
* @param array $orders Order
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
private function compileOrders(Builder $query, array $orders) : \string
|
||||
private function compileOrders(Builder $query, array $orders) : string
|
||||
{
|
||||
$expression = '';
|
||||
|
||||
|
|
@ -361,14 +361,14 @@ class Grammar extends GrammarAbstract
|
|||
* Compile insert into table.
|
||||
*
|
||||
* @param Builder $query Builder
|
||||
* @param \string $table Table
|
||||
* @param string $table Table
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
protected function compileInto(Builder $query, $table) : \string
|
||||
protected function compileInto(Builder $query, $table) : string
|
||||
{
|
||||
return 'INSERT INTO ' . $this->compileSystem($table, $query->getPrefix());
|
||||
}
|
||||
|
|
@ -379,12 +379,12 @@ class Grammar extends GrammarAbstract
|
|||
* @param Builder $query Builder
|
||||
* @param array $columns Columns
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
protected function compileInserts(Builder $query, array $columns) : \string
|
||||
protected function compileInserts(Builder $query, array $columns) : string
|
||||
{
|
||||
$cols = '';
|
||||
|
||||
|
|
@ -405,12 +405,12 @@ class Grammar extends GrammarAbstract
|
|||
* @param Builder $query Builder
|
||||
* @param array $values Values
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
protected function compileValues(Builder $query, array $values) : \string
|
||||
protected function compileValues(Builder $query, array $values) : string
|
||||
{
|
||||
$vals = '';
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class MysqlGrammar extends Grammar
|
|||
/**
|
||||
* System identifier.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $systemIdentifier = '`';
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class SqliteGrammar extends Grammar
|
|||
/**
|
||||
* System identifier.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public $systemIdentifier = '`';
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ class Builder extends BuilderAbstract
|
|||
$this->drop = array_unique($this->drop);
|
||||
}
|
||||
|
||||
public function create(\string $table)
|
||||
public function create(string $table)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -78,12 +78,12 @@ class Builder extends BuilderAbstract
|
|||
/**
|
||||
* Parsing to string.
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function toSql() : \string
|
||||
public function toSql() : string
|
||||
{
|
||||
return $this->grammar->compileQuery($this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class Grammar extends GrammarAbstract
|
|||
/**
|
||||
* Select components.
|
||||
*
|
||||
* @var \string[]
|
||||
* @var string[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $selectComponents = [
|
||||
|
|
@ -48,7 +48,7 @@ class Grammar extends GrammarAbstract
|
|||
/**
|
||||
* Select components.
|
||||
*
|
||||
* @var \string[]
|
||||
* @var string[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $dropComponents = [
|
||||
|
|
@ -77,7 +77,7 @@ class Grammar extends GrammarAbstract
|
|||
return $sql;
|
||||
}
|
||||
|
||||
protected function compileDrop(Builder $query, array $tables) : \string
|
||||
protected function compileDrop(Builder $query, array $tables) : string
|
||||
{
|
||||
$expression = $this->expressionizeTableColumn($tables, $query->getPrefix());
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class MysqlGrammar extends Grammar
|
|||
/**
|
||||
* System identifier.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $systemIdentifier = '`';
|
||||
|
|
@ -45,12 +45,12 @@ class MysqlGrammar extends Grammar
|
|||
* @param Builder $query Builder
|
||||
* @param array $columns Columns
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
protected function compileSelects(Builder $query, array $columns) : \string
|
||||
protected function compileSelects(Builder $query, array $columns) : string
|
||||
{
|
||||
$expression = $this->expressionizeTableColumn($columns);
|
||||
|
||||
|
|
@ -67,12 +67,12 @@ class MysqlGrammar extends Grammar
|
|||
* @param Builder $query Builder
|
||||
* @param array $table Tables
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
protected function compileFrom(Builder $query, array $table) : \string
|
||||
protected function compileFrom(Builder $query, array $table) : string
|
||||
{
|
||||
$expression = $this->expressionizeTableColumn('information_schema.tables');
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class ConsoleSession implements SessionInterface
|
|||
/**
|
||||
* Session ID.
|
||||
*
|
||||
* @var \string|\int
|
||||
* @var string|int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $sid = null;
|
||||
|
|
@ -40,7 +40,7 @@ class ConsoleSession implements SessionInterface
|
|||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param \string|\int $sid Session id
|
||||
* @param string|int $sid Session id
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
|
|
@ -60,7 +60,7 @@ class ConsoleSession implements SessionInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function set($key, $value, \bool $overwrite = true) : \bool
|
||||
public function set($key, $value, bool $overwrite = true) : bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -68,7 +68,7 @@ class ConsoleSession implements SessionInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function remove($key) : \bool
|
||||
public function remove($key) : bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class HttpSession implements SessionInterface
|
|||
/**
|
||||
* Session ID.
|
||||
*
|
||||
* @var \string|int
|
||||
* @var string|int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $sid = null;
|
||||
|
|
@ -44,15 +44,15 @@ class HttpSession implements SessionInterface
|
|||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param \int $liftetime Session life time
|
||||
* @param \string|int|\bool $sid Session id
|
||||
* @param int $liftetime Session life time
|
||||
* @param string|int|bool $sid Session id
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function __construct(\int $liftetime = 3600, $sid = false)
|
||||
public function __construct(int $liftetime = 3600, $sid = false)
|
||||
{
|
||||
if ($sid !== false) {
|
||||
if (!is_bool($sid)) {
|
||||
session_id($sid);
|
||||
}
|
||||
|
||||
|
|
@ -83,7 +83,7 @@ class HttpSession implements SessionInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function set($key, $value, \bool $overwrite = true) : \bool
|
||||
public function set($key, $value, bool $overwrite = true) : bool
|
||||
{
|
||||
if($overwrite || !isset($this->sessionData[$key])) {
|
||||
$this->sessionData[$key] = $value;
|
||||
|
|
@ -105,7 +105,7 @@ class HttpSession implements SessionInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function remove($key) : \bool
|
||||
public function remove($key) : bool
|
||||
{
|
||||
if (isset($this->sessionData[$key])) {
|
||||
unset($this->sessionData[$key]);
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ interface SessionInterface
|
|||
/**
|
||||
* Get session variable by key.
|
||||
*
|
||||
* @param \string|\int $key Value key
|
||||
* @param string|int $key Value key
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
|
|
@ -46,28 +46,28 @@ interface SessionInterface
|
|||
/**
|
||||
* Store session value by key.
|
||||
*
|
||||
* @param \string|\int $key Value key
|
||||
* @param string|int $key Value key
|
||||
* @param mixed $value Value to store
|
||||
* @param \bool $overwrite Overwrite existing values
|
||||
* @param bool $overwrite Overwrite existing values
|
||||
*
|
||||
* @return \bool
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function set($key, $value, \bool $overwrite = true) : \bool;
|
||||
public function set($key, $value, bool $overwrite = true) : bool;
|
||||
|
||||
/**
|
||||
* Remove value from session by key.
|
||||
*
|
||||
* @param \string|\int $key Value key
|
||||
* @param string|int $key Value key
|
||||
*
|
||||
* @return \bool
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function remove($key) : \bool;
|
||||
public function remove($key) : bool;
|
||||
|
||||
/**
|
||||
* Save session.
|
||||
|
|
@ -82,7 +82,7 @@ interface SessionInterface
|
|||
public function save();
|
||||
|
||||
/**
|
||||
* @return \int|\string
|
||||
* @return int|string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
|
|
@ -90,7 +90,7 @@ interface SessionInterface
|
|||
public function getSID();
|
||||
|
||||
/**
|
||||
* @param \int|\string $sid
|
||||
* @param int|string $sid
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class SocketSession implements SessionInterface
|
|||
/**
|
||||
* Session ID.
|
||||
*
|
||||
* @var \string|\int
|
||||
* @var string|int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $sid = null;
|
||||
|
|
@ -40,7 +40,7 @@ class SocketSession implements SessionInterface
|
|||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param \string|\int $sid Session id
|
||||
* @param string|int $sid Session id
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
|
|
@ -60,7 +60,7 @@ class SocketSession implements SessionInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function set($key, $value, \bool $overwrite = true) : \bool
|
||||
public function set($key, $value, bool $overwrite = true) : bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -68,7 +68,7 @@ class SocketSession implements SessionInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function remove($key) : \bool
|
||||
public function remove($key) : bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class Address implements JsonableInterface
|
|||
/**
|
||||
* Name of the receiver.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $recipient = '';
|
||||
|
|
@ -42,7 +42,7 @@ class Address implements JsonableInterface
|
|||
/**
|
||||
* Sub of the address.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $fao = '';
|
||||
|
|
@ -69,12 +69,12 @@ class Address implements JsonableInterface
|
|||
/**
|
||||
* Get recipient.
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getRecipient() : \string
|
||||
public function getRecipient() : string
|
||||
{
|
||||
return $this->recipient;
|
||||
}
|
||||
|
|
@ -82,14 +82,14 @@ class Address implements JsonableInterface
|
|||
/**
|
||||
* Set recipient.
|
||||
*
|
||||
* @param \string $recipient Recipient
|
||||
* @param string $recipient Recipient
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setRecipient(\string $recipient)
|
||||
public function setRecipient(string $recipient)
|
||||
{
|
||||
$this->recipient = $recipient;
|
||||
}
|
||||
|
|
@ -97,12 +97,12 @@ class Address implements JsonableInterface
|
|||
/**
|
||||
* Get FAO.
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getFAO() : \string
|
||||
public function getFAO() : string
|
||||
{
|
||||
return $this->fao;
|
||||
}
|
||||
|
|
@ -110,14 +110,14 @@ class Address implements JsonableInterface
|
|||
/**
|
||||
* Set FAO.
|
||||
*
|
||||
* @param \string $fao FAO
|
||||
* @param string $fao FAO
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setFAO(\string $fao)
|
||||
public function setFAO(string $fao)
|
||||
{
|
||||
$this->fao = $fao;
|
||||
}
|
||||
|
|
@ -161,7 +161,7 @@ class Address implements JsonableInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toJson(\int $option = 0) : \string
|
||||
public function toJson(int $option = 0) : string
|
||||
{
|
||||
return json_encode($this->toArray());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,14 +36,14 @@ abstract class Enum
|
|||
*
|
||||
* Checking if a certain const name exists (case sensitive)
|
||||
*
|
||||
* @param \string $name Name of the value (case sensitive)
|
||||
* @param string $name Name of the value (case sensitive)
|
||||
*
|
||||
* @return \bool
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function isValidName(\string $name) : \bool
|
||||
public static function isValidName(string $name) : bool
|
||||
{
|
||||
$constants = self::getConstants();
|
||||
|
||||
|
|
@ -72,12 +72,12 @@ abstract class Enum
|
|||
*
|
||||
* @param mixed $value Value to check
|
||||
*
|
||||
* @return \bool
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function isValidValue($value) : \bool
|
||||
public static function isValidValue($value) : bool
|
||||
{
|
||||
$values = array_values(self::getConstants());
|
||||
|
||||
|
|
|
|||
|
|
@ -36,14 +36,14 @@ abstract class EnumArray
|
|||
*
|
||||
* Checking if a certain const name exists (case sensitive)
|
||||
*
|
||||
* @param \string $name Name of the value (case sensitive)
|
||||
* @param string $name Name of the value (case sensitive)
|
||||
*
|
||||
* @return \bool
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function isValidName(\string $name) : \bool
|
||||
public static function isValidName(string $name) : bool
|
||||
{
|
||||
$constants = self::getConstants();
|
||||
|
||||
|
|
@ -71,12 +71,12 @@ abstract class EnumArray
|
|||
*
|
||||
* @param mixed $value Value to check
|
||||
*
|
||||
* @return \bool
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function isValidValue($value) : \bool
|
||||
public static function isValidValue($value) : bool
|
||||
{
|
||||
$constants = self::getConstants();
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class Location implements JsonableInterface
|
|||
/**
|
||||
* Zip or postal.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $postal = '';
|
||||
|
|
@ -42,7 +42,7 @@ class Location implements JsonableInterface
|
|||
/**
|
||||
* Name of city.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $city = '';
|
||||
|
|
@ -50,7 +50,7 @@ class Location implements JsonableInterface
|
|||
/**
|
||||
* Name of the country.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $country = '';
|
||||
|
|
@ -58,7 +58,7 @@ class Location implements JsonableInterface
|
|||
/**
|
||||
* Street & district.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $address = '';
|
||||
|
|
@ -66,7 +66,7 @@ class Location implements JsonableInterface
|
|||
/**
|
||||
* State.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $state = '';
|
||||
|
|
@ -74,7 +74,7 @@ class Location implements JsonableInterface
|
|||
/**
|
||||
* Geo coordinates.
|
||||
*
|
||||
* @var \float[]
|
||||
* @var float[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $geo = ['lat' => 0, 'long' => 0];
|
||||
|
|
@ -90,127 +90,127 @@ class Location implements JsonableInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getPostal() : \string
|
||||
public function getPostal() : string
|
||||
{
|
||||
return $this->postal;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \string $postal
|
||||
* @param string $postal
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setPostal(\string $postal)
|
||||
public function setPostal(string $postal)
|
||||
{
|
||||
$this->postal = $postal;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getCity() : \string
|
||||
public function getCity() : string
|
||||
{
|
||||
return $this->city;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \string $city
|
||||
* @param string $city
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setCity(\string $city)
|
||||
public function setCity(string $city)
|
||||
{
|
||||
$this->city = $city;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getCountry() : \string
|
||||
public function getCountry() : string
|
||||
{
|
||||
return $this->country;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \string $country
|
||||
* @param string $country
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setCountry(\string $country)
|
||||
public function setCountry(string $country)
|
||||
{
|
||||
$this->country = $country;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getAddress() : \string
|
||||
public function getAddress() : string
|
||||
{
|
||||
return $this->address;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \string $address
|
||||
* @param string $address
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setAddress(\string $address)
|
||||
public function setAddress(string $address)
|
||||
{
|
||||
$this->address = $address;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getState() : \string
|
||||
public function getState() : string
|
||||
{
|
||||
return $this->state;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \string $state
|
||||
* @param string $state
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setState(\string $state)
|
||||
public function setState(string $state)
|
||||
{
|
||||
$this->state = $state;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \float[]
|
||||
* @return float[]
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
|
|
@ -221,7 +221,7 @@ class Location implements JsonableInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* @param \float[] $geo
|
||||
* @param float[] $geo
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
|
|
@ -251,7 +251,7 @@ class Location implements JsonableInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toJson(\int $option = 0) : \string
|
||||
public function toJson(int $option = 0) : string
|
||||
{
|
||||
return json_encode($this->toArray());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,17 +44,17 @@ class SmartDateTime extends \DateTime
|
|||
/**
|
||||
* Modify datetime in a smart way.
|
||||
*
|
||||
* @param \int $y Year
|
||||
* @param \int $m Month
|
||||
* @param \int $d Day
|
||||
* @param \int $calendar Calendar
|
||||
* @param int $y Year
|
||||
* @param int $m Month
|
||||
* @param int $d Day
|
||||
* @param int $calendar Calendar
|
||||
*
|
||||
* @return SmartDateTime
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function createModify(\int $y, \int $m = 0, \int $d = 0, \int $calendar = CAL_GREGORIAN) : SmartDateTime
|
||||
public function createModify(int $y, int $m = 0, int $d = 0, int $calendar = CAL_GREGORIAN) : SmartDateTime
|
||||
{
|
||||
$dt = clone $this;
|
||||
$dt->smartModify($y, $m, $d, $calendar);
|
||||
|
|
@ -65,17 +65,17 @@ class SmartDateTime extends \DateTime
|
|||
/**
|
||||
* Modify datetime in a smart way.
|
||||
*
|
||||
* @param \int $y Year
|
||||
* @param \int $m Month
|
||||
* @param \int $d Day
|
||||
* @param \int $calendar Calendar
|
||||
* @param int $y Year
|
||||
* @param int $m Month
|
||||
* @param int $d Day
|
||||
* @param int $calendar Calendar
|
||||
*
|
||||
* @return SmartDateTime
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function smartModify(\int $y, \int $m = 0, \int $d = 0, \int $calendar = CAL_GREGORIAN) : SmartDateTime
|
||||
public function smartModify(int $y, int $m = 0, int $d = 0, int $calendar = CAL_GREGORIAN) : SmartDateTime
|
||||
{
|
||||
$y_change = floor(((int) $this->format('m') + $m) / 12);
|
||||
$y_change = ((int) $this->format('m') + $m) < 0 && ((int) $this->format('m') + $m) % 12 === 0 ? $y_change - 1 : $y_change;
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ class Dispatcher
|
|||
/**
|
||||
* Dispatch controller.
|
||||
*
|
||||
* @param \string|array|\Closure $controller Controller string
|
||||
* @param string|array|\Closure $controller Controller string
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param mixed $data Data
|
||||
|
|
@ -118,14 +118,14 @@ class Dispatcher
|
|||
/**
|
||||
* Get controller.
|
||||
*
|
||||
* @param \string $controller Controller string
|
||||
* @param string $controller Controller string
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function get(\string $controller)
|
||||
public function get(string $controller)
|
||||
{
|
||||
if (!isset($this->controllers[$controller])) {
|
||||
if (realpath($path = ROOT_PATH . '/' . str_replace('\\', '/', $controller) . '.php') === false) {
|
||||
|
|
@ -142,14 +142,14 @@ class Dispatcher
|
|||
* Set controller by alias.
|
||||
*
|
||||
* @param ModuleAbstract $controller Controller
|
||||
* @param \string $name Controller string
|
||||
* @param string $name Controller string
|
||||
*
|
||||
* @return \bool
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function set(ModuleAbstract $controller, \string $name) : \bool
|
||||
public function set(ModuleAbstract $controller, string $name) : bool
|
||||
{
|
||||
if (!isset($this->controllers[$name])) {
|
||||
$this->controllers[$name] = $controller;
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class EventManager implements Mediator
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function attach(\string $event, \Closure $callback = null, \string $listener = null) : \string
|
||||
public function attach(string $event, \Closure $callback = null, string $listener = null) : string
|
||||
{
|
||||
$this->events[$event][$listener] = $callback;
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ class EventManager implements Mediator
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function trigger(\string $event, \Closure $callback = null, \string $source = null) : \int
|
||||
public function trigger(string $event, \Closure $callback = null, string $source = null) : int
|
||||
{
|
||||
$count = 0;
|
||||
foreach ($this->events[$event] as $event) {
|
||||
|
|
@ -82,16 +82,16 @@ class EventManager implements Mediator
|
|||
*
|
||||
* An object fires an event until it's callback returns false
|
||||
*
|
||||
* @param \string $event Event ID
|
||||
* @param string $event Event ID
|
||||
* @param \Closure $callback Callback function of the event. This will get triggered after firering all listener callbacks.
|
||||
* @param \string $source What class is invoking this event
|
||||
* @param string $source What class is invoking this event
|
||||
*
|
||||
* @return \int
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function triggerUntil(\string $event, \Closure $callback = null, \string $source = null) : \int
|
||||
public function triggerUntil(string $event, \Closure $callback = null, string $source = null) : int
|
||||
{
|
||||
$run = true;
|
||||
$count = 0;
|
||||
|
|
@ -113,7 +113,7 @@ class EventManager implements Mediator
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function detach(\int $event)
|
||||
public function detach(int $event)
|
||||
{
|
||||
$this->events = ArrayUtils::unsetArray($event, $this->events, '/');
|
||||
}
|
||||
|
|
@ -121,12 +121,12 @@ class EventManager implements Mediator
|
|||
/**
|
||||
* Count event listenings.
|
||||
*
|
||||
* @return \int
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function count() : \int
|
||||
public function count() : int
|
||||
{
|
||||
return count($this->events);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class L11nManager
|
|||
/**
|
||||
* Language.
|
||||
*
|
||||
* @var \string[][]
|
||||
* @var string[][]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $language = [];
|
||||
|
|
@ -40,14 +40,14 @@ class L11nManager
|
|||
/**
|
||||
* Verify if language is loaded.
|
||||
*
|
||||
* @param \string $language Language iso code
|
||||
* @param string $language Language iso code
|
||||
*
|
||||
* @return \bool
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function isLanguageLoaded(\string $language) : \bool
|
||||
public function isLanguageLoaded(string $language) : bool
|
||||
{
|
||||
return isset($this->language[$language]);
|
||||
}
|
||||
|
|
@ -58,9 +58,9 @@ class L11nManager
|
|||
* One module can only be loaded once. Once the module got loaded it's not
|
||||
* possible to load more language files later on.
|
||||
*
|
||||
* @param \string $language Language iso code
|
||||
* @param \string $from Module name
|
||||
* @param \string[][] $files Language files content
|
||||
* @param string $language Language iso code
|
||||
* @param string $from Module name
|
||||
* @param string[][] $files Language files content
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
|
|
@ -69,7 +69,7 @@ class L11nManager
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function loadLanguage(\string $language, \string $from, array $files)
|
||||
public function loadLanguage(string $language, string $from, array $files)
|
||||
{
|
||||
if(!isset($files[$from])) {
|
||||
throw new \Exception('Unexpected language key: ' . $from);
|
||||
|
|
@ -86,15 +86,15 @@ class L11nManager
|
|||
/**
|
||||
* Get application language.
|
||||
*
|
||||
* @param \string $language Language iso code
|
||||
* @param \string $module Module name
|
||||
* @param string $language Language iso code
|
||||
* @param string $module Module name
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getLanguage(\string $language, \string $module = null) : array
|
||||
public function getLanguage(string $language, string $module = null) : array
|
||||
{
|
||||
if (!isset($module) && isset($this->language[$language])) {
|
||||
return $this->language[$language];
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class Localization
|
|||
/**
|
||||
* Country ID.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $country = ISO3166Enum::_US;
|
||||
|
|
@ -41,7 +41,7 @@ class Localization
|
|||
/**
|
||||
* Timezone.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $timezone = 'America/New_York';
|
||||
|
|
@ -49,7 +49,7 @@ class Localization
|
|||
/**
|
||||
* Language ISO code.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $language = ISO639x1Enum::_EN;
|
||||
|
|
@ -57,7 +57,7 @@ class Localization
|
|||
/**
|
||||
* Currency.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $currency = ISO4217Enum::C_USD;
|
||||
|
|
@ -65,7 +65,7 @@ class Localization
|
|||
/**
|
||||
* Number format.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $decimal = '.';
|
||||
|
|
@ -73,7 +73,7 @@ class Localization
|
|||
/**
|
||||
* Number format.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $thousands = ',';
|
||||
|
|
@ -81,7 +81,7 @@ class Localization
|
|||
/**
|
||||
* Time format.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $datetime = 'Y-m-d H:i:s';
|
||||
|
|
@ -89,7 +89,7 @@ class Localization
|
|||
/**
|
||||
* Language array.
|
||||
*
|
||||
* @var \string[]
|
||||
* @var string[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public $lang = [];
|
||||
|
|
@ -105,25 +105,25 @@ class Localization
|
|||
}
|
||||
|
||||
/**
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getCountry() : \string
|
||||
public function getCountry() : string
|
||||
{
|
||||
return $this->country;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \string $country
|
||||
* @param string $country
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setCountry(\string $country)
|
||||
public function setCountry(string $country)
|
||||
{
|
||||
if(!ISO3166Enum::isValidValue($country)) {
|
||||
throw new InvalidEnumValue($country);
|
||||
|
|
@ -133,25 +133,25 @@ class Localization
|
|||
}
|
||||
|
||||
/**
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getTimezone() : \string
|
||||
public function getTimezone() : string
|
||||
{
|
||||
return $this->timezone;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \string $timezone
|
||||
* @param string $timezone
|
||||
*
|
||||
* @todo: maybe make parameter int
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setTimezone(\string $timezone)
|
||||
public function setTimezone(string $timezone)
|
||||
{
|
||||
if(!TimeZoneEnumArray::isValidValue($timezone)) {
|
||||
throw new InvalidEnumValue($timezone);
|
||||
|
|
@ -161,25 +161,25 @@ class Localization
|
|||
}
|
||||
|
||||
/**
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getLanguage() : \string
|
||||
public function getLanguage() : string
|
||||
{
|
||||
return $this->language;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \string $language
|
||||
* @param string $language
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setLanguage(\string $language)
|
||||
public function setLanguage(string $language)
|
||||
{
|
||||
if(!ISO639x1Enum::isValidValue($language)) {
|
||||
throw new InvalidEnumValue($language);
|
||||
|
|
@ -213,25 +213,25 @@ class Localization
|
|||
}
|
||||
|
||||
/**
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getCurrency() : \string
|
||||
public function getCurrency() : string
|
||||
{
|
||||
return $this->currency;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \string $currency
|
||||
* @param string $currency
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setCurrency(\string $currency)
|
||||
public function setCurrency(string $currency)
|
||||
{
|
||||
if(!ISO4217Enum::isValidValue($currency)) {
|
||||
throw new InvalidEnumValue($currency);
|
||||
|
|
@ -241,73 +241,73 @@ class Localization
|
|||
}
|
||||
|
||||
/**
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getDatetime() : \string
|
||||
public function getDatetime() : string
|
||||
{
|
||||
return $this->datetime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \string $datetime
|
||||
* @param string $datetime
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setDatetime(\string $datetime)
|
||||
public function setDatetime(string $datetime)
|
||||
{
|
||||
$this->datetime = $datetime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getDecimal() : \string
|
||||
public function getDecimal() : string
|
||||
{
|
||||
return $this->decimal;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \string $decimal
|
||||
* @param string $decimal
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setDecimal(\string $decimal)
|
||||
public function setDecimal(string $decimal)
|
||||
{
|
||||
$this->decimal = $decimal;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getThousands() : \string
|
||||
public function getThousands() : string
|
||||
{
|
||||
return $this->thousands;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \string $thousands
|
||||
* @param string $thousands
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setThousands(\string $thousands)
|
||||
public function setThousands(string $thousands)
|
||||
{
|
||||
$this->thousands = $thousands;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,12 +78,12 @@ class FileLogger implements LoggerInterface
|
|||
*
|
||||
* Creates the logging object and overwrites all default values.
|
||||
*
|
||||
* @param \string $lpath Path for logging
|
||||
* @param string $lpath Path for logging
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public function __construct(\string $lpath)
|
||||
public function __construct(string $lpath)
|
||||
{
|
||||
$path = realpath($lpath);
|
||||
|
||||
|
|
@ -115,14 +115,14 @@ class FileLogger implements LoggerInterface
|
|||
/**
|
||||
* Returns instance.
|
||||
*
|
||||
* @param \string $path Logging path
|
||||
* @param string $path Logging path
|
||||
*
|
||||
* @return self
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getInstance(\string $path = '')
|
||||
public static function getInstance(string $path = '')
|
||||
{
|
||||
if (self::$instance === null) {
|
||||
self::$instance = new self($path);
|
||||
|
|
@ -159,7 +159,7 @@ class FileLogger implements LoggerInterface
|
|||
/**
|
||||
* Starts the time measurement.
|
||||
*
|
||||
* @param \string $id the ID by which this time measurement gets identified
|
||||
* @param string $id the ID by which this time measurement gets identified
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
|
|
@ -177,9 +177,9 @@ class FileLogger implements LoggerInterface
|
|||
/**
|
||||
* Ends the time measurement.
|
||||
*
|
||||
* @param \string $id the ID by which this time measurement gets identified
|
||||
* @param string $id the ID by which this time measurement gets identified
|
||||
*
|
||||
* @return \int the time measurement
|
||||
* @return int the time measurement
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
|
|
@ -213,16 +213,16 @@ class FileLogger implements LoggerInterface
|
|||
/**
|
||||
* Interpolate context
|
||||
*
|
||||
* @param \string $message
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @param \string $level
|
||||
* @param string $level
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
private function interpolate(\string $message, array $context = [], \string $level = LogLevel::DEBUG)
|
||||
private function interpolate(string $message, array $context = [], string $level = LogLevel::DEBUG)
|
||||
{
|
||||
$replace = [];
|
||||
foreach ($context as $key => $val) {
|
||||
|
|
@ -257,7 +257,7 @@ class FileLogger implements LoggerInterface
|
|||
* @param array $a
|
||||
* @param array $b
|
||||
*
|
||||
* @return \bool the comparison
|
||||
* @return bool the comparison
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
|
|
@ -274,14 +274,14 @@ class FileLogger implements LoggerInterface
|
|||
/**
|
||||
* Write to file.
|
||||
*
|
||||
* @param \string $message
|
||||
* @param string $message
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
private function write(\string $message)
|
||||
private function write(string $message)
|
||||
{
|
||||
$this->fp = fopen($this->path, 'a');
|
||||
fwrite($this->fp, $message . "\n");
|
||||
|
|
@ -291,7 +291,7 @@ class FileLogger implements LoggerInterface
|
|||
/**
|
||||
* System is unusable.
|
||||
*
|
||||
* @param \string $message
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
|
|
@ -299,7 +299,7 @@ class FileLogger implements LoggerInterface
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public function emergency(\string $message, array $context = [])
|
||||
public function emergency(string $message, array $context = [])
|
||||
{
|
||||
$message = $this->interpolate($message, $context, LogLevel::EMERGENCY);
|
||||
$this->write($message);
|
||||
|
|
@ -311,7 +311,7 @@ class FileLogger implements LoggerInterface
|
|||
* Example: Entire website down, database unavailable, etc. This should
|
||||
* trigger the SMS alerts and wake you up.
|
||||
*
|
||||
* @param \string $message
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return void
|
||||
|
|
@ -319,7 +319,7 @@ class FileLogger implements LoggerInterface
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public function alert(\string $message, array $context = [])
|
||||
public function alert(string $message, array $context = [])
|
||||
{
|
||||
$message = $this->interpolate($message, $context, LogLevel::ALERT);
|
||||
$this->write($message);
|
||||
|
|
@ -330,7 +330,7 @@ class FileLogger implements LoggerInterface
|
|||
*
|
||||
* Example: Application component unavailable, unexpected exception.
|
||||
*
|
||||
* @param \string $message
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return void
|
||||
|
|
@ -338,7 +338,7 @@ class FileLogger implements LoggerInterface
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public function critical(\string $message, array $context = [])
|
||||
public function critical(string $message, array $context = [])
|
||||
{
|
||||
$message = $this->interpolate($message, $context, LogLevel::CRITICAL);
|
||||
$this->write($message);
|
||||
|
|
@ -348,7 +348,7 @@ class FileLogger implements LoggerInterface
|
|||
* Runtime errors that do not require immediate action but should typically
|
||||
* be logged and monitored.
|
||||
*
|
||||
* @param \string $message
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return void
|
||||
|
|
@ -356,7 +356,7 @@ class FileLogger implements LoggerInterface
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public function error(\string $message, array $context = [])
|
||||
public function error(string $message, array $context = [])
|
||||
{
|
||||
$message = $this->interpolate($message, $context, LogLevel::ERROR);
|
||||
$this->write($message);
|
||||
|
|
@ -368,7 +368,7 @@ class FileLogger implements LoggerInterface
|
|||
* Example: Use of deprecated APIs, poor use of an API, undesirable things
|
||||
* that are not necessarily wrong.
|
||||
*
|
||||
* @param \string $message
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return void
|
||||
|
|
@ -376,7 +376,7 @@ class FileLogger implements LoggerInterface
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public function warning(\string $message, array $context = [])
|
||||
public function warning(string $message, array $context = [])
|
||||
{
|
||||
$message = $this->interpolate($message, $context, LogLevel::WARNING);
|
||||
$this->write($message);
|
||||
|
|
@ -385,7 +385,7 @@ class FileLogger implements LoggerInterface
|
|||
/**
|
||||
* Normal but significant events.
|
||||
*
|
||||
* @param \string $message
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return void
|
||||
|
|
@ -393,7 +393,7 @@ class FileLogger implements LoggerInterface
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public function notice(\string $message, array $context = [])
|
||||
public function notice(string $message, array $context = [])
|
||||
{
|
||||
$message = $this->interpolate($message, $context, LogLevel::NOTICE);
|
||||
$this->write($message);
|
||||
|
|
@ -404,7 +404,7 @@ class FileLogger implements LoggerInterface
|
|||
*
|
||||
* Example: User logs in, SQL logs.
|
||||
*
|
||||
* @param \string $message
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return void
|
||||
|
|
@ -412,7 +412,7 @@ class FileLogger implements LoggerInterface
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public function info(\string $message, array $context = [])
|
||||
public function info(string $message, array $context = [])
|
||||
{
|
||||
$message = $this->interpolate($message, $context, LogLevel::INFO);
|
||||
$this->write($message);
|
||||
|
|
@ -421,7 +421,7 @@ class FileLogger implements LoggerInterface
|
|||
/**
|
||||
* Detailed debug information.
|
||||
*
|
||||
* @param \string $message
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return void
|
||||
|
|
@ -429,7 +429,7 @@ class FileLogger implements LoggerInterface
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public function debug(\string $message, array $context = [])
|
||||
public function debug(string $message, array $context = [])
|
||||
{
|
||||
$message = $this->interpolate($message, $context, LogLevel::DEBUG);
|
||||
$this->write($message);
|
||||
|
|
@ -438,8 +438,8 @@ class FileLogger implements LoggerInterface
|
|||
/**
|
||||
* Logs with an arbitrary level.
|
||||
*
|
||||
* @param \string $level
|
||||
* @param \string $message
|
||||
* @param string $level
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return void
|
||||
|
|
@ -447,7 +447,7 @@ class FileLogger implements LoggerInterface
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public function log(\string $level, \string $message, array $context = [])
|
||||
public function log(string $level, string $message, array $context = [])
|
||||
{
|
||||
if (!LogLevel::isValidValue($level)) {
|
||||
throw new InvalidEnumValue($level);
|
||||
|
|
@ -490,11 +490,11 @@ class FileLogger implements LoggerInterface
|
|||
/**
|
||||
* Find cricitcal connections.
|
||||
*
|
||||
* @param \int $limit Amout of perpetrators
|
||||
* @param int $limit Amout of perpetrators
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getHighestPerpetrator(\int $limit = 10)
|
||||
public function getHighestPerpetrator(int $limit = 10)
|
||||
{
|
||||
$connection = [];
|
||||
|
||||
|
|
@ -523,12 +523,12 @@ class FileLogger implements LoggerInterface
|
|||
/**
|
||||
* Get logging messages from file.
|
||||
*
|
||||
* @param \int $limit Amout of perpetrators
|
||||
* @param \int $offset Offset
|
||||
* @param int $limit Amout of perpetrators
|
||||
* @param int $offset Offset
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get(\int $limit = 25, \int $offset = 0) : array
|
||||
public function get(int $limit = 25, int $offset = 0) : array
|
||||
{
|
||||
$logs = [];
|
||||
$id = 0;
|
||||
|
|
@ -570,11 +570,11 @@ class FileLogger implements LoggerInterface
|
|||
/**
|
||||
* Get single logging message from file.
|
||||
*
|
||||
* @param \int $id Id/Line number of the logging message
|
||||
* @param int $id Id/Line number of the logging message
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getByLine(\int $id = 1) : array
|
||||
public function getByLine(int $id = 1) : array
|
||||
{
|
||||
$log = [];
|
||||
$current = 0;
|
||||
|
|
|
|||
|
|
@ -21,12 +21,12 @@ interface LoggerInterface
|
|||
/**
|
||||
* System is unusable.
|
||||
*
|
||||
* @param \string $message
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function emergency(\string $message, array $context = []);
|
||||
public function emergency(string $message, array $context = []);
|
||||
|
||||
/**
|
||||
* Action must be taken immediately.
|
||||
|
|
@ -34,35 +34,35 @@ interface LoggerInterface
|
|||
* Example: Entire website down, database unavailable, etc. This should
|
||||
* trigger the SMS alerts and wake you up.
|
||||
*
|
||||
* @param \string $message
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function alert(\string $message, array $context = []);
|
||||
public function alert(string $message, array $context = []);
|
||||
|
||||
/**
|
||||
* Critical conditions.
|
||||
*
|
||||
* Example: Application component unavailable, unexpected exception.
|
||||
*
|
||||
* @param \string $message
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function critical(\string $message, array $context = []);
|
||||
public function critical(string $message, array $context = []);
|
||||
|
||||
/**
|
||||
* Runtime errors that do not require immediate action but should typically
|
||||
* be logged and monitored.
|
||||
*
|
||||
* @param \string $message
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function error(\string $message, array $context = []);
|
||||
public function error(string $message, array $context = []);
|
||||
|
||||
/**
|
||||
* Exceptional occurrences that are not errors.
|
||||
|
|
@ -70,53 +70,53 @@ interface LoggerInterface
|
|||
* Example: Use of deprecated APIs, poor use of an API, undesirable things
|
||||
* that are not necessarily wrong.
|
||||
*
|
||||
* @param \string $message
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function warning(\string $message, array $context = []);
|
||||
public function warning(string $message, array $context = []);
|
||||
|
||||
/**
|
||||
* Normal but significant events.
|
||||
*
|
||||
* @param \string $message
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function notice(\string $message, array $context = []);
|
||||
public function notice(string $message, array $context = []);
|
||||
|
||||
/**
|
||||
* Interesting events.
|
||||
*
|
||||
* Example: User logs in, SQL logs.
|
||||
*
|
||||
* @param \string $message
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function info(\string $message, array $context = []);
|
||||
public function info(string $message, array $context = []);
|
||||
|
||||
/**
|
||||
* Detailed debug information.
|
||||
*
|
||||
* @param \string $message
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function debug(\string $message, array $context = []);
|
||||
public function debug(string $message, array $context = []);
|
||||
|
||||
/**
|
||||
* Logs with an arbitrary level.
|
||||
*
|
||||
* @param \string $level
|
||||
* @param \string $message
|
||||
* @param string $level
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function log(\string $level, \string $message, array $context = []);
|
||||
public function log(string $level, string $message, array $context = []);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class PointPolygonIntersection
|
|||
{
|
||||
}
|
||||
|
||||
public static function pointInPolygon(array $point, array $vertices) : \int
|
||||
public static function pointInPolygon(array $point, array $vertices) : int
|
||||
{
|
||||
$length = count($vertices);
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ class FiniteDifference
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getNewtonDifferenceQuotient(\string $formula, array $variable) : \float
|
||||
public static function getNewtonDifferenceQuotient(string $formula, array $variable) : float
|
||||
{
|
||||
return (Evaluator::evaluate($formula, ['x' => $variable['x'] + self::EPSILON]) - Evaluator::evaluate($formula, ['x' => $variable['x']])) / self::EPSILON;
|
||||
}
|
||||
|
|
@ -68,7 +68,7 @@ class FiniteDifference
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getSymmetricDifferenceQuotient(\string $formula, array $variable) : \float
|
||||
public static function getSymmetricDifferenceQuotient(string $formula, array $variable) : float
|
||||
{
|
||||
return (Evaluator::evaluate($formula, ['x' => $variable['x'] + self::EPSILON]) - Evaluator::evaluate($formula, ['x' => $variable['x'] - self::EPSILON])) / (2 * self::EPSILON);
|
||||
}
|
||||
|
|
@ -89,7 +89,7 @@ class FiniteDifference
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getFivePointStencil(\string $formula, array $variable, \int $derivative = 1) : \float
|
||||
public static function getFivePointStencil(string $formula, array $variable, int $derivative = 1) : float
|
||||
{
|
||||
if ($derivative === 1) {
|
||||
return (-Evaluator::evaluate($formula, ['x' => $variable['x'] + 2 * self::EPSILON]) + 8 * Evaluator::evaluate($formula, ['x' => $variable['x'] + self::EPSILON]) - 8 * Evaluator::evaluate($formula, ['x' => $variable['x'] - self::EPSILON]) + Evaluator::evaluate($formula, ['x' => $variable['x'] - 2 * self::EPSILON])) / (12 * self::EPSILON);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -31,17 +31,17 @@ class Loan
|
|||
/**
|
||||
* Balloon Loan - Payments
|
||||
*
|
||||
* @param \float $PV Present value
|
||||
* @param \float $r Rate per period
|
||||
* @param \int $n Number of periods
|
||||
* @param \float $balloon Balloon balance
|
||||
* @param float $PV Present value
|
||||
* @param float $r Rate per period
|
||||
* @param int $n Number of periods
|
||||
* @param float $balloon Balloon balance
|
||||
*
|
||||
* @return \float
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public static function getPaymentsOnBalloonLoan(\float $PV, \float $r, \int $n, \float $balloon = 0) : \float
|
||||
public static function getPaymentsOnBalloonLoan(float $PV, float $r, int $n, float $balloon = 0) : float
|
||||
{
|
||||
return ($PV - $balloon / pow(1 + $r, $n)) * $r / (1 - pow(1 + $r, -$n));
|
||||
}
|
||||
|
|
@ -49,17 +49,17 @@ class Loan
|
|||
/**
|
||||
* Loan - Balloon Balance
|
||||
*
|
||||
* @param \float $PV Present value (original balance)
|
||||
* @param \float $P Payment
|
||||
* @param \float $r Rate per payment
|
||||
* @param \int $n Number of payments
|
||||
* @param float $PV Present value (original balance)
|
||||
* @param float $P Payment
|
||||
* @param float $r Rate per payment
|
||||
* @param int $n Number of payments
|
||||
*
|
||||
* @return \float
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public static function getBalloonBalanceOfLoan(\float $PV, \float $P, \float $r, \int $n) : \float
|
||||
public static function getBalloonBalanceOfLoan(float $PV, float $P, float $r, int $n) : float
|
||||
{
|
||||
return $PV * pow(1 + $r, $n) - $P * (pow(1 + $r, $n) - 1) / $r;
|
||||
}
|
||||
|
|
@ -67,16 +67,16 @@ class Loan
|
|||
/**
|
||||
* Loan - Payment
|
||||
*
|
||||
* @param \float $PV Present value (original balance)
|
||||
* @param \float $r Rate per period
|
||||
* @param \int $n Number of periods
|
||||
* @param float $PV Present value (original balance)
|
||||
* @param float $r Rate per period
|
||||
* @param int $n Number of periods
|
||||
*
|
||||
* @return \float
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public static function getLoanPayment(\float $PV, \float $r, \int $n) : \float
|
||||
public static function getLoanPayment(float $PV, float $r, int $n) : float
|
||||
{
|
||||
return $r * $PV / (1 - pow(1 + $r, -$n));
|
||||
}
|
||||
|
|
@ -84,17 +84,17 @@ class Loan
|
|||
/**
|
||||
* Loan - Remaining Balance
|
||||
*
|
||||
* @param \float $PV Present value (original balance)
|
||||
* @param \float $P Payment
|
||||
* @param \float $r Rate per payment
|
||||
* @param \int $n Number of payments
|
||||
* @param float $PV Present value (original balance)
|
||||
* @param float $P Payment
|
||||
* @param float $r Rate per payment
|
||||
* @param int $n Number of payments
|
||||
*
|
||||
* @return \float
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public static function getRemainingBalanceLoan(\float $PV, \float $P, \float $r, \int $n) : \float
|
||||
public static function getRemainingBalanceLoan(float $PV, float $P, float $r, int $n) : float
|
||||
{
|
||||
return $PV * pow(1 + $r, $n) - $P * (pow(1 + $r, $n) - 1) / $r;
|
||||
}
|
||||
|
|
@ -102,15 +102,15 @@ class Loan
|
|||
/**
|
||||
* Loan to Deposit Ratio
|
||||
*
|
||||
* @param \float $loans Loans
|
||||
* @param \float $deposits Deposits
|
||||
* @param float $loans Loans
|
||||
* @param float $deposits Deposits
|
||||
*
|
||||
* @return \float
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public static function getLoanToDepositRatio(\float $loans, \float $deposits) : \float
|
||||
public static function getLoanToDepositRatio(float $loans, float $deposits) : float
|
||||
{
|
||||
return $loans / $deposits;
|
||||
}
|
||||
|
|
@ -118,15 +118,15 @@ class Loan
|
|||
/**
|
||||
* Loan to Value (LTV)
|
||||
*
|
||||
* @param \float $loan Loan amount
|
||||
* @param \float $collateral Value of collateral
|
||||
* @param float $loan Loan amount
|
||||
* @param float $collateral Value of collateral
|
||||
*
|
||||
* @return \float
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public static function getLoanToValueRatio(\float $loan, \float $collateral) : \float
|
||||
public static function getLoanToValueRatio(float $loan, float $collateral) : float
|
||||
{
|
||||
return $loan / $collateral;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,16 +31,16 @@ class StockBonds
|
|||
/**
|
||||
* Bond Equivalent Yield
|
||||
*
|
||||
* @param \float $fv Face value
|
||||
* @param \float $price Price
|
||||
* @param \int $days Days to maturity
|
||||
* @param float $fv Face value
|
||||
* @param float $price Price
|
||||
* @param int $days Days to maturity
|
||||
*
|
||||
* @return \float
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public static function getBondEquivalentYield(\float $fv, \float $price, \int $days) : \float
|
||||
public static function getBondEquivalentYield(float $fv, float $price, int $days) : float
|
||||
{
|
||||
return ($fv - $price) / $price * 365 / $days;
|
||||
}
|
||||
|
|
@ -48,15 +48,15 @@ class StockBonds
|
|||
/**
|
||||
* Book Value per Share
|
||||
*
|
||||
* @param \float $total Total common stockholder's Equity
|
||||
* @param \int $common Number of common shares
|
||||
* @param float $total Total common stockholder's Equity
|
||||
* @param int $common Number of common shares
|
||||
*
|
||||
* @return \float
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public static function getBookValuePerShare(\float $total, \int $common) : \float
|
||||
public static function getBookValuePerShare(float $total, int $common) : float
|
||||
{
|
||||
return $total / $common;
|
||||
}
|
||||
|
|
@ -64,16 +64,16 @@ class StockBonds
|
|||
/**
|
||||
* Capital Asset Pricing Model (CAPM)
|
||||
*
|
||||
* @param \float $rf Risk free rate
|
||||
* @param \float $beta Risk to invest in a stock relative to the risk of the market
|
||||
* @param \float $r Return on the market
|
||||
* @param float $rf Risk free rate
|
||||
* @param float $beta Risk to invest in a stock relative to the risk of the market
|
||||
* @param float $r Return on the market
|
||||
*
|
||||
* @return \float
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public static function getExpectedReturnCAPM(\float $rf, \float $beta, \float $r) : \float
|
||||
public static function getExpectedReturnCAPM(float $rf, float $beta, float $r) : float
|
||||
{
|
||||
return $rf + $beta * ($r - $rf);
|
||||
}
|
||||
|
|
@ -81,15 +81,15 @@ class StockBonds
|
|||
/**
|
||||
* Capital Gains Yield
|
||||
*
|
||||
* @param \float $P0 Old stock price
|
||||
* @param \float $P1 New stock price
|
||||
* @param float $P0 Old stock price
|
||||
* @param float $P1 New stock price
|
||||
*
|
||||
* @return \float
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public static function getCapitalGainsYield(\float $P0, \float $P1) : \float
|
||||
public static function getCapitalGainsYield(float $P0, float $P1) : float
|
||||
{
|
||||
return $P1 / $P0 - 1;
|
||||
}
|
||||
|
|
@ -97,15 +97,15 @@ class StockBonds
|
|||
/**
|
||||
* Current Yield
|
||||
*
|
||||
* @param \float $coupons Annual coupons
|
||||
* @param \float $price Current bond price
|
||||
* @param float $coupons Annual coupons
|
||||
* @param float $price Current bond price
|
||||
*
|
||||
* @return \float
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public static function getCurrentYield(\float $coupons, \float $price) : \float
|
||||
public static function getCurrentYield(float $coupons, float $price) : float
|
||||
{
|
||||
return $coupons / $price;
|
||||
}
|
||||
|
|
@ -113,16 +113,16 @@ class StockBonds
|
|||
/**
|
||||
* Diluted Earnings per Share
|
||||
*
|
||||
* @param \float $income Net Income
|
||||
* @param \float $avg Avg. shares
|
||||
* @param \float $other Other convertible instruments
|
||||
* @param float $income Net Income
|
||||
* @param float $avg Avg. shares
|
||||
* @param float $other Other convertible instruments
|
||||
*
|
||||
* @return \float
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public static function getDilutedEarningsPerShare(\float $income, \float $avg, \float $other) : \float
|
||||
public static function getDilutedEarningsPerShare(float $income, float $avg, float $other) : float
|
||||
{
|
||||
return $income / ($avg + $other);
|
||||
}
|
||||
|
|
@ -130,15 +130,15 @@ class StockBonds
|
|||
/**
|
||||
* Dividend Payout Ratio
|
||||
*
|
||||
* @param \float $dividends Dividends
|
||||
* @param \float $income Net income
|
||||
* @param float $dividends Dividends
|
||||
* @param float $income Net income
|
||||
*
|
||||
* @return \float
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public static function getDividendPayoutRatio(\float $dividends, \float $income) : \float
|
||||
public static function getDividendPayoutRatio(float $dividends, float $income) : float
|
||||
{
|
||||
return $dividends / $income;
|
||||
}
|
||||
|
|
@ -146,15 +146,15 @@ class StockBonds
|
|||
/**
|
||||
* Dividend Yield
|
||||
*
|
||||
* @param \float $dividends Dividends
|
||||
* @param \float $price Initial price for the period
|
||||
* @param float $dividends Dividends
|
||||
* @param float $price Initial price for the period
|
||||
*
|
||||
* @return \float
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public static function getDividendYield(\float $dividends, \float $price) : \float
|
||||
public static function getDividendYield(float $dividends, float $price) : float
|
||||
{
|
||||
return $dividends / $price;
|
||||
}
|
||||
|
|
@ -162,15 +162,15 @@ class StockBonds
|
|||
/**
|
||||
* Dividend Yield
|
||||
*
|
||||
* @param \float $dividends Dividends
|
||||
* @param \int $shares Initial price for the period
|
||||
* @param float $dividends Dividends
|
||||
* @param int $shares Initial price for the period
|
||||
*
|
||||
* @return \float
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public static function getDividendsPerShare(\float $dividends, \int $shares) : \float
|
||||
public static function getDividendsPerShare(float $dividends, int $shares) : float
|
||||
{
|
||||
return $dividends / $shares;
|
||||
}
|
||||
|
|
@ -178,15 +178,15 @@ class StockBonds
|
|||
/**
|
||||
* Earnings Per Share
|
||||
*
|
||||
* @param \float $income Net income
|
||||
* @param \float $shares Weighted avg. outstanding shares
|
||||
* @param float $income Net income
|
||||
* @param float $shares Weighted avg. outstanding shares
|
||||
*
|
||||
* @return \float
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public static function getEarningsPerShare(\float $income, \float $shares) : \float
|
||||
public static function getEarningsPerShare(float $income, float $shares) : float
|
||||
{
|
||||
return $income / $shares;
|
||||
}
|
||||
|
|
@ -194,15 +194,15 @@ class StockBonds
|
|||
/**
|
||||
* Equity Multiplier
|
||||
*
|
||||
* @param \float $assets Total assets
|
||||
* @param \float $equity Stockholder's equity
|
||||
* @param float $assets Total assets
|
||||
* @param float $equity Stockholder's equity
|
||||
*
|
||||
* @return \float
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public static function getEquityMultiplier(\float $assets, \float $equity) : \float
|
||||
public static function getEquityMultiplier(float $assets, float $equity) : float
|
||||
{
|
||||
return $assets / $equity;
|
||||
}
|
||||
|
|
@ -212,12 +212,12 @@ class StockBonds
|
|||
*
|
||||
* @param array $r Rate of return
|
||||
*
|
||||
* @return \float
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public static function getHoldingPeriodReturn(array $r) : \float
|
||||
public static function getHoldingPeriodReturn(array $r) : float
|
||||
{
|
||||
$hpr = 1.0;
|
||||
|
||||
|
|
@ -231,16 +231,16 @@ class StockBonds
|
|||
/**
|
||||
* Net Asset Value
|
||||
*
|
||||
* @param \float $assets Fund assets
|
||||
* @param \float $liabilities Fund liabilities
|
||||
* @param \int $shares Outstanding shares
|
||||
* @param float $assets Fund assets
|
||||
* @param float $liabilities Fund liabilities
|
||||
* @param int $shares Outstanding shares
|
||||
*
|
||||
* @return \float
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public static function getNetAssetValue(\float $assets, \float $liabilities, \int $shares) : \float
|
||||
public static function getNetAssetValue(float $assets, float $liabilities, int $shares) : float
|
||||
{
|
||||
return ($assets - $liabilities) / $shares;
|
||||
}
|
||||
|
|
@ -248,15 +248,15 @@ class StockBonds
|
|||
/**
|
||||
* Price to Book Value
|
||||
*
|
||||
* @param \float $market Market price per share
|
||||
* @param \float $book Book value per share
|
||||
* @param float $market Market price per share
|
||||
* @param float $book Book value per share
|
||||
*
|
||||
* @return \float
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public static function getPriceToBookValue(\float $market, \float $book) : \float
|
||||
public static function getPriceToBookValue(float $market, float $book) : float
|
||||
{
|
||||
return $market / $book;
|
||||
}
|
||||
|
|
@ -264,15 +264,15 @@ class StockBonds
|
|||
/**
|
||||
* Price to Earnings (P/E Ratio)
|
||||
*
|
||||
* @param \float $price Price per share
|
||||
* @param \float $earnings Earnings per share
|
||||
* @param float $price Price per share
|
||||
* @param float $earnings Earnings per share
|
||||
*
|
||||
* @return \float
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public static function getPriceEarningsRatio(\float $price, \float $earnings) : \float
|
||||
public static function getPriceEarningsRatio(float $price, float $earnings) : float
|
||||
{
|
||||
return $price / $earnings;
|
||||
}
|
||||
|
|
@ -280,15 +280,15 @@ class StockBonds
|
|||
/**
|
||||
* Price to Sales (P/S Ratio)
|
||||
*
|
||||
* @param \float $price Price per share
|
||||
* @param \float $sales Sales per share
|
||||
* @param float $price Price per share
|
||||
* @param float $sales Sales per share
|
||||
*
|
||||
* @return \float
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public static function getPriceToSalesRatio(\float $price, \float $sales) : \float
|
||||
public static function getPriceToSalesRatio(float $price, float $sales) : float
|
||||
{
|
||||
return $price / $sales;
|
||||
}
|
||||
|
|
@ -296,16 +296,16 @@ class StockBonds
|
|||
/**
|
||||
* Stock - PV with Constant Growth
|
||||
*
|
||||
* @param \float $dividend Estimated dividends for next period
|
||||
* @param \float $r Required rate of return
|
||||
* @param \float $g Growth rate
|
||||
* @param float $dividend Estimated dividends for next period
|
||||
* @param float $r Required rate of return
|
||||
* @param float $g Growth rate
|
||||
*
|
||||
* @return \float
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public static function getPresentValueOfStockConstantGrowth(\float $dividend, \float $r, \float $g = 0.0) : \float
|
||||
public static function getPresentValueOfStockConstantGrowth(float $dividend, float $r, float $g = 0.0) : float
|
||||
{
|
||||
return $dividend / ($r - $g);
|
||||
}
|
||||
|
|
@ -313,15 +313,15 @@ class StockBonds
|
|||
/**
|
||||
* Tax Equivalent Yield
|
||||
*
|
||||
* @param \float $free Tax free yield
|
||||
* @param \float $tax Tax rate
|
||||
* @param float $free Tax free yield
|
||||
* @param float $tax Tax rate
|
||||
*
|
||||
* @return \float
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public static function getTaxEquivalentYield(\float $free, \float $tax) : \float
|
||||
public static function getTaxEquivalentYield(float $free, float $tax) : float
|
||||
{
|
||||
return $free / (1 - $tax);
|
||||
}
|
||||
|
|
@ -329,16 +329,16 @@ class StockBonds
|
|||
/**
|
||||
* Total Stock Return
|
||||
*
|
||||
* @param \float $P0 Initial stock price
|
||||
* @param \float $P1 Ending stock price
|
||||
* @param \float $D Dividends
|
||||
* @param float $P0 Initial stock price
|
||||
* @param float $P1 Ending stock price
|
||||
* @param float $D Dividends
|
||||
*
|
||||
* @return \float
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public static function getTotalStockReturn(\float $P0, \float $P1, \float $D) : \float
|
||||
public static function getTotalStockReturn(float $P0, float $P1, float $D) : float
|
||||
{
|
||||
return ($P1 - $P0 + $D) / $P0;
|
||||
}
|
||||
|
|
@ -346,17 +346,17 @@ class StockBonds
|
|||
/**
|
||||
* Yield to Maturity
|
||||
*
|
||||
* @param \float $C Coupon/interest payment
|
||||
* @param \float $F Face value
|
||||
* @param \float $P Price
|
||||
* @param \int $n Years to maturity
|
||||
* @param float $C Coupon/interest payment
|
||||
* @param float $F Face value
|
||||
* @param float $P Price
|
||||
* @param int $n Years to maturity
|
||||
*
|
||||
* @return \float
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public static function getYieldToMaturity(\float $C, \float $F, \float $P, \int $n) : \float
|
||||
public static function getYieldToMaturity(float $C, float $F, float $P, int $n) : float
|
||||
{
|
||||
return ($C + ($F - $P) / $n) / (($F + $P) / 2);
|
||||
}
|
||||
|
|
@ -364,16 +364,16 @@ class StockBonds
|
|||
/**
|
||||
* Zero Coupon Bond Value
|
||||
*
|
||||
* @param \float $F Face value
|
||||
* @param \float $r Rate or yield
|
||||
* @param \int $t Time to maturity
|
||||
* @param float $F Face value
|
||||
* @param float $r Rate or yield
|
||||
* @param int $t Time to maturity
|
||||
*
|
||||
* @return \float
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public static function getZeroCouponBondValue(\float $F, \float $r, \int $t) : \float
|
||||
public static function getZeroCouponBondValue(float $F, float $r, int $t) : float
|
||||
{
|
||||
return $F / pow(1 + $r, $t);
|
||||
}
|
||||
|
|
@ -381,16 +381,16 @@ class StockBonds
|
|||
/**
|
||||
* Zero Coupon Bond Effective Yield
|
||||
*
|
||||
* @param \float $F Face value
|
||||
* @param \float $PV Present value
|
||||
* @param \int $n Time to maturity
|
||||
* @param float $F Face value
|
||||
* @param float $PV Present value
|
||||
* @param int $n Time to maturity
|
||||
*
|
||||
* @return \float
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public static function getZeroCouponBondEffectiveYield(\float $F, \float $PV, \int $n) : \float
|
||||
public static function getZeroCouponBondEffectiveYield(float $F, float $PV, int $n) : float
|
||||
{
|
||||
return pow($F / $PV, 1 / $n) - 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class Functions
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getGammaInteger(\int $k) : \int
|
||||
public static function getGammaInteger(int $k) : int
|
||||
{
|
||||
return self::fact($k - 1);
|
||||
}
|
||||
|
|
@ -59,7 +59,7 @@ class Functions
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function fact(\int $n, \int $start = 1) : \int
|
||||
public static function fact(int $n, int $start = 1) : int
|
||||
{
|
||||
$fact = 1;
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ class Functions
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function binomialCoefficient(\int $n, \int $k) : \int
|
||||
public static function binomialCoefficient(int $n, int $k) : int
|
||||
{
|
||||
$max = max([$k, $n - $k]);
|
||||
$min = min([$k, $n - $k]);
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ class BruteForce
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getSolution(\int $limit = 1) : Population
|
||||
public function getSolution(int $limit = 1) : Population
|
||||
{
|
||||
$population = new Population($this->cityPool, $limit, true);
|
||||
$cities = $this->cityPool->getCities();
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ class City
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function __construct(\float $lat, \float $long, \string $name)
|
||||
public function __construct(float $lat, float $long, string $name)
|
||||
{
|
||||
$this->long = $long;
|
||||
$this->lat = $lat;
|
||||
|
|
@ -79,7 +79,7 @@ class City
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getLongitude() : \float
|
||||
public function getLongitude() : float
|
||||
{
|
||||
return $this->long;
|
||||
}
|
||||
|
|
@ -92,7 +92,7 @@ class City
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getLatitude() : \float
|
||||
public function getLatitude() : float
|
||||
{
|
||||
return $this->lat;
|
||||
}
|
||||
|
|
@ -105,7 +105,7 @@ class City
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getName() : \string
|
||||
public function getName() : string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
|
@ -120,7 +120,7 @@ class City
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function equals(City $city) : \bool
|
||||
public function equals(City $city) : bool
|
||||
{
|
||||
return $this->name === $city->getName() && $this->lat === $city->getLatitude() && $this->long === $city->getLatitude();
|
||||
}
|
||||
|
|
@ -135,7 +135,7 @@ class City
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getDistanceTo(City $city) : \float
|
||||
public function getDistanceTo(City $city) : float
|
||||
{
|
||||
return Sphere::distance2PointsOnSphere($this->lat, $this->long, $city->getLatitude(), $city->getLongitude());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ class CityPool implements \Countable
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getCity(\int $index) : City
|
||||
public function getCity(int $index) : City
|
||||
{
|
||||
return array_values($this->cities)[$index];
|
||||
}
|
||||
|
|
@ -96,12 +96,12 @@ class CityPool implements \Countable
|
|||
*
|
||||
* @param City $city City
|
||||
*
|
||||
* @return \bool
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function hasCity(City $city) : \bool
|
||||
public function hasCity(City $city) : bool
|
||||
{
|
||||
foreach ($this->cities as $c) {
|
||||
if ($c->equals($city)) {
|
||||
|
|
@ -115,12 +115,12 @@ class CityPool implements \Countable
|
|||
/**
|
||||
* Count cities
|
||||
*
|
||||
* @return \int
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function count() : \int
|
||||
public function count() : int
|
||||
{
|
||||
return count($this->cities);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class Population implements \Countable
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function __construct(CityPool $pool, \int $size, \bool $initialize = false)
|
||||
public function __construct(CityPool $pool, int $size, bool $initialize = false)
|
||||
{
|
||||
if ($initialize) {
|
||||
for ($i = 0; $i < $size; $i++) {
|
||||
|
|
@ -65,7 +65,7 @@ class Population implements \Countable
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function insertTourAt(\int $index, Tour $tour)
|
||||
public function insertTourAt(int $index, Tour $tour)
|
||||
{
|
||||
$this->tours = array_slice($this->tours, 0, $index) + [$tour] + array_slice($this->tours, $index);
|
||||
}
|
||||
|
|
@ -79,7 +79,7 @@ class Population implements \Countable
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setTour(\int $index, Tour $tour)
|
||||
public function setTour(int $index, Tour $tour)
|
||||
{
|
||||
$this->tours[$index] = $tour;
|
||||
asort($this->tours);
|
||||
|
|
@ -108,7 +108,7 @@ class Population implements \Countable
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getTour(\int $index)
|
||||
public function getTour(int $index)
|
||||
{
|
||||
return $this->tours[$index] ?? null;
|
||||
}
|
||||
|
|
@ -165,7 +165,7 @@ class Population implements \Countable
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function count() : \int
|
||||
public function count() : int
|
||||
{
|
||||
return count($this->tours);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ class Tour implements \Countable
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function __construct(CityPool $pool, \bool $initialize = false)
|
||||
public function __construct(CityPool $pool, bool $initialize = false)
|
||||
{
|
||||
$this->cityPool = $pool;
|
||||
|
||||
|
|
@ -103,7 +103,7 @@ class Tour implements \Countable
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getFitness() : \float
|
||||
public function getFitness() : float
|
||||
{
|
||||
if ($this->fitness === 0.0 && ($distance = $this->getDistance()) !== 0.0) {
|
||||
$this->fitness = 1 / $distance;
|
||||
|
|
@ -137,7 +137,7 @@ class Tour implements \Countable
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setCity(\int $index, City $city)
|
||||
public function setCity(int $index, City $city)
|
||||
{
|
||||
$this->cities[$index] = $city;
|
||||
asort($this->cities);
|
||||
|
|
@ -154,7 +154,7 @@ class Tour implements \Countable
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getDistance() : \float
|
||||
public function getDistance() : float
|
||||
{
|
||||
if ($this->distance === 0.0) {
|
||||
$distance = 0.0;
|
||||
|
|
@ -178,12 +178,12 @@ class Tour implements \Countable
|
|||
*
|
||||
* @param City $city City
|
||||
*
|
||||
* @return \bool
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function hasCity(City $city) : \bool
|
||||
public function hasCity(City $city) : bool
|
||||
{
|
||||
foreach ($this->cities as $c) {
|
||||
if ($c->equals($city)) {
|
||||
|
|
@ -202,7 +202,7 @@ class Tour implements \Countable
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function count() : \int
|
||||
public function count() : int
|
||||
{
|
||||
return count($this->cities);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class Circle
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getArea(\float $r)
|
||||
public static function getArea(float $r)
|
||||
{
|
||||
return pi() * $r ** 2;
|
||||
}
|
||||
|
|
@ -54,7 +54,7 @@ class Circle
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getCircumference(\float $r)
|
||||
public static function getCircumference(float $r)
|
||||
{
|
||||
return 2 * pi() * $r;
|
||||
}
|
||||
|
|
@ -69,7 +69,7 @@ class Circle
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getRadiusByArea(\float $area)
|
||||
public static function getRadiusByArea(float $area)
|
||||
{
|
||||
return sqrt($area / pi());
|
||||
}
|
||||
|
|
@ -84,7 +84,7 @@ class Circle
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getRadiusByCircumference(\float $C)
|
||||
public static function getRadiusByCircumference(float $C)
|
||||
{
|
||||
return $C / (2 * pi());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class Ellipse
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getArea(\float $a, \float $b)
|
||||
public static function getArea(float $a, float $b)
|
||||
{
|
||||
return pi() * $a * $b;
|
||||
}
|
||||
|
|
@ -66,7 +66,7 @@ class Ellipse
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getCircumference(\float $a, \float $b)
|
||||
public static function getCircumference(float $a, float $b)
|
||||
{
|
||||
return pi() * ($a + $b) * (3 * ($a - $b) ** 2 / (($a + $b) ** 2 * (sqrt(-3 * ($a - $b) ** 2 / (($a + $b) ** 2) + 4) + 10)) + 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class Polygon implements Shape2DInterface
|
|||
/**
|
||||
* Polygon perimeter.
|
||||
*
|
||||
* @var \float
|
||||
* @var float
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $perimeter = null;
|
||||
|
|
@ -52,7 +52,7 @@ class Polygon implements Shape2DInterface
|
|||
/**
|
||||
* Polygon surface.
|
||||
*
|
||||
* @var \float
|
||||
* @var float
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $surface = null;
|
||||
|
|
@ -60,7 +60,7 @@ class Polygon implements Shape2DInterface
|
|||
/**
|
||||
* Interior angle sum of the polygon.
|
||||
*
|
||||
* @var \float
|
||||
* @var float
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $interiorAngleSum = null;
|
||||
|
|
@ -68,7 +68,7 @@ class Polygon implements Shape2DInterface
|
|||
/**
|
||||
* Exterior angle sum of the polygon.
|
||||
*
|
||||
* @var \float
|
||||
* @var float
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $exteriorAngleSum = null;
|
||||
|
|
@ -76,7 +76,7 @@ class Polygon implements Shape2DInterface
|
|||
/**
|
||||
* Polygon barycenter.
|
||||
*
|
||||
* @var \float[]
|
||||
* @var float[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $barycenter = null;
|
||||
|
|
@ -84,7 +84,7 @@ class Polygon implements Shape2DInterface
|
|||
/**
|
||||
* Polygon edge length.
|
||||
*
|
||||
* @var \float
|
||||
* @var float
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $edgeLength = [];
|
||||
|
|
@ -92,7 +92,7 @@ class Polygon implements Shape2DInterface
|
|||
/**
|
||||
* Polygon inner length.
|
||||
*
|
||||
* @var \float
|
||||
* @var float
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $innerLength = null;
|
||||
|
|
@ -100,7 +100,7 @@ class Polygon implements Shape2DInterface
|
|||
/**
|
||||
* Polygon inner edge angular.
|
||||
*
|
||||
* @var \float
|
||||
* @var float
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $innerEdgeAngular = null;
|
||||
|
|
@ -133,9 +133,9 @@ class Polygon implements Shape2DInterface
|
|||
/**
|
||||
* Set polygon coordinate.
|
||||
*
|
||||
* @param \int $i Index
|
||||
* @param \int|\float $x X coordinate
|
||||
* @param \int|\float $y Y coordinate
|
||||
* @param int $i Index
|
||||
* @param int|float $x X coordinate
|
||||
* @param int|float $y Y coordinate
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class Rectangle
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getArea(\float $a, \float $b)
|
||||
public static function getArea(float $a, float $b)
|
||||
{
|
||||
return $a * $b;
|
||||
}
|
||||
|
|
@ -56,7 +56,7 @@ class Rectangle
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getPerimeter(\float $a, \float $b)
|
||||
public static function getPerimeter(float $a, float $b)
|
||||
{
|
||||
return 2 * ($a + $b);
|
||||
}
|
||||
|
|
@ -72,7 +72,7 @@ class Rectangle
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getDiagonal(\float $a, \float $b)
|
||||
public static function getDiagonal(float $a, float $b)
|
||||
{
|
||||
return sqrt($a * $a + $b * $b);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class Trapezoid
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getArea(\float $a, \float $b, \float $h)
|
||||
public static function getArea(float $a, float $b, float $h)
|
||||
{
|
||||
return ($a + $b) / 2 * $h;
|
||||
}
|
||||
|
|
@ -71,7 +71,7 @@ class Trapezoid
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getPerimeter(\float $a, \float $b, \float $c, \float $d)
|
||||
public static function getPerimeter(float $a, float $b, float $c, float $d)
|
||||
{
|
||||
return $a + $b + $c + $d;
|
||||
}
|
||||
|
|
@ -94,7 +94,7 @@ class Trapezoid
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getHeight(\float $area, \float $a, \float $b)
|
||||
public static function getHeight(float $area, float $a, float $b)
|
||||
{
|
||||
return 2 * $area / ($a + $b);
|
||||
}
|
||||
|
|
@ -117,7 +117,7 @@ class Trapezoid
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getA(\float $area, \float $h, \float $b)
|
||||
public static function getA(float $area, float $h, float $b)
|
||||
{
|
||||
return 2 * $area / $h - $b;
|
||||
}
|
||||
|
|
@ -140,7 +140,7 @@ class Trapezoid
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getB(\float $area, \float $h, \float $a)
|
||||
public static function getB(float $area, float $h, float $a)
|
||||
{
|
||||
return 2 * $area / $h - $a;
|
||||
}
|
||||
|
|
@ -164,7 +164,7 @@ class Trapezoid
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getC(\float $perimeter, \float $a, \float $b, \float $d)
|
||||
public static function getC(float $perimeter, float $a, float $b, float $d)
|
||||
{
|
||||
return $perimeter - $a - $b - $d;
|
||||
}
|
||||
|
|
@ -188,7 +188,7 @@ class Trapezoid
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getD(\float $perimeter, \float $a, \float $b, \float $c)
|
||||
public static function getD(float $perimeter, float $a, float $b, float $c)
|
||||
{
|
||||
return $perimeter - $a - $b - $c;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class Triangle
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getArea(\float $b, \float $h)
|
||||
public static function getArea(float $b, float $h)
|
||||
{
|
||||
return $h * $b / 2;
|
||||
}
|
||||
|
|
@ -63,7 +63,7 @@ class Triangle
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getPerimeter(\float $a, \float $b, \float $c)
|
||||
public static function getPerimeter(float $a, float $b, float $c)
|
||||
{
|
||||
return $a + $b + $c;
|
||||
}
|
||||
|
|
@ -79,7 +79,7 @@ class Triangle
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getHeight(\float $area, \float $b)
|
||||
public static function getHeight(float $area, float $b)
|
||||
{
|
||||
return 2 * $area / $b;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class Cone
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getVolume(\float $r, \float $h)
|
||||
public static function getVolume(float $r, float $h)
|
||||
{
|
||||
return pi() * $r ** 2 * $h / 3;
|
||||
}
|
||||
|
|
@ -56,7 +56,7 @@ class Cone
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getSurface(\float $r, \float $h)
|
||||
public static function getSurface(float $r, float $h)
|
||||
{
|
||||
return pi() * $r * ($r + sqrt($h ** 2 + $r ** 2));
|
||||
}
|
||||
|
|
@ -72,7 +72,7 @@ class Cone
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getSlantHeight(\float $r, \float $h)
|
||||
public static function getSlantHeight(float $r, float $h)
|
||||
{
|
||||
return sqrt($h ** 2 + $r ** 2);
|
||||
}
|
||||
|
|
@ -88,7 +88,7 @@ class Cone
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getHeight(\float $V, \float $r)
|
||||
public static function getHeight(float $V, float $r)
|
||||
{
|
||||
return 4 * $V / (pi() * $r ** 2);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class Cuboid
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getVolume(\float $a, \float $b, \float $h)
|
||||
public static function getVolume(float $a, float $b, float $h)
|
||||
{
|
||||
return $a * $b * $h;
|
||||
}
|
||||
|
|
@ -58,7 +58,7 @@ class Cuboid
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getSurface(\float $a, \float $b, \float $h)
|
||||
public static function getSurface(float $a, float $b, float $h)
|
||||
{
|
||||
return 2 * ($a * $b + $a * $h + $b * $h);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class Cylinder
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getVolume(\float $r, \float $h)
|
||||
public static function getVolume(float $r, float $h)
|
||||
{
|
||||
return pi() * $r ** 2 * $h;
|
||||
}
|
||||
|
|
@ -56,7 +56,7 @@ class Cylinder
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getSurface(\float $r, \float $h)
|
||||
public static function getSurface(float $r, float $h)
|
||||
{
|
||||
return 2 * pi() * ($r * $h + $r ** 2);
|
||||
}
|
||||
|
|
@ -72,7 +72,7 @@ class Cylinder
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getLateralSurface(\float $r, \float $h)
|
||||
public static function getLateralSurface(float $r, float $h)
|
||||
{
|
||||
return 2 * pi() * $r * $h;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class RectangularPyramid
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getVolume(\float $a, \float $b, \float $h)
|
||||
public static function getVolume(float $a, float $b, float $h)
|
||||
{
|
||||
return $a * $b * $h / 3;
|
||||
}
|
||||
|
|
@ -58,7 +58,7 @@ class RectangularPyramid
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getSurface(\float $a, \float $b, \float $h)
|
||||
public static function getSurface(float $a, float $b, float $h)
|
||||
{
|
||||
return $a * $b + $a * sqrt(($b / 2) ** 2 + $h ** 2) + $b * sqrt(($a / 2) ** 2 + $h ** 2);
|
||||
}
|
||||
|
|
@ -75,7 +75,7 @@ class RectangularPyramid
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getLateralSurface(\float $a, \float $b, \float $h)
|
||||
public static function getLateralSurface(float $a, float $b, float $h)
|
||||
{
|
||||
return $a * sqrt(($b / 2) ** 2 + $h ** 2) + $b * sqrt(($a / 2) ** 2 + $h ** 2);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class Sphere
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function distance2PointsOnSphere(\float $latStart, \float $longStart, \float $latEnd, \float $longEnd, \float $radius = 6371000.0) : \float
|
||||
public static function distance2PointsOnSphere(float $latStart, float $longStart, float $latEnd, float $longEnd, float $radius = 6371000.0) : float
|
||||
{
|
||||
$latFrom = deg2rad($latStart);
|
||||
$lonFrom = deg2rad($longStart);
|
||||
|
|
@ -73,7 +73,7 @@ class Sphere
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getVolume(\float $r)
|
||||
public static function getVolume(float $r)
|
||||
{
|
||||
return 4 / 3 * pi() * $r ** 3;
|
||||
}
|
||||
|
|
@ -88,7 +88,7 @@ class Sphere
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getRadiusByVolume(\float $V)
|
||||
public static function getRadiusByVolume(float $V)
|
||||
{
|
||||
return pow($V * 3 / (4 * pi()), 1 / 3);
|
||||
}
|
||||
|
|
@ -103,7 +103,7 @@ class Sphere
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getSurface(\float $r)
|
||||
public static function getSurface(float $r)
|
||||
{
|
||||
return 4 * pi() * $r ** 2;
|
||||
}
|
||||
|
|
@ -118,7 +118,7 @@ class Sphere
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getRadiusBySurface(\float $S)
|
||||
public static function getRadiusBySurface(float $S)
|
||||
{
|
||||
return sqrt($S / (4 * pi()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class Tetrahedron
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getVolume(\float $a)
|
||||
public static function getVolume(float $a)
|
||||
{
|
||||
return $a ** 3 / (6 * sqrt(2));
|
||||
}
|
||||
|
|
@ -54,7 +54,7 @@ class Tetrahedron
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getSurface(\float $a)
|
||||
public static function getSurface(float $a)
|
||||
{
|
||||
return sqrt(3) * $a ** 2;
|
||||
}
|
||||
|
|
@ -69,7 +69,7 @@ class Tetrahedron
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getFaceArea(\float $a)
|
||||
public static function getFaceArea(float $a)
|
||||
{
|
||||
return sqrt(3) / 4 * $a ** 2;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class Average
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function weightedAverage(array $values, array $weight) : \float
|
||||
public static function weightedAverage(array $values, array $weight) : float
|
||||
{
|
||||
if (($count = count($values)) !== count($weight)) {
|
||||
throw new \Exception('Dimension');
|
||||
|
|
@ -93,7 +93,7 @@ class Average
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function median(array $values) : \float
|
||||
public static function median(array $values) : float
|
||||
{
|
||||
sort($values);
|
||||
$count = count($values);
|
||||
|
|
@ -116,7 +116,7 @@ class Average
|
|||
* Example: ([1, 2, 2, 3, 4, 4, 2])
|
||||
*
|
||||
* @param array $values Values
|
||||
* @param \int $offset Offset for outlier
|
||||
* @param int $offset Offset for outlier
|
||||
*
|
||||
* @return float
|
||||
*
|
||||
|
|
@ -125,7 +125,7 @@ class Average
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function arithmeticMean(array $values, \int $offset = 0)
|
||||
public static function arithmeticMean(array $values, int $offset = 0)
|
||||
{
|
||||
sort($values);
|
||||
|
||||
|
|
@ -148,7 +148,7 @@ class Average
|
|||
* Example: ([1, 2, 2, 3, 4, 4, 2])
|
||||
*
|
||||
* @param array $values Values
|
||||
* @param \int $offset Offset for outlier
|
||||
* @param int $offset Offset for outlier
|
||||
*
|
||||
* @return float
|
||||
*
|
||||
|
|
@ -157,7 +157,7 @@ class Average
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function geometricMean(array $values, \int $offset = 0)
|
||||
public static function geometricMean(array $values, int $offset = 0)
|
||||
{
|
||||
sort($values);
|
||||
|
||||
|
|
@ -180,7 +180,7 @@ class Average
|
|||
* Example: ([1, 2, 2, 3, 4, 4, 2])
|
||||
*
|
||||
* @param array $values Values
|
||||
* @param \int $offset Offset for outlier
|
||||
* @param int $offset Offset for outlier
|
||||
*
|
||||
* @return float
|
||||
*
|
||||
|
|
@ -189,7 +189,7 @@ class Average
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function harmonicMean(array $values, \int $offset = 0)
|
||||
public static function harmonicMean(array $values, int $offset = 0)
|
||||
{
|
||||
sort($values);
|
||||
|
||||
|
|
@ -217,14 +217,14 @@ class Average
|
|||
* Example: ([1, 2, 2, 3, 4, 4, 2])
|
||||
*
|
||||
* @param array $angles Angles
|
||||
* @param \int $offset Offset for outlier
|
||||
* @param int $offset Offset for outlier
|
||||
*
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function angleMean($angles, \int $offset = 0)
|
||||
public static function angleMean($angles, int $offset = 0)
|
||||
{
|
||||
sort($angles);
|
||||
|
||||
|
|
@ -260,7 +260,7 @@ class Average
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function timeToAngle(\string $time) : \float
|
||||
public static function timeToAngle(string $time) : float
|
||||
{
|
||||
$parts = explode(':', $time);
|
||||
|
||||
|
|
@ -288,7 +288,7 @@ class Average
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function angleToTime(\float $angle) : \string
|
||||
public static function angleToTime(float $angle) : string
|
||||
{
|
||||
$sec = 86400.0 * $angle / 360.0;
|
||||
$time = sprintf('%02d:%02d:%02d', floor($sec / 3600), floor(($sec % 3600) / 60), $sec % 60);
|
||||
|
|
@ -302,14 +302,14 @@ class Average
|
|||
* Example: ([1, 2, 2, 3, 4, 4, 2])
|
||||
*
|
||||
* @param array $angles Angles
|
||||
* @param \int $offset Offset for outlier
|
||||
* @param int $offset Offset for outlier
|
||||
*
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function angleMean2(array $angles, \int $offset = 0)
|
||||
public static function angleMean2(array $angles, int $offset = 0)
|
||||
{
|
||||
sort($angles);
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class MeasureOfDispersion
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function range(array $values) : \float
|
||||
public static function range(array $values) : float
|
||||
{
|
||||
sort($values);
|
||||
$end = end($values);
|
||||
|
|
@ -65,7 +65,7 @@ class MeasureOfDispersion
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function empiricalVariance(array $values) : \float
|
||||
public static function empiricalVariance(array $values) : float
|
||||
{
|
||||
$count = count($values);
|
||||
|
||||
|
|
@ -97,7 +97,7 @@ class MeasureOfDispersion
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function sampleVariance(array $values) : \float
|
||||
public static function sampleVariance(array $values) : float
|
||||
{
|
||||
$count = count($values);
|
||||
|
||||
|
|
@ -120,7 +120,7 @@ class MeasureOfDispersion
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function standardDeviation(array $values) : \float
|
||||
public static function standardDeviation(array $values) : float
|
||||
{
|
||||
return sqrt(self::sampleVariance($values));
|
||||
}
|
||||
|
|
@ -139,7 +139,7 @@ class MeasureOfDispersion
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function empiricalVariationcoefficient(array $values) : \float
|
||||
public static function empiricalVariationcoefficient(array $values) : float
|
||||
{
|
||||
$mean = Average::arithmeticMean($values);
|
||||
|
||||
|
|
@ -165,7 +165,7 @@ class MeasureOfDispersion
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function empiricalCovariance(array $x, array $y) : \float
|
||||
public static function empiricalCovariance(array $x, array $y) : float
|
||||
{
|
||||
$count = count($x);
|
||||
|
||||
|
|
@ -202,7 +202,7 @@ class MeasureOfDispersion
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function bravaisPersonCorrelationcoefficient(array $x, array $y) : \float
|
||||
public static function bravaisPersonCorrelationcoefficient(array $x, array $y) : float
|
||||
{
|
||||
return self::empiricalCovariance($x, $y) / sqrt(self::empiricalCovariance($x, $x) * self::empiricalCovariance($y, $y));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class BernulliDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getPmf(\float $p, \int $k) : \float
|
||||
public static function getPmf(float $p, int $k) : float
|
||||
{
|
||||
if ($k === 0) {
|
||||
return 1 - $p;
|
||||
|
|
@ -56,14 +56,14 @@ class BernulliDistribution
|
|||
/**
|
||||
* Get mode.
|
||||
*
|
||||
* @param \float $p
|
||||
* @param float $p
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMode(\float $p) : \int
|
||||
public static function getMode(float $p) : int
|
||||
{
|
||||
if ($p === 0.5) {
|
||||
return 0;
|
||||
|
|
@ -77,14 +77,14 @@ class BernulliDistribution
|
|||
/**
|
||||
* Get expected value.
|
||||
*
|
||||
* @param \float $p
|
||||
* @param float $p
|
||||
*
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMean(\float $p) : \float
|
||||
public static function getMean(float $p) : float
|
||||
{
|
||||
return $p;
|
||||
}
|
||||
|
|
@ -92,14 +92,14 @@ class BernulliDistribution
|
|||
/**
|
||||
* Get expected value.
|
||||
*
|
||||
* @param \float $p
|
||||
* @param float $p
|
||||
*
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMedian(\float $p) : \float
|
||||
public static function getMedian(float $p) : float
|
||||
{
|
||||
if ($p === 0.5) {
|
||||
return 0.5;
|
||||
|
|
@ -113,14 +113,14 @@ class BernulliDistribution
|
|||
/**
|
||||
* Get variance.
|
||||
*
|
||||
* @param \float $p
|
||||
* @param float $p
|
||||
*
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getVariance(\float $p) : \float
|
||||
public static function getVariance(float $p) : float
|
||||
{
|
||||
return $p * (1 - $p);
|
||||
}
|
||||
|
|
@ -136,7 +136,7 @@ class BernulliDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMgf(\float $p, \float $t) : \float
|
||||
public static function getMgf(float $p, float $t) : float
|
||||
{
|
||||
return (1 - $p) + $p * exp($t);
|
||||
}
|
||||
|
|
@ -151,7 +151,7 @@ class BernulliDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getSkewness(\float $p) : \float
|
||||
public static function getSkewness(float $p) : float
|
||||
{
|
||||
return (1 - 2 * $p) / sqrt($p * (1 - $p));
|
||||
}
|
||||
|
|
@ -166,7 +166,7 @@ class BernulliDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getFisherInformation(\float $p) : \float
|
||||
public static function getFisherInformation(float $p) : float
|
||||
{
|
||||
return 1 / ($p * (1 - $p));
|
||||
}
|
||||
|
|
@ -181,7 +181,7 @@ class BernulliDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getExKurtosis(\float $p) : \float
|
||||
public static function getExKurtosis(float $p) : float
|
||||
{
|
||||
return (1 - 6 * $p * (1 - $p)) / ($p * (1 - $p));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class BinomialDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMode(\int $n, \float $p) : \float
|
||||
public static function getMode(int $n, float $p) : float
|
||||
{
|
||||
if (($temp = ($n + 1) * $p) === 0 || !is_int($temp)) {
|
||||
return floor($temp);
|
||||
|
|
@ -71,7 +71,7 @@ class BinomialDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getPmf(\int $n, \int $k, \float $p) : \float
|
||||
public static function getPmf(int $n, int $k, float $p) : float
|
||||
{
|
||||
return Functions::binomialCoefficient($n, $k) * pow($p, $k) * pow(1 - $p, $n - $k);
|
||||
}
|
||||
|
|
@ -88,7 +88,7 @@ class BinomialDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMgf(\int $n, \float $t, \float $p) : \float
|
||||
public static function getMgf(int $n, float $t, float $p) : float
|
||||
{
|
||||
return pow(1 - $p + $p * exp($t), $n);
|
||||
}
|
||||
|
|
@ -104,7 +104,7 @@ class BinomialDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getSkewness(\int $n, \float $p) : \float
|
||||
public static function getSkewness(int $n, float $p) : float
|
||||
{
|
||||
return (1 - 2 * $p) / sqrt($n * $p * (1 - $p));
|
||||
}
|
||||
|
|
@ -120,7 +120,7 @@ class BinomialDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getFisherInformation(\int $n, \float $p) : \float
|
||||
public static function getFisherInformation(int $n, float $p) : float
|
||||
{
|
||||
return $n / ($p * (1 - $p));
|
||||
}
|
||||
|
|
@ -136,7 +136,7 @@ class BinomialDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getExKurtosis(\int $n, \float $p) : \float
|
||||
public static function getExKurtosis(int $n, float $p) : float
|
||||
{
|
||||
return (1 - 6 * $p * (1 - $p)) / ($n * $p * (1 - $p));
|
||||
}
|
||||
|
|
@ -153,7 +153,7 @@ class BinomialDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getCdf(\int $n, \int $x, \float $p) : \float
|
||||
public static function getCdf(int $n, int $x, float $p) : float
|
||||
{
|
||||
$sum = 0.0;
|
||||
|
||||
|
|
@ -175,7 +175,7 @@ class BinomialDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMedian(\int $n, \float $p) : \float
|
||||
public static function getMedian(int $n, float $p) : float
|
||||
{
|
||||
return floor($n * $p);
|
||||
}
|
||||
|
|
@ -191,7 +191,7 @@ class BinomialDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMean(\int $n, \float $p) : \float
|
||||
public static function getMean(int $n, float $p) : float
|
||||
{
|
||||
return $n * $p;
|
||||
}
|
||||
|
|
@ -207,7 +207,7 @@ class BinomialDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getVariance(\int $n, \float $p) : \float
|
||||
public static function getVariance(int $n, float $p) : float
|
||||
{
|
||||
return $n * $p * (1 - $p);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class CauchyDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getPdf(\float $x, \float $x0, \float $gamma) : \float
|
||||
public static function getPdf(float $x, float $x0, float $gamma) : float
|
||||
{
|
||||
return 1 / (pi() * $gamma * (1 + (($x - $x0) / $gamma) ** 2));
|
||||
}
|
||||
|
|
@ -58,7 +58,7 @@ class CauchyDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getCdf(\float $x, \float $x0, \float $gamma) : \float
|
||||
public static function getCdf(float $x, float $x0, float $gamma) : float
|
||||
{
|
||||
return 1 / pi() * atan(($x - $x0) / $gamma) + 0.5;
|
||||
}
|
||||
|
|
@ -73,7 +73,7 @@ class CauchyDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMode($x0) : \float
|
||||
public static function getMode($x0) : float
|
||||
{
|
||||
return $x0;
|
||||
}
|
||||
|
|
@ -81,14 +81,14 @@ class CauchyDistribution
|
|||
/**
|
||||
* Get expected value.
|
||||
*
|
||||
* @param \float $x0
|
||||
* @param float $x0
|
||||
*
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMedian(\float $x0) : \float
|
||||
public static function getMedian(float $x0) : float
|
||||
{
|
||||
return $x0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ class ChiSquaredDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getDegreesOfFreedom(array $values) : \int
|
||||
public static function getDegreesOfFreedom(array $values) : int
|
||||
{
|
||||
if (is_array($first = reset($values))) {
|
||||
return (count($values) - 1) * (count($first) - 1);
|
||||
|
|
@ -111,7 +111,7 @@ class ChiSquaredDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function testHypothesis(array $dataset, array $expected, \float $significance = 0.05, \int $df = 0) : array
|
||||
public static function testHypothesis(array $dataset, array $expected, float $significance = 0.05, int $df = 0) : array
|
||||
{
|
||||
if (($count = count($dataset)) !== count($expected)) {
|
||||
throw new \Exception('Dimension');
|
||||
|
|
@ -158,7 +158,7 @@ class ChiSquaredDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getPdf(\float $x, \int $df) : \float
|
||||
public static function getPdf(float $x, int $df) : float
|
||||
{
|
||||
if ($x < 0) {
|
||||
throw new \Exception('Out of bounds');
|
||||
|
|
@ -170,14 +170,14 @@ class ChiSquaredDistribution
|
|||
/**
|
||||
* Get mode.
|
||||
*
|
||||
* @param \int $df Degrees of freedom
|
||||
* @param int $df Degrees of freedom
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMode(\int $df) : \int
|
||||
public static function getMode(int $df) : int
|
||||
{
|
||||
return max([$df - 2, 0]);
|
||||
}
|
||||
|
|
@ -185,14 +185,14 @@ class ChiSquaredDistribution
|
|||
/**
|
||||
* Get expected value.
|
||||
*
|
||||
* @param \int $df Degrees of freedom
|
||||
* @param int $df Degrees of freedom
|
||||
*
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMean(\int $df) : \float
|
||||
public static function getMean(int $df) : float
|
||||
{
|
||||
return $df;
|
||||
}
|
||||
|
|
@ -200,14 +200,14 @@ class ChiSquaredDistribution
|
|||
/**
|
||||
* Get expected value.
|
||||
*
|
||||
* @param \int $df Degrees of freedom
|
||||
* @param int $df Degrees of freedom
|
||||
*
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMedian(\int $df) : \float
|
||||
public static function getMedian(int $df) : float
|
||||
{
|
||||
return $df * (1 - 2 / (9 * $df)) ** 3;
|
||||
}
|
||||
|
|
@ -215,14 +215,14 @@ class ChiSquaredDistribution
|
|||
/**
|
||||
* Get variance.
|
||||
*
|
||||
* @param \int $df Degrees of freedom
|
||||
* @param int $df Degrees of freedom
|
||||
*
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getVariance(\int $df) : \float
|
||||
public static function getVariance(int $df) : float
|
||||
{
|
||||
return 2 * $df;
|
||||
}
|
||||
|
|
@ -240,7 +240,7 @@ class ChiSquaredDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMgf(\int $df, \float $t) : \float
|
||||
public static function getMgf(int $df, float $t) : float
|
||||
{
|
||||
if ($t > 0.5) {
|
||||
throw new \Exception('Out of bounds');
|
||||
|
|
@ -259,7 +259,7 @@ class ChiSquaredDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getSkewness(\int $df) : \float
|
||||
public static function getSkewness(int $df) : float
|
||||
{
|
||||
return sqrt(8 / $df);
|
||||
}
|
||||
|
|
@ -274,7 +274,7 @@ class ChiSquaredDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getExKurtosis(\int $df) : \float
|
||||
public static function getExKurtosis(int $df) : float
|
||||
{
|
||||
return 12 / $df;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class ExponentialDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getPdf(\float $x, \float $lambda) : \float
|
||||
public static function getPdf(float $x, float $lambda) : float
|
||||
{
|
||||
return $x >= 0 ? $lambda * exp(-$lambda * $x) : 0;
|
||||
}
|
||||
|
|
@ -56,7 +56,7 @@ class ExponentialDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getCdf(\float $x, \float $lambda) : \float
|
||||
public static function getCdf(float $x, float $lambda) : float
|
||||
{
|
||||
return $x >= 0 ? 1 - exp($lambda * $x) : 0;
|
||||
}
|
||||
|
|
@ -69,7 +69,7 @@ class ExponentialDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMode() : \float
|
||||
public static function getMode() : float
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -77,14 +77,14 @@ class ExponentialDistribution
|
|||
/**
|
||||
* Get expected value.
|
||||
*
|
||||
* @param \float $lambda
|
||||
* @param float $lambda
|
||||
*
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMean(\float $lambda) : \float
|
||||
public static function getMean(float $lambda) : float
|
||||
{
|
||||
return 1 / $lambda;
|
||||
}
|
||||
|
|
@ -92,14 +92,14 @@ class ExponentialDistribution
|
|||
/**
|
||||
* Get expected value.
|
||||
*
|
||||
* @param \float $lambda
|
||||
* @param float $lambda
|
||||
*
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMedian(\float $lambda) : \float
|
||||
public static function getMedian(float $lambda) : float
|
||||
{
|
||||
return 1 / $lambda;
|
||||
}
|
||||
|
|
@ -107,14 +107,14 @@ class ExponentialDistribution
|
|||
/**
|
||||
* Get variance.
|
||||
*
|
||||
* @param \float $lambda
|
||||
* @param float $lambda
|
||||
*
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getVariance(\float $lambda) : \float
|
||||
public static function getVariance(float $lambda) : float
|
||||
{
|
||||
return pow($lambda, -2);
|
||||
}
|
||||
|
|
@ -132,7 +132,7 @@ class ExponentialDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMgf(\float $t, \float $lambda) : \float
|
||||
public static function getMgf(float $t, float $lambda) : float
|
||||
{
|
||||
if ($t >= $lambda) {
|
||||
throw new \Exception('Out of bounds');
|
||||
|
|
@ -149,7 +149,7 @@ class ExponentialDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getSkewness() : \float
|
||||
public static function getSkewness() : float
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
|
@ -162,7 +162,7 @@ class ExponentialDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getExKurtosis() : \float
|
||||
public static function getExKurtosis() : float
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class GeometricDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getPmf(\float $p, \int $k) : \float
|
||||
public static function getPmf(float $p, int $k) : float
|
||||
{
|
||||
return pow(1 - $p, $k - 1) * $p;
|
||||
}
|
||||
|
|
@ -60,7 +60,7 @@ class GeometricDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getCdf(\float $p, \int $k) : \float
|
||||
public static function getCdf(float $p, int $k) : float
|
||||
{
|
||||
return 1 - pow(1 - $p, $k);
|
||||
}
|
||||
|
|
@ -73,7 +73,7 @@ class GeometricDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMode() : \int
|
||||
public static function getMode() : int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -81,14 +81,14 @@ class GeometricDistribution
|
|||
/**
|
||||
* Get expected value.
|
||||
*
|
||||
* @param \float $p
|
||||
* @param float $p
|
||||
*
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMean(\float $p) : \float
|
||||
public static function getMean(float $p) : float
|
||||
{
|
||||
return 1 / $p;
|
||||
}
|
||||
|
|
@ -96,14 +96,14 @@ class GeometricDistribution
|
|||
/**
|
||||
* Get expected value.
|
||||
*
|
||||
* @param \float $p
|
||||
* @param float $p
|
||||
*
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMedian(\float $p) : \float
|
||||
public static function getMedian(float $p) : float
|
||||
{
|
||||
return ceil(-1 / (log(1 - $p, 2)));
|
||||
}
|
||||
|
|
@ -111,14 +111,14 @@ class GeometricDistribution
|
|||
/**
|
||||
* Get variance.
|
||||
*
|
||||
* @param \float $p
|
||||
* @param float $p
|
||||
*
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getVariance(\float $p) : \float
|
||||
public static function getVariance(float $p) : float
|
||||
{
|
||||
return (1 - $p) / $p ** 2;
|
||||
}
|
||||
|
|
@ -134,7 +134,7 @@ class GeometricDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMgf(\float $p, \float $t) : \float
|
||||
public static function getMgf(float $p, float $t) : float
|
||||
{
|
||||
return $p * exp($t) / (1 - (1 - $p) * exp($t));
|
||||
}
|
||||
|
|
@ -149,7 +149,7 @@ class GeometricDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getSkewness(\float $lambda) : \float
|
||||
public static function getSkewness(float $lambda) : float
|
||||
{
|
||||
return (2 - $p) / sqrt(1 - $p);
|
||||
}
|
||||
|
|
@ -164,7 +164,7 @@ class GeometricDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getExKurtosis(\float $lambda) : \float
|
||||
public static function getExKurtosis(float $lambda) : float
|
||||
{
|
||||
return 6 + $p ** 2 / (1 - $p);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class LaplaceDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getPdf(\float $x, \float $mu, \float $b) : \float
|
||||
public static function getPdf(float $x, float $mu, float $b) : float
|
||||
{
|
||||
return 1 / (2 * $b) * exp(-abs($x - $mu) / $b);
|
||||
}
|
||||
|
|
@ -58,7 +58,7 @@ class LaplaceDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getCdf(\float $x, \float $mu, \float $b) : \float
|
||||
public static function getCdf(float $x, float $mu, float $b) : float
|
||||
{
|
||||
return $x < $mu ? exp(($x - $mu) / $b) / 2 : 1 - exp(-($x - $mu) / $b) / 2;
|
||||
}
|
||||
|
|
@ -66,14 +66,14 @@ class LaplaceDistribution
|
|||
/**
|
||||
* Get mode.
|
||||
*
|
||||
* @param \float $mu
|
||||
* @param float $mu
|
||||
*
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMode(\float $mu) : \float
|
||||
public static function getMode(float $mu) : float
|
||||
{
|
||||
return $mu;
|
||||
}
|
||||
|
|
@ -81,14 +81,14 @@ class LaplaceDistribution
|
|||
/**
|
||||
* Get expected value.
|
||||
*
|
||||
* @param \float $mu
|
||||
* @param float $mu
|
||||
*
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMean(\float $mu) : \float
|
||||
public static function getMean(float $mu) : float
|
||||
{
|
||||
return $mu;
|
||||
}
|
||||
|
|
@ -96,14 +96,14 @@ class LaplaceDistribution
|
|||
/**
|
||||
* Get expected value.
|
||||
*
|
||||
* @param \float $mu
|
||||
* @param float $mu
|
||||
*
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMedian(\float $mu) : \float
|
||||
public static function getMedian(float $mu) : float
|
||||
{
|
||||
return $mu;
|
||||
}
|
||||
|
|
@ -111,14 +111,14 @@ class LaplaceDistribution
|
|||
/**
|
||||
* Get variance.
|
||||
*
|
||||
* @param \float $b
|
||||
* @param float $b
|
||||
*
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getVariance(\float $b) : \float
|
||||
public static function getVariance(float $b) : float
|
||||
{
|
||||
return 2 * $b ** 2;
|
||||
}
|
||||
|
|
@ -137,7 +137,7 @@ class LaplaceDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMgf(\float $t, \float $mu, \float $b) : \float
|
||||
public static function getMgf(float $t, float $mu, float $b) : float
|
||||
{
|
||||
if ($t >= 1 / $b) {
|
||||
throw new \Exception('Out of bounds');
|
||||
|
|
@ -154,7 +154,7 @@ class LaplaceDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getSkewness() : \float
|
||||
public static function getSkewness() : float
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -167,7 +167,7 @@ class LaplaceDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getExKurtosis() : \float
|
||||
public static function getExKurtosis() : float
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class NormalDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getPdf(\float $x, \float $mu, \float $sig) : \float
|
||||
public static function getPdf(float $x, float $mu, float $sig) : float
|
||||
{
|
||||
return 1 / ($sig * sqrt(2 * pi())) * exp(-($x - $mu) ** 2 / (2 * $sig ** 2));
|
||||
}
|
||||
|
|
@ -50,14 +50,14 @@ class NormalDistribution
|
|||
/**
|
||||
* Get mode.
|
||||
*
|
||||
* @param \float $mu
|
||||
* @param float $mu
|
||||
*
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMode(\float $mu) : \float
|
||||
public static function getMode(float $mu) : float
|
||||
{
|
||||
return $mu;
|
||||
}
|
||||
|
|
@ -65,14 +65,14 @@ class NormalDistribution
|
|||
/**
|
||||
* Get expected value.
|
||||
*
|
||||
* @param \float $mu
|
||||
* @param float $mu
|
||||
*
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMean(\float $mu) : \float
|
||||
public static function getMean(float $mu) : float
|
||||
{
|
||||
return $mu;
|
||||
}
|
||||
|
|
@ -80,14 +80,14 @@ class NormalDistribution
|
|||
/**
|
||||
* Get expected value.
|
||||
*
|
||||
* @param \float $mu
|
||||
* @param float $mu
|
||||
*
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMedian(\float $mu) : \float
|
||||
public static function getMedian(float $mu) : float
|
||||
{
|
||||
return $mu;
|
||||
}
|
||||
|
|
@ -95,14 +95,14 @@ class NormalDistribution
|
|||
/**
|
||||
* Get variance.
|
||||
*
|
||||
* @param \float $sig
|
||||
* @param float $sig
|
||||
*
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getVariance(\float $sig) : \float
|
||||
public static function getVariance(float $sig) : float
|
||||
{
|
||||
return $sig ** 2;
|
||||
}
|
||||
|
|
@ -119,7 +119,7 @@ class NormalDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMgf(\float $t, \float $mu, \float $sig) : \float
|
||||
public static function getMgf(float $t, float $mu, float $sig) : float
|
||||
{
|
||||
return exp($mu * $t + ($sig ** 2 * $t ** 2) / 2);
|
||||
}
|
||||
|
|
@ -132,7 +132,7 @@ class NormalDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getSkewness() : \float
|
||||
public static function getSkewness() : float
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -147,7 +147,7 @@ class NormalDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getFisherInformation(\float $sig) : \float
|
||||
public static function getFisherInformation(float $sig) : float
|
||||
{
|
||||
return [[1 / $sig ** 2, 0], [0, 1 / (2 * $sig ** 4)]];
|
||||
}
|
||||
|
|
@ -160,7 +160,7 @@ class NormalDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getExKurtosis() : \float
|
||||
public static function getExKurtosis() : float
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class PoissonDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getPmf(\int $k, \float $lambda) : \float
|
||||
public static function getPmf(int $k, float $lambda) : float
|
||||
{
|
||||
return exp($k * log($lambda) - $lambda - log(Functions::getGammaInteger($k + 1)));
|
||||
}
|
||||
|
|
@ -59,7 +59,7 @@ class PoissonDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getCdf(\int $k, \float $lambda) : \float
|
||||
public static function getCdf(int $k, float $lambda) : float
|
||||
{
|
||||
$sum = 0.0;
|
||||
|
||||
|
|
@ -73,14 +73,14 @@ class PoissonDistribution
|
|||
/**
|
||||
* Get mode.
|
||||
*
|
||||
* @param \float $lambda Lambda
|
||||
* @param float $lambda Lambda
|
||||
*
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMode(\float $lambda) : \float
|
||||
public static function getMode(float $lambda) : float
|
||||
{
|
||||
return floor($lambda);
|
||||
}
|
||||
|
|
@ -88,14 +88,14 @@ class PoissonDistribution
|
|||
/**
|
||||
* Get expected value.
|
||||
*
|
||||
* @param \float $lambda Lambda
|
||||
* @param float $lambda Lambda
|
||||
*
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMean(\float $lambda) : \float
|
||||
public static function getMean(float $lambda) : float
|
||||
{
|
||||
return $lambda;
|
||||
}
|
||||
|
|
@ -103,14 +103,14 @@ class PoissonDistribution
|
|||
/**
|
||||
* Get expected value.
|
||||
*
|
||||
* @param \float $lambda Lambda
|
||||
* @param float $lambda Lambda
|
||||
*
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMedian(\float $lambda) : \float
|
||||
public static function getMedian(float $lambda) : float
|
||||
{
|
||||
return floor($lambda + 1 / 3 - 0.02 / $lambda);
|
||||
}
|
||||
|
|
@ -118,14 +118,14 @@ class PoissonDistribution
|
|||
/**
|
||||
* Get variance.
|
||||
*
|
||||
* @param \float $lambda Lambda
|
||||
* @param float $lambda Lambda
|
||||
*
|
||||
* @return float
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getVariance(\float $lambda) : \float
|
||||
public static function getVariance(float $lambda) : float
|
||||
{
|
||||
return $lambda;
|
||||
}
|
||||
|
|
@ -141,7 +141,7 @@ class PoissonDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMgf(\float $lambda, \float $t) : \float
|
||||
public static function getMgf(float $lambda, float $t) : float
|
||||
{
|
||||
return exp($lambda * (exp($t) - 1));
|
||||
}
|
||||
|
|
@ -156,7 +156,7 @@ class PoissonDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getSkewness(\float $lambda) : \float
|
||||
public static function getSkewness(float $lambda) : float
|
||||
{
|
||||
return pow($lambda, -1 / 2);
|
||||
}
|
||||
|
|
@ -171,7 +171,7 @@ class PoissonDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getFisherInformation(\float $lambda) : \float
|
||||
public static function getFisherInformation(float $lambda) : float
|
||||
{
|
||||
return pow($lambda, -1);
|
||||
}
|
||||
|
|
@ -186,7 +186,7 @@ class PoissonDistribution
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getExKurtosis(\float $lambda) : \float
|
||||
public static function getExKurtosis(float $lambda) : float
|
||||
{
|
||||
return pow($lambda, -1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class UniformDistributionContinuous
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMode(\float $a, \float $b) : \float
|
||||
public static function getMode(float $a, float $b) : float
|
||||
{
|
||||
return ($a + $b) / 2;
|
||||
}
|
||||
|
|
@ -62,7 +62,7 @@ class UniformDistributionContinuous
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getPdf(\float $x, \float $a, \float $b) : \float
|
||||
public static function getPdf(float $x, float $a, float $b) : float
|
||||
{
|
||||
return $x > $a && $x < $b ? 1 / ($b - $a) : 0;
|
||||
}
|
||||
|
|
@ -81,7 +81,7 @@ class UniformDistributionContinuous
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getCdf(\float $x, \float $a, \float $b) : \float
|
||||
public static function getCdf(float $x, float $a, float $b) : float
|
||||
{
|
||||
if ($x < $a) {
|
||||
return 0;
|
||||
|
|
@ -104,7 +104,7 @@ class UniformDistributionContinuous
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMgf(\int $t, \float $a, \float $b) : \float
|
||||
public static function getMgf(int $t, float $a, float $b) : float
|
||||
{
|
||||
return $t === 0 ? 1 : (exp($t * $b) - exp($t * $a)) / ($t * ($b - $a));
|
||||
}
|
||||
|
|
@ -117,7 +117,7 @@ class UniformDistributionContinuous
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getSkewness() : \float
|
||||
public static function getSkewness() : float
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
|
@ -130,7 +130,7 @@ class UniformDistributionContinuous
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getExKurtosis() : \float
|
||||
public static function getExKurtosis() : float
|
||||
{
|
||||
return -6 / 5;
|
||||
}
|
||||
|
|
@ -146,7 +146,7 @@ class UniformDistributionContinuous
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMedian(\float $a, \float $b) : \float
|
||||
public static function getMedian(float $a, float $b) : float
|
||||
{
|
||||
return ($a + $b) / 2;
|
||||
}
|
||||
|
|
@ -162,7 +162,7 @@ class UniformDistributionContinuous
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMean(\float $a, \float $b) : \float
|
||||
public static function getMean(float $a, float $b) : float
|
||||
{
|
||||
return ($a + $b) / 2;
|
||||
}
|
||||
|
|
@ -178,7 +178,7 @@ class UniformDistributionContinuous
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getVariance(\float $a, \float $b) : \float
|
||||
public static function getVariance(float $a, float $b) : float
|
||||
{
|
||||
return 1 / 12 * ($b - $a) ** 2;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class UniformDistributionDiscrete
|
|||
/**
|
||||
* Get probability mass function.
|
||||
*
|
||||
* @param \float $a
|
||||
* @param float $a
|
||||
* @param float $b
|
||||
*
|
||||
* @return float
|
||||
|
|
@ -41,7 +41,7 @@ class UniformDistributionDiscrete
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getPmf(\float $a, \float $b) : \float
|
||||
public static function getPmf(float $a, float $b) : float
|
||||
{
|
||||
return 1 / ($b - $a + 1);
|
||||
}
|
||||
|
|
@ -60,7 +60,7 @@ class UniformDistributionDiscrete
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getCdf(\float $k, \float $a, \float $b) : \float
|
||||
public static function getCdf(float $k, float $a, float $b) : float
|
||||
{
|
||||
if ($k > $b || $k < $a) {
|
||||
throw new \Exception('Out of bounds');
|
||||
|
|
@ -81,7 +81,7 @@ class UniformDistributionDiscrete
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMgf(\int $t, \float $a, \float $b) : \float
|
||||
public static function getMgf(int $t, float $a, float $b) : float
|
||||
{
|
||||
return (exp($a * $t) - exp(($b + 1) * $t)) / (($b - $a + 1) * (1 - exp($t)));
|
||||
}
|
||||
|
|
@ -94,7 +94,7 @@ class UniformDistributionDiscrete
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getSkewness() : \float
|
||||
public static function getSkewness() : float
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
|
@ -110,7 +110,7 @@ class UniformDistributionDiscrete
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getExKurtosis(\float $a, \float $b) : \float
|
||||
public static function getExKurtosis(float $a, float $b) : float
|
||||
{
|
||||
$n = ($b - $a + 1);
|
||||
|
||||
|
|
@ -128,7 +128,7 @@ class UniformDistributionDiscrete
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMedian(\float $a, \float $b) : \float
|
||||
public static function getMedian(float $a, float $b) : float
|
||||
{
|
||||
return ($a + $b) / 2;
|
||||
}
|
||||
|
|
@ -144,7 +144,7 @@ class UniformDistributionDiscrete
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getMean(\float $a, \float $b) : \float
|
||||
public static function getMean(float $a, float $b) : float
|
||||
{
|
||||
return ($a + $b) / 2;
|
||||
}
|
||||
|
|
@ -160,7 +160,7 @@ class UniformDistributionDiscrete
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getVariance(\float $a, \float $b) : \float
|
||||
public static function getVariance(float $a, float $b) : float
|
||||
{
|
||||
return (($b - $a + 1) ** 2 - 1) / 12;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ class Request extends RequestAbstract
|
|||
/**
|
||||
* Request information.
|
||||
*
|
||||
* @var \string[]
|
||||
* @var string[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $info = null;
|
||||
|
|
@ -80,12 +80,12 @@ class Request extends RequestAbstract
|
|||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param \string $rootPath relative installation path
|
||||
* @param string $rootPath relative installation path
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function __construct(\string $rootPath)
|
||||
public function __construct(string $rootPath)
|
||||
{
|
||||
$this->uri = new Http($rootPath);
|
||||
$this->l11n = new Localization();
|
||||
|
|
@ -97,7 +97,7 @@ class Request extends RequestAbstract
|
|||
*
|
||||
* This is used in order to either initialize the current http request or a batch of GET requests
|
||||
*
|
||||
* @param \string $uri URL
|
||||
* @param string $uri URL
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
|
|
@ -106,7 +106,7 @@ class Request extends RequestAbstract
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function init(\string $uri = null)
|
||||
public function init(string $uri = null)
|
||||
{
|
||||
if ($uri === null) {
|
||||
$this->data = $_GET ?? [];
|
||||
|
|
@ -165,7 +165,7 @@ class Request extends RequestAbstract
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function isMobile() : \bool
|
||||
public function isMobile() : bool
|
||||
{
|
||||
// TODO: maybe replace this with smart media queries... checked gets handled in reverse!!!
|
||||
$useragent = $_SERVER['HTTP_USER_AGENT'];
|
||||
|
|
@ -197,12 +197,12 @@ class Request extends RequestAbstract
|
|||
*
|
||||
* @param array $request Request array
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
private function hashRequest(array $request) : \string
|
||||
private function hashRequest(array $request) : string
|
||||
{
|
||||
return sha1(implode('', $request));
|
||||
}
|
||||
|
|
@ -284,7 +284,7 @@ class Request extends RequestAbstract
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getOrigin() : \string
|
||||
public function getOrigin() : string
|
||||
{
|
||||
return $_SERVER['REMOTE_ADDR'];
|
||||
}
|
||||
|
|
@ -292,14 +292,14 @@ class Request extends RequestAbstract
|
|||
/**
|
||||
* Is request made via https.
|
||||
*
|
||||
* @param \int $port Secure port
|
||||
* @param int $port Secure port
|
||||
*
|
||||
* @return \bool
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function isHttps(\int $port = 443) : \bool
|
||||
public function isHttps(int $port = 443) : bool
|
||||
{
|
||||
if ($port < 1 || $port > 65535) {
|
||||
throw new \OutOfRangeException('Value "' . $port . '" is out of range.');
|
||||
|
|
@ -315,7 +315,7 @@ class Request extends RequestAbstract
|
|||
/**
|
||||
* Stringify request.
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
|
|
@ -331,12 +331,12 @@ class Request extends RequestAbstract
|
|||
/**
|
||||
* Get request type.
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getMethod() : \string
|
||||
public function getMethod() : string
|
||||
{
|
||||
if (!isset($this->type)) {
|
||||
$this->type = $_SERVER['REQUEST_METHOD'];
|
||||
|
|
@ -348,7 +348,7 @@ class Request extends RequestAbstract
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getProtocolVersion() : \string
|
||||
public function getProtocolVersion() : string
|
||||
{
|
||||
return $_SERVER['SERVER_PROTOCOL'];
|
||||
}
|
||||
|
|
@ -364,7 +364,7 @@ class Request extends RequestAbstract
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasHeader(\string $name) : \bool
|
||||
public function hasHeader(string $name) : bool
|
||||
{
|
||||
return array_key_exists($name, getallheaders());
|
||||
}
|
||||
|
|
@ -372,7 +372,7 @@ class Request extends RequestAbstract
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getHeader(\string $name) : \string
|
||||
public function getHeader(string $name) : string
|
||||
{
|
||||
return getallheaders()[$name];
|
||||
}
|
||||
|
|
@ -380,7 +380,7 @@ class Request extends RequestAbstract
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBody() : \string
|
||||
public function getBody() : string
|
||||
{
|
||||
return file_get_contents('php://input');
|
||||
}
|
||||
|
|
@ -388,7 +388,7 @@ class Request extends RequestAbstract
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getRequestTarget() : \string
|
||||
public function getRequestTarget() : string
|
||||
{
|
||||
return '/';
|
||||
}
|
||||
|
|
@ -406,7 +406,7 @@ class Request extends RequestAbstract
|
|||
return $this->files;
|
||||
}
|
||||
|
||||
public function setHeader($key, \string $header, \bool $overwrite = true)
|
||||
public function setHeader($key, string $header, bool $overwrite = true)
|
||||
{
|
||||
// NOT Required for Http request
|
||||
}
|
||||
|
|
@ -419,7 +419,7 @@ class Request extends RequestAbstract
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getRoutify() : \string
|
||||
public function getRoutify() : string
|
||||
{
|
||||
return $this->uri->__toString();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class Response extends ResponseAbstract implements RenderableInterface
|
|||
/**
|
||||
* Header.
|
||||
*
|
||||
* @var \string[][]
|
||||
* @var string[][]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $header = [];
|
||||
|
|
@ -83,14 +83,14 @@ class Response extends ResponseAbstract implements RenderableInterface
|
|||
/**
|
||||
* Remove header by ID.
|
||||
*
|
||||
* @param \int $key Header key
|
||||
* @param int $key Header key
|
||||
*
|
||||
* @return \bool
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function removeHeader(\int $key) : \bool
|
||||
public function removeHeader(int $key) : bool
|
||||
{
|
||||
if (isset($this->header[$key])) {
|
||||
unset($this->header[$key]);
|
||||
|
|
@ -104,14 +104,14 @@ class Response extends ResponseAbstract implements RenderableInterface
|
|||
/**
|
||||
* Generate header automatically based on code.
|
||||
*
|
||||
* @param \int $code HTTP status code
|
||||
* @param int $code HTTP status code
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function generateHeader(\int $code)
|
||||
public function generateHeader(int $code)
|
||||
{
|
||||
if ($code === 403) {
|
||||
$this->setHeader('HTTP', 'HTTP/1.0 403 Forbidden');
|
||||
|
|
@ -129,14 +129,14 @@ class Response extends ResponseAbstract implements RenderableInterface
|
|||
/**
|
||||
* Set response.
|
||||
*
|
||||
* @param \string $response Response to set
|
||||
* @param string $response Response to set
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setResponse(\string $response)
|
||||
public function setResponse(string $response)
|
||||
{
|
||||
$this->response = $response;
|
||||
}
|
||||
|
|
@ -144,14 +144,14 @@ class Response extends ResponseAbstract implements RenderableInterface
|
|||
/**
|
||||
* Push a specific response ID.
|
||||
*
|
||||
* @param \int $id Response ID
|
||||
* @param int $id Response ID
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function pushResponseId(\int $id)
|
||||
public function pushResponseId(int $id)
|
||||
{
|
||||
ob_start();
|
||||
echo $this->response[$id];
|
||||
|
|
@ -193,14 +193,14 @@ class Response extends ResponseAbstract implements RenderableInterface
|
|||
/**
|
||||
* Remove response by ID.
|
||||
*
|
||||
* @param \int $id Response ID
|
||||
* @param int $id Response ID
|
||||
*
|
||||
* @return \bool
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function remove(\int $id) : \bool
|
||||
public function remove(int $id) : bool
|
||||
{
|
||||
if (isset($this->response[$id])) {
|
||||
unset($this->response[$id]);
|
||||
|
|
@ -222,7 +222,7 @@ class Response extends ResponseAbstract implements RenderableInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getProtocolVersion() : \string
|
||||
public function getProtocolVersion() : string
|
||||
{
|
||||
return '1.0';
|
||||
}
|
||||
|
|
@ -238,7 +238,7 @@ class Response extends ResponseAbstract implements RenderableInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasHeader(\string $name) : \bool
|
||||
public function hasHeader(string $name) : bool
|
||||
{
|
||||
return array_key_exists($name, $this->header);
|
||||
}
|
||||
|
|
@ -246,7 +246,7 @@ class Response extends ResponseAbstract implements RenderableInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBody() : \string
|
||||
public function getBody() : string
|
||||
{
|
||||
return $this->render();
|
||||
}
|
||||
|
|
@ -254,14 +254,14 @@ class Response extends ResponseAbstract implements RenderableInterface
|
|||
/**
|
||||
* Generate response.
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @throws \Exception
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function render() : \string
|
||||
public function render() : string
|
||||
{
|
||||
$render = $this->head->render();
|
||||
|
||||
|
|
@ -284,7 +284,7 @@ class Response extends ResponseAbstract implements RenderableInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toCsv() : \string
|
||||
public function toCsv() : string
|
||||
{
|
||||
return ArrayUtils::arrayToCSV($this->toArray());
|
||||
}
|
||||
|
|
@ -310,7 +310,7 @@ class Response extends ResponseAbstract implements RenderableInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getReasonPhrase() : \string
|
||||
public function getReasonPhrase() : string
|
||||
{
|
||||
return $this->getHeader('Status');
|
||||
}
|
||||
|
|
@ -318,7 +318,7 @@ class Response extends ResponseAbstract implements RenderableInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getHeader(\string $name)
|
||||
public function getHeader(string $name)
|
||||
{
|
||||
if (isset($this->header[$name])) {
|
||||
return $this->header[$name];
|
||||
|
|
@ -330,7 +330,7 @@ class Response extends ResponseAbstract implements RenderableInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setHeader($key, \string $header, \bool $overwrite = false) : \bool
|
||||
public function setHeader($key, string $header, bool $overwrite = false) : bool
|
||||
{
|
||||
if (!$overwrite && isset($this->header[$key])) {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -51,12 +51,12 @@ class Rest
|
|||
/**
|
||||
* Set url.
|
||||
*
|
||||
* @param \string $url Url
|
||||
* @param string $url Url
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public function setUrl(\string $url) {
|
||||
public function setUrl(string $url) {
|
||||
if (filter_var($url, FILTER_VALIDATE_URL) === false) {
|
||||
throw new InvalidUriException('$url');
|
||||
}
|
||||
|
|
@ -67,12 +67,12 @@ class Rest
|
|||
/**
|
||||
* Set method.
|
||||
*
|
||||
* @param \string $method Method
|
||||
* @param string $method Method
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public function setMethod(\string $method) {
|
||||
public function setMethod(string $method) {
|
||||
if(!RequestMethod::isValidValue($method)) {
|
||||
throw new InvalidEnumValue($method);
|
||||
}
|
||||
|
|
@ -85,12 +85,12 @@ class Rest
|
|||
*
|
||||
* @param mixed $data Data to pass
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public function callApi($data = false) : \string
|
||||
public function callApi($data = false) : string
|
||||
{
|
||||
$curl = curl_init();
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class Imap extends Mail
|
|||
return imap_get_quotaroot($this->inbox, "INBOX");
|
||||
}
|
||||
|
||||
public function getInbox(\string $option = 'ALL') : array
|
||||
public function getInbox(string $option = 'ALL') : array
|
||||
{
|
||||
$ids = imap_search($this->inbox, $option, SE_FREE, 'UTF-8');
|
||||
|
||||
|
|
@ -74,22 +74,22 @@ class Imap extends Mail
|
|||
return $this->getInbox('NEW');
|
||||
}
|
||||
|
||||
public function getInboxFrom(\string $from)
|
||||
public function getInboxFrom(string $from)
|
||||
{
|
||||
return $this->getInbox('FROM "' . $from . '"');
|
||||
}
|
||||
|
||||
public function getInboxTo(\string $to)
|
||||
public function getInboxTo(string $to)
|
||||
{
|
||||
return $this->getInbox('TO "' . $to . '"');
|
||||
}
|
||||
|
||||
public function getInboxCc(\string $cc)
|
||||
public function getInboxCc(string $cc)
|
||||
{
|
||||
return $this->getInbox('CC "' . $cc . '"');
|
||||
}
|
||||
|
||||
public function getInboxBcc(\string $bcc)
|
||||
public function getInboxBcc(string $bcc)
|
||||
{
|
||||
return $this->getInbox('BCC "' . $bcc . '"');
|
||||
}
|
||||
|
|
@ -99,7 +99,7 @@ class Imap extends Mail
|
|||
return $this->getInbox('ANSWERED');
|
||||
}
|
||||
|
||||
public function getInboxSubject(\string $subject)
|
||||
public function getInboxSubject(string $subject)
|
||||
{
|
||||
return $this->getInbox('SUBJECT "' . $subject . '"');
|
||||
}
|
||||
|
|
@ -124,7 +124,7 @@ class Imap extends Mail
|
|||
return $this->getInbox('DELETED');
|
||||
}
|
||||
|
||||
public function getInboxText(\string $text)
|
||||
public function getInboxText(string $text)
|
||||
{
|
||||
return $this->getInbox('TEXT "' . $text . '"');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ abstract class Mail
|
|||
|
||||
protected $mailer = null;
|
||||
|
||||
public function __construct(\int $type)
|
||||
public function __construct(int $type)
|
||||
{
|
||||
$this->type = $type;
|
||||
|
||||
|
|
|
|||
|
|
@ -50,92 +50,92 @@ interface MessageInterface
|
|||
/**
|
||||
* Checks if a header exists by the given case-insensitive name.
|
||||
*
|
||||
* @param \string $name Header name
|
||||
* @param string $name Header name
|
||||
*
|
||||
* @return \bool
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function hasHeader(\string $name) : \bool;
|
||||
public function hasHeader(string $name) : bool;
|
||||
|
||||
/**
|
||||
* Retrieves a message header value by the given case-insensitive name.
|
||||
*
|
||||
* @param \string $name Header name
|
||||
* @param string $name Header name
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getHeader(\string $name);
|
||||
public function getHeader(string $name);
|
||||
|
||||
/**
|
||||
* Add header by ID.
|
||||
*
|
||||
* @param mixed $key Header ID
|
||||
* @param \string $header Header string
|
||||
* @param \bool $overwrite Overwrite existing headers
|
||||
* @param string $header Header string
|
||||
* @param bool $overwrite Overwrite existing headers
|
||||
*
|
||||
* @return \bool
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setHeader($key, \string $header, \bool $overwrite = true);
|
||||
public function setHeader($key, string $header, bool $overwrite = true);
|
||||
|
||||
/**
|
||||
* Gets the body of the message.
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getBody() : \string;
|
||||
public function getBody() : string;
|
||||
|
||||
/**
|
||||
* Set status code.
|
||||
*
|
||||
* @param \string $status Status code
|
||||
* @param string $status Status code
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setStatusCode(\string $status);
|
||||
public function setStatusCode(string $status);
|
||||
|
||||
/**
|
||||
* Get status code.
|
||||
*
|
||||
* @return \string Status code
|
||||
* @return string Status code
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getStatusCode() : \string;
|
||||
public function getStatusCode() : string;
|
||||
|
||||
/**
|
||||
* Get account id.
|
||||
*
|
||||
* @return \int Account id
|
||||
* @return int Account id
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getAccount() : \int;
|
||||
public function getAccount() : int;
|
||||
|
||||
/**
|
||||
* Set account id.
|
||||
*
|
||||
* @param \int $account Account id
|
||||
* @param int $account Account id
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setAccount(\int $account);
|
||||
public function setAccount(int $account);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ abstract class RequestAbstract implements RequestInterface
|
|||
/**
|
||||
* Account.
|
||||
*
|
||||
* @var \int
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $account = null;
|
||||
|
|
@ -94,7 +94,7 @@ abstract class RequestAbstract implements RequestInterface
|
|||
/**
|
||||
* Request status.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $status = RequestStatus::R_200;
|
||||
|
|
@ -156,7 +156,7 @@ abstract class RequestAbstract implements RequestInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
abstract public function getMethod() : \string;
|
||||
abstract public function getMethod() : string;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
@ -209,7 +209,7 @@ abstract class RequestAbstract implements RequestInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getAccount() : \int
|
||||
public function getAccount() : int
|
||||
{
|
||||
return $this->account;
|
||||
}
|
||||
|
|
@ -217,7 +217,7 @@ abstract class RequestAbstract implements RequestInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setAccount(\int $account)
|
||||
public function setAccount(int $account)
|
||||
{
|
||||
$this->account = $account;
|
||||
}
|
||||
|
|
@ -225,7 +225,7 @@ abstract class RequestAbstract implements RequestInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setStatusCode(\string $status)
|
||||
public function setStatusCode(string $status)
|
||||
{
|
||||
$this->status = $status;
|
||||
}
|
||||
|
|
@ -233,7 +233,7 @@ abstract class RequestAbstract implements RequestInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getStatusCode() : \string
|
||||
public function getStatusCode() : string
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
|
@ -241,7 +241,7 @@ abstract class RequestAbstract implements RequestInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public abstract function getOrigin() : \string;
|
||||
public abstract function getOrigin() : string;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
|||
|
|
@ -34,22 +34,22 @@ interface RequestInterface extends MessageInterface
|
|||
/**
|
||||
* Get request target.
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getRequestTarget() : \string;
|
||||
public function getRequestTarget() : string;
|
||||
|
||||
/**
|
||||
* Get request method.
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getMethod() : \string;
|
||||
public function getMethod() : string;
|
||||
|
||||
/**
|
||||
* Get request uri.
|
||||
|
|
@ -64,7 +64,7 @@ interface RequestInterface extends MessageInterface
|
|||
/**
|
||||
* Get request hash.
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ abstract class ResponseAbstract implements ResponseInterface, ArrayableInterface
|
|||
/**
|
||||
* Responses.
|
||||
*
|
||||
* @var \string[]
|
||||
* @var string[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $response = [];
|
||||
|
|
@ -53,7 +53,7 @@ abstract class ResponseAbstract implements ResponseInterface, ArrayableInterface
|
|||
/**
|
||||
* Response status.
|
||||
*
|
||||
* @var \int
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $status = 200;
|
||||
|
|
@ -61,7 +61,7 @@ abstract class ResponseAbstract implements ResponseInterface, ArrayableInterface
|
|||
/**
|
||||
* Account.
|
||||
*
|
||||
* @var \int
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $account = null;
|
||||
|
|
@ -69,7 +69,7 @@ abstract class ResponseAbstract implements ResponseInterface, ArrayableInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
abstract public function setHeader($key, \string $header, \bool $overwrite = true);
|
||||
abstract public function setHeader($key, string $header, bool $overwrite = true);
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
@ -107,14 +107,14 @@ abstract class ResponseAbstract implements ResponseInterface, ArrayableInterface
|
|||
*
|
||||
* @param mixed $key Response id
|
||||
* @param mixed $response Response to add
|
||||
* @param \bool $overwrite Overwrite
|
||||
* @param bool $overwrite Overwrite
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function set($key, $response, \bool $overwrite = true)
|
||||
public function set($key, $response, bool $overwrite = true)
|
||||
{
|
||||
$this->response = ArrayUtils::setArray($key, $this->response, $response, ':', $overwrite);
|
||||
}
|
||||
|
|
@ -122,7 +122,7 @@ abstract class ResponseAbstract implements ResponseInterface, ArrayableInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setStatusCode(\string $status)
|
||||
public function setStatusCode(string $status)
|
||||
{
|
||||
$this->status = $status;
|
||||
$this->generateHeader($status);
|
||||
|
|
@ -131,7 +131,7 @@ abstract class ResponseAbstract implements ResponseInterface, ArrayableInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getStatusCode() : \string
|
||||
public function getStatusCode() : string
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
|
@ -139,7 +139,7 @@ abstract class ResponseAbstract implements ResponseInterface, ArrayableInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getAccount() : \int
|
||||
public function getAccount() : int
|
||||
{
|
||||
return $this->account;
|
||||
}
|
||||
|
|
@ -147,7 +147,7 @@ abstract class ResponseAbstract implements ResponseInterface, ArrayableInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setAccount(\int $account)
|
||||
public function setAccount(int $account)
|
||||
{
|
||||
$this->account = $account;
|
||||
}
|
||||
|
|
@ -155,7 +155,7 @@ abstract class ResponseAbstract implements ResponseInterface, ArrayableInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toJson(\int $options = 0) : \string
|
||||
public function toJson(int $options = 0) : string
|
||||
{
|
||||
return json_encode($this->toArray());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,12 +32,12 @@ interface ResponseInterface extends MessageInterface
|
|||
/**
|
||||
* Generate header automatically based on code.
|
||||
*
|
||||
* @param \int $code HTTP status code
|
||||
* @param int $code HTTP status code
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function generateHeader(\int $code);
|
||||
public function generateHeader(int $code);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,14 +40,14 @@ interface UploadedFileInterface
|
|||
/**
|
||||
* Move the uploaded file to a new location.
|
||||
*
|
||||
* @param \string $targetPath Path to new location
|
||||
* @param string $targetPath Path to new location
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function moveTo(\string $targetPath);
|
||||
public function moveTo(string $targetPath);
|
||||
|
||||
/**
|
||||
* Retrieve the file size.
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class Head implements RenderableInterface
|
|||
/**
|
||||
* Page language.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $language = '';
|
||||
|
|
@ -46,7 +46,7 @@ class Head implements RenderableInterface
|
|||
/**
|
||||
* Page title.
|
||||
*
|
||||
* @var \string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $title = '';
|
||||
|
|
@ -62,7 +62,7 @@ class Head implements RenderableInterface
|
|||
/**
|
||||
* Is the header set?
|
||||
*
|
||||
* @var \bool
|
||||
* @var bool
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $hasContent = false;
|
||||
|
|
@ -118,12 +118,12 @@ class Head implements RenderableInterface
|
|||
/**
|
||||
* Set page title.
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getTitle() : \string
|
||||
public function getTitle() : string
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
|
@ -131,14 +131,14 @@ class Head implements RenderableInterface
|
|||
/**
|
||||
* Set page title.
|
||||
*
|
||||
* @param \string $title Page title
|
||||
* @param string $title Page title
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setTitle(\string $title)
|
||||
public function setTitle(string $title)
|
||||
{
|
||||
$this->title = $title;
|
||||
}
|
||||
|
|
@ -146,15 +146,15 @@ class Head implements RenderableInterface
|
|||
/**
|
||||
* Set page title.
|
||||
*
|
||||
* @param \string $type Asset type
|
||||
* @param \string $uri Asset uri
|
||||
* @param string $type Asset type
|
||||
* @param string $uri Asset uri
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function addAsset(\string $type, \string $uri)
|
||||
public function addAsset(string $type, string $uri)
|
||||
{
|
||||
$this->assets[$uri] = $type;
|
||||
}
|
||||
|
|
@ -162,14 +162,14 @@ class Head implements RenderableInterface
|
|||
/**
|
||||
* Set page language.
|
||||
*
|
||||
* @param \string $language language string
|
||||
* @param string $language language string
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setLanguage(\string $language)
|
||||
public function setLanguage(string $language)
|
||||
{
|
||||
$this->language = $language;
|
||||
}
|
||||
|
|
@ -177,12 +177,12 @@ class Head implements RenderableInterface
|
|||
/**
|
||||
* Get the evaluated contents of the object.
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function render() : \string
|
||||
public function render() : string
|
||||
{
|
||||
$head = '';
|
||||
if ($this->hasContent) {
|
||||
|
|
@ -197,12 +197,12 @@ class Head implements RenderableInterface
|
|||
/**
|
||||
* Render style.
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function renderStyle() : \string
|
||||
public function renderStyle() : string
|
||||
{
|
||||
$style = '';
|
||||
foreach ($this->style as $css) {
|
||||
|
|
@ -215,12 +215,12 @@ class Head implements RenderableInterface
|
|||
/**
|
||||
* Render script.
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function renderScript() : \string
|
||||
public function renderScript() : string
|
||||
{
|
||||
$script = '';
|
||||
foreach ($this->script as $js) {
|
||||
|
|
@ -233,16 +233,16 @@ class Head implements RenderableInterface
|
|||
/**
|
||||
* Set a style.
|
||||
*
|
||||
* @param \string $key Style key
|
||||
* @param \string $style Style source
|
||||
* @param \bool $overwrite Overwrite if already existing
|
||||
* @param string $key Style key
|
||||
* @param string $style Style source
|
||||
* @param bool $overwrite Overwrite if already existing
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setStyle(\string $key, \string $style, \bool $overwrite = true)
|
||||
public function setStyle(string $key, string $style, bool $overwrite = true)
|
||||
{
|
||||
if ($overwrite || !isset($this->script[$key])) {
|
||||
$this->style[$key] = $style;
|
||||
|
|
@ -252,16 +252,16 @@ class Head implements RenderableInterface
|
|||
/**
|
||||
* Set a script.
|
||||
*
|
||||
* @param \string $key Script key
|
||||
* @param \string $script Script source
|
||||
* @param \bool $overwrite Overwrite if already existing
|
||||
* @param string $key Script key
|
||||
* @param string $script Script source
|
||||
* @param bool $overwrite Overwrite if already existing
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setScript(\string $key, \string $script, \bool $overwrite = true)
|
||||
public function setScript(string $key, string $script, bool $overwrite = true)
|
||||
{
|
||||
if ($overwrite || !isset($this->script[$key])) {
|
||||
$this->script[$key] = $script;
|
||||
|
|
@ -297,12 +297,12 @@ class Head implements RenderableInterface
|
|||
/**
|
||||
* Render assets.
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function renderAssets() : \string
|
||||
public function renderAssets() : string
|
||||
{
|
||||
$asset = '';
|
||||
foreach ($this->assets as $uri => $type) {
|
||||
|
|
@ -319,12 +319,12 @@ class Head implements RenderableInterface
|
|||
/**
|
||||
* Render assets.
|
||||
*
|
||||
* @return \string
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function renderAssetsLate() : \string
|
||||
public function renderAssetsLate() : string
|
||||
{
|
||||
$asset = '';
|
||||
foreach ($this->assets as $uri => $type) {
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user