Refactored project structure.
This commit is contained in:
parent
cfe93434ad
commit
c015d8c58b
308 changed files with 39 additions and 47 deletions
|
|
@ -1,340 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace PHPCensor\Model;
|
||||
|
||||
use PHPCensor\Config;
|
||||
use PHPCensor\Model;
|
||||
|
||||
/**
|
||||
* @author Dan Cryer <dan@block8.co.uk>
|
||||
*/
|
||||
class User extends Model
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $tableName = 'user';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $data = [
|
||||
'id' => null,
|
||||
'email' => null,
|
||||
'hash' => null,
|
||||
'is_admin' => null,
|
||||
'name' => null,
|
||||
'language' => null,
|
||||
'per_page' => null,
|
||||
'provider_key' => null,
|
||||
'provider_data' => null,
|
||||
'remember_key' => null,
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $getters = [
|
||||
'id' => 'getId',
|
||||
'email' => 'getEmail',
|
||||
'hash' => 'getHash',
|
||||
'is_admin' => 'getIsAdmin',
|
||||
'name' => 'getName',
|
||||
'language' => 'getLanguage',
|
||||
'per_page' => 'getPerPage',
|
||||
'provider_key' => 'getProviderKey',
|
||||
'provider_data' => 'getProviderData',
|
||||
'remember_key' => 'getRememberKey',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $setters = [
|
||||
'id' => 'setId',
|
||||
'email' => 'setEmail',
|
||||
'hash' => 'setHash',
|
||||
'is_admin' => 'setIsAdmin',
|
||||
'name' => 'setName',
|
||||
'language' => 'setLanguage',
|
||||
'per_page' => 'setPerPage',
|
||||
'provider_key' => 'setProviderKey',
|
||||
'provider_data' => 'setProviderData',
|
||||
'remember_key' => 'setRememberKey',
|
||||
];
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
$rtn = $this->data['id'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getEmail()
|
||||
{
|
||||
$rtn = $this->data['email'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getHash()
|
||||
{
|
||||
$rtn = $this->data['hash'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
$rtn = $this->data['name'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getIsAdmin()
|
||||
{
|
||||
$rtn = $this->data['is_admin'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getProviderKey()
|
||||
{
|
||||
$rtn = $this->data['provider_key'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getProviderData()
|
||||
{
|
||||
$rtn = $this->data['provider_data'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getRememberKey()
|
||||
{
|
||||
$rtn = $this->data['remember_key'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLanguage()
|
||||
{
|
||||
$rtn = $this->data['language'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPerPage()
|
||||
{
|
||||
$rtn = $this->data['per_page'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $value
|
||||
*/
|
||||
public function setId($value)
|
||||
{
|
||||
$this->validateNotNull('id', $value);
|
||||
$this->validateInt('id', $value);
|
||||
|
||||
if ($this->data['id'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['id'] = $value;
|
||||
|
||||
$this->setModified('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setEmail($value)
|
||||
{
|
||||
$this->validateNotNull('email', $value);
|
||||
$this->validateString('email', $value);
|
||||
|
||||
if ($this->data['email'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['email'] = $value;
|
||||
|
||||
$this->setModified('email');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setHash($value)
|
||||
{
|
||||
$this->validateNotNull('hash', $value);
|
||||
$this->validateString('hash', $value);
|
||||
|
||||
if ($this->data['hash'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['hash'] = $value;
|
||||
|
||||
$this->setModified('hash');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setName($value)
|
||||
{
|
||||
$this->validateNotNull('name', $value);
|
||||
$this->validateString('name', $value);
|
||||
|
||||
if ($this->data['name'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['name'] = $value;
|
||||
|
||||
$this->setModified('name');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $value
|
||||
*/
|
||||
public function setIsAdmin($value)
|
||||
{
|
||||
$this->validateNotNull('is_admin', $value);
|
||||
$this->validateInt('is_admin', $value);
|
||||
|
||||
if ($this->data['is_admin'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['is_admin'] = $value;
|
||||
|
||||
$this->setModified('is_admin');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setProviderKey($value)
|
||||
{
|
||||
$this->validateNotNull('provider_key', $value);
|
||||
$this->validateString('provider_key', $value);
|
||||
|
||||
if ($this->data['provider_key'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['provider_key'] = $value;
|
||||
|
||||
$this->setModified('provider_key');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setProviderData($value)
|
||||
{
|
||||
$this->validateString('provider_data', $value);
|
||||
|
||||
if ($this->data['provider_data'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['provider_data'] = $value;
|
||||
|
||||
$this->setModified('provider_data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setRememberKey($value)
|
||||
{
|
||||
$this->validateString('remember_key', $value);
|
||||
|
||||
if ($this->data['remember_key'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['remember_key'] = $value;
|
||||
|
||||
$this->setModified('remember_key');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setLanguage($value)
|
||||
{
|
||||
if ($this->data['language'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['language'] = $value;
|
||||
|
||||
$this->setModified('language');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setPerPage($value)
|
||||
{
|
||||
if ($this->data['per_page'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['per_page'] = $value;
|
||||
|
||||
$this->setModified('per_page');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getFinalPerPage()
|
||||
{
|
||||
$perPage = $this->getPerPage();
|
||||
if ($perPage) {
|
||||
return (integer)$perPage;
|
||||
}
|
||||
|
||||
return (integer)Config::getInstance()->get('php-censor.per_page', 10);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue