Code Duplication    Length = 15-15 lines in 2 locations

Plugin.php 2 locations

@@ 184-198 (lines=15) @@
181
     *
182
     * @return Logger
183
     */
184
    private function setSyslogHandler($monolog)
185
    {
186
        $required = ['syslog_enabled', 'syslog_ident', 'syslog_facility'];
187
        if (!$this->checkRequiredFields($required)) {
188
            return $monolog;
189
        }
190
191
        $ident = Settings::get('syslog_ident');
192
        $facility = Settings::get('syslog_facility');
193
        $level = Settings::get('syslog_level', 100);
194
        $handler = new SyslogHandler($ident, $facility, $level);
195
        $monolog->pushHandler($handler);
196
197
        return $monolog;
198
    }
199
200
    /**
201
     * Set handler for New Relic.
@@ 207-221 (lines=15) @@
204
     *
205
     * @return Logger
206
     */
207
    private function setNewrelicHandler($monolog)
208
    {
209
        $required = ['newrelic_enabled', 'newrelic_appname'];
210
        if (!$this->checkRequiredFields($required)) {
211
            return $monolog;
212
        }
213
214
        $appname = Settings::get('newrelic_appname');
215
        $level = Settings::get('newrelic_level', 100);
216
        $bubble = true;
217
        $handler = new NewRelicHandler($level, $bubble, $appname);
218
        $monolog->pushHandler($handler);
219
220
        return $monolog;
221
    }
222
223
    /**
224
     * Check each required field if exist and not empty.