Code style fixes

This commit is contained in:
Dmitry Khomutov 2017-01-13 22:35:41 +07:00
parent dfd002d35f
commit 1237bf450c
No known key found for this signature in database
GPG key ID: 7EB36C9576F9ECB9
88 changed files with 205 additions and 261 deletions

1
src/B8Framework/Application.php Executable file → Normal file
View file

@ -4,7 +4,6 @@ namespace b8;
use b8\Exception\HttpException\NotFoundException;
use b8\Http;
use b8\View;
use b8\Http\Response;
use b8\Http\Request;

0
src/B8Framework/Cache.php Executable file → Normal file
View file

0
src/B8Framework/Cache/ApcCache.php Executable file → Normal file
View file

0
src/B8Framework/Cache/RequestCache.php Executable file → Normal file
View file

0
src/B8Framework/Config.php Executable file → Normal file
View file

0
src/B8Framework/Controller.php Executable file → Normal file
View file

0
src/B8Framework/Database.php Executable file → Normal file
View file

0
src/B8Framework/Exception/HttpException.php Executable file → Normal file
View file

View file

View file

View file

View file

View file

View file

4
src/B8Framework/Form.php Executable file → Normal file
View file

@ -29,12 +29,12 @@ class Form extends FieldSet
$this->_method = $method;
}
protected function _onPreRender(View &$view)
protected function onPreRender(View &$view)
{
$view->action = $this->getAction();
$view->method = $this->getMethod();
parent::_onPreRender($view);
parent::onPreRender($view);
}
public function __toString()

0
src/B8Framework/Form/ControlGroup.php Executable file → Normal file
View file

4
src/B8Framework/Form/Element.php Executable file → Normal file
View file

@ -104,10 +104,10 @@ abstract class Element
$view->ccss = $this->getContainerClass();
$view->parent = $this->_parent;
$this->_onPreRender($view);
$this->onPreRender($view);
return $view->render();
}
abstract protected function _onPreRender(View &$view);
abstract protected function onPreRender(View &$view);
}

4
src/B8Framework/Form/Element/Button.php Executable file → Normal file
View file

@ -11,9 +11,9 @@ class Button extends Input
return true;
}
protected function _onPreRender(View &$view)
protected function onPreRender(View &$view)
{
parent::_onPreRender($view);
parent::onPreRender($view);
$view->type = 'button';
}
}

12
src/B8Framework/Form/Element/Checkbox.php Executable file → Normal file
View file

@ -21,14 +21,14 @@ class Checkbox extends Input
public function setValue($value)
{
if (is_bool($value) && $value == true) {
$this->_value = $this->getCheckedValue();
if (is_bool($value) && $value === true) {
$this->_value = $this->getCheckedValue();
$this->_checked = true;
return;
}
if ($value == $this->getCheckedValue()) {
$this->_value = $this->getCheckedValue();
$this->_value = $this->getCheckedValue();
$this->_checked = true;
return;
}
@ -37,10 +37,10 @@ class Checkbox extends Input
$this->_checked = false;
}
public function _onPreRender(View &$view)
public function onPreRender(View &$view)
{
parent::_onPreRender($view);
parent::onPreRender($view);
$view->checkedValue = $this->getCheckedValue();
$view->checked = $this->_checked;
$view->checked = $this->_checked;
}
}

0
src/B8Framework/Form/Element/CheckboxGroup.php Executable file → Normal file
View file

4
src/B8Framework/Form/Element/Csrf.php Executable file → Normal file
View file

@ -17,9 +17,9 @@ class Csrf extends Hidden
return true;
}
protected function _onPreRender(View &$view)
protected function onPreRender(View &$view)
{
parent::_onPreRender($view);
parent::onPreRender($view);
$csrf = md5(microtime(true));
$view->csrf = $csrf;
setcookie($this->getName(), $csrf);

4
src/B8Framework/Form/Element/Email.php Executable file → Normal file
View file

@ -11,9 +11,9 @@ class Email extends Text
return parent::render(($viewFile ? $viewFile : 'Text'));
}
protected function _onPreRender(View &$view)
protected function onPreRender(View &$view)
{
parent::_onPreRender($view);
parent::onPreRender($view);
$view->type = 'email';
}
}

2
src/B8Framework/Form/Element/Hidden.php Executable file → Normal file
View file

@ -2,7 +2,7 @@
namespace b8\Form\Element;
use b8\Form\Input, b8\View;
use b8\Form\Input;
class Hidden extends Input
{

4
src/B8Framework/Form/Element/Password.php Executable file → Normal file
View file

@ -11,9 +11,9 @@ class Password extends Text
return parent::render(($viewFile ? $viewFile : 'Text'));
}
protected function _onPreRender(View &$view)
protected function onPreRender(View &$view)
{
parent::_onPreRender($view);
parent::onPreRender($view);
$view->type = 'password';
}
}

0
src/B8Framework/Form/Element/Radio.php Executable file → Normal file
View file

4
src/B8Framework/Form/Element/Select.php Executable file → Normal file
View file

@ -13,9 +13,9 @@ class Select extends Input
$this->_options = $options;
}
protected function _onPreRender(View &$view)
protected function onPreRender(View &$view)
{
parent::_onPreRender($view);
parent::onPreRender($view);
$view->options = $this->_options;
}
}

4
src/B8Framework/Form/Element/Submit.php Executable file → Normal file
View file

@ -13,9 +13,9 @@ class Submit extends Button
return parent::render(($viewFile ? $viewFile : 'Button'));
}
protected function _onPreRender(View &$view)
protected function onPreRender(View &$view)
{
parent::_onPreRender($view);
parent::onPreRender($view);
$view->type = 'submit';
}
}

