MiddlewareServiceProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 7
c 1
b 0
f 0
dl 0
loc 22
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A bootstrap() 0 1 1
A register() 0 11 1
1
<?php
2
/**
3
 * @package   WPEmerge
4
 * @author    Atanas Angelov <[email protected]>
5
 * @copyright 2017-2019 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\Middleware;
11
12
use WPEmerge\ServiceProviders\ServiceProviderInterface;
13
14
/**
15
 * Provide middleware dependencies.
16
 *
17
 * @codeCoverageIgnore
18
 */
19
class MiddlewareServiceProvider implements ServiceProviderInterface {
20
	/**
21
	 * {@inheritDoc}
22
	 */
23
	public function register( $container ) {
24
		$container[ UserLoggedOutMiddleware::class ] = function ( $c ) {
25
			return new UserLoggedOutMiddleware( $c[ WPEMERGE_RESPONSE_SERVICE_KEY ] );
26
		};
27
28
		$container[ UserLoggedInMiddleware::class ] = function ( $c ) {
29
			return new UserLoggedInMiddleware( $c[ WPEMERGE_RESPONSE_SERVICE_KEY ] );
30
		};
31
32
		$container[ UserCanMiddleware::class ] = function ( $c ) {
33
			return new UserCanMiddleware( $c[ WPEMERGE_RESPONSE_SERVICE_KEY ] );
34
		};
35
	}
36
37
	/**
38
	 * {@inheritDoc}
39
	 */
40
	public function bootstrap( $container ) {
41
		// Nothing to bootstrap.
42
	}
43
}
44