Module::getConsoleUsage()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
crap 1
1
<?php
2
namespace mxdiModule;
3
4
use Doctrine\Common\Annotations\AnnotationRegistry;
5
use Zend\Console\Adapter\AdapterInterface;
6
use Zend\ModuleManager\Feature\ConsoleBannerProviderInterface;
7
use Zend\ModuleManager\Feature\ConsoleUsageProviderInterface;
8
9
class Module implements ConsoleBannerProviderInterface, ConsoleUsageProviderInterface
10
{
11
    /**
12
     * Initialize autoloader
13
     */
14 1
    public function init()
15
    {
16 1
        AnnotationRegistry::registerLoader([$this, 'annotationAutoloader']);
17 1
    }
18
19
    /**
20
     * Get config
21
     *
22
     * @return array
23
     */
24 1
    public function getConfig()
25
    {
26 1
        return (array)require __DIR__ . '/../config/module.config.php';
27
    }
28
29
    /**
30
     * Get the autoloader for annotations.
31
     *
32
     * @param string $class
33
     * @return bool
34
     */
35 1
    public function annotationAutoloader($class)
36
    {
37 1
        if (strpos($class, 'mxdiModule\\Annotation') !== false) {
38 1
            $file = substr($class, strrpos($class, '\\')+1);
39 1
            require_once sprintf('%s/Annotation/%s.php', __DIR__, $file);
40 1
            return true;
41
        }
42
43 1
        return false;
44
    }
45
46
    /**
47
     * {@inheritdoc}
48
     */
49 1
    public function getConsoleBanner(AdapterInterface $console)
50
    {
51 1
        return 'mxdiModule console';
52
    }
53
54
    /**
55
     * {@inheritdoc}
56
     */
57 1
    public function getConsoleUsage(AdapterInterface $console)
58
    {
59
        return [
60 1
            'mxdimodule proxy clear'          => 'Remove proxies from the proxy dir',
61 1
            'mxdimodule cache clear [<fqcn>]' => 'Flush whole cache or only of given service',
62 1
        ];
63
    }
64
}
65