Completed
Pull Request — master (#62)
by Jason
15:39
created

SlideshowBlock_Controller   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 10
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Dynamic\DynamicBlocks\Block;
4
5
use SheaDawson\Blocks\Controllers\BlockController;
6
use SheaDawson\Blocks\Model\Block;
7
8 12
class SlideshowBlock extends Block
9
{
10 12
    /**
11
     * @return string
12
     */
13
    public function singular_name()
14
    {
15
        return _t('SlideshowBlock.SINGULARNAME', 'Slideshow Block');
16 1
    }
17
18 1
    /**
19
     * @return string
20
     */
21
    public function plural_name()
22
    {
23
        return _t('SlideshowBlock.PLURALNAME', 'Slideshow Blocks');
24
    }
25
}
26
27
class SlideshowBlock_Controller extends BlockController
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
28
{
29
    /**
30
     *
31
     */
32
    public function init()
33
    {
34
        $this->Data()->contentcontrollerInit();
0 ignored issues
show
Documentation Bug introduced by
The method Data does not exist on object<Dynamic\DynamicBl...deshowBlock_Controller>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
35
    }
36
}