diff --git a/Event/EventManager.php b/Event/EventManager.php index 898b3821c..ecdd60481 100644 --- a/Event/EventManager.php +++ b/Event/EventManager.php @@ -157,19 +157,25 @@ class EventManager * * @param string $group Name of the event * - * @return void + * @return bool * * @since 1.0.0 */ - public function detach(string $group) /* : bool */ + public function detach(string $group) : bool { + $found = false; + if (isset($this->callbacks[$group])) { unset($this->callbacks[$group]); + $found = true; } if (isset($this->groups[$group])) { unset($this->groups[$group]); + $found = true; } + + return $found; } /** diff --git a/Localization/L11nManager.php b/Localization/L11nManager.php index 100646fbb..91590e1a1 100644 --- a/Localization/L11nManager.php +++ b/Localization/L11nManager.php @@ -189,4 +189,9 @@ class L11nManager return $this->language[$code][$module][$translation]; } + + public function getHtml(string $code, string $module, string $theme, string $translation) : string + { + return htmlspecialchars($this->getText($code, $module, $theme, $translation)); + } } diff --git a/Message/Http/Request.php b/Message/Http/Request.php index 084de7896..60badbd4d 100644 --- a/Message/Http/Request.php +++ b/Message/Http/Request.php @@ -282,6 +282,7 @@ class Request extends RequestAbstract if (!isset($this->browser)) { $arr = BrowserType::getConstants(); $http_request_type = strtolower($_SERVER['HTTP_USER_AGENT']); + foreach ($arr as $key => $val) { if (stripos($http_request_type, $val)) { $this->browser = $val; diff --git a/Message/RequestAbstract.php b/Message/RequestAbstract.php index 70c078137..b3cc27a4b 100644 --- a/Message/RequestAbstract.php +++ b/Message/RequestAbstract.php @@ -110,7 +110,7 @@ abstract class RequestAbstract implements MessageInterface * @var \phpOMS\Message\RequestSource * @since 1.0.0 */ - private $source = null; + private $source = RequestSource::UNDEFINED; /** * Request hash. diff --git a/Message/RequestSource.php b/Message/RequestSource.php index a65e90d5a..3b30da6df 100644 --- a/Message/RequestSource.php +++ b/Message/RequestSource.php @@ -31,4 +31,5 @@ abstract class RequestSource extends Enum /* public */ const WEB = 0; /* This is a http request */ /* public */ const CONSOLE = 1; /* Request is a console command */ /* public */ const SOCKET = 2; /* Request through socket connection */ + /* public */ const UNDEFINED = 3; /* Request through socket connection */ } diff --git a/Validation/Base/DateTime.php b/Validation/Base/DateTime.php index e7a5ba372..8f0e8cdb8 100644 --- a/Validation/Base/DateTime.php +++ b/Validation/Base/DateTime.php @@ -41,7 +41,7 @@ abstract class DateTime extends ValidatorAbstract /** * {@inheritdoc} */ - public static function isValid($value) : bool + public static function isValid($value, array $constraints = null) : bool { return (bool) strtotime($value); } diff --git a/Validation/Finance/BIC.php b/Validation/Finance/BIC.php index cdf5e91db..5802fa04c 100644 --- a/Validation/Finance/BIC.php +++ b/Validation/Finance/BIC.php @@ -41,7 +41,7 @@ class BIC extends ValidatorAbstract /** * {@inheritdoc} */ - public static function isValid($value) : bool + public static function isValid($value, array $constraints = null) : bool { return (bool) preg_match('/^[a-z]{6}[0-9a-z]{2}([0-9a-z]{3})?\z/i', $value); } diff --git a/Validation/Finance/CreditCard.php b/Validation/Finance/CreditCard.php index 899129672..4ed2c178f 100644 --- a/Validation/Finance/CreditCard.php +++ b/Validation/Finance/CreditCard.php @@ -41,7 +41,7 @@ abstract class CreditCard extends ValidatorAbstract /** * {@inheritdoc} */ - public static function isValid($value) : bool + public static function isValid($value, array $constraints = null) : bool { $value = preg_replace('/\D/', '', $value); diff --git a/Validation/Finance/Iban.php b/Validation/Finance/Iban.php index 3045603b3..9095b3b87 100644 --- a/Validation/Finance/Iban.php +++ b/Validation/Finance/Iban.php @@ -45,7 +45,7 @@ abstract class Iban extends ValidatorAbstract * * @since 1.0.0 */ - public static function isValid($value) : bool + public static function isValid($value, array $constraints = null) : bool { $value = str_replace(' ', '', strtolower($value)); $enumName = 'C_' . strtoupper(substr($value, 0, 2)); diff --git a/Validation/Network/Email.php b/Validation/Network/Email.php index 8f3e506ed..f474ac3e0 100644 --- a/Validation/Network/Email.php +++ b/Validation/Network/Email.php @@ -41,7 +41,7 @@ class Email extends ValidatorAbstract /** * {@inheritdoc} */ - public static function isValid(string $value) : bool + public static function isValid($value, array $constraints = null) : bool { if (filter_var($value, FILTER_VALIDATE_EMAIL) === false) { self::$msg = 'Invalid Email by filter_var standards'; diff --git a/Validation/Network/Hostname.php b/Validation/Network/Hostname.php index 53df28894..5d64b4c3b 100644 --- a/Validation/Network/Hostname.php +++ b/Validation/Network/Hostname.php @@ -41,7 +41,7 @@ abstract class Hostname extends ValidatorAbstract /** * {@inheritdoc} */ - public static function isValid($value) : bool + public static function isValid($value, array $constraints = null) : bool { return filter_var(gethostbyname($value), FILTER_VALIDATE_IP) !== false; } diff --git a/Validation/Network/Ip.php b/Validation/Network/Ip.php index abd1222e5..4a1788b9a 100644 --- a/Validation/Network/Ip.php +++ b/Validation/Network/Ip.php @@ -41,7 +41,7 @@ class Ip extends ValidatorAbstract /** * {@inheritdoc} */ - public static function isValid($value) : bool + public static function isValid($value, array $constraints = null) : bool { return filter_var($value, FILTER_VALIDATE_IP) !== false; }