RestApplication   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 23
ccs 6
cts 6
cp 1
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 10 2
1
<?php
2
/**
3
 * Application class intended for use with RestApiController
4
 *
5
 * @file      RestApplication.php
6
 *
7
 * PHP version 8.0+
8
 *
9
 * @author    Yancharuk Alexander <alex at itvault dot info>
10
 * @copyright © 2012-2021 Alexander Yancharuk <alex at itvault at info>
11
 * @date      2021-04-20 07:03
12
 * @license   The BSD 3-Clause License
13
 *            <https://tldrlegal.com/license/bsd-3-clause-license-(revised)>
14
 */
15
16
namespace Veles\Application;
17
18
use Veles\Application\Interfaces\ApplicationInterface;
19
use Veles\Application\Interfaces\RequestAwareInterface;
20
use Veles\Application\Interfaces\RouteAwareInterface;
21
use Exception;
22
use Veles\Application\Traits\RequestTrait;
23
use Veles\Application\Traits\RouteTrait;
24
use Veles\View\View;
25
26
/**
27
 * Class   RestApplication
28
 *
29
 * @author Yancharuk Alexander <alex at itvault dot info>
30
 */
31
class RestApplication implements
32
	ApplicationInterface,
33
	RequestAwareInterface,
34
	RouteAwareInterface
35
{
36
	use RequestTrait;
37
	use RouteTrait;
38
39
	/**
40
	 * Application start
41
	 *
42
	 * @throws Exception
43
	 */
44 1
	public function run(): void
45
	{
46 1
		$route      = $this->getRoute();
47 1
		$controller = $route->getController();
48
49 1
		if ($vars = $controller->setApplication($this)->index()) {
0 ignored issues
show
introduced by
The method index() does not exist on Veles\Controllers\BaseController. Maybe you want to declare this class abstract? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

49
		if ($vars = $controller->setApplication($this)->/** @scrutinizer ignore-call */ index()) {
Loading history...
50 1
			View::set($vars);
51
		}
52
53 1
		View::show($route->getTemplate());
54
	}
55
}
56