Passed
Push — main ( b120a7...6737cd )
by Andrey
02:12
created

BasePlugin::vendor()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
3
/*
4
 * This file is part of the "andrey-helldar/laravel-lang-publisher" project.
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 *
9
 * @author Andrey Helldar <[email protected]>
10
 *
11
 * @copyright 2021 Andrey Helldar
12
 *
13
 * @license MIT
14
 *
15
 * @see https://github.com/andrey-helldar/laravel-lang-publisher
16
 */
17
18
declare(strict_types=1);
19
20
namespace Helldar\LaravelLangPublisher\Plugins;
21
22
use Helldar\Contracts\LangPublisher\Plugin;
23
use Helldar\LaravelLangPublisher\Concerns\Paths;
24
use Helldar\Support\Facades\Helpers\Filesystem\Directory;
25
26
abstract class BasePlugin implements Plugin
27
{
28
    use Paths;
29
30
    public function vendor(): ?string
31
    {
32
        return null;
33
    }
34
35 62
    public function has(): bool
36
    {
37 62
        if ($vendor = $this->vendor()) {
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $vendor is correct as $this->vendor() targeting Helldar\LaravelLangPubli...ns\BasePlugin::vendor() seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
38 62
            $path = $this->vendorPath($vendor);
0 ignored issues
show
Bug introduced by
$vendor of type void is incompatible with the type string expected by parameter $parameters of Helldar\LaravelLangPubli...asePlugin::vendorPath(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

38
            $path = $this->vendorPath(/** @scrutinizer ignore-type */ $vendor);
Loading history...
39
40 62
            return Directory::exists($path);
41
        }
42
43
        return true;
44
    }
45
}
46