Completed
Push — intl ( b391f2...20c33e )
by Fabio
08:04
created
framework/Web/UI/WebControls/TClientScript.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -105,11 +105,11 @@  discard block
 block discarded – undo
105 105
 	public function onPreRender($param)
106 106
 	{
107 107
 		parent::onPreRender($param);
108
-		$scripts = preg_split('/,|\s+/', $this->getPradoScripts());
109
-		$cs = $this->getPage()->getClientScript();
108
+		$scripts=preg_split('/,|\s+/', $this->getPradoScripts());
109
+		$cs=$this->getPage()->getClientScript();
110 110
 		foreach($scripts as $script)
111 111
 		{
112
-			if(($script = trim($script))!=='')
112
+			if(($script=trim($script))!=='')
113 113
 				$cs->registerPradoScript($script);
114 114
 		}
115 115
 	}
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	public function render($writer)
124 124
 	{
125
-		if ($this->getFlushScriptFiles())
125
+		if($this->getFlushScriptFiles())
126 126
 			$this->getPage()->getClientScript()->flushScriptFiles($writer, $this);
127 127
 		$this->renderCustomScriptFile($writer);
128 128
 		$this->renderCustomScript($writer);
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	protected function renderCustomScriptFile($writer)
136 136
 	{
137
-		if(($scriptUrl = $this->getScriptUrl())!=='')
137
+		if(($scriptUrl=$this->getScriptUrl())!=='')
138 138
 			$writer->write("<script type=\"text/javascript\" src=\"$scriptUrl\"></script>\n");
139 139
 	}
140 140
 
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TMarkdown.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 */
52 52
 	public function processText($text)
53 53
 	{
54
-		$result = Parsedown::instance()->parse($text);
54
+		$result=Parsedown::instance()->parse($text);
55 55
 		return preg_replace_callback(
56 56
 				'/<pre><code class="language-(\w+)">((.|\n)*?)<\\/code><\\/pre>/im',
57 57
 				array($this, 'highlightCode'), $result);
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 */
65 65
 	protected function highlightCode($matches)
66 66
 	{
67
-		$text = html_entity_decode($matches[2],ENT_QUOTES,'UTF-8');
67
+		$text=html_entity_decode($matches[2], ENT_QUOTES, 'UTF-8');
68 68
 		$this->setLanguage($matches[1]);
69 69
 		return parent::processText($text);
70 70
 	}
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TListControlValidator.php 2 patches
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
 	public function getMinSelection()
78 78
 	{
79
-		return $this->getViewState('MinSelection',-1);
79
+		return $this->getViewState('MinSelection', -1);
80 80
 	}
81 81
 
82 82
 	/**
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	public function setMinSelection($value)
86 86
 	{
87
-		if(($value=TPropertyValue::ensureInteger($value))<0)
87
+		if(($value=TPropertyValue::ensureInteger($value)) < 0)
88 88
 			$value=-1;
89
-		$this->setViewState('MinSelection',$value,-1);
89
+		$this->setViewState('MinSelection', $value, -1);
90 90
 	}
91 91
 
92 92
 	/**
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 	public function getMaxSelection()
96 96
 	{
97
-		return $this->getViewState('MaxSelection',-1);
97
+		return $this->getViewState('MaxSelection', -1);
98 98
 	}
99 99
 
100 100
 	/**
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public function setMaxSelection($value)
104 104
 	{
105
-		if(($value=TPropertyValue::ensureInteger($value))<0)
105
+		if(($value=TPropertyValue::ensureInteger($value)) < 0)
106 106
 			$value=-1;
107
-		$this->setViewState('MaxSelection',$value,-1);
107
+		$this->setViewState('MaxSelection', $value, -1);
108 108
 	}
109 109
 
110 110
 	/**
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 */
114 114
 	public function getRequiredSelections()
115 115
 	{
116
-		return $this->getViewState('RequiredSelections','');
116
+		return $this->getViewState('RequiredSelections', '');
117 117
 	}
118 118
 
119 119
 	/**
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	public function setRequiredSelections($value)
124 124
 	{
125
-		$this->setViewState('RequiredSelections',$value,'');
125
+		$this->setViewState('RequiredSelections', $value, '');
126 126
 	}
127 127
 
128 128
 	/**
@@ -135,28 +135,28 @@  discard block
 block discarded – undo
135 135
 	{
136 136
 		$control=$this->getValidationTarget();
137 137
 
138
-		$exists = true;
139
-		$values = $this->getSelection($control);
140
-		$count = count($values);
141
-		$required = $this->getRequiredValues();
138
+		$exists=true;
139
+		$values=$this->getSelection($control);
140
+		$count=count($values);
141
+		$required=$this->getRequiredValues();
142 142
 
143 143
 		//if required, check the values
144 144
 		if(!empty($required))
145 145
 		{
146
-			if($count < count($required) )
146
+			if($count < count($required))
147 147
 				return false;
148 148
 			foreach($required as $require)
149
-				$exists = $exists && in_array($require, $values);
149
+				$exists=$exists && in_array($require, $values);
150 150
 		}
151 151
 
152
-		$min = $this->getMinSelection();
153
-		$max = $this->getMaxSelection();
152
+		$min=$this->getMinSelection();
153
+		$max=$this->getMaxSelection();
154 154
 
155
-		if($min !== -1 && $max !== -1)
155
+		if($min!==-1 && $max!==-1)
156 156
 			return $exists && $count >= $min && $count <= $max;
157
-		else if($min === -1 && $max !== -1)
157
+		else if($min===-1 && $max!==-1)
158 158
 			return $exists && $count <= $max;
159
-		else if($min !== -1 && $max === -1)
159
+		else if($min!==-1 && $max===-1)
160 160
 			return $exists && $count >= $min;
161 161
 		else
162 162
 			return $exists;
@@ -168,13 +168,13 @@  discard block
 block discarded – undo
168 168
 	 */
169 169
 	protected function getSelection($control)
170 170
 	{
171
-		$values = array();
171
+		$values=array();
172 172
 
173 173
 		//get the data
174 174
 		foreach($control->getItems() as $item)
175 175
 		{
176 176
 			if($item->getSelected())
177
-				$values[] = $item->getValue();
177
+				$values[]=$item->getValue();
178 178
 		}
179 179
 		return $values;
180 180
 	}
@@ -184,10 +184,10 @@  discard block
 block discarded – undo
184 184
 	 */
185 185
 	protected function getRequiredValues()
186 186
 	{
187
-		$required = array();
188
-		$string = $this->getRequiredSelections();
187
+		$required=array();
188
+		$string=$this->getRequiredSelections();
189 189
 		if(!empty($string))
190
-			$required = preg_split('/,\s*/', $string);
190
+			$required=preg_split('/,\s*/', $string);
191 191
 		return $required;
192 192
 	}
193 193
 
@@ -197,26 +197,26 @@  discard block
 block discarded – undo
197 197
 	 */
198 198
 	protected function getClientScriptOptions()
199 199
 	{
200
-		$options = parent::getClientScriptOptions();
201
-		$control = $this->getValidationTarget();
200
+		$options=parent::getClientScriptOptions();
201
+		$control=$this->getValidationTarget();
202 202
 
203 203
 		if(!$control instanceof TListControl)
204 204
 		{
205 205
 			throw new TConfigurationException(
206 206
 				'listcontrolvalidator_invalid_control',
207
-				$this->getID(),$this->getControlToValidate(), get_class($control));
207
+				$this->getID(), $this->getControlToValidate(), get_class($control));
208 208
 		}
209 209
 
210
-		$min = $this->getMinSelection();
211
-		$max = $this->getMaxSelection();
212
-		if($min !== -1)
213
-			$options['Min']= $min;
214
-		if($max !== -1)
215
-			$options['Max']= $max;
216
-		$required = $this->getRequiredSelections();
210
+		$min=$this->getMinSelection();
211
+		$max=$this->getMaxSelection();
212
+		if($min!==-1)
213
+			$options['Min']=$min;
214
+		if($max!==-1)
215
+			$options['Max']=$max;
216
+		$required=$this->getRequiredSelections();
217 217
 		if(strlen($required) > 0)
218
-			$options['Required']= $required;
219
-		$options['TotalItems'] = $control->getItemCount();
218
+			$options['Required']=$required;
219
+		$options['TotalItems']=$control->getItemCount();
220 220
 
221 221
 		return $options;
222 222
 	}
Please login to merge, or discard this patch.
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -163,6 +163,7 @@
 block discarded – undo
163 163
 
164 164
 	/**
165 165
 	 * @param TListControl control to validate
166
+	 * @param \Prado\Web\UI\TControl $control
166 167
 	 * @return array number of selected values and its values.
167 168
 	 */
168 169
 	protected function getSelection($control)
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TLiteral.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	 */
37 37
 	public function getText()
38 38
 	{
39
-		return $this->getViewState('Text','');
39
+		return $this->getViewState('Text', '');
40 40
 	}
41 41
 
42 42
 	/**
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 */
46 46
 	public function setText($value)
47 47
 	{
48
-		$this->setViewState('Text',TPropertyValue::ensureString($value),'');
48
+		$this->setViewState('Text', TPropertyValue::ensureString($value), '');
49 49
 	}
50 50
 
51 51
 	/**
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public function getEncode()
81 81
 	{
82
-		return $this->getViewState('Encode',false);
82
+		return $this->getViewState('Encode', false);
83 83
 	}
84 84
 
85 85
 	/**
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	public function setEncode($value)
89 89
 	{
90
-		$this->setViewState('Encode',TPropertyValue::ensureBoolean($value),false);
90
+		$this->setViewState('Encode', TPropertyValue::ensureBoolean($value), false);
91 91
 	}
92 92
 
93 93
 	/**
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -106,8 +106,7 @@
 block discarded – undo
106 106
 				$writer->write(THttpUtility::htmlEncode($text));
107 107
 			else
108 108
 				$writer->write($text);
109
-		}
110
-		else
109
+		} else
111 110
 			parent::render($writer);
112 111
 	}
113 112
 }
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TRegularExpressionValidator.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 */
63 63
 	public function getRegularExpression()
64 64
 	{
65
-		return $this->getViewState('RegularExpression','');
65
+		return $this->getViewState('RegularExpression', '');
66 66
 	}
67 67
 
68 68
 	/**
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 */
71 71
 	public function setRegularExpression($value)
72 72
 	{
73
-		$this->setViewState('RegularExpression',$value,'');
73
+		$this->setViewState('RegularExpression', $value, '');
74 74
 	}
75 75
 
76 76
 	/**
@@ -84,10 +84,10 @@  discard block
 block discarded – undo
84 84
 	{
85 85
 		if(($value=$this->getValidationValue($this->getValidationTarget()))==='')
86 86
 			return true;
87
-		if(($expression=addcslashes($this->getRegularExpression(),"/"))!=='')
87
+		if(($expression=addcslashes($this->getRegularExpression(), "/"))!=='')
88 88
 		{
89
-			$mods = $this->getPatternModifiers();
90
-			return preg_match("/^$expression\$/{$mods}",$value);
89
+			$mods=$this->getPatternModifiers();
90
+			return preg_match("/^$expression\$/{$mods}", $value);
91 91
 		}
92 92
 		else
93 93
 			return true;
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 */
134 134
 	protected function getClientScriptOptions()
135 135
 	{
136
-		$options = parent::getClientScriptOptions();
136
+		$options=parent::getClientScriptOptions();
137 137
 		$options['ValidationExpression']=$this->getRegularExpression();
138 138
 		$options['PatternModifiers']=$this->getClientSidePatternModifiers();
139 139
 		return $options;
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -85,8 +85,7 @@
 block discarded – undo
85 85
 		{
86 86
 			$mods = $this->getPatternModifiers();
87 87
 			return preg_match("/^$expression\$/{$mods}",$value);
88
-		}
89
-		else
88
+		} else
90 89
 			return true;
91 90
 	}
