Completed
Pull Request — master (#22)
by Sergey
16:14
created

EventableModel   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A saving() 0 4 1
A saved() 0 4 1
A deleting() 0 8 2
A deleted() 0 4 1
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