Completed
Push — master ( d9189f...847185 )
by Jean-Christophe
03:54
created

AjaxTransition::jqFade()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
namespace Ajax\service;
3
use Ajax\semantic\html\base\constants\Transition;
4
5
class AjaxTransition {
6
	public static function none($responseElement,$jqueryDone="html"){
7
		return "$({$responseElement}).{$jqueryDone}( data )";
8
	}
9
10
	public static function jqFade($responseElement,$jqueryDone="html"){
11
		return "$({$responseElement}).hide().{$jqueryDone}( data ).fadeIn()";
12
	}
13
14
	public static function jqSlide($responseElement,$jqueryDone="html"){
15
		return "$({$responseElement}).hide().{$jqueryDone}( data ).slideDown()";
16
	}
17
18
	public static function random($responseElement,$jqueryDone="html"){
19
		$transitions=Transition::getConstantValues();
20
		$transition=$transitions[\rand(0,\sizeof($transitions)-1)];
21
		return self::__callStatic($transition, [$responseElement,$jqueryDone]);
22
	}
23
24
	public static function __callStatic($name, $arguments){
25
		if(\sizeof($arguments)==2){
26
			$responseElement=$arguments[0];
27
			$jqueryDone=$arguments[1];
28
			$name=JString::camelCaseToSeparated($name);
29
			return "$({$responseElement}).{$jqueryDone}( data ).transition('{$name} in')";
30
		}
31
	}
32
}