@@ -55,8 +55,9 @@ discard block |
||
| 55 | 55 | $this->monolog->pushHandler(new CouchHandler($this)); |
| 56 | 56 | |
| 57 | 57 | // If a log file is provided, creates a stream handler to log debugging messages. |
| 58 | - if (!empty($fileName)) |
|
| 59 | - $this->monolog->pushHandler(new StreamHandler($fileName, Logger::DEBUG)); |
|
| 58 | + if (!empty($fileName)) { |
|
| 59 | + $this->monolog->pushHandler(new StreamHandler($fileName, Logger::DEBUG)); |
|
| 60 | + } |
|
| 60 | 61 | |
| 61 | 62 | // Get all available commands. |
| 62 | 63 | $this->loadCommands(); |
@@ -109,13 +110,11 @@ discard block |
||
| 109 | 110 | $class = $this->commands[$cmd]; |
| 110 | 111 | $cmdObj = new $class($this, $args); |
| 111 | 112 | $cmdObj->execute(); |
| 112 | - } |
|
| 113 | - catch (\Exception $e) { |
|
| 113 | + } catch (\Exception $e) { |
|
| 114 | 114 | $this->monolog->addCritical($e->getMessage()); |
| 115 | 115 | exit(Server::EXIT_FAILURE); |
| 116 | 116 | } |
| 117 | - } |
|
| 118 | - else { |
|
| 117 | + } else { |
|
| 119 | 118 | $this->monolog->addCritical(sprintf("'%s' command is not supported.", $cmd)); |
| 120 | 119 | exit(Server::EXIT_FAILURE); |
| 121 | 120 | } |
@@ -187,10 +186,11 @@ discard block |
||
| 187 | 186 | |
| 188 | 187 | eval("\$closure = ".$fn); |
| 189 | 188 | |
| 190 | - if (is_callable($closure)) |
|
| 191 | - $reductions[] = call_user_func($closure, $keys, $values, $rereduce); |
|
| 192 | - else |
|
| 193 | - throw new \BadFunctionCallException("The reduce function is not callable."); |
|
| 189 | + if (is_callable($closure)) { |
|
| 190 | + $reductions[] = call_user_func($closure, $keys, $values, $rereduce); |
|
| 191 | + } else { |
|
| 192 | + throw new \BadFunctionCallException("The reduce function is not callable."); |
|
| 193 | + } |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | // Sends mappings to CouchDB. |
@@ -78,9 +78,9 @@ |
||
| 78 | 78 | if (is_callable($closure)) { |
| 79 | 79 | call_user_func($closure, $doc); |
| 80 | 80 | $result[] = $map; |
| 81 | + } else { |
|
| 82 | + throw new \BadFunctionCallException("The map function is not callable."); |
|
| 81 | 83 | } |
| 82 | - else |
|
| 83 | - throw new \BadFunctionCallException("The map function is not callable."); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | // Sends mappings to CouchDB. |