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

EmbedBlock   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 85.71%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 45
ccs 12
cts 14
cp 0.8571
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A singular_name() 0 4 1
A plural_name() 0 4 1
A getCMSFields() 0 16 1
1
<?php
2
3
namespace Dynamic\DynamicBlocks\Block;
4
5
use SheaDawson\Blocks\Model\Block;
6
7
class EmbedBlock extends Block
8 12
{
9
    /**
10 12
     * @return string
11
     */
12
    public function singular_name()
13
    {
14
        return _t('EmbedBlock.SINGULARNAME', 'oEmbed Block');
15
    }
16
17
    /**
18
     * @return string
19
     */
20
    public function plural_name()
21
    {
22
        return _t('EmbedBlock.PLURALNAME', 'oEmbed Blocks');
23
    }
24
25
    /**
26
     * @var array
27
     */
28
    private static $has_one = [
29
        //'EmbeddedObject' => 'EmbeddedObject', // todo readd once Linkable is SS4 compatible
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
30
    ];
31 1
32 1
    /**
33
     * @return \SilverStripe\Forms\FieldList
34 1
     */
35 1
    public function getCMSFields(){
36 1
        $fields = parent::getCMSFields();
37
38 1
        $fields->removeByName([
39 1
            'EmbeddedObjectID',
40 1
        ]);
41 1
42
        /* // todo readd once Linkable is SS4 compatible
0 ignored issues
show
Unused Code Comprehensibility introduced by
63% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
43 1
        $fields->addFieldToTab(
44
            'Root.Embed',
45
            EmbeddedObjectField::create('EmbeddedObject', 'Content from oEmbed URL', $this->EmbeddedObject())
46
        );
47
        */
48
49
        return $fields;
50
    }
51
}