Move Exceptions in a separate directory + Fixed Range function
Signed-off-by: davidarendsen <davidarendsen@hey.com>
This commit is contained in:
parent
79edee7400
commit
648709bd19
9 changed files with 47 additions and 19 deletions
|
|
@ -3,6 +3,7 @@
|
|||
namespace Arendsen\FluxQueryBuilder\Functions;
|
||||
|
||||
use Arendsen\FluxQueryBuilder\Formatters;
|
||||
use Arendsen\FluxQueryBuilder\Function\FunctionNotImplementedException;
|
||||
|
||||
abstract class Base {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Arendsen\FluxQueryBuilder\Functions;
|
||||
|
||||
use Exception;
|
||||
|
||||
class FunctionNotImplementedException extends Exception {}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Arendsen\FluxQueryBuilder\Functions;
|
||||
|
||||
use Arendsen\FluxQueryBuilder\Formatters;
|
||||
use Arendsen\FluxQueryBuilder\Exception\FunctionRequiredSettingMissingException;
|
||||
|
||||
class Range extends Base {
|
||||
|
||||
|
|
@ -18,7 +18,18 @@ class Range extends Base {
|
|||
|
||||
public function __toString()
|
||||
{
|
||||
return '|> range(' . Formatters::toFluxArrayString($this->settings) . ') ';
|
||||
if(!isset($this->settings['start']))
|
||||
{
|
||||
throw new FunctionRequiredSettingMissingException('Range', 'Start setting is required!');
|
||||
}
|
||||
|
||||
$settingsString = 'start: ' . $this->settings['start'];
|
||||
if(isset($this->settings['stop']))
|
||||
{
|
||||
$settingsString .= ', stop: ' . $this->settings['stop'];
|
||||
}
|
||||
|
||||
return '|> range(' . $settingsString . ') ';
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
editor.link_modal.header
Reference in a new issue