Completed
Push — master ( 7e748b...ca1854 )
by Karsten
02:03
created

AsKeyValuePairs::validate()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 15
Code Lines 9

Duplication

Lines 15
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 15
loc 15
ccs 0
cts 7
cp 0
rs 9.4285
cc 2
eloc 9
nc 2
nop 1
crap 6
1
<?php
2
/**
3
 * File was created 30.09.2015 10:49
4
 */
5
6
namespace PeekAndPoke\Component\Slumber\Annotation\Slumber;
7
8
use Doctrine\Common\Annotations\Annotation;
9
10
/**
11
 * AsKeyValuePairs transforms arrays into the form { 'k': ..., 'v': ... }
12
 *
13
 * Keys are preserved.
14
 *
15
 * The result of slumbering will look like:
16
 *
17
 * Input:
18
 *
19
 * <code>
20
 *   array ( 'a' => 'A', 'b' => 'B' )
21
 *   array ( 'C', 'B' )
22
 * </code>
23
 *
24
 * Output:
25
 *
26
 * <code>
27
 *   [ { 'k' : 'a', 'v' : 'A'}, { 'k' : 'b', 'v' : 'B'} ]
28
 *   [ { 'k' : '0', 'v' : 'C'}, { 'k' : '1', 'v' : 'D'} ]
29
 * </code>
30
 *
31
 * The keys ('k') will always be strings
32
 *
33
 * @Annotation
34
 * @Annotation\Target("PROPERTY")
35
 *
36
 * @author Karsten J. Gerber <[email protected]>
37
 */
38
class AsKeyValuePairs extends AsCollection
39
{
40
}
41