Passed
Push — master ( e4cb94...6c843c )
by Jakub
02:09
created
tests/HeroesofAbenez/Chat/ChatControlTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
     public function setUp(): void
23 23
     {
24 24
         static $control = null;
25
-        if ($control === null) {
25
+        if($control === null) {
26 26
             /** @var IExampleChatControlFactory $factory */
27 27
             $factory = $this->getService(IExampleChatControlFactory::class);
28 28
             $control = $factory->create();
Please login to merge, or discard this patch.
tests/HeroesofAbenez/Chat/DI/ChatExtensionTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
                 ],
42 42
             ]
43 43
         ];
44
-        Assert::exception(function () use ($config) {
44
+        Assert::exception(function() use ($config) {
45 45
             $this->refreshContainer($config);
46 46
         }, InvalidChatControlFactoryException::class);
47 47
         $config["chat"]["chats"]["abc"] = IFakeFactory::class;
48
-        Assert::exception(function () use ($config) {
48
+        Assert::exception(function() use ($config) {
49 49
             $this->refreshContainer($config);
50 50
         }, InvalidChatControlFactoryException::class);
51 51
     }
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
                 ],
60 60
             ],
61 61
         ];
62
-        Assert::exception(function () use ($config) {
62
+        Assert::exception(function() use ($config) {
63 63
             $this->refreshContainer($config);
64 64
         }, InvalidMessageProcessorException::class);
65 65
     }
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
                 "databaseAdapter" => \stdClass::class,
72 72
             ],
73 73
         ];
