Code Duplication    Length = 22-22 lines in 2 locations

src/Extensions/SmokeReporter/Reporter/KoalamonSummaryReporter.php 1 location

@@ 118-139 (lines=22) @@
115
     * @param $component
116
     * @param Attribute[] $attributes
117
     */
118
    private function send($identifier, $system, $message, $status, $value, $tool, $component, $attributes = [], $url = "")
119
    {
120
        if ($status !== CheckResult::STATUS_NONE) {
121
            $event = new Event($identifier, $system, $status, $tool, $message, $value, $url, $component);
122
            $event->addAttribute(new Attribute('_config', json_encode($this->config->getConfigArray()), true));
123
124
            foreach ($attributes as $attribute) {
125
                $event->addAttribute($attribute);
126
            }
127
128
            try {
129
                $this->reporter->sendEvent($event);
130
            } catch (KoalamonException $e) {
131
                $this->output->writeln("\n  <error> Error sending result to leankoala. </error>");
132
                $this->output->writeln('   Url: ' . $e->getUrl());
133
                $this->output->writeln('   Payload: ' . $e->getPayload());
134
                $this->output->writeln("");
135
            } catch (\Exception $e) {
136
                $this->output->writeln($e->getMessage());
137
            }
138
        }
139
    }
140
}
141

src/Extensions/SmokeReporter/Reporter/LeankoalaReporter.php 1 location

@@ 246-267 (lines=22) @@
243
     * @param $component
244
     * @param Attribute[] $attributes
245
     */
246
    private function send($identifier, $system, $message, $status, $value, $tool, $component, $attributes = [], $url = "")
247
    {
248
        if ($status !== CheckResult::STATUS_NONE) {
249
            $event = new Event($identifier, $system, $status, $tool, $message, $value, $url, $component);
250
            $event->addAttribute(new Attribute('_config', json_encode($this->config->getConfigArray()), true));
251
            
252
            foreach ($attributes as $attribute) {
253
                $event->addAttribute($attribute);
254
            }
255
256
            try {
257
                $this->reporter->sendEvent($event);
258
            } catch (KoalamonException $e) {
259
                $this->output->writeln("\n  <error> Error sending result to leankoala. </error>");
260
                $this->output->writeln('   Url: ' . $e->getUrl());
261
                $this->output->writeln('   Payload: ' . $e->getPayload());
262
                $this->output->writeln("");
263
            } catch (\Exception $e) {
264
                $this->output->writeln($e->getMessage());
265
            }
266
        }
267
    }
268
}
269