Completed
Pull Request — master (#62)
by Jason
14:09
created

EmbedBlock::getCMSFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 5

Duplication

Lines 16
Ratio 100 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 0
Metric Value
dl 16
loc 16
ccs 7
cts 7
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Dynamic\DynamicBlocks\Block;
4
5
use SheaDawson\Blocks\Model\Block;
6
7 View Code Duplication
class EmbedBlock extends Block
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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
}