Code Duplication    Length = 15-15 lines in 2 locations

Plugin.php 2 locations

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