Plugin   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A info() 0 6 1
A search() 0 4 1
1
<?php
2
3
namespace Darkgoldblade01\Wordpress\Api;
4
5
use Darkgoldblade01\Wordpress\Models\Plugin as PluginModel;
6
use Darkgoldblade01\Wordpress\WordpressApi;
7
8
class Plugin extends WordpressApi
9
{
10
    protected $base_uri = 'https://api.wordpress.org/plugins/';
11
12
    /**
13
     * Info.
14
     *
15
     * Returns the information for the plugin.
16
     *
17
     * @param string $slug  The slug of the plugin you want to pull
18
     * @return mixed
19
     * @throws \GuzzleHttp\Exception\GuzzleException
20
     */
21 2
    public function info(string $slug): PluginModel
22
    {
23 2
        $info = $this->get('info/1.2/?action=plugin_information&request[slug]='.$slug);
24
25 2
        return (new PluginModel())->fill($info);
26
    }
27
28
    /**
29
     * Info.
30
     *
31
     * Returns the information for the plugin.
32
     *
33
     * @param string $search
34
     * @return mixed
35
     * @throws \GuzzleHttp\Exception\GuzzleException
36
     */
37 1
    public function search(string $search)
38
    {
39 1
        return $this->get('info/1.2/?action=query_plugins&request[search]='.$search);
40
    }
41
}
42