Passed
Push — master ( 379f19...9ce0c5 )
by
unknown
06:34
created

FlashServiceProvider   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 2
dl 0
loc 25
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 13 3
A boot() 0 3 1
1
<?php
2
3
namespace CarbonFramework\Flash;
4
5
use CarbonFramework\Framework;
6
use CarbonFramework\ServiceProviders\ServiceProviderInterface;
7
8
/**
9
 * Provide flash dependencies
10
 *
11
 * @codeCoverageIgnore
12
 */
13
class FlashServiceProvider implements ServiceProviderInterface {
14
	/**
15
	 * {@inheritDoc}
16
	 */
17
	public function register( $container ) {
18
		$container['framework.flash.flash'] = function( $c ) {
19
			$session = null;
20
			if ( isset( $c['framework.session'] ) ) {
21
				$session = $c['framework.session'];
22
			} else if ( isset( $_SESSION ) ) {
23
				$session = &$_SESSION;
24
			}
25
			return new \CarbonFramework\Flash\Flash( $session );
26
		};
27
28
		Framework::facade( 'Flash', \CarbonFramework\Flash\FlashFacade::class );
29
	}
30
31
	/**
32
	 * {@inheritDoc}
33
	 */
34
	public function boot( $container ) {
35
		// nothing to boot
36
	}
37
}
38