Completed
Push — core-test-reorganisation ( b9cfa9...ce9ad9 )
by Kamil
43:54 queued 22:56
created

ApiAccessTokenFixture   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 4
dl 0
loc 24
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 4 1
A configureResourceNode() 0 10 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\ApiBundle\Fixture;
13
14
use Sylius\Bundle\CoreBundle\Fixture\AbstractResourceFixture;
15
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
16
17
/**
18
 * @author Łukasz Chruściel <[email protected]>
19
 */
20
class ApiAccessTokenFixture extends AbstractResourceFixture
21
{
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function getName()
26
    {
27
        return 'access_token';
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    protected function configureResourceNode(ArrayNodeDefinition $resourceNode)
34
    {
35
        $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...
36
            ->children()
37
                ->scalarNode('client')->cannotBeEmpty()->end()
38
                ->scalarNode('token')->cannotBeEmpty()->end()
39
                ->scalarNode('user')->cannotBeEmpty()->end()
40
                ->scalarNode('expires_at')->end()
41
        ;
42
    }
43
}
44