Completed
Push — master ( 5afb5d...6dae66 )
by dima
05:53
created

InstallController   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
B postPackageInstall() 0 29 3
1
<?php
2
3
namespace Frameworkless\Controllers;
4
5
class InstallController
6
{
7
8
    static public function postPackageInstall()
0 ignored issues
show
Coding Style introduced by
As per PSR2, the static declaration should come after the visibility declaration.
Loading history...
9
    {
10
        $finder = \Symfony\Component\Finder\Finder::create();
11
12
        $root_path = __DIR__ . "../../..";
13
14
        $iterator = $finder
15
                ->files()
16
                ->in($root_path . "/vendor/*/*/db");
17
18
        foreach ($iterator as $file) {
19
            //print $file->getRealpath() . PHP_EOL;
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
20
21
            // Dump the relative path to the file, omitting the filename
22
            //var_dump($file->getRelativePath());
0 ignored issues
show
Unused Code Comprehensibility introduced by
78% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
23
24
            // Dump the relative path to the file
25
            //var_dump($file->getRelativePathname());
0 ignored issues
show
Unused Code Comprehensibility introduced by
78% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
26
27
            if (!copy($file->getRealpath(), $root_path . '/db/' . $file->getRelativePathname())) {
28
               echo sprintf("error copy migration %s..." . PHP_EOL, $file->getRelativePathname());
29
            }
30
            else{
31
                echo sprintf("copy migration %s" . PHP_EOL, $file->getRelativePathname());
32
            }
33
        }
34
        
35
        echo "completed!" . PHP_EOL;
36
    }
37
}
38