Add Flux from() and filter() methods

Signed-off-by: davidarendsen <davidarendsen@hey.com>
This commit is contained in:
davidarendsen 2022-08-05 15:41:38 +00:00
commit e0e69b4beb
17 changed files with 2095 additions and 0 deletions

31
src/Function/From.php Normal file
View file

@ -0,0 +1,31 @@
<?php
namespace Arendsen\FluxQueryBuilder\Function;
class From extends Base {
/**
* @var array $settings
*/
private $settings;
public function __construct(array $settings)
{
$this->settings = $settings;
}
public function __toString()
{
return 'from(' . implode(', ', $this->format($this->settings)) . ') ';
}
protected function format(array $settings)
{
array_walk($settings, function(&$value, $key) {
$value = $key . ': ' . (is_string($value) ? '"' . $value . '"' : $value);
});
return $settings;
}
}