77use Magento \Framework \App \Filesystem \DirectoryList ;
88use Magento \Framework \Console \Cli ;
99use Magento \Framework \Filesystem ;
10- use Magento \Framework \Filesystem \Directory \WriteInterface ;
1110use OpenForgeProject \MageForge \Console \Command \AbstractCommand ;
1211use OpenForgeProject \MageForge \Model \ThemeList ;
1312use OpenForgeProject \MageForge \Model \ThemePath ;
@@ -118,8 +117,8 @@ private function cleanViewPreprocessed(string $themeName): int
118117 $ varDirectory = $ this ->filesystem ->getDirectoryWrite (DirectoryList::VAR_DIR );
119118
120119 // Extract vendor and theme parts
121- $ themeParts = explode ( ' / ' , $ themeName );
122- if (count ( $ themeParts) !== 2 ) {
120+ $ themeParts = $ this -> parseThemeName ( $ themeName );
121+ if ($ themeParts === null ) {
123122 return 0 ;
124123 }
125124
@@ -164,8 +163,8 @@ private function cleanPubStatic(string $themeName): int
164163 $ staticDirectory = $ this ->filesystem ->getDirectoryWrite (DirectoryList::STATIC_VIEW );
165164
166165 // Extract vendor and theme parts
167- $ themeParts = explode ( ' / ' , $ themeName );
168- if (count ( $ themeParts) !== 2 ) {
166+ $ themeParts = $ this -> parseThemeName ( $ themeName );
167+ if ($ themeParts === null ) {
169168 return 0 ;
170169 }
171170
@@ -191,4 +190,20 @@ private function cleanPubStatic(string $themeName): int
191190
192191 return $ cleaned ;
193192 }
193+
194+ /**
195+ * Parse theme name into vendor and theme parts
196+ *
197+ * @param string $themeName
198+ * @return array|null Array with [vendor, theme] or null if invalid format
199+ */
200+ private function parseThemeName (string $ themeName ): ?array
201+ {
202+ $ themeParts = explode ('/ ' , $ themeName );
203+ if (count ($ themeParts ) !== 2 ) {
204+ return null ;
205+ }
206+
207+ return $ themeParts ;
208+ }
194209}
0 commit comments