Code Duplication    Length = 12-13 lines in 2 locations

src/services/Model.php 2 locations

@@ 266-278 (lines=13) @@
263
     * @return BaseModel
264
     * @throws ModelNotFoundException
265
     */
266
    public function getById(int $id, string $toScenario = null): BaseModel
267
    {
268
269
        // Find by ID
270
        if (!$model = $this->findById($id, $toScenario)) {
271
272
            $this->notFoundByIdException($id);
273
274
        }
275
276
        return $model;
277
278
    }
279
280
    /**
281
     * @param int $id
@@ 306-317 (lines=12) @@
303
     * @return BaseModel
304
     * @throws ModelNotFoundException
305
     */
306
    public function freshGetById(int $id, string $toScenario = null): BaseModel
307
    {
308
309
        if (!$model = $this->freshFindById($id, $toScenario)) {
310
311
            $this->notFoundByIdException($id);
312
313
        }
314
315
        return $model;
316
317
    }
318
319
    /*******************************************
320
     * FIND/GET BY QUERY