Completed
Push — master ( 93d1cc...438c17 )
by
unknown
23:12
created

ContainerProvider   C

Complexity

Total Complexity 31

Size/Duplication

Total Lines 503
Duplicated Lines 23.06 %

Coupling/Cohesion

Components 1
Dependencies 22

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 31
c 2
b 0
f 0
lcom 1
cbo 22
dl 116
loc 503
rs 5.6736

31 Methods

Rating   Name   Duplication   Size   Complexity  
A registerBaseServices() 0 7 1
A registerAdminServices() 0 7 1
A registerBaseUrl() 0 6 1
A registerConfig() 0 16 1
A registerAdminConfig() 0 8 1
A registerLayoutFactory() 0 8 1
A registerLayoutBuilder() 0 10 1
A registerDashboardFactory() 20 20 1
A registerDashboardBuilder() 0 10 1
A registerWidgetFactory() 16 16 1
A registerWidgetBuilder() 0 8 1
B registerClimate() 0 41 1
A registerTranslator() 0 16 1
A registerLogger() 0 6 1
A registerCache() 0 6 1
A registerDatabase() 0 8 1
A registerMetadataLoader() 0 18 1
A registerSourceFactory() 17 17 1
A registerPropertyFactory() 21 21 1
A registerPropertyDisplayFactory() 17 17 1
A registerModelFactory() 0 20 1
A registerAcl() 0 6 1
A registerAuthenticator() 0 15 1
A registerAuthorizer() 0 13 1
A registerCollectionLoader() 0 12 1
A registerEmailFactory() 0 10 1
A registerElfinderConfig() 0 6 1
A registerActionDependencies() 13 13 1
A registerTemplateDependencies() 0 16 1
A registerWidgetDependencies() 12 12 1
B registerView() 0 27 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Charcoal\Tests;
4
5
use PDO;
6
7
// From Mockery
8
use Mockery;
9
10
// From PSR-3
11
use Psr\Log\NullLogger;
12
13
// From 'cache/void-adapter' (PSR-6)
0 ignored issues
show
Unused Code Comprehensibility introduced by
40% 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...
14
use Cache\Adapter\Void\VoidCachePool;
15
16
// From 'tedivm/stash' (PSR-6)
0 ignored issues
show
Unused Code Comprehensibility introduced by
40% 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...
17
use Stash\Pool;
18
use Stash\Driver\Ephemeral;
19
20
// From 'zendframework/zend-permissions-acl'
21
use Zend\Permissions\Acl\Acl;
22
23
// From Pimple
24
use Pimple\Container;
25
26
// From 'league/climate'
27
use League\CLImate\CLImate;
28
use League\CLImate\Util\System\Linux;
29
use League\CLImate\Util\Output;
30
use League\CLImate\Util\Reader\Stdin;
31
use League\CLImate\Util\UtilFactory;
32
33
// From 'charcoal-factory'
34
use Charcoal\Factory\GenericFactory as Factory;
35
36
// From 'charcoal-app'
37
use Charcoal\App\AppConfig;
38
use Charcoal\App\Template\WidgetBuilder;
39
40
// From 'charcoal-core'
41
use Charcoal\Model\Service\MetadataLoader;
42
use Charcoal\Source\DatabaseSource;
43
44
// From 'charcoal-user'
45
use Charcoal\User\Authenticator;
46
use Charcoal\User\Authorizer;
47
48
// From 'charcoal-ui'
49
use Charcoal\Ui\Dashboard\DashboardBuilder;
50
use Charcoal\Ui\Dashboard\DashboardInterface;
51
use Charcoal\Ui\Layout\LayoutBuilder;
52
use Charcoal\Ui\Layout\LayoutFactory;
53
54
// From 'charcoal-email'
55
use Charcoal\Email\Email;
56
use Charcoal\Email\EmailConfig;
57
58
// From 'charcoal-view'
59
use Charcoal\View\GenericView;
60
use Charcoal\View\Mustache\MustacheEngine;
61
use Charcoal\View\Mustache\MustacheLoader;
62
63
// From 'charcoal-translator'
64
use Charcoal\Translator\LocalesManager;
65
use Charcoal\Translator\Translator;
66
67
// From 'charcoal-admin'
68
use Charcoal\Admin\Config as AdminConfig;
69
70
/**
71
 *
72
 */
