* [ADD] Improved tracking handling.

* [MOD] Improved login process workflow.
This commit is contained in:
nuxsmin
2018-02-26 14:07:14 +01:00
committed by Rubén Domínguez
parent 94f9929be0
commit ed0d95b774
13 changed files with 581 additions and 120 deletions

View File

@@ -0,0 +1,53 @@
<?php
namespace SP\Repositories\Track;
use SP\Core\Exceptions\InvalidArgumentException;
/**
* Class TrackRequest
* @package SP\Repositories\Track
*/
class TrackRequest
{
public $time;
public $source;
public $userId;
protected $ipv6;
protected $ipv4;
/**
* @param string $address
* @throws InvalidArgumentException
*/
public function setTrackIp($address)
{
$ip = @inet_pton($address);
if (strlen($ip) === 4) {
$this->ipv4 = $ip;
} elseif (strlen($ip) > 4) {
$this->ipv6 = $ip;
} elseif ($ip === false) {
debugLog(sprintf('%s : %s', __('IP inválida'), $address));
throw new InvalidArgumentException(__u('IP inválida'), InvalidArgumentException::ERROR, $address);
}
}
/**
* @return string
*/
public function getIpv6()
{
return $this->ipv6;
}
/**
* @return string
*/
public function getIpv4()
{
return $this->ipv4;
}
}