File tree Expand file tree Collapse file tree 1 file changed +16
-8
lines changed Expand file tree Collapse file tree 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)
3333 {
3434 if (is_array ($ mappings )) {
3535 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 );
4137
4238 if (false === empty ($ this ->aliasMap [$ mapping ->getClassAlias ()])) {
4339 throw new MappingException (
@@ -52,11 +48,15 @@ public function __construct(array $mappings = null)
5248 }
5349
5450 /**
55- * @param array $array
51+ * @param string|array $mappedClass
52+ *
53+ * @return array
5654 */
57- public function setClassMap ( array $ array )
55+ protected function buildMapping ( $ mappedClass )
5856 {
59- $ this ->classMap = $ array ;
57+ return (is_string ($ mappedClass ) && class_exists ($ mappedClass , true )) ?
58+ MappingFactory::fromClass ($ mappedClass ) :
59+ MappingFactory::fromArray ($ mappedClass );
6060 }
6161
6262 /**
@@ -66,4 +66,12 @@ public function getClassMap()
6666 {
6767 return $ this ->classMap ;
6868 }
69+
70+ /**
71+ * @param array $array
72+ */
73+ public function setClassMap (array $ array )
74+ {
75+ $ this ->classMap = $ array ;
76+ }
6977}
You can’t perform that action at this time.
0 commit comments