Fix coding style with phpcs PSR-12 standard
Signed-off-by: davidarendsen <davidarendsen@hey.com>
This commit is contained in:
parent
b77ffd7f38
commit
39ae737fa1
30 changed files with 264 additions and 205 deletions
|
|
@ -5,14 +5,13 @@ namespace Arendsen\FluxQueryBuilder\Functions;
|
|||
use Arendsen\FluxQueryBuilder\Formatters;
|
||||
use Arendsen\FluxQueryBuilder\Exception\FunctionNotImplementedException;
|
||||
|
||||
abstract class Base {
|
||||
|
||||
/**
|
||||
* @throws FunctionNotImplementedException
|
||||
*/
|
||||
public function __toString()
|
||||
abstract class Base
|
||||
{
|
||||
/**
|
||||
* @throws FunctionNotImplementedException
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
throw new FunctionNotImplementedException('__toString', get_class($this));
|
||||
}
|
||||
|
||||
}
|
||||
throw new FunctionNotImplementedException('__toString', get_class($this));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ namespace Arendsen\FluxQueryBuilder\Functions;
|
|||
|
||||
use Arendsen\FluxQueryBuilder\Expression\KeyValue;
|
||||
|
||||
class Filter extends Base {
|
||||
|
||||
class Filter extends Base
|
||||
{
|
||||
/**
|
||||
* @var KeyValue $keyValue
|
||||
*/
|
||||
|
|
@ -20,5 +20,4 @@ class Filter extends Base {
|
|||
{
|
||||
return '|> filter(fn: (r) => ' . $this->keyValue . ') ';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ namespace Arendsen\FluxQueryBuilder\Functions;
|
|||
|
||||
use Arendsen\FluxQueryBuilder\Formatters;
|
||||
|
||||
class From extends Base {
|
||||
|
||||
class From extends Base
|
||||
{
|
||||
/**
|
||||
* @var array $settings
|
||||
*/
|
||||
|
|
@ -20,5 +20,4 @@ class From extends Base {
|
|||
{
|
||||
return 'from(' . Formatters::toFluxArrayString($this->settings) . ') ';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ namespace Arendsen\FluxQueryBuilder\Functions;
|
|||
|
||||
use Arendsen\FluxQueryBuilder\Formatters;
|
||||
|
||||
class Group extends Base {
|
||||
|
||||
class Group extends Base
|
||||
{
|
||||
/**
|
||||
* @var array $columns
|
||||
*/
|
||||
|
|
@ -31,5 +31,4 @@ class Group extends Base {
|
|||
|
||||
return '|> group(' . $array . ') ';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
namespace Arendsen\FluxQueryBuilder\Functions;
|
||||
|
||||
class Limit extends Base {
|
||||
|
||||
class Limit extends Base
|
||||
{
|
||||
/**
|
||||
* @var int $limit
|
||||
*/
|
||||
|
|
@ -18,5 +18,4 @@ class Limit extends Base {
|
|||
{
|
||||
return '|> limit(n:' . (string)$this->limit . ') ';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
namespace Arendsen\FluxQueryBuilder\Functions;
|
||||
|
||||
class Map extends Base {
|
||||
|
||||
class Map extends Base
|
||||
{
|
||||
/**
|
||||
* @var array $query
|
||||
*/
|
||||
|
|
@ -18,5 +18,4 @@ class Map extends Base {
|
|||
{
|
||||
return '|> map(fn: (r) => ({ ' . $this->query . ' })) ';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ use Arendsen\FluxQueryBuilder\Exception\FunctionRequiredSettingMissingException;
|
|||
use Arendsen\FluxQueryBuilder\Formatters;
|
||||
use DateTime;
|
||||
|
||||
class Range extends Base {
|
||||
|
||||
class Range extends Base
|
||||
{
|
||||
/**
|
||||
* @var mixed $start
|
||||
*/
|
||||
|
|
@ -26,18 +26,15 @@ class Range extends Base {
|
|||
|
||||
public function __toString()
|
||||
{
|
||||
if(!$this->start)
|
||||
{
|
||||
if (!$this->start) {
|
||||
throw new FunctionRequiredSettingMissingException('Range', 'Start setting is required!');
|
||||
}
|
||||
|
||||
$settingsString = 'start: ' . $this->start;
|
||||
if($this->stop)
|
||||
{
|
||||
if ($this->stop) {
|
||||
$settingsString .= ', stop: ' . $this->stop;
|
||||
}
|
||||
|
||||
return '|> range(' . $settingsString . ') ';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ namespace Arendsen\FluxQueryBuilder\Functions;
|
|||
|
||||
use Arendsen\FluxQueryBuilder\Formatters;
|
||||
|
||||
class Reduce extends Base {
|
||||
|
||||
class Reduce extends Base
|
||||
{
|
||||
/**
|
||||
* @var array $settings
|
||||
*/
|
||||
|
|
@ -24,17 +24,16 @@ class Reduce extends Base {
|
|||
|
||||
public function __toString()
|
||||
{
|
||||
return '|> reduce(fn: (r, accumulator) => ({' . implode(', ', $this->formatSettings($this->settings)) . '}), ' .
|
||||
return '|> reduce(fn: (r, accumulator) => ({' . implode(', ', $this->formatSettings($this->settings)) . '}), ' .
|
||||
'identity: {' . Formatters::toFluxArrayString($this->identity) . '}) ';
|
||||
}
|
||||
|
||||
protected function formatSettings(array $settings)
|
||||
{
|
||||
array_walk($settings, function(&$value, $key) {
|
||||
$value = $key . ': ' . $value;
|
||||
});
|
||||
array_walk($settings, function (&$value, $key) {
|
||||
$value = $key . ': ' . $value;
|
||||
});
|
||||
|
||||
return $settings;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ namespace Arendsen\FluxQueryBuilder\Functions;
|
|||
|
||||
use Arendsen\FluxQueryBuilder\Formatters;
|
||||
|
||||
class Sort extends Base {
|
||||
|
||||
class Sort extends Base
|
||||
{
|
||||
/**
|
||||
* @var array $columns
|
||||
*/
|
||||
|
|
@ -24,8 +24,7 @@ class Sort extends Base {
|
|||
|
||||
public function __toString()
|
||||
{
|
||||
return '|> sort(columns: [' . Formatters::toFluxArrayString($this->columns) .
|
||||
return '|> sort(columns: [' . Formatters::toFluxArrayString($this->columns) .
|
||||
'], desc: ' . Formatters::valueToString($this->desc) . ') ';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
editor.link_modal.header
Reference in a new issue