92 91
 
Please login to merge, or discard this patch.
framework/Web/UI/TSessionPageStatePersister.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public function setHistorySize($value)
81 81
 	{
82
-		if(($value=TPropertyValue::ensureInteger($value))>0)
82
+		if(($value=TPropertyValue::ensureInteger($value)) > 0)
83 83
 			$this->_historySize=$value;
84 84
 		else
85 85
 			throw new TInvalidDataValueException('sessionpagestatepersister_historysize_invalid');
@@ -93,19 +93,19 @@  discard block
 block discarded – undo
93 93
 		$session=$this->_page->getSession();
94 94
 		$session->open();
95 95
 		$data=serialize($state);
96
-		$timestamp=(string)microtime(true);
96
+		$timestamp=(string) microtime(true);
97 97
 		$key=self::STATE_SESSION_KEY.$timestamp;
98
-		$session->add($key,$data);
98
+		$session->add($key, $data);
99 99
 		if(($queue=$session->itemAt(self::QUEUE_SESSION_KEY))===null)
100 100
 			$queue=array();
101 101
 		$queue[]=$key;
102
-		if(count($queue)>$this->getHistorySize())
102
+		if(count($queue) > $this->getHistorySize())
103 103
 		{
104 104
 			$expiredKey=array_shift($queue);
105 105
 			$session->remove($expiredKey);
106 106
 		}
107
-		$session->add(self::QUEUE_SESSION_KEY,$queue);
108
-		$this->_page->setClientState(TPageStateFormatter::serialize($this->_page,$timestamp));
107
+		$session->add(self::QUEUE_SESSION_KEY, $queue);
108
+		$this->_page->setClientState(TPageStateFormatter::serialize($this->_page, $timestamp));
109 109
 	}
