Issues (257)

src/Providers/AdsenseServiceProvider.php (100 issues)

1
<?php
0 ignored issues
show
Class found in ".php" file; use ".inc" extension instead
Loading history...
There must be no blank lines before the file comment
Loading history...
The PHP open tag does not have a corresponding PHP close tag
Loading history...
Filename "AdsenseServiceProvider.php" doesn't match the expected filename "adsenseserviceprovider.php"
Loading history...
2
3
/**
0 ignored issues
show
Namespaced classes, interfaces and traits should not begin with a file doc comment
Loading history...
4
 * Google Adsense Ads for Laravel.
5
 *
6
 * Package for easily including Google Adsense Ad units
7
 * in Laravel and Lumen.
8
 *
9
 * @developer Martin Butt <https://www.martinbutt.com/>
0 ignored issues
show
The tag in position 1 should be the @package tag
Loading history...
10
 *
11
 * @copyright Copyright (c) 2021 Martin Butt
0 ignored issues
show
Coding Style Documentation introduced by
Expected "xxxx-xxxx Squiz Pty Ltd (ABN 77 084 670 600)" for copyright declaration
Loading history...
The tag in position 2 should be the @subpackage tag
Loading history...
@copyright tag must contain a year and the name of the copyright holder
Loading history...
12
 * @license   MIT
0 ignored issues
show
The tag in position 3 should be the @author tag
Loading history...
@license tag must contain a URL and a license name
Loading history...
Tag value indented incorrectly; expected 1 space but found 3
Loading history...
13
 *
14
 * Copyright (c) 2016 Galen Han
15
 * Copyright (c) 2019 Crypto Technology srl
16
 * Copyright (c) 2021 Martin Butt
17
 *
18
 * Permission is hereby granted, free of charge, to any person obtaining a copy of
0 ignored issues
show
Line exceeds 80 characters; contains 82 characters
Loading history...
19
 * this software and associated documentation files (the "Software"), to deal in
20
 * the Software without restriction, including without limitation the rights to
21
 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
0 ignored issues
show
Line exceeds 80 characters; contains 83 characters
Loading history...
22
 * the Software, and to permit persons to whom the Software is furnished to do so,
0 ignored issues
show
Line exceeds 80 characters; contains 82 characters
Loading history...
23
 * subject to the following conditions:
24
 *
25
 * The above copyright notice and this permission notice shall be included in all
0 ignored issues
show
Line exceeds 80 characters; contains 81 characters
Loading history...
26
 * copies or substantial portions of the Software.
27
 *
28
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
0 ignored issues
show
Line exceeds 80 characters; contains 83 characters
Loading history...
30
 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
0 ignored issues
show
Line exceeds 80 characters; contains 81 characters
Loading history...
31
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
0 ignored issues
show
Line exceeds 80 characters; contains 81 characters
Loading history...
32
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
33
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34
 */
0 ignored issues
show
PHP version not specified
Loading history...
Coding Style Documentation introduced by
Missing @package tag in file comment
Loading history...
Coding Style Documentation introduced by
Missing @subpackage tag in file comment
Loading history...
Coding Style Documentation introduced by
Missing @author tag in file comment
Loading history...
Missing @category tag in file comment
Loading history...
Missing @link tag in file comment
Loading history...
35
36
declare(strict_types=1);
37
38
namespace MartinButt\Laravel\Adsense\Providers;
39
40
use Illuminate\Support\ServiceProvider;
41
use Laravel\Lumen\Application as LumenApplication;
0 ignored issues
show
The type Laravel\Lumen\Application was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
42
use MartinButt\Laravel\Adsense\AdsenseBuilder;
43
44
/**
45
 * Class AdsenseServiceProvider.
46
 *
47
 * @see \Illuminate\Support\ServiceProvider
0 ignored issues
show
Coding Style Documentation introduced by
@see tag is not allowed in class comment
Loading history...
48
 */
