2022-08-08 15:37:04 +00:00
|
|
|
<?php
|
|
|
|
|
|
2022-08-12 12:37:30 +00:00
|
|
|
namespace Arendsen\FluxQueryBuilder\Functions;
|
2022-08-08 15:37:04 +00:00
|
|
|
|
2022-08-16 14:46:06 +00:00
|
|
|
use Arendsen\FluxQueryBuilder\Type\Record;
|
2022-08-11 12:42:43 +00:00
|
|
|
|
2022-08-15 20:28:25 +00:00
|
|
|
class Reduce extends Base
|
|
|
|
|
{
|
2022-08-08 15:37:04 +00:00
|
|
|
/**
|
|
|
|
|
* @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()
|
|
|
|
|
{
|
2022-08-16 14:46:06 +00:00
|
|
|
return '|> reduce(fn: (r, accumulator) => (' . new Record($this->settings) . '), ' .
|
|
|
|
|
'identity: ' . new Record($this->identity) . ') ';
|
2022-08-08 15:37:04 +00:00
|
|
|
}
|
2022-08-15 20:28:25 +00:00
|
|
|
}
|