protected function flatMap(array $flattened, MonadInterface $result)
    {
        $value = $result->get();

        if (!is_array($value)) {
            $value = [ $value ];
        }

        return array_merge($flattened, $value);
    }
protected function flatMap(array $flattened, MonadInterface $result)
    {
        $value = $result->get();

        if (!is_array($value)) {
            $value = [ $value ];
        }

        return array_merge($flattened, $value);
    }
protected function flatMap ( array $ flattened , MonadInterface $ result ) { $ value = $ result -> get ( ) ; if ( ! is_array ( $ value ) ) { $ value = [ $ value ] ; } return array_merge ( $ flattened , $ value ) ; }
Internal callback that is used in conjunction with php's array_reduce to flatten recursive chain results.

@param array $flattened The current flat array.
@param MonadInterface $result The result to be reduced into the flat array.

@return array A new flat array created from merging in the flattened result.
Internal callback that is used in conjunction with php s array_reduce to flatten recursive chain results .