GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

MigrationTrait   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 4
Bugs 1 Features 1
Metric Value
wmc 3
c 4
b 1
f 1
lcom 1
cbo 0
dl 0
loc 32
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A requireMigrations() 0 10 2
A getMigrationPath() 0 6 1
1
<?php
2
3
namespace Caffeinated\Modules\Traits;
4
5
trait MigrationTrait
6
{
7
    /**
8
     * Require (once) all migration files for the supplied module.
9
     *
10
     * @param string $module
11
     */
12
    protected function requireMigrations($module)
13
    {
14
        $path = $this->getMigrationPath($module);
15
16
        $migrations = $this->laravel['files']->glob($path.'*_*.php');
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...
17
18
        foreach ($migrations as $migration) {
19
            $this->laravel['files']->requireOnce($migration);
20
        }
21
    }
22
23
    /**
24
     * Get migration directory path.
25
     *
26
     * @param string $module
27
     *
28
     * @return string
29
     */
30
    protected function getMigrationPath($module)
31
    {
32
        $path = $this->laravel['modules']->getModulePath($module);
33
34
        return $path.'Database/Migrations/';
35
    }
36
}
37