Completed
Branch FET/cascade-deletion (d58b4b)
by
unknown
31:20 queued 23:22
created

BaseNode::visit()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
nc 3
dl 0
loc 9
c 0
b 0
f 0
cc 3
nop 1
rs 9.9666
1
<?php
2
3
namespace EventEspresso\core\services\orm\tree_traversal;
4
5
/**
6
 * Class BaseNode
7
 *
8
 * Description
9
 *
10
 * @package     Event Espresso
11
 * @author         Mike Nelson
12
 * @since         $VID:$
13
 *
14
 */
15
abstract class BaseNode
16
{
17
    /**
18
     * @var boolean
19
     */
20
    protected $complete;
21
    /**
22
     * Whether this item has already been initialized
23
     */
24
    public abstract function isDiscovered();
25
26
    /**
27
     * @since $VID:$
28
     * @return boolean
29
     */
30
    public abstract function isComplete();
31
32
    public abstract function discover();
33
34
    /**
35
     * @since $VID:$
36
     * @param $work_to_do
37
     * @return int units of work done
38
     */
39
    public function visit($work_to_do){
40
        if($this->isComplete()){
41
           return;
42
        }
43
        if(! $this->isDiscovered()){
44
            $this->discover();
45
        }
46
        return $this->work($work_to_do);
47
    }
48
49
    /**
50
     *
51
     * @since $VID:$
52
     * @param $work_to_do
53
     * @return int units of work done
54
     */
55
    protected abstract function work($work_to_do);
56
}
57
// End of file BaseNode.php
58
// Location: EventEspresso\core\services\orm\tree_traversal/BaseNode.php
59