Refactored models.
This commit is contained in:
parent
fee4b127b0
commit
fb11ba4652
34 changed files with 2006 additions and 2335 deletions
455
src/Model/Base/Build.php
Normal file
455
src/Model/Base/Build.php
Normal file
|
|
@ -0,0 +1,455 @@
|
|||
<?php
|
||||
|
||||
namespace PHPCensor\Model\Base;
|
||||
|
||||
use PHPCensor\Model;
|
||||
|
||||
class Build extends Model
|
||||
{
|
||||
const STATUS_PENDING = 0;
|
||||
const STATUS_RUNNING = 1;
|
||||
const STATUS_SUCCESS = 2;
|
||||
const STATUS_FAILED = 3;
|
||||
|
||||
const SOURCE_UNKNOWN = 0;
|
||||
const SOURCE_MANUAL_WEB = 1;
|
||||
const SOURCE_MANUAL_CONSOLE = 2;
|
||||
const SOURCE_PERIODICAL = 3;
|
||||
const SOURCE_WEBHOOK = 4;
|
||||
const SOURCE_WEBHOOK_PULL_REQUEST = 5;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $data = [
|
||||
'id' => null,
|
||||
'project_id' => null,
|
||||
'commit_id' => null,
|
||||
'status' => null,
|
||||
'log' => null,
|
||||
'branch' => null,
|
||||
'tag' => null,
|
||||
'create_date' => null,
|
||||
'start_date' => null,
|
||||
'finish_date' => null,
|
||||
'committer_email' => null,
|
||||
'commit_message' => null,
|
||||
'extra' => null,
|
||||
'environment' => null,
|
||||
'source' => Build::SOURCE_UNKNOWN,
|
||||
'user_id' => 0,
|
||||
];
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return (integer)$this->data['id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $value
|
||||
*/
|
||||
public function setId($value)
|
||||
{
|
||||
$this->validateNotNull('id', $value);
|
||||
$this->validateInt('id', $value);
|
||||
|
||||
if ($this->data['id'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['id'] = (integer)$value;
|
||||
|
||||
$this->setModified('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getProjectId()
|
||||
{
|
||||
return (integer)$this->data['project_id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $value
|
||||
*/
|
||||
public function setProjectId($value)
|
||||
{
|
||||
$this->validateNotNull('project_id', $value);
|
||||
$this->validateInt('project_id', $value);
|
||||
|
||||
if ($this->data['project_id'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['project_id'] = $value;
|
||||
|
||||
$this->setModified('project_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCommitId()
|
||||
{
|
||||
return $this->data['commit_id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setCommitId($value)
|
||||
{
|
||||
$this->validateNotNull('commit_id', $value);
|
||||
$this->validateString('commit_id', $value);
|
||||
|
||||
if ($this->data['commit_id'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['commit_id'] = $value;
|
||||
|
||||
$this->setModified('commit_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getStatus()
|
||||
{
|
||||
return (integer)$this->data['status'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $value
|
||||
*/
|
||||
public function setStatus($value)
|
||||
{
|
||||
$this->validateNotNull('status', $value);
|
||||
$this->validateInt('status', $value);
|
||||
|
||||
if ($this->data['status'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['status'] = $value;
|
||||
|
||||
$this->setModified('status');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLog()
|
||||
{
|
||||
return $this->data['log'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setLog($value)
|
||||
{
|
||||
$this->validateString('log', $value);
|
||||
|
||||
if ($this->data['log'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['log'] = $value;
|
||||
|
||||
$this->setModified('log');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getBranch()
|
||||
{
|
||||
return $this->data['branch'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setBranch($value)
|
||||
{
|
||||
$this->validateNotNull('branch', $value);
|
||||
$this->validateString('branch', $value);
|
||||
|
||||
if ($this->data['branch'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['branch'] = $value;
|
||||
|
||||
$this->setModified('branch');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTag()
|
||||
{
|
||||
return $this->data['tag'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setTag($value)
|
||||
{
|
||||
$this->validateString('tag', $value);
|
||||
|
||||
if ($this->data['tag'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['tag'] = $value;
|
||||
|
||||
$this->setModified('tag');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DateTime|null
|
||||
*/
|
||||
public function getCreateDate()
|
||||
{
|
||||
if ($this->data['create_date']) {
|
||||
return new \DateTime($this->data['create_date']);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DateTime $value
|
||||
*/
|
||||
public function setCreateDate(\DateTime $value)
|
||||
{
|
||||
$stringValue = $value->format('Y-m-d H:i:s');
|
||||
|
||||
if ($this->data['create_date'] === $stringValue) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['create_date'] = $stringValue;
|
||||
|
||||
$this->setModified('create_date');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DateTime|null
|
||||
*/
|
||||
public function getStartDate()
|
||||
{
|
||||
if ($this->data['start_date']) {
|
||||
return new \DateTime($this->data['start_date']);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DateTime $value
|
||||
*/
|
||||
public function setStartDate(\DateTime $value)
|
||||
{
|
||||
$stringValue = $value->format('Y-m-d H:i:s');
|
||||
|
||||
if ($this->data['start_date'] === $stringValue) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['start_date'] = $stringValue;
|
||||
|
||||
$this->setModified('start_date');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DateTime|null
|
||||
*/
|
||||
public function getFinishDate()
|
||||
{
|
||||
if ($this->data['finish_date']) {
|
||||
return new \DateTime($this->data['finish_date']);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DateTime $value
|
||||
*/
|
||||
public function setFinishDate(\DateTime $value)
|
||||
{
|
||||
$stringValue = $value->format('Y-m-d H:i:s');
|
||||
|
||||
if ($this->data['finish_date'] === $stringValue) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['finish_date'] = $stringValue;
|
||||
|
||||
$this->setModified('finish_date');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCommitterEmail()
|
||||
{
|
||||
return $this->data['committer_email'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setCommitterEmail($value)
|
||||
{
|
||||
$this->validateString('committer_email', $value);
|
||||
|
||||
if ($this->data['committer_email'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['committer_email'] = $value;
|
||||
|
||||
$this->setModified('committer_email');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCommitMessage()
|
||||
{
|
||||
return $this->data['commit_message'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setCommitMessage($value)
|
||||
{
|
||||
$this->validateString('commit_message', $value);
|
||||
|
||||
if ($this->data['commit_message'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['commit_message'] = $value;
|
||||
|
||||
$this->setModified('commit_message');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $key
|
||||
*
|
||||
* @return array|string|null
|
||||
*/
|
||||
public function getExtra($key = null)
|
||||
{
|
||||
$data = json_decode($this->data['extra'], true);
|
||||
$extra = null;
|
||||
if (is_null($key)) {
|
||||
$extra = $data;
|
||||
} elseif (isset($data[$key])) {
|
||||
$extra = $data[$key];
|
||||
}
|
||||
|
||||
return $extra;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $value
|
||||
*/
|
||||
public function setExtra(array $value)
|
||||
{
|
||||
$this->validateNotNull('branches', $value);
|
||||
|
||||
$extra = json_encode($value);
|
||||
if ($this->data['extra'] === $extra) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['extra'] = $extra;
|
||||
|
||||
$this->setModified('extra');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getEnvironment()
|
||||
{
|
||||
return $this->data['environment'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setEnvironment($value)
|
||||
{
|
||||
$this->validateString('environment', $value);
|
||||
|
||||
if ($this->data['environment'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['environment'] = $value;
|
||||
|
||||
$this->setModified('environment');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSource()
|
||||
{
|
||||
return (integer)$this->data['source'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $value
|
||||
*/
|
||||
public function setSource($value)
|
||||
{
|
||||
$this->validateInt('source', $value);
|
||||
|
||||
if ($this->data['source'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['source'] = $value;
|
||||
|
||||
$this->setModified('source');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getUserId()
|
||||
{
|
||||
return (integer)$this->data['user_id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $value
|
||||
*/
|
||||
public function setUserId($value)
|
||||
{
|
||||
$this->validateNotNull('user_id', $value);
|
||||
$this->validateInt('user_id', $value);
|
||||
|
||||
if ($this->data['user_id'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['user_id'] = $value;
|
||||
|
||||
$this->setModified('user_id');
|
||||
}
|
||||
}
|
||||
307
src/Model/Base/BuildError.php
Normal file
307
src/Model/Base/BuildError.php
Normal file
|
|
@ -0,0 +1,307 @@
|
|||
<?php
|
||||
|
||||
namespace PHPCensor\Model\Base;
|
||||
|
||||
use PHPCensor\Model;
|
||||
|
||||
class BuildError extends Model
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $tableName = 'build_error';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $data = [
|
||||
'id' => null,
|
||||
'build_id' => null,
|
||||
'plugin' => null,
|
||||
'file' => null,
|
||||
'line_start' => null,
|
||||
'line_end' => null,
|
||||
'severity' => null,
|
||||
'message' => null,
|
||||
'create_date' => null,
|
||||
'hash' => null,
|
||||
'is_new' => null,
|
||||
];
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return (integer)$this->data['id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @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');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getBuildId()
|
||||
{
|
||||
return (integer)$this->data['build_id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $value
|
||||
*/
|
||||
public function setBuildId($value)
|
||||
{
|
||||
$this->validateNotNull('build_id', $value);
|
||||
$this->validateInt('build_id', $value);
|
||||
|
||||
if ($this->data['build_id'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['build_id'] = $value;
|
||||
|
||||
$this->setModified('build_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPlugin()
|
||||
{
|
||||
return $this->data['plugin'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setPlugin($value)
|
||||
{
|
||||
$this->validateNotNull('plugin', $value);
|
||||
$this->validateString('plugin', $value);
|
||||
|
||||
if ($this->data['plugin'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['plugin'] = $value;
|
||||
|
||||
$this->setModified('plugin');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getFile()
|
||||
{
|
||||
return $this->data['file'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setFile($value)
|
||||
{
|
||||
$this->validateString('file', $value);
|
||||
|
||||
if ($this->data['file'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['file'] = $value;
|
||||
|
||||
$this->setModified('file');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getLineStart()
|
||||
{
|
||||
return (integer)$this->data['line_start'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $value
|
||||
*/
|
||||
public function setLineStart($value)
|
||||
{
|
||||
$this->validateInt('line_start', $value);
|
||||
|
||||
if ($this->data['line_start'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['line_start'] = $value;
|
||||
|
||||
$this->setModified('line_start');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getLineEnd()
|
||||
{
|
||||
return (integer)$this->data['line_end'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $value
|
||||
*/
|
||||
public function setLineEnd($value)
|
||||
{
|
||||
$this->validateInt('line_end', $value);
|
||||
|
||||
if ($this->data['line_end'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['line_end'] = $value;
|
||||
|
||||
$this->setModified('line_end');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getSeverity()
|
||||
{
|
||||
return (integer)$this->data['severity'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $value
|
||||
*/
|
||||
public function setSeverity($value)
|
||||
{
|
||||
$this->validateNotNull('severity', $value);
|
||||
$this->validateInt('severity', $value);
|
||||
|
||||
if ($this->data['severity'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['severity'] = $value;
|
||||
|
||||
$this->setModified('severity');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMessage()
|
||||
{
|
||||
return $this->data['message'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setMessage($value)
|
||||
{
|
||||
$this->validateNotNull('message', $value);
|
||||
$this->validateString('message', $value);
|
||||
|
||||
if ($this->data['message'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['message'] = $value;
|
||||
|
||||
$this->setModified('message');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DateTime|null
|
||||
*/
|
||||
public function getCreateDate()
|
||||
{
|
||||
if ($this->data['create_date']) {
|
||||
return new \DateTime($this->data['create_date']);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DateTime $value
|
||||
*/
|
||||
public function setCreateDate(\DateTime $value)
|
||||
{
|
||||
$this->validateNotNull('create_date', $value);
|
||||
|
||||
$stringValue = $value->format('Y-m-d H:i:s');
|
||||
|
||||
if ($this->data['create_date'] === $stringValue) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['create_date'] = $stringValue;
|
||||
|
||||
$this->setModified('create_date');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getHash()
|
||||
{
|
||||
return $this->data['hash'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @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');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public function getIsNew()
|
||||
{
|
||||
return (boolean)$this->data['is_new'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boolean $value
|
||||
*/
|
||||
public function setIsNew($value)
|
||||
{
|
||||
$this->validateNotNull('is_new', $value);
|
||||
$this->validateBoolean('is_new', $value);
|
||||
|
||||
if ($this->data['is_new'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['is_new'] = (integer)$value;
|
||||
|
||||
$this->setModified('is_new');
|
||||
}
|
||||
}
|
||||
123
src/Model/Base/BuildMeta.php
Normal file
123
src/Model/Base/BuildMeta.php
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
<?php
|
||||
|
||||
namespace PHPCensor\Model\Base;
|
||||
|
||||
use PHPCensor\Model;
|
||||
|
||||
class BuildMeta extends Model
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $tableName = 'build_meta';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $data = [
|
||||
'id' => null,
|
||||
'build_id' => null,
|
||||
'meta_key' => null,
|
||||
'meta_value' => null,
|
||||
];
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return (integer)$this->data['id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @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');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getBuildId()
|
||||
{
|
||||
return (integer)$this->data['build_id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $value
|
||||
*/
|
||||
public function setBuildId($value)
|
||||
{
|
||||
$this->validateNotNull('build_id', $value);
|
||||
$this->validateInt('build_id', $value);
|
||||
|
||||
if ($this->data['build_id'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['build_id'] = $value;
|
||||
|
||||
$this->setModified('build_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMetaKey()
|
||||
{
|
||||
return $this->data['meta_key'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setMetaKey($value)
|
||||
{
|
||||
$this->validateNotNull('meta_key', $value);
|
||||
$this->validateString('meta_key', $value);
|
||||
|
||||
if ($this->data['meta_key'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['meta_key'] = $value;
|
||||
|
||||
$this->setModified('meta_key');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMetaValue()
|
||||
{
|
||||
return $this->data['meta_value'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setMetaValue($value)
|
||||
{
|
||||
$this->validateNotNull('meta_value', $value);
|
||||
$this->validateString('meta_value', $value);
|
||||
|
||||
if ($this->data['meta_value'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['meta_value'] = $value;
|
||||
|
||||
$this->setModified('meta_value');
|
||||
}
|
||||
}
|
||||
128
src/Model/Base/Environment.php
Normal file
128
src/Model/Base/Environment.php
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
<?php
|
||||
|
||||
namespace PHPCensor\Model\Base;
|
||||
|
||||
use PHPCensor\Model;
|
||||
|
||||
class Environment extends Model
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $tableName = 'environment';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $data = [
|
||||
'id' => null,
|
||||
'project_id' => null,
|
||||
'name' => null,
|
||||
'branches' => null,
|
||||
];
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return (integer)$this->data['id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @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');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getProjectId()
|
||||
{
|
||||
return (integer)$this->data['project_id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $value
|
||||
*/
|
||||
public function setProjectId($value)
|
||||
{
|
||||
$this->validateNotNull('project_id', $value);
|
||||
$this->validateInt('project_id', $value);
|
||||
|
||||
if ($this->data['project_id'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['project_id'] = $value;
|
||||
|
||||
$this->setModified('project_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->data['name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @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');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getBranches()
|
||||
{
|
||||
return array_filter(
|
||||
array_map(
|
||||
'trim',
|
||||
explode("\n", $this->data['branches'])
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $value
|
||||
*/
|
||||
public function setBranches(array $value)
|
||||
{
|
||||
$this->validateNotNull('branches', $value);
|
||||
|
||||
$branches = implode("\n", $value);
|
||||
if ($this->data['branches'] === $branches) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['branches'] = $branches;
|
||||
|
||||
$this->setModified('branches');
|
||||
}
|
||||
}
|
||||
461
src/Model/Base/Project.php
Normal file
461
src/Model/Base/Project.php
Normal file
|
|
@ -0,0 +1,461 @@
|
|||
<?php
|
||||
|
||||
namespace PHPCensor\Model\Base;
|
||||
|
||||
use PHPCensor\Model;
|
||||
|
||||
class Project extends Model
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $tableName = 'project';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $data = [
|
||||
'id' => null,
|
||||
'title' => null,
|
||||
'reference' => null,
|
||||
'branch' => null,
|
||||
'default_branch_only' => null,
|
||||
'ssh_private_key' => null,
|
||||
'ssh_public_key' => null,
|
||||
'type' => null,
|
||||
'access_information' => null,
|
||||
'last_commit' => null,
|
||||
'build_config' => null,
|
||||
'allow_public_status' => null,
|
||||
'archived' => null,
|
||||
'group_id' => null,
|
||||
'create_date' => null,
|
||||
'user_id' => 0,
|
||||
];
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return (integer)$this->data['id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @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');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->data['title'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setTitle($value)
|
||||
{
|
||||
$this->validateNotNull('title', $value);
|
||||
$this->validateString('title', $value);
|
||||
|
||||
if ($this->data['title'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['title'] = $value;
|
||||
|
||||
$this->setModified('title');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getReference()
|
||||
{
|
||||
return $this->data['reference'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setReference($value)
|
||||
{
|
||||
$this->validateNotNull('reference', $value);
|
||||
$this->validateString('reference', $value);
|
||||
|
||||
if ($this->data['reference'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['reference'] = $value;
|
||||
|
||||
$this->setModified('reference');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getBranch()
|
||||
{
|
||||
if (!$this->data['branch']) {
|
||||
$projectType = $this->getType();
|
||||
switch ($projectType) {
|
||||
case 'hg':
|
||||
$branch = 'default';
|
||||
break;
|
||||
case 'svn':
|
||||
$branch = 'trunk';
|
||||
break;
|
||||
default:
|
||||
$branch = 'master';
|
||||
}
|
||||
|
||||
return $branch;
|
||||
} else {
|
||||
return $this->data['branch'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setBranch($value)
|
||||
{
|
||||
$this->validateNotNull('branch', $value);
|
||||
$this->validateString('branch', $value);
|
||||
|
||||
if ($this->data['branch'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['branch'] = $value;
|
||||
|
||||
$this->setModified('branch');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public function getDefaultBranchOnly()
|
||||
{
|
||||
return (boolean)$this->data['default_branch_only'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boolean $value
|
||||
*/
|
||||
public function setDefaultBranchOnly($value)
|
||||
{
|
||||
$this->validateNotNull('default_branch_only', $value);
|
||||
$this->validateBoolean('default_branch_only', $value);
|
||||
|
||||
if ($this->data['default_branch_only'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['default_branch_only'] = (integer)$value;
|
||||
|
||||
$this->setModified('default_branch_only');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSshPrivateKey()
|
||||
{
|
||||
return $this->data['ssh_private_key'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setSshPrivateKey($value)
|
||||
{
|
||||
$this->validateString('ssh_private_key', $value);
|
||||
|
||||
if ($this->data['ssh_private_key'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['ssh_private_key'] = $value;
|
||||
|
||||
$this->setModified('ssh_private_key');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSshPublicKey()
|
||||
{
|
||||
return $this->data['ssh_public_key'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setSshPublicKey($value)
|
||||
{
|
||||
$this->validateString('ssh_public_key', $value);
|
||||
|
||||
if ($this->data['ssh_public_key'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['ssh_public_key'] = $value;
|
||||
|
||||
$this->setModified('ssh_public_key');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->data['type'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setType($value)
|
||||
{
|
||||
$this->validateNotNull('type', $value);
|
||||
$this->validateString('type', $value);
|
||||
|
||||
if ($this->data['type'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['type'] = $value;
|
||||
|
||||
$this->setModified('type');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $key
|
||||
*
|
||||
* @return array|string|null
|
||||
*/
|
||||
public function getAccessInformation($key = null)
|
||||
{
|
||||
$data = json_decode($this->data['access_information'], true);
|
||||
$accessInformation = null;
|
||||
if (is_null($key)) {
|
||||
$accessInformation = $data;
|
||||
} elseif (isset($data[$key])) {
|
||||
$accessInformation = $data[$key];
|
||||
}
|
||||
|
||||
return $accessInformation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $value
|
||||
*/
|
||||
public function setAccessInformation(array $value)
|
||||
{
|
||||
$this->validateNotNull('branches', $value);
|
||||
|
||||
$accessInformation = json_encode($value);
|
||||
if ($this->data['access_information'] === $accessInformation) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['access_information'] = $accessInformation;
|
||||
|
||||
$this->setModified('access_information');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLastCommit()
|
||||
{
|
||||
return $this->data['last_commit'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setLastCommit($value)
|
||||
{
|
||||
$this->validateString('last_commit', $value);
|
||||
|
||||
if ($this->data['last_commit'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['last_commit'] = $value;
|
||||
|
||||
$this->setModified('last_commit');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getBuildConfig()
|
||||
{
|
||||
return $this->data['build_config'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setBuildConfig($value)
|
||||
{
|
||||
$this->validateString('build_config', $value);
|
||||
|
||||
if ($this->data['build_config'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['build_config'] = $value;
|
||||
|
||||
$this->setModified('build_config');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public function getAllowPublicStatus()
|
||||
{
|
||||
return (boolean)$this->data['allow_public_status'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boolean $value
|
||||
*/
|
||||
public function setAllowPublicStatus($value)
|
||||
{
|
||||
$this->validateNotNull('allow_public_status', $value);
|
||||
$this->validateBoolean('allow_public_status', $value);
|
||||
|
||||
if ($this->data['allow_public_status'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['allow_public_status'] = (integer)$value;
|
||||
|
||||
$this->setModified('allow_public_status');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public function getArchived()
|
||||
{
|
||||
return (boolean)$this->data['archived'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boolean $value
|
||||
*/
|
||||
public function setArchived($value)
|
||||
{
|
||||
$this->validateNotNull('archived', $value);
|
||||
$this->validateBoolean('archived', $value);
|
||||
|
||||
if ($this->data['archived'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['archived'] = (integer)$value;
|
||||
|
||||
$this->setModified('archived');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getGroupId()
|
||||
{
|
||||
return (integer)$this->data['group_id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $value
|
||||
*/
|
||||
public function setGroupId($value)
|
||||
{
|
||||
$this->validateNotNull('group_id', $value);
|
||||
$this->validateInt('group_id', $value);
|
||||
|
||||
if ($this->data['group_id'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['group_id'] = $value;
|
||||
|
||||
$this->setModified('group_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DateTime|null
|
||||
*/
|
||||
public function getCreateDate()
|
||||
{
|
||||
if ($this->data['create_date']) {
|
||||
return new \DateTime($this->data['create_date']);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DateTime $value
|
||||
*/
|
||||
public function setCreateDate(\DateTime $value)
|
||||
{
|
||||
$stringValue = $value->format('Y-m-d H:i:s');
|
||||
|
||||
if ($this->data['create_date'] === $stringValue) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['create_date'] = $stringValue;
|
||||
|
||||
$this->setModified('create_date');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getUserId()
|
||||
{
|
||||
return (integer)$this->data['user_id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $value
|
||||
*/
|
||||
public function setUserId($value)
|
||||
{
|
||||
$this->validateNotNull('user_id', $value);
|
||||
$this->validateInt('user_id', $value);
|
||||
|
||||
if ($this->data['user_id'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['user_id'] = $value;
|
||||
|
||||
$this->setModified('user_id');
|
||||
}
|
||||
}
|
||||
126
src/Model/Base/ProjectGroup.php
Normal file
126
src/Model/Base/ProjectGroup.php
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
<?php
|
||||
|
||||
namespace PHPCensor\Model\Base;
|
||||
|
||||
use PHPCensor\Model;
|
||||
|
||||
class ProjectGroup extends Model
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $tableName = 'project_group';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $data = [
|
||||
'id' => null,
|
||||
'title' => null,
|
||||
'create_date' => null,
|
||||
'user_id' => 0,
|
||||
];
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return (integer)$this->data['id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @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');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->data['title'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setTitle($value)
|
||||
{
|
||||
$this->validateNotNull('title', $value);
|
||||
$this->validateString('title', $value);
|
||||
|
||||
if ($this->data['title'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['title'] = $value;
|
||||
|
||||
$this->setModified('title');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DateTime|null
|
||||
*/
|
||||
public function getCreateDate()
|
||||
{
|
||||
if ($this->data['create_date']) {
|
||||
return new \DateTime($this->data['create_date']);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DateTime $value
|
||||
*/
|
||||
public function setCreateDate(\DateTime $value)
|
||||
{
|
||||
$stringValue = $value->format('Y-m-d H:i:s');
|
||||
|
||||
if ($this->data['create_date'] === $stringValue) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['create_date'] = $stringValue;
|
||||
|
||||
$this->setModified('create_date');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getUserId()
|
||||
{
|
||||
return (integer)$this->data['user_id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $value
|
||||
*/
|
||||
public function setUserId($value)
|
||||
{
|
||||
$this->validateNotNull('user_id', $value);
|
||||
$this->validateInt('user_id', $value);
|
||||
|
||||
if ($this->data['user_id'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['user_id'] = $value;
|
||||
|
||||
$this->setModified('user_id');
|
||||
}
|
||||
}
|
||||
284
src/Model/Base/User.php
Normal file
284
src/Model/Base/User.php
Normal file
|
|
@ -0,0 +1,284 @@
|
|||
<?php
|
||||
|
||||
namespace PHPCensor\Model\Base;
|
||||
|
||||
use PHPCensor\Model;
|
||||
|
||||
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,
|
||||
];
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return (integer)$this->data['id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @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');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getEmail()
|
||||
{
|
||||
return $this->data['email'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @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');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getHash()
|
||||
{
|
||||
return $this->data['hash'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @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');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public function getIsAdmin()
|
||||
{
|
||||
return (boolean)$this->data['is_admin'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boolean $value
|
||||
*/
|
||||
public function setIsAdmin($value)
|
||||
{
|
||||
$this->validateNotNull('is_admin', $value);
|
||||
$this->validateBoolean('is_admin', $value);
|
||||
|
||||
if ($this->data['is_admin'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['is_admin'] = (integer)$value;
|
||||
|
||||
$this->setModified('is_admin');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->data['name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @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');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLanguage()
|
||||
{
|
||||
return $this->data['language'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setLanguage($value)
|
||||
{
|
||||
if ($this->data['language'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['language'] = $value;
|
||||
|
||||
$this->setModified('language');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getPerPage()
|
||||
{
|
||||
return (integer)$this->data['per_page'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $value
|
||||
*/
|
||||
public function setPerPage($value)
|
||||
{
|
||||
$this->validateInt('per_page', $value);
|
||||
|
||||
if ($this->data['per_page'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['per_page'] = $value;
|
||||
|
||||
$this->setModified('per_page');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getProviderKey()
|
||||
{
|
||||
return $this->data['provider_key'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @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|null $key
|
||||
*
|
||||
* @return array|string|null
|
||||
*/
|
||||
public function getProviderData($key = null)
|
||||
{
|
||||
$data = json_decode($this->data['provider_data'], true);
|
||||
$providerData = null;
|
||||
if (is_null($key)) {
|
||||
$providerData = $data;
|
||||
} elseif (isset($data[$key])) {
|
||||
$providerData = $data[$key];
|
||||
}
|
||||
|
||||
return $providerData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $value
|
||||
*/
|
||||
public function setProviderData(array $value)
|
||||
{
|
||||
$this->validateNotNull('provider_data', $value);
|
||||
|
||||
$providerData = json_encode($value);
|
||||
if ($this->data['provider_data'] === $providerData) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['provider_data'] = $providerData;
|
||||
|
||||
$this->setModified('provider_data');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getRememberKey()
|
||||
{
|
||||
return $this->data['remember_key'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @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');
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue