2022-09-01 09:49:14 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Arendsen\FluxQueryBuilder\Type;
|
|
|
|
|
|
|
|
|
|
class FnType implements TypeInterface
|
|
|
|
|
{
|
2022-09-09 11:07:42 +00:00
|
|
|
/**
|
|
|
|
|
* @var mixed $value
|
|
|
|
|
*/
|
|
|
|
|
protected $value;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var string $content
|
|
|
|
|
*/
|
|
|
|
|
protected $content;
|
|
|
|
|
|
|
|
|
|
public function __construct($value, string $content = '')
|
2022-09-01 09:49:14 +00:00
|
|
|
{
|
|
|
|
|
$this->value = $value;
|
2022-09-09 11:07:42 +00:00
|
|
|
$this->content = $content;
|
2022-09-01 09:49:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function __toString(): string
|
|
|
|
|
{
|
2022-09-09 11:07:42 +00:00
|
|
|
if(is_string($this->value)) {
|
|
|
|
|
return $this->value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return '(' . implode(', ', $this->value) . ') => ' . $this->content;
|
2022-09-01 09:49:14 +00:00
|
|
|
}
|
|
|
|
|
}
|