Failed Conditions
Branch refactor/kernels (f9ae97)
by Atanas
01:58
created

src/Routing/RoutingServiceProvider.php (1 issue)

Labels
Severity
1
<?php
2
/**
3
 * @package   WPEmerge
4
 * @author    Atanas Angelov <[email protected]>
5
 * @copyright 2018 Atanas Angelov
6
 * @license   https://www.gnu.org/licenses/gpl-2.0.html GPL-2.0
7
 * @link      https://wpemerge.com/
8
 */
9
10
namespace WPEmerge\Routing;
11
12
use WPEmerge\Facades\Application;
13
use WPEmerge\Facades\Route as RouteFacade;
0 ignored issues
show
The type WPEmerge\Facades\Route 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...
14
use WPEmerge\Routing\Conditions\ConditionFactory;
15
use WPEmerge\ServiceProviders\ServiceProviderInterface;
16
17
/**
18
 * Provide routing dependencies
19
 *
20
 * @codeCoverageIgnore
21
 */
22
class RoutingServiceProvider implements ServiceProviderInterface {
23
24
	/**
25
	 * Key=>Class dictionary of condition types
26
	 *
27
	 * @var array<string, string>
28
	 */
29
	protected static $condition_types = [
30
		'url' => \WPEmerge\Routing\Conditions\UrlCondition::class,
31
		'custom' => \WPEmerge\Routing\Conditions\CustomCondition::class,
32
		'multiple' => \WPEmerge\Routing\Conditions\MultipleCondition::class,
33
		'negate' => \WPEmerge\Routing\Conditions\NegateCondition::class,
34
		'post_id' => \WPEmerge\Routing\Conditions\PostIdCondition::class,
35
		'post_slug' => \WPEmerge\Routing\Conditions\PostSlugCondition::class,
36
		'post_status' => \WPEmerge\Routing\Conditions\PostStatusCondition::class,
37
		'post_template' => \WPEmerge\Routing\Conditions\PostTemplateCondition::class,
38
		'post_type' => \WPEmerge\Routing\Conditions\PostTypeCondition::class,
39
		'query_var' => \WPEmerge\Routing\Conditions\QueryVarCondition::class,
40
		'ajax' => \WPEmerge\Routing\Conditions\AjaxCondition::class,
41
		'admin' => \WPEmerge\Routing\Conditions\AdminCondition::class,
42
	];
43
44
	/**
45
	 * {@inheritDoc}
46
	 */
47
	public function register( $container ) {
48
		$container[ WPEMERGE_ROUTING_CONDITION_TYPES_KEY ] =
49
			static::$condition_types;
50
51
		$container[ WPEMERGE_ROUTING_ROUTER_KEY ] = function ( $c ) {
52
			return new Router( $c[ WPEMERGE_ROUTING_CONDITIONS_CONDITION_FACTORY_KEY ] );
53
		};
54
55
		$container[ WPEMERGE_ROUTING_CONDITIONS_CONDITION_FACTORY_KEY ] = function ( $c ) {
56
			return new ConditionFactory( $c[ WPEMERGE_ROUTING_CONDITION_TYPES_KEY ] );
57
		};
58
59
		$container[ WPEMERGE_ROUTING_ROUTE_REGISTRAR_KEY ] = $container->factory( function ( $c ) {
60
			return new RouteRegistrar( $c[ WPEMERGE_ROUTING_ROUTER_KEY ] );
61
		} );
62
63
		Application::facade( 'Route', RouteFacade::class );
64
	}
65
66
	/**
67
	 * {@inheritDoc}
68
	 */
69
	public function bootstrap( $container ) {
70
		// Nothing to bootstrap.
71
	}
72
}
73