### GreaterThan   A last analyzed 2019-01-07 13:41 UTC

#### Complexity

 Total Complexity 5

#### Size/Duplication

 Total Lines 72 Duplicated Lines 100 %

#### Coupling/Cohesion

 Components 1 Dependencies 0

#### Test Coverage

 Coverage 100%

#### Importance

 Changes 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 72
loc 72
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0

#### 4 Methods

Rating   Name   Duplication   Size   Complexity
A __construct() 4 4 1
A validate() 4 4 1
A notGreaterThan() 8 8 2
A getMessageParameters() 6 6 1

#### Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

 1 ` '{{ name }} must be greater than {{ min }}',` 32 ` ];` 33 34 ` /**` 35 ` * The lower boundary.` 36 ` *` 37 ` * @var int` 38 ` */` 39 ` protected \$min;` 40 41 ` /**` 42 ` * Construct the GreaterThan rule.` 43 ` *` 44 ` * @param int \$min` 45 ` */` 46 3 ` public function __construct(\$min)` 47 ` {` 48 3 ` \$this->min = \$min;` 49 3 ` }` 50 51 ` /**` 52 ` * Checks whether or not \$value is greater than the min for this rule.` 53 ` *` 54 ` * @param mixed \$value` 55 ` * @return bool` 56 ` */` 57 5 ` public function validate(\$value)` 58 ` {` 59 5 ` return !\$this->notGreaterThan(\$value, self::NOT_GREATER_THAN);` 60 ` }` 61 62 ` /**` 63 ` * Returns whether or not the value is greater than the min, and logs an error if it isn't.` 64 ` *` 65 ` * @param mixed \$value` 66 ` * @param string \$error` 67 ` * @return bool` 68 ` */` 69 5 ` protected function notGreaterThan(\$value, \$error)` 70 ` {` 71 5 ` if (\$value <= \$this->min) {` 72 4 ` \$this->error(\$error);` 73 4 ` return true;` 74 ` }` 75 1 ` return false;` 76 ` }` 77 78 ` /**` 79 ` * Returns the parameters that may be used in a validation message.` 80 ` *` 81 ` * @return array` 82 ` */` 83 4 ` protected function getMessageParameters()` 84 ` {` 85 4 ` return array_merge(parent::getMessageParameters(), [` 86 4 ` 'min' => \$this->min,` 87 4 ` ]);` 88 ` }` 89 `}` 90