Completed
Push — master ( caad37...82c5ce )
by Dmitriy
06:13
created

SearchClient   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 47
Duplicated Lines 95.74 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 1 Features 1
Metric Value
wmc 2
c 2
b 1
f 1
lcom 1
cbo 3
dl 45
loc 47
ccs 12
cts 12
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 10 10 1
A getFilterCategory() 9 10 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
 * Yandex PHP Library
4
 *
5
 * @copyright NIX Solutions Ltd.
6
 * @link      https://github.com/nixsolutions/yandex-php-library
7
 */
8
9
/**
10
 * @namespace
11
 */
12
namespace Yandex\Market\Content\Clients;
13
14
use Yandex\Market\Content\ContentClient;
15
use Yandex\Market\Content\Models;
16
17
/**
18
 * Class SearchClient
19
 *
20
 * @category Yandex
21
 * @package  MarketContent
22
 *
23
 * @author  Oleg Scherbakov <[email protected]>
24
 * @created 09.01.16 15:03
25
 */
26 View Code Duplication
class SearchClient extends ContentClient
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...
27
{
28
    /**
29
     * Get models & offers search result
30
     *
31
     * Returns models and offers of Yandex.Market service search result according to params.
32
     *
33
     * @see https://tech.yandex.ru/market/content-data/doc/dg/reference/search-docpage/
34
     *
35
     * @param array $params
36
     *
37
     * @return Models\ResponseSearchGet
38
     */
39 1
    public function get($params = array())
40
    {
41 1
        $resource = 'search.json';
42 1
        $resource .= '?' . $this->buildQueryString($params);
43 1
        $response = $this->getServiceResponse($resource);
44
45 1
        $getSearchResponse = new Models\ResponseSearchGet($response);
46
47 1
        return $getSearchResponse;
48
    }
49
50
    /**
51
     * Get models & offers search by filters result
52
     *
53
     * Returns models and offers of Yandex.Market service search by filters result according to params.
54
     *
55
     * @see https://tech.yandex.ru/market/content-data/doc/dg/reference/filter-id-docpage/
56
     *
57
     * @param int   $categoryId
58
     * @param array $params
59
     *
60
     * @return Models\ResponseFilterCategoryGet
61
     */
62 1
    public function getFilterCategory($categoryId, $params = array())
63
    {
64 1
        $resource = 'filter/' . $categoryId. '.json';
65 1
        $resource .= '?' . $this->buildQueryString($params);
66 1
        $response = $this->getServiceResponse($resource);
67
68 1
        $getFilterCategoryResponse = new Models\ResponseFilterCategoryGet($response);
69
70 1
        return $getFilterCategoryResponse;
71
    }
72
}
73