@@ -46,7 +46,7 @@ |
||
| 46 | 46 | public static function paginateItems( |
| 47 | 47 | $items, |
| 48 | 48 | int $index, |
| 49 | - Keyboard &$keyboard, |
|
| 49 | + Keyboard & $keyboard, |
|
| 50 | 50 | callable $format_item, |
| 51 | 51 | int $item_per_page = 3, |
| 52 | 52 | string $prefix = 'list', |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * @param CoreBot $bot References to the bot that's using the inline keyboard. |
| 39 | 39 | * @param array $buttons Buttons passed as inizialization. |
| 40 | 40 | */ |
| 41 | - public function __construct(CoreBot &$bot, array $buttons = array()) |
|
| 41 | + public function __construct(CoreBot & $bot, array $buttons = array()) |
|
| 42 | 42 | { |
| 43 | 43 | $this->bot = $bot; |
| 44 | 44 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | public function getBackButton(bool $json_serialized = true) |
| 56 | 56 | { |
| 57 | 57 | // Create the button |
| 58 | - $inline_keyboard = [ 'inline_keyboard' => |
|
| 58 | + $inline_keyboard = ['inline_keyboard' => |
|
| 59 | 59 | [ |
| 60 | 60 | [ |
| 61 | 61 | [ |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | public function getBackSkipKeyboard(bool $json_serialized = true) |
| 91 | 91 | { |
| 92 | 92 | // Create the keyboard |
| 93 | - $inline_keyboard = [ 'inline_keyboard' => |
|
| 93 | + $inline_keyboard = ['inline_keyboard' => |
|
| 94 | 94 | [ |
| 95 | 95 | [ |
| 96 | 96 | [ |
@@ -86,7 +86,7 @@ |
||
| 86 | 86 | * @{ |
| 87 | 87 | */ |
| 88 | 88 | |
| 89 | - public function __construct(BasicBot &$bot) |
|
| 89 | + public function __construct(BasicBot & $bot) |
|
| 90 | 90 | { |
| 91 | 91 | $this->bot = $bot; |
| 92 | 92 | } |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | /** \brief Current user/group language. */ |
| 48 | 48 | public $language; |
| 49 | 49 | |
| 50 | - public function __construct(BasicBot &$bot) |
|
| 50 | + public function __construct(BasicBot & $bot) |
|
| 51 | 51 | { |
| 52 | 52 | $this->bot = $bot; |
| 53 | 53 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * \brief Create a Database handler object. |
| 50 | 50 | * @param BasicBot $bot Reference to the bot that use this object. |
| 51 | 51 | */ |
| 52 | - public function __construct(BasicBot &$bot) |
|
| 52 | + public function __construct(BasicBot & $bot) |
|
| 53 | 53 | { |
| 54 | 54 | $this->bot = $bot; |
| 55 | 55 | } |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | public static function addDefaultValue(array $params) : array |
| 96 | 96 | { |
| 97 | - static $defaults = [ 'adapter' => PDO_DEFAULT_ADAPTER, 'host' => 'localhost', 'options' => [] ]; |
|
| 97 | + static $defaults = ['adapter' => PDO_DEFAULT_ADAPTER, 'host' => 'localhost', 'options' => []]; |
|
| 98 | 98 | return array_merge($defaults, $params); |
| 99 | 99 | } |
| 100 | 100 | |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | |
| 30 | 30 | // Add a welcome message |
| 31 | 31 | $start_command = new PhpBotFramework\Commands\MessageCommand('start', |
| 32 | - function ($bot, $message) { |
|
| 32 | + function($bot, $message) { |
|
| 33 | 33 | $bot->sendMessage('<strong>Hey there!</strong> Send or forward me a text message :)'); |
| 34 | 34 | } |
| 35 | 35 | ); |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | public function killEveryProcessRunningOnTuTuPort() |
| 104 | 104 | { |
| 105 | - $killerProcess = new Process(sprintf("kill $(lsof -t -i:%d)", (int) $this->tutuPort)); |
|
| 105 | + $killerProcess = new Process(sprintf("kill $(lsof -t -i:%d)", (int)$this->tutuPort)); |
|
| 106 | 106 | $killerProcess->run(); |
| 107 | 107 | } |
| 108 | 108 | |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | $fs->remove($resourceFilePath); |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - $fs->dumpFile($resourceFilePath, (string) $fileContent); |
|
| 128 | + $fs->dumpFile($resourceFilePath, (string)$fileContent); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | public function thereIsAFileWithFollowingContent($filePath, PyStringNode $fileContent) |
| 135 | 135 | { |
| 136 | 136 | $fs = new Filesystem(); |
| 137 | - $fs->dumpFile($this->workDir . '/' . $filePath, (string) $fileContent); |
|
| 137 | + $fs->dumpFile($this->workDir . '/' . $filePath, (string)$fileContent); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $fs->remove($configFilePath); |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - $content = (string) $fileContent; |
|
| 153 | + $content = (string)$fileContent; |
|
| 154 | 154 | $content = str_replace('%workDir%', $this->workDir, $content); |
| 155 | 155 | |
| 156 | 156 | $fs->dumpFile($configFilePath, $content); |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | { |
| 202 | 202 | $status = $this->getSession()->getStatusCode(); |
| 203 | 203 | if ($status !== (int)$expectedStatus) { |
| 204 | - throw new \RuntimeException(sprintf("Status %d is not equal to %d.", $status, (int) $expectedStatus)); |
|
| 204 | + throw new \RuntimeException(sprintf("Status %d is not equal to %d.", $status, (int)$expectedStatus)); |
|
| 205 | 205 | } |
| 206 | 206 | } |
| 207 | 207 | |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | public function theResponseContentShouldBeEqualTo(PyStringNode $expectedContent) |
| 212 | 212 | { |
| 213 | 213 | $content = $this->getSession()->getDriver()->getContent(); |
| 214 | - if ((string) $content !== (string) $expectedContent) { |
|
| 214 | + if ((string)$content !== (string)$expectedContent) { |
|
| 215 | 215 | throw new \RuntimeException("Content is different than expected."); |
| 216 | 216 | } |
| 217 | 217 | } |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | public function theResponseContentShouldMatchExpression(PyStringNode $pattern) |
| 223 | 223 | { |
| 224 | 224 | $content = $this->getSession()->getDriver()->getContent(); |
| 225 | - expect($content)->toMatch('/'.$pattern.'/'); |
|
| 225 | + expect($content)->toMatch('/' . $pattern . '/'); |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | /** |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | */ |
| 303 | 303 | public function httpClientSendGetRequestOnWithBody($method, $url, PyStringNode $body) |
| 304 | 304 | { |
| 305 | - $this->makeHttpCall($method, $url, [], [], (string) $body); |
|
| 305 | + $this->makeHttpCall($method, $url, [], [], (string)$body); |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | /** |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | $this->httpCallAttemptsPerScenario++; |
| 332 | 332 | $this->tutuIsRunningOnHostAtPort($this->tutuHost, $this->tutuPort); |
| 333 | 333 | $this->makeHttpCall($method, $url, $parameters, $headers, $body); |
| 334 | - return ; |
|
| 334 | + return; |
|
| 335 | 335 | } |
| 336 | 336 | } |
| 337 | 337 | |
@@ -77,14 +77,14 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | private function registerClassLoader() |
| 79 | 79 | { |
| 80 | - $this->container->setStaticDefinition('class_loader', function ($container) { |
|
| 80 | + $this->container->setStaticDefinition('class_loader', function($container) { |
|
| 81 | 81 | return new ClassLoader(); |
| 82 | 82 | }); |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | private function registerPHPMatcher() |
| 86 | 86 | { |
| 87 | - $this->container->setStaticDefinition('php_matcher', function ($container) { |
|
| 87 | + $this->container->setStaticDefinition('php_matcher', function($container) { |
|
| 88 | 88 | return (new SimpleFactory())->createMatcher(); |
| 89 | 89 | }); |
| 90 | 90 | } |
@@ -105,14 +105,14 @@ discard block |
||
| 105 | 105 | $resourcesPath |
| 106 | 106 | ); |
| 107 | 107 | |
| 108 | - $this->container->setStaticDefinition('twig_loader', function ($container) { |
|
| 108 | + $this->container->setStaticDefinition('twig_loader', function($container) { |
|
| 109 | 109 | $stringLoader = new \Twig_Loader_String(); |
| 110 | 110 | $filesystemLoader = new \Twig_Loader_Filesystem(); |
| 111 | 111 | $filesystemLoader->addPath($container->getParameter('resources_path'), 'resources'); |
| 112 | 112 | return new \Twig_Loader_Chain([$filesystemLoader, $stringLoader]); |
| 113 | 113 | }); |
| 114 | 114 | |
| 115 | - $this->container->setStaticDefinition('twig' ,function ($container) { |
|
| 115 | + $this->container->setStaticDefinition('twig', function($container) { |
|
| 116 | 116 | $defaultOptions = [ |
| 117 | 117 | 'cache' => $container->getParameter('tutu.root_path') . '/var/twig', |
| 118 | 118 | 'globals' => [] |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | |
| 140 | 140 | private function registerEventDispatcher() |
| 141 | 141 | { |
| 142 | - $this->container->setStaticDefinition('event_dispatcher' , function ($container) { |
|
| 142 | + $this->container->setStaticDefinition('event_dispatcher', function($container) { |
|
| 143 | 143 | $eventDispatcher = new EventDispatcher(); |
| 144 | 144 | $eventSubscribers = $container->getServicesByTag('event_dispatcher.subscriber'); |
| 145 | 145 | foreach ($eventSubscribers as $subscriber) { |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | |
| 153 | 153 | private function registerExtensionInitializer() |
| 154 | 154 | { |
| 155 | - $this->container->setDefinition('extension.initializer', function ($container) { |
|
| 155 | + $this->container->setDefinition('extension.initializer', function($container) { |
|
| 156 | 156 | return new Initializer($this->container->getService('class_loader')); |
| 157 | 157 | }); |
| 158 | 158 | } |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | $responsesPath |
| 174 | 174 | ); |
| 175 | 175 | |
| 176 | - $this->container->setDefinition('response.config.loader.yaml', function ($container) { |
|
| 176 | + $this->container->setDefinition('response.config.loader.yaml', function($container) { |
|
| 177 | 177 | return new YamlLoader($container->getParameter('responses_file_path')); |
| 178 | 178 | }); |
| 179 | 179 | } |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | }, ['matching_policy']); |
| 198 | 198 | |
| 199 | 199 | |
| 200 | - $this->container->setDefinition('request.matching_policy', function ($container) { |
|
| 200 | + $this->container->setDefinition('request.matching_policy', function($container) { |
|
| 201 | 201 | $matchingPolicy = new ChainMatchingPolicy(); |
| 202 | 202 | $matchingPolicies = $container->getServicesByTag('matching_policy'); |
| 203 | 203 | foreach ($matchingPolicies as $policy) { |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | |
| 211 | 211 | private function registerConfigResolver() |
| 212 | 212 | { |
| 213 | - $this->container->setStaticDefinition('response.config.resolver', function ($container) { |
|
| 213 | + $this->container->setStaticDefinition('response.config.resolver', function($container) { |
|
| 214 | 214 | return new Resolver( |
| 215 | 215 | $container->getService('response.config.loader.yaml'), |
| 216 | 216 | $container->getService('request.matching_policy') |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | $this->container->setDefinition('request.path.parser', function($container) { |
| 224 | 224 | return new Parser(); |
| 225 | 225 | }); |
| 226 | - $this->container->setDefinition('response.builder', function ($container) { |
|
| 226 | + $this->container->setDefinition('response.builder', function($container) { |
|
| 227 | 227 | return new Builder($container->getService('twig'), $container->getService('request.path.parser')); |
| 228 | 228 | }); |
| 229 | 229 | } |
@@ -264,10 +264,10 @@ discard block |
||
| 264 | 264 | |
| 265 | 265 | if ($customPath = getenv('tutu_config')) { |
| 266 | 266 | if (!file_exists($customPath)) { |
| 267 | - throw new \RuntimeException('Custom config file not found at '.$customPath); |
|
| 267 | + throw new \RuntimeException('Custom config file not found at ' . $customPath); |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | - $configFiles = (array) $customPath; |
|
| 270 | + $configFiles = (array)$customPath; |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | foreach ($configFiles as $filePath) { |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | private function getExtensionArgumentsValues($arguments) |
| 313 | 313 | { |
| 314 | 314 | if (is_null($arguments)) { |
| 315 | - return ; |
|
| 315 | + return; |
|
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | if (is_array($arguments)) { |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | return $value; |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | - if ($value[0] != '%' || $value[strlen($value) - 1] != '%') { |
|
| 343 | + if ($value[0] != '%' || $value[strlen($value) - 1] != '%') { |
|
| 344 | 344 | return $value; |
| 345 | 345 | } |
| 346 | 346 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function setAllowedMethods($methods) |
| 72 | 72 | { |
| 73 | - $this->allowedMethods = array_map(function ($method) { |
|
| 73 | + $this->allowedMethods = array_map(function($method) { |
|
| 74 | 74 | return strtoupper($method); |
| 75 | 75 | }, $methods); |
| 76 | 76 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | public function hasBodyParameters() |
| 98 | 98 | { |
| 99 | - return (boolean) count($this->request); |
|
| 99 | + return (boolean)count($this->request); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | */ |
| 121 | 121 | public function hasQueryParameters() |
| 122 | 122 | { |
| 123 | - return (boolean) count($this->query); |
|
| 123 | + return (boolean)count($this->query); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | /** |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | public function hasHeaders() |
| 146 | 146 | { |
| 147 | - return (boolean) count($this->headers); |
|
| 147 | + return (boolean)count($this->headers); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** |