Test Failed
Push — master ( d27946...98f74e )
by Terzi
08:07
created

Translatable::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Terranet\Administrator\Field;
4
5
use Terranet\Administrator\Exception;
6
use Terranet\Administrator\Traits\Form\RendersTranslatableElement;
7
8
class Translatable
9
{
10
    use RendersTranslatableElement;
11
12
    protected $field;
13
14
    /**
15
     * Translatable constructor.
16
     *
17
     * @param Generic $field
18
     */
19
    public function __construct(Generic $field)
20
    {
21
        $this->field = $field;
22
    }
23
24
    /**
25
     * Proxy field methods calls.
26
     *
27
     * @param $method
28
     * @param $args
29
     */
30
    public function __call($method, $args)
31
    {
32
        if (method_exists($this->field, $method)) {
33
            return call_user_func_array([$this->field, $method], $args);
34
        }
35
36
        throw new Exception(sprintf('Unknown method [%s]', $method));
37
    }
38
}