1- <?php //phpcs:disable WordPress.NamingConventions.ValidVariableName
1+ <?php //phpcs:disable WordPress.NamingConventions.ValidVariableName, Squiz.PHP.CommentedOutCode.Found, Squiz.Commenting.InlineComment.InvalidEndChar
22/**
33 * Builder class file.
44 *
@@ -86,7 +86,7 @@ public function enableCompilation(
8686 * @return static
8787 */
8888 public function enableDefinitionCache ( string $ cacheNamespace = '' , bool $ enableCache = false ): static {
89- return $ enableCache
89+ return $ enableCache && ! \defined ( ' WP_CLI ' )
9090 ? parent ::enableDefinitionCache ( \rtrim ( $ cacheNamespace , '. ' ) . '. ' )
9191 : $ this ;
9292 }
@@ -116,30 +116,35 @@ public function enableHookCache( bool $enableCache, string $cacheDirectory ): st
116116 */
117117 public function addBaseDefinition ( array $ config ): App_Builder {
118118 $ definition = array (
119- 'xwp. app ' => \DI \get ( 'Module- ' . $ config ['app_module ' ] ),
120- 'xwp. app.cache ' => \DI \value (
119+ 'app ' => \DI \get ( 'Module- ' . $ config ['app_module ' ] ),
120+ 'app.cache ' => \DI \value (
121121 array (
122122 'app ' => $ config ['cache_app ' ],
123123 'defs ' => $ config ['cache_defs ' ],
124124 'dir ' => $ config ['cache_dir ' ],
125125 'hooks ' => $ config ['cache_hooks ' ],
126+ 'ns ' => $ config ['app_id ' ],
126127 ),
127128 ),
128- 'xwp.app.debug ' => \DI \value ( \defined ( 'WP_DEBUG ' ) && WP_DEBUG ),
129- 'xwp.app.env ' => \DI \factory ( 'wp_get_environment_type ' ),
130- 'xwp.app.id ' => \DI \value ( $ config ['app_id ' ] ),
131- 'xwp.app.module ' => \DI \value ( $ config ['app_module ' ] ),
132- 'xwp.app.type ' => \DI \value ( $ config ['app_type ' ] ),
133- 'xwp.app.uuid ' => \DI \factory ( 'wp_generate_uuid4 ' ),
134- 'xwp.app.ver ' => \DI \value ( $ config ['app_version ' ] ),
129+ 'app.debug ' => \DI \value ( \defined ( 'WP_DEBUG ' ) && WP_DEBUG ),
130+ 'app.env ' => \DI \factory ( 'wp_get_environment_type ' ),
131+ 'app.extend ' => \DI \value ( $ config ['extendable ' ] ),
132+ 'app.id ' => \DI \value ( $ config ['app_id ' ] ),
133+ 'app.module ' => \DI \value ( $ config ['app_module ' ] ),
134+ 'app.type ' => \DI \value ( $ config ['app_type ' ] ),
135+ 'app.uuid ' => \DI \factory ( 'wp_generate_uuid4 ' ),
136+ 'app.ver ' => \DI \value ( $ config ['app_version ' ] ),
135137 );
136138
137139 if ( $ config ['app_file ' ] && 'plugin ' === $ config ['app_type ' ] ) {
138- $ definition ['xwp.app.file ' ] = \DI \value ( $ config ['app_file ' ] );
139- $ definition ['xwp.app.base ' ] = \DI \factory ( 'plugin_basename ' , )
140- ->parameter ( 'file ' , \DI \get ( 'xwp.app.file ' ) );
141- $ definition ['xwp.app.path ' ] = \DI \factory ( 'plugin_dir_path ' )
142- ->parameter ( 'file ' , \DI \get ( 'xwp.app.file ' ) );
140+ $ definition ['app.file ' ] = \DI \value ( $ config ['app_file ' ] );
141+ $ definition ['app.base ' ] = \DI \factory ( 'plugin_basename ' , )
142+ ->parameter ( 'file ' , \DI \get ( 'app.file ' ) );
143+ $ definition ['app.path ' ] = \DI \factory ( 'plugin_dir_path ' )
144+ ->parameter ( 'file ' , \DI \get ( 'app.file ' ) );
145+ $ definition ['app.url ' ] = \DI \factory ( 'plugin_dir_url ' )
146+ ->parameter ( 'file ' , \DI \get ( 'app.file ' ) );
147+
143148 }
144149
145150 return parent ::addDefinitions ( $ definition );
@@ -152,12 +157,18 @@ public function addBaseDefinition( array $config ): App_Builder {
152157 * @return App_Builder
153158 */
154159 public function addModuleDefinition ( array $ config ): App_Builder {
155- $ parser = new Parser ( $ config ['app_module ' ] );
160+ $ parser = ( new Parser ( $ config ['app_module ' ], $ config ['app_id ' ] ) )
161+ ->set_extendable ( $ config ['extendable ' ] );
156162
157163 $ defns = $ this ->isHookCacheEnabled ()
158164 ? ( new Compiler ( $ parser ) )->compile ( $ config ['cache_dir ' ] )
159165 : $ parser ->make ()->get_parsed ();
160166
167+ // if ( 'woosync' === $config['app_id'] ) {
168+ // \dump( $defns );
169+ // die;
170+ // }
171+
161172 return $ this ->addDefinitions ( $ defns );
162173 }
163174
0 commit comments