Completed
Push — master ( 2cd806...1496f0 )
by Lorenzo
02:47
created

dummy()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 2
eloc 4
nc 2
nop 1
1
<?php
2
namespace Padosoft\Laravel\Google\StructuredDataTestingTool;
3
4
use Illuminate\Support\ServiceProvider;
5
6
class GoogleStructuredDataTestToolServiceProvider extends ServiceProvider
7
{
8
    /**
9
     * Indicates if loading of the provider is deferred.
10
     *
11
     * @var bool
12
     */
13
    protected $defer = true;
14
15
    /**
16
     * Bootstrap the application events.
17
     *
18
     * @return void
19
     */
20
    public function boot()
21
    {
22
        $this->publishes([
23
            __DIR__ . '/config/laravel-google-structured-data-testing-tool.php' => config_path('laravel-google-structured-data-testing-tool.php'),
24
        ], 'config');
25
26
        $this->loadViewsFrom(__DIR__ . '/views', 'laravel-google-structured-data-testing-tool');
27
28
        $this->publishes([
29
            __DIR__ . '/views' => base_path('resources/views/vendor/laravel-google-structured-data-testing-tool'),
30
        ]);
31
    }
32
33
    /**
34
     * Register the service provider.
35
     *
36
     * @return void
37
     */
38
    public function register()
39
    {
40
        $this->app['command.google-markup:test'] = $this->app->share(
41
            function ($app) {
42
                $this->dummy($app);
0 ignored issues
show
Unused Code introduced by
The call to the method Padosoft\Laravel\Google\...erviceProvider::dummy() 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...
43
                return new GoogleStructuredDataTestTool();
44
            }
45
        );
46
        $this->commands('command.google-markup:test');
47
48
    }
49
50
    /**
51
     * Get the services provided by the provider.
52
     *
53
     * @return string[]
54
     */
55
    public function provides()
56
    {
57
        return ['command.google-markup:test'];
58
    }
59
60
    /**
61
     * @param $app
62
     * @return bool
63
     */
64
    public function dummy($app)
65
    {
66
        if($app){
67
            return true;
68
        }
69
        return false;
70
    }
71
}
72