Code Duplication    Length = 12-13 lines in 2 locations

src/services/Model.php 2 locations

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