Completed
Push — master ( 0661db...c488b0 )
by Peter
12:28
created

EmbedRefArrayDecorator::getClassName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
ccs 0
cts 3
cp 0
rs 9.4286
cc 1
eloc 3
nc 1
nop 2
crap 2
1
<?php
2
3
/**
4
 * This software package is licensed under AGPL or Commercial license.
5
 *
6
 * @package maslosoft/mangan
7
 * @licence AGPL or Commercial
8
 * @copyright Copyright (c) Piotr Masełkowski <[email protected]>
9
 * @copyright Copyright (c) Maslosoft
10
 * @copyright Copyright (c) Others as mentioned in code
11
 * @link http://maslosoft.com/mangan/
12
 */
13
14
namespace Maslosoft\Mangan\Decorators;
15
16
use Maslosoft\Mangan\Meta\DocumentPropertyMeta;
17
use Maslosoft\Mangan\Meta\ManganMeta;
18
19
/**
20
 * Embed Ref Array Decorator is alias for embedded array decorator
21
 * for converting arrays of Db Refs into JSON arrays, Document arrays etc.
22
 *
23
 * @author Piotr Maselkowski <pmaselkowski at gmail.com>
24
 */
25
class EmbedRefArrayDecorator extends EmbeddedArrayDecorator
26
{
27
28
	protected static function getClassName($model, $name)
29
	{
30
		$fieldMeta = ManganMeta::create($model)->$name;
31
32
		/* @var $fieldMeta DocumentPropertyMeta */
33
		return $fieldMeta->dbRef->class;
34
	}
35
36
}
37