Add Types
Signed-off-by: davidarendsen <davidarendsen@hey.com>
This commit is contained in:
parent
02810bd7fa
commit
a50e33ba04
5 changed files with 93 additions and 1 deletions
29
src/Type.php
Normal file
29
src/Type.php
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace Arendsen\FluxQueryBuilder;
|
||||
|
||||
use Arendsen\FluxQueryBuilder\Type\Time;
|
||||
use DateTime;
|
||||
|
||||
class Type
|
||||
{
|
||||
public function __construct($value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
switch (gettype($this->value)) {
|
||||
case 'string':
|
||||
return '"' . $this->value . '"';
|
||||
case 'object':
|
||||
if ($this->value instanceof DateTime) {
|
||||
return new Time($this->value);
|
||||
}
|
||||
return $this->value->__toString();
|
||||
default:
|
||||
return (string)$this->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
editor.link_modal.header
Reference in a new issue