110 110
 
111 111
 	/**
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	 */
116 116
 	public function load()
117 117
 	{
118
-		if(($timestamp=TPageStateFormatter::unserialize($this->_page,$this->_page->getRequestClientState()))!==null)
118
+		if(($timestamp=TPageStateFormatter::unserialize($this->_page, $this->_page->getRequestClientState()))!==null)
119 119
 		{
120 120
 			$session=$this->_page->getSession();
121 121
 			$session->open();
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 			if(($data=$session->itemAt($key))!==null)
124 124
 				return unserialize($data);
125 125
 		}
126
-		throw new THttpException(400,'sessionpagestatepersister_pagestate_corrupted');
126
+		throw new THttpException(400, 'sessionpagestatepersister_pagestate_corrupted');
127 127
 	}
128 128
 }
129 129
 
Please login to merge, or discard this patch.
framework/Web/UI/TControlAdapter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
 	 */
49 49
 	public function getPage()
50 50
 	{
51
-		return $this->_control?$this->_control->getPage():null;
51
+		return $this->_control ? $this->_control->getPage() : null;
52 52
 	}
53 53
 
54 54
 	/**
Please login to merge, or discard this patch.
framework/Web/UI/TForm.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	protected function addAttributesToRender($writer)
45 45
 	{
46
-		$writer->addAttribute('id',$this->getClientID());
47
-		$writer->addAttribute('method',$this->getMethod());
46
+		$writer->addAttribute('id', $this->getClientID());
47
+		$writer->addAttribute('method', $this->getMethod());
48 48
 		$uri=$this->getRequest()->getRequestURI();
49
-		$writer->addAttribute('action',str_replace('&','&amp;',str_replace('&amp;','&',$uri)));
49
+		$writer->addAttribute('action', str_replace('&', '&amp;', str_replace('&amp;', '&', $uri)));
50 50
 		if(($enctype=$this->getEnctype())!=='')
51
-			$writer->addAttribute('enctype',$enctype);
51
+			$writer->addAttribute('enctype', $enctype);
52 52
 
53 53
 		$attributes=$this->getAttributes();
54 54
 		$attributes->remove('action');
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 			if(($button=$this->findControl($butt))!==null)
60 60
 				$this->getPage()->getClientScript()->registerDefaultButton($this, $button);
61 61
 			else
62
-				throw new TInvalidDataValueException('form_defaultbutton_invalid',$butt);
62
+				throw new TInvalidDataValueException('form_defaultbutton_invalid', $butt);
63 63
 		}
64 64
 	}
65 65
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function getDefaultButton()
110 110
 	{
111
-		return $this->getViewState('DefaultButton','');
111
+		return $this->getViewState('DefaultButton', '');
112 112
 	}
113 113
 
114 114
 	/**
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	public function setDefaultButton($value)
121 121
 	{
122
-		$this->setViewState('DefaultButton',$value,'');
122
+		$this->setViewState('DefaultButton', $value, '');
123 123
 	}
124 124
 
125 125
 	/**
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 */
128 128
 	public function getMethod()
