-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGenerator_Definer.php
More file actions
52 lines (42 loc) · 2.46 KB
/
Copy pathGenerator_Definer.php
File metadata and controls
52 lines (42 loc) · 2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php declare(strict_types=1);
namespace Tribe\Libs\Generators;
use DI;
use Psr\Container\ContainerInterface;
use Tribe\Libs\CLI\CLI_Definer;
use Tribe\Libs\Container\Definer_Interface;
class Generator_Definer implements Definer_Interface {
public const SRC_PATH = 'libs.generator.path.src';
public const THEME_PATH = 'libs.generator.path.theme';
public const TESTS_PATH = 'libs.generator.path.tests';
public function define(): array {
return [
self::SRC_PATH => static fn( ContainerInterface $container ) => plugin_dir_path( $container->get( 'plugin.file' ) ) . 'src',
self::THEME_PATH => static fn( ContainerInterface $container ) => get_template_directory(),
self::TESTS_PATH => static fn() => trailingslashit( realpath( ABSPATH . '/../dev/tests/tests' ) ),
File_System::class => DI\create(),
CLI_Generator::class => DI\create()->constructor( DI\get( File_System::class ), DI\get( self::SRC_PATH ) ),
CPT_Generator::class => DI\create()->constructor( DI\get( File_System::class ), DI\get( self::SRC_PATH ) ),
Component_Generator::class => DI\create()->constructor( DI\get( File_System::class ), DI\get( self::SRC_PATH ), DI\get( self::THEME_PATH ) ),
Block_Generator::class => DI\create()->constructor( DI\get( File_System::class ), DI\get( self::SRC_PATH ), DI\get( self::THEME_PATH ) ),
Block_Middleware_Generator::class => DI\create()->constructor( DI\get( File_System::class ), DI\get( self::SRC_PATH ), DI\get( self::TESTS_PATH ) ),
Settings_Generator::class => DI\create()->constructor( DI\get( File_System::class ), DI\get( self::SRC_PATH ) ),
Taxonomy_Generator::class => DI\create()->constructor( DI\get( File_System::class ), DI\get( self::SRC_PATH ) ),
Image_Size_Generator::class => DI\create()->constructor( DI\get( File_System::class ), DI\get( self::SRC_PATH ) ),
Meta_Importer::class => DI\create()->constructor( DI\get( File_System::class ), DI\get( self::SRC_PATH ) ),
/**
* Add commands for the CLI subscriber to register
*/
CLI_Definer::COMMANDS => DI\add( [
DI\get( CLI_Generator::class ),
DI\get( CPT_Generator::class ),
DI\get( Component_Generator::class ),
DI\get( Block_Generator::class ),
DI\get( Block_Middleware_Generator::class ),
DI\get( Settings_Generator::class ),
DI\get( Taxonomy_Generator::class ),
DI\get( Image_Size_Generator::class ),
DI\get( Meta_Importer::class ),
] ),
];
}
}