Completed
Push — remove-phpcr-context ( 64497c )
by Kamil
33:54 queued 13:21
created

AddressFixture::configureResourceNode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 14
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sylius\Bundle\CoreBundle\Fixture;
13
14
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
15
16
/**
17
 * @author Jan Góralski <[email protected]>
18
 */
19
class AddressFixture extends AbstractResourceFixture
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function getName()
25
    {
26
        return 'address';
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    protected function configureResourceNode(ArrayNodeDefinition $resourceNode)
33
    {
34
        $resourceNode
0 ignored issues
show
Unused Code introduced by
The call to the method Symfony\Component\Config...r\NodeDefinition::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...
35
            ->children()
36
                ->scalarNode('first_name')->cannotBeEmpty()->end()
37
                ->scalarNode('last_name')->cannotBeEmpty()->end()
38
                ->scalarNode('phone_number')->end()
39
                ->scalarNode('company')->end()
40
                ->scalarNode('street')->cannotBeEmpty()->end()
41
                ->scalarNode('city')->cannotBeEmpty()->end()
42
                ->scalarNode('postcode')->cannotBeEmpty()->end()
43
                ->scalarNode('country_code')->cannotBeEmpty()->end()
44
                ->scalarNode('province_code')->end()
45
                ->scalarNode('province_name')->end()
46
                ->scalarNode('customer')->cannotBeEmpty()->end()
47
        ;
48
    }
49
}
50