Completed
Push — master ( b9cd4a...bf5ad5 )
by Ivannis Suárez
06:04
created

CollectionPropertyMetadata   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 67
rs 10
c 1
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A setType() 0 14 1
A setOf() 0 4 1
A toArray() 0 9 1
1
<?php
2
/**
3
 * This file is part of the Cubiche package.
4
 *
5
 * Copyright (c) Cubiche
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Cubiche\Infrastructure\Collections\Doctrine\ODM\MongoDB\Metadata;
12
13
use Cubiche\Infrastructure\Doctrine\ODM\MongoDB\Metadata\PropertyMetadata;
14
15
/**
16
 * CollectionPropertyMetadata class.
17
 *
18
 * @author Ivannis Suárez Jerez <[email protected]>
19
 */
20
class CollectionPropertyMetadata extends PropertyMetadata
21
{
22
    /**
23
     * @var string
24
     */
25
    public $typeClassName;
26
27
    /**
28
     * @var string
29
     */
30
    public $persistenClassName;
31
32
    /**
33
     * @var string
34
     */
35
    public $of;
36
37
    /**
38
     * CollectionPropertyMetadata constructor.
39
     *
40
     * @param string $class
41
     * @param string $name
42
     */
43
    public function __construct($class, $name)
44
    {
45
        parent::__construct($class, $name, 'collection');
46
    }
47
48
    /**
49
     * @param string $type
50
     */
51
    public function setType($type)
52
    {
53
        $this->type = $type;
54
55
        $this->typeClassName = sprintf(
56
            'Cubiche\\Infrastructure\\Collections\\Doctrine\\ODM\\MongoDB\\Types\\%sType',
57
            $type
58
        );
59
60
        $this->persistenClassName = sprintf(
61
            'Cubiche\\Infrastructure\\Collections\\Doctrine\\Common\\Collections\\Persistent%s',
62
            $type
63
        );
64
    }
65
66
    /**
67
     * @param string $of
68
     */
69
    public function setOf($of)
70
    {
71
        $this->of = $of;
72
    }
73
74
    /**
75
     * @return array
76
     */
77
    public function toArray()
78
    {
79
        return array(
80
            'type' => $this->type,
81
            'typeClassName' => $this->typeClassName,
82
            'persistenClassName' => $this->persistenClassName,
83
            'of' => $this->of,
84
        );
85
    }
86
}
87