Stats   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 72
ccs 0
cts 10
cp 0
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A wordpress() 0 4 1
A php() 0 4 1
A mysql() 0 4 1
A plugin() 0 4 1
A plugin_downloads() 0 4 1
1
<?php
2
3
namespace Darkgoldblade01\Wordpress\Api;
4
5
use Darkgoldblade01\Wordpress\WordpressApi;
6
7
class Stats extends WordpressApi
8
{
9
    protected $base_uri = 'https://api.wordpress.org/stats/';
10
11
    /**
12
     * Wordpress.
13
     *
14
     * Returns the stats for Wordpress.
15
     *
16
     * @return mixed
17
     * @throws \GuzzleHttp\Exception\GuzzleException
18
     */
19
    public function wordpress()
20
    {
21
        return $this->get('wordpress/1.0');
22
    }
23
24
    /**
25
     * PHP.
26
     *
27
     * Returns the stats for PHP.
28
     *
29
     * @return mixed
30
     * @throws \GuzzleHttp\Exception\GuzzleException
31
     */
32
    public function php()
33
    {
34
        return $this->get('php/1.0');
35
    }
36
37
    /**
38
     * MySQL.
39
     *
40
     * Returns the stats for MySQL.
41
     *
42
     * @return mixed
43
     * @throws \GuzzleHttp\Exception\GuzzleException
44
     */
45
    public function mysql()
46
    {
47
        return $this->get('mysql/1.0');
48
    }
49
50
    /**
51
     * Plugin.
52
     *
53
     * Returns the stats for a Plugin.
54
     *
55
     * @param $slug     string  The slug of the Plugin
56
     * @return mixed
57
     * @throws \GuzzleHttp\Exception\GuzzleException
58
     */
59
    public function plugin(string $slug)
60
    {
61
        return $this->get('plugin/1.0/'.$slug);
62
    }
63
64
    /**
65
     * Downloads.
66
     *
67
     * Returns the download stats for a Plugin.
68
     *
69
     * @param $slug     string  The slug of the Plugin
70
     * @param $days     int     The number of days you want
71
     * @return mixed
72
     * @throws \GuzzleHttp\Exception\GuzzleException
73
     */
74
    public function plugin_downloads(string $slug, int $days)
75
    {
76
        return $this->get('plugin/1.0/downloads.php?slug='.$slug.'&limit='.$days);
77
    }
78
}
79