ResetCmd   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 3
dl 0
loc 20
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 3 1
A execute() 0 10 1
1
<?php
2
3
/**
4
 * @file ResetCmd.php
5
 * @brief This file contains the ResetCmd class.
6
 * @details
7
 * @author Filippo F. Fadda
8
 */
9
10
11
namespace EoC\Command;
12
13
14
/**
15
 * @brief Resets the internal state of the server and makes it forget all previous input.
16
 * @details The argument provided by CouchDB has the following structure:
17
 @code
18
   Array
19
   (
20
       [0] => Array
21
       (
22
           [reduce_limit] => 1
23
           [timeout] => 5000
24
       )
25
   )
26
 @endcode
27
 */
28
final class ResetCmd extends AbstractCmd {
29
  use CmdTrait;
30
31
32
  public static function getName() {
33
    return "reset";
34
  }
35
36
37
  public function execute() {
38
    $args = reset($this->args);
39
40
    $this->server->setReduceLimit($args['reduce_limit']); // Not used.
41
    $this->server->setTimeout($args['timeout']); // Not used.
42
43
    $this->server->resetFuncs();
44
45
    $this->server->writeln("true");
46
  }
47
}