Completed
Pull Request — master (#22)
by Sergey
12:53
created

EventableModel::deleting()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 0
1
<?php
2
3
namespace Isswp101\Persimmon\Test\Models;
4
5
class EventableModel extends ElasticsearchModel
6
{
7
    public static $_index = 'test_events';
8
    public static $_type = 'events';
9
10
    public $name;
11
    public $price = 0;
12
13
    protected function saving()
14
    {
15
        $this->price = 100500;
16
    }
17
18
    protected function saved()
19
    {
20
        $this->price = 1050;
21
    }
22
23
    protected function deleting()
24
    {
25
        if ($this->price !== 100) {
26
            return false;
27
        }
28
29
        return true;
30
    }
31
32
    protected function deleted()
33
    {
34
        $this->price = 1;
35
    }
36
}
37