Completed
Push — master ( 62bec2...5bc1e5 )
by Hong
02:42
created

ExtensionAbstract::methodsAvailable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 5
rs 9.4285
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 * Phossa Project
4
 *
5
 * PHP version 5.4
6
 *
7
 * @category  Library
8
 * @package   Phossa2\Shared
9
 * @copyright Copyright (c) 2016 phossa.com
10
 * @license   http://mit-license.org/ MIT License
11
 * @link      http://www.phossa.com/
12
 */
13
/*# declare(strict_types=1); */
14
15
namespace Phossa2\Shared\Extension;
16
17
use Phossa2\Shared\Base\ObjectAbstract;
18
19
/**
20
 * ExtensionAbstract
21
 *
22
 * @package Phossa2\Shared
23
 * @author  Hong Zhang <[email protected]>
24
 * @see     ObjectAbstract
25
 * @see     ExtensionInterface
26
 * @version 2.0.0
27
 * @since   2.0.0 added
28
 */
29
abstract class ExtensionAbstract extends ObjectAbstract implements ExtensionInterface
30
{
31
    /**
32
     * The server object
33
     *
34
     * @var    ExtensionAwareInterface
35
     * @access protected
36
     */
37
    protected $server;
38
39
    /**
40
     * The lazy boot flag
41
     *
42
     * @var    bool
43
     * @access protected
44
     */
45
    protected $booted = false;
46
47
    /**
48
     * {@inheritDoc}
49
     */
50
    public function methodsAvailable()/*# : array */
51
    {
52
        // e.g. ['connect', 'method2']
0 ignored issues
show
Unused Code Comprehensibility introduced by
42% 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...
53
        return [];
54
    }
55
56
    /**
57
     * {@inheritDoc}
58
     */
59
    public function boot(ExtensionAwareInterface $server)
60
    {
61
        if (!$this->booted) {
62
            // bind server
63
            $this->server = $server;
64
65
            // call user defined boot
66
            $this->bootExtension($server);
67
68
            // call your own bootMethod here
69
            $this->booted = true;
70
        }
71
    }
72
73
    /**
74
     *
75
     * @param  ExtensionAwareInterface $server
76
     * @access protected
77
     */
78
    abstract protected function bootExtension(ExtensionAwareInterface $server);
79
}
80