Added 'user_id' column to 'build' table (created by)

+ Renamed columns 'created' -> 'create_date', 'started' -> 'start_date' and 'finished' -> 'finish_date'
+ Code style fixes.
This commit is contained in:
Dmitry Khomutov 2017-10-15 21:58:36 +07:00
commit 4ec6d854c2
29 changed files with 550 additions and 661 deletions

View file

@ -21,10 +21,10 @@ class Build extends Model
const STAGE_FIXED = 'fixed';
const STAGE_BROKEN = 'broken';
const STATUS_PENDING = 0;
const STATUS_RUNNING = 1;
const STATUS_SUCCESS = 2;
const STATUS_FAILED = 3;
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;
@ -58,14 +58,15 @@ class Build extends Model
'log' => null,
'branch' => null,
'tag' => null,
'created' => null,
'started' => null,
'finished' => 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,
];
/**
@ -80,14 +81,15 @@ class Build extends Model
'log' => 'getLog',
'branch' => 'getBranch',
'tag' => 'getTag',
'created' => 'getCreated',
'started' => 'getStarted',
'finished' => 'getFinished',
'create_date' => 'getCreateDate',
'start_date' => 'getStartDate',
'finish_date' => 'getFinishDate',
'committer_email' => 'getCommitterEmail',
'commit_message' => 'getCommitMessage',
'extra' => 'getExtra',
'environment' => 'getEnvironment',
'source' => 'getSource',
'user_id' => 'getUserId',
// Foreign key getters:
'Project' => 'getProject',
@ -105,22 +107,21 @@ class Build extends Model
'log' => 'setLog',
'branch' => 'setBranch',
'setTag' => 'setTag',
'created' => 'setCreated',
'started' => 'setStarted',
'finished' => 'setFinished',
'create_date' => 'setCreateDate',
'start_date' => 'setStartDate',
'finish_date' => 'setFinishDate',
'committer_email' => 'setCommitterEmail',
'commit_message' => 'setCommitMessage',
'extra' => 'setExtra',
'environment' => 'setEnvironment',
'source' => 'setSource',
'user_id' => 'setUserId',
// Foreign key setters:
'Project' => 'setProject',
];
/**
* Get the value of Id / id.
*
* @return integer
*/
public function getId()
@ -131,134 +132,12 @@ class Build extends Model
}
/**
* Get the value of ProjectId / project_id.
*
* @return integer
*/
public function getProjectId()
{
$rtn = $this->data['project_id'];
return (integer)$rtn;
}
/**
* Get the value of CommitId / commit_id.
*
* @return string
*/
public function getCommitId()
{
$rtn = $this->data['commit_id'];
return $rtn;
}
/**
* Get the value of Status / status.
*
* @return integer
*/
public function getStatus()
{
$rtn = $this->data['status'];
return (integer)$rtn;
}
/**
* Get the value of Log / log.
*
* @return string
*/
public function getLog()
{
$rtn = $this->data['log'];
return $rtn;
}
/**
* Get the value of Branch / branch.
*
* @return string
*/
public function getBranch()
{
$rtn = $this->data['branch'];
return $rtn;
}
/**
* Get the value of Created / created.
*
* @return \DateTime
*/
public function getCreated()
{
$rtn = $this->data['created'];
if (!empty($rtn)) {
$rtn = new \DateTime($rtn);
}
return $rtn;
}
/**
* Get the value of Started / started.
*
* @return \DateTime
*/
public function getStarted()
{
$rtn = $this->data['started'];
if (!empty($rtn)) {
$rtn = new \DateTime($rtn);
}
return $rtn;
}
/**
* Get the value of Finished / finished.
*
* @return \DateTime
*/
public function getFinished()
{
$rtn = $this->data['finished'];
if (!empty($rtn)) {
$rtn = new \DateTime($rtn);
}
return $rtn;
}
/**
* Get the value of CommitterEmail / committer_email.
*
* @return string
*/
public function getCommitterEmail()
{
$rtn = $this->data['committer_email'];
return $rtn;
}
/**
* Set the value of Id / id. Must not be null.
*
* @param $value int
*/
public function setId($value)
{
$this->validateNotNull('Id', $value);
$this->validateInt('Id', $value);
$this->validateNotNull('id', $value);
$this->validateInt('id', $value);
if ($this->data['id'] === $value) {
return;
@ -270,14 +149,22 @@ class Build extends Model
}
/**
* Set the value of ProjectId / project_id. Must not be null.
*
* @return integer
*/
public function getProjectId()
{
$rtn = $this->data['project_id'];
return (integer)$rtn;
}
/**
* @param $value int
*/
public function setProjectId($value)
{
$this->validateNotNull('ProjectId', $value);
$this->validateInt('ProjectId', $value);
$this->validateNotNull('project_id', $value);
$this->validateInt('project_id', $value);
if ($this->data['project_id'] === $value) {
return;
@ -289,14 +176,22 @@ class Build extends Model
}
/**
* Set the value of CommitId / commit_id. Must not be null.
*
* @return string
*/
public function getCommitId()
{
$rtn = $this->data['commit_id'];
return $rtn;
}
/**
* @param $value string
*/
public function setCommitId($value)
{
$this->validateNotNull('CommitId', $value);
$this->validateString('CommitId', $value);
$this->validateNotNull('commit_id', $value);
$this->validateString('commit_id', $value);
if ($this->data['commit_id'] === $value) {
return;
@ -308,14 +203,22 @@ class Build extends Model
}
/**
* Set the value of Status / status. Must not be null.
*
* @return integer
*/
public function getStatus()
{
$rtn = $this->data['status'];
return (integer)$rtn;
}
/**
* @param $value int
*/
public function setStatus($value)
{
$this->validateNotNull('Status', $value);
$this->validateInt('Status', $value);
$this->validateNotNull('status', $value);
$this->validateInt('status', $value);
if ($this->data['status'] === $value) {
return;
@ -327,15 +230,315 @@ class Build extends Model
}
/**
* Set the value of Status / status only if it synced with db. Must not be null.
* @return string
*/
public function getLog()
{
$rtn = $this->data['log'];
return $rtn;
}
/**
* @param $value string
*/
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()
{
$rtn = $this->data['branch'];
return $rtn;
}
/**
* @param $value string
*/
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 \DateTime
*/
public function getCreateDate()
{
$rtn = $this->data['create_date'];
if (!empty($rtn)) {
$rtn = new \DateTime($rtn);
}
return $rtn;
}
/**
* @param $value \DateTime
*/
public function setCreateDate($value)
{
$this->validateDate('create_date', $value);
if ($this->data['create_date'] === $value) {
return;
}
$this->data['create_date'] = $value;
$this->setModified('create_date');
}
/**
* @return \DateTime
*/
public function getStartDate()
{
$rtn = $this->data['start_date'];
if (!empty($rtn)) {
$rtn = new \DateTime($rtn);
}
return $rtn;
}
/**
* @param $value \DateTime
*/
public function setStartDate($value)
{
$this->validateDate('start_date', $value);
if ($this->data['start_date'] === $value) {
return;
}
$this->data['start_date'] = $value;
$this->setModified('start_date');
}
/**
* @return \DateTime
*/
public function getFinishDate()
{
$rtn = $this->data['finish_date'];
if (!empty($rtn)) {
$rtn = new \DateTime($rtn);
}
return $rtn;
}
/**
* @param $value \DateTime
*/
public function setFinishDate($value)
{
$this->validateDate('finish_date', $value);
if ($this->data['finish_date'] === $value) {
return;
}
$this->data['finish_date'] = $value;
$this->setModified('finish_date');
}
/**
* @return string
*/
public function getCommitterEmail()
{
$rtn = $this->data['committer_email'];
return $rtn;
}
/**
* @param $value string
*/
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()
{
$rtn = htmlspecialchars($this->data['commit_message']);
return $rtn;
}
/**
* @param $value string
*/
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');
}
/**
* @return string
*/
public function getTag()
{
$rtn = $this->data['tag'];
return $rtn;
}
/**
* @param $value string
*/
public function setTag($value)
{
$this->validateString('tag', $value);
if ($this->data['tag'] === $value) {
return;
}
$this->data['tag'] = $value;
$this->setModified('tag');
}
/**
* @return string
*/
public function getSource()
{
$rtn = $this->data['source'];
return (integer)$rtn;
}
/**
* @param $value integer
*/
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()
{
$rtn = $this->data['user_id'];
return (integer)$rtn;
}
/**
* @param $value integer
*/
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');
}
/**
* @return string
*/
public function getEnvironment()
{
$rtn = $this->data['environment'];
return $rtn;
}
/**
* @param $value string
*/
public function setEnvironment($value)
{
$this->validateString('environment', $value);
if ($this->data['environment'] === $value) {
return;
}
$this->data['environment'] = $value;
$this->setModified('environment');
}
/**
* Set the value of status only if it synced with db. Must not be null.
*
* @param $value int
* @return bool
*/
public function setStatusSync($value)
{
$this->validateNotNull('Status', $value);
$this->validateInt('Status', $value);
$this->validateNotNull('status', $value);
$this->validateInt('status', $value);
if ($this->data['status'] !== $value) {
$store = Factory::getStore('Build');
@ -347,185 +550,11 @@ class Build extends Model
return false;
}
/**
* Set the value of Log / log.
*
* @param $value string
*/
public function setLog($value)
{
$this->validateString('Log', $value);
if ($this->data['log'] === $value) {
return;
}
$this->data['log'] = $value;
$this->setModified('log');
}
/**
* Set the value of Branch / branch. Must not be null.
*
* @param $value string
*/
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');
}
/**
* Set the value of Created / created.
*
* @param $value \DateTime
*/
public function setCreated($value)
{
$this->validateDate('Created', $value);
if ($this->data['created'] === $value) {
return;
}
$this->data['created'] = $value;
$this->setModified('created');
}
/**
* Set the value of Started / started.
*
* @param $value \DateTime
*/
public function setStarted($value)
{
$this->validateDate('Started', $value);
if ($this->data['started'] === $value) {
return;
}
$this->data['started'] = $value;
$this->setModified('started');
}
/**
* Set the value of Finished / finished.
*
* @param $value \DateTime
*/
public function setFinished($value)
{
$this->validateDate('Finished', $value);
if ($this->data['finished'] === $value) {
return;
}
$this->data['finished'] = $value;
$this->setModified('finished');
}
/**
* Set the value of CommitterEmail / committer_email.
*
* @param $value string
*/
public function setCommitterEmail($value)
{
$this->validateString('CommitterEmail', $value);
if ($this->data['committer_email'] === $value) {
return;
}
$this->data['committer_email'] = $value;
$this->setModified('committer_email');
}
/**
* Set the value of CommitMessage / commit_message.
*
* @param $value string
*/
public function setCommitMessage($value)
{
$this->validateString('CommitMessage', $value);
if ($this->data['commit_message'] === $value) {
return;
}
$this->data['commit_message'] = $value;
$this->setModified('commit_message');
}
/**
* Set the value of Extra / extra.
*
* @param $value string
*/
public function setExtra($value)
{
$this->validateString('Extra', $value);
if ($this->data['extra'] === $value) {
return;
}
$this->data['extra'] = $value;
$this->setModified('extra');
}
/**
* Set the value of Extra / extra.
*
* @param $name string
* @param $value mixed
*/
public function setExtraValue($name, $value)
{
$extra = json_decode($this->data['extra'], true);
if ($extra === false) {
$extra = [];
}
$extra[$name] = $value;
$this->setExtra(json_encode($extra));
}
/**
* Set the values of Extra / extra.
*
* @param $values mixed
*/
public function setExtraValues($values)
{
$extra = json_decode($this->data['extra'], true);
if ($extra === false) {
$extra = [];
}
$extra = array_replace($extra, $values);
$this->setExtra(json_encode($extra));
}
/**
* Return a value from the build's "extra" JSON array.
*
* @param null $key
*
* @return mixed|null|string
*/
public function getExtra($key = null)
@ -543,6 +572,53 @@ class Build extends Model
return $rtn;
}
/**
* @param $value string
*/
public function setExtra($value)
{
$this->validateString('extra', $value);
if ($this->data['extra'] === $value) {
return;
}
$this->data['extra'] = $value;
$this->setModified('extra');
}
/**
* Set the value of extra.
*
* @param $name string
* @param $value mixed
*/
public function setExtraValue($name, $value)
{
$extra = json_decode($this->data['extra'], true);
if ($extra === false) {
$extra = [];
}
$extra[$name] = $value;
$this->setExtra(json_encode($extra));
}
/**
* Set the values of extra.
*
* @param $values mixed
*/
public function setExtraValues($values)
{
$extra = json_decode($this->data['extra'], true);
if ($extra === false) {
$extra = [];
}
$extra = array_replace($extra, $values);
$this->setExtra(json_encode($extra));
}
/**
* Get the Project model for this Build by Id.
*
@ -764,17 +840,6 @@ class Build extends Model
return $config;
}
/**
* Returns the commit message for this build.
* @return string
*/
public function getCommitMessage()
{
$rtn = htmlspecialchars($this->data['commit_message']);
return $rtn;
}
/**
* Allows specific build types (e.g. Github) to report violations back to their respective services.
* @param Builder $builder
@ -852,17 +917,18 @@ class Build extends Model
/**
* Get the number of seconds a build has been running for.
*
* @return int
*/
public function getDuration()
{
$start = $this->getStarted();
$start = $this->getStartDate();
if (empty($start)) {
return 0;
}
$end = $this->getFinished();
$end = $this->getFinishDate();
if (empty($end)) {
$end = new \DateTime();
@ -873,15 +939,16 @@ class Build extends Model
/**
* get time a build has been running for in hour/minute/seconds format (e.g. 1h 21m 45s)
*
* @return string
*/
public function getPrettyDuration()
{
$start = $this->getStarted();
$start = $this->getStartDate();
if (!$start) {
$start = new \DateTime();
}
$end = $this->getFinished();
$end = $this->getFinishDate();
if (!$end) {
$end = new \DateTime();
}
@ -910,96 +977,6 @@ class Build extends Model
return false;
}
/**
* Get the value of Tag / tag.
*
* @return string
*/
public function getTag()
{
$rtn = $this->data['tag'];
return $rtn;
}
/**
* Set the value of Tag / tag.
*
* @param $value string
*/
public function setTag($value)
{
$this->validateString('Tag', $value);
if ($this->data['tag'] === $value) {
return;
}
$this->data['tag'] = $value;
$this->setModified('tag');
}
/**
* Get the value of source.
*
* @return string
*/
public function getSource()
{
$rtn = $this->data['source'];
return (integer)$rtn;
}
/**
* Set the value of source.
*
* @param $value integer
*/
public function setSource($value)
{
$this->validateInt('Source', $value);
if ($this->data['source'] === $value) {
return;
}
$this->data['source'] = $value;
$this->setModified('source');
}
/**
* Get the value of Environment / environment.
*
* @return string
*/
public function getEnvironment()
{
$rtn = $this->data['environment'];
return $rtn;
}
/**
* Set the value of Environment / environment.
*
* @param $value string
*/
public function setEnvironment($value)
{
$this->validateString('Environment', $value);
if ($this->data['environment'] === $value) {
return;
}
$this->data['environment'] = $value;
$this->setModified('environment');
}
/**
* Create an SSH key file on disk for this build.
*

View file

@ -7,6 +7,11 @@ use b8\Store\Factory;
class BuildError extends Model
{
const SEVERITY_CRITICAL = 0;
const SEVERITY_HIGH = 1;
const SEVERITY_NORMAL = 2;
const SEVERITY_LOW = 3;
/**
* @var array
*/
@ -76,8 +81,6 @@ class BuildError extends Model
];
/**
* Get the value of Id / id.
*
* @return int
*/
public function getId()
@ -88,8 +91,6 @@ class BuildError extends Model
}
/**
* Get the value of BuildId / build_id.
*
* @return int
*/
public function getBuildId()
@ -100,8 +101,6 @@ class BuildError extends Model
}
/**
* Get the value of Plugin / plugin.
*
* @return string
*/
public function getPlugin()
@ -112,8 +111,6 @@ class BuildError extends Model
}
/**
* Get the value of File / file.
*
* @return string
*/
public function getFile()
@ -124,8 +121,6 @@ class BuildError extends Model
}
/**
* Get the value of LineStart / line_start.
*
* @return int
*/
public function getLineStart()
@ -136,8 +131,6 @@ class BuildError extends Model
}
/**
* Get the value of LineEnd / line_end.
*
* @return int
*/
public function getLineEnd()
@ -148,8 +141,6 @@ class BuildError extends Model
}
/**
* Get the value of Severity / severity.
*
* @return int
*/
public function getSeverity()
@ -160,8 +151,6 @@ class BuildError extends Model
}
/**
* Get the value of Message / message.
*
* @return string
*/
public function getMessage()
@ -172,8 +161,6 @@ class BuildError extends Model
}
/**
* Get the value of CreatedDate / created_date.
*
* @return \DateTime
*/
public function getCreatedDate()
@ -188,15 +175,12 @@ class BuildError extends Model
}
/**
* Set the value of Id / id.
*
* Must not be null.
* @param $value int
*/
public function setId($value)
{
$this->validateNotNull('Id', $value);
$this->validateInt('Id', $value);
$this->validateNotNull('id', $value);
$this->validateInt('id', $value);
if ($this->data['id'] === $value) {
return;
@ -208,15 +192,12 @@ class BuildError extends Model
}
/**
* Set the value of BuildId / build_id.
*
* Must not be null.
* @param $value int
*/
public function setBuildId($value)
{
$this->validateNotNull('BuildId', $value);
$this->validateInt('BuildId', $value);
$this->validateNotNull('build_id', $value);
$this->validateInt('build_id', $value);
if ($this->data['build_id'] === $value) {
return;
@ -228,15 +209,12 @@ class BuildError extends Model
}
/**
* Set the value of Plugin / plugin.
*
* Must not be null.
* @param $value string
*/
public function setPlugin($value)
{
$this->validateNotNull('Plugin', $value);
$this->validateString('Plugin', $value);
$this->validateNotNull('plugin', $value);
$this->validateString('plugin', $value);
if ($this->data['plugin'] === $value) {
return;
@ -248,13 +226,11 @@ class BuildError extends Model
}
/**
* Set the value of File / file.
*
* @param $value string
*/
public function setFile($value)
{
$this->validateString('File', $value);
$this->validateString('file', $value);
if ($this->data['file'] === $value) {
return;
@ -266,13 +242,11 @@ class BuildError extends Model
}
/**
* Set the value of LineStart / line_start.
*
* @param $value int
*/
public function setLineStart($value)
{
$this->validateInt('LineStart', $value);
$this->validateInt('line_start', $value);
if ($this->data['line_start'] === $value) {
return;
@ -284,13 +258,11 @@ class BuildError extends Model
}
/**
* Set the value of LineEnd / line_end.
*
* @param $value int
*/
public function setLineEnd($value)
{
$this->validateInt('LineEnd', $value);
$this->validateInt('line_end', $value);
if ($this->data['line_end'] === $value) {
return;
@ -302,15 +274,12 @@ class BuildError extends Model
}
/**
* Set the value of Severity / severity.
*
* Must not be null.
* @param $value int
*/
public function setSeverity($value)
{
$this->validateNotNull('Severity', $value);
$this->validateInt('Severity', $value);
$this->validateNotNull('severity', $value);
$this->validateInt('severity', $value);
if ($this->data['severity'] === $value) {
return;
@ -322,15 +291,12 @@ class BuildError extends Model
}
/**
* Set the value of Message / message.
*
* Must not be null.
* @param $value string
*/
public function setMessage($value)
{
$this->validateNotNull('Message', $value);
$this->validateString('Message', $value);
$this->validateNotNull('message', $value);
$this->validateString('message', $value);
if ($this->data['message'] === $value) {
return;
@ -342,15 +308,12 @@ class BuildError extends Model
}
/**
* Set the value of CreatedDate / created_date.
*
* Must not be null.
* @param $value \DateTime
*/
public function setCreatedDate($value)
{
$this->validateNotNull('CreatedDate', $value);
$this->validateDate('CreatedDate', $value);
$this->validateNotNull('created_date', $value);
$this->validateDate('created_date', $value);
if ($this->data['created_date'] === $value) {
return;
@ -364,8 +327,6 @@ class BuildError extends Model
/**
* Get the Build model for this BuildError by Id.
*
* @uses \PHPCensor\Store\BuildStore::getById()
* @uses \PHPCensor\Model\Build
* @return \PHPCensor\Model\Build
*/
public function getBuild()
@ -418,13 +379,9 @@ class BuildError extends Model
return $this->setBuildId($value->getId());
}
const SEVERITY_CRITICAL = 0;
const SEVERITY_HIGH = 1;
const SEVERITY_NORMAL = 2;
const SEVERITY_LOW = 3;
/**
* Get the language string key for this error's severity level.
*
* @return string
*/
public function getSeverityString()
@ -446,6 +403,7 @@ class BuildError extends Model
/**
* Get the class to apply to HTML elements representing this error.
*
* @return string
*/
public function getSeverityClass()

View file

@ -61,8 +61,6 @@ class BuildMeta extends Model
];
/**
* Get the value of Id / id.
*
* @return int
*/
public function getId()
@ -73,8 +71,6 @@ class BuildMeta extends Model
}
/**
* Get the value of BuildId / build_id.
*
* @return int
*/
public function getBuildId()
@ -85,8 +81,6 @@ class BuildMeta extends Model
}
/**
* Get the value of MetaKey / meta_key.
*
* @return string
*/
public function getMetaKey()
@ -97,8 +91,6 @@ class BuildMeta extends Model
}
/**
* Get the value of MetaValue / meta_value.
*
* @return string
*/
public function getMetaValue()
@ -109,15 +101,12 @@ class BuildMeta extends Model
}
/**
* Set the value of Id / id.
*
* Must not be null.
* @param $value int
* @param int $value
*/
public function setId($value)
{
$this->validateNotNull('Id', $value);
$this->validateInt('Id', $value);
$this->validateNotNull('id', $value);
$this->validateInt('id', $value);
if ($this->data['id'] === $value) {
return;
@ -129,15 +118,12 @@ class BuildMeta extends Model
}
/**
* Set the value of BuildId / build_id.
*
* Must not be null.
* @param $value int
* @param int $value
*/
public function setBuildId($value)
{
$this->validateNotNull('BuildId', $value);
$this->validateInt('BuildId', $value);
$this->validateNotNull('build_id', $value);
$this->validateInt('build_id', $value);
if ($this->data['build_id'] === $value) {
return;
@ -149,15 +135,12 @@ class BuildMeta extends Model
}
/**
* Set the value of MetaKey / meta_key.
*
* Must not be null.
* @param $value string
*/
public function setMetaKey($value)
{
$this->validateNotNull('MetaKey', $value);
$this->validateString('MetaKey', $value);
$this->validateNotNull('meta_key', $value);
$this->validateString('meta_key', $value);
if ($this->data['meta_key'] === $value) {
return;
@ -169,15 +152,12 @@ class BuildMeta extends Model
}
/**
* Set the value of MetaValue / meta_value.
*
* Must not be null.
* @param $value string
*/
public function setMetaValue($value)
{
$this->validateNotNull('MetaValue', $value);
$this->validateString('MetaValue', $value);
$this->validateNotNull('meta_value', $value);
$this->validateString('meta_value', $value);
if ($this->data['meta_value'] === $value) {
return;
@ -191,8 +171,6 @@ class BuildMeta extends Model
/**
* Get the Build model for this BuildMeta by Id.
*
* @uses \PHPCensor\Store\BuildStore::getById()
* @uses \PHPCensor\Model\Build
* @return \PHPCensor\Model\Build
*/
public function getBuild()
@ -203,8 +181,8 @@ class BuildMeta extends Model
return null;
}
$cacheKey = 'Cache.Build.' . $key;
$rtn = $this->cache->get($cacheKey, null);
$cacheKey = 'Cache.Build.' . $key;
$rtn = $this->cache->get($cacheKey, null);
if (empty($rtn)) {
$rtn = Factory::getStore('Build', 'PHPCensor')->getById($key);

View file

@ -52,8 +52,6 @@ class Environment extends Model
];
/**
* Get the value of Id / id.
*
* @return int
*/
public function getId()
@ -64,8 +62,6 @@ class Environment extends Model
}
/**
* Get the value of Id / id.
*
* @return int
*/
public function getProjectId()
@ -76,8 +72,6 @@ class Environment extends Model
}
/**
* Get the value of Title / title.
*
* @return string
*/
public function getName()
@ -88,8 +82,6 @@ class Environment extends Model
}
/**
* Get the value of Title / title.
*
* @return array
*/
public function getBranches()
@ -100,15 +92,12 @@ class Environment extends Model
}
/**
* Set the value of Id / id.
*
* Must not be null.
* @param $value int
*/
public function setId($value)
{
$this->validateNotNull('Id', $value);
$this->validateInt('Id', $value);
$this->validateNotNull('id', $value);
$this->validateInt('id', $value);
if ($this->data['id'] === $value) {
return;
@ -120,15 +109,12 @@ class Environment extends Model
}
/**
* Set the value of Id / id.
*
* Must not be null.
* @param $value int
*/
public function setProjectId($value)
{
$this->validateNotNull('ProjectId', $value);
$this->validateInt('ProjectId', $value);
$this->validateNotNull('project_id', $value);
$this->validateInt('project_id', $value);
if ($this->data['project_id'] === $value) {
return;
@ -140,15 +126,12 @@ class Environment extends Model
}
/**
* Set the value of Name / name
*
* Must not be null.
* @param $value string
*/
public function setName($value)
{
$this->validateNotNull('Name', $value);
$this->validateString('Name', $value);
$this->validateNotNull('name', $value);
$this->validateString('name', $value);
if ($this->data['name'] === $value) {
return;
@ -160,14 +143,11 @@ class Environment extends Model
}
/**
* Set the value of Branches / branches
*
* Must not be null.
* @param $value array
*/
public function setBranches($value)
{
$this->validateNotNull('Branches', $value);
$this->validateNotNull('branches', $value);
$value = implode("\n", $value);
if ($this->data['branches'] === $value) {

View file

@ -98,8 +98,6 @@ class Project extends Model
];
/**
* Get the value of Id / id.
*
* @return int
*/
public function getId()
@ -110,8 +108,6 @@ class Project extends Model
}
/**
* Get the value of Title / title.
*
* @return string
*/
public function getTitle()
@ -122,8 +118,6 @@ class Project extends Model
}
/**
* Get the value of Reference / reference.
*
* @return string
*/
public function getReference()
@ -134,8 +128,6 @@ class Project extends Model
}
/**
* Get the value of SshPrivateKey / ssh_private_key.
*
* @return string
*/
public function getSshPrivateKey()
@ -146,8 +138,6 @@ class Project extends Model
}
/**
* Get the value of Type / type.
*
* @return string
*/
public function getType()
@ -158,8 +148,6 @@ class Project extends Model
}
/**
* Get the value of LastCommit / last_commit.
*
* @return string
*/
public function getLastCommit()
@ -170,8 +158,6 @@ class Project extends Model
}
/**
* Get the value of BuildConfig / build_config.
*
* @return string
*/
public function getBuildConfig()
@ -182,8 +168,6 @@ class Project extends Model
}
/**
* Get the value of SshPublicKey / ssh_public_key.
*
* @return string
*/
public function getSshPublicKey()
@ -194,8 +178,6 @@ class Project extends Model
}
/**
* Get the value of AllowPublicStatus / allow_public_status.
*
* @return int
*/
public function getAllowPublicStatus()
@ -206,8 +188,6 @@ class Project extends Model
}
/**
* Get the value of Archived / archived.
*
* @return int
*/
public function getArchived()
@ -218,8 +198,6 @@ class Project extends Model
}
/**
* Get the value of GroupId / group_id.
*
* @return int
*/
public function getGroupId()
@ -230,8 +208,6 @@ class Project extends Model
}
/**
* Get the value of DefaultBranchOnly / default_branch_only.
*
* @return int
*/
public function getDefaultBranchOnly()
@ -242,15 +218,12 @@ class Project extends Model
}
/**
* Set the value of Id / id.
*
* Must not be null.
* @param $value int
*/
public function setId($value)
{
$this->validateNotNull('Id', $value);
$this->validateInt('Id', $value);
$this->validateNotNull('id', $value);
$this->validateInt('id', $value);
if ($this->data['id'] === $value) {
return;
@ -262,15 +235,12 @@ class Project extends Model
}
/**
* Set the value of Title / title.
*
* Must not be null.
* @param $value string
*/
public function setTitle($value)
{
$this->validateNotNull('Title', $value);
$this->validateString('Title', $value);
$this->validateNotNull('title', $value);
$this->validateString('title', $value);
if ($this->data['title'] === $value) {
return;
@ -282,15 +252,12 @@ class Project extends Model
}
/**
* Set the value of Reference / reference.
*
* Must not be null.
* @param $value string
*/
public function setReference($value)
{
$this->validateNotNull('Reference', $value);
$this->validateString('Reference', $value);
$this->validateNotNull('reference', $value);
$this->validateString('reference', $value);
if ($this->data['reference'] === $value) {
return;
@ -302,15 +269,12 @@ class Project extends Model
}
/**
* Set the value of Branch / branch.
*
* Must not be null.
* @param $value string
*/
public function setBranch($value)
{
$this->validateNotNull('Branch', $value);
$this->validateString('Branch', $value);
$this->validateNotNull('branch', $value);
$this->validateString('branch', $value);
if ($this->data['branch'] === $value) {
return;
@ -322,15 +286,12 @@ class Project extends Model
}
/**
* Set the value of DefaultBranchOnly / default_branch_only.
*
* Must not be null.
* @param $value int
*/
public function setDefaultBranchOnly($value)
{
$this->validateNotNull('DefaultBranchOnly', $value);
$this->validateInt('DefaultBranchOnly', $value);
$this->validateNotNull('default_branch_only', $value);
$this->validateInt('default_branch_only', $value);
if ($this->data['default_branch_only'] === $value) {
return;
@ -342,13 +303,11 @@ class Project extends Model
}
/**
* Set the value of SshPrivateKey / ssh_private_key.
*
* @param $value string
*/
public function setSshPrivateKey($value)
{
$this->validateString('SshPrivateKey', $value);
$this->validateString('ssh_private_key', $value);
if ($this->data['ssh_private_key'] === $value) {
return;
@ -360,15 +319,12 @@ class Project extends Model
}
/**
* Set the value of Type / type.
*
* Must not be null.
* @param $value string
*/
public function setType($value)
{
$this->validateNotNull('Type', $value);
$this->validateString('Type', $value);
$this->validateNotNull('type', $value);
$this->validateString('type', $value);
if ($this->data['type'] === $value) {
return;
@ -380,13 +336,11 @@ class Project extends Model
}
/**
* Set the value of LastCommit / last_commit.
*
* @param $value string
*/
public function setLastCommit($value)
{
$this->validateString('LastCommit', $value);
$this->validateString('last_commit', $value);
if ($this->data['last_commit'] === $value) {
return;
@ -398,13 +352,11 @@ class Project extends Model
}
/**
* Set the value of BuildConfig / build_config.
*
* @param $value string
*/
public function setBuildConfig($value)
{
$this->validateString('BuildConfig', $value);
$this->validateString('build_config', $value);
if ($this->data['build_config'] === $value) {
return;
@ -416,13 +368,11 @@ class Project extends Model
}
/**
* Set the value of SshPublicKey / ssh_public_key.
*
* @param $value string
*/
public function setSshPublicKey($value)
{
$this->validateString('SshPublicKey', $value);
$this->validateString('ssh_public_key', $value);
if ($this->data['ssh_public_key'] === $value) {
return;
@ -434,15 +384,12 @@ class Project extends Model
}
/**
* Set the value of AllowPublicStatus / allow_public_status.
*
* Must not be null.
* @param $value int
*/
public function setAllowPublicStatus($value)
{
$this->validateNotNull('AllowPublicStatus', $value);
$this->validateInt('AllowPublicStatus', $value);
$this->validateNotNull('allow_public_status', $value);
$this->validateInt('allow_public_status', $value);
if ($this->data['allow_public_status'] === $value) {
return;
@ -454,15 +401,12 @@ class Project extends Model
}
/**
* Set the value of Archived / archived.
*
* Must not be null.
* @param $value int
*/
public function setArchived($value)
{
$this->validateNotNull('Archived', $value);
$this->validateInt('Archived', $value);
$this->validateNotNull('archived', $value);
$this->validateInt('archived', $value);
if ($this->data['archived'] === $value) {
return;
@ -474,15 +418,12 @@ class Project extends Model
}
/**
* Set the value of GroupId / group_id.
*
* Must not be null.
* @param $value int
*/
public function setGroupId($value)
{
$this->validateNotNull('GroupId', $value);
$this->validateInt('GroupId', $value);
$this->validateNotNull('group_id', $value);
$this->validateInt('group_id', $value);
if ($this->data['group_id'] === $value) {
return;
@ -496,8 +437,6 @@ class Project extends Model
/**
* Get the ProjectGroup model for this Project by Id.
*
* @uses \PHPCensor\Store\ProjectGroupStore::getById()
* @uses \PHPCensor\Model\ProjectGroup
* @return \PHPCensor\Model\ProjectGroup
*/
public function getGroup()
@ -508,11 +447,11 @@ class Project extends Model
return null;
}
$cacheKey = 'Cache.ProjectGroup.' . $key;
$rtn = $this->cache->get($cacheKey, null);
$cacheKey = 'Cache.ProjectGroup.' . $key;
$rtn = $this->cache->get($cacheKey, null);
if (empty($rtn)) {
$rtn = Factory::getStore('ProjectGroup', 'PHPCensor')->getById($key);
$rtn = Factory::getStore('ProjectGroup', 'PHPCensor')->getById($key);
$this->cache->set($cacheKey, $rtn);
}
@ -553,8 +492,6 @@ class Project extends Model
/**
* Get Build models by ProjectId for this Project.
*
* @uses \PHPCensor\Store\BuildStore::getByProjectId()
* @uses \PHPCensor\Model\Build
* @return \PHPCensor\Model\Build[]
*/
public function getProjectBuilds()
@ -564,8 +501,10 @@ class Project extends Model
/**
* Return the latest build from a specific branch, of a specific status, for this project.
*
* @param string $branch
* @param null $status
* @param null $status
*
* @return mixed|null
*/
public function getLatestBuild($branch = 'master', $status = null)
@ -592,7 +531,9 @@ class Project extends Model
/**
* Return the previous build from a specific branch, for this project.
*
* @param string $branch
*
* @return mixed|null
*/
public function getPreviousBuild($branch = 'master')
@ -613,7 +554,6 @@ class Project extends Model
}
/**
* Store this project's access_information data
* @param string|array $value
*/
public function setAccessInformation($value)
@ -622,7 +562,7 @@ class Project extends Model
$value = json_encode($value);
}
$this->validateString('AccessInformation', $value);
$this->validateString('access_information', $value);
if ($this->data['access_information'] === $value) {
return;
@ -635,7 +575,9 @@ class Project extends Model
/**
* Get this project's access_information data. Pass a specific key or null for all data.
*
* @param string|null $key
*
* @return mixed|null|string
*/
public function getAccessInformation($key = null)
@ -661,7 +603,7 @@ class Project extends Model
}
/**
* Get the value of Branch / branch.
* Get the value of branch.
*
* @return string
*/
@ -688,6 +630,7 @@ class Project extends Model
/**
* Return the name of a FontAwesome icon to represent this project, depending on its type.
*
* @return string
*/
public function getIcon()
@ -740,7 +683,7 @@ class Project extends Model
if (empty($rtn)) {
$store = $this->getEnvironmentStore();
$rtn = $store->getByProjectId($key);
$rtn = $store->getByProjectId($key);
$this->cache->set($cacheKey, $rtn);
}

View file

@ -47,8 +47,6 @@ class ProjectGroup extends Model
];
/**
* Get the value of Id / id.
*
* @return int
*/
public function getId()
@ -59,8 +57,6 @@ class ProjectGroup extends Model
}
/**
* Get the value of Title / title.
*
* @return string
*/
public function getTitle()
@ -71,15 +67,12 @@ class ProjectGroup extends Model
}
/**
* Set the value of Id / id.
*
* Must not be null.
* @param $value int
*/
public function setId($value)
{
$this->validateNotNull('Id', $value);
$this->validateInt('Id', $value);
$this->validateNotNull('id', $value);
$this->validateInt('id', $value);
if ($this->data['id'] === $value) {
return;
@ -91,15 +84,12 @@ class ProjectGroup extends Model
}
/**
* Set the value of Title / title.
*
* Must not be null.
* @param $value string
*/
public function setTitle($value)
{
$this->validateNotNull('Title', $value);
$this->validateString('Title', $value);
$this->validateNotNull('title', $value);
$this->validateString('title', $value);
if ($this->data['title'] === $value) {
return;
@ -113,8 +103,6 @@ class ProjectGroup extends Model
/**
* Get Project models by GroupId for this ProjectGroup.
*
* @uses \PHPCensor\Store\ProjectStore::getByGroupId()
* @uses \PHPCensor\Model\Project
* @return \PHPCensor\Model\Project[]
*/
public function getGroupProjects()

View file

@ -74,8 +74,6 @@ class User extends Model
];
/**
* Get the value of Id / id.
*
* @return int
*/
public function getId()
@ -86,8 +84,6 @@ class User extends Model
}
/**
* Get the value of Email / email.
*
* @return string
*/
public function getEmail()
@ -98,8 +94,6 @@ class User extends Model
}
/**
* Get the value of Hash / hash.
*
* @return string
*/
public function getHash()
@ -110,8 +104,6 @@ class User extends Model
}
/**
* Get the value of Name / name.
*
* @return string
*/
public function getName()
@ -122,8 +114,6 @@ class User extends Model
}
/**
* Get the value of IsAdmin / is_admin.
*
* @return int
*/
public function getIsAdmin()
@ -134,8 +124,6 @@ class User extends Model
}
/**
* Get the value of ProviderKey / provider_key.
*
* @return string
*/
public function getProviderKey()
@ -146,8 +134,6 @@ class User extends Model
}
/**
* Get the value of ProviderData / provider_data.
*
* @return string
*/
public function getProviderData()
@ -158,8 +144,6 @@ class User extends Model
}
/**
* Get the value of RememberKey / remember_key.
*
* @return string
*/
public function getRememberKey()
@ -170,8 +154,6 @@ class User extends Model
}
/**
* Get the value of Language / language.
*
* @return string
*/
public function getLanguage()
@ -182,8 +164,6 @@ class User extends Model
}
/**
* Get the value of PerPage / per_page.
*
* @return string
*/
public function getPerPage()
@ -194,15 +174,12 @@ class User extends Model
}
/**
* Set the value of Id / id.
*
* Must not be null.
* @param $value int
*/
public function setId($value)
{
$this->validateNotNull('Id', $value);
$this->validateInt('Id', $value);
$this->validateNotNull('id', $value);
$this->validateInt('id', $value);
if ($this->data['id'] === $value) {
return;
@ -214,15 +191,12 @@ class User extends Model
}
/**
* Set the value of Email / email.
*
* Must not be null.
* @param $value string
*/
public function setEmail($value)
{
$this->validateNotNull('Email', $value);
$this->validateString('Email', $value);
$this->validateNotNull('email', $value);
$this->validateString('email', $value);
if ($this->data['email'] === $value) {
return;
@ -234,15 +208,12 @@ class User extends Model
}
/**
* Set the value of Hash / hash.
*
* Must not be null.
* @param $value string
*/
public function setHash($value)
{
$this->validateNotNull('Hash', $value);
$this->validateString('Hash', $value);
$this->validateNotNull('hash', $value);
$this->validateString('hash', $value);
if ($this->data['hash'] === $value) {
return;
@ -254,15 +225,12 @@ class User extends Model
}
/**
* Set the value of Name / name.
*
* Must not be null.
* @param $value string
*/
public function setName($value)
{
$this->validateNotNull('Name', $value);
$this->validateString('Name', $value);
$this->validateNotNull('name', $value);
$this->validateString('name', $value);
if ($this->data['name'] === $value) {
return;
@ -274,15 +242,12 @@ class User extends Model
}
/**
* Set the value of IsAdmin / is_admin.
*
* Must not be null.
* @param $value int
*/
public function setIsAdmin($value)
{
$this->validateNotNull('IsAdmin', $value);
$this->validateInt('IsAdmin', $value);
$this->validateNotNull('is_admin', $value);
$this->validateInt('is_admin', $value);
if ($this->data['is_admin'] === $value) {
return;
@ -294,15 +259,12 @@ class User extends Model
}
/**
* Set the value of ProviderKey / provider_key.
*
* Must not be null.
* @param $value string
*/
public function setProviderKey($value)
{
$this->validateNotNull('ProviderKey', $value);
$this->validateString('ProviderKey', $value);
$this->validateNotNull('provider_key', $value);
$this->validateString('provider_key', $value);
if ($this->data['provider_key'] === $value) {
return;
@ -314,13 +276,11 @@ class User extends Model
}
/**
* Set the value of ProviderData / provider_data.
*
* @param $value string
*/
public function setProviderData($value)
{
$this->validateString('ProviderData', $value);
$this->validateString('provider_data', $value);
if ($this->data['provider_data'] === $value) {
return;
@ -332,13 +292,11 @@ class User extends Model
}
/**
* Set the value of RememberKey / remember_key.
*
* @param $value string
*/
public function setRememberKey($value)
{
$this->validateString('RememberKey', $value);
$this->validateString('remember_key', $value);
if ($this->data['remember_key'] === $value) {
return;
@ -350,9 +308,6 @@ class User extends Model
}
/**
* Set the value of Language / language.
*
* Must not be null.
* @param $value string
*/
public function setLanguage($value)
@ -367,9 +322,6 @@ class User extends Model
}
/**
* Set the value of PerPage / per_page.
*
* Must not be null.
* @param $value string
*/
public function setPerPage($value)