IntegerNet_Anonymizer_Shell   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 27
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A run() 0 10 1
A usageHelp() 0 9 1
1
<?php
2
/**
3
 * integer_net Magento Module
4
 *
5
 * @category   IntegerNet
6
 * @package    IntegerNet_Anonymizer
7
 * @copyright  Copyright (c) 2015 integer_net GmbH (http://www.integer-net.de/)
8
 * @author     Fabian Schmengler <[email protected]>
9
 */
10
11
require_once 'abstract.php';
12
require_once 'autoloader_initializer.php';
13
14
class IntegerNet_Anonymizer_Shell extends AutoloaderInitializer
15
{
16
    /**
17
     * Run script
18
     */
19
    public function run()
20
    {
21
        ini_set('memory_limit', '1024M');
22
        /** @var IntegerNet_Anonymizer_Model_Anonymizer $anonymizer */
23
        $anonymizer = Mage::getModel('integernet_anonymizer/anonymizer');
24
        $anonymizer->setOutputStream(STDOUT);
0 ignored issues
show
Documentation introduced by
STDOUT is of type string, but the function expects a resource.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
25
        $anonymizer->setShowProgress((bool) $this->getArg('progress'));
26
        $anonymizer->setProgressSteps((int) $this->getArg('progress'));
27
        $anonymizer->anonymizeAll();
28
    }
29
30
    public function usageHelp()
31
    {
32
        return <<<USAGE
33
Usage:  php -f anonymizer.php -- [options]
34
35
  --progress [steps]    Show progress in real time (steps defines after how many updated entities status should be refreshed)
36
  -h | --help           This help
37
USAGE;
38
    }
39
40
}
41
42
$shell = new IntegerNet_Anonymizer_Shell();
43
$shell->run();