added configuration for PHP Coding Standards Fixer, including its fixes, resolving #47

This commit is contained in:
El RIDO
2016-08-15 16:45:47 +02:00
parent 87926ce157
commit 72aac25f68
17 changed files with 114 additions and 90 deletions

View File

@@ -67,9 +67,9 @@ abstract class AbstractModel
*/
public function __construct(Configuration $configuration, AbstractData $storage)
{
$this->_conf = $configuration;
$this->_store = $storage;
$this->_data = new stdClass;
$this->_conf = $configuration;
$this->_store = $storage;
$this->_data = new stdClass;
$this->_data->meta = new stdClass;
}

View File

@@ -133,7 +133,7 @@ class Comment extends AbstractModel
*/
public function setPaste(Paste $paste)
{
$this->_paste = $paste;
$this->_paste = $paste;
$this->_data->meta->pasteid = $paste->getId();
}
@@ -199,12 +199,12 @@ class Comment extends AbstractModel
$icon = $this->_conf->getKey('icon');
if ($icon != 'none') {
$pngdata = '';
$hmac = TrafficLimiter::getHash();
$hmac = TrafficLimiter::getHash();
if ($icon == 'identicon') {
$identicon = new Identicon();
$pngdata = $identicon->getImageDataUri($hmac, 16);
$pngdata = $identicon->getImageDataUri($hmac, 16);
} elseif ($icon == 'vizhash') {
$vh = new Vizhash16x16();
$vh = new Vizhash16x16();
$pngdata = 'data:image/png;base64,' . base64_encode(
$vh->generate($hmac)
);

View File

@@ -62,11 +62,11 @@ class Paste extends AbstractModel
if (!property_exists($data->meta, 'salt')) {
$data->meta->salt = ServerSalt::get();
}
$data->comments = array_values($this->getComments());
$data->comment_count = count($data->comments);
$data->comments = array_values($this->getComments());
$data->comment_count = count($data->comments);
$data->comment_offset = 0;
$data->{'@context'} = 'js/paste.jsonld';
$this->_data = $data;
$data->{'@context'} = 'js/paste.jsonld';
$this->_data = $data;
return $this->_data;
}
@@ -85,7 +85,7 @@ class Paste extends AbstractModel
}
$this->_data->meta->postdate = time();
$this->_data->meta->salt = serversalt::generate();
$this->_data->meta->salt = serversalt::generate();
// store paste
if (
@@ -247,7 +247,7 @@ class Paste extends AbstractModel
throw new Exception('Invalid data.', 73);
}
$this->_data->meta->burnafterreading = true;
$this->_data->meta->opendiscussion = false;
$this->_data->meta->opendiscussion = false;
}
}
@@ -296,7 +296,7 @@ class Paste extends AbstractModel
*
* @access public
* @throws Exception
* @return boolean
* @return bool
*/
public function isBurnafterreading()
{
@@ -313,7 +313,7 @@ class Paste extends AbstractModel
*
* @access public
* @throws Exception
* @return boolean
* @return bool
*/
public function isOpendiscussion()
{