Passed
Push — master ( b7467b...db04eb )
by Atanas
02:41
created

FlashServiceProvider::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Obsidian\Flash;
4
5
use Obsidian\Framework;
6
use Obsidian\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 \Obsidian\Flash\Flash( $session );
26
		};
27
28
		Framework::facade( 'Flash', \Obsidian\Flash\FlashFacade::class );
29
	}
30
31
	/**
32
	 * {@inheritDoc}
33
	 */
34
	public function boot( $container ) {
35
		// nothing to boot
36
	}
37
}
38