0 ignored issues
show
The class short comment should describe what the class does and not simply repeat the class name
Loading history...
Missing @category tag in class comment
Loading history...
Missing @package tag in class comment
Loading history...
Missing @author tag in class comment
Loading history...
Missing @license tag in class comment
Loading history...
Missing @link tag in class comment
Loading history...
49
class AdsenseServiceProvider extends ServiceProvider
50
{
0 ignored issues
show
Opening brace should be on the same line as the declaration for class AdsenseServiceProvider
Loading history...
Opening brace should be on the same line as the declaration
Loading history...
51
    /**
0 ignored issues
show
Line indented incorrectly; expected 2 spaces, found 4
Loading history...
52
     * Bootstrap any application services.
53
     */
0 ignored issues
show
Missing @return tag in function comment
Loading history...
54 3
    public function boot(): void
0 ignored issues
show
Line indented incorrectly; expected 2 spaces, found 4
Loading history...
Expected 1 blank line before function; 0 found
Loading history...
55
    {
0 ignored issues
show
Opening brace should be on the same line as the declaration
Loading history...
56 3
        $this->loadViewsFrom(__DIR__.'/../resources/views', 'adsense');
0 ignored issues
show
Line indented incorrectly; expected 4 spaces, found 8
Loading history...
Concat operator must be surrounded by a single space
Loading history...
Expected at least 1 space before "."; 0 found
Loading history...
Expected at least 1 space after "."; 0 found
Loading history...
57
58 3
        if ($this->app instanceof LumenApplication) {
0 ignored issues
show
Line indented incorrectly; expected 4 spaces, found 8
Loading history...
59
            /* @scrutinizer ignore-call */ $this->app->configure('adsense');
0 ignored issues
show
Line indented incorrectly; expected 6 spaces, found 12
Loading history...
Single line block comment not allowed; use inline ("// text") comment instead
Loading history...
60
        } else {
0 ignored issues
show
Line indented incorrectly; expected 4 spaces, found 8
Loading history...
Expected newline after closing brace
Loading history...
61
            // Publishing the configuration file.
0 ignored issues
show
Line indented incorrectly; expected 6 spaces, found 12
Loading history...
62 3
            $this->publishes([
0 ignored issues
show
Line indented incorrectly; expected 6 spaces, found 12
Loading history...
Short array syntax is not allowed
Loading history...
63 3
                $this->getConfigFile() => config_path('adsense.php'),
0 ignored issues
show
Array indentation error, expected 14 spaces but found 16
Loading history...
64 3
            ], 'config');
65
            // Publishing the views.
0 ignored issues
show
Line indented incorrectly; expected 6 spaces, found 12
Loading history...
66 3
            $this->publishes([
0 ignored issues
show
Line indented incorrectly; expected 6 spaces, found 12
Loading history...
Short array syntax is not allowed
Loading history...
67 3
                __DIR__.'/../resources/views' => resource_path('views/vendor/adsense'),
0 ignored issues
show
Array indentation error, expected 14 spaces but found 16
Loading history...
Concat operator must be surrounded by a single space
Loading history...
Expected at least 1 space before "."; 0 found
Loading history...
Expected at least 1 space after "."; 0 found
Loading history...
68 3
            ], 'views');
69
        }
0 ignored issues
show
Line indented incorrectly; expected 4 spaces, found 8
Loading history...
70 3
    }
0 ignored issues
show
Line indented incorrectly; expected 2 spaces, found 4
Loading history...
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected //end boot()
Loading history...
71
72
    /**
0 ignored issues
show
Line indented incorrectly; expected 2 spaces, found 4
Loading history...
73
     * {@inheritdoc}
74
     */
0 ignored issues
show
Missing @return tag in function comment
Loading history...
75 3
    public function register(): void
0 ignored issues
show
Line indented incorrectly; expected 2 spaces, found 4
Loading history...
76
    {
0 ignored issues
show
Opening brace should be on the same line as the declaration
Loading history...
77 3
        $this->mergeConfigFrom(
0 ignored issues
show
Line indented incorrectly; expected 4 spaces, found 8
Loading history...
78 3
            $this->getConfigFile(),
79 3
            'adsense'
80
        );
81
82
        $this->app->bind(AdsenseBuilder::class, function () {
0 ignored issues
show
Line indented incorrectly; expected 4 spaces, found 8
Loading history...
83 3
            return new AdsenseBuilder();
84 3
        });
0 ignored issues
show
Line indented incorrectly; expected 4 spaces, found 8
Loading history...
85
86 3
        $this->app->alias(AdsenseBuilder::class, 'adsense');
0 ignored issues
show
Line indented incorrectly; expected 4 spaces, found 8
Loading history...
87 3
    }
0 ignored issues
show
Line indented incorrectly; expected 2 spaces, found 4
Loading history...
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected //end register()
Loading history...
88
89
    /**
0 ignored issues
show
Line indented incorrectly; expected 2 spaces, found 4
Loading history...
90
     * {@inheritdoc}
91
     */
0 ignored issues
show
Missing @return tag in function comment
Loading history...
92
    public function provides(): array
0 ignored issues
show
Line indented incorrectly; expected 2 spaces, found 4
Loading history...
93
    {
0 ignored issues
show
Opening brace should be on the same line as the declaration
Loading history...
94
        return [
0 ignored issues
show
Line indented incorrectly; expected 4 spaces, found 8
Loading history...
Short array syntax is not allowed
Loading history...
95
            AdsenseBuilder::class,
0 ignored issues
show
Array indentation error, expected 10 spaces but found 12
Loading history...
96
            'adsense',
0 ignored issues
show
Array indentation error, expected 10 spaces but found 12
Loading history...
97
        ];
98
    }
0 ignored issues
show
Line indented incorrectly; expected 2 spaces, found 4
Loading history...
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected //end provides()
Loading history...
99
100
    /**
0 ignored issues
show
Line indented incorrectly; expected 2 spaces, found 4
Loading history...
101
     * Return the path of configuration file.
102
     */
0 ignored issues
show
Missing @return tag in function comment
Loading history...
103 3
    protected function getConfigFile(): string
0 ignored issues
show
Line indented incorrectly; expected 2 spaces, found 4
Loading history...
104
    {
0 ignored issues
show
Opening brace should be on the same line as the declaration
Loading history...
105 3
        return __DIR__.'/../resources/config/adsense.php';
0 ignored issues
show
Line indented incorrectly; expected 4 spaces, found 8
Loading history...
Concat operator must be surrounded by a single space
Loading history...
Expected at least 1 space before "."; 0 found
Loading history...
Expected at least 1 space after "."; 0 found
Loading history...
106
    }
0 ignored issues
show
Line indented incorrectly; expected 2 spaces, found 4
Loading history...
Expected 1 blank line after function; 0 found
Loading history...
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected //end getConfigFile()
Loading history...
107
}
0 ignored issues
show
Expected //end class
Loading history...
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
108