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.
Passed
Push — master ( c13e8b...6b60bf )
by Albert
04:30
created

Server::files()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php 
2
namespace Elimuswift\DbExporter;
3
4
use Config;
5
use Storage;
6
7
class Server
8
{
9
    protected $ignoredFiles = array('..', '.', '.gitkeep');
10
11
    public static $uploadedFiles;
12
13
    /**
14
     * What the class has to upload (migrations or seeds)
15
     * @var
16
     */
17
    protected $what;
18
19
    public function upload($what)
20
    {
21
        
22
        $remotePath = Config::get('db-exporter.remote.' . $what);
23
24 View Code Duplication
        foreach ($this->files($what) as $file) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
25
            if (in_array($file, $this->ignoredFiles)) {
26
                continue;
27
            }
28
29
            // Capture the uploaded files for display later
30
            self::$uploadedFiles[$what][] = $remotePath . $file;
31
32
            // Copy the files
33
            Storage::disk($this->getDiskName())->put(
34
                $remotePath . $file,
35
                $localPath . '/' . $file
0 ignored issues
show
Bug introduced by
The variable $localPath does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
36
            );
37
        }
38
39
        return true;
40
    }
41
    public function files($value='')
0 ignored issues
show
Unused Code introduced by
The parameter $value is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
42
    {
43
        $localPath = Config::get('db-exporter.export_path.'.$what);
0 ignored issues
show
Bug introduced by
The variable $what does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
44
45
        return scandir($localPath);
46
    }
47
48
    private function getDiskName()
49
    {
50
        // For now static from he config file.
51
        return Config::get('db-exporter.remote.disk');
52
    }
53
}