73
class ContainerProvider
74
{
75
    /**
76
     * Register the unit tests required services.
77
     *
78
     * @param  Container $container A DI container.
79
     * @return void
80
     */
81
    public function registerBaseServices(Container $container)
82
    {
83
        $this->registerConfig($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\ContainerProvider::registerConfig() 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...
84
        $this->registerDatabase($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...der::registerDatabase() 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...
85
        $this->registerLogger($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\ContainerProvider::registerLogger() 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...
86
        $this->registerCache($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\ContainerProvider::registerCache() 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...
87
    }
88
89
    /**
90
     * Register the admin services.
91
     *
92
     * @param  Container $container A DI container.
93
     * @return void
94
     */
95
    public function registerAdminServices(Container $container)
96
    {
97
        $this->registerBaseUrl($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...ider::registerBaseUrl() 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...
98
        $this->registerAdminConfig($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...::registerAdminConfig() 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...
99
        $this->registerAuthenticator($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...registerAuthenticator() 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...
100
        $this->registerAuthorizer($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...r::registerAuthorizer() 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...
101
    }
102
103
    /**
104
     * Setup the application's base URI.
105
     *
106
     * @param  Container $container A DI container.
107
     * @return void
108
     */
109
    public function registerBaseUrl(Container $container)
110
    {
111
        $container['base-url'] = function (Container $container) {
0 ignored issues
show
Unused Code introduced by
The parameter $container is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
112
            return '';
113
        };
114
    }
115
116
    /**
117
     * Setup the application configset.
118
     *
119
     * @param  Container $container A DI container.
120
     * @return void
121
     */
122
    public function registerConfig(Container $container)
123
    {
124
        $container['config'] = function (Container $container) {
0 ignored issues
show
Unused Code introduced by
The parameter $container is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
125
            return new AppConfig([
126
                'base_path'  => realpath(__DIR__.'/../../..'),
127
                'apis'       => [
128
                    'google' => [
129
                        'recaptcha' => [
130
                            'public_key'  => 'foobar',
131
                            'private_key' => 'bazqux',
132
                        ]
133
                    ]
134
                ]
135
            ]);
136
        };
137
    }
138
139
    /**
140
     * Setup the admin module configset.
141
     *
142
     * @param  Container $container A DI container.
143
     * @return void
144
     */
145
    public function registerAdminConfig(Container $container)
146
    {
147
        $this->registerConfig($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\ContainerProvider::registerConfig() 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...
148
149
        $container['admin/config'] = function (Container $container) {
0 ignored issues
show
Unused Code introduced by
The parameter $container is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
150
            return new AdminConfig();
151
        };
152
    }
153
154
    public function registerLayoutFactory(Container $container)
155
    {
156
        $container['layout/factory'] = function (Container $container) {
0 ignored issues
show
Unused Code introduced by
The parameter $container is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
157
158
            $layoutFactory = new LayoutFactory();
159
            return $layoutFactory;
160
        };
161
    }
162
163
    public function registerLayoutBuilder(Container $container)
164
    {
165
        $this->registerLayoutFactory($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...registerLayoutFactory() 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...
166
167
        $container['layout/builder'] = function (Container $container) {
168
            $layoutFactory = $container['layout/factory'];
169
            $layoutBuilder = new LayoutBuilder($layoutFactory, $container);
170
            return $layoutBuilder;
171
        };
172
    }
173
174 View Code Duplication
    public function registerDashboardFactory(Container $container)
0 ignored issues
show
Duplication introduced by
This method 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...
175
    {
176
        $this->registerLogger($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\ContainerProvider::registerLogger() 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...
177
        $this->registerWidgetBuilder($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...registerWidgetBuilder() 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...
178
        $this->registerLayoutBuilder($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...registerLayoutBuilder() 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...
179
180
        $container['dashboard/factory'] = function (Container $container) {
181
            return new Factory([
182
                'arguments'          => [[
183
                    'container'      => $container,
184
                    'logger'         => $container['logger'],
185
                    'widget_builder' => $container['widget/builder'],
186
                    'layout_builder' => $container['layout/builder']
187
                ]],
188
                'resolver_options' => [
189
                    'suffix' => 'Dashboard'
190
                ]
191
            ]);
192
        };
193
    }
194
195
    public function registerDashboardBuilder(Container $container)
196
    {
197
        $this->registerDashboardFactory($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...isterDashboardFactory() 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...
198
199
        $container['dashboard/builder'] = function (Container $container) {
200
            $dashboardFactory = $container['dashboard/factory'];
201
            $dashboardBuilder = new DashboardBuilder($dashboardFactory, $container);
202
            return $dashboardBuilder;
203
        };
204
    }
205
206 View Code Duplication
    public function registerWidgetFactory(Container $container)
0 ignored issues
show
Duplication introduced by
This method 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...
207
    {
208
        $this->registerLogger($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\ContainerProvider::registerLogger() 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...
209
210
        $container['widget/factory'] = function (Container $container) {
211
            return new Factory([
212
                'resolver_options' => [
213
                    'suffix' => 'Widget'
214
                ],
215
                'arguments' => [[
216
                    'container' => $container,
217
                    'logger'    => $container['logger']
218
                ]]
219
            ]);
220
        };
221
    }
222
223
    public function registerWidgetBuilder(Container $container)
224
    {
225
        $this->registerWidgetFactory($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...registerWidgetFactory() 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...
226
227
        $container['widget/builder'] = function (Container $container) {
228
            return new WidgetBuilder($container['widget/factory'], $container);
229
        };
230
    }
231
    public function registerClimate(Container $container)
232
    {
233
        $container['climate/system'] = function (Container $container) {
0 ignored issues
show
Unused Code introduced by
The parameter $container is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
234
            $system = Mockery::mock(Linux::class);
235
            $system->shouldReceive('hasAnsiSupport')->andReturn(true);
236
            $system->shouldReceive('width')->andReturn(80);
237
238
            return $system;
239
        };
240
241
        $container['climate/output'] = function (Container $container) {
0 ignored issues
show
Unused Code introduced by
The parameter $container is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
242
            $output = Mockery::mock(Output::class);
243
            $output->shouldReceive('persist')->andReturn($output);
244
            $output->shouldReceive('sameLine')->andReturn($output);
245
            $output->shouldReceive('write');
246
247
            return $output;
248
        };
249
250
        $container['climate/reader'] = function (Container $container) {
0 ignored issues
show
Unused Code introduced by
The parameter $container is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
251
            $reader = Mockery::mock(Stdin::class);
252
            $reader->shouldReceive('line')->andReturn('line');
253
            $reader->shouldReceive('char')->andReturn('char');
254
            $reader->shouldReceive('multiLine')->andReturn('multiLine');
255
            return $reader;
256
        };
257
258
        $container['climate/util'] = function (Container $container) {
259
            return new UtilFactory($container['climate/system']);
260
        };
261
262
        $container['climate'] = function (Container $container) {
263
            $climate = new CLImate();
264
265
            $climate->setOutput($container['climate/output']);
266
            $climate->setUtil($container['climate/util']);
267
            $climate->setReader($container['climate/reader']);
268
269
            return $climate;
270
        };
271
    }
272
273
    /**
274
     * Setup the framework's view renderer.
275
     *
276
     * @param  Container $container A DI container.
277
     * @return void
278
     */
279
    public function registerView(Container $container)
280
    {
281
        $container['view/loader'] = function (Container $container) {
282
            return new MustacheLoader([
283
                'logger'    => $container['logger'],
284
                'base_path' => $container['config']['base_path'],
285
                'paths'     => [
286
                    'views'
287
                ]
288
            ]);
289
        };
290
291
        $container['view/engine'] = function (Container $container) {
292
            return new MustacheEngine([
293
                'logger' => $container['logger'],
294
                'cache'  => MustacheEngine::DEFAULT_CACHE_PATH,
295
                'loader' => $container['view/loader']
296
            ]);
297
        };
298
299
        $container['view'] = function (Container $container) {
300
            return new GenericView([
301
                'logger' => $container['logger'],
302
                'engine' => $container['view/engine']
303
            ]);
304
        };
305
    }
306
307
    /**
308
     * Setup the application's translator service.
309
     *
310
     * @param  Container $container A DI container.
311
     * @return void
312
     */
313
    public function registerTranslator(Container $container)
314
    {
315
        $container['locales/manager'] = function (Container $container) {
0 ignored issues
show
Unused Code introduced by
The parameter $container is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
316
            return new LocalesManager([
317
                'locales' => [
318
                    'en' => [ 'locale' => 'en-US' ]
319
                ]
320
            ]);
321
        };
322
323
        $container['translator'] = function (Container $container) {
324
            return new Translator([
325
                'manager' => $container['locales/manager']
326
            ]);
327
        };
328
    }
329
330
    /**
331
     * Setup the application's logging interface.
332
     *
333
     * @param  Container $container A DI container.
334
     * @return void
335
     */
336
    public function registerLogger(Container $container)
337
    {
338
        $container['logger'] = function (Container $container) {
0 ignored issues
show
Unused Code introduced by
The parameter $container is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
339
            return new NullLogger();
340
        };
341
    }
342
343
    /**
344
     * Setup the application's caching interface.
345
     *
346
     * @param  Container $container A DI container.
347
     * @return void
348
     */
349
    public function registerCache(Container $container)
350
    {
351
        $container['cache'] = function ($container) {
0 ignored issues
show
Unused Code introduced by
The parameter $container is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
352
            return new Pool(new Ephemeral());
353
        };
354
    }
355
356
    public function registerDatabase(Container $container)
357
    {
358
        $container['database'] = function (Container $container) {
0 ignored issues
show
Unused Code introduced by
The parameter $container is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
359
            $pdo = new PDO('sqlite::memory:');
360
            $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
361
            return $pdo;
362
        };
363
    }
364
365
    public function registerMetadataLoader(Container $container)
366
    {
367
        $this->registerLogger($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\ContainerProvider::registerLogger() 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...
368
        $this->registerCache($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\ContainerProvider::registerCache() 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...
369
370
        $container['metadata/loader'] = function (Container $container) {
371
            return new MetadataLoader([
372
                'logger'    => $container['logger'],
373
                'cache'     => $container['cache'],
374
                'base_path' => $container['config']['base_path'],
375
                'paths'     => [
376
                    'metadata',
377
                    'vendor/locomotivemtl/charcoal-object/metadata',
378
                    'vendor/locomotivemtl/charcoal-user/metadata'
379
                ]
380
            ]);
381
        };
382
    }
383
384 View Code Duplication
    public function registerSourceFactory(Container $container)
0 ignored issues
show
Duplication introduced by
This method 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...
385
    {
386
        $this->registerLogger($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\ContainerProvider::registerLogger() 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...
387
        $this->registerDatabase($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...der::registerDatabase() 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...
388
389
        $container['source/factory'] = function (Container $container) {
390
            return new Factory([
391
                'map' => [
392
                    'database' => DatabaseSource::class
393
                ],
394
                'arguments'  => [[
395
                    'logger' => $container['logger'],
396
                    'pdo'    => $container['database']
397
                ]]
398
            ]);
399
        };
400
    }
401
402 View Code Duplication
    public function registerPropertyFactory(Container $container)
0 ignored issues
show
Duplication introduced by
This method 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...
403
    {
404
        $this->registerTranslator($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...r::registerTranslator() 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...
405
        $this->registerDatabase($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...der::registerDatabase() 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...
406
        $this->registerLogger($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\ContainerProvider::registerLogger() 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...
407
408
        $container['property/factory'] = function (Container $container) {
409
            return new Factory([
410
                'resolver_options' => [
411
                    'prefix' => '\\Charcoal\\Property\\',
412
                    'suffix' => 'Property'
413
                ],
414
                'arguments' => [[
415
                    'container'  => $container,
416
                    'database'   => $container['database'],
417
                    'translator' => $container['translator'],
418
                    'logger'     => $container['logger']
419
                ]]
420
            ]);
421
        };
422
    }
423
424 View Code Duplication
    public function registerPropertyDisplayFactory(Container $container)
0 ignored issues
show
Duplication introduced by
This method 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...
425
    {
426
        $this->registerDatabase($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...der::registerDatabase() 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...
427
        $this->registerLogger($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\ContainerProvider::registerLogger() 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...
428
429
        $container['property/display/factory'] = function (Container $container) {
430
            return new Factory([
431
                'resolver_options' => [
432
                    'suffix' => 'Display'
433
                ],
434
                'arguments' => [[
435
                    'container' => $container,
436
                    'logger'    => $container['logger']
437
                ]]
438
            ]);
439
        };
440
    }
441
442
443
    public function registerModelFactory(Container $container)
444
    {
445
        $this->registerLogger($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\ContainerProvider::registerLogger() 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...
446
        $this->registerTranslator($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...r::registerTranslator() 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...
447
        $this->registerMetadataLoader($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...egisterMetadataLoader() 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...
448
        $this->registerPropertyFactory($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...gisterPropertyFactory() 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...
449
        $this->registerSourceFactory($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...registerSourceFactory() 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...
450
451
        $container['model/factory'] = function (Container $container) {
452
            return new Factory([
453
                'arguments' => [[
454
                    'container'        => $container,
455
                    'logger'           => $container['logger'],
456
                    'metadata_loader'  => $container['metadata/loader'],
457
                    'property_factory' => $container['property/factory'],
458
                    'source_factory'   => $container['source/factory']
459
                ]]
460
            ]);
461
        };
462
    }
463
464
    public function registerAcl(Container $container)
465
    {
466
        $container['admin/acl'] = function (Container $container) {
0 ignored issues
show
Unused Code introduced by
The parameter $container is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
467
            return new Acl();
468
        };
469
    }
470
471
    public function registerAuthenticator(Container $container)
472
    {
473
        $this->registerLogger($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\ContainerProvider::registerLogger() 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...
474
        $this->registerModelFactory($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...:registerModelFactory() 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...
475
476
        $container['admin/authenticator'] = function (Container $container) {
477
            return new Authenticator([
478
                'logger'        => $container['logger'],
479
                'user_type'     => 'charcoal/admin/user',
480
                'user_factory'  => $container['model/factory'],
481
                'token_type'    => 'charcoal/admin/user/auth-token',
482
                'token_factory' => $container['model/factory']
483
            ]);
484
        };
485
    }
486
487
    public function registerAuthorizer(Container $container)
488
    {
489
        $this->registerLogger($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\ContainerProvider::registerLogger() 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...
490
        $this->registerAcl($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\ContainerProvider::registerAcl() 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...
491
492
        $container['admin/authorizer'] = function (Container $container) {
493
            return new Authorizer([
494
                'logger'    => $container['logger'],
495
                'acl'       => $container['admin/acl'],
496
                'resource'  => 'admin'
497
            ]);
498
        };
499
    }
500
501
    public function registerCollectionLoader(Container $container)
502
    {
503
        $this->registerLogger($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\ContainerProvider::registerLogger() 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...
504
        $this->registerModelFactory($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...:registerModelFactory() 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...
505
506
        $container['model/collection/loader'] = function (Container $container) {
507
            return new \Charcoal\Loader\CollectionLoader([
508
                'logger'  => $container['logger'],
509
                'factory' => $container['model/factory']
510
            ]);
511
        };
512
    }
513
514
    public function registerEmailFactory(Container $container)
515
    {
516
        $container['email/factory'] = function (Container $container) {
0 ignored issues
show
Unused Code introduced by
The parameter $container is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
517
            return new Factory([
518
                'map' => [
519
                    'email' => Email::class
520
                ]
521
            ]);
522
        };
523
    }
524
525
    public function registerElfinderConfig(Container $container)
526
    {
527
        $container['elfinder/config'] = function (Container $container) {
0 ignored issues
show
Unused Code introduced by
The parameter $container is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
528
            return [];
529
        };
530
    }
531
532 View Code Duplication
    public function registerActionDependencies(Container $container)
0 ignored issues
show
Duplication introduced by
This method 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...
533
    {
534
        $this->registerLogger($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\ContainerProvider::registerLogger() 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...
535
536
        $this->registerModelFactory($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...:registerModelFactory() 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...
537
        $this->registerTranslator($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...r::registerTranslator() 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...
538
539
        $this->registerAdminConfig($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...::registerAdminConfig() 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...
540
        $this->registerBaseUrl($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...ider::registerBaseUrl() 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...
541
542
        $this->registerAuthenticator($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...registerAuthenticator() 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...
543
        $this->registerAuthorizer($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...r::registerAuthorizer() 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...
544
    }
545
546
    public function registerTemplateDependencies(Container $container)
547
    {
548
        $this->registerLogger($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\ContainerProvider::registerLogger() 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...
549
550
        $this->registerModelFactory($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...:registerModelFactory() 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...
551
        $this->registerTranslator($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...r::registerTranslator() 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...
552
553
        $this->registerAdminConfig($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...::registerAdminConfig() 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...
554
        $this->registerBaseUrl($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...ider::registerBaseUrl() 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...
555
556
        $this->registerAuthenticator($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...registerAuthenticator() 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...
557
        $this->registerAuthorizer($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...r::registerAuthorizer() 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...
558
559
        $container['menu/builder'] = null;
560
        $container['menu/item/builder'] = null;
561
    }
562
563 View Code Duplication
    public function registerWidgetDependencies(Container $container)
0 ignored issues
show
Duplication introduced by
This method 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...
564
    {
565
        $this->registerLogger($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\ContainerProvider::registerLogger() 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...
566
        $this->registerTranslator($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...r::registerTranslator() 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...
567
        $this->registerView($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\ContainerProvider::registerView() 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...
568
        $this->registerAdminConfig($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...::registerAdminConfig() 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...
569
        $this->registerBaseUrl($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...ider::registerBaseUrl() 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...
570
        $this->registerModelFactory($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...:registerModelFactory() 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...
571
572
        $this->registerAuthenticator($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...registerAuthenticator() 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...
573
        $this->registerAuthorizer($container);
0 ignored issues
show
Unused Code introduced by
The call to the method Charcoal\Tests\Container...r::registerAuthorizer() 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...
574
    }
575
}
576