Code Duplication    Length = 33-36 lines in 4 locations

lib/Payone/Api/Mapper/Response/3dsCheck.php 1 location

@@ 33-65 (lines=33) @@
30
 * @license         <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
 * @link            http://www.noovias.com
32
 */
33
class Payone_Api_Mapper_Response_3dsCheck
34
    extends Payone_Api_Mapper_Response_Abstract
35
    implements Payone_Api_Mapper_Response_Interface
36
{
37
    /**
38
     * @param array $params
39
     * @return Payone_Api_Response_3dsCheck_Enrolled|Payone_Api_Response_3dsCheck_Invalid|Payone_Api_Response_3dsCheck_Valid|Payone_Api_Response_Error
40
     * @throws Payone_Api_Exception_UnknownStatus
41
     */
42
    public function map(array $params)
43
    {
44
        $this->setParams($params);
45
46
        if ($this->isValid()) {
47
            $response = new Payone_Api_Response_3dsCheck_Valid($params);
48
        }
49
        elseif ($this->isEnrolled()) {
50
            $response = new Payone_Api_Response_3dsCheck_Enrolled($params);
51
        }
52
        elseif ($this->isInvalid()) {
53
            $response = new Payone_Api_Response_3dsCheck_Invalid($params);
54
        }
55
        elseif ($this->isError()) {
56
            $response = new Payone_Api_Response_Error($params);
57
        }
58
        else {
59
            throw new Payone_Api_Exception_UnknownStatus();
60
        }
61
62
        return $response;
63
    }
64
65
}

lib/Payone/Api/Mapper/Response/BankAccountCheck.php 1 location

@@ 33-66 (lines=34) @@
30
 * @license         <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
 * @link            http://www.noovias.com
32
 */
33
class Payone_Api_Mapper_Response_BankAccountCheck
34
    extends Payone_Api_Mapper_Response_Abstract
35
    implements Payone_Api_Mapper_Response_Interface
36
{
37
    /**
38
     * @param array $params
39
     *
40
     * @return Payone_Api_Response_BankAccountCheck_Blocked|Payone_Api_Response_BankAccountCheck_Invalid|Payone_Api_Response_BankAccountCheck_Valid|Payone_Api_Response_Error
41
     * @throws Payone_Api_Exception_UnknownStatus
42
     */
43
    public function map(array $params)
44
    {
45
        $this->setParams($params);
46
47
        if ($this->isValid()) {
48
            $response = new Payone_Api_Response_BankAccountCheck_Valid($params);
49
        }
50
        elseif ($this->isInvalid()) {
51
            $response = new Payone_Api_Response_BankAccountCheck_Invalid($params);
52
        }
53
        elseif ($this->isBlocked()) {
54
            $response = new Payone_Api_Response_BankAccountCheck_Blocked($params);
55
        }
56
        elseif ($this->isError()) {
57
            $response = new Payone_Api_Response_Error($params);
58
        }
59
        else {
60
            throw new Payone_Api_Exception_UnknownStatus();
61
        }
62
63
        return $response;
64
    }
65
66
}

lib/Payone/Api/Mapper/Response/Genericpayment.php 1 location

@@ 21-56 (lines=36) @@
18
 * @author          Ronny Schröder
19
 * @license         <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
20
 */
21
class Payone_Api_Mapper_Response_Genericpayment
22
    extends Payone_Api_Mapper_Response_Abstract
23
    implements Payone_Api_Mapper_Response_Interface
24
{
25
    /**
26
     * @param array $params
27
     *
28
     * @return Payone_Api_Response_Authorization_Approved|Payone_Api_Response_Authorization_Redirect|Payone_Api_Response_Error
29
     * @throws Payone_Api_Exception_UnknownStatus
30
     */
31
    public function map(array $params)
32
    {
33
        $this->setParams($params);
34
35
        if ($this->isApproved()) {
36
            $response = new Payone_Api_Response_Genericpayment_Approved($params);
37
        }
38
        elseif ($this->isOk()) {
39
            $response = new Payone_Api_Response_Genericpayment_Ok($params);
40
        }
41
        elseif ($this->isRedirect()) {
42
            $response = new Payone_Api_Response_Genericpayment_Redirect($params);
43
        }
44
        elseif ($this->isError()) {
45
            $response = new Payone_Api_Response_Error($params);
46
        }
47
        else {
48
            throw new Payone_Api_Exception_UnknownStatus();
49
        }
50
        
51
        $response->setRawResponse($params);
52
53
        return $response;
54
    }
55
56
}
57

lib/Payone/Api/Mapper/Response/Preauthorization.php 1 location

@@ 33-66 (lines=34) @@
30
 * @license         <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
 * @link            http://www.noovias.com
32
 */
33
class Payone_Api_Mapper_Response_Preauthorization
34
    extends Payone_Api_Mapper_Response_Abstract
35
    implements Payone_Api_Mapper_Response_Interface
36
{
37
    /**
38
     * @param array $params
39
     *
40
     * @return Payone_Api_Response_Error|Payone_Api_Response_Preauthorization_Approved|Payone_Api_Response_Preauthorization_Redirect
41
     * @throws Payone_Api_Exception_UnknownStatus
42
     */
43
    public function map(array $params)
44
    {
45
        $this->setParams($params);
46
47
        if ($this->isApproved()) {
48
            $response = new Payone_Api_Response_Preauthorization_Approved($params);
49
        }
50
        elseif ($this->isRedirect()) {
51
            $response = new Payone_Api_Response_Preauthorization_Redirect($params);
52
        }
53
        elseif ($this->isPending()) {
54
            $response = new Payone_Api_Response_Preauthorization_Pending($params);
55
        }
56
        elseif ($this->isError()) {
57
            $response = new Payone_Api_Response_Error($params);
58
        }
59
        else {
60
            throw new Payone_Api_Exception_UnknownStatus();
61
        }
62
63
        return $response;
64
    }
65
66
}
67