Completed
Push — master ( 34fb15...fb7dfb )
by Jean-Christophe
02:52
created
Ajax/common/BaseEnum.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@  discard block
 block discarded – undo
12 12
 	private static $constCacheArray=NULL;
13 13
 
14 14
 	public static function getConstants() {
15
-		if (self::$constCacheArray == NULL) {
16
-			self::$constCacheArray=[ ];
15
+		if (self::$constCacheArray==NULL) {
16
+			self::$constCacheArray=[];
17 17
 		}
18 18
 		$calledClass=get_called_class();
19 19
 		if (!array_key_exists($calledClass, self::$constCacheArray)) {
@@ -23,16 +23,16 @@  discard block
 block discarded – undo
23 23
 		return self::$constCacheArray[$calledClass];
24 24
 	}
25 25
 
26
-	public static function getConstantValues($postFix="",$prefixBefore=false) {
27
-		if ($postFix == "")
26
+	public static function getConstantValues($postFix="", $prefixBefore=false) {
27
+		if ($postFix=="")
28 28
 			return \array_values(self::getConstants());
29 29
 		else {
30
-			if($prefixBefore===false){
31
-				return \array_map(function ($elem) use($postFix) {
32
-					return $elem . " " . $postFix;
30
+			if ($prefixBefore===false) {
31
+				return \array_map(function($elem) use($postFix) {
32
+					return $elem." ".$postFix;
33 33
 				}, \array_values(self::getConstants()));
34
-			}else{
35
-				return \array_map(function ($elem) use($postFix) {
34
+			} else {
35
+				return \array_map(function($elem) use($postFix) {
36 36
 					return $postFix." ".$elem;
37 37
 				}, \array_values(self::getConstants()));
38 38
 			}
Please login to merge, or discard this patch.
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,14 +24,14 @@
 block discarded – undo
24 24
 	}
25 25
 
26 26
 	public static function getConstantValues($postFix="",$prefixBefore=false) {
27
-		if ($postFix == "")
28
-			return \array_values(self::getConstants());
29
-		else {
27
+		if ($postFix == "") {
28
+					return \array_values(self::getConstants());
29
+		} else {
30 30
 			if($prefixBefore===false){
31 31
 				return \array_map(function ($elem) use($postFix) {
32 32
 					return $elem . " " . $postFix;
33 33
 				}, \array_values(self::getConstants()));
34
-			}else{
34
+			} else{
35 35
 				return \array_map(function ($elem) use($postFix) {
36 36
 					return $postFix." ".$elem;
37 37
 				}, \array_values(self::getConstants()));
Please login to merge, or discard this patch.
Ajax/common/JsCode.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 
26 26
 	public function compile($keyAndvalues) {
27 27
 		$result=$this->mask;
28
-		foreach ( $keyAndvalues as $k => $v ) {
28
+		foreach ($keyAndvalues as $k => $v) {
29 29
 			$result=str_ireplace("%{$k}%", $v, $result);
30 30
 		}
31 31
 		return $result;
Please login to merge, or discard this patch.
Ajax/common/html/html5/HtmlOption.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 class HtmlOption extends HtmlDoubleElement {
11 11
 	protected $value;
12 12
 	protected $selected;
13
-	public function __construct($identifier,$caption,$value="") {
13
+	public function __construct($identifier, $caption, $value="") {
14 14
 		parent::__construct($identifier, "option");
15 15
 		$this->_template='<option id="%identifier%" value="%value%" %selected% %properties%>%content%</option>';
16 16
 		$this->content=$caption;
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 		$this->selected="";
19 19
 	}
20 20
 
21
-	public function select(){
21
+	public function select() {
22 22
 		$this->selected="selected";
23 23
 		return $this;
24 24
 	}
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 		return $this->value;
28 28
 	}
29 29
 	public function setValue($value) {
30
-		$this->value = $value;
30
+		$this->value=$value;
31 31
 		return $this;
32 32
 	}
33 33
 
Please login to merge, or discard this patch.
Ajax/common/html/html5/HtmlImg.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 
8 8
 class HtmlImg extends HtmlSingleElement {
9 9
 
10
-	public function __construct($identifier,$src="",$alt="") {
10
+	public function __construct($identifier, $src="", $alt="") {
11 11
 		parent::__construct($identifier, "img");
12 12
 		$this->setSrc($src);
13 13
 		$this->setAlt($alt);
Please login to merge, or discard this patch.
Ajax/common/html/html5/HtmlList.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,8 @@
 block discarded – undo
14 14
 		parent::__construct($identifier, "ul");
15 15
 		$this->addItems($items);
16 16
 	}
17
-	public function setOrdered($ordered=true){
18
-		$this->tagName=($ordered===true)?"ol":"ul";
17
+	public function setOrdered($ordered=true) {
18
+		$this->tagName=($ordered===true) ? "ol" : "ul";
19 19
 	}
20 20
 
21 21
 	/**
Please login to merge, or discard this patch.
Ajax/common/html/html5/HtmlSelect.php 2 patches
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	public function addOption($element,$value="",$selected=false){
26 26
 		if($element instanceof HtmlOption){
27 27
 			$option=$element;
28
-		}else{
28
+		} else{
29 29
 			$option=new HtmlOption($this->identifier."-".count($this->options), $element,$value);
30 30
 		}
31 31
 		if($selected || $option->getValue()==$this->getProperty("value")){
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 			foreach ($array as $k=>$v){
65 65
 				$this->addOption($v, $k);
66 66
 			}
67
-		}else{
67
+		} else{
68 68
 			foreach ($array as $v){
69 69
 				$this->addOption($v, $v);
70 70
 			}
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 	private $default;
14 14
 	private $options;
15 15
 
16
-	public function __construct($identifier, $caption="",$default=NULL) {
16
+	public function __construct($identifier, $caption="", $default=NULL) {
17 17
 		parent::__construct($identifier, "select");
18 18
 		$this->setProperty("name", $identifier);
19 19
 		$this->setProperty("class", "form-control");
@@ -22,21 +22,21 @@  discard block
 block discarded – undo
22 22
 		$this->options=array();
23 23
 	}
24 24
 
25
-	public function addOption($element,$value="",$selected=false){
26
-		if($element instanceof HtmlOption){
25
+	public function addOption($element, $value="", $selected=false) {
26
+		if ($element instanceof HtmlOption) {
27 27
 			$option=$element;
28
-		}else{
29
-			$option=new HtmlOption($this->identifier."-".count($this->options), $element,$value);
28
+		} else {
29
+			$option=new HtmlOption($this->identifier."-".count($this->options), $element, $value);
30 30
 		}
31
-		if($selected || $option->getValue()==$this->getProperty("value")){
31
+		if ($selected || $option->getValue()==$this->getProperty("value")) {
32 32
 			$option->select();
33 33
 		}
34 34
 		$this->options[]=$option;
35 35
 	}
36 36
 
37 37
 	public function setValue($value) {
38
-		foreach ( $this->options as $option ) {
39
-			if (strcasecmp($option->getValue(),$value)===0) {
38
+		foreach ($this->options as $option) {
39
+			if (strcasecmp($option->getValue(), $value)===0) {
40 40
 				$option->setProperty("selected", "");
41 41
 			}
42 42
 		}
@@ -49,23 +49,23 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
51 51
 		$this->content=array();
52
-		if(isset($this->default)){
52
+		if (isset($this->default)) {
53 53
 			$default=new HtmlOption("", $this->default);
54 54
 			$this->content[]=$default;
55 55
 		}
56
-		foreach ($this->options as $option){
56
+		foreach ($this->options as $option) {
57 57
 			$this->content[]=$option;
58 58
 		}
59 59
 		return parent::compile($js, $view);
60 60
 	}
61 61
 
62
-	public function fromArray($array){
63
-		if(JArray::isAssociative($array)){
64
-			foreach ($array as $k=>$v){
62
+	public function fromArray($array) {
63
+		if (JArray::isAssociative($array)) {
64
+			foreach ($array as $k=>$v) {
65 65
 				$this->addOption($v, $k);
66 66
 			}
67
-		}else{
68
-			foreach ($array as $v){
67
+		} else {
68
+			foreach ($array as $v) {
69 69
 				$this->addOption($v, $v);
70 70
 			}
71 71
 		}
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 		$this->addOption($function($object));
99 99
 	}
100 100
 
101
-	public function setSize($size){
101
+	public function setSize($size) {
102 102
 		return $this->setProperty("size", $size);
103 103
 	}
104 104
 }
Please login to merge, or discard this patch.
Ajax/php/symfony/JsUtils.php 3 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -48,15 +48,15 @@
 block discarded – undo
48 48
 	}
49 49
 
50 50
 	public function renderContent($initialControllerInstance,$viewName, $params=NULL) {
51
-        if ($initialControllerInstance->has('templating')) {
52
-            return $initialControllerInstance->get('templating')->render($viewName, $params);
53
-        }
51
+		if ($initialControllerInstance->has('templating')) {
52
+			return $initialControllerInstance->get('templating')->render($viewName, $params);
53
+		}
54 54
 
55
-        if (!$initialControllerInstance->has('twig')) {
56
-            throw new \LogicException('You can not use the "renderView" method if the Templating Component or the Twig Bundle are not available.');
57
-        }
55
+		if (!$initialControllerInstance->has('twig')) {
56
+			throw new \LogicException('You can not use the "renderView" method if the Templating Component or the Twig Bundle are not available.');
57
+		}
58 58
 
59
-        return $initialControllerInstance->get('twig')->render($viewName, $params);
59
+		return $initialControllerInstance->get('twig')->render($viewName, $params);
60 60
 	}
61 61
 
62 62
 	public function fromDispatcher($dispatcher){
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -6,27 +6,27 @@  discard block
 block discarded – undo
6 6
 use Symfony\Component\HttpFoundation\Request;
7 7
 use Symfony\Component\HttpKernel\HttpKernelInterface;
8 8
 use Ajax\service\JString;
9
-class JsUtils extends \Ajax\JsUtils{
10
-	public function getUrl($url){
9
+class JsUtils extends \Ajax\JsUtils {
10
+	public function getUrl($url) {
11 11
 		//$request = Request::createFromGlobals();
12 12
 		$router=$this->getInjected();
13
-		if(isset($router)){
13
+		if (isset($router)) {
14 14
 			try {
15 15
 			$url=$router->generate($url);
16
-			}catch (\Exception $e){
16
+			}catch (\Exception $e) {
17 17
 				return $router->getContext()->getBaseUrl();
18 18
 			}
19 19
 		}
20 20
 		return $url;
21 21
 	}
22
-	public function addViewElement($identifier,$content,&$view){
23
-		if(\array_key_exists("q", $view)===false){
22
+	public function addViewElement($identifier, $content, &$view) {
23
+		if (\array_key_exists("q", $view)===false) {
24 24
 			$view["q"]=array();
25 25
 		}
26 26
 		$view["q"][$identifier]=$content;
27 27
 	}
28 28
 
29
-	public function createScriptVariable(&$view,$view_var, $output){
29
+	public function createScriptVariable(&$view, $view_var, $output) {
30 30
 		$view[$view_var]=$output;
31 31
 	}
32 32
 
@@ -37,17 +37,17 @@  discard block
 block discarded – undo
37 37
 	 * @param array $params
38 38
 	 * @see \Ajax\JsUtils::forward()
39 39
 	 */
40
-	public function forward($initialControllerInstance,$controllerName,$actionName,$params=array()){
40
+	public function forward($initialControllerInstance, $controllerName, $actionName, $params=array()) {
41 41
 		$path=$params;
42
-		$request = $initialControllerInstance->get('request_stack')->getCurrentRequest();
43
-		$path['_forwarded'] = $request->attributes;
44
-		$path['_controller'] = $controllerName.":".$actionName;
45
-		$subRequest = $request->duplicate([], null, $path);
46
-		$response= $initialControllerInstance->get('http_kernel')->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
42
+		$request=$initialControllerInstance->get('request_stack')->getCurrentRequest();
43
+		$path['_forwarded']=$request->attributes;
44
+		$path['_controller']=$controllerName.":".$actionName;
45
+		$subRequest=$request->duplicate([], null, $path);
46
+		$response=$initialControllerInstance->get('http_kernel')->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
47 47
 		return $response->getContent();
48 48
 	}
49 49
 
50
-	public function renderContent($initialControllerInstance,$viewName, $params=NULL) {
50
+	public function renderContent($initialControllerInstance, $viewName, $params=NULL) {
51 51
         if ($initialControllerInstance->has('templating')) {
52 52
             return $initialControllerInstance->get('templating')->render($viewName, $params);
53 53
         }
@@ -59,10 +59,10 @@  discard block
 block discarded – undo
59 59
         return $initialControllerInstance->get('twig')->render($viewName, $params);
60 60
 	}
61 61
 
62
-	public function fromDispatcher($dispatcher){
63
-		$request = $dispatcher->get('request_stack')->getCurrentRequest();
62
+	public function fromDispatcher($dispatcher) {
63
+		$request=$dispatcher->get('request_stack')->getCurrentRequest();
64 64
 		$uri=$request->getPathInfo();
65
-		if(JString::startswith($uri, "/")){
65
+		if (JString::startswith($uri, "/")) {
66 66
 			$uri=\substr($uri, 1);
67 67
 		}
68 68
 		return \explode("/", $uri);
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 		if(isset($router)){
14 14
 			try {
15 15
 			$url=$router->generate($url);
16
-			}catch (\Exception $e){
16
+			} catch (\Exception $e){
17 17
 				return $router->getContext()->getBaseUrl();
18 18
 			}
19 19
 		}
Please login to merge, or discard this patch.
Ajax/php/phalcon/JsUtils.php 2 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 use Phalcon\Mvc\View;
8 8
 use Phalcon\Mvc\Controller;
9 9
 
10
-class JsUtils extends \Ajax\JsUtils implements InjectionAwareInterface{
10
+class JsUtils extends \Ajax\JsUtils implements InjectionAwareInterface {
11 11
 	protected $_di;
12 12
 	public function setDi(DiInterface $di) {
13 13
 		$this->_di=$di;
@@ -18,50 +18,50 @@  discard block
 block discarded – undo
18 18
 		return $this->_di;
19 19
 	}
20 20
 
21
-	public function getUrl($url){
21
+	public function getUrl($url) {
22 22
 		return $this->_di->get("url")->get($url);
23 23
 	}
24 24
 
25
-	public function addViewElement($identifier,$content,&$view){
25
+	public function addViewElement($identifier, $content, &$view) {
26 26
 		$controls=$view->getVar("q");
27
-		if (isset($controls) === false) {
28
-			$controls=array ();
27
+		if (isset($controls)===false) {
28
+			$controls=array();
29 29
 		}
30 30
 		$controls[$identifier]=$content;
31 31
 		$view->setVar("q", $controls);
32 32
 	}
33 33
 
34
-	public function createScriptVariable(&$view,$view_var, $output){
35
-		$view->setVar($view_var,$output);
34
+	public function createScriptVariable(&$view, $view_var, $output) {
35
+		$view->setVar($view_var, $output);
36 36
 	}
37 37
 
38
-	public function forward($initialController,$controller,$action,$params=array()){
39
-		$dispatcher = $initialController->dispatcher;
38
+	public function forward($initialController, $controller, $action, $params=array()) {
39
+		$dispatcher=$initialController->dispatcher;
40 40
 		$dispatcher->setControllerName($controller);
41 41
 		$dispatcher->setActionName($action);
42 42
 		$dispatcher->dispatch();
43
-		$template=$initialController->view->getRender($dispatcher->getControllerName(), $dispatcher->getActionName(),$dispatcher->getParams(), function ($view) {
43
+		$template=$initialController->view->getRender($dispatcher->getControllerName(), $dispatcher->getActionName(), $dispatcher->getParams(), function($view) {
44 44
 			$view->setRenderLevel(View::LEVEL_ACTION_VIEW);
45 45
 		});
46 46
 		return $template;
47 47
 	}
48 48
 
49
-	public function renderContent($initialControllerInstance,$viewName, $params=NULL) {
50
-		list($controller,$action)=\explode("@", $viewName);
51
-		$template=$initialControllerInstance->view->getRender($controller, $action, $params, function ($view) {
49
+	public function renderContent($initialControllerInstance, $viewName, $params=NULL) {
50
+		list($controller, $action)=\explode("@", $viewName);
51
+		$template=$initialControllerInstance->view->getRender($controller, $action, $params, function($view) {
52 52
 			$view->setRenderLevel(View::LEVEL_ACTION_VIEW);
53 53
 		});
54 54
 		return $template;
55 55
 	}
56 56
 
57
-	public function fromDispatcher($dispatcher){
57
+	public function fromDispatcher($dispatcher) {
58 58
 		$params=$dispatcher->getParams();
59 59
 		$action=$dispatcher->getActionName();
60 60
 		$items=array($dispatcher->getControllerName());
61
-		if(\sizeof($params)>0 || \strtolower($action)!="index" ){
61
+		if (\sizeof($params)>0 || \strtolower($action)!="index") {
62 62
 			$items[]=$action;
63
-			foreach ($params as $p){
64
-				if(\is_object($p)===false)
63
+			foreach ($params as $p) {
64
+				if (\is_object($p)===false)
65 65
 					$items[]=$p;
66 66
 			}
67 67
 		}
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,8 +61,9 @@
 block discarded – undo
61 61
 		if(\sizeof($params)>0 || \strtolower($action)!="index" ){
62 62
 			$items[]=$action;
63 63
 			foreach ($params as $p){
64
-				if(\is_object($p)===false)
65
-					$items[]=$p;
64
+				if(\is_object($p)===false) {
65
+									$items[]=$p;
66
+				}
66 67
 			}
67 68
 		}
68 69
 		return $items;
Please login to merge, or discard this patch.
Ajax/php/yii/JsUtils.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@
 block discarded – undo
6 6
 
7 7
 class JsUtils extends \Ajax\JsUtils{
8 8
 	public function getUrl($url){
9
-		if($url==="")
10
-			$url="/";
9
+		if($url==="") {
10
+					$url="/";
11
+		}
11 12
 		return Url::toRoute($url);
12 13
 	}
13 14
 
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -4,14 +4,14 @@  discard block
 block discarded – undo
4 4
 
5 5
 use yii\helpers\Url;
6 6
 
7
-class JsUtils extends \Ajax\JsUtils{
8
-	public function getUrl($url){
9
-		if($url==="")
7
+class JsUtils extends \Ajax\JsUtils {
8
+	public function getUrl($url) {
9
+		if ($url==="")
10 10
 			$url="/";
11 11
 		return Url::toRoute($url);
12 12
 	}
13 13
 
14
-	public function addViewElement($identifier,$content,&$view){
14
+	public function addViewElement($identifier, $content, &$view) {
15 15
 		$params=$view->params;
16 16
 		if (\array_key_exists("q", $params)===false) {
17 17
 			$view->params["q"]=array();
@@ -19,11 +19,11 @@  discard block
 block discarded – undo
19 19
 		$view->params["q"][$identifier]=$content;
20 20
 	}
21 21
 
22
-	public function createScriptVariable(&$view,$view_var, $output){
22
+	public function createScriptVariable(&$view, $view_var, $output) {
23 23
 		$view->params[$view_var]=$output;
24 24
 	}
25 25
 
26
-	public function forward($initialControllerInstance,$controllerName,$actionName,$params=array()){
26
+	public function forward($initialControllerInstance, $controllerName, $actionName, $params=array()) {
27 27
 		\ob_start();
28 28
 		$ctrInfo=\yii::$app->createController($controllerName."/".$actionName);
29 29
 		$ctrInfo[0]->{$ctrInfo[1]}($params);
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
 		return $result;
33 33
 	}
34 34
 
35
-	public function renderContent($initialControllerInstance,$viewName, $params=NULL) {
36
-		return \yii::$app->view->render($viewName,$params);
35
+	public function renderContent($initialControllerInstance, $viewName, $params=NULL) {
36
+		return \yii::$app->view->render($viewName, $params);
37 37
 	}
38 38
 
39
-	public function fromDispatcher($dispatcher){
39
+	public function fromDispatcher($dispatcher) {
40 40
 		$uri=new \Ajax\php\yii\URI();
41 41
 		return $uri->segment_array();
42 42
 	}
Please login to merge, or discard this patch.