StringBlockFixture::getName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Lakion\CmsPlugin\Fixture;
4
5
use Sylius\Bundle\CoreBundle\Fixture\AbstractResourceFixture;
6
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
7
8
final class StringBlockFixture extends AbstractResourceFixture
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13
    public function getName(): string
14
    {
15
        return 'lakion_cms_string_block';
16
    }
17
18
    /**
19
     * {@inheritdoc}
20
     */
21
    protected function configureResourceNode(ArrayNodeDefinition $resourceNode): void
22
    {
23
        $resourceNode
0 ignored issues
show
Unused Code introduced by
The call to the method Symfony\Component\Config...arNodeDefinition::end() seems un-needed as the method has no side-effects.

PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left.

Let’s take a look at an example:

class User
{
    private $email;

    public function getEmail()
    {
        return $this->email;
    }

    public function setEmail($email)
    {
        $this->email = $email;
    }
}

If we look at the getEmail() method, we can see that it has no side-effect. Whether you call this method or not, no future calls to other methods are affected by this. As such code as the following is useless:

$user = new User();
$user->getEmail(); // This line could safely be removed as it has no effect.

On the hand, if we look at the setEmail(), this method _has_ side-effects. In the following case, we could not remove the method call:

$user = new User();
$user->setEmail('email@domain'); // This line has a side-effect (it changes an
                                 // instance variable).
Loading history...
24
            ->children()
25
                ->scalarNode('name')->end()
26
                ->scalarNode('body')->end()
27
        ;
28
    }
29
}
30