AddSocialitesColumnsToUsers::up()   A
last analyzed

Complexity

Conditions 3
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 3
eloc 4
nc 1
nop 0
dl 0
loc 6
rs 10
c 1
b 0
f 1
1
<?php
2
3
use Illuminate\Support\Facades\Schema;
4
use Illuminate\Database\Schema\Blueprint;
0 ignored issues
show
Bug introduced by
The type Illuminate\Database\Schema\Blueprint 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...
5
use Illuminate\Database\Migrations\Migration;
0 ignored issues
show
Bug introduced by
The type Illuminate\Database\Migrations\Migration 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...
6
7
class AddSocialitesColumnsToUsers extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::table(config('laravel-oauth.users.table'), function (Blueprint $table) {
0 ignored issues
show
Bug introduced by
The function config was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

16
        Schema::table(/** @scrutinizer ignore-call */ config('laravel-oauth.users.table'), function (Blueprint $table) {
Loading history...
17
            foreach (config('laravel-oauth.providers') as $provider => $status) {
0 ignored issues
show
Bug introduced by
The function config was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

17
            foreach (/** @scrutinizer ignore-call */ config('laravel-oauth.providers') as $provider => $status) {
Loading history...
18
                if ($status === true) {
19
                    $table->string($provider.'_id')->nullable();
20
                }
21
            }
22
        });
23
    }
24
25
    /**
26
     * Reverse the migrations.
27
     *
28
     * @return void
29
     */
30
    public function down()
31
    {
32
        Schema::table(config('laravel-oauth.users.table'), function (Blueprint $table) {
0 ignored issues
show
Bug introduced by
The function config was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

32
        Schema::table(/** @scrutinizer ignore-call */ config('laravel-oauth.users.table'), function (Blueprint $table) {
Loading history...
33
            foreach (config('laravel-oauth.providers') as $provider => $status) {
34
                if (Schema::hasColumn(config('laravel-oauth.users.table'), $provider.'_id')) {
0 ignored issues
show
Bug introduced by
The function config was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

34
                if (Schema::hasColumn(/** @scrutinizer ignore-call */ config('laravel-oauth.users.table'), $provider.'_id')) {
Loading history...
35
                    $table->dropColumn($provider.'_id');
36
                }
37
            }
38
        });
39
    }
40
}
41