2018-03-09 19:00:53 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace PHPCensor\Model\Base;
|
|
|
|
|
|
|
|
use PHPCensor\Model;
|
|
|
|
|
|
|
|
class BuildError extends Model
|
|
|
|
{
|
2018-03-11 06:13:28 +01:00
|
|
|
const SEVERITY_CRITICAL = 0;
|
|
|
|
const SEVERITY_HIGH = 1;
|
|
|
|
const SEVERITY_NORMAL = 2;
|
|
|
|
const SEVERITY_LOW = 3;
|
|
|
|
|
2018-03-09 19:00:53 +01:00
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $tableName = 'build_error';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $data = [
|
2018-03-11 06:13:28 +01:00
|
|
|
'id' => null,
|
|
|
|
'build_id' => null,
|
|
|
|
'plugin' => null,
|
|
|
|
'file' => null,
|
|
|
|
'line_start' => null,
|
|
|
|
'line_end' => null,
|
|
|
|
'severity' => null,
|
|
|
|
'message' => null,
|
|
|
|
'create_date' => null,
|
2018-04-15 10:48:50 +02:00
|
|
|
'hash' => '',
|
|
|
|
'is_new' => 0,
|
2018-03-09 19:00:53 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return integer
|
|
|
|
*/
|
|
|
|
public function getId()
|
|
|
|
{
|
|
|
|
return (integer)$this->data['id'];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param integer $value
|
2018-03-11 06:13:28 +01:00
|
|
|
*
|
|
|
|
* @return boolean
|
2018-03-09 19:00:53 +01:00
|
|
|
*/
|
|
|
|
public function setId($value)
|
|
|
|
{
|
|
|
|
$this->validateNotNull('id', $value);
|
|
|
|
$this->validateInt('id', $value);
|
|
|
|
|
|
|
|
if ($this->data['id'] === $value) {
|
2018-03-11 06:13:28 +01:00
|
|
|
return false;
|
2018-03-09 19:00:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$this->data['id'] = $value;
|
|
|
|
|
2018-03-11 06:13:28 +01:00
|
|
|
return $this->setModified('id');
|
2018-03-09 19:00:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return integer
|
|
|
|
*/
|
|
|
|
public function getBuildId()
|
|
|
|
{
|
|
|
|
return (integer)$this->data['build_id'];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param integer $value
|
2018-03-11 06:13:28 +01:00
|
|
|
*
|
|
|
|
* @return boolean
|
2018-03-09 19:00:53 +01:00
|
|
|
*/
|
|
|
|
public function setBuildId($value)
|
|
|
|
{
|
|
|
|
$this->validateNotNull('build_id', $value);
|
|
|
|
$this->validateInt('build_id', $value);
|
|
|
|
|
|
|
|
if ($this->data['build_id'] === $value) {
|
2018-03-11 06:13:28 +01:00
|
|
|
return false;
|
2018-03-09 19:00:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$this->data['build_id'] = $value;
|
|
|
|
|
2018-03-11 06:13:28 +01:00
|
|
|
return $this->setModified('build_id');
|
2018-03-09 19:00:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getPlugin()
|
|
|
|
{
|
|
|
|
return $this->data['plugin'];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $value
|
2018-03-11 06:13:28 +01:00
|
|
|
*
|
|
|
|
* @return boolean
|
2018-03-09 19:00:53 +01:00
|
|
|
*/
|
|
|
|
public function setPlugin($value)
|
|
|
|
{
|
|
|
|
$this->validateNotNull('plugin', $value);
|
|
|
|
$this->validateString('plugin', $value);
|
|
|
|
|
|
|
|
if ($this->data['plugin'] === $value) {
|
2018-03-11 06:13:28 +01:00
|
|
|
return false;
|
2018-03-09 19:00:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$this->data['plugin'] = $value;
|
|
|
|
|
2018-03-11 06:13:28 +01:00
|
|
|
return $this->setModified('plugin');
|
2018-03-09 19:00:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getFile()
|
|
|
|
{
|
|
|
|
return $this->data['file'];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $value
|
2018-03-11 06:13:28 +01:00
|
|
|
*
|
|
|
|
* @return boolean
|
2018-03-09 19:00:53 +01:00
|
|
|
*/
|
|
|
|
public function setFile($value)
|
|
|
|
{
|
|
|
|
$this->validateString('file', $value);
|
|
|
|
|
|
|
|
if ($this->data['file'] === $value) {
|
2018-03-11 06:13:28 +01:00
|
|
|
return false;
|
2018-03-09 19:00:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$this->data['file'] = $value;
|
|
|
|
|
2018-03-11 06:13:28 +01:00
|
|
|
return $this->setModified('file');
|
2018-03-09 19:00:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return integer
|
|
|
|
*/
|
|
|
|
public function getLineStart()
|
|
|
|
{
|
|
|
|
return (integer)$this->data['line_start'];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param integer $value
|
2018-03-11 06:13:28 +01:00
|
|
|
*
|
|
|
|
* @return boolean
|
2018-03-09 19:00:53 +01:00
|
|
|
*/
|
|
|
|
public function setLineStart($value)
|
|
|
|
{
|
|
|
|
$this->validateInt('line_start', $value);
|
|
|
|
|
|
|
|
if ($this->data['line_start'] === $value) {
|
2018-03-11 06:13:28 +01:00
|
|
|
return false;
|
2018-03-09 19:00:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$this->data['line_start'] = $value;
|
|
|
|
|
2018-03-11 06:13:28 +01:00
|
|
|
return $this->setModified('line_start');
|
2018-03-09 19:00:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return integer
|
|
|
|
*/
|
|
|
|
public function getLineEnd()
|
|
|
|
{
|
|
|
|
return (integer)$this->data['line_end'];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param integer $value
|
2018-03-11 06:13:28 +01:00
|
|
|
*
|
|
|
|
* @return boolean
|
2018-03-09 19:00:53 +01:00
|
|
|
*/
|
|
|
|
public function setLineEnd($value)
|
|
|
|
{
|
|
|
|
$this->validateInt('line_end', $value);
|
|
|
|
|
|
|
|
if ($this->data['line_end'] === $value) {
|
2018-03-11 06:13:28 +01:00
|
|
|
return false;
|
2018-03-09 19:00:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$this->data['line_end'] = $value;
|
|
|
|
|
2018-03-11 06:13:28 +01:00
|
|
|
return $this->setModified('line_end');
|
2018-03-09 19:00:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return integer
|
|
|
|
*/
|
|
|
|
public function getSeverity()
|
|
|
|
{
|
|
|
|
return (integer)$this->data['severity'];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param integer $value
|
2018-03-11 06:13:28 +01:00
|
|
|
*
|
|
|
|
* @return boolean
|
2018-03-09 19:00:53 +01:00
|
|
|
*/
|
|
|
|
public function setSeverity($value)
|
|
|
|
{
|
|
|
|
$this->validateNotNull('severity', $value);
|
|
|
|
$this->validateInt('severity', $value);
|
|
|
|
|
|
|
|
if ($this->data['severity'] === $value) {
|
2018-03-11 06:13:28 +01:00
|
|
|
return false;
|
2018-03-09 19:00:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$this->data['severity'] = $value;
|
|
|
|
|
2018-03-11 06:13:28 +01:00
|
|
|
return $this->setModified('severity');
|
2018-03-09 19:00:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getMessage()
|
|
|
|
{
|
|
|
|
return $this->data['message'];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $value
|
2018-03-11 06:13:28 +01:00
|
|
|
*
|
|
|
|
* @return boolean
|
2018-03-09 19:00:53 +01:00
|
|
|
*/
|
|
|
|
public function setMessage($value)
|
|
|
|
{
|
|
|
|
$this->validateNotNull('message', $value);
|
|
|
|
$this->validateString('message', $value);
|
|
|
|
|
|
|
|
if ($this->data['message'] === $value) {
|
2018-03-11 06:13:28 +01:00
|
|
|
return false;
|
2018-03-09 19:00:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$this->data['message'] = $value;
|
|
|
|
|
2018-03-11 06:13:28 +01:00
|
|
|
return $this->setModified('message');
|
2018-03-09 19:00:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return \DateTime|null
|
|
|
|
*/
|
|
|
|
public function getCreateDate()
|
|
|
|
{
|
|
|
|
if ($this->data['create_date']) {
|
|
|
|
return new \DateTime($this->data['create_date']);
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param \DateTime $value
|
2018-03-11 06:13:28 +01:00
|
|
|
*
|
|
|
|
* @return boolean
|
2018-03-09 19:00:53 +01:00
|
|
|
*/
|
|
|
|
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) {
|
2018-03-11 06:13:28 +01:00
|
|
|
return false;
|
2018-03-09 19:00:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$this->data['create_date'] = $stringValue;
|
|
|
|
|
2018-03-11 06:13:28 +01:00
|
|
|
return $this->setModified('create_date');
|
2018-03-09 19:00:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getHash()
|
|
|
|
{
|
|
|
|
return $this->data['hash'];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $value
|
2018-03-11 06:13:28 +01:00
|
|
|
*
|
|
|
|
* @return boolean
|
2018-03-09 19:00:53 +01:00
|
|
|
*/
|
|
|
|
public function setHash($value)
|
|
|
|
{
|
|
|
|
$this->validateNotNull('hash', $value);
|
|
|
|
$this->validateString('hash', $value);
|
|
|
|
|
|
|
|
if ($this->data['hash'] === $value) {
|
2018-03-11 06:13:28 +01:00
|
|
|
return false;
|
2018-03-09 19:00:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$this->data['hash'] = $value;
|
|
|
|
|
2018-03-11 06:13:28 +01:00
|
|
|
return $this->setModified('hash');
|
2018-03-09 19:00:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return boolean
|
|
|
|
*/
|
|
|
|
public function getIsNew()
|
|
|
|
{
|
|
|
|
return (boolean)$this->data['is_new'];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param boolean $value
|
2018-03-11 06:13:28 +01:00
|
|
|
*
|
|
|
|
* @return boolean
|
2018-03-09 19:00:53 +01:00
|
|
|
*/
|
|
|
|
public function setIsNew($value)
|
|
|
|
{
|
|
|
|
$this->validateNotNull('is_new', $value);
|
|
|
|
$this->validateBoolean('is_new', $value);
|
|
|
|
|
2018-03-11 06:13:28 +01:00
|
|
|
if ($this->data['is_new'] === (integer)$value) {
|
|
|
|
return false;
|
2018-03-09 19:00:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$this->data['is_new'] = (integer)$value;
|
|
|
|
|
2018-03-11 06:13:28 +01:00
|
|
|
return $this->setModified('is_new');
|
2018-03-09 19:00:53 +01:00
|
|
|
}
|
|
|
|
}
|