Code Duplication    Length = 22-22 lines in 2 locations

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

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

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

@@ 258-279 (lines=22) @@
255
     * @param $component
256
     * @param Attribute[] $attributes
257
     */
258
    private function send($identifier, $system, $message, $status, $value, $tool, $component, $attributes = [], $url = "")
259
    {
260
        if ($status !== CheckResult::STATUS_NONE) {
261
            $event = new Event($identifier, $system, $status, $tool, $message, $value, $url, $component);
262
            $event->addAttribute(new Attribute('_config', json_encode($this->config->getConfigArray()), true));
263
264
            foreach ($attributes as $attribute) {
265
                $event->addAttribute($attribute);
266
            }
267
268
            try {
269
                $this->reporter->sendEvent($event);
270
            } catch (KoalamonException $e) {
271
                $this->output->writeln("\n  <error> Error sending result to leankoala. </error>");
272
                $this->output->writeln('   Url: ' . $e->getUrl());
273
                $this->output->writeln('   Payload: ' . $e->getPayload());
274
                $this->output->writeln("");
275
            } catch (\Exception $e) {
276
                $this->output->writeln($e->getMessage());
277
            }
278
        }
279
    }
280
}
281