Completed
Push — master ( fc7c74...94aea7 )
by Jean-Christophe
04:24
created

JsUtils::getUrl()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Ajax\php\laravel;
4
5
6
class JsUtils extends \Ajax\JsUtils{
7
	public function getUrl($url){
8
		return $url;
9
	}
10 View Code Duplication
	public function addViewElement($identifier,$content,$view){
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
11
		$controls=$view->__get("q");
12
		if (isset($controls) === false) {
13
			$controls=array ();
14
		}
15
		$controls[$identifier]=$content;
16
		$view->__set("q", $controls);
17
	}
18
19
	public function createScriptVariable($view,$view_var, $output){
20
		$view->__set($view_var,$output);
21
	}
22
23 View Code Duplication
	public function forward($initialController,$controller,$action){
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
24
		$dispatcher = $initialController->dispatcher;
25
		$dispatcher->setControllerName($controller);
26
		$dispatcher->setActionName($action);
27
		$dispatcher->dispatch();
28
		$template=$initialController->view->getRender($dispatcher->getControllerName(), $dispatcher->getActionName(),$dispatcher->getParams(), function ($view) {
29
			$view->setRenderLevel(View::LEVEL_ACTION_VIEW);
30
		});
31
		return $template;
32
	}
33
34
	public function renderContent($view, $controller, $action, $params=NULL) {
35
		$template=$view->getRender($controller, $action, $params, function ($view) {
36
			$view->setRenderLevel(View::LEVEL_ACTION_VIEW);
37
		});
38
		return $template;
39
	}
40
41 View Code Duplication
	public function fromDispatcher($dispatcher){
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
42
		$params=$dispatcher->getParams();
43
		$action=$dispatcher->getActionName();
44
		$items=array($dispatcher->getControllerName());
45
		if(\sizeof($params)>0 || \strtolower($action)!="index" ){
46
			$items[]=$action;
47
			foreach ($params as $p){
48
				if(\is_object($p)===false)
49
					$items[]=$p;
50
			}
51
		}
52
		return $items;
53
	}
54
}