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

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