Completed
Push — master ( d31412...ff3c6b )
by Sergey
05:01 queued 01:33
created

CanBeDeleted   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 21
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A delete() 0 4 1
A getDeleteUrl() 0 4 2
1
<?php
2
3
namespace seregazhuk\PinterestBot\Api\Traits;
4
5
/**
6
 * Class CanBeDeleted
7
 * @package seregazhuk\PinterestBot\Api\Traits
8
 *
9
 * @property string $deleteUrl
10
 */
11
trait CanBeDeleted
12
{
13
    use HandlesRequestAndResponse, HasEntityIdName;
14
15
    /**
16
     * Delete entity by ID.
17
     *
18
     * @param int $entityId
19
     *
20
     * @return bool
21
     */
22
    public function delete($entityId)
23
    {
24
        return $this->execPostRequest([$this->getEntityIdName() => $entityId], $this->getDeleteUrl());
25
    }
26
27
    protected function getDeleteUrl()
28
    {
29
        return property_exists($this, 'deleteUrl') ? $this->deleteUrl : '';
30
    }
31
}