Test Failed
Push — develop ( db5b9c...b55dd4 )
by Paul
17:52
created

DynamicModule   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 9
c 1
b 0
f 0
dl 0
loc 20
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A load() 0 10 1
1
<?php
2
/**
3
 * Module: Dynamic Module class.
4
 *
5
 * @package MEE\Modules\DynamicModule
6
 * @since ??
7
 */
8
9
namespace MEE\Modules\DynamicModule;
10
11
if ( ! defined( 'ABSPATH' ) ) {
12
	die( 'Direct access forbidden.' );
13
}
14
15
use ET\Builder\Framework\DependencyManagement\Interfaces\DependencyInterface;
0 ignored issues
show
Bug introduced by
The type ET\Builder\Framework\Dep...ces\DependencyInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
use ET\Builder\Packages\ModuleLibrary\ModuleRegistration;
0 ignored issues
show
Bug introduced by
The type ET\Builder\Packages\Modu...rary\ModuleRegistration was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
17
use MEE\Modules\DynamicModule\DynamicModuleTrait;
18
19
/**
20
 * `DynamicModule` is consisted of functions used for Dynamic Module such as Front-End rendering, REST API Endpoints etc.
21
 *
22
 * This is a dependency class and can be used as a dependency for `DependencyTree`.
23
 *
24
 * @since ??
25
 */
26
class DynamicModule implements DependencyInterface {
27
	use DynamicModuleTrait\RenderCallbackTrait;
28
29
	/**
30
	 * Loads `DynamicModule` and registers Front-End render callback and REST API Endpoints.
31
	 *
32
	 * @since ??
33
	 *
34
	 * @return void
35
	 */
36
	public function load() {
37
		$module_json_folder_path = D5_EXTENSION_EXAMPLE_MODULES_JSON_PATH . 'dynamic-module/';
38
39
		add_action(
40
			'init',
41
			function() use ( $module_json_folder_path ) {
42
				ModuleRegistration::register_module(
43
					$module_json_folder_path,
44
					[
45
						'render_callback' => [ DynamicModule::class, 'render_callback' ],
46
					]
47
				);
48
			}
49
		);
50
	}
51
}
52