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.

MakerConfigFile::run()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 0
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 13 and the first side effect is on line 7.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
namespace Classes;
3
4
5
use Classes\Maker\AbstractMaker;
6
7
require_once 'Maker/AbstractMaker.php';
8
9
/**
10
 * @author Pedro Alarcao <[email protected]>
11
 * @link   https://github.com/pedro151/orm-generator
12
 */
13
class MakerConfigFile extends AbstractMaker
14
{
15
16
    /**
17
     * caminho de pastas Base
18
     *
19
     * @type string
20
     */
21
    private $baseLocation = '';
22
23
    private $template = 'Classes/templates/file_configs/ini.php';
24
25
    private $msg = "\033[0mPlease enter the value for %index% \033[1;33m[%config%]:\033[0m ";
26
27
    private $configs = array (
28
        'name-ini'  => 'config' ,
29
        'framework'   => 'none' ,
30
        'driver'      => 'pgsql' ,
31
        'environment' => 'dev' ,
32
        'host'        => 'localhost' ,
33
        'database'    => null ,
34
        'schema'      => null ,
35
        'username'    => null ,
36
        'password'    => null
37
    );
38
39
    public function __construct ( $argv , $basePath )
40
    {
41
        $this->argv = $this->parseConfig ( $basePath , $argv );
0 ignored issues
show
Bug introduced by
The property argv 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...
42
    }
43
44
    /**
45
     * Analisa e estrutura a Configuracao do generate
46
     *
47
     * @param string $_path
0 ignored issues
show
Bug introduced by
There is no parameter named $_path. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
48
     * @param array  $argv
49
     *
50
     * @return array
51
     * @throws \Exception
52
     */
53
    private function parseConfig ( $basePath , $argv )
54
    {
55
        $this->baseLocation = $basePath;
56
57
        $arrayIO = array_diff_key ( $this->configs , $argv );
58 View Code Duplication
        foreach ( $arrayIO as $index => $config )
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...
59
        {
60
            $attribs = array ( "%index%" => $index , "%config%" => $config );
61
            echo strtr ( $this->msg , $attribs );
62
            $line = trim ( fgets ( STDIN ) );
63
            if ( ! empty( $line ) )
64
            {
65
                $this->configs[ $index ] = strtolower ( $line );
66
            }
67
        }
68
        $this->configs ['version']     = Config::$version;
69
        return $argv + array_filter ( $this->configs );
70
    }
71
72
    public function run ()
73
    {
74
        $path = $this->baseLocation . DIRECTORY_SEPARATOR . "configs";
75
        self::makeDir ( $path );
76
        self::makeSourcer (
77
            $path . DIRECTORY_SEPARATOR . $this->argv[ 'name-ini' ] . '.ini' ,
78
            $this->getParsedTplContents ( $this->template , $this->argv )
79
        );
80
        echo "\n\033[1;32mSuccessfully process finished!\n\033[0m";
81
    }
82
}