RuntimeReflectionService   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 37
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getClass() 0 4 1
A getAccessibleProperty() 0 12 2
1
<?php
2
3
/**
4
 * This file is part of the Kdyby (http://www.kdyby.org)
5
 *
6
 * Copyright (c) 2008 Filip Procházka ([email protected])
7
 *
8
 * For the full copyright and license information, please view the file license.txt that was distributed with this source code.
9
 */
10
11
namespace Kdyby\Doctrine\Mapping;
12
13
use Doctrine;
14
use Kdyby;
15
use Nette;
16
use Nette\Reflection;
17
18
19
20
/**
21
 * @author Filip Procházka <[email protected]>
22
 */
23
class RuntimeReflectionService extends Doctrine\Common\Persistence\Mapping\RuntimeReflectionService
24
{
25
26
	/**
27
	 * Return a reflection class instance or null
28
	 *
29
	 * @param string $class
30
	 * @return \Nette\Reflection\ClassType
31
	 */
32
	public function getClass($class)
33
	{
34
		return new Reflection\ClassType($class);
35
	}
36
37
38
39
	/**
40
	 * Return an accessible property (setAccessible(true)) or null.
41
	 *
42
	 * @param string $class
43
	 * @param string $property
44
	 * @return \Nette\Reflection\Property|NULL
45
	 */
46
	public function getAccessibleProperty($class, $property)
47
	{
48
		try {
49
			$property = new Reflection\Property($class, $property);
50
			$property->setAccessible(TRUE);
51
52
			return $property;
53
54
		} catch (\ReflectionException $e) {
55
			return NULL;
56
		}
57
	}
58
59
}
60