You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
stats/Entity/AuthenticationEntry.php

123 lines
2.4 KiB

<?php
/**
* Authserver, an OAuth2-based single-signon authentication provider written in PHP.
*
* Copyright (C) 2017 Lars Vierbergen
*
* his program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace vierbergenlars\AuthserverStatsBundle\Entity;
use App\Entity\User;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="vierbergenlars_stats_auth")
*/
class AuthenticationEntry
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*
* @var integer
*/
private $id;
/**
* @ORM\Column(name="ip", type="string")
*
* @var string
*/
private $ip;
/**
* @ORM\Column(name="ts", type="datetime")
*
* @var \DateTime
*/
private $timeStamp;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\User", fetch="EAGER")
* @ORM\JoinColumn(nullable=true)
*
* @var User|null
*/
private $user;
/**
* @ORM\Column(name="success", type="boolean")
*
* @var boolean
*/
private $success;
public function __construct($ip, $success, User $user = null)
{
$this->ip = $ip;
$this->success = $success;
$this->user = $user;
$this->timeStamp = new \DateTime();
}
/**
*
* @return number
*/
public function getId()
{
return $this->id;
}
/**
*
* @return string
*/
public function getIp()
{
return $this->ip;
}
/**
*
* @return \DateTime
*/
public function getTimeStamp()
{
return $this->timeStamp;
}
/**
*
* @return \App\Entity\User|null
*/
public function getUser()
{
return $this->user;
}
/**
*
* @return boolean
*/
public function isSuccess()
{
return $this->success;
}
}