4
src/B8Framework/Form/Element/Text.php Executable file → Normal file
View file

@ -6,9 +6,9 @@ use b8\Form\Input, b8\View;
class Text extends Input
{
protected function _onPreRender(View &$view)
protected function onPreRender(View &$view)
{
parent::_onPreRender($view);
parent::onPreRender($view);
$view->type = 'text';
}
}

4
src/B8Framework/Form/Element/TextArea.php Executable file → Normal file
View file

@ -18,9 +18,9 @@ class TextArea extends Text
$this->_rows = $rows;
}
protected function _onPreRender(View &$view)
protected function onPreRender(View &$view)
{
parent::_onPreRender($view);
parent::onPreRender($view);
$view->rows = $this->getRows();
}
}

4
src/B8Framework/Form/Element/Url.php Executable file → Normal file
View file

@ -11,9 +11,9 @@ class Url extends Text
return parent::render(($viewFile ? $viewFile : 'Text'));
}
protected function _onPreRender(View &$view)
protected function onPreRender(View &$view)
{
parent::_onPreRender($view);
parent::onPreRender($view);
$view->type = 'url';
}
}

2
src/B8Framework/Form/FieldSet.php Executable file → Normal file
View file

@ -70,7 +70,7 @@ class FieldSet extends Element
return $rtn;
}
protected function _onPreRender(View &$view)
protected function onPreRender(View &$view)
{
$rendered = [];
foreach ($this->_children as $child) {

2
src/B8Framework/Form/Input.php Executable file → Normal file
View file

@ -107,7 +107,7 @@ class Input extends Element
return $this;
}
protected function _onPreRender(View &$view)
protected function onPreRender(View &$view)
{
$view->value = $this->getValue();
$view->error = $this->_error;

0
src/B8Framework/Form/View/Button.phtml Executable file → Normal file
View file

0
src/B8Framework/Form/View/Checkbox.phtml Executable file → Normal file
View file

0
src/B8Framework/Form/View/CheckboxGroup.phtml Executable file → Normal file
View file

0
src/B8Framework/Form/View/ControlGroup.phtml Executable file → Normal file
View file

0
src/B8Framework/Form/View/Csrf.phtml Executable file → Normal file
View file

0
src/B8Framework/Form/View/FieldSet.phtml Executable file → Normal file
View file

0
src/B8Framework/Form/View/Form.phtml Executable file → Normal file
View file

0
src/B8Framework/Form/View/Hidden.phtml Executable file → Normal file
View file

0
src/B8Framework/Form/View/Radio.phtml Executable file → Normal file
View file

0
src/B8Framework/Form/View/Select.phtml Executable file → Normal file
View file

0
src/B8Framework/Form/View/Text.phtml Executable file → Normal file
View file

0
src/B8Framework/Form/View/TextArea.phtml Executable file → Normal file
View file

0
src/B8Framework/Http/Request.php Executable file → Normal file
View file

0
src/B8Framework/Http/Response.php Executable file → Normal file
View file

0
src/B8Framework/Http/Response/JsonResponse.php Executable file → Normal file
View file

2
src/B8Framework/Http/Response/RedirectResponse.php Executable file → Normal file
View file

@ -22,6 +22,6 @@ class RedirectResponse extends Response
public function flush()
{
parent::flush();
die;
exit(1);
}
}

0
src/B8Framework/Http/Router.php Executable file → Normal file
View file

10
src/B8Framework/HttpClient.php Executable file → Normal file
View file

@ -64,7 +64,7 @@ class HttpClient
$res['headers'] = $http_response_header;
$res['code'] = (int)preg_replace('/HTTP\/1\.[0-1] ([0-9]+)/', '$1', $res['headers'][0]);
$res['success'] = false;
$res['body'] = $this->_decodeResponse($result);
$res['body'] = $this->decodeResponse($result);
if ($res['code'] >= 200 && $res['code'] < 300) {
$res['success'] = true;
@ -103,13 +103,13 @@ class HttpClient
return $this->request('DELETE', $uri, $params);
}
protected function _decodeResponse($originalResponse)
protected function decodeResponse($originalResponse)
{
$response = $originalResponse;
$body = '';
do {
$line = $this->_readChunk($response);
$line = $this->readChunk($response);
if ($line == PHP_EOL) {
continue;
@ -122,7 +122,7 @@ class HttpClient
}
do {
$data = $this->_readChunk($response, $length);
$data = $this->readChunk($response, $length);
// remove the amount received from the total length on the next loop
// it'll attempt to read that much less data
@ -145,7 +145,7 @@ class HttpClient
return $body;
}
protected function _readChunk(&$string, $len = 4096)
protected function readChunk(&$string, $len = 4096)
{
$rtn = '';
for ($i = 0; $i <= $len; $i++) {

4
src/B8Framework/Image.php Executable file → Normal file
View file

@ -65,7 +65,7 @@ class Image
$sourceRatio = $sourceWidth / $sourceHeight;
$targetRatio = $height != 'auto' ? $width / $height : $sourceRatio;
$quads = $this->_getQuadrants($sourceWidth, $sourceHeight);
$quads = $this->getQuadrants($sourceWidth, $sourceHeight);
foreach($quads as $name => $l)
{
@ -133,7 +133,7 @@ class Image
return $source;
}
protected function _getQuadrants($x, $y)
protected function getQuadrants($x, $y)
{
$rtn = [];
$rtn['top_left'] = [0, $x / 2, 0, $y / 3];

22
src/B8Framework/Model.php Executable file → Normal file
View file

@ -39,13 +39,13 @@ class Model
$rtn = [];
foreach ($sleepable as $property) {
$rtn[$property] = $this->_propertyToArray($property, $currentDepth, $depth);
$rtn[$property] = $this->propertyToArray($property, $currentDepth, $depth);
}
return $rtn;
}
protected function _propertyToArray($property, $currentDepth, $depth)
protected function propertyToArray($property, $currentDepth, $depth)
{
$rtn = null;
@ -54,14 +54,14 @@ class Model
$rtn = $this->{$method}();
if (is_object($rtn) || is_array($rtn)) {
$rtn = ($depth > $currentDepth) ? $this->_valueToArray($rtn, $currentDepth, $depth) : null;
$rtn = ($depth > $currentDepth) ? $this->valueToArray($rtn, $currentDepth, $depth) : null;
}
}
return $rtn;
}
protected function _valueToArray($value, $currentDepth, $depth)
protected function valueToArray($value, $currentDepth, $depth)
{
$rtn = null;
if (!is_null($value)) {
@ -71,7 +71,7 @@ class Model
$childArray = [];
foreach ($value as $k => $v) {
$childArray[$k] = $this->_valueToArray($v, $currentDepth + 1, $depth);
$childArray[$k] = $this->valueToArray($v, $currentDepth + 1, $depth);
}
$rtn = $childArray;
@ -113,19 +113,19 @@ class Model
}
}
protected function _setModified($column)
protected function setModified($column)
{
$this->modified[$column] = $column;
}
protected function _validateString($name, $value)
protected function validateString($name, $value)
{
if (!is_string($value) && !is_null($value)) {
throw new HttpException\ValidationException($name . ' must be a string.');
}
}
protected function _validateInt($name, &$value)
protected function validateInt($name, &$value)
{
if (is_bool($value)) {
$value = $value ? 1 : 0;
@ -140,7 +140,7 @@ class Model
}
}
protected function _validateFloat($name, &$value)
protected function validateFloat($name, &$value)
{
if (!is_numeric($value) && !is_null($value)) {
throw new HttpException\ValidationException($name . ' must be a float.');
@ -151,7 +151,7 @@ class Model
}
}
protected function _validateDate($name, &$value)
protected function validateDate($name, &$value)
{
if (is_string($value)) {
$value = empty($value) ? null : new \DateTime($value);
@ -165,7 +165,7 @@ class Model
$value = empty($value) ? null : $value->format('Y-m-d H:i:s');
}
protected function _validateNotNull($name, &$value)
protected function validateNotNull($name, &$value)
{
if (is_null($value)) {
throw new HttpException\ValidationException($name . ' must not be null.');

0
src/B8Framework/Store.php Executable file → Normal file
View file

0
src/B8Framework/Store/Factory.php Executable file → Normal file
View file

0
src/B8Framework/Type/CacheInterface.php Executable file → Normal file
View file

View file

@ -1,8 +0,0 @@
<?php
namespace b8\Type;
interface RestUser
{
public function checkPermission($permission, $resource);
}

4
src/B8Framework/View.php Executable file → Normal file
View file

@ -2,8 +2,6 @@
namespace b8;
class ViewRuntimeException extends \RuntimeException {}
class View
{
protected $_vars = [];
@ -13,7 +11,7 @@ class View
public function __construct($file, $path = null)
{
if (!self::exists($file, $path)) {
throw new ViewRuntimeException('View file does not exist: ' . $file);
throw new \RuntimeException('View file does not exist: ' . $file);
}
$this->viewFile = self::getViewFile($file, $path);

View file

@ -1,11 +0,0 @@
<?php
namespace b8\View\Helper;
class Format
{
public function Currency($number, $symbol = true)
{
return ($symbol ? '£' : '') . number_format($number, 2, '.', ',');
}
}

0
src/B8Framework/View/Template.php Executable file → Normal file
View file

View file

@ -89,7 +89,7 @@ class Builder implements LoggerAwareInterface
protected $pluginExecutor;
/**
* @var Helper\CommandExecutor
* @var Helper\CommandExecutorInterface
*/
protected $commandExecutor;

View file

@ -17,7 +17,7 @@ use Psr\Log\LogLevel;
* Handles running system commands with variables.
* @package PHPCensor\Helper
*/
abstract class BaseCommandExecutor implements CommandExecutor
abstract class BaseCommandExecutor implements CommandExecutorInterface
{
/**
* @var BuildLogger

View file

@ -9,7 +9,7 @@
namespace PHPCensor\Helper;
interface CommandExecutor
interface CommandExecutorInterface
{
/**
* Executes shell commands. Accepts multiple arguments the first

View file

@ -346,8 +346,8 @@ class BuildBase extends Model
*/
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;
@ -355,7 +355,7 @@ class BuildBase extends Model
$this->data['id'] = $value;
$this->_setModified('id');
$this->setModified('id');
}
/**
@ -365,8 +365,8 @@ class BuildBase extends Model
*/
public function setProjectId($value)
{
$this->_validateNotNull('ProjectId', $value);
$this->_validateInt('ProjectId', $value);
$this->validateNotNull('ProjectId', $value);
$this->validateInt('ProjectId', $value);
if ($this->data['project_id'] === $value) {
return;
@ -374,7 +374,7 @@ class BuildBase extends Model
$this->data['project_id'] = $value;
$this->_setModified('project_id');
$this->setModified('project_id');
}
/**
@ -384,8 +384,8 @@ class BuildBase extends Model
*/
public function setCommitId($value)
{
$this->_validateNotNull('CommitId', $value);
$this->_validateString('CommitId', $value);
$this->validateNotNull('CommitId', $value);
$this->validateString('CommitId', $value);
if ($this->data['commit_id'] === $value) {
return;
@ -393,7 +393,7 @@ class BuildBase extends Model
$this->data['commit_id'] = $value;
$this->_setModified('commit_id');
$this->setModified('commit_id');
}
/**
@ -403,8 +403,8 @@ class BuildBase extends Model
*/
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;
@ -412,7 +412,7 @@ class BuildBase extends Model
$this->data['status'] = $value;
$this->_setModified('status');
$this->setModified('status');
}
/**
@ -422,7 +422,7 @@ class BuildBase extends Model
*/
public function setLog($value)
{
$this->_validateString('Log', $value);
$this->validateString('Log', $value);
if ($this->data['log'] === $value) {
return;
@ -430,7 +430,7 @@ class BuildBase extends Model
$this->data['log'] = $value;
$this->_setModified('log');
$this->setModified('log');
}
/**
@ -440,8 +440,8 @@ class BuildBase extends Model
*/
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;
@ -449,7 +449,7 @@ class BuildBase extends Model
$this->data['branch'] = $value;
$this->_setModified('branch');
$this->setModified('branch');
}
/**
@ -459,7 +459,7 @@ class BuildBase extends Model
*/
public function setCreated($value)
{
$this->_validateDate('Created', $value);
$this->validateDate('Created', $value);
if ($this->data['created'] === $value) {
return;
@ -467,7 +467,7 @@ class BuildBase extends Model
$this->data['created'] = $value;
$this->_setModified('created');
$this->setModified('created');
}
/**
@ -477,7 +477,7 @@ class BuildBase extends Model
*/
public function setStarted($value)
{
$this->_validateDate('Started', $value);
$this->validateDate('Started', $value);
if ($this->data['started'] === $value) {
return;
@ -485,7 +485,7 @@ class BuildBase extends Model
$this->data['started'] = $value;
$this->_setModified('started');
$this->setModified('started');
}
/**
@ -495,7 +495,7 @@ class BuildBase extends Model
*/
public function setFinished($value)
{
$this->_validateDate('Finished', $value);
$this->validateDate('Finished', $value);
if ($this->data['finished'] === $value) {
return;
@ -503,7 +503,7 @@ class BuildBase extends Model
$this->data['finished'] = $value;
$this->_setModified('finished');
$this->setModified('finished');
}
/**
@ -513,7 +513,7 @@ class BuildBase extends Model
*/
public function setCommitterEmail($value)
{
$this->_validateString('CommitterEmail', $value);
$this->validateString('CommitterEmail', $value);
if ($this->data['committer_email'] === $value) {
return;
@ -521,7 +521,7 @@ class BuildBase extends Model
$this->data['committer_email'] = $value;
$this->_setModified('committer_email');
$this->setModified('committer_email');
}
/**
@ -531,7 +531,7 @@ class BuildBase extends Model
*/
public function setCommitMessage($value)
{
$this->_validateString('CommitMessage', $value);
$this->validateString('CommitMessage', $value);
if ($this->data['commit_message'] === $value) {
return;
@ -539,7 +539,7 @@ class BuildBase extends Model
$this->data['commit_message'] = $value;
$this->_setModified('commit_message');
$this->setModified('commit_message');
}
/**
@ -549,7 +549,7 @@ class BuildBase extends Model
*/
public function setExtra($value)
{
$this->_validateString('Extra', $value);
$this->validateString('Extra', $value);
if ($this->data['extra'] === $value) {
return;
@ -557,7 +557,7 @@ class BuildBase extends Model
$this->data['extra'] = $value;
$this->_setModified('extra');
$this->setModified('extra');
}
/**

View file

@ -279,8 +279,8 @@ class BuildErrorBase extends Model
*/
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;
@ -288,7 +288,7 @@ class BuildErrorBase extends Model
$this->data['id'] = $value;
$this->_setModified('id');
$this->setModified('id');
}
/**
@ -299,8 +299,8 @@ class BuildErrorBase extends Model
*/
public function setBuildId($value)
{
$this->_validateNotNull('BuildId', $value);
$this->_validateInt('BuildId', $value);
$this->validateNotNull('BuildId', $value);
$this->validateInt('BuildId', $value);
if ($this->data['build_id'] === $value) {
return;
@ -308,7 +308,7 @@ class BuildErrorBase extends Model
$this->data['build_id'] = $value;
$this->_setModified('build_id');
$this->setModified('build_id');
}
/**
@ -319,8 +319,8 @@ class BuildErrorBase extends Model
*/
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;
@ -328,7 +328,7 @@ class BuildErrorBase extends Model
$this->data['plugin'] = $value;
$this->_setModified('plugin');
$this->setModified('plugin');
}
/**
@ -338,7 +338,7 @@ class BuildErrorBase extends Model
*/
public function setFile($value)
{
$this->_validateString('File', $value);
$this->validateString('File', $value);
if ($this->data['file'] === $value) {
return;
@ -346,7 +346,7 @@ class BuildErrorBase extends Model
$this->data['file'] = $value;
$this->_setModified('file');
$this->setModified('file');
}
/**
@ -356,7 +356,7 @@ class BuildErrorBase extends Model
*/
public function setLineStart($value)
{
$this->_validateInt('LineStart', $value);
$this->validateInt('LineStart', $value);
if ($this->data['line_start'] === $value) {
return;
@ -364,7 +364,7 @@ class BuildErrorBase extends Model
$this->data['line_start'] = $value;
$this->_setModified('line_start');
$this->setModified('line_start');
}
/**
@ -374,7 +374,7 @@ class BuildErrorBase extends Model
*/
public function setLineEnd($value)
{
$this->_validateInt('LineEnd', $value);
$this->validateInt('LineEnd', $value);
if ($this->data['line_end'] === $value) {
return;
@ -382,7 +382,7 @@ class BuildErrorBase extends Model
$this->data['line_end'] = $value;
$this->_setModified('line_end');
$this->setModified('line_end');
}
/**
@ -393,8 +393,8 @@ class BuildErrorBase extends Model
*/
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;
@ -402,7 +402,7 @@ class BuildErrorBase extends Model
$this->data['severity'] = $value;
$this->_setModified('severity');
$this->setModified('severity');
}
/**
@ -413,8 +413,8 @@ class BuildErrorBase extends Model
*/
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;
@ -422,7 +422,7 @@ class BuildErrorBase extends Model
$this->data['message'] = $value;
$this->_setModified('message');
$this->setModified('message');
}
/**
@ -433,8 +433,8 @@ class BuildErrorBase extends Model
*/
public function setCreatedDate($value)
{
$this->_validateNotNull('CreatedDate', $value);
$this->_validateDate('CreatedDate', $value);
$this->validateNotNull('CreatedDate', $value);
$this->validateDate('CreatedDate', $value);
if ($this->data['created_date'] === $value) {
return;
@ -442,7 +442,7 @@ class BuildErrorBase extends Model
$this->data['created_date'] = $value;
$this->_setModified('created_date');
$this->setModified('created_date');
}
/**

View file

@ -201,8 +201,8 @@ class BuildMetaBase extends Model
*/
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;
@ -210,7 +210,7 @@ class BuildMetaBase extends Model
$this->data['id'] = $value;
$this->_setModified('id');
$this->setModified('id');
}
/**
@ -221,8 +221,8 @@ class BuildMetaBase extends Model
*/
public function setProjectId($value)
{
$this->_validateNotNull('ProjectId', $value);
$this->_validateInt('ProjectId', $value);
$this->validateNotNull('ProjectId', $value);
$this->validateInt('ProjectId', $value);
if ($this->data['project_id'] === $value) {
return;
@ -230,7 +230,7 @@ class BuildMetaBase extends Model
$this->data['project_id'] = $value;
$this->_setModified('project_id');
$this->setModified('project_id');
}
/**
@ -241,8 +241,8 @@ class BuildMetaBase extends Model
*/
public function setBuildId($value)
{
$this->_validateNotNull('BuildId', $value);
$this->_validateInt('BuildId', $value);
$this->validateNotNull('BuildId', $value);
$this->validateInt('BuildId', $value);
if ($this->data['build_id'] === $value) {
return;
@ -250,7 +250,7 @@ class BuildMetaBase extends Model
$this->data['build_id'] = $value;
$this->_setModified('build_id');
$this->setModified('build_id');
}
/**
@ -261,8 +261,8 @@ class BuildMetaBase extends Model
*/
public function setMetaKey($value)
{
$this->_validateNotNull('MetaKey', $value);
$this->_validateString('MetaKey', $value);
$this->validateNotNull('MetaKey', $value);
$this->validateString('MetaKey', $value);
if ($this->data['meta_key'] === $value) {
return;
@ -270,7 +270,7 @@ class BuildMetaBase extends Model
$this->data['meta_key'] = $value;
$this->_setModified('meta_key');
$this->setModified('meta_key');
}
/**
@ -281,8 +281,8 @@ class BuildMetaBase extends Model
*/
public function setMetaValue($value)
{
$this->_validateNotNull('MetaValue', $value);
$this->_validateString('MetaValue', $value);
$this->validateNotNull('MetaValue', $value);
$this->validateString('MetaValue', $value);
if ($this->data['meta_value'] === $value) {
return;
@ -290,7 +290,7 @@ class BuildMetaBase extends Model
$this->data['meta_value'] = $value;
$this->_setModified('meta_value');
$this->setModified('meta_value');
}
/**

View file

@ -353,8 +353,8 @@ class ProjectBase extends Model
*/
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;
@ -362,7 +362,7 @@ class ProjectBase extends Model
$this->data['id'] = $value;
$this->_setModified('id');
$this->setModified('id');
}
/**
@ -373,8 +373,8 @@ class ProjectBase extends Model
*/
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;
@ -382,7 +382,7 @@ class ProjectBase extends Model
$this->data['title'] = $value;
$this->_setModified('title');
$this->setModified('title');
}
/**
@ -393,8 +393,8 @@ class ProjectBase extends Model
*/
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;
@ -402,7 +402,7 @@ class ProjectBase extends Model
$this->data['reference'] = $value;
$this->_setModified('reference');
$this->setModified('reference');
}
/**
@ -413,8 +413,8 @@ class ProjectBase extends Model
*/
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;
@ -422,7 +422,7 @@ class ProjectBase extends Model
$this->data['branch'] = $value;
$this->_setModified('branch');
$this->setModified('branch');
}
/**
@ -432,7 +432,7 @@ class ProjectBase extends Model
*/
public function setSshPrivateKey($value)
{
$this->_validateString('SshPrivateKey', $value);
$this->validateString('SshPrivateKey', $value);
if ($this->data['ssh_private_key'] === $value) {
return;
@ -440,7 +440,7 @@ class ProjectBase extends Model
$this->data['ssh_private_key'] = $value;
$this->_setModified('ssh_private_key');
$this->setModified('ssh_private_key');
}
/**
@ -451,8 +451,8 @@ class ProjectBase extends Model
*/
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;
@ -460,7 +460,7 @@ class ProjectBase extends Model
$this->data['type'] = $value;
$this->_setModified('type');
$this->setModified('type');
}
/**
@ -470,7 +470,7 @@ class ProjectBase extends Model
*/
public function setAccessInformation($value)
{
$this->_validateString('AccessInformation', $value);
$this->validateString('AccessInformation', $value);
if ($this->data['access_information'] === $value) {
return;
@ -478,7 +478,7 @@ class ProjectBase extends Model
$this->data['access_information'] = $value;
$this->_setModified('access_information');
$this->setModified('access_information');
}
/**
@ -488,7 +488,7 @@ class ProjectBase extends Model
*/
public function setLastCommit($value)
{
$this->_validateString('LastCommit', $value);
$this->validateString('LastCommit', $value);
if ($this->data['last_commit'] === $value) {
return;
@ -496,7 +496,7 @@ class ProjectBase extends Model
$this->data['last_commit'] = $value;
$this->_setModified('last_commit');
$this->setModified('last_commit');
}
/**
@ -506,7 +506,7 @@ class ProjectBase extends Model
*/
public function setBuildConfig($value)
{
$this->_validateString('BuildConfig', $value);
$this->validateString('BuildConfig', $value);
if ($this->data['build_config'] === $value) {
return;
@ -514,7 +514,7 @@ class ProjectBase extends Model
$this->data['build_config'] = $value;
$this->_setModified('build_config');
$this->setModified('build_config');
}
/**
@ -524,7 +524,7 @@ class ProjectBase extends Model
*/
public function setSshPublicKey($value)
{
$this->_validateString('SshPublicKey', $value);
$this->validateString('SshPublicKey', $value);
if ($this->data['ssh_public_key'] === $value) {
return;
@ -532,7 +532,7 @@ class ProjectBase extends Model
$this->data['ssh_public_key'] = $value;
$this->_setModified('ssh_public_key');
$this->setModified('ssh_public_key');
}
/**
@ -543,8 +543,8 @@ class ProjectBase extends Model
*/
public function setAllowPublicStatus($value)
{
$this->_validateNotNull('AllowPublicStatus', $value);
$this->_validateInt('AllowPublicStatus', $value);
$this->validateNotNull('AllowPublicStatus', $value);
$this->validateInt('AllowPublicStatus', $value);
if ($this->data['allow_public_status'] === $value) {
return;
@ -552,7 +552,7 @@ class ProjectBase extends Model
$this->data['allow_public_status'] = $value;
$this->_setModified('allow_public_status');
$this->setModified('allow_public_status');
}
/**
@ -563,8 +563,8 @@ class ProjectBase extends Model
*/
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;
@ -572,7 +572,7 @@ class ProjectBase extends Model
$this->data['archived'] = $value;
$this->_setModified('archived');
$this->setModified('archived');
}
/**
@ -583,8 +583,8 @@ class ProjectBase extends Model
*/
public function setGroupId($value)
{
$this->_validateNotNull('GroupId', $value);
$this->_validateInt('GroupId', $value);
$this->validateNotNull('GroupId', $value);
$this->validateInt('GroupId', $value);
if ($this->data['group_id'] === $value) {
return;
@ -592,7 +592,7 @@ class ProjectBase extends Model
$this->data['group_id'] = $value;
$this->_setModified('group_id');
$this->setModified('group_id');
}
/**

View file

@ -119,8 +119,8 @@ class ProjectGroupBase extends Model
*/
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;
@ -128,7 +128,7 @@ class ProjectGroupBase extends Model
$this->data['id'] = $value;
$this->_setModified('id');
$this->setModified('id');
}
/**
@ -139,8 +139,8 @@ class ProjectGroupBase extends Model
*/
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;
@ -148,7 +148,7 @@ class ProjectGroupBase extends Model
$this->data['title'] = $value;
$this->_setModified('title');
$this->setModified('title');
}
/**

View file

@ -221,8 +221,8 @@ class UserBase extends Model
*/
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;
@ -230,7 +230,7 @@ class UserBase extends Model
$this->data['id'] = $value;
$this->_setModified('id');
$this->setModified('id');
}
/**
@ -241,8 +241,8 @@ class UserBase extends Model
*/
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;
@ -250,7 +250,7 @@ class UserBase extends Model
$this->data['email'] = $value;
$this->_setModified('email');
$this->setModified('email');
}
/**
@ -261,8 +261,8 @@ class UserBase extends Model
*/
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;
@ -270,7 +270,7 @@ class UserBase extends Model
$this->data['hash'] = $value;
$this->_setModified('hash');
$this->setModified('hash');
}
/**
@ -281,8 +281,8 @@ class UserBase extends Model
*/
public function setIsAdmin($value)
{
$this->_validateNotNull('IsAdmin', $value);
$this->_validateInt('IsAdmin', $value);
$this->validateNotNull('IsAdmin', $value);
$this->validateInt('IsAdmin', $value);
if ($this->data['is_admin'] === $value) {
return;
@ -290,7 +290,7 @@ class UserBase extends Model
$this->data['is_admin'] = $value;
$this->_setModified('is_admin');
$this->setModified('is_admin');
}
/**
@ -301,8 +301,8 @@ class UserBase extends Model
*/
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;
@ -310,7 +310,7 @@ class UserBase extends Model
$this->data['name'] = $value;
$this->_setModified('name');
$this->setModified('name');
}
/**
@ -327,7 +327,7 @@ class UserBase extends Model
$this->data['language'] = $value;
$this->_setModified('language');
$this->setModified('language');
}
/**
@ -344,7 +344,7 @@ class UserBase extends Model
$this->data['per_page'] = $value;
$this->_setModified('per_page');
$this->setModified('per_page');
}
/**

View file

@ -13,9 +13,9 @@ use PHPCensor\Builder;
use PHPCensor\Helper\Lang;
use PHPCensor\Model\Build;
use PHPCensor\Plugin\Util\TestResultParsers\Codeception as Parser;
use Psr\Log\LogLevel;
use PHPCensor\Plugin;
use PHPCensor\ZeroConfigPlugin;
use PHPCensor\ZeroConfigPluginInterface;
use Psr\Log\LogLevel;
/**
* Codeception Plugin - Enables full acceptance, unit, and functional testing.
@ -26,7 +26,7 @@ use PHPCensor\ZeroConfigPlugin;
* @package PHPCI
* @subpackage Plugins
*/
class Codeception extends Plugin implements ZeroConfigPlugin
class Codeception extends Plugin implements ZeroConfigPluginInterface
{
/** @var string */
protected $args = '';
@ -142,7 +142,7 @@ class Codeception extends Plugin implements ZeroConfigPlugin
$this->builder->log(
'Codeception XML path: '. $this->builder->buildPath . $this->path . 'report.xml',
Loglevel::DEBUG
LogLevel::DEBUG
);
$xml = file_get_contents($this->builder->buildPath . $this->path . 'report.xml', false);

View file

@ -13,7 +13,7 @@ use PHPCensor;
use PHPCensor\Builder;
use PHPCensor\Model\Build;
use PHPCensor\Plugin;
use PHPCensor\ZeroConfigPlugin;
use PHPCensor\ZeroConfigPluginInterface;
/**
* Composer Plugin - Provides access to Composer functionality.
@ -22,7 +22,7 @@ use PHPCensor\ZeroConfigPlugin;
* @package PHPCI
* @subpackage Plugins
*/
class Composer extends Plugin implements ZeroConfigPlugin
class Composer extends Plugin implements ZeroConfigPluginInterface
{
protected $directory;
protected $action;

View file

@ -9,13 +9,8 @@
namespace PHPCensor\Plugin;
use b8\Config;
use b8\ViewRuntimeException;
use Exception;
use b8\View;
use PHPCensor\Builder;
use PHPCensor\Helper\Lang;
use PHPCensor\Model\Build;
use PHPCensor\Helper\Email as EmailHelper;
use Psr\Log\LogLevel;
use PHPCensor\Plugin;
@ -57,7 +52,7 @@ class Email extends Plugin
try {
$view = $this->getMailTemplate();
} catch (ViewRuntimeException $e) {
} catch (\RuntimeException $e) {
$this->builder->log(
sprintf('Unknown mail template "%s", falling back to default.', $this->options['template']),
LogLevel::WARNING

View file

@ -9,9 +9,7 @@
namespace PHPCensor\Plugin;
use PHPCensor\Builder;
use PHPCensor\Helper\Lang;
use PHPCensor\Model\Build;
use PHPCensor\Plugin;
/**

View file

@ -9,9 +9,7 @@
namespace PHPCensor\Plugin;
use PHPCensor\Builder;
use PHPCensor\Helper\Lang;
use PHPCensor\Model\Build;
use PHPCensor\Plugin;
/**

View file

@ -2,7 +2,6 @@
namespace PHPCensor\Plugin;
use Exception;
use PHPCensor\Builder;
use PHPCensor\Helper\Lang;
use PHPCensor\Model\Build;
@ -204,7 +203,7 @@ class Phar extends Plugin
}
$success = true;
} catch (Exception $e) {
} catch (\Exception $e) {
$this->builder->log(Lang::get('phar_internal_error'));
$this->builder->log($e->getMessage());
}

View file

@ -14,7 +14,7 @@ use PHPCensor\Builder;
use PHPCensor\Model\Build;
use PHPCensor\Model\BuildError;
use PHPCensor\Plugin;
use PHPCensor\ZeroConfigPlugin;
use PHPCensor\ZeroConfigPluginInterface;
/**
* PHP Code Sniffer Plugin - Allows PHP Code Sniffer testing.
@ -23,7 +23,7 @@ use PHPCensor\ZeroConfigPlugin;
* @package PHPCI
* @subpackage Plugins
*/
class PhpCodeSniffer extends Plugin implements ZeroConfigPlugin
class PhpCodeSniffer extends Plugin implements ZeroConfigPluginInterface
{
/**
* @var array

View file

@ -14,7 +14,7 @@ use PHPCensor\Helper\Lang;
use PHPCensor\Model\Build;
use PHPCensor\Model\BuildError;
use PHPCensor\Plugin;
use PHPCensor\ZeroConfigPlugin;
use PHPCensor\ZeroConfigPluginInterface;
/**
* PHP Copy / Paste Detector - Allows PHP Copy / Paste Detector testing.
@ -23,7 +23,7 @@ use PHPCensor\ZeroConfigPlugin;
* @package PHPCI
* @subpackage Plugins
*/
class PhpCpd extends Plugin implements ZeroConfigPlugin
class PhpCpd extends Plugin implements ZeroConfigPluginInterface
{
protected $directory;
protected $args;

View file

@ -13,7 +13,7 @@ use PHPCensor;
use PHPCensor\Builder;
use PHPCensor\Model\Build;
use PHPCensor\Plugin;
use PHPCensor\ZeroConfigPlugin;
use PHPCensor\ZeroConfigPluginInterface;
/**
* PHP Docblock Checker Plugin - Checks your PHP files for appropriate uses of Docblocks
@ -22,7 +22,7 @@ use PHPCensor\ZeroConfigPlugin;
* @package PHPCI
* @subpackage Plugins
*/
class PhpDocblockChecker extends Plugin implements ZeroConfigPlugin
class PhpDocblockChecker extends Plugin implements ZeroConfigPluginInterface
{
/**
* @var string Based on the assumption the root may not hold the code to be

View file

@ -13,7 +13,7 @@ use PHPCensor;
use PHPCensor\Builder;
use PHPCensor\Model\Build;
use PHPCensor\Plugin;
use PHPCensor\ZeroConfigPlugin;
use PHPCensor\ZeroConfigPluginInterface;
/**
* PHP Loc - Allows PHP Copy / Lines of Code testing.
@ -22,7 +22,7 @@ use PHPCensor\ZeroConfigPlugin;
* @package PHPCI
* @subpackage Plugins
*/
class PhpLoc extends Plugin implements ZeroConfigPlugin
class PhpLoc extends Plugin implements ZeroConfigPluginInterface
{
/**
* @var string

View file

@ -13,7 +13,7 @@ use PHPCensor;
use PHPCensor\Builder;
use PHPCensor\Model\Build;
use PHPCensor\Plugin;
use PHPCensor\ZeroConfigPlugin;
use PHPCensor\ZeroConfigPluginInterface;
/**
* PHP Mess Detector Plugin - Allows PHP Mess Detector testing.
@ -22,7 +22,7 @@ use PHPCensor\ZeroConfigPlugin;
* @package PHPCI
* @subpackage Plugins
*/
class PhpMessDetector extends Plugin implements ZeroConfigPlugin
class PhpMessDetector extends Plugin implements ZeroConfigPluginInterface
{
/**
* @var array

View file

@ -12,7 +12,7 @@ namespace PHPCensor\Plugin;
use PHPCensor\Builder;
use PHPCensor\Model\Build;
use PHPCensor\Plugin;
use PHPCensor\ZeroConfigPlugin;
use PHPCensor\ZeroConfigPluginInterface;
/**
* Php Parallel Lint Plugin - Provides access to PHP lint functionality.
@ -21,7 +21,7 @@ use PHPCensor\ZeroConfigPlugin;
* @package PHPCI
* @subpackage Plugins
*/
class PhpParallelLint extends Plugin implements ZeroConfigPlugin
class PhpParallelLint extends Plugin implements ZeroConfigPluginInterface
{
/**
* @var string

View file

@ -10,8 +10,6 @@
namespace PHPCensor\Plugin;
use PHPCensor;
use PHPCensor\Builder;
use PHPCensor\Model\Build;
use PHPCensor\Plugin;
/**

View file

@ -17,7 +17,7 @@ use PHPCensor\Model\BuildError;
use PHPCensor\Plugin\Option\PhpUnitOptions;
use PHPCensor\Plugin\Util\PhpUnitResult;
use PHPCensor\Plugin;
use PHPCensor\ZeroConfigPlugin;
use PHPCensor\ZeroConfigPluginInterface;
/**
* PHP Unit Plugin - A rewrite of the original PHP Unit plugin
@ -27,7 +27,7 @@ use PHPCensor\ZeroConfigPlugin;
* @package PHPCI
* @subpackage Plugins
*/
class PhpUnit extends Plugin implements ZeroConfigPlugin
class PhpUnit extends Plugin implements ZeroConfigPluginInterface
{
/** @var string[] Raw options from the PHPCI config file */
protected $options = array();

6
src/PHPCensor/Plugin/TechnicalDebt.php Executable file → Normal file
View file

@ -13,7 +13,7 @@ use PHPCensor;
use PHPCensor\Builder;
use PHPCensor\Model\Build;
use PHPCensor\Plugin;
use PHPCensor\ZeroConfigPlugin;
use PHPCensor\ZeroConfigPluginInterface;
/**
* Technical Debt Plugin - Checks for existence of "TODO", "FIXME", etc.
@ -22,7 +22,7 @@ use PHPCensor\ZeroConfigPlugin;
* @package PHPCI
* @subpackage Plugins
*/
class TechnicalDebt extends Plugin implements ZeroConfigPlugin
class TechnicalDebt extends Plugin implements ZeroConfigPluginInterface
{
/**
* @var array
@ -155,7 +155,7 @@ class TechnicalDebt extends Plugin implements ZeroConfigPlugin
$skipFile = true;
}
if ($skipFile == false) {
if ($skipFile === false) {
$files[] = $file->getRealPath();
}
}

View file

@ -35,7 +35,6 @@ class WindowsProcessControl implements ProcessControlInterface
*/
public function kill($pid, $forcefully = false)
{
$output = [];
$result = 1;
exec(sprintf("taskkill /t /pid %d %s 2>nul:", $pid, $forcefully ? '/f' : ''));

View file

@ -9,7 +9,6 @@
namespace PHPCensor\Service;
use PHPCensor\Helper\Lang;
use PHPCensor\Model\User;
use PHPCensor\Store\UserStore;

View file

@ -15,7 +15,7 @@ use PHPCensor\Model\Build;
* PHPCI Plugin Interface - Used by all build plugins.
* @author Dan Cryer <dan@block8.co.uk>
*/
interface ZeroConfigPlugin
interface ZeroConfigPluginInterface
{
public static function canExecute($stage, Builder $builder, Build $build);
}

View file

@ -31,19 +31,6 @@ class ViewTest extends \PHPUnit_Framework_TestCase
$this->assertTrue($view->render() == 'Hello World');
}
public function testFormatViewHelper()
{
$view = new View('format', __DIR__ . '/data/view/');
$view->number = 1000000.25;
$view->symbol = true;
$this->assertTrue($view->render() == '£1,000,000.25');
$view->number = 1024;
$view->symbol = false;
$this->assertTrue($view->render() == '1,024.00');
}
/**
* @expectedException \Exception
*/
@ -115,12 +102,6 @@ class ViewTest extends \PHPUnit_Framework_TestCase
$view = new Template('Hello{ifnot who} World{/ifnot}');
$view->who = true;
$this->assertTrue($view->render() == 'Hello');
$view = new Template('Hello {if Format:not_present}World{/if}');
$this->assertTrue($view->render() == 'Hello ');
$view = new Template('Hello {ifnot Format:not_present}World{/ifnot}');
$this->assertTrue($view->render() == 'Hello World');
}
public function testUserViewLoop()

View file

@ -1 +0,0 @@
<?= $this->Format()->Currency($number, $symbol); ?>