Completed
Push — master ( fff9f5...ef609f )
by Jean-Christophe
07:06
created

Jquery_   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 19
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A renderView() 0 5 1
A generateUrl() 0 4 1
1
<?php
2
namespace Ajax\php\symfony;
3
4
use Symfony\Component\HttpFoundation\Response;
5
use Symfony\Component\HttpFoundation\Request;
6
7
abstract class Jquery_ extends JsUtils {
8
	protected $container;
9
10
	/**
11
	 * @param string $viewName
12
	 * @param array $parameters
13
	 * @return Response
14
	 */
15
	public function renderView($viewName,$parameters=[]){
16
		$twig=$this->container->get("twig");
17
		$this->compile($parameters);
18
		return new Response($twig->render($viewName, $parameters));
19
	}
20
21
	public function generateUrl($path){
22
		$request=Request::createFromGlobals();
23
		return $request->getBaseUrl().$path;
24
	}
25
}
26