Completed
Push — master ( 81e852...7c46f8 )
by Onur
01:16
created

Settlement   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 53
Duplicated Lines 32.08 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 17
loc 53
c 0
b 0
f 0
wmc 3
lcom 1
cbo 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getSettlementList() 9 9 1
A getSettlementDetail() 8 8 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\SettlementInterface;
7
use Onurkacmaz\LaravelN11\Service;
8
use SoapClient;
9
10
class Settlement extends Service implements SettlementInterface
11
{
12
13
    /**
14
     * @var SoapClient|null
15
     */
16
    private $_client;
17
18
    /**
19
     * City constructor
20
     * @throws N11Exception|\SoapFault
21
     */
22
    public function __construct()
23
    {
24
        parent::__construct();
25
        $this->_client = $this->setEndPoint(self::END_POINT);
26
    }
27
28
    /**
29
     * @param string $startDate
30
     * @param int $endDate
31
     * @param int $currentPage
32
     * @param int $pageSize
33
     * @return object
34
     * @description Seçilen tarih aralığına göre ödeme bilgilerini listeleyen servis.
35
     */
36 View Code Duplication
    public function getSettlementList(string $startDate, int $endDate, int $currentPage = 1, int $pageSize = 100): 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...
37
        $this->_parameters["startDate"] = $startDate;
38
        $this->_parameters["endDate"] = $endDate;
39
        $this->_parameters["pagingData"] = [
40
            "currentPage" => $currentPage,
41
            "pageSize" => $pageSize,
42
        ];
43
        return $this->_client->GetSettlementList($this->_parameters);
44
    }
45
46
    /**
47
     * @param string $date
48
     * @param int $currentPage
49
     * @param int $pageSize
50
     * @return object
51
     * @description GetSettlementList metodu ile listelenen ödemelere ait ayrıntıları gösteren metod. Belirli bir gün seçilerek, o güne ait satış/uzlaşma detayları getirilir.
52
     */
53 View Code Duplication
    public function getSettlementDetail(string $date, int $currentPage = 1, int $pageSize = 100): 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...
54
        $this->_parameters["date"] = $date;
55
        $this->_parameters["pagingData"] = [
56
            "currentPage" => $currentPage,
57
            "pageSize" => $pageSize,
58
        ];
59
        return $this->_client->GetSettlementDetail($this->_parameters);
60
    }
61
62
}
63