Completed
Push — prado-3.3 ( f4da81...5dd4b5 )
by Fabio
09:03
created
framework/Caching/TXCache.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
 		if(!function_exists('xcache_isset'))
53 53
 			throw new TConfigurationException('xcache_extension_required');
54 54
 
55
-		$enabled = (int)ini_get('xcache.cacher') !== 0;
56
-		$var_size = (int)ini_get('xcache.var_size');
55
+		$enabled=(int) ini_get('xcache.cacher')!==0;
56
+		$var_size=(int) ini_get('xcache.var_size');
57 57
 
58 58
 		if(!($enabled && $var_size > 0))
59 59
 			throw new TConfigurationException('xcache_extension_not_enabled');
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
 	 * @param integer the number of seconds in which the cached value will expire. 0 means never expire.
82 82
 	 * @return boolean true if the value is successfully stored into cache, false otherwise
83 83
 	 */
84
-	protected function setValue($key,$value,$expire)
84
+	protected function setValue($key, $value, $expire)
85 85
 	{
86
-		return xcache_set($key,$value,$expire);
86
+		return xcache_set($key, $value, $expire);
87 87
 	}
88 88
 
89 89
 	/**
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
 	 * @param integer the number of seconds in which the cached value will expire. 0 means never expire.
96 96
 	 * @return boolean true if the value is successfully stored into cache, false otherwise
97 97
 	 */
98
-	protected function addValue($key,$value,$expire)
98
+	protected function addValue($key, $value, $expire)
99 99
 	{
100
-		return !xcache_isset($key) ? $this->setValue($key,$value,$expire) : false;
100
+		return !xcache_isset($key) ? $this->setValue($key, $value, $expire) : false;
101 101
 	}
102 102
 
103 103
 	/**
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	public function flush()
119 119
 	{
120
-		for($i=0, $max=xcache_count(XC_TYPE_VAR); $i<$max; $i++)
120
+		for($i=0, $max=xcache_count(XC_TYPE_VAR); $i < $max; $i++)
121 121
 		{
122 122
 			if(xcache_clear_cache(XC_TYPE_VAR, $i)===false)
123 123
 				return false;
Please login to merge, or discard this patch.
framework/Collections/TDummyDataSource.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -137,7 +137,7 @@
 block discarded – undo
137 137
 	 */
138 138
 	public function valid()
139 139
 	{
140
-		return $this->_index<$this->_count;
140
+		return $this->_index < $this->_count;
141 141
 	}
142 142
 }
143 143
 
Please login to merge, or discard this patch.
framework/Collections/TStack.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
  * @package System.Collections
30 30
  * @since 3.0
31 31
  */
32
-class TStack extends TComponent implements IteratorAggregate,Countable
32
+class TStack extends TComponent implements IteratorAggregate, Countable
33 33
 {
34 34
 	/**
35 35
 	 * internal data storage
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 */
99 99
 	public function contains($item)
100 100
 	{
101
-		return array_search($item,$this->_d,true)!==false;
101
+		return array_search($item, $this->_d, true)!==false;
102 102
 	}
103 103
 
104 104
 	/**
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 		if($this->_c===0)
113 113
 			throw new TInvalidOperationException('stack_empty');
114 114
 		else
115
-			return $this->_d[$this->_c-1];
115
+			return $this->_d[$this->_c - 1];
116 116
 	}
117 117
 
118 118
 	/**
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	public function push($item)
139 139
 	{
140 140
 		++$this->_c;
141
-		$this->_d[] = $item;
141
+		$this->_d[]=$item;
142 142
 	}
143 143
 
144 144
 	/**
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	 */
149 149
 	public function getIterator()
150 150
 	{
151
-		return new ArrayIterator( $this->_d );
151
+		return new ArrayIterator($this->_d);
152 152
 	}
153 153
 
154 154
 	/**
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 	 */
255 255
 	public function valid()
256 256
 	{
257
-		return $this->_i<$this->_c;
257
+		return $this->_i < $this->_c;
258 258
 	}
259 259
 }
260 260
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -81,8 +81,7 @@
 block discarded – undo
81 81
 				$this->_d[]=$item;
