Rename namespace Function keyword to Functions to prevent errors
Signed-off-by: davidarendsen <davidarendsen@hey.com>
This commit is contained in:
parent
4c1a1a0af8
commit
79edee7400
19 changed files with 31 additions and 31 deletions
40
src/Functions/Reduce.php
Normal file
40
src/Functions/Reduce.php
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
namespace Arendsen\FluxQueryBuilder\Functions;
|
||||
|
||||
use Arendsen\FluxQueryBuilder\Formatters;
|
||||
|
||||
class Reduce extends Base {
|
||||
|
||||
/**
|
||||
* @var array $settings
|
||||
*/
|
||||
private $settings;
|
||||
|
||||
/**
|
||||
* @var array $identity
|
||||
*/
|
||||
private $identity;
|
||||
|
||||
public function __construct(array $settings, array $identity)
|
||||
{
|
||||
$this->settings = $settings;
|
||||
$this->identity = $identity;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return '|> reduce(fn: (r, accumulator) => ({' . implode(', ', $this->formatSettings($this->settings)) . '}), ' .
|
||||
'identity: {' . Formatters::toFluxArrayString($this->identity) . '}) ';
|
||||
}
|
||||
|
||||
protected function formatSettings(array $settings)
|
||||
{
|
||||
array_walk($settings, function(&$value, $key) {
|
||||
$value = $key . ': ' . $value;
|
||||
});
|
||||
|
||||
return $settings;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
editor.link_modal.header
Reference in a new issue