129 129
 	{
130
-		return $this->getViewState('Method','post');
130
+		return $this->getViewState('Method', 'post');
131 131
 	}
132 132
 
133 133
 	/**
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	public function setMethod($value)
137 137
 	{
138
-		$this->setViewState('Method',TPropertyValue::ensureEnum($value,'post','get'),'post');
138
+		$this->setViewState('Method', TPropertyValue::ensureEnum($value, 'post', 'get'), 'post');
139 139
 	}
140 140
 
141 141
 	/**
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 */
144 144
 	public function getEnctype()
145 145
 	{
146
-		return $this->getViewState('Enctype','');
146
+		return $this->getViewState('Enctype', '');
147 147
 	}
148 148
 
149 149
 	/**
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	 */
156 156
 	public function setEnctype($value)
157 157
 	{
158
-		$this->setViewState('Enctype',$value,'');
158
+		$this->setViewState('Enctype', $value, '');
159 159
 	}
160 160
 
161 161
 	/**
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -92,8 +92,7 @@
 block discarded – undo
92 92
 
93 93
 			$cs->renderScriptFilesEnd($writer);
94 94
 			$cs->renderEndScripts($writer);
95
-		}
96
-		else
95
+		} else
97 96
 		{
98 97
 			$cs->renderHiddenFieldsBegin($writer);
99 98
 
Please login to merge, or discard this patch.
framework/Web/UI/THtmlWriter.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 
89 89
 	public function setWriter($writer)
90 90
 	{
91
-		$this->_writer = $writer;
91
+		$this->_writer=$writer;
92 92
 	}
93 93
 	/**
94 94
 	 * Adds a list of attributes to be rendered.
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 * @param string name of the attribute
106 106
 	 * @param string value of the attribute
107 107
 	 */
