Skip to content
This repository
Browse code

Folded all curly brackets of control structures to conform to PEAR/ZF CS

  • Loading branch information...
commit 2684de0d8e0956de3279f996c5f825b9167fb07c 1 parent e799768
Jordi Boggiano Seldaek authored fabpot committed

Showing 223 changed files with 1,916 additions and 4,272 deletions. Show diff stats Hide diff stats

  1. +14 30 src/Symfony/Components/BrowserKit/Client.php
  2. +5 10 src/Symfony/Components/BrowserKit/CookieJar.php
  3. +3 6 src/Symfony/Components/BrowserKit/History.php
  4. +3 6 src/Symfony/Components/BrowserKit/Response.php
  5. +54 116 src/Symfony/Components/Console/Application.php
  6. +16 36 src/Symfony/Components/Console/Command/Command.php
  7. +3 7 src/Symfony/Components/Console/Command/HelpCommand.php
  8. +2 5 src/Symfony/Components/Console/Command/ListCommand.php
  9. +6 14 src/Symfony/Components/Console/Helper/DialogHelper.php
  10. +5 10 src/Symfony/Components/Console/Helper/FormatterHelper.php
  11. +3 6 src/Symfony/Components/Console/Helper/HelperSet.php
  12. +22 51 src/Symfony/Components/Console/Input/ArgvInput.php
  13. +11 24 src/Symfony/Components/Console/Input/ArrayInput.php
  14. +7 15 src/Symfony/Components/Console/Input/Input.php
  15. +5 12 src/Symfony/Components/Console/Input/InputArgument.php
  16. +34 73 src/Symfony/Components/Console/Input/InputDefinition.php
  17. +9 20 src/Symfony/Components/Console/Input/InputOption.php
  18. +5 14 src/Symfony/Components/Console/Input/StringInput.php
  19. +9 18 src/Symfony/Components/Console/Output/Output.php
  20. +5 11 src/Symfony/Components/Console/Output/StreamOutput.php
  21. +9 19 src/Symfony/Components/Console/Shell.php
  22. +3 6 src/Symfony/Components/Console/Tester/ApplicationTester.php
  23. +3 6 src/Symfony/Components/Console/Tester/CommandTester.php
  24. +15 40 src/Symfony/Components/CssSelector/Node/AttribNode.php
  25. +1 2  src/Symfony/Components/CssSelector/Node/CombinedSelectorNode.php
  26. +3 7 src/Symfony/Components/CssSelector/Node/ElementNode.php
  27. +28 63 src/Symfony/Components/CssSelector/Node/FunctionNode.php
  28. +1 2  src/Symfony/Components/CssSelector/Node/OrNode.php
  29. +6 12 src/Symfony/Components/CssSelector/Node/PseudoNode.php
  30. +41 96 src/Symfony/Components/CssSelector/Parser.php
  31. +3 6 src/Symfony/Components/CssSelector/TokenStream.php
  32. +17 36 src/Symfony/Components/CssSelector/Tokenizer.php
  33. +17 39 src/Symfony/Components/CssSelector/XPathExpr.php
  34. +1 2  src/Symfony/Components/CssSelector/XPathExprOr.php
  35. +33 74 src/Symfony/Components/DependencyInjection/Builder.php
  36. +9 18 src/Symfony/Components/DependencyInjection/BuilderConfiguration.php
  37. +9 19 src/Symfony/Components/DependencyInjection/Container.php
  38. +3 6 src/Symfony/Components/DependencyInjection/Definition.php
  39. +16 34 src/Symfony/Components/DependencyInjection/Dumper/GraphvizDumper.php
  40. +43 98 src/Symfony/Components/DependencyInjection/Dumper/PhpDumper.php
  41. +23 52 src/Symfony/Components/DependencyInjection/Dumper/XmlDumper.php
  42. +28 65 src/Symfony/Components/DependencyInjection/Dumper/YamlDumper.php
  43. +1 2  src/Symfony/Components/DependencyInjection/FileResource.php
  44. +6 14 src/Symfony/Components/DependencyInjection/Loader/FileLoader.php
  45. +2 4 src/Symfony/Components/DependencyInjection/Loader/IniFileLoader.php
  46. +1 2  src/Symfony/Components/DependencyInjection/Loader/LoaderExtension.php
  47. +39 84 src/Symfony/Components/DependencyInjection/Loader/XmlFileLoader.php
  48. +28 60 src/Symfony/Components/DependencyInjection/Loader/YamlFileLoader.php
  49. +6 13 src/Symfony/Components/DependencyInjection/SimpleXMLElement.php
  50. +43 92 src/Symfony/Components/DomCrawler/Crawler.php
  51. +23 52 src/Symfony/Components/DomCrawler/Field/ChoiceFormField.php
  52. +5 11 src/Symfony/Components/DomCrawler/Field/FileFormField.php
  53. +3 6 src/Symfony/Components/DomCrawler/Field/InputFormField.php
  54. +2 4 src/Symfony/Components/DomCrawler/Field/TextareaFormField.php
  55. +23 53 src/Symfony/Components/DomCrawler/Form.php
  56. +3 6 src/Symfony/Components/DomCrawler/Link.php
  57. +2 4 src/Symfony/Components/EventDispatcher/Event.php
  58. +8 16 src/Symfony/Components/EventDispatcher/EventDispatcher.php
  59. +14 28 src/Symfony/Components/Finder/Finder.php
  60. +14 36 src/Symfony/Components/Finder/Glob.php
  61. +1 2  src/Symfony/Components/Finder/Iterator/CustomFilterIterator.php
  62. +4 8 src/Symfony/Components/Finder/Iterator/ExcludeDirectoryFilterIterator.php
  63. +2 5 src/Symfony/Components/Finder/Iterator/FileTypeFilterIterator.php
  64. +9 20 src/Symfony/Components/Finder/Iterator/FilenameFilterIterator.php
  65. +2 4 src/Symfony/Components/Finder/Iterator/SizeRangeFilterIterator.php
  66. +5 13 src/Symfony/Components/Finder/Iterator/SortableIterator.php
  67. +6 12 src/Symfony/Components/Finder/NumberCompare.php
  68. +7 16 src/Symfony/Components/HttpKernel/CacheControl.php
  69. +1 2  src/Symfony/Components/HttpKernel/Exception/ForbiddenHttpException.php
  70. +1 2  src/Symfony/Components/HttpKernel/Exception/NotFoundHttpException.php
  71. +1 2  src/Symfony/Components/HttpKernel/Exception/UnauthorizedHttpException.php
  72. +4 8 src/Symfony/Components/HttpKernel/HeaderBag.php
  73. +13 29 src/Symfony/Components/HttpKernel/HttpKernel.php
  74. +2 4 src/Symfony/Components/HttpKernel/ParameterBag.php
  75. +63 140 src/Symfony/Components/HttpKernel/Request.php
  76. +27 59 src/Symfony/Components/HttpKernel/Response.php
  77. +6 12 src/Symfony/Components/HttpKernel/Test/Client.php
  78. +3 6 src/Symfony/Components/HttpKernel/Test/RequestTester.php
  79. +14 29 src/Symfony/Components/HttpKernel/Test/ResponseTester.php
  80. +16 32 src/Symfony/Components/OutputEscaper/Escaper.php
  81. +1 2  src/Symfony/Components/OutputEscaper/GetterDecorator.php
  82. +5 12 src/Symfony/Components/OutputEscaper/ObjectDecorator.php
  83. +1 2  src/Symfony/Components/OutputEscaper/SafeDecorator.php
  84. +3 6 src/Symfony/Components/Process/PhpProcess.php
  85. +17 37 src/Symfony/Components/Process/Process.php
  86. +1 2  src/Symfony/Components/Routing/FileResource.php
  87. +2 4 src/Symfony/Components/Routing/Generator/Dumper/PhpGeneratorDumper.php
  88. +12 26 src/Symfony/Components/Routing/Generator/UrlGenerator.php
  89. +6 14 src/Symfony/Components/Routing/Loader/FileLoader.php
  90. +10 21 src/Symfony/Components/Routing/Loader/XmlFileLoader.php
  91. +8 19 src/Symfony/Components/Routing/Loader/YamlFileLoader.php
  92. +2 4 src/Symfony/Components/Routing/Matcher/ApacheUrlMatcher.php
  93. +5 10 src/Symfony/Components/Routing/Matcher/Dumper/ApacheMatcherDumper.php
  94. +3 6 src/Symfony/Components/Routing/Matcher/Dumper/PhpMatcherDumper.php
  95. +7 14 src/Symfony/Components/Routing/Matcher/UrlMatcher.php
  96. +5 10 src/Symfony/Components/Routing/Route.php
  97. +4 8 src/Symfony/Components/Routing/RouteCollection.php
  98. +14 34 src/Symfony/Components/Routing/RouteCompiler.php
  99. +15 30 src/Symfony/Components/Routing/Router.php
  100. +13 28 src/Symfony/Components/Templating/Engine.php
  101. +7 14 src/Symfony/Components/Templating/Helper/AssetsHelper.php
  102. +2 4 src/Symfony/Components/Templating/Helper/JavascriptsHelper.php
  103. +3 6 src/Symfony/Components/Templating/Helper/SlotsHelper.php
  104. +2 4 src/Symfony/Components/Templating/Helper/StylesheetsHelper.php
  105. +6 12 src/Symfony/Components/Templating/Loader/CacheLoader.php
  106. +2 4 src/Symfony/Components/Templating/Loader/ChainLoader.php
  107. +7 14 src/Symfony/Components/Templating/Loader/FilesystemLoader.php
  108. +2 5 src/Symfony/Components/Templating/Renderer/PhpRenderer.php
  109. +3 7 src/Symfony/Components/Yaml/Dumper.php
  110. +24 53 src/Symfony/Components/Yaml/Inline.php
  111. +62 144 src/Symfony/Components/Yaml/Parser.php
  112. +5 11 src/Symfony/Components/Yaml/Yaml.php
  113. +4 8 src/Symfony/Foundation/Bundle/Bundle.php
  114. +2 4 src/Symfony/Foundation/Bundle/KernelBundle.php
  115. +5 11 src/Symfony/Foundation/Bundle/KernelExtension.php
  116. +12 26 src/Symfony/Foundation/ClassCollectionLoader.php
  117. +2 4 src/Symfony/Foundation/Debug/ErrorHandler.php
  118. +7 14 src/Symfony/Foundation/Debug/EventDispatcher.php
  119. +4 8 src/Symfony/Foundation/EventDispatcher.php
  120. +29 62 src/Symfony/Foundation/Kernel.php
  121. +2 4 src/Symfony/Foundation/Test/Client.php
  122. +6 13 src/Symfony/Foundation/UniversalClassLoader.php
  123. +57 121 src/Symfony/Foundation/bootstrap.php
  124. +3 6 src/Symfony/Framework/DoctrineBundle/Bundle.php
  125. +9 20 src/Symfony/Framework/DoctrineBundle/Command/ConvertDoctrine1SchemaDoctrineCommand.php
  126. +4 8 src/Symfony/Framework/DoctrineBundle/Command/CreateDatabaseDoctrineCommand.php
  127. +11 23 src/Symfony/Framework/DoctrineBundle/Command/DoctrineCommand.php
  128. +4 8 src/Symfony/Framework/DoctrineBundle/Command/DropDatabaseDoctrineCommand.php
  129. +4 8 src/Symfony/Framework/DoctrineBundle/Command/GenerateEntitiesDoctrineCommand.php
  130. +5 10 src/Symfony/Framework/DoctrineBundle/Command/GenerateEntityDoctrineCommand.php
  131. +4 8 src/Symfony/Framework/DoctrineBundle/Command/GenerateRepositoriesDoctrineCommand.php
  132. +9 20 src/Symfony/Framework/DoctrineBundle/Command/ImportMappingDoctrineCommand.php
  133. +16 32 src/Symfony/Framework/DoctrineBundle/Command/LoadDataFixturesDoctrineCommand.php
  134. +4 10 src/Symfony/Framework/DoctrineBundle/Controller/DoctrineController.php
  135. +1 2  src/Symfony/Framework/DoctrineBundle/DataCollector/DoctrineDataCollector.php
  136. +18 37 src/Symfony/Framework/DoctrineBundle/DependencyInjection/DoctrineExtension.php
  137. +1 2  src/Symfony/Framework/DoctrineBundle/Logger/DbalLogger.php
  138. +1 2  src/Symfony/Framework/ProfilerBundle/DataCollector/DataCollector.php
  139. +7 16 src/Symfony/Framework/ProfilerBundle/DataCollector/DataCollectorManager.php
  140. +1 2  src/Symfony/Framework/ProfilerBundle/DependencyInjection/ProfilerExtension.php
  141. +3 6 src/Symfony/Framework/ProfilerBundle/Listener/WebDebugToolbar.php
  142. +10 23 src/Symfony/Framework/ProfilerBundle/ProfilerStorage.php
  143. +9 20 src/Symfony/Framework/SwiftmailerBundle/DependencyInjection/SwiftmailerExtension.php
  144. +2 4 src/Symfony/Framework/WebBundle/Bundle.php
  145. +3 6 src/Symfony/Framework/WebBundle/Command/AssetsInstallCommand.php
  146. +3 6 src/Symfony/Framework/WebBundle/Command/InitBundleCommand.php
  147. +15 33 src/Symfony/Framework/WebBundle/Command/RouterDebugCommand.php
  148. +3 6 src/Symfony/Framework/WebBundle/Console/Application.php
  149. +3 6 src/Symfony/Framework/WebBundle/Controller.php
  150. +4 7 src/Symfony/Framework/WebBundle/Controller/ExceptionController.php
  151. +1 2  src/Symfony/Framework/WebBundle/Controller/RedirectController.php
  152. +13 31 src/Symfony/Framework/WebBundle/Debug/ExceptionFormatter.php
  153. +13 28 src/Symfony/Framework/WebBundle/DependencyInjection/WebExtension.php
  154. +11 25 src/Symfony/Framework/WebBundle/Listener/ControllerLoader.php
  155. +4 9 src/Symfony/Framework/WebBundle/Listener/ExceptionHandler.php
  156. +4 9 src/Symfony/Framework/WebBundle/Listener/RequestParser.php
  157. +2 4 src/Symfony/Framework/WebBundle/Listener/ResponseFilter.php
  158. +1 2  src/Symfony/Framework/WebBundle/Resources/skeleton/application/xml/Kernel.php
  159. +1 2  src/Symfony/Framework/WebBundle/Resources/skeleton/application/yaml/Kernel.php
  160. +5 10 src/Symfony/Framework/WebBundle/Session/NativeSession.php
  161. +11 27 src/Symfony/Framework/WebBundle/Session/PdoSession.php
  162. +1 2  src/Symfony/Framework/WebBundle/Templating/Debugger.php
  163. +8 17 src/Symfony/Framework/WebBundle/Templating/Engine.php
  164. +1 2  src/Symfony/Framework/WebBundle/User.php
  165. +25 55 src/Symfony/Framework/WebBundle/Util/Filesystem.php
  166. +1 2  src/Symfony/Framework/WebBundle/Util/Mustache.php
  167. +2 4 src/Symfony/Framework/ZendBundle/DependencyInjection/ZendExtension.php
  168. +6 15 tests/Symfony/Tests/Components/BrowserKit/ClientTest.php
  169. +6 15 tests/Symfony/Tests/Components/BrowserKit/HistoryTest.php
  170. +14 35 tests/Symfony/Tests/Components/Console/ApplicationTest.php
  171. +10 25 tests/Symfony/Tests/Components/Console/Command/CommandTest.php
  172. +12 30 tests/Symfony/Tests/Components/Console/Input/ArgvInputTest.php
  173. +8 20 tests/Symfony/Tests/Components/Console/Input/ArrayInputTest.php
  174. +6 15 tests/Symfony/Tests/Components/Console/Input/InputArgumentTest.php
  175. +18 45 tests/Symfony/Tests/Components/Console/Input/InputDefinitionTest.php
  176. +8 20 tests/Symfony/Tests/Components/Console/Input/InputOptionTest.php
  177. +12 30 tests/Symfony/Tests/Components/Console/Input/InputTest.php
  178. +4 10 tests/Symfony/Tests/Components/Console/Output/OutputTest.php
  179. +2 5 tests/Symfony/Tests/Components/Console/Output/StreamOutputTest.php
  180. +1 2  tests/Symfony/Tests/Components/CssSelector/Node/AttribNodeTest.php
  181. +1 2  tests/Symfony/Tests/Components/CssSelector/Node/CombinedSelectorNodeTest.php
  182. +2 5 tests/Symfony/Tests/Components/CssSelector/ParserTest.php
  183. +1 2  tests/Symfony/Tests/Components/CssSelector/TokenizerTest.php
  184. +6 15 tests/Symfony/Tests/Components/DependencyInjection/BuilderConfigurationTest.php
  185. +14 35 tests/Symfony/Tests/Components/DependencyInjection/BuilderTest.php
  186. +14 35 tests/Symfony/Tests/Components/DependencyInjection/ContainerTest.php
  187. +2 4 tests/Symfony/Tests/Components/DependencyInjection/CrossCheckTest.php
  188. +2 5 tests/Symfony/Tests/Components/DependencyInjection/Dumper/DumperTest.php
  189. +2 5 tests/Symfony/Tests/Components/DependencyInjection/Dumper/PhpDumperTest.php
  190. +2 5 tests/Symfony/Tests/Components/DependencyInjection/Dumper/XmlDumperTest.php
  191. +2 5 tests/Symfony/Tests/Components/DependencyInjection/Dumper/YamlDumperTest.php
  192. +4 10 tests/Symfony/Tests/Components/DependencyInjection/Loader/IniFileLoaderTest.php
  193. +2 5 tests/Symfony/Tests/Components/DependencyInjection/Loader/LoaderExtensionTest.php
  194. +10 25 tests/Symfony/Tests/Components/DependencyInjection/Loader/XmlFileLoaderTest.php
  195. +10 25 tests/Symfony/Tests/Components/DependencyInjection/Loader/YamlFileLoaderTest.php
  196. +20 49 tests/Symfony/Tests/Components/DomCrawler/CrawlerTest.php
  197. +19 46 tests/Symfony/Tests/Components/DomCrawler/Field/ChoiceFormFieldTest.php
  198. +6 15 tests/Symfony/Tests/Components/DomCrawler/Field/FileFormFieldTest.php
  199. +1 2  tests/Symfony/Tests/Components/DomCrawler/Field/FormFieldTestCase.php
  200. +6 15 tests/Symfony/Tests/Components/DomCrawler/Field/InputFormFieldTest.php
  201. +2 5 tests/Symfony/Tests/Components/DomCrawler/Field/TextareaFormFieldTest.php
  202. +12 30 tests/Symfony/Tests/Components/DomCrawler/FormTest.php
  203. +2 5 tests/Symfony/Tests/Components/DomCrawler/LinkTest.php
  204. +4 10 tests/Symfony/Tests/Components/EventDispatcher/EventTest.php
  205. +7 16 tests/Symfony/Tests/Components/Finder/FinderTest.php
  206. +2 4 tests/Symfony/Tests/Components/Finder/GlobTest.php
  207. +1 2  tests/Symfony/Tests/Components/Finder/Iterator/Iterator.php
  208. +5 12 tests/Symfony/Tests/Components/Finder/Iterator/RealIteratorTestCase.php
  209. +2 5 tests/Symfony/Tests/Components/Finder/Iterator/SortableIteratorTest.php
  210. +4 9 tests/Symfony/Tests/Components/Finder/NumberCompareTest.php
  211. +8 20 tests/Symfony/Tests/Components/HttpKernel/Test/ClientTest.php
  212. +5 12 tests/Symfony/Tests/Components/OutputEscaper/ArrayDecoratorTest.php
  213. +2 5 tests/Symfony/Tests/Components/OutputEscaper/EscaperTest.php
  214. +1 2  tests/Symfony/Tests/Components/OutputEscaper/SafeDecoratorTest.php
  215. +9 22 tests/Symfony/Tests/Components/Templating/EngineTest.php
  216. +1 2  tests/Symfony/Tests/Components/Templating/Helper/AssetsTest.php
  217. +4 10 tests/Symfony/Tests/Components/Templating/Helper/SlotsHelperTest.php
  218. +1 2  tests/Symfony/Tests/Components/Templating/Loader/CacheLoaderTest.php
  219. +5 12 tests/Symfony/Tests/Components/Yaml/DumperTest.php
  220. +4 8 tests/Symfony/Tests/Components/Yaml/InlineTest.php
  221. +6 14 tests/Symfony/Tests/Components/Yaml/ParserTest.php
  222. +2 4 tests/fixtures/Symfony/Components/DependencyInjection/php/services9.php
  223. +1 2  tests/lib/SymfonyTests/Components/Templating/ProjectTemplateDebugger.php