74
-        Assert::exception(function () use ($config) {
74
+        Assert::exception(function() use ($config) {
75 75
             $this->refreshContainer($config);
76 76
         }, InvalidDatabaseAdapterException::class);
77 77
     }
Please login to merge, or discard this patch.
tests/HeroesofAbenez/Chat/FakeDatabaseAdapter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
     public function getTexts(string $column, $value, int $limit): ChatMessagesCollection
19 19
     {
20 20
         $texts = new ChatMessagesCollection();
21
-        for ($i = 1; $i <= $limit; $i++) {
21
+        for($i = 1; $i <= $limit; $i++) {
22 22
             $texts[] = new ChatMessage($i, "text", "now", $this->getFakeCharacter());
23 23
         }
24 24
         return $texts;
Please login to merge, or discard this patch.
tests/HeroesofAbenez/Chat/ChatCommandsProcessorTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
         $model = clone $this->model;
32 32
         $model->addCommand(new Test2Command());
33 33
         Assert::same("test", $model->parse("/" . Test2Command::NAME));
34
-        Assert::exception(function () use ($model) {
34
+        Assert::exception(function() use ($model) {
35 35
             $model->addCommand(new Test2Command());
36 36
         }, CommandNameAlreadyUsedException::class);
37 37
     }
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
         $model = clone $this->model;
42 42
         $model->addAlias(self::COMMAND_NAME, "test");
43 43
         Assert::same("passed", $model->parse("/test"));
44
-        Assert::exception(function () use ($model) {
44
+        Assert::exception(function() use ($model) {
45 45
             $model->addAlias("abc", "test");
46 46
         }, CommandNotFoundException::class);
47
-        Assert::exception(function () use ($model) {
47
+        Assert::exception(function() use ($model) {
48 48
             $model->addAlias(self::COMMAND_NAME, "test");
49 49
         }, CommandNameAlreadyUsedException::class);
50 50
     }
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     public function getTexts(): array
63 63
     {
64 64
         return [
65
-            ["anagfdffd", "/anagfdffd",]
65
+            ["anagfdffd", "/anagfdffd", ]
66 66
         ];
67 67
     }
68 68
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     public function testGetCommand(): void
93 93
     {
94 94
         Assert::type(IChatCommand::class, $this->model->getCommand(self::COMMAND_NAME));
95
-        Assert::exception(function () {
95
+        Assert::exception(function() {
96 96
             $this->model->getCommand("abc");
97 97
         }, CommandNotFoundException::class);
98 98
     }
Please login to merge, or discard this patch.
tests/bootstrap.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 declare(strict_types=1);
3 3
 
4 4
 require __DIR__ . "/../vendor/autoload.php";
5
-Testbench\Bootstrap::setup(__DIR__ . '/_temp', function (\Nette\Bootstrap\Configurator $configurator): void {
6
-    $configurator->addStaticParameters(["appDir" => __DIR__,]);
5
+Testbench\Bootstrap::setup(__DIR__ . '/_temp', function(\Nette\Bootstrap\Configurator $configurator): void {
6
+    $configurator->addStaticParameters(["appDir" => __DIR__, ]);
7 7
     $configurator->addConfig(__DIR__ . "/tests.neon");
8 8
 });
Please login to merge, or discard this patch.
src/ChatControl.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public function setMessagesPerPage(int $messagesPerPage): void
47 47
     {
48
-        if ($messagesPerPage < 0) {
48
+        if($messagesPerPage < 0) {
49 49
             $messagesPerPage = 0;
50 50
         }
51 51
         $this->messagesPerPage = $messagesPerPage;
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
 
103 103
     protected function processMessage(string $message): ?string
104 104
     {
105
-        foreach ($this->messageProcessors as $processor) {
105
+        foreach($this->messageProcessors as $processor) {
106 106
             $result = $processor->parse($message);
107
-            if (is_string($result)) {
107
+            if(is_string($result)) {
108 108
                 return $result;
109 109
             }
110 110
         }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
     public function newMessage(string $message): void
118 118
     {
119 119
         $result = $this->processMessage($message);
120
-        if ($result !== null) {
120
+        if($result !== null) {
121 121
             $this->presenter->flashMessage($result);
122 122
         } else {
123 123
             $this->database->addMessage($message, $this->textColumn, $this->textValue);
Please login to merge, or discard this patch.
src/IDatabaseAdapter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
 
5 5
 namespace HeroesofAbenez\Chat;
6 6
 
7
-if (false) {
7
+if(false) {
8 8
     /** @deprecated use DatabaseAdapter */
9 9
     interface IDatabaseAdapter extends DatabaseAdapter
10 10
     {
Please login to merge, or discard this patch.
src/DI/ChatExtension.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
     {
53 53
         try {
54 54
             $rm = new \ReflectionMethod($interface, "create");
55
-        } catch (\ReflectionException $e) {
55
+        } catch(\ReflectionException $e) {
56 56
             throw new InvalidChatControlFactoryException("Interface $interface does not contain method create.", 0, $e);
57 57
         }
58 58
         $returnType = $rm->getReturnType();
59
-        if ($returnType === null || !is_subclass_of($returnType->getName(), ChatControl::class)) {
59
+        if($returnType === null || !is_subclass_of($returnType->getName(), ChatControl::class)) {
60 60
             throw new InvalidChatControlFactoryException(
61 61
                 "Return type of $interface::create() is not a subtype of " . ChatControl::class . "."
62 62
             );
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     private function getChats(): array
70 70
     {
71 71
         $chats = [];
72
-        foreach ($this->config->chats as $name => $interface) {
72
+        foreach($this->config->chats as $name => $interface) {
73 73
             $this->validateFactory($interface);
74 74
             $chats[$name] = $interface;
75 75
         }
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
     private function getMessageProcessors(): array
83 83
     {
84 84
         $messageProcessors = [];
85
-        foreach ($this->config->messageProcessors as $name => $processor) {
86
-            if (!is_subclass_of($processor, ChatMessageProcessor::class)) {
85
+        foreach($this->config->messageProcessors as $name => $processor) {
86
+            if(!is_subclass_of($processor, ChatMessageProcessor::class)) {
87 87
                 throw new InvalidMessageProcessorException("Invalid message processor $processor.");
88 88
             }
89 89
             $messageProcessors[$name] = $processor;
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     private function getDatabaseAdapter(): string
98 98
     {
99 99
         $adapter = $this->config->databaseAdapter;
100
-        if (!is_subclass_of($adapter, DatabaseAdapter::class)) {
100
+        if(!is_subclass_of($adapter, DatabaseAdapter::class)) {
101 101
             throw new InvalidDatabaseAdapterException("Invalid database adapter $adapter.");
102 102
         }
103 103
         return $adapter;
@@ -113,16 +113,16 @@  discard block
 block discarded – undo
113 113
         $builder = $this->getContainerBuilder();
114 114
         $chats = $this->getChats();
115 115
         $characterProfileLink = $this->config->characterProfileLink;
116
-        foreach ($chats as $name => $interface) {
116
+        foreach($chats as $name => $interface) {
117 117
             $chat = $builder->addFactoryDefinition($this->prefix($name))
118 118
                 ->setImplement($interface)
119 119
                 ->addTag(self::TAG_CHAT);
120
-            if ($characterProfileLink !== "") {
120
+            if($characterProfileLink !== "") {
121 121
                 $chat->getResultDefinition()->addSetup("setCharacterProfileLink", [$characterProfileLink]);
122 122
             }
123 123
         }
124 124
         $messageProcessors = $this->getMessageProcessors();
125
-        foreach ($messageProcessors as $name => $processor) {
125
+        foreach($messageProcessors as $name => $processor) {
126 126
             $builder->addDefinition($this->prefix($name))
127 127
                 ->setType($processor);
128 128
         }
@@ -138,10 +138,10 @@  discard block
 block discarded – undo
138 138
         $builder = $this->getContainerBuilder();
139 139
         $chats = $this->getChats();
140 140
         $messageProcessors = $this->getMessageProcessors();
141
-        foreach ($chats as $chat => $chatClass) {
141
+        foreach($chats as $chat => $chatClass) {
142 142
             /** @var FactoryDefinition $chatService */
143 143
             $chatService = $builder->getDefinition($this->prefix($chat));
144
-            foreach ($messageProcessors as $processor => $processorClass) {
144
+            foreach($messageProcessors as $processor => $processorClass) {
145 145
                 $processorService = $builder->getDefinition($this->prefix($processor));
146 146
                 $chatService->getResultDefinition()->addSetup("addMessageProcessor", [$processorService]);
147 147
             }
@@ -154,11 +154,11 @@  discard block
 block discarded – undo
154 154
         try {
155 155
             /** @var ServiceDefinition $processor */
156 156
             $processor = $builder->getDefinition($this->prefix(self::SERVICE_CHAT_COMMANDS_PROCESSOR));
157
-        } catch (MissingServiceException) {
157
+        } catch(MissingServiceException) {
158 158
             return;
159 159
         }
160 160
         $chatCommands = $builder->findByType(IChatCommand::class);
161
-        foreach ($chatCommands as $command) {
161
+        foreach($chatCommands as $command) {
162 162
             $processor->addSetup("addCommand", [$command]);
163 163
         }
164 164
     }
Please login to merge, or discard this patch.
src/IChatMessageProcessor.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
 
5 5
 namespace HeroesofAbenez\Chat;
6 6
 
7
-if (false) {
7
+if(false) {
8 8
     /** @deprecated use ChatMessageProcessor */
9 9
     interface IChatMessageProcessor extends ChatMessageProcessor
10 10
     {
Please login to merge, or discard this patch.