82 82
 				++$this->_c;
83 83
 			}
84
-		}
85
-		else if($data!==null)
84
+		} else if($data!==null)
86 85
 			throw new TInvalidDataTypeException('queue_data_not_iterable');
87 86
 	}
88 87
 
Please login to merge, or discard this patch.
framework/Collections/TListItemCollection.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -38,10 +38,10 @@  discard block
 block discarded – undo
38 38
 	public function createListItem($index=-1)
39 39
 	{
40 40
 		$item=$this->createNewListItem();
41
-		if($index<0)
41
+		if($index < 0)
42 42
 			$this->add($item);
43 43
 		else
44
-			$this->insertAt($index,$item);
44
+			$this->insertAt($index, $item);
45 45
 		return $item;
46 46
 	}
47 47
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 */
51 51
 	protected function createNewListItem($text=null)
52 52
 	{
53
-		$item =  new TListItem;
53
+		$item=new TListItem;
54 54
 		if($text!==null)
55 55
 			$item->setText($text);
56 56
 		return $item;
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
 	 * @param TListItem the item to be inserted.
64 64
 	 * @throws TInvalidDataTypeException if the item being inserted is neither a string nor TListItem
65 65
 	 */
66
-	public function insertAt($index,$item)
66
+	public function insertAt($index, $item)
67 67
 	{
68 68
 		if(is_string($item))
69
-			$item = $this->createNewListItem($item);
69
+			$item=$this->createNewListItem($item);
70 70
 		if(!($item instanceof TListItem))
71
-			throw new TInvalidDataTypeException('listitemcollection_item_invalid',get_class($this));
72
-		parent::insertAt($index,$item);
71
+			throw new TInvalidDataTypeException('listitemcollection_item_invalid', get_class($this));
72
+		parent::insertAt($index, $item);
73 73
 	}
74 74
 
75 75
 	/**
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 * @param boolean whether to look for disabled items also
79 79
 	 * @return integer the index of the item found, -1 if not found.
80 80
 	 */
81
-	public function findIndexByValue($value,$includeDisabled=true)
81
+	public function findIndexByValue($value, $includeDisabled=true)
82 82
 	{
83 83
 		$value=TPropertyValue::ensureString($value);
84 84
 		$index=0;
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	 * @param boolean whether to look for disabled items also
98 98
 	 * @return integer the index of the item found, -1 if not found.
99 99
 	 */
100
-	public function findIndexByText($text,$includeDisabled=true)
100
+	public function findIndexByText($text, $includeDisabled=true)
101 101
 	{
102 102
 		$text=TPropertyValue::ensureString($text);
103 103
 		$index=0;
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
 	 * @param boolean whether to look for disabled items also
117 117
 	 * @return TListItem the item found, null if not found.
118 118
 	 */
119
-	public function findItemByValue($value,$includeDisabled=true)
119
+	public function findItemByValue($value, $includeDisabled=true)
120 120
 	{
121
-		if(($index=$this->findIndexByValue($value,$includeDisabled))>=0)
121
+		if(($index=$this->findIndexByValue($value, $includeDisabled)) >= 0)
122 122
 			return $this->itemAt($index);
123 123
 		else
124 124
 			return null;
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
 	 * @param boolean whether to look for disabled items also
131 131
 	 * @return TListItem the item found, null if not found.
132 132
 	 */
133
-	public function findItemByText($text,$includeDisabled=true)
133
+	public function findItemByText($text, $includeDisabled=true)
134 134
 	{
135
-		if(($index=$this->findIndexByText($text,$includeDisabled))>=0)
135
+		if(($index=$this->findIndexByText($text, $includeDisabled)) >= 0)
136 136
 			return $this->itemAt($index);
137 137
 		else
138 138
 			return null;
@@ -157,6 +157,6 @@  discard block
 block discarded – undo
157 157
 	 */
158 158
 	public function saveState()
159 159
 	{
160
-		return ($this->getCount()>0) ? $this->toArray() : null;
160
+		return ($this->getCount() > 0) ? $this->toArray() : null;
161 161
 	}
162 162
 }
Please login to merge, or discard this patch.
framework/I18N/TTranslateParameter.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 * To trim or not to trim the contents.
51 51
 	 * @var boolean
52 52
 	 */
53
-	protected $trim = true;
53
+	protected $trim=true;
54 54
 
55 55
 
56 56
 	/**
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 */
71 71
 	public function setKey($value)
72 72
 	{
73
-		$this->key = $value;
73
+		$this->key=$value;
74 74
 	}
75 75
 
76 76
 	/**
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public function setTrim($value)
81 81
 	{
82
-		$this->trim = TPropertyValue::ensureBoolean($value);
82
+		$this->trim=TPropertyValue::ensureBoolean($value);
83 83
 	}
84 84
 
85 85
 	/**
@@ -106,10 +106,10 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	public function getParameter()
108 108
 	{
109
-		$value = $this->getValue();
109
+		$value=$this->getValue();
110 110
 		if(strlen($value) > 0)
111 111
 			return $value;
112
-		$htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter());
112
+		$htmlWriter=Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter());
113 113
 		$this->renderControl($htmlWriter);
114 114
 		return $this->getTrim() ?
115 115
 			trim($htmlWriter->flush()) : $htmlWriter->flush();
Please login to merge, or discard this patch.
framework/I18N/Translation.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
 		//initialized the default class wide formatter
44 44
 		if(!isset(self::$formatters[$catalogue]))
45 45
 		{
46
-			$app = Prado::getApplication()->getGlobalization();
47
-			$config = $app->getTranslationConfiguration();
48
-			$source = MessageSource::factory($config['type'],
46
+			$app=Prado::getApplication()->getGlobalization();
47
+			$config=$app->getTranslationConfiguration();
48
+			$source=MessageSource::factory($config['type'],
49 49
 											$config['source'],
50 50
 											$config['filename']);
51 51
 
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
 			if(TPropertyValue::ensureBoolean($config['cache']))
55 55
 				$source->setCache(new MessageCache($config['cache']));
56 56
 
57
-			self::$formatters[$catalogue] = new MessageFormat($source, $app->getCharset());
57
+			self::$formatters[$catalogue]=new MessageFormat($source, $app->getCharset());
58 58
 
59 59
 			//mark untranslated text
60 60
 			if($ps=$config['marker'])
61
-				self::$formatters[$catalogue]->setUntranslatedPS(array($ps,$ps));
61
+				self::$formatters[$catalogue]->setUntranslatedPS(array($ps, $ps));
62 62
 
63 63
 			//save the message on end request
64 64
 			// Do it only once !
@@ -86,21 +86,21 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	public static function saveMessages()
88 88
 	{
89
-		static $onceonly = true;
89
+		static $onceonly=true;
90 90
 
91 91
 		if($onceonly)
92 92
 		{
93
-			foreach (self::$formatters as $catalogue=>$formatter)
93
+			foreach(self::$formatters as $catalogue=>$formatter)
94 94
 			{
95
-				$app = Prado::getApplication()->getGlobalization();
96
-				$config = $app->getTranslationConfiguration();
95
+				$app=Prado::getApplication()->getGlobalization();
96
+				$config=$app->getTranslationConfiguration();
97 97
 				if(isset($config['autosave']))
98 98
 				{
99 99
 					$formatter->getSource()->setCulture($app->getCulture());
100 100
 					$formatter->getSource()->save($catalogue);
101 101
 				}
102 102
 			}
103
-			$onceonly = false;
103
+			$onceonly=false;
104 104
 		}
105 105
 	}
106 106
 }
Please login to merge, or discard this patch.
framework/I18N/TGlobalizationAutoDetect.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,8 +32,8 @@
 block discarded – undo
32 32
 		parent::init($xml);
33 33
 
34 34
 		//set the culture according to browser language settings
35
-		$http = new HTTPNegotiator();
36
-		$languages = $http->getLanguages();
35
+		$http=new HTTPNegotiator();
36
+		$languages=$http->getLanguages();
37 37
 		if(count($languages) > 0)
38 38
 		{
39 39
 			$this->_detectedLanguage=$languages[0];
Please login to merge, or discard this patch.
framework/I18N/TI18NControl.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -41,18 +41,18 @@  discard block
 block discarded – undo
41 41
 	 */
42 42
 	public function getCharset()
43 43
 	{
44
-		$app = $this->getApplication()->getGlobalization(false);
44
+		$app=$this->getApplication()->getGlobalization(false);
45 45
 
46 46
 		//instance charset
47
-		$charset = $this->getViewState('Charset','');
47
+		$charset=$this->getViewState('Charset', '');
48 48
 
49 49
 		//fall back to globalization charset
50 50
 		if(empty($charset))
51
-			$charset = ($app===null) ? '' : $app->getCharset();
51
+			$charset=($app===null) ? '' : $app->getCharset();
52 52
 
53 53
 		//fall back to default charset
54 54
 		if(empty($charset))
55
-			$charset = ($app===null) ? 'UTF-8' : $app->getDefaultCharset();
55
+			$charset=($app===null) ? 'UTF-8' : $app->getDefaultCharset();
56 56
 
57 57
 		return $charset;
58 58
 	}
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 */
64 64
 	public function setCharset($value)
65 65
 	{
66
-		$this->setViewState('Charset',$value,'');
66
+		$this->setViewState('Charset', $value, '');
67 67
 	}
68 68
 
69 69
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	public function getCulture()
76 76
 	{
77
-		return $this->getViewState('Culture','');
77
+		return $this->getViewState('Culture', '');
78 78
 	}
79 79
 
80 80
 	/**
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 */
84 84
 	public function setCulture($culture)
85 85
 	{
86
-		$this->setViewState('Culture',$culture,'');
86
+		$this->setViewState('Culture', $culture, '');
87 87
 	}
88 88
 }
89 89
 
Please login to merge, or discard this patch.
framework/I18N/TTranslate.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	 */
67 67
 	public function getText()
68 68
 	{
69
-		return $this->getViewState('Text','');
69
+		return $this->getViewState('Text', '');
70 70
 	}
71 71
 
72 72
 	/**
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	public function setText($value)
77 77
 	{
78
-		$this->setViewState('Text',$value,'');
78
+		$this->setViewState('Text', $value, '');
79 79
 	}
80 80
 
81 81
 	/**
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	public function setKey($value)
86 86
 	{
87
-		$this->setViewState('Key',$value,'');
87
+		$this->setViewState('Key', $value, '');
88 88
 	}
89 89
 
90 90
 	/**
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 */
94 94
 	public function getKey()
95 95
 	{
96
-		return $this->getViewState('Key','');
96
+		return $this->getViewState('Key', '');
97 97
 	}
98 98
 
99 99
 	/**
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public function getCatalogue()
104 104
 	{
105
-		return $this->getViewState('Catalogue','');
105
+		return $this->getViewState('Catalogue', '');
106 106
 	}
107 107
 
108 108
 	/**
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 */
112 112
 	public function setCatalogue($value)
113 113
 	{
114
-		$this->setViewState('Catalogue',$value,'');
114
+		$this->setViewState('Catalogue', $value, '');
115 115
 	}
116 116
 
117 117
 	/**
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	public function setTrim($value)
122 122
 	{
123
-		$this->setViewState('Trim',TPropertyValue::ensureBoolean($value),true);
123
+		$this->setViewState('Trim', TPropertyValue::ensureBoolean($value), true);
124 124
 	}
125 125
 
126 126
 	/**
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	 */
130 130
 	public function getTrim()
131 131
 	{
132
-		return $this->getViewState('Trim',true);
132
+		return $this->getViewState('Trim', true);
133 133
 	}
134 134
 
135 135
 	/**
@@ -140,13 +140,13 @@  discard block
 block discarded – undo
140 140
 	 */
141 141
 	public function getParameters()
142 142
 	{
143
-		if($parameters=$this->getViewState('Parameters',null))
143
+		if($parameters=$this->getViewState('Parameters', null))
144 144
 			return $parameters;
145 145
 		else
146 146
 		{
147 147
 			$parameters=new TAttributeCollection;
148 148
 			$parameters->setCaseSensitive(true);
149
-			$this->setViewState('Parameters',$parameters,null);
149
+			$this->setViewState('Parameters', $parameters, null);
150 150
 			return $parameters;
151 151
 		}
152 152
 	}
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 	 */
157 157
 	public function hasParameter($name)
158 158
 	{
159
-		if($parameters=$this->getViewState('Parameters',null))
159
+		if($parameters=$this->getViewState('Parameters', null))
160 160
 			return $parameters->contains($name);
161 161
 		else
162 162
 			return false;
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	 */
168 168
 	public function getParameter($name)
169 169
 	{
170
-		if($parameters=$this->getViewState('Parameters',null))
170
+		if($parameters=$this->getViewState('Parameters', null))
171 171
 			return $parameters->itemAt($name);
172 172
 		else
173 173
 			return null;
@@ -177,9 +177,9 @@  discard block
 block discarded – undo
177 177
 	 * @param string parameter name
178 178
 	 * @param string value of the parameter
179 179
 	 */
180
-	public function setParameter($name,$value)
180
+	public function setParameter($name, $value)
181 181
 	{
182
-		$this->getParameters()->add($name,$value);
182
+		$this->getParameters()->add($name, $value);
183 183
 	}
184 184
 
185 185
 	/**
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	 */
190 190
 	public function removeParameter($name)
191 191
 	{
192
-		if($parameters=$this->getViewState('Parameters',null))
192
+		if($parameters=$this->getViewState('Parameters', null))
193 193
 			return $parameters->remove($name);
194 194
 		else
195 195
 			return null;
@@ -200,25 +200,25 @@  discard block
 block discarded – undo
200 200
 	 */
201 201
 	public function render($writer)
202 202
 	{
203
-		$htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter());
204
-		$subs = array();
203
+		$htmlWriter=Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter());
204
+		$subs=array();
205 205
 		foreach($this->getParameters() as $key => $value)
206
-			$subs['{'.$key.'}'] = $value;
206
+			$subs['{'.$key.'}']=$value;
207 207
 		foreach($this->getControls() as $control)
208 208
 		{
209 209
 			if($control instanceof TTranslateParameter)
210
-				$subs['{'.$control->getKey().'}'] = $control->getParameter();
210
+				$subs['{'.$control->getKey().'}']=$control->getParameter();
211 211
 			elseif($control instanceof TControl)
212 212
 				$control->render($htmlWriter);
213 213
 			elseif(is_string($control))
214 214
 				$htmlWriter->write($control);
215 215
 		}
216 216
 
217
-		$text = $this->getText();
217
+		$text=$this->getText();
218 218
 		if(strlen($text)==0)
219
-			$text = $htmlWriter->flush();
219
+			$text=$htmlWriter->flush();
220 220
 		if($this->getTrim())
221
-			$text = trim($text);
221
+			$text=trim($text);
222 222
 
223 223
 		$writer->write($this->translateText($text, $subs));
224 224
 	}
@@ -231,20 +231,20 @@  discard block
 block discarded – undo
231 231
 	 */
232 232
 	protected function translateText($text, $subs)
233 233
 	{
234
-		$app = $this->getApplication()->getGlobalization();
234
+		$app=$this->getApplication()->getGlobalization();
235 235
 
236 236
 		//no translation handler provided
237
-		if(($config = $app->getTranslationConfiguration())===null)
237
+		if(($config=$app->getTranslationConfiguration())===null)
238 238
 			return strtr($text, $subs);
239 239
 
240
-		$catalogue = $this->getCatalogue();
240
+		$catalogue=$this->getCatalogue();
241 241
 		if(empty($catalogue) && isset($config['catalogue']))
242
-			$catalogue = $config['catalogue'];
243
-		if (empty($catalogue)) $catalogue='messages';
242
+			$catalogue=$config['catalogue'];
243
+		if(empty($catalogue)) $catalogue='messages';
244 244
 		Translation::init($catalogue);
245 245
 
246
-		$key = $this->getKey();
247
-		if(!empty($key)) $text = $key;
246
+		$key=$this->getKey();
247
+		if(!empty($key)) $text=$key;
248 248
 
249 249
 		//translate it
250 250
 		return Translation::formatter($catalogue)->format($text,
Please login to merge, or discard this patch.