Popup   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A render() 0 7 1
1
<?php
2
3
namespace Amarkal\Shortcode;
4
5
class Popup
6
{
7
    /**
8
     * Popup configuration array
9
     *
10
     * @var array
11
     */
12
    private $config = array();
13
    
14
    /**
15
     * Constructor
16
     *
17
     * @param array $config
18
     */
19
    public function __construct(array $config = array()) 
20
    {
21
        $this->config = $config;
22
        $this->fields = new \Amarkal\UI\ComponentList($config['fields']);
0 ignored issues
show
Bug introduced by
The property fields does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
23
        $this->form   = new \Amarkal\UI\Form($this->fields);
0 ignored issues
show
Bug introduced by
The property form does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
24
    }
25
    
26
    /**
27
     * Render the popup
28
     *
29
     * @return void
30
     */
31
    public function render()
32
    {
33
        $this->form->update();
34
        ob_start();
35
        include dirname(__FILE__).'/Popup.phtml';
36
        return ob_get_clean();
37
    }
38
}