Kraken\Channel\ChannelComposite::combine PHP Method

combine() private method

private combine ( mixed | mixed[] | null $in, mixed | mixed[] | null $out, callable $combinator ) : mixed | mixed[]
$in mixed | mixed[] | null
$out mixed | mixed[] | null
$combinator callable
return mixed | mixed[]
    private function combine($in, $out, callable $combinator)
    {
        if ($in === null) {
            return $out;
        }
        if ($out === null) {
            return $in;
        }
        if (!is_array($in)) {
            return $combinator($in, $out);
        }
        $result = [];
        foreach ($in as $index => $status) {
            $result[$index] = $combinator($in[$index], $out[$index]);
        }
        return $result;
    }