Completed
Push — master ( bafc2b...789f6f )
by Oscar
03:26
created

Loader::customRender()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 14
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 2 Features 0
Metric Value
c 4
b 2
f 0
dl 0
loc 14
rs 9.4285
cc 3
eloc 7
nc 2
nop 2
1
<?php
2
3
namespace Folk\Formats;
4
5
use FormManager\Fields;
6
use FormManager\Builder;
7
8
class Loader extends Fields\Loader implements FormatInterface
9
{
10
    use Traits\HtmlValueTrait;
11
12
    public $list = false;
13
14
    public function __construct(Builder $builder, array $children = null)
15
    {
16
        parent::__construct($children);
17
18
        $this->class('format is-loader');
0 ignored issues
show
Documentation Bug introduced by
The method class does not exist on object<Folk\Formats\Loader>? 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...
19
        $this->set('list', false);
20
    }
21
22
    public function label($html = null)
23
    {
24
        if ($html === null) {
25
            return $this['loader']->label->html();
26
        }
27
28
        $this['loader']->label($html);
29
30
        return $this;
31
    }
32
}
33