108
-	public function addAttribute($name,$value)
108
+	public function addAttribute($name, $value)
109 109
 	{
110 110
 		$this->_attributes[THttpUtility::htmlStrip($name)]=THttpUtility::htmlEncode($value);
111 111
 	}
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 * @param string stylesheet attribute name
135 135
 	 * @param string stylesheet attribute value
136 136
 	 */
137
-	public function addStyleAttribute($name,$value)
137
+	public function addStyleAttribute($name, $value)
138 138
 	{
139 139
 		$this->_styles[THttpUtility::htmlStrip($name)]=THttpUtility::htmlEncode($value);
140 140
 	}
@@ -203,12 +203,12 @@  discard block
 block discarded – undo
203 203
 		if(isset(self::$_simpleTags[$tagName]))
204 204
 		{
205 205
 			$str.=' />';
206
-			$this->_openTags[] = '';
206
+			$this->_openTags[]='';
207 207
 		}
208 208
 		else
209 209
 		{
210 210
 			$str.='>';
211
-			$this->_openTags[] = $tagName;
211
+			$this->_openTags[]=$tagName;
212 212
 		}
213 213
 		$this->_writer->write($str);
214 214
 		$this->_attributes=array();
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -207,8 +207,7 @@
 block discarded – undo
207 207
 		{
208 208
 			$str.=' />';
209 209
 			$this->_openTags[] = '';
210
-		}
211
-		else
210
+		} else
212 211
 		{
213 212
 			$str.='>';
214 213
 			$this->_openTags[] = $tagName;
Please login to merge, or discard this patch.