Completed
Push — master ( 7c46f8...aaf38f )
by Onur
59s
created

Ticket   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 92
Duplicated Lines 27.17 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 25
loc 92
c 0
b 0
f 0
wmc 7
lcom 1
cbo 1
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A ticketListingAssignedToSeller() 6 6 1
A ticketListingBelongsToSeller() 6 6 1
A ticketAnswer() 6 6 1
A create() 7 7 1
A ticketReasons() 0 3 1
A markAsRead() 0 5 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 Onurkacmaz\LaravelN11\Models;
4
5
use Onurkacmaz\LaravelN11\Exceptions\N11Exception;
6
use Onurkacmaz\LaravelN11\Interfaces\TicketInterface;
7
use Onurkacmaz\LaravelN11\Service;
8
use SoapClient;
9
10
class Ticket extends Service implements TicketInterface
11
{
12
13
    /**
14
     * @var SoapClient|null
15
     */
16
    private $_client;
17
18
    /**
19
     * Category constructor
20
     * endPoint set edildi.
21
     * @throws N11Exception|\SoapFault
22
     */
23
    public function __construct()
24
    {
25
        parent::__construct();
26
        $this->_client = $this->setEndPoint(self::END_POINT);
27
    }
28
29
    /**
30
     * @param int $sellerId
31
     * @param int $startValue
32
     * @param int $pageSize
33
     * @return object
34
     */
35 View Code Duplication
    public function ticketListingAssignedToSeller(int $sellerId, int $startValue = 1, int $pageSize = 1): object {
0 ignored issues
show
Duplication introduced by
This method 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...
36
        $this->_parameters["sellerId"] = $sellerId;
37
        $this->_parameters["first"] = $startValue;
38
        $this->_parameters["pageSize"] = $pageSize;
39
        return $this->_client->TicketListingAssignedToSeller($this->_parameters);
40
    }
41
42
    /**
43
     * @param int $sellerId
44
     * @param int $startValue
45
     * @param int $pageSize
46
     * @return object
47
     */
48 View Code Duplication
    public function ticketListingBelongsToSeller(int $sellerId, int $startValue = 1, int $pageSize = 1): object {
0 ignored issues
show
Duplication introduced by
This method 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...
49
        $this->_parameters["sellerId"] = $sellerId;
50
        $this->_parameters["first"] = $startValue;
51
        $this->_parameters["pageSize"] = $pageSize;
52
        return $this->_client->TicketListingBelongsToSeller($this->_parameters);
53
    }
54
55
    /**
56
     * @param int $sellerId
57
     * @param int $ticketId
58
     * @param string $content
59
     * @return object
60
     */
61 View Code Duplication
    public function ticketAnswer(int $sellerId, int $ticketId, string $content): object {
0 ignored issues
show
Duplication introduced by
This method 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...
62
        $this->_parameters["sellerId"] = $sellerId;
63
        $this->_parameters["ticketId"] = $ticketId;
64
        $this->_parameters["content"] = $content;
65
        return $this->_client->TicketAnswer($this->_parameters);
66
    }
67
68
    /**
69
     * @param int $reasonId
70
     * @param int $sellerId
71
     * @param string $header
72
     * @param string $content
73
     * @return object
74
     */
75 View Code Duplication
    public function create(int $reasonId, int $sellerId, string $header, string $content): object {
0 ignored issues
show
Duplication introduced by
This method 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...
76
        $this->_parameters["reasonId"] = $reasonId;
77
        $this->_parameters["sellerId"] = $sellerId;
78
        $this->_parameters["header"] = $header;
79
        $this->_parameters["content"] = $content;
80
        return $this->_client->TicketCreate($this->_parameters);
81
    }
82
83
    /**
84
     * @return object
85
     */
86
    public function ticketReasons(): object {
87
        return $this->_client->TicketReasons($this->_parameters);
88
    }
89
90
    /**
91
     * @param int $ticketId
92
     * @param int $sellerId
93
     * @return object
94
     */
95
    public function markAsRead(int $ticketId, int $sellerId): object {
96
        $this->_parameters["ticketId"] = $ticketId;
97
        $this->_parameters["sellerId"] = $sellerId;
98
        return $this->_client->TicketRead($this->_parameters);
99
    }
100
101
}
102