Code Duplication    Length = 13-13 lines in 2 locations

src/LERN.php 2 locations

@@ 154-166 (lines=13) @@
151
     * @param Notifier $notifier
152
     * @return Notifier
153
     */
154
    protected function buildNotifier(Notifier $notifier = null)
155
    {
156
        $class = config('lern.notify.class');
157
        $class = !empty($class) ? $class : Notifier::class;
158
        if (empty($notifier)) {
159
            $notifier = new $class();
160
        }
161
        if ($notifier instanceof Notifier) {
162
            return $notifier;
163
        } else {
164
            throw new NotifierFailedException("LERN was expecting an instance of ".Notifier::class);
165
        }
166
    }
167
168
    /**
169
     * Constructs a Recorder
@@ 174-186 (lines=13) @@
171
     * @param Recorder $recorder
172
     * @return Recorder
173
     */
174
    protected function buildRecorder(Recorder $recorder = null)
175
    {
176
        $class = config('lern.record.class');
177
        $class = !empty($class) ? $class : Recorder::class;
178
        if (empty($recorder)) {
179
            $recorder = new $class();
180
        }
181
        if ($recorder instanceof Recorder) {
182
            return $recorder;
183
        } else {
184
            throw new RecorderFailedException("LERN was expecting an instance of ".Recorder::class);
185
        }
186
    }
187
}
188