POST   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 19
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 1
dl 19
loc 19
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getFormAttributes() 4 4 1
A getValue() 4 4 2
A hasValue() 4 4 1

How to fix   Duplicated Code   

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
<?php
2
3
namespace fieldwork\methods;
4
5 View Code Duplication
class POST extends Method
6
{
7
8
    public function getFormAttributes ()
9
    {
10
        return array('method' => 'POST');
11
    }
12
13
    public function getValue ($key, $default)
14
    {
15
        return isset($_POST[$key]) ? $_POST[$key] : $default;
16
    }
17
18
    public function hasValue ($key)
19
    {
20
        return isset($_POST[$key]);
21
    }
22
23
}