Fixes from test

This commit is contained in:
Dennis Eichhorn 2017-08-12 16:50:21 +02:00
parent 6554060634
commit c3686e3db0
12 changed files with 23 additions and 10 deletions

View File

@ -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;
}
/**

View File

@ -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));
}
}

View File

@ -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;

View File

@ -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.

View File

@ -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 */
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);

View File

@ -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));

View File

@ -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';

View File

@ -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;
}

View File

@ -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;
}