Passed
Push — main ( ad9d65...b0d77b )
by Thierry
04:01
created

AbstractComponent   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
dl 0
loc 37
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A rq() 0 3 1
A setupComponent() 0 2 1
1
<?php
2
3
namespace Jaxon\App\Component;
4
5
use Jaxon\Di\Container;
6
use Jaxon\Plugin\Request\CallableClass\ComponentHelper;
7
use Jaxon\Script\Call\JxnCall;
8
9
abstract class AbstractComponent
10
{
11
    /**
12
     * Get the component helper
13
     *
14
     * @return ComponentHelper
15
     */
16
    abstract protected function helper(): ComponentHelper;
17
18
    /**
19
     * Initialize the component
20
     *
21
     * @param Container $di
22
     * @param ComponentHelper $xHelper
23
     *
24
     * @return void
25
     */
26
    abstract protected function initComponent(Container $di, ComponentHelper $xHelper);
27
28
    /**
29
     * Initialize the component
30
     *
31
     * @return void
32
     */
33
    protected function setupComponent(): void
34
    {}
35
36
    /**
37
     * Get the js call factory.
38
     *
39
     * @param string $sClassName
40
     *
41
     * @return JxnCall
42
     */
43
    protected function rq(string $sClassName = ''): JxnCall
44
    {
45
        return $this->helper()->rq($sClassName);
46
    }
47
}
48