File tree 1 file changed +16
-8
lines changed
1 file changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -33,11 +33,7 @@ public function __construct(array $mappings = null)
33
33
{
34
34
if (is_array ($ mappings )) {
35
35
foreach ($ mappings as $ mappedClass ) {
36
- if (is_string ($ mappedClass ) && class_exists ($ mappedClass , true )) {
37
- $ mapping = MappingFactory::fromClass ($ mappedClass );
38
- } else {
39
- $ mapping = MappingFactory::fromArray ($ mappedClass );
40
- }
36
+ $ mapping = $ this ->buildMapping ($ mappedClass );
41
37
42
38
if (false === empty ($ this ->aliasMap [$ mapping ->getClassAlias ()])) {
43
39
throw new MappingException (
@@ -52,11 +48,15 @@ public function __construct(array $mappings = null)
52
48
}
53
49
54
50
/**
55
- * @param array $array
51
+ * @param string|array $mappedClass
52
+ *
53
+ * @return array
56
54
*/
57
- public function setClassMap ( array $ array )
55
+ protected function buildMapping ( $ mappedClass )
58
56
{
59
- $ this ->classMap = $ array ;
57
+ return (is_string ($ mappedClass ) && class_exists ($ mappedClass , true )) ?
58
+ MappingFactory::fromClass ($ mappedClass ) :
59
+ MappingFactory::fromArray ($ mappedClass );
60
60
}
61
61
62
62
/**
@@ -66,4 +66,12 @@ public function getClassMap()
66
66
{
67
67
return $ this ->classMap ;
68
68
}
69
+
70
+ /**
71
+ * @param array $array
72
+ */
73
+ public function setClassMap (array $ array )
74
+ {
75
+ $ this ->classMap = $ array ;
76
+ }
69
77
}
You can’t perform that action at this time.
0 commit comments