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

TestBlock::renderBlock()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
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
}