mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 17:58:41 +00:00
cs fixes
This commit is contained in:
parent
5babc18595
commit
17756362a1
|
|
@ -121,7 +121,7 @@ final class Glicko2
|
||||||
|
|
||||||
// Step 0:
|
// Step 0:
|
||||||
$rdOld /= self::Q;
|
$rdOld /= self::Q;
|
||||||
$elo = ($elo - $this->DEFAULT_ELO) / self::Q;
|
$elo = ($elo - $this->DEFAULT_ELO) / self::Q;
|
||||||
|
|
||||||
foreach ($oElo as $idx => $value) {
|
foreach ($oElo as $idx => $value) {
|
||||||
$oElo[$idx] = ($value - $this->DEFAULT_ELO) / self::Q;
|
$oElo[$idx] = ($value - $this->DEFAULT_ELO) / self::Q;
|
||||||
|
|
|
||||||
|
|
@ -171,7 +171,7 @@ final class DeleteMapper extends DataMapperAbstract
|
||||||
|
|
||||||
$objIds = [];
|
$objIds = [];
|
||||||
$refProp = $refClass->getProperty($member);
|
$refProp = $refClass->getProperty($member);
|
||||||
$values = $refProp->isPublic() ? $obj->{$member} : $refProp->getValue($obj);
|
$values = $refProp->isPublic() ? $obj->{$member} : $refProp->getValue($obj);
|
||||||
|
|
||||||
if (!\is_array($values)) {
|
if (!\is_array($values)) {
|
||||||
// conditionals
|
// conditionals
|
||||||
|
|
|
||||||
|
|
@ -262,7 +262,7 @@ final class WriteMapper extends DataMapperAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
$property = $refClass->getProperty($propertyName);
|
$property = $refClass->getProperty($propertyName);
|
||||||
$values = $property->isPublic() ? $obj->{$propertyName} : $property->getValue($obj);
|
$values = $property->isPublic() ? $obj->{$propertyName} : $property->getValue($obj);
|
||||||
|
|
||||||
/** @var class-string<DataMapperFactory> $mapper */
|
/** @var class-string<DataMapperFactory> $mapper */
|
||||||
$mapper = $this->mapper::HAS_MANY[$propertyName]['mapper'];
|
$mapper = $this->mapper::HAS_MANY[$propertyName]['mapper'];
|
||||||
|
|
|
||||||
|
|
@ -153,9 +153,15 @@ final class CliHeader extends HeaderAbstract
|
||||||
*/
|
*/
|
||||||
public function generate(int $code) : void
|
public function generate(int $code) : void
|
||||||
{
|
{
|
||||||
$this->generate500();
|
switch ($code) {
|
||||||
|
default:
|
||||||
|
$this->generate500();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
public function getRequestTime() : int
|
public function getRequestTime() : int
|
||||||
{
|
{
|
||||||
return $this->timestamp;
|
return $this->timestamp;
|
||||||
|
|
|
||||||
|
|
@ -150,6 +150,13 @@ abstract class HeaderAbstract
|
||||||
*/
|
*/
|
||||||
abstract public function has(string $key) : bool;
|
abstract public function has(string $key) : bool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get time of the request
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
abstract public function getRequestTime() : int;
|
abstract public function getRequestTime() : int;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -145,22 +145,47 @@ final class HttpHeader extends HeaderAbstract
|
||||||
return $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1';
|
return $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the referer link
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public function getReferer() : string
|
public function getReferer() : string
|
||||||
{
|
{
|
||||||
return $_SERVER['HTTP_REFERER'] ?? '';
|
return $_SERVER['HTTP_REFERER'] ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
public function getRequestTime() : int
|
public function getRequestTime() : int
|
||||||
{
|
{
|
||||||
return (int) ($_SERVER['REQUEST_TIME'] ?? $this->timestamp);
|
return (int) ($_SERVER['REQUEST_TIME'] ?? $this->timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the ip of the requester
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public function getRequestIp() : string
|
public function getRequestIp() : string
|
||||||
{
|
{
|
||||||
return $_SERVER['HTTP_X_FORWARDED_FOR'] ?? $_SERVER['REMOTE_ADDR'] ?? '';
|
return $_SERVER['HTTP_X_FORWARDED_FOR'] ?? $_SERVER['REMOTE_ADDR'] ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBrowserName(): string {
|
/**
|
||||||
|
* Get the browser/agent name of the request
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public function getBrowserName(): string
|
||||||
|
{
|
||||||
$userAgent = $_SERVER['HTTP_USER_AGENT'];
|
$userAgent = $_SERVER['HTTP_USER_AGENT'];
|
||||||
|
|
||||||
if (\strpos($userAgent, 'Opera') !== false || \strpos($userAgent, 'OPR/') !== false) {
|
if (\strpos($userAgent, 'Opera') !== false || \strpos($userAgent, 'OPR/') !== false) {
|
||||||
|
|
|
||||||
|
|
@ -27,26 +27,93 @@ use phpOMS\Localization\ISO639x1Enum;
|
||||||
*/
|
*/
|
||||||
class ImpressionStat
|
class ImpressionStat
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Request ip
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public string $address = '';
|
public string $address = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request language
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public string $language = ISO639x1Enum::_EN;
|
public string $language = ISO639x1Enum::_EN;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request country
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public string $country = ISO3166TwoEnum::_XXX;
|
public string $country = ISO3166TwoEnum::_XXX;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request time
|
||||||
|
*
|
||||||
|
* @var \DateTime
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public \DateTime $datetime;
|
public \DateTime $datetime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request host/domain
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public string $host = '';
|
public string $host = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request path
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public string $path = '';
|
public string $path = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request full uri
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public string $uri = '';
|
public string $uri = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request referer link
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public string $referer = '';
|
public string $referer = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request browser/agent
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public string $userAgent = '';
|
public string $userAgent = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Additional custom meta data to be stored
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public array $meta = [];
|
public array $meta = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param HttpRequest $request Http request object
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public function __construct(HttpRequest $request)
|
public function __construct(HttpRequest $request)
|
||||||
{
|
{
|
||||||
$this->language = $request->header->l11n->language;
|
$this->language = $request->header->l11n->language;
|
||||||
|
|
@ -60,6 +127,13 @@ class ImpressionStat
|
||||||
$this->userAgent = $request->header->getBrowserName();
|
$this->userAgent = $request->header->getBrowserName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Turn object to array
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public function toArray() : array
|
public function toArray() : array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user