| @@ 174-186 (lines=13) @@ | ||
| 171 | * @param Notifier $notifier |
|
| 172 | * @return Notifier |
|
| 173 | */ |
|
| 174 | protected function buildNotifier(Notifier $notifier = null) |
|
| 175 | {
|
|
| 176 | $class = config('lern.notify.class');
|
|
| 177 | $class = !empty($class) ? $class : Notifier::class; |
|
| 178 | if (empty($notifier)) {
|
|
| 179 | $notifier = new $class(); |
|
| 180 | } |
|
| 181 | if ($notifier instanceof Notifier) {
|
|
| 182 | return $notifier; |
|
| 183 | } else {
|
|
| 184 | throw new NotifierFailedException("LERN was expecting an instance of ".Notifier::class);
|
|
| 185 | } |
|
| 186 | } |
|
| 187 | ||
| 188 | /** |
|
| 189 | * Constructs a Recorder |
|
| @@ 194-206 (lines=13) @@ | ||
| 191 | * @param Recorder $recorder |
|
| 192 | * @return Recorder |
|
| 193 | */ |
|
| 194 | protected function buildRecorder(Recorder $recorder = null) |
|
| 195 | {
|
|
| 196 | $class = config('lern.record.class');
|
|
| 197 | $class = !empty($class) ? $class : Recorder::class; |
|
| 198 | if (empty($recorder)) {
|
|
| 199 | $recorder = new $class(); |
|
| 200 | } |
|
| 201 | if ($recorder instanceof Recorder) {
|
|
| 202 | return $recorder; |
|
| 203 | } else {
|
|
| 204 | throw new RecorderFailedException("LERN was expecting an instance of ".Recorder::class);
|
|
| 205 | } |
|
| 206 | } |
|
| 207 | } |
|
| 208 | ||