Test Failed
Push — master ( 9608fc...ccdba4 )
by Jean-Christophe
07:46
created

BaseControllerCreator   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 15
dl 0
loc 31
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A addRoute() 0 7 2
A __construct() 0 5 1
1
<?php
2
3
namespace Ubiquity\scaffolding\creators;
4
5
use Ubiquity\utils\base\UString;
6
use Ubiquity\scaffolding\ScaffoldController;
7
use Ubiquity\controllers\Startup;
8
9
/**
10
 * Base class for class creation in scaffolding
11
 * Ubiquity\scaffolding\creators$BaseControllerCreator
12
 * This class is part of Ubiquity
13
 *
14
 * @author jcheron <[email protected]>
15
 * @version 1.0.0
16
 *
17
 */
18
abstract class BaseControllerCreator {
19
	protected $controllerName;
20
	protected $routePath;
21
	protected $views;
22
	protected $controllerNS;
23
24
	/**
25
	 *
26
	 * @var ScaffoldController
27
	 */
28
	protected $scaffoldController;
29
30
	public function __construct($controllerName, $routePath, $views) {
31
		$this->controllerName = $controllerName;
32
		$this->routePath = $routePath;
33
		$this->views = $views;
34
		$this->controllerNS = Startup::getNS ( "controllers" );
35
	}
36
37
	protected function addRoute($routePath) {
38
		if (! UString::startswith ( $routePath, "/" )) {
39
			$routePath = "/" . $routePath;
40
		}
41
		$routeName = $routePath;
42
		$routePath = "\n * @route(\"{$routePath}\",\"inherited\"=>true,\"automated\"=>true)";
0 ignored issues
show
Unused Code introduced by
The assignment to $routePath is dead and can be removed.
Loading history...
43
		return $routeName;
44
	}
45
46
	abstract public function create(ScaffoldController $scaffoldController);
47
48
	abstract protected function addViews(&$uses, &$messages, &$classContent);
49
}
50
51