Issues (33)

src/Page/Client.php (2 issues)

Severity
1
<?php
2
3
namespace Freyo\MtaH5\Page;
4
5
use Freyo\MtaH5\Kernel\BaseClient;
6
7
class Client extends BaseClient
8
{
9
    /**
10
     * 查询当天所有url的pv\uv\vv\iv数据.
11
     *
12
     * @see https://mta.qq.com/docs/h5_api.html#%E9%A1%B5%E9%9D%A2%E6%8E%92%E8%A1%8C-%E5%BD%93%E5%A4%A9%E5%AE%9E%E6%97%B6%E5%88%97%E8%A1%A8
13
     *
14
     * @throws \Freyo\MtaH5\Kernel\Exceptions\InvalidConfigException
15
     *
16
     * @return array|\Freyo\MtaH5\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
17
     */
18
    public function realtime()
19
    {
20
        $params = [
21
            'idx' => 'pv,uv,vv,iv',
22
        ];
23
24
        return $this->httpGet('ctr_page/list_all_page_realtime', $params);
25
    }
26
27
    /**
28
     * 按天查询所有url的pv\uv\vv\iv数据.
29
     *
30
     * @see https://mta.qq.com/docs/h5_api.html#%E9%A1%B5%E9%9D%A2%E6%8E%92%E8%A1%8C-%E7%A6%BB%E7%BA%BF%E5%88%97%E8%A1%A8
31
     *
32
     * @param string $startDate 开始时间(Y-m-d)
33
     * @param string $endDate   结束时间(Y-m-d)
34
     * @param int    $page      每页2000条
35
     *
36
     * @throws \Freyo\MtaH5\Kernel\Exceptions\InvalidConfigException
37
     *
38
     * @return array|\Freyo\MtaH5\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
39
     */
40
    public function offline($startDate, $endDate, $page = 1)
41
    {
42
        $params = [
43
            'start_date' => $startDate,
44
            'end_date'   => $endDate,
45
            'page'       => $page,
46
            'idx'        => 'pv,uv,vv,iv',
47
        ];
48
49
        return $this->httpGet('ctr_page/list_all_page_offline', $params);
50
    }
51
52
    /**
53
     * 按天查询url的pv\uv\vv\iv数据.
54
     *
55
     * @see https://mta.qq.com/docs/h5_api.html#%E9%A1%B5%E9%9D%A2%E6%8E%92%E8%A1%8C-%E6%8C%87%E5%AE%9A%E6%9F%A5%E8%AF%A2%E9%83%A8%E5%88%86url
56
     *
57
     * @param string       $startDate 开始时间(Y-m-d)
58
     * @param string       $endDate   结束时间(Y-m-d)
59
     * @param array|string $urls      url地址
60
     *
61
     * @throws \Freyo\MtaH5\Kernel\Exceptions\InvalidConfigException
62
     *
63
     * @return array|\Freyo\MtaH5\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
64
     */
65
    public function query($startDate, $endDate, $urls)
66
    {
67
        $params = [
68
            'start_date' => $startDate,
69
            'end_date'   => $endDate,
70
            'urls'       => implode((array) $urls, ','),
0 ignored issues
show
The call to implode() has too many arguments starting with ','. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

70
            'urls'       => /** @scrutinizer ignore-call */ implode((array) $urls, ','),

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
71
            'idx'        => 'pv,uv,vv,iv',
72
        ];
73
74
        return $this->httpGet('ctr_page', $params);
75
    }
76
77
    /**
78
     * 按天查询用户访问深度.
79
     *
80
     * @see https://mta.qq.com/docs/h5_api.html#%E8%AE%BF%E9%97%AE%E6%B7%B1%E5%BA%A6
81
     *
82
     * @param string $startDate 开始时间(Y-m-d)
83
     * @param string $endDate   结束时间(Y-m-d)
84
     *
85
     * @throws \Freyo\MtaH5\Kernel\Exceptions\InvalidConfigException
86
     *
87
     * @return array|\Freyo\MtaH5\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
88
     */
89
    public function depth($startDate, $endDate)
90
    {
91
        $params = [
92
            'start_date' => $startDate,
93
            'end_date'   => $endDate,
94
        ];
95
96
        return $this->httpGet('ctr_depth', $params);
97
    }
98
99
    /**
100
     * 按天查询对应省市的访问延时与解析时长
101
     *
102
     * @see https://mta.qq.com/docs/h5_api.html#%E6%80%A7%E8%83%BD%E7%9B%91%E6%8E%A7
103
     *
104
     * @param string       $startDate    开始时间(Y-m-d)
105
     * @param string       $endDate      结束时间(Y-m-d)
106
     * @param array|string $typeContents 省市可选值详见附录(省市); 运营商可选值详见附录(运营商)
107
     * @param string       $type         可选值详见附录(性能监控)
108
     *
109
     * @throws \Freyo\MtaH5\Kernel\Exceptions\InvalidConfigException
110
     *
111
     * @return array|\Freyo\MtaH5\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
112
     */
113
    public function speed($startDate, $endDate, $typeContents, $type)
114
    {
115
        $params = [
116
            'start_date'    => $startDate,
117
            'end_date'      => $endDate,
118
            'type_contents' => implode((array) $typeContents, ','),
0 ignored issues
show
The call to implode() has too many arguments starting with ','. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

118
            'type_contents' => /** @scrutinizer ignore-call */ implode((array) $typeContents, ','),

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
119
            'type'          => $type,
120
            'idx'           => 'visitor_speed,dns_speed,tcp_speed,request_speed,resource_speed,dom_speed',
121
        ];
122
123
        return $this->httpGet('ctr_page_speed', $params);
124
    }
125
}
126