@@ -12,6 +12,7 @@ final class Autoloader
1212 // exclude files like filename.config.(php|yml)
1313 public const PHP = '/^[\w\d\-\_]+\.php$/ ' ;
1414 public const ANY_PHP = '/^[\w\d\-\_\.]+\.php$/ ' ;
15+ public const BLOCK_PHP = '/^[\w\d\-\_]+(Block)\.php$/ ' ;
1516 public const PAGE_PHP = '/^[\w\d\-\_]+(Page)\.php$/ ' ;
1617 public const USER_PHP = '/^[\w\d\-\_]+(User)\.php$/ ' ;
1718 public const YML = '/^[\w\d\-\_]+\.yml$/ ' ;
@@ -60,6 +61,14 @@ public function __construct(array $options = [])
6061 'require ' => true ,
6162 'lowercase ' => true ,
6263 ],
64+ 'blockmodels ' => [
65+ 'folder ' => 'models ' ,
66+ 'name ' => static ::BLOCK_PHP ,
67+ 'key ' => 'classname ' ,
68+ 'require ' => false ,
69+ 'lowercase ' => true ,
70+ 'map ' => [],
71+ ],
6372 'pagemodels ' => [
6473 'folder ' => 'models ' ,
6574 'name ' => static ::PAGE_PHP ,
@@ -158,7 +167,7 @@ private function registry(string $type): array
158167 }
159168 $ this ->registry [$ type ]['map ' ][$ class ] = $ file ->getRelativePathname ();
160169
161- foreach (['Page ' , 'User ' ] as $ suffix ) {
170+ foreach (['Page ' , 'User ' , ' Block ' ] as $ suffix ) {
162171 $ at = strpos ($ key , $ suffix );
163172 if ($ at === strlen ($ key ) - strlen ($ suffix )) {
164173 $ key = substr ($ key , 0 , -strlen ($ suffix ));
@@ -239,6 +248,11 @@ public function controllers(): array
239248 return $ this ->registry ('controllers ' );
240249 }
241250
251+ public function blockModels (): array
252+ {
253+ return $ this ->registry ('blockmodels ' );
254+ }
255+
242256 public function pageModels (): array
243257 {
244258 return $ this ->registry ('pagemodels ' );
0 commit comments