/** * Add a reduce phase to the map/reduce operation * * @param mixed $function - Either a named Javascript function (ie: * "Riak.mapValues"), or an anonymous javascript function (ie: * "function(...) { ... }" or an array ["erlang_module", * "function"]. * @param array() $options - An optional associative array * containing "language", "keep" flag, and/or "arg". * @return $this */ public function reduce($function, $options = array()) { $language = is_array($function) ? "erlang" : "javascript"; $this->phases[] = new MapReducePhase("reduce", $function, Utils::get_value("language", $options, $language), Utils::get_value("keep", $options, false), Utils::get_value("arg", $options, null)); return $this; }