Test Setup Failed
Push — master ( 29d7f6...b0c19c )
by Php Easy Api
03:16
created

ClientHttpManager::getMethod()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Resta\Client;
4
5
use Resta\Contracts\ApplicationContracts;
6
use Resta\Foundation\ApplicationProvider;
7
8
class ClientHttpManager extends ApplicationProvider
9
{
10
    /**
11
     * @var string $method
12
     */
13
    protected $method;
14
15
    /**
16
     * RequestHttpManager constructor.
17
     *
18
     * @param ApplicationContracts $app
19
     */
20
    public function __construct(ApplicationContracts $app)
21
    {
22
        parent::__construct($app);
23
24
        $this->method = httpMethod();
25
    }
26
27
    /**
28
     * http data resolve
29
     *
30
     * @return mixed
31
     */
32
    public function resolve()
33
    {
34
        $inputs = $this->app->get($this->method);
35
36
        $content = json_decode($this->app['request']->getContent(),1);
37
38
        if(is_array($inputs) && count($inputs)){
39
            return $inputs;
40
        }
41
42
        return is_array($content) ? $content : [];
43
    }
44
45
    /**
46
     * get http method
47
     *
48
     * @return mixed
49
     */
50
    public function getMethod()
51
    {
52
        return $this->method;
53
    }
54
55
}