Code Duplication    Length = 15-15 lines in 2 locations

Plugin.php 2 locations

@@ 142-156 (lines=15) @@
139
     *
140
     * @return Logger
141
     */
142
    private function setSyslogHandler($monolog)
143
    {
144
        $required = ['syslog_enabled', 'syslog_ident', 'syslog_facility'];
145
        if (!$this->checkRequiredFields($required)) {
146
            return $monolog;
147
        }
148
149
        $ident = Settings::get('syslog_ident');
150
        $facility = Settings::get('syslog_facility');
151
        $level = Settings::get('syslog_level', 100);
152
        $handler = new SyslogHandler($ident, $facility, $level);
153
        $monolog->pushHandler($handler);
154
155
        return $monolog;
156
    }
157
158
    /**
159
     * Set handler for New Relic
@@ 165-179 (lines=15) @@
162
     *
163
     * @return Logger
164
     */
165
    private function setNewrelicHandler($monolog)
166
    {
167
        $required = ['newrelic_enabled', 'newrelic_appname'];
168
        if (!$this->checkRequiredFields($required)) {
169
            return $monolog;
170
        }
171
172
        $appname = Settings::get('newrelic_appname');
173
        $level = Settings::get('newrelic_level', 100);
174
        $bubble = true;
175
        $handler = new NewRelicHandler($level, $bubble, $appname);
176
        $monolog->pushHandler($handler);
177
178
        return $monolog;
179
    }
180
181
    /**
182
     * Check each required field if exist and not empty