Payone_Api_Mapper_Response_GetFile   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 32
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 9
lcom 1
cbo 4
dl 32
loc 32
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B map() 20 20 9

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
 *
4
 * NOTICE OF LICENSE
5
 *
6
 * This source file is subject to the GNU General Public License (GPL 3)
7
 * that is bundled with this package in the file LICENSE.txt
8
 *
9
 * DISCLAIMER
10
 *
11
 * Do not edit or add to this file if you wish to upgrade Payone to newer
12
 * versions in the future. If you wish to customize Payone for your
13
 * needs please refer to http://www.payone.de for more information.
14
 *
15
 * @category        Payone
16
 * @package         Payone_Api
17
 * @subpackage      Mapper
18
 * @copyright       Copyright (c) 2012 <[email protected]> - www.noovias.com
19
 * @author          Matthias Walter <[email protected]>
20
 * @license         <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
21
 * @link            http://www.noovias.com
22
 */
23
24
/**
25
 *
26
 * @category        Payone
27
 * @package         Payone_Api
28
 * @subpackage      Mapper
29
 * @copyright       Copyright (c) 2012 <[email protected]> - www.noovias.com
30
 * @license         <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
 * @link            http://www.noovias.com
32
 */
33 View Code Duplication
class Payone_Api_Mapper_Response_GetFile
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
34
    extends Payone_Api_Mapper_Response_Abstract
35
    implements Payone_Api_Mapper_Response_Interface
36
{
37
38
    /**
39
     * @param array $params
40
     *
41
     * @return Payone_Api_Response_Management_GetFile|Payone_Api_Response_Error
42
     * @throws Payone_Api_Exception_UnknownStatus
43
     */
44
    public function map(array $params)
45
    {
46
        $this->setParams($params);
47
48
        if ($this->isError()) {
49
            $response = new Payone_Api_Response_Error($params);
50
        }
51
        elseif (empty($params) || $this->isApproved() || $this->isBlocked() || $this->isEnrolled() ||
52
            $this->isInvalid() || $this->isRedirect() || $this->isValid()
53
        ) {
54
            throw new Payone_Api_Exception_UnknownStatus();
55
        }
56
        else {
57
            $params = array('response' => $params);
58
            $response = new Payone_Api_Response_Management_GetFile($params);
59
            $response->setStatus(Payone_Api_Enum_ResponseType::VALID);
60
        }
61
62
        return $response;
63
    }
64
}
65