Completed
Push — master ( 40080a...3f2ff8 )
by Jean-Christophe
04:12 queued 01:14
created
Ajax/semantic/traits/SemanticWidgetsTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 	 * @param array $instances
14 14
 	 * @return ListView
15 15
 	 */
16
-	public function listView($identifier,$model, $instances){
17
-		return $this->addHtmlComponent(new ListView($identifier,$model,$instances));
16
+	public function listView($identifier, $model, $instances) {
17
+		return $this->addHtmlComponent(new ListView($identifier, $model, $instances));
18 18
 	}
19 19
 }
20 20
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/widgets/InstanceViewer.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -10,72 +10,72 @@  discard block
 block discarded – undo
10 10
 	private $visibleProperties;
11 11
 	private $values;
12 12
 
13
-	public function __construct($instance=NULL,$captions=NULL){
13
+	public function __construct($instance=NULL, $captions=NULL) {
14 14
 		$this->values=[];
15
-		if(isset($instance))
15
+		if (isset($instance))
16 16
 			$this->setInstance($instance);
17 17
 		$this->setCaptions($captions);
18 18
 	}
19 19
 
20
-	public function getCaption($index){
20
+	public function getCaption($index) {
21 21
 		return $this->properties[$index]->getName();
22 22
 	}
23 23
 
24
-	public function getCaptions(){
25
-		if(isset($this->captions)){
24
+	public function getCaptions() {
25
+		if (isset($this->captions)) {
26 26
 			return $this->captions;
27 27
 		}
28 28
 		$captions=[];
29 29
 		$index=0;
30 30
 		$count=$this->count();
31
-		while($index<$count){
31
+		while ($index<$count) {
32 32
 			$captions[]=$this->getCaption($index++);
33 33
 		}
34 34
 		return $captions;
35 35
 	}
36 36
 
37
-	public function getValues(){
37
+	public function getValues() {
38 38
 		$values=[];
39 39
 		$index=0;
40 40
 		$count=$this->count();
41
-		while($index<$count){
41
+		while ($index<$count) {
42 42
 			$values[]=$this->getValue($index++);
43 43
 		}
44 44
 		return $values;
45 45
 	}
46 46
 
47
-	public function getValue($index){
47
+	public function getValue($index) {
48 48
 		$this->properties[$index]->setAccessible(true);
49 49
 		$value=$this->properties[$index]->getValue($this->instance);
50
-		if(isset($this->values[$index])){
51
-			$value= $this->values[$index]($value);
50
+		if (isset($this->values[$index])) {
51
+			$value=$this->values[$index]($value);
52 52
 		}
53 53
 		return $value;
54 54
 	}
55 55
 
56
-	public function count(){
56
+	public function count() {
57 57
 		return \sizeof($this->properties);
58 58
 	}
59 59
 
60
-	public function showableProperty(\ReflectionProperty $rProperty){
61
-		if(\is_array($this->visibleProperties)){
60
+	public function showableProperty(\ReflectionProperty $rProperty) {
61
+		if (\is_array($this->visibleProperties)) {
62 62
 			return \array_search($rProperty->getName(), $this->visibleProperties);
63 63
 		}
64
-		return JString::startswith($rProperty->getName(),"_")===false;
64
+		return JString::startswith($rProperty->getName(), "_")===false;
65 65
 	}
66 66
 
67 67
 	public function setInstance($instance) {
68
-		if(\is_string($instance)){
68
+		if (\is_string($instance)) {
69 69
 			$instance=new $instance();
70 70
 		}
71 71
 		$this->instance=$instance;
72 72
 		$this->properties=[];
73 73
 		$this->reflect=new \ReflectionClass($instance);
74 74
 		$properties=$this->reflect->getProperties();
75
-		foreach ($properties as $property){
75
+		foreach ($properties as $property) {
76 76
 			$showable=$this->showableProperty($property);
77
-			if($showable!==false){
78
-				if(\is_int($showable))
77
+			if ($showable!==false) {
78
+				if (\is_int($showable))
79 79
 					$this->properties[$showable]=$property;
80 80
 				else
81 81
 					$this->properties[]=$property;
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 		return $this;
95 95
 	}
96 96
 
97
-	public function setValueFunction($index,$callback){
97
+	public function setValueFunction($index, $callback) {
98 98
 		$this->values[$index]=$callback;
99 99
 	}
100 100
 
Please login to merge, or discard this patch.
Ajax/semantic/widgets/ListView.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -9,26 +9,26 @@  discard block
 block discarded – undo
9 9
 class ListView extends Widget {
10 10
 
11 11
 
12
-	public function run(JsUtils $js){
12
+	public function run(JsUtils $js) {
13 13
 		parent::run($js);
14 14
 	}
15 15
 
16
-	public function __construct($identifier,$model,$modelInstance=NULL) {
17
-		parent::__construct($identifier, $model,$modelInstance);
16
+	public function __construct($identifier, $model, $modelInstance=NULL) {
17
+		parent::__construct($identifier, $model, $modelInstance);
18 18
 		$this->_instanceViewer=new InstanceViewer();
19 19
 	}
20 20
 
21
-	public function compile(JsUtils $js=NULL,&$view=NULL){
21
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
22 22
 		$this->_instanceViewer->setInstance($this->_model);
23 23
 		$captions=$this->_instanceViewer->getCaptions();
24
-		$table=new HtmlTable($this->identifier,0,\sizeof($captions));
24
+		$table=new HtmlTable($this->identifier, 0, \sizeof($captions));
25 25
 		$table->setHeaderValues($captions);
26
-		$table->fromDatabaseObjects($this->_modelInstance, function($instance){
26
+		$table->fromDatabaseObjects($this->_modelInstance, function($instance) {
27 27
 			$this->_instanceViewer->setInstance($instance);
28 28
 			return $this->_instanceViewer->getValues();
29 29
 		});
30 30
 		$this->content=$table;
31
-		return parent::compile($js,$view);
31
+		return parent::compile($js, $view);
32 32
 	}
33 33
 
34 34
 	public function getInstanceViewer() {
@@ -40,17 +40,17 @@  discard block
 block discarded – undo
40 40
 		return $this;
41 41
 	}
42 42
 
43
-	public function setCaptions($captions){
43
+	public function setCaptions($captions) {
44 44
 		$this->_instanceViewer->setCaptions($captions);
45 45
 		return $this;
46 46
 	}
47 47
 
48
-	public function setFields($fields){
48
+	public function setFields($fields) {
49 49
 		$this->_instanceViewer->setVisibleProperties($fields);
50 50
 		return $this;
51 51
 	}
52 52
 
53
-	public function setValueFunction($index,$callback){
53
+	public function setValueFunction($index, $callback) {
54 54
 		$this->_instanceViewer->setValueFunction($index, $callback);
55 55
 		return $this;
56 56
 	}
Please login to merge, or discard this patch.
Ajax/common/Widget.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,15 +10,15 @@
 block discarded – undo
10 10
 	protected $_modelInstance;
11 11
 	protected $_instanceViewer;
12 12
 
13
-	public function __construct($identifier,$model,$modelInstance=NULL) {
13
+	public function __construct($identifier, $model, $modelInstance=NULL) {
14 14
 		parent::__construct($identifier);
15 15
 		$this->_template="%wrapContentBefore%%content%%wrapContentAfter%";
16 16
 		$this->setModel($model);
17
-		if(isset($modelInstance));
17
+		if (isset($modelInstance));
18 18
 			$this->show($modelInstance);
19 19
 	}
20 20
 
21
-	public function show($modelInstance){
21
+	public function show($modelInstance) {
22 22
 		$this->_modelInstance=$modelInstance;
23 23
 	}
24 24
 
Please login to merge, or discard this patch.