Install::postAutoloadDump()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
1
<?php
2
3
namespace Codexshaper\WooCommerce\PHP;
4
5
use Composer\Script\Event;
6
use Composer\Installer\PackageEvent;
7
8
class Install
9
{
10
    public static function postUpdate(Event $event)
11
    {
12
        $composer = $event->getComposer();
0 ignored issues
show
Unused Code introduced by
$composer is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
13
        // do stuff
14
    }
15
16
    public static function postAutoloadDump(Event $event)
17
    {
18
        $vendorDir = $event->getComposer()->getConfig()->get('vendor-dir');
19
        require $vendorDir . '/autoload.php';
20
21
        mkdir($vendorDir.'/basir', 0700);
22
        mkdir($vendorDir.'/../test', 0700);
23
24
        // some_function_from_an_autoloaded_file();
25
    }
26
27
    public static function postPackageInstall(PackageEvent $event)
28
    {
29
        $installedPackage = $event->getOperation()->getPackage();
30
        // do stuff
31
32
        var_dump($installedPackage);
0 ignored issues
show
Security Debugging Code introduced by
var_dump($installedPackage); looks like debug code. Are you sure you do not want to remove it? This might expose sensitive data.
Loading history...
33
    }
34
35
    public static function warmCache(Event $event)
36
    {
37
        // make cache toasty
38
        $vendorDir = $event->getComposer()->getConfig()->get('vendor-dir');
39
        mkdir($vendorDir.'/basir', 0700);
40
        mkdir($vendorDir.'/../test', 0700);
41
42
        $content = "some text here";
43
        $fp = fopen("myText.txt","wb");
44
        fwrite($fp,$content);
45
        fclose($fp);
46
    }
47
}
48