Code Duplication    Length = 17-18 lines in 3 locations

src/services/Model.php 1 location

@@ 451-468 (lines=18) @@
448
     * @param string $toScenario
449
     * @return BaseModel[]
450
     */
451
    public function findAllByCriteria($criteria, string $toScenario = null): array
452
    {
453
454
        $models = [];
455
456
        // Find record in db
457
        if ($records = $this->findAllRecordsByCriteria($criteria)
458
        ) {
459
460
            foreach ($records as $record) {
461
                $models[] = $this->findByRecord($record, $toScenario);
462
            }
463
464
        }
465
466
        return $models;
467
468
    }
469
470
    /**
471
     * @param $criteria

src/services/Object.php 2 locations

@@ 372-388 (lines=17) @@
369
     * @param string $toScenario
370
     * @return BaseObject[]
371
     */
372
    public function findAllByCondition($condition, string $toScenario = null): array
373
    {
374
375
        $objects = [];
376
377
        // Find record in db
378
        if ($records = $this->findAllRecordsByCondition($condition)) {
379
380
            foreach ($records as $record) {
381
                $objects[] = $this->findByRecord($record, $toScenario);
382
            }
383
384
        }
385
386
        return $objects;
387
388
    }
389
390
    /**
391
     * @param $condition
@@ 454-471 (lines=18) @@
451
     * @param string $toScenario
452
     * @return BaseObject[]
453
     */
454
    public function findAllByCriteria($criteria, string $toScenario = null): array
455
    {
456
457
        $objects = [];
458
459
        // Find record in db
460
        if ($records = $this->findAllRecordsByCriteria($criteria)
461
        ) {
462
463
            foreach ($records as $record) {
464
                $objects[] = $this->findByRecord($record, $toScenario);
465
            }
466
467
        }
468
469
        return $objects;
470
471
    }
472
473
    /**
474
     * @param $criteria