Completed
Push — master ( f011eb...9572b6 )
by Sergey
03:28
created

Widgets::delete()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 12
rs 9.4285
cc 2
eloc 8
nc 2
nop 2
1
<?php
2
3
namespace seregazhuk\Favro\Api\Endpoints;
4
5
use seregazhuk\Favro\Api\Endpoints\Traits\CrudEndpoint;
6
use seregazhuk\Favro\Api\Endpoints\Traits\BelongsToOrganization;
7
8
class Widgets extends Endpoint
9
{
10
11
    use BelongsToOrganization, CrudEndpoint;
12
13
    /**
14
     * @var string
15
     */
16
    protected $endpoint = 'widgets';
17
18
    /**
19
     * @param string $itemId
20
     * @param string|null $collectionId
21
     * @return mixed
22
     */
23
    public function delete($itemId, $collectionId = null)
24
    {
25
        $attributes = $collectionId ? ['collectionId' => $collectionId] : [];
26
27
        return $this
28
            ->getHttp()
29
            ->delete(
30
                $this->makeRequestUrl($itemId),
31
                $attributes,
32
                $this->getHeaders()
33
            );
34
    }
35
}