@@ -28,11 +28,11 @@ |
||
| 28 | 28 | protected function _validate() |
| 29 | 29 | { |
| 30 | 30 | // subvalues cannot be arrays |
| 31 | - if($this->isSubvalue) { |
|
| 31 | + if ($this->isSubvalue) { |
|
| 32 | 32 | return $this->value; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - if(is_array($this->value)) { |
|
| 35 | + if (is_array($this->value)) { |
|
| 36 | 36 | return $this->value; |
| 37 | 37 | } |
| 38 | 38 | |
@@ -83,12 +83,12 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | public function addFile(string $varName, string $fileName, string $content, string $contentType = '', string $encoding = '') : RequestHelper_Boundaries |
| 85 | 85 | { |
| 86 | - if(empty($contentType)) |
|
| 86 | + if (empty($contentType)) |
|
| 87 | 87 | { |
| 88 | 88 | $contentType = (string)FileHelper::detectMimeType($fileName); |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - if(empty($encoding)) |
|
| 91 | + if (empty($encoding)) |
|
| 92 | 92 | { |
| 93 | 93 | $encoding = RequestHelper::ENCODING_UTF8; |
| 94 | 94 | $content = ConvertHelper::string2utf8($content); |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | */ |
| 154 | 154 | public function render() : string |
| 155 | 155 | { |
| 156 | - if(empty($this->boundaries)) |
|
| 156 | + if (empty($this->boundaries)) |
|
| 157 | 157 | { |
| 158 | 158 | throw new RequestHelper_Exception( |
| 159 | 159 | 'No mime boundaries added', |
@@ -164,13 +164,13 @@ discard block |
||
| 164 | 164 | |
| 165 | 165 | $result = ''; |
| 166 | 166 | |
| 167 | - foreach($this->boundaries as $boundary) |
|
| 167 | + foreach ($this->boundaries as $boundary) |
|
| 168 | 168 | { |
| 169 | 169 | $result .= $boundary->render(); |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - $result .= "--" . $this->getMimeBoundary() . "--" . |
|
| 173 | - $this->getEOL() . $this->getEOL(); // always finish with two eol's!! |
|
| 172 | + $result .= "--".$this->getMimeBoundary()."--". |
|
| 173 | + $this->getEOL().$this->getEOL(); // always finish with two eol's!! |
|
| 174 | 174 | |
| 175 | 175 | return $result; |
| 176 | 176 | } |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | $result = array(); |
| 48 | 48 | |
| 49 | - foreach($parts as $part) |
|
| 49 | + foreach ($parts as $part) |
|
| 50 | 50 | { |
| 51 | 51 | $tokens = explode('=', $part); |
| 52 | 52 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | $trimmed = trim($name); |
| 57 | 57 | |
| 58 | - if(empty($trimmed)) |
|
| 58 | + if (empty($trimmed)) |
|
| 59 | 59 | { |
| 60 | 60 | continue; |
| 61 | 61 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | /** |
| 26 | 26 | * @var string[] |
| 27 | 27 | */ |
| 28 | - protected static $controlChars = array( |
|
| 28 | + protected static $controlChars = array( |
|
| 29 | 29 | '0000-0008', // control chars |
| 30 | 30 | '000E-000F', // control chars |
| 31 | 31 | '0010-001F', // control chars |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | public function __construct() |
| 51 | 51 | { |
| 52 | 52 | // create the regex from the unicode characters list |
| 53 | - if(!isset(self::$controlCharsRegex)) |
|
| 53 | + if (!isset(self::$controlCharsRegex)) |
|
| 54 | 54 | { |
| 55 | 55 | $chars = $this->getCharsAsHex(); |
| 56 | 56 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | // in the regular expression. |
| 59 | 59 | $stack = array(); |
| 60 | 60 | |
| 61 | - foreach($chars as $char) |
|
| 61 | + foreach ($chars as $char) |
|
| 62 | 62 | { |
| 63 | 63 | $stack[] = '\x{'.$char.'}'; |
| 64 | 64 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | $stack = array(); |
| 85 | 85 | |
| 86 | - foreach(self::$controlChars as $char) |
|
| 86 | + foreach (self::$controlChars as $char) |
|
| 87 | 87 | { |
| 88 | 88 | $tokens = explode('-', $char); |
| 89 | 89 | $start = $tokens[0]; |
@@ -92,24 +92,24 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | $range = array(); |
| 94 | 94 | |
| 95 | - foreach(self::$hexAlphabet as $number) |
|
| 95 | + foreach (self::$hexAlphabet as $number) |
|
| 96 | 96 | { |
| 97 | 97 | $range[] = $prefix.$number; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | $use = false; |
| 101 | 101 | |
| 102 | - foreach($range as $number) |
|
| 102 | + foreach ($range as $number) |
|
| 103 | 103 | { |
| 104 | - if($number == $start) { |
|
| 104 | + if ($number == $start) { |
|
| 105 | 105 | $use = true; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - if($use) { |
|
| 108 | + if ($use) { |
|
| 109 | 109 | $stack[] = $number; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - if($number == $end) { |
|
| 112 | + if ($number == $end) { |
|
| 113 | 113 | break; |
| 114 | 114 | } |
| 115 | 115 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | $chars = $this->getCharsAsHex(); |
| 133 | 133 | |
| 134 | 134 | $result = array(); |
| 135 | - foreach($chars as $char) { |
|
| 135 | + foreach ($chars as $char) { |
|
| 136 | 136 | $result[] = hex2bin($char); |
| 137 | 137 | } |
| 138 | 138 | |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $chars = $this->getCharsAsHex(); |
| 151 | 151 | |
| 152 | 152 | $result = array(); |
| 153 | - foreach($chars as $char) { |
|
| 153 | + foreach ($chars as $char) { |
|
| 154 | 154 | $result[] = '\u'.strtolower($char); |
| 155 | 155 | } |
| 156 | 156 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | */ |
| 171 | 171 | public function stripControlCharacters(string $string) : string |
| 172 | 172 | { |
| 173 | - if(empty($string)) |
|
| 173 | + if (empty($string)) |
|
| 174 | 174 | { |
| 175 | 175 | return $string; |
| 176 | 176 | } |
@@ -178,13 +178,13 @@ discard block |
||
| 178 | 178 | $result = preg_replace(self::$controlCharsRegex, '', $string); |
| 179 | 179 | |
| 180 | 180 | // can happen if the text contains invalid UTF8 |
| 181 | - if($result === null) |
|
| 181 | + if ($result === null) |
|
| 182 | 182 | { |
| 183 | 183 | $string = ConvertHelper::string2utf8($string); |
| 184 | 184 | |
| 185 | 185 | $result = preg_replace(self::$controlCharsRegex, '', $string); |
| 186 | 186 | |
| 187 | - if($result === null) |
|
| 187 | + if ($result === null) |
|
| 188 | 188 | { |
| 189 | 189 | throw new ConvertHelper_Exception( |
| 190 | 190 | 'Cannot strip control characters: malformatted string encountered.', |
@@ -22,14 +22,14 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | class Value_Bool_False extends Value_Bool |
| 24 | 24 | { |
| 25 | - public function __construct(bool $value=true) |
|
| 25 | + public function __construct(bool $value = true) |
|
| 26 | 26 | { |
| 27 | 27 | parent::__construct($value); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | public function set(bool $value) : Value_Bool |
| 31 | 31 | { |
| 32 | - if($value === false) |
|
| 32 | + if ($value === false) |
|
| 33 | 33 | { |
| 34 | 34 | parent::set($value); |
| 35 | 35 | } |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | { |
| 25 | 25 | public function set(bool $value) : Value_Bool |
| 26 | 26 | { |
| 27 | - if($value === true) |
|
| 27 | + if ($value === true) |
|
| 28 | 28 | { |
| 29 | 29 | parent::set($value); |
| 30 | 30 | } |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | private static function checkFragment(string $fragment) : void |
| 109 | 109 | { |
| 110 | - if(!stristr($fragment, '<body') && !stristr($fragment, 'doctype')) |
|
| 110 | + if (!stristr($fragment, '<body') && !stristr($fragment, 'doctype')) |
|
| 111 | 111 | { |
| 112 | 112 | return; |
| 113 | 113 | } |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | // capture all elements except the body tag itself |
| 209 | 209 | $xml = ''; |
| 210 | - foreach($nodes as $child) |
|
| 210 | + foreach ($nodes as $child) |
|
| 211 | 211 | { |
| 212 | 212 | $xml .= $this->dom->saveXML($child); |
| 213 | 213 | } |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | $lines = explode("\n", $list); |
| 23 | 23 | $reverseArray = array(); |
| 24 | 24 | |
| 25 | - foreach($lines as $line) |
|
| 25 | + foreach ($lines as $line) |
|
| 26 | 26 | { |
| 27 | 27 | $parts = explode('=', $line); |
| 28 | 28 | $name = trim(str_replace('XML_ERR_', '', $parts[0])); |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * @param bool $exclude |
| 49 | 49 | * @return Request_RefreshParams |
| 50 | 50 | */ |
| 51 | - public function setExcludeSessionName(bool $exclude=true) : Request_RefreshParams |
|
| 51 | + public function setExcludeSessionName(bool $exclude = true) : Request_RefreshParams |
|
| 52 | 52 | { |
| 53 | 53 | $this->setOption('exclude-session-name', $exclude); |
| 54 | 54 | return $this; |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | public function excludeParamByName(string $paramName) : Request_RefreshParams |
| 72 | 72 | { |
| 73 | - if($paramName !== '') |
|
| 73 | + if ($paramName !== '') |
|
| 74 | 74 | { |
| 75 | 75 | $this->excludes[] = new Request_RefreshParams_Exclude_Name($paramName); |
| 76 | 76 | } |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | public function excludeParamsByName(array $paramNames) : Request_RefreshParams |
| 109 | 109 | { |
| 110 | - foreach($paramNames as $name) |
|
| 110 | + foreach ($paramNames as $name) |
|
| 111 | 111 | { |
| 112 | 112 | $this->excludeParamByName((string)$name); |
| 113 | 113 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | public function overrideParams(array $params) : Request_RefreshParams |
| 141 | 141 | { |
| 142 | - foreach($params as $name => $value) |
|
| 142 | + foreach ($params as $name => $value) |
|
| 143 | 143 | { |
| 144 | 144 | $this->overrideParam((string)$name, $value); |
| 145 | 145 | } |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | */ |
| 174 | 174 | private function autoExcludeSessionName(array &$excludes) : void |
| 175 | 175 | { |
| 176 | - if($this->getBoolOption('exclude-session-name')) |
|
| 176 | + if ($this->getBoolOption('exclude-session-name')) |
|
| 177 | 177 | { |
| 178 | 178 | $excludes[] = new Request_RefreshParams_Exclude_Name(session_name()); |
| 179 | 179 | } |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | */ |
| 188 | 188 | private function autoExcludeQuickform(array &$excludes) : void |
| 189 | 189 | { |
| 190 | - if($this->getBoolOption('exclude-quickform-submitter')) |
|
| 190 | + if ($this->getBoolOption('exclude-quickform-submitter')) |
|
| 191 | 191 | { |
| 192 | 192 | $excludes[] = new Request_RefreshParams_Exclude_Callback(function(string $paramName) |
| 193 | 193 | { |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | // Note: using this loop instead of array_merge, |
| 210 | 210 | // because array_merge has weird behavior when |
| 211 | 211 | // using numeric keys. |
| 212 | - foreach($this->overrides as $name => $val) |
|
| 212 | + foreach ($this->overrides as $name => $val) |
|
| 213 | 213 | { |
| 214 | 214 | $params[$name] = $val; |
| 215 | 215 | } |
@@ -227,11 +227,11 @@ discard block |
||
| 227 | 227 | { |
| 228 | 228 | $result = array(); |
| 229 | 229 | |
| 230 | - foreach($params as $name => $value) |
|
| 230 | + foreach ($params as $name => $value) |
|
| 231 | 231 | { |
| 232 | 232 | $name = (string)$name; |
| 233 | 233 | |
| 234 | - if(!$this->isExcluded($name, $value)) |
|
| 234 | + if (!$this->isExcluded($name, $value)) |
|
| 235 | 235 | { |
| 236 | 236 | $result[$name] = $value; |
| 237 | 237 | } |
@@ -252,9 +252,9 @@ discard block |
||
| 252 | 252 | { |
| 253 | 253 | $excludes = $this->resolveExcludes(); |
| 254 | 254 | |
| 255 | - foreach($excludes as $exclude) |
|
| 255 | + foreach ($excludes as $exclude) |
|
| 256 | 256 | { |
| 257 | - if($exclude->isExcluded($paramName, $paramValue)) |
|
| 257 | + if ($exclude->isExcluded($paramName, $paramValue)) |
|
| 258 | 258 | { |
| 259 | 259 | return true; |
| 260 | 260 | } |