Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
PerformanceWPCLI | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
12 |
1 | <?php |
2 | |
3 | namespace NewfoldLabs\WP\Module\Performance; |
4 | |
5 | use NewfoldLabs\WP\Module\Performance\Images\WPCLI\ImageCommandHandler; |
6 | use NewfoldLabs\WP\Module\Performance\LinkPrefetch\WPCLI\LinkPrefetchCommandHandler; |
7 | use NewfoldLabs\WP\Module\Performance\Cache\Types\WPCLI\CacheTypesCommandHandler; |
8 | |
9 | /** |
10 | * Manages all "wp nfd performance" WP-CLI commands. |
11 | */ |
12 | class PerformanceWPCLI { |
13 | /** |
14 | * Command namespace. |
15 | * |
16 | * @var string |
17 | */ |
18 | private static $cmd_namespace = 'performance'; |
19 | |
20 | /** |
21 | * List of performance-related WP-CLI commands. |
22 | * |
23 | * @var array |
24 | */ |
25 | private static $commands = array( |
26 | 'images' => ImageCommandHandler::class, |
27 | 'link_prefetch' => LinkPrefetchCommandHandler::class, |
28 | 'cache' => CacheTypesCommandHandler::class, |
29 | ); |
30 | |
31 | /** |
32 | * Constructor |
33 | */ |
34 | public function __construct() { |
35 | foreach ( self::$commands as $command => $handler ) { |
36 | if ( class_exists( $handler ) ) { |
37 | NFD_WPCLI::add_command( self::$cmd_namespace, $command, $handler ); |
38 | } |
39 | } |
40 | |
41 | new NFD_WPCLI(); |
42 | } |
43 | } |