Add new types Array, Boolean, Record, Math

Signed-off-by: davidarendsen <davidarendsen@hey.com>
This commit is contained in:
davidarendsen 2022-08-16 14:46:06 +00:00
commit 057a2d625e
10 changed files with 137 additions and 29 deletions

27
src/Type/ArrayType.php Normal file
View file

@ -0,0 +1,27 @@
<?php
namespace Arendsen\FluxQueryBuilder\Type;
use Arendsen\FluxQueryBuilder\Formatters;
use Arendsen\FluxQueryBuilder\Type;
class ArrayType implements TypeInterface
{
public function __construct(array $value)
{
$this->value = $value;
}
public function __toString(): string
{
array_walk($this->value, function (&$value, $key) {
if (is_string($key)) {
$value = $key . ': ' . Formatters::valueToString($value);
} else {
$value = Formatters::valueToString($value);
}
});
return implode(', ', $this->value);
}
}