Completed
Push — master ( 0c34b7...ef90f4 )
by Oscar
02:32
created

Radio   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
c 2
b 0
f 0
lcom 0
cbo 2
dl 0
loc 22
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A customRender() 0 4 1
1
<?php
2
3
namespace Folk\Formats;
4
5
use FormManager\Fields;
6
7
class Radio extends Fields\Radio
8
{
9
    use Traits\FieldTrait;
10
11
    public function __construct()
12
    {
13
        parent::__construct();
14
15
        $this->set([
0 ignored issues
show
Documentation Bug introduced by
The method set does not exist on object<Folk\Formats\Radio>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
16
            'list' => true,
17
            'class' => 'is-boolean',
18
        ]);
19
    }
20
21
    /**
22
     * {@inheritdoc}
23
     */
24
    protected function customRender($prepend = '', $append = '')
25
    {
26
        return '<div class="button button-radio">'.$this.'</div>';
27
    }
28
}
29