DeleteTrait   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 40
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
endpoint() 0 1 ?
api() 0 1 ?
A delete() 0 4 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Matthew
5
 * Date: 21/04/2016
6
 * Time: 9:10 AM
7
 */
8
9
namespace Freshdesk\Resources\Traits;
10
11
/**
12
 * Delete Trait
13
 *
14
 * @package Freshdesk\Resources\Traits
15
 */
16
trait DeleteTrait
17
{
18
19
    /**
20
     * @param null $end string
21
     * @return string
22
     * @internal
23
     */
24
    abstract protected function endpoint($end = null);
25
26
    /**
27
     * @return \Freshdesk\Api
28
     * @internal
29
     */
30
    abstract protected function api();
31
32
    /**
33
     * Delete a resource
34
     *
35
     * Delete a resource by $id
36
     *
37
     * @api
38
     * @param in $id The resource id
39
     * @return array|null
40
     * @throws \Freshdesk\Exceptions\AccessDeniedException
41
     * @throws \Freshdesk\Exceptions\ApiException
42
     * @throws \Freshdesk\Exceptions\AuthenticationException
43
     * @throws \Freshdesk\Exceptions\ConflictingStateException
44
     * @throws \Freshdesk\Exceptions\NotFoundException
45
     * @throws \Freshdesk\Exceptions\RateLimitExceededException
46
     * @throws \Freshdesk\Exceptions\UnsupportedContentTypeException
47
     * @throws \Freshdesk\Exceptions\MethodNotAllowedException
48
     * @throws \Freshdesk\Exceptions\UnsupportedAcceptHeaderException
49
     * @throws \Freshdesk\Exceptions\ValidationException
50
     */
51
    public function delete($id)
52
    {
53
        return $this->api()->request('DELETE', $this->endpoint($id));
54
    }
55
}
56