Completed
Pull Request — master (#1088)
by
unknown
02:55
created

Definitions   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 24
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getModules() 0 4 1
A getModule() 0 4 2
1
<?php
2
3
namespace Nwidart\Modules\Console\Traits;
4
5
trait Definitions
6
{
7
8
    /**
9
     * Get modules
10
     *
11
     * @return object
12
     */
13
    public function getModules()
14
    {
15
        return $this->laravel['modules'];
0 ignored issues
show
Bug introduced by
The property laravel does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
16
    }
17
18
    /**
19
     * Get specified module
20
     *
21
     * @param string $moduleName
22
     * @return object
23
     */
24
    public function getModule(string $moduleName)
25
    {
26
        return $this->getModules()->findOrFail($moduleName ?: $this->getModuleName());
0 ignored issues
show
Bug introduced by
The method getModuleName() does not exist on Nwidart\Modules\Console\Traits\Definitions. Did you maybe mean getModule()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
27
    }
28
}
29