File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -127,25 +127,16 @@ public static function faker(): ?Generator
127127 */
128128 public function call (string $ class )
129129 {
130- if (empty ($ class ))
130+ $ class = trim ($ class );
131+
132+ if ($ class === '' )
131133 {
132134 throw new InvalidArgumentException ('No seeder was specified. ' );
133135 }
134136
135- $ path = str_replace ('.php ' , '' , $ class ) . '.php ' ;
136-
137- // If we have namespaced class, simply try to load it.
138- if (strpos ($ class , '\\' ) !== false )
137+ if (strpos ($ class , '\\' ) === false )
139138 {
140- /**
141- * @var Seeder
142- */
143- $ seeder = new $ class ($ this ->config );
144- }
145- // Otherwise, try to load the class manually.
146- else
147- {
148- $ path = $ this ->seedPath . $ path ;
139+ $ path = $ this ->seedPath . str_replace ('.php ' , '' , $ class ) . '.php ' ;
149140
150141 if (! is_file ($ path ))
151142 {
@@ -160,14 +151,13 @@ public function call(string $class)
160151 {
161152 require_once $ path ;
162153 }
163-
164- /**
165- * @var Seeder
166- */
167- $ seeder = new $ class ($ this ->config );
168154 // @codeCoverageIgnoreEnd
169155 }
170156
157+ /**
158+ * @var Seeder
159+ */
160+ $ seeder = new $ class ($ this ->config );
171161 $ seeder ->setSilent ($ this ->silent )->run ();
172162
173163 unset($ seeder );
Original file line number Diff line number Diff line change @@ -63,15 +63,15 @@ protected function arrayToXML(array $data, &$output)
6363 {
6464 foreach ($ data as $ key => $ value )
6565 {
66+ $ key = $ this ->normalizeXMLTag ($ key );
67+
6668 if (is_array ($ value ))
6769 {
68- $ key = $ this ->normalizeXMLTag ($ key );
6970 $ subnode = $ output ->addChild ("$ key " );
7071 $ this ->arrayToXML ($ value , $ subnode );
7172 }
7273 else
7374 {
74- $ key = $ this ->normalizeXMLTag ($ key );
7575 $ output ->addChild ("$ key " , htmlspecialchars ("$ value " ));
7676 }
7777 }
You can’t perform that action at this time.
0 commit comments