Completed
Push — master ( cc9e5c...67ffd6 )
by Sergey
13:28 queued 10:12
created

CanBeDeleted::getDeleteUrl()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 2
eloc 2
nc 2
nop 0
1
<?php
2
3
namespace seregazhuk\PinterestBot\Helpers\Providers\Traits;
4
5
trait CanBeDeleted
6
{
7
    use HandlesRequestAndResponse, HasEntityIdName;
8
9
    /**
10
     * Delete entity by ID.
11
     *
12
     * @param int $entityId
13
     *
14
     * @return bool
15
     */
16
    public function delete($entityId)
17
    {
18
        return $this->execPostRequest([$this->getEntityIdName() => $entityId], $this->getDeleteUrl());
19
    }
20
21
    protected function getDeleteUrl()
22
    {
23
        return property_exists($this, 'deleteUrl') ? $this->deleteUrl : '';
0 ignored issues
show
Bug introduced by
The property deleteUrl does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
24
    }
25
}