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

AjaxTransition   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 2
dl 0
loc 28
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A none() 0 3 1
A jqFade() 0 3 1
A jqSlide() 0 3 1
A random() 0 5 1
A __callStatic() 0 8 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
}