Passed
Push — master ( 7a143e...62bba1 )
by Jean-Christophe
05:53
created

ShieldonManager::getFirewall()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 1
c 1
b 0
f 1
dl 0
loc 2
rs 10
cc 1
nc 1
nop 0
1
<?php
2
namespace Ubiquity\security\shieldon;
3
4
use Psr\Http\Message\ResponseInterface;
0 ignored issues
show
Bug introduced by
The type Psr\Http\Message\ResponseInterface 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...
5
use Shieldon\Firewall\Firewall;
0 ignored issues
show
Bug introduced by
The type Shieldon\Firewall\Firewall 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...
6
use Shieldon\Firewall\HttpResolver;
0 ignored issues
show
Bug introduced by
The type Shieldon\Firewall\HttpResolver 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...
7
use Shieldon\Firewall\Panel;
0 ignored issues
show
Bug introduced by
The type Shieldon\Firewall\Panel 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...
8
9
/**
10
 * Ubiquity\security\shieldon$ShieldonManager
11
 * This class is part of Ubiquity
12
 *
13
 * @author jc
14
 * @version 1.0.0
15
 *
16
 */
17
class ShieldonManager {
18
19
	private static Firewall $firewall;
20
21
	public static function getFirewall(): Firewall {
22
		return self::$firewall;
23
	}
24
25
	public static function start(string $writable = null) {
26
		$writable ??= \ROOT . \DS . 'cache' . \DS . 'shieldon';
27
		self::$firewall = new Firewall();
28
		self::$firewall->configure($writable);
29
		$response = self::$firewall->run();
30
		if ($response->getStatusCode() !== 200) {
31
			$httpResolver = new HttpResolver();
32
			$httpResolver($response);
33
		}
34
	}
35
36
	public static function createPanel(string $uri): Panel {
37
		$panel = new Panel();
38
		self::$firewall->controlPanel($uri);
39
		return $panel;
40
	}
41
42
	public static function run(): ResponseInterface {
43
		return self::$firewall->run();
44
	}
45
}
46