|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Ubiquity\orm\parser; |
|
4
|
|
|
|
|
5
|
|
|
|
|
6
|
|
|
trait ReflexionFieldsTrait { |
|
7
|
|
|
|
|
8
|
|
|
abstract public static function getAnnotationMember($class, $member, $annotation); |
|
9
|
|
|
abstract public static function getAnnotsEngine(); |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* |
|
13
|
|
|
* @param string $class |
|
14
|
|
|
* @param string $member |
|
15
|
|
|
* @return \Ubiquity\annotations\ColumnAnnotation|boolean |
|
|
|
|
|
|
16
|
|
|
*/ |
|
17
|
48 |
|
protected static function getAnnotationColumnMember($class, $member) { |
|
18
|
48 |
|
return self::getAnnotationMember ( $class, $member, 'column' ); |
|
19
|
|
|
} |
|
20
|
|
|
|
|
21
|
48 |
|
public static function getDbType($class, $member) { |
|
22
|
48 |
|
$ret = self::getAnnotationColumnMember ( $class, $member ); |
|
23
|
48 |
|
if (! $ret) |
|
24
|
47 |
|
return false; |
|
25
|
|
|
else |
|
26
|
48 |
|
return $ret->dbType; |
|
|
|
|
|
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
48 |
|
public static function isSerializable($class, $member) { |
|
30
|
48 |
|
if (self::getAnnotationMember ( $class, $member, 'transient' ) !== false || self::getAnnotationMember ( $class, $member, 'manyToOne' ) !== false || self::getAnnotationMember ( $class, $member, 'manyToMany' ) !== false || self::getAnnotationMember ( $class, $member, 'oneToMany' ) !== false) |
|
31
|
48 |
|
return false; |
|
32
|
|
|
else |
|
33
|
48 |
|
return true; |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
48 |
|
public static function getFieldName($class, $member) { |
|
37
|
48 |
|
$ret = self::getAnnotationColumnMember ( $class, $member ); |
|
38
|
48 |
|
if ($ret === false || ! isset ( $ret->name )) |
|
|
|
|
|
|
39
|
47 |
|
$ret = $member; |
|
40
|
|
|
else |
|
41
|
48 |
|
$ret = $ret->name; |
|
42
|
48 |
|
return $ret; |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
48 |
|
public static function isNullable($class, $member) { |
|
46
|
48 |
|
$ret = self::getAnnotationColumnMember ( $class, $member ); |
|
47
|
48 |
|
if (! $ret) |
|
48
|
47 |
|
return false; |
|
49
|
|
|
else |
|
50
|
48 |
|
return $ret->nullable; |
|
|
|
|
|
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
57 |
|
public static function getProperties($class) { |
|
54
|
57 |
|
$reflect = new \ReflectionClass ( $class ); |
|
55
|
57 |
|
return $reflect->getProperties (); |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
34 |
|
public static function getProperty($instance, $member) { |
|
59
|
34 |
|
$reflect = new \ReflectionClass ( $instance ); |
|
60
|
34 |
|
$prop = false; |
|
61
|
34 |
|
if ($reflect->hasProperty ( $member )) { |
|
62
|
34 |
|
$prop = $reflect->getProperty ( $member ); |
|
63
|
|
|
} |
|
64
|
34 |
|
return $prop; |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
8 |
|
public static function getPropertyType($class, $property) { |
|
68
|
8 |
|
if(($r=self::getMetadata ( $class, $property, 'var', 'type' ))===false){ |
|
69
|
|
|
$reflect=new \ReflectionProperty($class, $property); |
|
70
|
|
|
return $reflect->getType(); |
|
71
|
|
|
} |
|
72
|
8 |
|
return $r; |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
8 |
|
public static function getMetadata($class, $property, $type, $name) { |
|
76
|
8 |
|
$a = self::getAnnotsEngine()->getAnnotsOfProperty ( $class, $property, $type ); |
|
77
|
8 |
|
if (! \count ( $a )) { |
|
78
|
|
|
return false; |
|
79
|
|
|
} |
|
80
|
8 |
|
return \trim ( $a [0]->$name, ';' ); |
|
81
|
|
|
} |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths