Passed
Push — main ( 058061...63bb54 )
by Andrey
03:30
created

DiscoverInfo::getDiscoverApi()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 19
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 11
c 0
b 0
f 0
dl 0
loc 19
rs 9.9
cc 1
nc 1
nop 5
1
<?php
2
3
namespace Daaner\TikTok\Models;
4
5
use Daaner\TikTok\TikTok;
6
7
class DiscoverInfo extends TikTok
8
{
9
    protected $url;
10
    protected $url_api;
11
12
    /**
13
     * @return $this
14
     */
15
    public function ModelSettings()
16
    {
17
        $this->url = config('tiktok.discover_info.link');
18
        $this->url_api = config('tiktok.discover_info.link_api');
19
    }
20
21
    /**
22
     * @return array
23
     */
24
    public function getDiscover()
25
    {
26
        //add settings
27
        $this->ModelSettings();
28
29
        $response = $this->getResponse($this->url);
30
31
        return $response;
32
    }
33
34
    /**
35
     * @param string $type
36
     * @param int|null $count
37
     * @param int|null $offset
38
     * @param boolean $needItemList
39
     * @param boolean useRecommend
0 ignored issues
show
Bug introduced by
The type Daaner\TikTok\Models\useRecommend was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
40
     *
41
     * $discoverType only 0
42
     * $keyWord not used
43
     *
44
     * @return array
45
     */
46
    public function getDiscoverApi($type, $count = 20, $offset = 0, $needItemList = true, $useRecommend = false)
47
    {
48
        //add settings
49
        $this->ModelSettings();
50
51
        $body = [
52
            'offset' => $offset,
53
            'count' => $count,
54
            'needItemList' => $needItemList,
55
            'useRecommend' => $useRecommend,
56
            'keyWord' => '',
57
            'discoverType' => 0,
58
        ];
59
60
        $body = array_merge($body, config('tiktok.primary_body_api'));
61
62
        $response = $this->getResponse($this->url_api . $type, $body);
63
64
        return $response;
65
    }
66
}
67