Completed
Branch BUG/reg-status-change-recursio... (2db0c9)
by
unknown
20:03 queued 10:32
created

BlockManager   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
initHook() 0 1 ?
initialize() 0 1 ?
1
<?php
2
3
namespace EventEspresso\core\services\editor;
4
5
use EventEspresso\core\domain\entities\editor\BlockCollection;
6
use EventEspresso\core\domain\entities\editor\BlockInterface;
7
use EventEspresso\core\services\collections\CollectionInterface;
8
use EventEspresso\core\services\request\RequestInterface;
9
10
/**
11
 * Class BlockManager
12
 * Description
13
 *
14
 * @package EventEspresso\core\services\editor
15
 * @author  Brent Christensen
16
 * @since   $VID:$
17
 */
18
abstract class BlockManager
19
{
20
21
    /**
22
     * @var CollectionInterface|BlockInterface[] $blocks
23
     */
24
    protected $blocks;
25
26
    /**
27
     * @var RequestInterface $request
28
     */
29
    protected $request;
30
31
32
33
    /**
34
     * BlockManager constructor.
35
     *
36
     * @param BlockCollection   $blocks
37
     * @param RequestInterface  $request
38
     */
39
    public function __construct(
40
        BlockCollection $blocks,
41
        RequestInterface $request
42
    ) {
43
        $this->blocks            = $blocks;
44
        $this->request           = $request;
45
        add_action($this->initHook(), array($this, 'initialize'));
46
    }
47
48
49
    /**
50
     *  Returns the name of a hookpoint to be used to call initialize()
51
     *
52
     * @return string
53
     */
54
    abstract public function initHook();
55
56
57
    /**
58
     * Perform any early setup required for block editors to functions
59
     *
60
     * @return void
61
     */
62
    abstract public function initialize();
63
}
64