44 src/Symfony/Components/BrowserKit/Client.php
@@ -75,8 +75,7 @@ public function followRedirects($followRedirect = true)
75 75 */
76 76 public function insulate($insulated = true)
77 77 {
78   - if (!class_exists('Symfony\\Components\\Process\\Process'))
79   - {
  78 + if (!class_exists('Symfony\\Components\\Process\\Process')) {
80 79 // @codeCoverageIgnoreStart
81 80 throw new \RuntimeException('Unable to isolate requests as the Symfony Process Component is not installed.');
82 81 // @codeCoverageIgnoreEnd
@@ -189,8 +188,7 @@ public function request($method, $uri, $parameters = array(), $headers = array()
189 188 $uri = $this->getAbsoluteUri($uri);
190 189
191 190 $server = array_merge($this->server, $server);
192   - if (!$this->history->isEmpty())
193   - {
  191 + if (!$this->history->isEmpty()) {
194 192 $server['HTTP_REFERER'] = $this->history->current()->getUri();
195 193 }
196 194 $server['HTTP_HOST'] = parse_url($uri, PHP_URL_HOST);
@@ -200,17 +198,13 @@ public function request($method, $uri, $parameters = array(), $headers = array()
200 198
201 199 $this->request = $this->filterRequest($request);
202 200
203   - if (true === $changeHistory)
204   - {
  201 + if (true === $changeHistory) {
205 202 $this->history->add($request);
206 203 }
207 204
208   - if ($this->insulated)
209   - {
  205 + if ($this->insulated) {
210 206 $this->response = $this->doRequestInProcess($this->request);
211   - }
212   - else
213   - {
  207 + } else {
214 208 $this->response = $this->doRequest($this->request);
215 209 }
216 210
@@ -220,8 +214,7 @@ public function request($method, $uri, $parameters = array(), $headers = array()
220 214
221 215 $this->redirect = $response->getHeader('Location');
222 216
223   - if ($this->followRedirects && $this->redirect)
224   - {
  217 + if ($this->followRedirects && $this->redirect) {
225 218 return $this->crawler = $this->followRedirect();
226 219 }
227 220
@@ -242,8 +235,7 @@ protected function doRequestInProcess($request)
242 235 $process = new PhpProcess($this->getScript($request));
243 236 $process->run();
244 237
245   - if ($process->getExitCode() > 0)
246   - {
  238 + if ($process->getExitCode() > 0) {
247 239 throw new \RuntimeException($process->getErrorOutput());
248 240 }
249 241
@@ -324,8 +316,7 @@ public function reload()
324 316 */
325 317 public function followRedirect()
326 318 {
327   - if (empty($this->redirect))
328   - {
  319 + if (empty($this->redirect)) {
329 320 throw new \LogicException('The request was not redirected.');
330 321 }
331 322
@@ -346,17 +337,13 @@ public function restart()
346 337 protected function getAbsoluteUri($uri)
347 338 {
348 339 // already absolute?
349   - if ('http' === substr($uri, 0, 4))
350   - {
  340 + if ('http' === substr($uri, 0, 4)) {
351 341 return $uri;
352 342 }
353 343
354   - if (!$this->history->isEmpty())
355   - {
  344 + if (!$this->history->isEmpty()) {
356 345 $currentUri = $this->history->current()->getUri();
357   - }
358   - else
359   - {
  346 + } else {
360 347 $currentUri = sprintf('http%s://%s/',
361 348 isset($this->server['HTTPS']) ? 's' : '',
362 349 isset($this->server['HTTP_HOST']) ? $this->server['HTTP_HOST'] : 'localhost'
@@ -364,17 +351,14 @@ protected function getAbsoluteUri($uri)
364 351 }
365 352
366 353 // anchor?
367   - if (!$uri || '#' == $uri[0])
368   - {
  354 + if (!$uri || '#' == $uri[0]) {
369 355 return preg_replace('/#.*?$/', '', $currentUri).$uri;
370 356 }
371 357
372   - if ('/' !== $uri[0])
373   - {
  358 + if ('/' !== $uri[0]) {
374 359 $path = parse_url($currentUri, PHP_URL_PATH);
375 360
376   - if ('/' !== substr($path, -1))
377   - {
  361 + if ('/' !== substr($path, -1)) {
378 362 $path = substr($path, 0, strrpos($path, '/') + 1);
379 363 }
380 364
15 src/Symfony/Components/BrowserKit/CookieJar.php
@@ -71,8 +71,7 @@ public function clear()
71 71 */
72 72 public function updateFromResponse(Response $response)
73 73 {
74   - foreach ($response->getCookies() as $name => $cookie)
75   - {
  74 + foreach ($response->getCookies() as $name => $cookie) {
76 75 $this->set(new Cookie(
77 76 $name,
78 77 isset($cookie['value']) ? $cookie['value'] : '',
@@ -110,20 +109,17 @@ public function getValues($uri)
110 109 $parts = parse_url($uri);
111 110
112 111 $cookies = array();
113   - foreach ($this->cookieJar as $cookie)
114   - {
  112 + foreach ($this->cookieJar as $cookie) {
115 113 if ($cookie->getDomain() && $cookie->getDomain() != substr($parts['host'], -strlen($cookie->getDomain())))
116 114 {
117 115 continue;
118 116 }
119 117
120   - if ($cookie->getPath() != substr($parts['path'], 0, strlen($cookie->getPath())))
121   - {
  118 + if ($cookie->getPath() != substr($parts['path'], 0, strlen($cookie->getPath()))) {
122 119 continue;
123 120 }
124 121
125   - if ($cookie->isSecure() && 'https' != $parts['scheme'])
126   - {
  122 + if ($cookie->isSecure() && 'https' != $parts['scheme']) {
127 123 continue;
128 124 }
129 125
@@ -139,8 +135,7 @@ public function getValues($uri)
139 135 public function flushExpiredCookies()
140 136 {
141 137 $cookies = $this->cookieJar;
142   - foreach ($cookies as $name => $cookie)
143   - {
  138 + foreach ($cookies as $name => $cookie) {
144 139 if ($cookie->isExpired())
145 140 {
146 141 unset($this->cookieJar[$name]);
9 src/Symfony/Components/BrowserKit/History.php
@@ -71,8 +71,7 @@ public function isEmpty()
71 71 */
72 72 public function back()
73 73 {
74   - if ($this->position < 1)
75   - {
  74 + if ($this->position < 1) {
76 75 throw new \LogicException('You are already on the first page.');
77 76 }
78 77
@@ -88,8 +87,7 @@ public function back()
88 87 */
89 88 public function forward()
90 89 {
91   - if ($this->position > count($this->stack) - 2)
92   - {
  90 + if ($this->position > count($this->stack) - 2) {
93 91 throw new \LogicException('You are already on the last page.');
94 92 }
95 93
@@ -105,8 +103,7 @@ public function forward()
105 103 */
106 104 public function current()
107 105 {
108   - if (-1 == $this->position)
109   - {
  106 + if (-1 == $this->position) {
110 107 throw new \LogicException('The page history is empty.');
111 108 }
112 109
9 src/Symfony/Components/BrowserKit/Response.php
@@ -44,12 +44,10 @@ public function __construct($content = '', $status = 200, $headers = array(), $c
44 44 public function __toString()
45 45 {
46 46 $headers = '';
47   - foreach ($this->headers as $name => $value)
48   - {
  47 + foreach ($this->headers as $name => $value) {
49 48 $headers .= sprintf("%s: %s\n", $name, $value);
50 49 }
51   - foreach ($this->cookies as $name => $cookie)
52   - {
  50 + foreach ($this->cookies as $name => $cookie) {
53 51 $headers .= sprintf("Set-Cookie: %s=%s\n", $name, $cookie['value']);
54 52 }
55 53
@@ -95,8 +93,7 @@ public function getHeaders()
95 93 */
96 94 public function getHeader($header)
97 95 {
98   - foreach ($this->headers as $key => $value)
99   - {
  96 + foreach ($this->headers as $key => $value) {
100 97 if (str_replace('-', '_', strtolower($key)) == str_replace('-', '_', strtolower($header)))
101 98 {
102 99 return $value;
170 src/Symfony/Components/Console/Application.php
@@ -104,22 +104,17 @@ public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
104 104 */
105 105 public function run(InputInterface $input = null, OutputInterface $output = null)
106 106 {
107   - if (null === $input)
108   - {
  107 + if (null === $input) {
109 108 $input = new ArgvInput();
110 109 }
111 110
112   - if (null === $output)
113   - {
  111 + if (null === $output) {
114 112 $output = new ConsoleOutput();
115 113 }
116 114
117   - try
118   - {
  115 + try {
119 116 $statusCode = $this->doRun($input, $output);
120   - }
121   - catch (\Exception $e)
122   - {
  117 + } catch (\Exception $e) {
123 118 if (!$this->catchExceptions)
124 119 {
125 120 throw $e;
@@ -131,14 +126,11 @@ public function run(InputInterface $input = null, OutputInterface $output = null
131 126 $statusCode = is_numeric($statusCode) && $statusCode ? $statusCode : 1;
132 127 }
133 128
134   - if ($this->autoExit)
135   - {
  129 + if ($this->autoExit) {
136 130 // @codeCoverageIgnoreStart
137 131 exit($statusCode);
138 132 // @codeCoverageIgnoreEnd
139   - }
140   - else
141   - {
  133 + } else {
142 134 return $statusCode;
143 135 }
144 136 }
@@ -155,47 +147,37 @@ public function doRun(InputInterface $input, OutputInterface $output)
155 147 {
156 148 $name = $input->getFirstArgument('command');
157 149
158   - if (true === $input->hasParameterOption(array('--color', '-c')))
159   - {
  150 + if (true === $input->hasParameterOption(array('--color', '-c'))) {
160 151 $output->setDecorated(true);
161 152 }
162 153
163   - if (true === $input->hasParameterOption(array('--help', '-H')))
164   - {
  154 + if (true === $input->hasParameterOption(array('--help', '-H'))) {
165 155 if (!$name)
166 156 {
167 157 $name = 'help';
168 158 $input = new ArrayInput(array('command' => 'help'));
169   - }
170   - else
171   - {
  159 + } else {
172 160 $this->wantHelps = true;
173 161 }
174 162 }
175 163
176   - if (true === $input->hasParameterOption(array('--no-interaction', '-n')))
177   - {
  164 + if (true === $input->hasParameterOption(array('--no-interaction', '-n'))) {
178 165 $input->setInteractive(false);
179 166 }
180 167
181   - if (true === $input->hasParameterOption(array('--quiet', '-q')))
182   - {
  168 + if (true === $input->hasParameterOption(array('--quiet', '-q'))) {
183 169 $output->setVerbosity(Output::VERBOSITY_QUIET);
184   - }
185   - elseif (true === $input->hasParameterOption(array('--verbose', '-v')))
186   - {
  170 + } elseif (true === $input->hasParameterOption(array('--verbose', '-v'))) {
187 171 $output->setVerbosity(Output::VERBOSITY_VERBOSE);
188 172 }
189 173
190   - if (true === $input->hasParameterOption(array('--version', '-V')))
191   - {
  174 + if (true === $input->hasParameterOption(array('--version', '-V'))) {
192 175 $output->writeln($this->getLongVersion());
193 176
194 177 return 0;
195 178 }
196 179
197   - if (!$name)
198   - {
  180 + if (!$name) {
199 181 $name = 'list';
200 182 $input = new ArrayInput(array('command' => 'list'));
201 183 }
@@ -255,8 +237,7 @@ public function getHelp()
255 237 '<comment>Options:</comment>',
256 238 );
257 239
258   - foreach ($this->definition->getOptions() as $option)
259   - {
  240 + foreach ($this->definition->getOptions() as $option) {
260 241 $messages[] = sprintf(' %-29s %s %s',
261 242 '<info>--'.$option->getName().'</info>',
262 243 $option->getShortcut() ? '<info>-'.$option->getShortcut().'</info>' : ' ',
@@ -334,12 +315,9 @@ public function setVersion($version)
334 315 */
335 316 public function getLongVersion()
336 317 {
337   - if ('UNKNOWN' !== $this->getName() && 'UNKNOWN' !== $this->getVersion())
338   - {
  318 + if ('UNKNOWN' !== $this->getName() && 'UNKNOWN' !== $this->getVersion()) {
339 319 return sprintf('<info>%s</info> version <comment>%s</comment>', $this->getName(), $this->getVersion());
340   - }
341   - else
342   - {
  320 + } else {
343 321 return '<info>Console Tool</info>';
344 322 }
345 323 }
@@ -363,8 +341,7 @@ public function register($name)
363 341 */
364 342 public function addCommands(array $commands)
365 343 {
366   - foreach ($commands as $command)
367   - {
  344 + foreach ($commands as $command) {
368 345 $this->addCommand($command);
369 346 }
370 347 }
@@ -384,8 +361,7 @@ public function addCommand(Command $command)
384 361
385 362 $this->commands[$command->getFullName()] = $command;
386 363
387   - foreach ($command->getAliases() as $alias)
388   - {
  364 + foreach ($command->getAliases() as $alias) {
389 365 $this->aliases[$alias] = $command;
390 366 }
391 367
@@ -403,15 +379,13 @@ public function addCommand(Command $command)
403 379 */
404 380 public function getCommand($name)
405 381 {
406   - if (!isset($this->commands[$name]) && !isset($this->aliases[$name]))
407   - {
  382 + if (!isset($this->commands[$name]) && !isset($this->aliases[$name])) {
408 383 throw new \InvalidArgumentException(sprintf('The command "%s" does not exist.', $name));
409 384 }
410 385
411 386 $command = isset($this->commands[$name]) ? $this->commands[$name] : $this->aliases[$name];
412 387
413   - if ($this->wantHelps)
414   - {
  388 + if ($this->wantHelps) {
415 389 $this->wantHelps = false;
416 390
417 391 $helpCommand = $this->getCommand('help');
@@ -445,8 +419,7 @@ public function hasCommand($name)
445 419 public function getNamespaces()
446 420 {
447 421 $namespaces = array();
448   - foreach ($this->commands as $command)
449   - {
  422 + foreach ($this->commands as $command) {
450 423 if ($command->getNamespace())
451 424 {
452 425 $namespaces[$command->getNamespace()] = true;
@@ -467,13 +440,11 @@ public function findNamespace($namespace)
467 440 {
468 441 $abbrevs = static::getAbbreviations($this->getNamespaces());
469 442
470   - if (!isset($abbrevs[$namespace]))
471   - {
  443 + if (!isset($abbrevs[$namespace])) {
472 444 throw new \InvalidArgumentException(sprintf('There are no commands defined in the "%s" namespace.', $namespace));
473 445 }
474 446
475   - if (count($abbrevs[$namespace]) > 1)
476   - {
  447 + if (count($abbrevs[$namespace]) > 1) {
477 448 throw new \InvalidArgumentException(sprintf('The namespace "%s" is ambiguous (%s).', $namespace, $this->getAbbreviationSuggestions($abbrevs[$namespace])));
478 449 }
479 450
@@ -496,8 +467,7 @@ public function findCommand($name)
496 467 {
497 468 // namespace
498 469 $namespace = '';
499   - if (false !== $pos = strrpos($name, ':'))
500   - {
  470 + if (false !== $pos = strrpos($name, ':')) {
501 471 $namespace = $this->findNamespace(substr($name, 0, $pos));
502 472 $name = substr($name, $pos + 1);
503 473 }
@@ -506,8 +476,7 @@ public function findCommand($name)
506 476
507 477 // name
508 478 $commands = array();
509   - foreach ($this->commands as $command)
510   - {
  479 + foreach ($this->commands as $command) {
511 480 if ($command->getNamespace() == $namespace)
512 481 {
513 482 $commands[] = $command->getName();
@@ -515,13 +484,11 @@ public function findCommand($name)
515 484 }
516 485
517 486 $abbrevs = static::getAbbreviations($commands);
518   - if (isset($abbrevs[$name]) && 1 == count($abbrevs[$name]))
519   - {
  487 + if (isset($abbrevs[$name]) && 1 == count($abbrevs[$name])) {
520 488 return $this->getCommand($namespace ? $namespace.':'.$abbrevs[$name][0] : $abbrevs[$name][0]);
521 489 }
522 490
523   - if (isset($abbrevs[$name]) && count($abbrevs[$name]) > 1)
524   - {
  491 + if (isset($abbrevs[$name]) && count($abbrevs[$name]) > 1) {
525 492 $suggestions = $this->getAbbreviationSuggestions(array_map(function ($command) use ($namespace) { return $namespace.':'.$command; }, $abbrevs[$name]));
526 493
527 494 throw new \InvalidArgumentException(sprintf('Command "%s" is ambiguous (%s).', $fullName, $suggestions));
@@ -529,13 +496,11 @@ public function findCommand($name)
529 496
530 497 // aliases
531 498 $abbrevs = static::getAbbreviations(array_keys($this->aliases));
532   - if (!isset($abbrevs[$fullName]))
533   - {
  499 + if (!isset($abbrevs[$fullName])) {
534 500 throw new \InvalidArgumentException(sprintf('Command "%s" is not defined.', $fullName));
535 501 }
536 502
537   - if (count($abbrevs[$fullName]) > 1)
538   - {
  503 + if (count($abbrevs[$fullName]) > 1) {
539 504 throw new \InvalidArgumentException(sprintf('Command "%s" is ambiguous (%s).', $fullName, $this->getAbbreviationSuggestions($abbrevs[$fullName])));
540 505 }
541 506
@@ -553,14 +518,12 @@ public function findCommand($name)
553 518 */
554 519 public function getCommands($namespace = null)
555 520 {
556   - if (null === $namespace)
557   - {
  521 + if (null === $namespace) {
558 522 return $this->commands;
559 523 }
560 524
561 525 $commands = array();
562   - foreach ($this->commands as $name => $command)
563   - {
  526 + foreach ($this->commands as $name => $command) {
564 527 if ($namespace === $command->getNamespace())
565 528 {
566 529 $commands[$name] = $command;
@@ -580,25 +543,20 @@ public function getCommands($namespace = null)
580 543 static public function getAbbreviations($names)
581 544 {
582 545 $abbrevs = array();
583   - foreach ($names as $name)
584   - {
  546 + foreach ($names as $name) {
585 547 for ($len = strlen($name) - 1; $len > 0; --$len)
586 548 {
587 549 $abbrev = substr($name, 0, $len);
588   - if (!isset($abbrevs[$abbrev]))
589   - {
  550 + if (!isset($abbrevs[$abbrev])) {
590 551 $abbrevs[$abbrev] = array($name);
591   - }
592   - else
593   - {
  552 + } else {
594 553 $abbrevs[$abbrev][] = $name;
595 554 }
596 555 }
597 556 }
598 557
599 558 // Non-abbreviations always get entered, even if they aren't unique
600   - foreach ($names as $name)
601   - {
  559 + foreach ($names as $name) {
602 560 $abbrevs[$name] = array($name);
603 561 }
604 562
@@ -617,32 +575,26 @@ public function asText($namespace = null)
617 575 $commands = $namespace ? $this->getCommands($this->findNamespace($namespace)) : $this->commands;
618 576
619 577 $messages = array($this->getHelp(), '');
620   - if ($namespace)
621   - {
  578 + if ($namespace) {
622 579 $messages[] = sprintf("<comment>Available commands for the \"%s\" namespace:</comment>", $namespace);
623   - }
624   - else
625   - {
  580 + } else {
626 581 $messages[] = '<comment>Available commands:</comment>';
627 582 }
628 583
629 584 $width = 0;
630   - foreach ($commands as $command)
631   - {
  585 + foreach ($commands as $command) {
632 586 $width = strlen($command->getName()) > $width ? strlen($command->getName()) : $width;
633 587 }
634 588 $width += 2;
635 589
636 590 // add commands by namespace
637   - foreach ($this->sortCommands($commands) as $space => $commands)
638   - {
  591 + foreach ($this->sortCommands($commands) as $space => $commands) {
639 592 if (!$namespace && '_global' !== $space)
640 593 {
641 594 $messages[] = '<comment>'.$space.'</comment>';
642 595 }
643 596
644   - foreach ($commands as $command)
645   - {
  597 + foreach ($commands as $command) {
646 598 $aliases = $command->getAliases() ? '<comment> ('.implode(', ', $command->getAliases()).')</comment>' : '';
647 599
648 600 $messages[] = sprintf(" <info>%-${width}s</info> %s%s", ($command->getNamespace() ? ':' : '').$command->getName(), $command->getDescription(), $aliases);
@@ -670,26 +622,21 @@ public function asXml($namespace = null, $asDom = false)
670 622
671 623 $xml->appendChild($commandsXML = $dom->createElement('commands'));
672 624
673   - if ($namespace)
674   - {
  625 + if ($namespace) {
675 626 $commandsXML->setAttribute('namespace', $namespace);
676   - }
677   - else
678   - {
  627 + } else {
679 628 $xml->appendChild($namespacesXML = $dom->createElement('namespaces'));
680 629 }
681 630
682 631 // add commands by namespace
683   - foreach ($this->sortCommands($commands) as $space => $commands)
684   - {
  632 + foreach ($this->sortCommands($commands) as $space => $commands) {
685 633 if (!$namespace)
686 634 {
687 635 $namespacesXML->appendChild($namespaceArrayXML = $dom->createElement('namespace'));
688 636 $namespaceArrayXML->setAttribute('id', $space);
689 637 }
690 638
691   - foreach ($commands as $command)
692   - {
  639 + foreach ($commands as $command) {
693 640 if (!$namespace)
694 641 {
695 642 $namespaceArrayXML->appendChild($commandXML = $dom->createElement('command'));
@@ -725,36 +672,31 @@ public function renderException($e, $output)
725 672 $title = sprintf(' [%s] ', get_class($e));
726 673 $len = $strlen($title);
727 674 $lines = array();
728   - foreach (explode("\n", $e->getMessage()) as $line)
729   - {
  675 + foreach (explode("\n", $e->getMessage()) as $line) {
730 676 $lines[] = sprintf(' %s ', $line);
731 677 $len = max($strlen($line) + 4, $len);
732 678 }
733 679
734 680 $messages = array(str_repeat(' ', $len), $title.str_repeat(' ', $len - $strlen($title)));
735 681
736   - foreach ($lines as $line)
737   - {
  682 + foreach ($lines as $line) {
738 683 $messages[] = $line.str_repeat(' ', $len - $strlen($line));
739 684 }
740 685
741 686 $messages[] = str_repeat(' ', $len);
742 687
743 688 $output->writeln("\n");
744   - foreach ($messages as $message)
745   - {
  689 + foreach ($messages as $message) {
746 690 $output->writeln('<error>'.$message.'</error>');
747 691 }
748 692 $output->writeln("\n");
749 693
750   - if (null !== $this->runningCommand)
751   - {
  694 + if (null !== $this->runningCommand) {
752 695 $output->writeln(sprintf('<info>%s</info>', sprintf($this->runningCommand->getSynopsis(), $this->getName())));
753 696 $output->writeln("\n");
754 697 }
755 698
756   - if (Output::VERBOSITY_VERBOSE === $output->getVerbosity())
757   - {
  699 + if (Output::VERBOSITY_VERBOSE === $output->getVerbosity()) {
758 700 $output->writeln('</comment>Exception trace:</comment>');
759 701
760 702 // exception related properties
@@ -766,8 +708,7 @@ public function renderException($e, $output)
766 708 'args' => array(),
767 709 ));
768 710
769   - for ($i = 0, $count = count($trace); $i < $count; $i++)
770   - {
  711 + for ($i = 0, $count = count($trace); $i < $count; $i++) {
771 712 $class = isset($trace[$i]['class']) ? $trace[$i]['class'] : '';
772 713 $type = isset($trace[$i]['type']) ? $trace[$i]['type'] : '';
773 714 $function = $trace[$i]['function'];
@@ -784,12 +725,10 @@ public function renderException($e, $output)
784 725 private function sortCommands($commands)
785 726 {
786 727 $namespacedCommands = array();
787   - foreach ($commands as $name => $command)
788   - {
  728 + foreach ($commands as $name => $command) {
789 729 $key = $command->getNamespace() ? $command->getNamespace() : '_global';
790 730
791   - if (!isset($namespacedCommands[$key]))
792   - {
  731 + if (!isset($namespacedCommands[$key])) {
793 732 $namespacedCommands[$key] = array();
794 733 }
795 734
@@ -797,8 +736,7 @@ private function sortCommands($commands)
797 736 }
798 737 ksort($namespacedCommands);
799 738
800   - foreach ($namespacedCommands as $name => &$commands)
801   - {
  739 + foreach ($namespacedCommands as $name => &$commands) {
802 740 ksort($commands);
803 741 }
804 742
52 src/Symfony/Components/Console/Command/Command.php
@@ -53,15 +53,13 @@ public function __construct($name = null)
53 53 $this->applicationDefinitionMerged = false;
54 54 $this->aliases = array();
55 55
56   - if (null !== $name)
57   - {
  56 + if (null !== $name) {
58 57 $this->setName($name);
59 58 }
60 59
61 60 $this->configure();
62 61
63   - if (!$this->name)
64   - {
  62 + if (!$this->name) {
65 63 throw new \LogicException('The command name cannot be empty.');
66 64 }
67 65 }
@@ -133,12 +131,9 @@ public function run(InputInterface $input, OutputInterface $output)
133 131 $this->mergeApplicationDefinition();
134 132
135 133 // bind the input against the command specific arguments/options
136   - try
137   - {
  134 + try {
138 135 $input->bind($this->definition);
139   - }
140   - catch (\Exception $e)
141   - {
  136 + } catch (\Exception $e) {
142 137 if (!$this->ignoreValidationErrors)
143 138 {
144 139 throw $e;
@@ -147,19 +142,15 @@ public function run(InputInterface $input, OutputInterface $output)
147 142
148 143 $this->initialize($input, $output);
149 144
150   - if ($input->isInteractive())
151   - {
  145 + if ($input->isInteractive()) {
152 146 $this->interact($input, $output);
153 147 }
154 148
155 149 $input->validate();
156 150
157   - if ($this->code)
158   - {
  151 + if ($this->code) {
159 152 return call_user_func($this->code, $input, $output);
160   - }
161   - else
162   - {
  153 + } else {
163 154 return $this->execute($input, $output);
164 155 }
165 156 }
@@ -183,8 +174,7 @@ public function setCode(\Closure $code)
183 174 */
184 175 protected function mergeApplicationDefinition()
185 176 {
186   - if (null === $this->application || true === $this->applicationDefinitionMerged)
187   - {
  177 + if (null === $this->application || true === $this->applicationDefinitionMerged) {
188 178 return;
189 179 }
190 180
@@ -207,12 +197,9 @@ protected function mergeApplicationDefinition()
207 197 */
208 198 public function setDefinition($definition)
209 199 {
210   - if ($definition instanceof InputDefinition)
211   - {
  200 + if ($definition instanceof InputDefinition) {
212 201 $this->definition = $definition;
213   - }
214   - else
215   - {
  202 + } else {
216 203 $this->definition->setDefinition($definition);
217 204 }
218 205
@@ -282,18 +269,14 @@ public function addOption($name, $shortcut = null, $mode = null, $description =
282 269 */
283 270 public function setName($name)
284 271 {
285   - if (false !== $pos = strrpos($name, ':'))
286   - {
  272 + if (false !== $pos = strrpos($name, ':')) {
287 273 $namespace = substr($name, 0, $pos);
288 274 $name = substr($name, $pos + 1);
289   - }
290   - else
291   - {
  275 + } else {
292 276 $namespace = $this->namespace;
293 277 }
294 278
295   - if (!$name)
296   - {
  279 + if (!$name) {
297 280 throw new \InvalidArgumentException('A command name cannot be empty.');
298 281 }
299 282
@@ -478,15 +461,13 @@ public function asText()
478 461 '',
479 462 );
480 463
481   - if ($this->getAliases())
482   - {
  464 + if ($this->getAliases()) {
483 465 $messages[] = '<comment>Aliases:</comment> <info>'.implode(', ', $this->getAliases()).'</info>';
484 466 }
485 467
486 468 $messages[] = $this->definition->asText();
487 469
488   - if ($help = $this->getProcessedHelp())
489   - {
  470 + if ($help = $this->getProcessedHelp()) {
490 471 $messages[] = '<comment>Help:</comment>';
491 472 $messages[] = ' '.implode("\n ", explode("\n", $help))."\n";
492 473 }
@@ -521,8 +502,7 @@ public function asXml($asDom = false)
521 502 $helpXML->appendChild($dom->createTextNode(implode("\n ", explode("\n", $help))));
522 503
523 504 $commandXML->appendChild($aliasesXML = $dom->createElement('aliases'));
524   - foreach ($this->getAliases() as $alias)
525   - {
  505 + foreach ($this->getAliases() as $alias) {
526 506 $aliasesXML->appendChild($aliasXML = $dom->createElement('alias'));
527 507 $aliasXML->appendChild($dom->createTextNode($alias));
528 508 }
10 src/Symfony/Components/Console/Command/HelpCommand.php
@@ -66,17 +66,13 @@ public function setCommand(Command $command)
66 66 */
67 67 protected function execute(InputInterface $input, OutputInterface $output)
68 68 {
69   - if (null === $this->command)
70   - {
  69 + if (null === $this->command) {
71 70 $this->command = $this->application->getCommand($input->getArgument('command_name'));
72 71 }
73 72
74   - if ($input->getOption('xml'))
75   - {
  73 + if ($input->getOption('xml')) {
76 74 $output->writeln($this->command->asXml(), Output::OUTPUT_RAW);
77   - }
78   - else
79   - {
  75 + } else {
80 76 $output->writeln($this->command->asText());
81 77 }
82 78 }
7 src/Symfony/Components/Console/Command/ListCommand.php
@@ -60,12 +60,9 @@ protected function configure()
60 60 */
61 61 protected function execute(InputInterface $input, OutputInterface $output)
62 62 {
63   - if ($input->getOption('xml'))
64   - {
  63 + if ($input->getOption('xml')) {
65 64 $output->writeln($this->application->asXml($input->getArgument('namespace')), Output::OUTPUT_RAW);
66   - }
67   - else
68   - {
  65 + } else {
69 66 $output->writeln($this->application->asText($input->getArgument('namespace')));
70 67 }
71 68 }
20 src/Symfony/Components/Console/Helper/DialogHelper.php
@@ -57,17 +57,13 @@ public function askConfirmation(OutputInterface $output, $question, $default = t
57 57 {
58 58 // @codeCoverageIgnoreStart
59 59 $answer = 'z';
60   - while ($answer && !in_array(strtolower($answer[0]), array('y', 'n')))
61   - {
  60 + while ($answer && !in_array(strtolower($answer[0]), array('y', 'n'))) {
62 61 $answer = $this->ask($output, $question);
63 62 }
64 63
65   - if (false === $default)
66   - {
  64 + if (false === $default) {
67 65 return $answer && 'y' == strtolower($answer[0]);
68   - }
69   - else
70   - {
  66 + } else {
71 67 return !$answer || 'y' == strtolower($answer[0]);
72 68 }
73 69 // @codeCoverageIgnoreEnd
@@ -89,8 +85,7 @@ public function askAndValidate(OutputInterface $output, $question, \Closure $val
89 85 {
90 86 // @codeCoverageIgnoreStart
91 87 $error = null;
92   - while (false === $attempts || $attempts--)
93   - {
  88 + while (false === $attempts || $attempts--) {
94 89 if (null !== $error)
95 90 {
96 91 $output->writeln($this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error'));
@@ -98,12 +93,9 @@ public function askAndValidate(OutputInterface $output, $question, \Closure $val
98 93
99 94 $value = $this->ask($output, $question, null);
100 95
101   - try
102   - {
  96 + try {
103 97 return $validator($value);
104   - }
105   - catch (\Exception $error)
106   - {
  98 + } catch (\Exception $error) {
107 99 }
108 100 }
109 101
15 src/Symfony/Components/Console/Helper/FormatterHelper.php
@@ -43,31 +43,26 @@ public function formatSection($section, $message, $style = 'info')
43 43 */
44 44 public function formatBlock($messages, $style, $large = false)
45 45 {
46   - if (!is_array($messages))
47   - {
  46 + if (!is_array($messages)) {
48 47 $messages = array($messages);
49 48 }
50 49
51 50 $len = 0;
52 51 $lines = array();
53   - foreach ($messages as $message)
54   - {
  52 + foreach ($messages as $message) {
55 53 $lines[] = sprintf($large ? ' %s ' : ' %s ', $message);
56 54 $len = max($this->strlen($message) + ($large ? 4 : 2), $len);
57 55 }
58 56
59 57 $messages = $large ? array(str_repeat(' ', $len)) : array();
60   - foreach ($lines as $line)
61   - {
  58 + foreach ($lines as $line) {
62 59 $messages[] = $line.str_repeat(' ', $len - $this->strlen($line));
63 60 }
64   - if ($large)
65   - {
  61 + if ($large) {
66 62 $messages[] = str_repeat(' ', $len);
67 63 }
68 64
69   - foreach ($messages as &$message)
70   - {
  65 + foreach ($messages as &$message) {
71 66 $message = sprintf('<%s>%s</%s>', $style, $message, $style);
72 67 }
73 68
9 src/Symfony/Components/Console/Helper/HelperSet.php
@@ -31,8 +31,7 @@ class HelperSet
31 31 */
32 32 public function __construct(array $helpers = array())
33 33 {
34   - foreach ($helpers as $alias => $helper)
35   - {
  34 + foreach ($helpers as $alias => $helper) {
36 35 $this->set($helper, is_int($alias) ? null : $alias);
37 36 }
38 37 }
@@ -46,8 +45,7 @@ public function __construct(array $helpers = array())