Completed
Pull Request — Gutenberg/master (#482)
by
unknown
30:58 queued 13:18
created

TestBlock   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A initialize() 0 7 1
A renderBlock() 0 4 1
1
<?php
2
3
namespace EventEspresso\core\domain\entities\editor\blocks\test;
4
5
use EventEspresso\core\domain\entities\editor\Block;
6
use EventEspresso\core\domain\entities\editor\blocks\CoreBlocksAssetManager;
7
use EventEspresso\core\domain\entities\shortcodes\EspressoEvents;
8
9
/**
10
 * Class TestBlock
11
 * Description
12
 *
13
 * @package EventEspresso\core\domain\entities\editor\blocks
14
 * @author  Brent Christensen
15
 * @since   $VID:$
16
 */
17
class TestBlock extends Block
18
{
19
20
    const BLOCK_TYPE = 'test-block';
21
22
23
    /**
24
     * EventsList constructor.
25
     *
26
     * @param CoreBlocksAssetManager $block_asset_manager
27
     */
28
    public function __construct(CoreBlocksAssetManager $block_asset_manager)
29
    {
30
        parent::__construct($block_asset_manager);
31
    }
32
33
34
    /**
35
     * Perform any early setup required by the block
36
     * including setting the block type and supported post types
37
     *
38
     * @return void
39
     */
40
    public function initialize()
41
    {
42
        $this->setBlockType(self::BLOCK_TYPE);
43
        $this->setSupportedPostTypes(array('post', 'page'));
44
        $this->setAttributes(array());
45
        $this->setDynamic();
46
    }
47
48
49
    /**
50
     * returns the rendered HTML for the block
51
     *
52
     * @param array $attributes
53
     * @return string
54
     * @throws \EE_Error
55
     * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
56
     * @throws \EventEspresso\core\exceptions\InvalidInterfaceException
57
     * @throws \InvalidArgumentException
58
     */
59
    public function renderBlock(array $attributes = array())
60
    {
61
        return '<h2>' . __METHOD__ . '()</h2>' . var_export($attributes, true);
62
    }
63
}