phpcs fixes

This commit is contained in:
Dennis Eichhorn 2018-02-16 15:28:07 +01:00
parent 11c7b0e626
commit 3059003191
39 changed files with 256 additions and 157 deletions

View File

@ -109,7 +109,7 @@ interface DataMapperInterface
/** /**
* Load. * Load.
* *
* @param array $objects Objects to load * @param array ...$objects Objects to load
* *
* @return $this * @return $this
* *

View File

@ -144,6 +144,8 @@ abstract class GrammarAbstract
* Set table prefix. * Set table prefix.
* *
* @param string $prefix Table prefix * @param string $prefix Table prefix
*
* @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -247,7 +247,7 @@ class Builder extends BuilderAbstract
/** /**
* Select. * Select.
* *
* @param array $columns Columns * @param array ...$columns Columns
* *
* @return Builder * @return Builder
* *
@ -273,7 +273,7 @@ class Builder extends BuilderAbstract
/** /**
* Select. * Select.
* *
* @param array $columns Columns * @param array ...$columns Columns
* *
* @return Builder * @return Builder
* *
@ -423,7 +423,7 @@ class Builder extends BuilderAbstract
/** /**
* From. * From.
* *
* @param string|array $tables Tables * @param string|array ...$tables Tables
* *
* @return Builder * @return Builder
* *
@ -627,7 +627,7 @@ class Builder extends BuilderAbstract
/** /**
* Group by. * Group by.
* *
* @param string|array|\Closure $columns Grouping result * @param string|array|\Closure ...$columns Grouping result
* *
* @return Builder * @return Builder
* *
@ -761,6 +761,8 @@ class Builder extends BuilderAbstract
/** /**
* Lock query. * Lock query.
*
* @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -770,6 +772,8 @@ class Builder extends BuilderAbstract
/** /**
* Lock for update query. * Lock for update query.
*
* @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -779,6 +783,8 @@ class Builder extends BuilderAbstract
/** /**
* Create query string. * Create query string.
*
* @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -789,6 +795,8 @@ class Builder extends BuilderAbstract
/** /**
* Find query. * Find query.
*
* @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -813,6 +821,8 @@ class Builder extends BuilderAbstract
/** /**
* Select minimum. * Select minimum.
*
* @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -822,6 +832,8 @@ class Builder extends BuilderAbstract
/** /**
* Select maximum. * Select maximum.
*
* @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -831,6 +843,8 @@ class Builder extends BuilderAbstract
/** /**
* Select sum. * Select sum.
*
* @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -840,6 +854,8 @@ class Builder extends BuilderAbstract
/** /**
* Select average. * Select average.
*
* @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -850,7 +866,7 @@ class Builder extends BuilderAbstract
/** /**
* Insert into columns. * Insert into columns.
* *
* @param array $columns Columns * @param array ...$columns Columns
* *
* @return Builder * @return Builder
* *
@ -892,7 +908,7 @@ class Builder extends BuilderAbstract
/** /**
* Values to insert. * Values to insert.
* *
* @param array $values Values * @param array ...$values Values
* *
* @return Builder * @return Builder
* *
@ -928,7 +944,7 @@ class Builder extends BuilderAbstract
/** /**
* Values to insert. * Values to insert.
* *
* @param array $sets Values * @param array ...$sets Values
* *
* @return Builder * @return Builder
* *
@ -961,7 +977,7 @@ class Builder extends BuilderAbstract
/** /**
* Update columns. * Update columns.
* *
* @param array $tables Column names to update * @param array ...$tables Column names to update
* *
* @return Builder * @return Builder
* *
@ -988,6 +1004,13 @@ class Builder extends BuilderAbstract
return $this; return $this;
} }
/**
* Delete query
*
* @return Builder
*
* @since 1.0.0
*/
public function delete() : Builder public function delete() : Builder
{ {
if ($this->isReadOnly) { if ($this->isReadOnly) {
@ -1001,6 +1024,8 @@ class Builder extends BuilderAbstract
/** /**
* Increment value. * Increment value.
*
* @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -1010,6 +1035,8 @@ class Builder extends BuilderAbstract
/** /**
* Decrement value. * Decrement value.
*
* @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -1019,6 +1046,8 @@ class Builder extends BuilderAbstract
/** /**
* Join. * Join.
*
* @return Builder
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -1029,6 +1058,8 @@ class Builder extends BuilderAbstract
/** /**
* Join where. * Join where.
*
* @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -1038,6 +1069,8 @@ class Builder extends BuilderAbstract
/** /**
* Left join. * Left join.
*
* @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -1047,6 +1080,8 @@ class Builder extends BuilderAbstract
/** /**
* Left join where. * Left join where.
*
* @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -1056,6 +1091,8 @@ class Builder extends BuilderAbstract
/** /**
* Right join. * Right join.
*
* @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -1065,6 +1102,8 @@ class Builder extends BuilderAbstract
/** /**
* Right join where. * Right join where.
*
* @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -1086,6 +1125,8 @@ class Builder extends BuilderAbstract
/** /**
* On. * On.
*
* @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -63,7 +63,7 @@ class Dispatcher
* Dispatch controller. * Dispatch controller.
* *
* @param string|array|\Closure $controller Controller string * @param string|array|\Closure $controller Controller string
* @param mixed $data Data * @param mixed ...$data Data
* *
* @return array * @return array
* *

View File

@ -194,7 +194,7 @@ class Money implements \Serializable
/** /**
* Add money. * Add money.
* *
* @param Money|string|int|float $value * @param Money|string|int|float $value Value to add
* *
* @return Money * @return Money
* *
@ -228,7 +228,7 @@ class Money implements \Serializable
/** /**
* Sub money. * Sub money.
* *
* @param Money|string|int|float $value * @param Money|string|int|float $value Value to subtract
* *
* @return Money * @return Money
* *
@ -250,7 +250,7 @@ class Money implements \Serializable
/** /**
* Mult. * Mult.
* *
* @param int|float $value * @param int|float $value Value to multiply with
* *
* @return Money * @return Money
* *
@ -268,7 +268,7 @@ class Money implements \Serializable
/** /**
* Div. * Div.
* *
* @param int|float $value * @param int|float $value Value to divide by
* *
* @return Money * @return Money
* *
@ -300,7 +300,7 @@ class Money implements \Serializable
/** /**
* Power. * Power.
* *
* @param int|float $value * @param int|float $value Value to power
* *
* @return Money * @return Money
* *
@ -330,7 +330,7 @@ class Money implements \Serializable
/** /**
* Unserialize. * Unserialize.
* *
* @param mixed $value * @param mixed $value Value to unserialize
* *
* @return void * @return void
* *

View File

@ -215,9 +215,9 @@ class FileLogger implements LoggerInterface
/** /**
* Interpolate context * Interpolate context
* *
* @param string $message * @param string $message Log schema
* @param array $context * @param array $context Context to log
* @param string $level * @param string $level Log level
* *
* @return string * @return string
* *
@ -256,7 +256,7 @@ class FileLogger implements LoggerInterface
/** /**
* Write to file. * Write to file.
* *
* @param string $message * @param string $message Log message
* *
* @return void * @return void
* *
@ -285,14 +285,7 @@ class FileLogger implements LoggerInterface
} }
/** /**
* System is unusable. * {@inheritdoc}
*
* @param string $message
* @param array $context
*
* @return null
*
* @since 1.0.0
*/ */
public function emergency(string $message, array $context = []) /* : void */ public function emergency(string $message, array $context = []) /* : void */
{ {
@ -301,17 +294,7 @@ class FileLogger implements LoggerInterface
} }
/** /**
* Action must be taken immediately. * {@inheritdoc}
*
* Example: Entire website down, database unavailable, etc. This should
* trigger the SMS alerts and wake you up.
*
* @param string $message
* @param array $context
*
* @return void
*
* @since 1.0.0
*/ */
public function alert(string $message, array $context = []) /* : void */ public function alert(string $message, array $context = []) /* : void */
{ {
@ -320,16 +303,7 @@ class FileLogger implements LoggerInterface
} }
/** /**
* Critical conditions. * {@inheritdoc}
*
* Example: Application component unavailable, unexpected exception.
*
* @param string $message
* @param array $context
*
* @return void
*
* @since 1.0.0
*/ */
public function critical(string $message, array $context = []) /* : void */ public function critical(string $message, array $context = []) /* : void */
{ {
@ -338,15 +312,7 @@ class FileLogger implements LoggerInterface
} }
/** /**
* Runtime errors that do not require immediate action but should typically * {@inheritdoc}
* be logged and monitored.
*
* @param string $message
* @param array $context
*
* @return void
*
* @since 1.0.0
*/ */
public function error(string $message, array $context = []) /* : void */ public function error(string $message, array $context = []) /* : void */
{ {
@ -355,17 +321,7 @@ class FileLogger implements LoggerInterface
} }
/** /**
* Exceptional occurrences that are not errors. * {@inheritdoc}
*
* Example: Use of deprecated APIs, poor use of an API, undesirable things
* that are not necessarily wrong.
*
* @param string $message
* @param array $context
*
* @return void
*
* @since 1.0.0
*/ */
public function warning(string $message, array $context = []) /* : void */ public function warning(string $message, array $context = []) /* : void */
{ {
@ -374,14 +330,7 @@ class FileLogger implements LoggerInterface
} }
/** /**
* Normal but significant events. * {@inheritdoc}
*
* @param string $message
* @param array $context
*
* @return void
*
* @since 1.0.0
*/ */
public function notice(string $message, array $context = []) /* : void */ public function notice(string $message, array $context = []) /* : void */
{ {
@ -390,16 +339,7 @@ class FileLogger implements LoggerInterface
} }
/** /**
* Interesting events. * {@inheritdoc}
*
* Example: User logs in, SQL logs.
*
* @param string $message
* @param array $context
*
* @return void
*
* @since 1.0.0
*/ */
public function info(string $message, array $context = []) /* : void */ public function info(string $message, array $context = []) /* : void */
{ {
@ -408,14 +348,7 @@ class FileLogger implements LoggerInterface
} }
/** /**
* Detailed debug information. * {@inheritdoc}
*
* @param string $message
* @param array $context
*
* @return void
*
* @since 1.0.0
*/ */
public function debug(string $message, array $context = []) /* : void */ public function debug(string $message, array $context = []) /* : void */
{ {
@ -424,15 +357,7 @@ class FileLogger implements LoggerInterface
} }
/** /**
* Logs with an arbitrary level. * {@inheritdoc}
*
* @param string $level
* @param string $message
* @param array $context
*
* @return void
*
* @since 1.0.0
*/ */
public function log(string $level, string $message, array $context = []) /* : void */ public function log(string $level, string $message, array $context = []) /* : void */
{ {

View File

@ -28,8 +28,8 @@ interface LoggerInterface
/** /**
* System is unusable. * System is unusable.
* *
* @param string $message * @param string $message Logging message schema
* @param array $context * @param array $context Context to log
* *
* @return null * @return null
*/ */
@ -41,8 +41,8 @@ interface LoggerInterface
* Example: Entire website down, database unavailable, etc. This should * Example: Entire website down, database unavailable, etc. This should
* trigger the SMS alerts and wake you up. * trigger the SMS alerts and wake you up.
* *
* @param string $message * @param string $message Logging message schema
* @param array $context * @param array $context Context to log
* *
* @return null * @return null
*/ */
@ -53,8 +53,8 @@ interface LoggerInterface
* *
* Example: Application component unavailable, unexpected exception. * Example: Application component unavailable, unexpected exception.
* *
* @param string $message * @param string $message Logging message schema
* @param array $context * @param array $context Context to log
* *
* @return null * @return null
*/ */
@ -64,8 +64,8 @@ interface LoggerInterface
* Runtime errors that do not require immediate action but should typically * Runtime errors that do not require immediate action but should typically
* be logged and monitored. * be logged and monitored.
* *
* @param string $message * @param string $message Logging message schema
* @param array $context * @param array $context Context to log
* *
* @return null * @return null
*/ */
@ -77,8 +77,8 @@ interface LoggerInterface
* Example: Use of deprecated APIs, poor use of an API, undesirable things * Example: Use of deprecated APIs, poor use of an API, undesirable things
* that are not necessarily wrong. * that are not necessarily wrong.
* *
* @param string $message * @param string $message Logging message schema
* @param array $context * @param array $context Context to log
* *
* @return null * @return null
*/ */
@ -87,8 +87,8 @@ interface LoggerInterface
/** /**
* Normal but significant events. * Normal but significant events.
* *
* @param string $message * @param string $message Logging message schema
* @param array $context * @param array $context Context to log
* *
* @return null * @return null
*/ */
@ -99,8 +99,8 @@ interface LoggerInterface
* *
* Example: User logs in, SQL logs. * Example: User logs in, SQL logs.
* *
* @param string $message * @param string $message Logging message schema
* @param array $context * @param array $context Context to log
* *
* @return null * @return null
*/ */
@ -109,8 +109,8 @@ interface LoggerInterface
/** /**
* Detailed debug information. * Detailed debug information.
* *
* @param string $message * @param string $message Logging message schema
* @param array $context * @param array $context Context to log
* *
* @return null * @return null
*/ */
@ -119,9 +119,9 @@ interface LoggerInterface
/** /**
* Logs with an arbitrary level. * Logs with an arbitrary level.
* *
* @param string $level * @param string $level Log level/severeness
* @param string $message * @param string $message Logging message schema
* @param array $context * @param array $context Context to log
* *
* @return null * @return null
*/ */

View File

@ -70,8 +70,8 @@ class Functions
* *
* Example: (7, 2) * Example: (7, 2)
* *
* @param int $n * @param int $n n
* @param int $k * @param int $k k
* *
* @return int * @return int
* *
@ -111,8 +111,8 @@ class Functions
/** /**
* Calculate ackermann function. * Calculate ackermann function.
* *
* @param int $m * @param int $m m
* @param int $n * @param int $n n
* *
* @return int * @return int
* *
@ -152,7 +152,7 @@ class Functions
/** /**
* Calculate inverse modular. * Calculate inverse modular.
* *
* @param int $a * @param int $a a
* @param int $n Modulo * @param int $n Modulo
* *
* @return int * @return int
@ -198,8 +198,8 @@ class Functions
/** /**
* Modular implementation for negative values. * Modular implementation for negative values.
* *
* @param int $a * @param int $a a
* @param int $b * @param int $b b
* *
* @return int * @return int
* *

View File

@ -224,6 +224,8 @@ class Header extends HeaderAbstract
/** /**
* Push all headers. * Push all headers.
*
* @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -27,7 +27,7 @@ interface UploadedFileInterface
/** /**
* Retrieve a stream representing the uploaded file. * Retrieve a stream representing the uploaded file.
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function getStream(); public function getStream();
@ -45,29 +45,37 @@ interface UploadedFileInterface
/** /**
* Retrieve the file size. * Retrieve the file size.
*
* @return int
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function getSize(); public function getSize() : int;
/** /**
* Retrieve the error associated with the uploaded file. * Retrieve the error associated with the uploaded file.
*
* @return int
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function getError(); public function getError() : int;
/** /**
* Retrieve the filename sent by the client. * Retrieve the filename sent by the client.
*
* @return string
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function getClientFilename(); public function getClientFilename() : string;
/** /**
* Retrieve the media type sent by the client. * Retrieve the media type sent by the client.
*
* @return string
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function getClientMediaType(); public function getClientMediaType() : string;
} }

View File

@ -101,6 +101,8 @@ class Head implements RenderableInterface
/** /**
* Set page meta. * Set page meta.
*
* @return Meta
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -110,6 +110,8 @@ class InfoManager
* @param string $path Value path * @param string $path Value path
* @param mixed $data Scalar or array of data to set * @param mixed $data Scalar or array of data to set
* @param string $delim Delimiter of path * @param string $delim Delimiter of path
*
* @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -94,6 +94,8 @@ class ModuleFactory
* Load modules this module is requesting from * Load modules this module is requesting from
* *
* @param ModuleAbstract $obj Current module * @param ModuleAbstract $obj Current module
*
* @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -112,6 +114,8 @@ class ModuleFactory
* Register modules this module is receiving from * Register modules this module is receiving from
* *
* @param ModuleAbstract $obj Current module * @param ModuleAbstract $obj Current module
*
* @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -210,6 +210,15 @@ class ModuleManager
return $this->active; return $this->active;
} }
/**
* Is module active
*
* @param string $module Module name
*
* @return bool
*
* @since 1.0.0
*/
public function isActive(string $module) : bool public function isActive(string $module) : bool
{ {
return in_array($module, $this->getActiveModules(false)); return in_array($module, $this->getActiveModules(false));
@ -294,7 +303,7 @@ class ModuleManager
*/ */
private function loadInfo(string $module) : InfoManager private function loadInfo(string $module) : InfoManager
{ {
$path = realpath($oldPath = $this->modulePath . '/' . $module . '/' . 'info.json'); $path = realpath($oldPath = $this->modulePath . '/' . $module . '/info.json');
if ($path === false) { if ($path === false) {
throw new PathException($oldPath); throw new PathException($oldPath);

View File

@ -263,18 +263,7 @@ class PackageManager
private function authenticate(string $signedHash, string $rawHash) : bool private function authenticate(string $signedHash, string $rawHash) : bool
{ {
// https://3v4l.org/PN9Xl // https://3v4l.org/PN9Xl
$publicKey = 'MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAjr73rerPRq3ZwWmrUKsN $publicKey = 'MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAjr73rerPRq3ZwWmrUKsNBjg8Wy5lnyWu9HCRQz0fix6grz+NOOsr4m/jazB2knfdtn7fi5XifbIbmrNJY8e6musCJ0FTgJPVBqVk7XAFVSRe2gUaCPZrTPtfZ00C3cynjwTlxSdjNtU9N0ZAo17sVWghH8ki4T2d5Mg1erGOtMJzp5yw47UHUa+KbxUmUV25WMcRYyi7+itD2xANF2AE+PQZT1dSEU8++NI+zT6tXD/Orv5ikk0whoVqvo6duWejx5n5cpJB4EiMo4Q7epbw9uMo9uIKqgQ9y3KdT36GBQkBErFf1dhf8KYJBGYMhO1UJE11dY3XrA7Ij1+zK+aiduQHOc5EMClUGZQzCJAIU5lj4WEHQ4Lo0gop+fx9hzuBTDxdyOjWSJzkqyuWMkq3zEpRBay785iaglaue9XDLee58wY+toiGLBfXe73gsbDqDSOll+cQYNjrronVN7sUDc2WyTIVW1Z8KFwK10D3SW0oEylCaGLtClyyihuW7JPu/8Or1Zjf87W82XTm31FpYkRgoEMDtVHZq0N2eHpLz1L8zKyT0ogZYN5eH5VlGrPcpwbAludNKlgAJ0hrgED19YsCBLwJQpFa4VZP7A5a/Qcw8EFAvNkgaPpBbAAtWoDbyOQsez6Jsdan/enfZ18+LL7qOB5oFFM/pKlTIeVS+UsCAwEAAQ==';
Bjg8Wy5lnyWu9HCRQz0fix6grz+NOOsr4m/jazB2knfdtn7fi5XifbIbmrNJY8e6
musCJ0FTgJPVBqVk7XAFVSRe2gUaCPZrTPtfZ00C3cynjwTlxSdjNtU9N0ZAo17s
VWghH8ki4T2d5Mg1erGOtMJzp5yw47UHUa+KbxUmUV25WMcRYyi7+itD2xANF2AE
+PQZT1dSEU8++NI+zT6tXD/Orv5ikk0whoVqvo6duWejx5n5cpJB4EiMo4Q7epbw
9uMo9uIKqgQ9y3KdT36GBQkBErFf1dhf8KYJBGYMhO1UJE11dY3XrA7Ij1+zK+ai
duQHOc5EMClUGZQzCJAIU5lj4WEHQ4Lo0gop+fx9hzuBTDxdyOjWSJzkqyuWMkq3
zEpRBay785iaglaue9XDLee58wY+toiGLBfXe73gsbDqDSOll+cQYNjrronVN7sU
Dc2WyTIVW1Z8KFwK10D3SW0oEylCaGLtClyyihuW7JPu/8Or1Zjf87W82XTm31Fp
YkRgoEMDtVHZq0N2eHpLz1L8zKyT0ogZYN5eH5VlGrPcpwbAludNKlgAJ0hrgED1
9YsCBLwJQpFa4VZP7A5a/Qcw8EFAvNkgaPpBbAAtWoDbyOQsez6Jsdan/enfZ18+
LL7qOB5oFFM/pKlTIeVS+UsCAwEAAQ==';
$unsignedHash = \sodium_crypto_sign_open($signedHash, $publicKey); $unsignedHash = \sodium_crypto_sign_open($signedHash, $publicKey);
return $unsignedHash === $rawHash; return $unsignedHash === $rawHash;

View File

@ -24,6 +24,12 @@ namespace phpOMS\Security;
*/ */
class PhpCode class PhpCode
{ {
/**
* Deprecated functions
*
* @var array
* @since 1.0.0
*/
public static $deprecatedFunctions = [ public static $deprecatedFunctions = [
'apache_child_terminate', 'apache_setenv', 'define_syslog_variables', 'escapeshellarg', 'escapeshellcmd', 'eval', 'apache_child_terminate', 'apache_setenv', 'define_syslog_variables', 'escapeshellarg', 'escapeshellcmd', 'eval',
'exec', 'fp', 'fput', 'ftp_connect', 'ftp_exec', 'ftp_get', 'ftp_login', 'ftp_nb_fput', 'ftp_put', 'ftp_raw', 'exec', 'fp', 'fput', 'ftp_connect', 'ftp_exec', 'ftp_get', 'ftp_login', 'ftp_nb_fput', 'ftp_put', 'ftp_raw',
@ -33,16 +39,43 @@ class PhpCode
'posix_setuid', 'posix_uname', 'proc_close', 'proc_get_status', 'posix_setuid', 'posix_uname', 'proc_close', 'proc_get_status',
]; ];
/**
* Normalize source code for inspection
*
* @param string $source Source code
*
* @return string
*
* @since 1.0.0
*/
private static function normalizeSource(string $source) : string private static function normalizeSource(string $source) : string
{ {
return str_replace(["\n", "\r\n", "\r", "\t"], ['', '', '', ' '], $source); return str_replace(["\n", "\r\n", "\r", "\t"], ['', '', '', ' '], $source);
} }
/**
* Check if has source unicode
*
* @param string $source Source code
*
* @return bool
*
* @since 1.0.0
*/
public static function hasUnicode(string $source) : bool public static function hasUnicode(string $source) : bool
{ {
return (bool) preg_match('/[^\x20-\x7f]/', $source) || !mb_check_encoding($source, 'ASCII'); return (bool) preg_match('/[^\x20-\x7f]/', $source) || !mb_check_encoding($source, 'ASCII');
} }
/**
* Check if function is disabled
*
* @param array $functions Functions to check
*
* @return bool
*
* @since 1.0.0
*/
public static function isDisabled(array $functions) : bool public static function isDisabled(array $functions) : bool
{ {
$disabled = ini_get('disable_functions'); $disabled = ini_get('disable_functions');
@ -58,12 +91,21 @@ class PhpCode
return true; return true;
} }
/**
* Check if has deprecated functions
*
* @param string $source Source code
*
* @return bool
*
* @since 1.0.0
*/
public static function hasDeprecatedFunction(string $source) : bool public static function hasDeprecatedFunction(string $source) : bool
{ {
$source = self::normalizeSource($source); $source = self::normalizeSource($source);
foreach (self::$deprecatedFunctions as $function) { foreach (self::$deprecatedFunctions as $function) {
if (preg_match('/' . $function . '\s*\(' . '/', $source) === 1) { if (preg_match('/' . $function . '\s*\(/', $source) === 1) {
return true; return true;
} }
} }

View File

@ -324,8 +324,10 @@ interface ContainerInterface
* *
* This is used in order to initialize all resources. * This is used in order to initialize all resources.
* Sub-sub-resources are only initialized once they are needed. * Sub-sub-resources are only initialized once they are needed.
*
* @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function index(); public function index(); /* : void */
} }

View File

@ -120,7 +120,7 @@ interface UriInterface
/** /**
* Set root path. * Set root path.
* *
* @param string $uri Uri * @param string $root Root path
* *
* @return void * @return void
* *

View File

@ -232,7 +232,7 @@ class ArrayUtils
$str .= $key . ' => ' . $value . ', '; $str .= $key . ' => ' . $value . ', ';
break; break;
case 'string': case 'string':
$str .= $key . ' => \'' . $value . '\'' . ', '; $str .= $key . ' => \'' . $value . '\', ';
break; break;
case 'object': case 'object':
$str .= $key . ' => ' . get_class($value['default']) . '()'; $str .= $key . ' => ' . get_class($value['default']) . '()';

View File

@ -84,6 +84,8 @@ class C128a extends C128Abstract
* Set content to encrypt * Set content to encrypt
* *
* @param string $content Content to encrypt * @param string $content Content to encrypt
*
* @return void
* *
* @todo : add mirror parameter * @todo : add mirror parameter
* *

View File

@ -53,6 +53,8 @@ class Currency
* Reset currency rates. * Reset currency rates.
* *
* Can be used in order to refresh them. Be careful currency rates only get updated once a day from the ECB website. * Can be used in order to refresh them. Be careful currency rates only get updated once a day from the ECB website.
*
* @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -60,6 +60,8 @@ class Branch
* Set branch name * Set branch name
* *
* @param string $name Branch name * @param string $name Branch name
*
* @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -152,6 +152,8 @@ class Commit
* Set commit message. * Set commit message.
* *
* @param string $message Commit message * @param string $message Commit message
*
* @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -208,6 +210,8 @@ class Commit
* Set commit author. * Set commit author.
* *
* @param Author $author Commit author * @param Author $author Commit author
*
* @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -232,6 +236,8 @@ class Commit
* Set commit branch. * Set commit branch.
* *
* @param Branch $branch Commit branch * @param Branch $branch Commit branch
*
* @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -256,6 +262,8 @@ class Commit
* Set commit tag. * Set commit tag.
* *
* @param Tag $tag Commit tag * @param Tag $tag Commit tag
*
* @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -306,6 +314,8 @@ class Commit
* Set commit repository. * Set commit repository.
* *
* @param Repository $repository Commit repository * @param Repository $repository Commit repository
*
* @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -321,6 +331,8 @@ class Commit
* @param int $line Line number * @param int $line Line number
* @param string $old Old line * @param string $old Old line
* @param string $new New line * @param string $new New line
*
* @return void
* *
* @throws \Exception * @throws \Exception
* *

View File

@ -73,6 +73,8 @@ class Git
* Set git binary. * Set git binary.
* *
* @param string $path Git path * @param string $path Git path
*
* @return void
* *
* @throws PathException * @throws PathException
* *

View File

@ -76,6 +76,8 @@ class Repository
* Set repository path. * Set repository path.
* *
* @param string $path Path to repository * @param string $path Path to repository
*
* @return void
* *
* @throws PathException * @throws PathException
* *

View File

@ -77,13 +77,13 @@ class Text
/** /**
* Set if the text should have formatting. * Set if the text should have formatting.
* *
* @param bool $hasFormatting * @param bool $hasFormatting Text has formatting.
* *
* @return void * @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function setFormatting($hasFormatting) /* : void */ public function setFormatting(bool $hasFormatting) /* : void */
{ {
$this->hasFormatting = $hasFormatting; $this->hasFormatting = $hasFormatting;
} }
@ -91,13 +91,13 @@ class Text
/** /**
* Set if the text should have paragraphs. * Set if the text should have paragraphs.
* *
* @param bool $hasParagraphs * @param bool $hasParagraphs Text has paragraphs
* *
* @return void * @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function setParagraphs($hasParagraphs) /* : void */ public function setParagraphs(bool $hasParagraphs) /* : void */
{ {
$this->hasParagraphs = $hasParagraphs; $this->hasParagraphs = $hasParagraphs;
} }

View File

@ -109,6 +109,8 @@ class Interval implements \Serializable
* Unserialize. * Unserialize.
* *
* @param string $serialized String to unserialize * @param string $serialized String to unserialize
*
* @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -279,6 +281,8 @@ class Interval implements \Serializable
* @param int $step Step * @param int $step Step
* @param bool $any Any * @param bool $any Any
* *
* @return void
*
* @throws \Exception * @throws \Exception
* *
* @since 1.0.0 * @since 1.0.0
@ -341,6 +345,8 @@ class Interval implements \Serializable
* @param array $hour Hour * @param array $hour Hour
* @param int $step Step * @param int $step Step
* @param bool $any Any * @param bool $any Any
*
* @return void
* *
* @throws \Exception * @throws \Exception
* *
@ -379,6 +385,8 @@ class Interval implements \Serializable
* @param bool $any Any * @param bool $any Any
* @param bool $last Last * @param bool $last Last
* @param int $nearest Nearest day * @param int $nearest Nearest day
*
* @return void
* *
* @throws \Exception * @throws \Exception
* *
@ -446,6 +454,8 @@ class Interval implements \Serializable
* @param int $step Step * @param int $step Step
* @param bool $any Any * @param bool $any Any
* @param bool $last Last * @param bool $last Last
*
* @return void
* *
* @throws \Exception * @throws \Exception
* *
@ -508,6 +518,8 @@ class Interval implements \Serializable
* @param array $month Month * @param array $month Month
* @param int $step Step * @param int $step Step
* @param bool $any Any * @param bool $any Any
*
* @return void
* *
* @throws \Exception * @throws \Exception
* *
@ -544,6 +556,8 @@ class Interval implements \Serializable
* @param array $year Year * @param array $year Year
* @param int $step Step * @param int $step Step
* @param bool $any Any * @param bool $any Any
*
* @return void
* *
* @throws \Exception * @throws \Exception
* *

View File

@ -52,6 +52,8 @@ abstract class SchedulerAbstract
* Set git binary. * Set git binary.
* *
* @param string $path Git path * @param string $path Git path
*
* @return void
* *
* @throws PathException * @throws PathException
* *
@ -92,7 +94,7 @@ abstract class SchedulerAbstract
/** /**
* Create task * Create task
* *
* @param TaskAbstract * @param TaskAbstract $task Task to create
* *
* @return void * @return void
* *

View File

@ -18,6 +18,9 @@ use phpOMS\Validation\ValidatorAbstract;
class Barcode extends ValidatorAbstract class Barcode extends ValidatorAbstract
{ {
/**
* {@inheritdoc}
*/
public static function isValid($value, array $constraints = null) public static function isValid($value, array $constraints = null)
{ {

View File

@ -18,6 +18,9 @@ use phpOMS\Validation\ValidatorAbstract;
class Barcode11 extends ValidatorAbstract class Barcode11 extends ValidatorAbstract
{ {
/**
* {@inheritdoc}
*/
public static function isValid($value, array $constraints = null) public static function isValid($value, array $constraints = null)
{ {

View File

@ -18,6 +18,9 @@ use phpOMS\Validation\ValidatorAbstract;
class Barcode128 extends ValidatorAbstract class Barcode128 extends ValidatorAbstract
{ {
/**
* {@inheritdoc}
*/
public static function isValid($value, array $constraints = null) public static function isValid($value, array $constraints = null)
{ {

View File

@ -18,6 +18,9 @@ use phpOMS\Validation\ValidatorAbstract;
class Barcode25 extends ValidatorAbstract class Barcode25 extends ValidatorAbstract
{ {
/**
* {@inheritdoc}
*/
public static function isValid($value, array $constraints = null) public static function isValid($value, array $constraints = null)
{ {

View File

@ -18,6 +18,9 @@ use phpOMS\Validation\ValidatorAbstract;
class Barcode39 extends ValidatorAbstract class Barcode39 extends ValidatorAbstract
{ {
/**
* {@inheritdoc}
*/
public static function isValid($value, array $constraints = null) public static function isValid($value, array $constraints = null)
{ {

View File

@ -18,6 +18,9 @@ use phpOMS\Validation\ValidatorAbstract;
class Barcode93 extends ValidatorAbstract class Barcode93 extends ValidatorAbstract
{ {
/**
* {@inheritdoc}
*/
public static function isValid($value, array $constraints = null) public static function isValid($value, array $constraints = null)
{ {

View File

@ -18,6 +18,9 @@ use phpOMS\Validation\ValidatorAbstract;
class BarcodeCodebar extends ValidatorAbstract class BarcodeCodebar extends ValidatorAbstract
{ {
/**
* {@inheritdoc}
*/
public static function isValid($value, array $constraints = null) public static function isValid($value, array $constraints = null)
{ {

View File

@ -18,6 +18,9 @@ use phpOMS\Validation\ValidatorAbstract;
class BarcodeDatamatrix extends ValidatorAbstract class BarcodeDatamatrix extends ValidatorAbstract
{ {
/**
* {@inheritdoc}
*/
public static function isValid($value, array $constraints = null) public static function isValid($value, array $constraints = null)
{ {

View File

@ -18,6 +18,9 @@ use phpOMS\Validation\ValidatorAbstract;
class BarcodeEAN extends ValidatorAbstract class BarcodeEAN extends ValidatorAbstract
{ {
/**
* {@inheritdoc}
*/
public static function isValid($value, array $constraints = null) public static function isValid($value, array $constraints = null)
{ {

View File

@ -18,6 +18,9 @@ use phpOMS\Validation\ValidatorAbstract;
class BarcodeMSI extends ValidatorAbstract class BarcodeMSI extends ValidatorAbstract
{ {
/**
* {@inheritdoc}
*/
public static function isValid($value, array $constraints = null) public static function isValid($value, array $constraints = null)
{ {

View File

@ -18,6 +18,9 @@ use phpOMS\Validation\ValidatorAbstract;
class QrCode extends ValidatorAbstract class QrCode extends ValidatorAbstract
{ {
/**
* {@inheritdoc}
*/
public static function isValid($value, array $constraints = null) public static function isValid($value, array $constraints = null)
{ {