Completed
Pull Request — master (#168)
by Sergey
03:10
created

News   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 27.27 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A last() 0 4 1
A all() 9 9 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 seregazhuk\PinterestBot\Api\Providers;
4
5
use seregazhuk\PinterestBot\Helpers\UrlBuilder;
6
7
class News extends Provider
8
{
9
    /**
10
     * @var array
11
     */
12
    protected $loginRequiredFor = ['last', 'all'];
13
14
    /**
15
     * Get user's latest news array.
16
     * @deprecated 4.11.0
17
     *
18
     * @param $limit
19
     * @return mixed
20
     */
21
    public function last($limit = 0)
22
    {
23
        return $this->all($limit);
24
    }
25
26
    /**
27
     * @param int $limit
28
     * @return mixed
29
     */
30 View Code Duplication
    public function all($limit = 0)
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...
31
    {
32
        $params = [
33
            'data' => ['allow_stale' => true],
34
            'url'  => UrlBuilder::RESOURCE_GET_LATEST_NEWS
35
        ];
36
37
        return $this->getPaginatedResponse($params, $limit);
38
    }
39
}
40