ModelProxy   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 30.43%

Importance

Changes 7
Bugs 1 Features 3
Metric Value
wmc 6
c 7
b 1
f 3
lcom 0
cbo 0
dl 0
loc 44
ccs 7
cts 23
cp 0.3043
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B __construct() 0 27 6
1
<?php
2
3
namespace Tpg\ExtjsBundle\Annotation;
4
5
/**
6
 * Description of proxy for model
7
 *
8
 * @Annotation
9
 * @Target("CLASS")
10
 */
11
final class ModelProxy
12
{
13
    /** @var string Name of proxy */
14
    public $name = 'memory';
15
    /** @var array Options */
16
    public $option = array();
17
    /** @var array Reader params */
18
    public $reader = array();
19
    /** @var array Writer params */
20
    public $writer = array();
21
22
    /**
23
     * Constructor.
24
     *
25
     * @param array $values Values
26
     */
27 6
    public function __construct($values)
28
    {
29 6
        if (isset($values['value'])) {
30
            $this->name = "rest";
31
            $this->option = array(
32
                "url" => $values['value'],
33
                "format" => "json",
34
            );
35
            $this->writer = array(
36
                "type" => "json",
37
                "writeRecordId" => false,
38
            );
39
        } else {
40 6
            if (isset($values['name'])) {
41
                $this->name = $values['name'];
42
            }
43
        }
44 6
        if (isset($values['option'])) {
45
            $this->option = array_merge($this->option, $values['option']);
46
        }
47 6
        if (isset($values['writer'])) {
48
            $this->writer = array_merge($this->writer, $values['writer']);
49
        }
50 6
        if (isset($values['reader'])) {
51
            $this->reader = $values['reader'];
52
        }
53
    }
54
}