Base::delete()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace MacsiDigital\Xero\Interfaces;
4
5
use Exception;
6
use MacsiDigital\Xero\Support\Response;
7
8
abstract class Base
9
{
10
    protected $request;
11
12
    public function get($end_point)
13
    {
14
        try {
15
            return new Response($this->request->get($end_point));
16
        } catch (Exception $e) {
17
            return new Response($e->getResponse());
18
        }
19
    }
20
21 View Code Duplication
    public function post($end_point, $fields)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
22
    {
23
        try {
24
            return new Response($this->request->post($end_point, $fields));
25
        } catch (Exception $e) {
26
            return new Response($e->getResponse());
27
        }
28
    }
29
30 View Code Duplication
    public function put($end_point, $fields)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
31
    {
32
        try {
33
            return new Response($this->request->put($end_point, $fields));
34
        } catch (Exception $e) {
35
            return new Response($e->getResponse());
36
        }
37
    }
38
39
    public function delete($end_point)
40
    {
41
        return new Response($this->request->delete($end_point));
42
    }
43
}
44