Code Duplication    Length = 17-18 lines in 3 locations

src/services/Model.php 1 location

@@ 347-364 (lines=18) @@
344
     * @param string $toScenario
345
     * @return BaseModel[]
346
     */
347
    public function findAllByCriteria($criteria, string $toScenario = null): array
348
    {
349
350
        $models = [];
351
352
        // Find record in db
353
        if ($records = $this->findAllRecordsByCriteria($criteria)
354
        ) {
355
356
            foreach ($records as $record) {
357
                $models[] = $this->findByRecord($record, $toScenario);
358
            }
359
360
        }
361
362
        return $models;
363
364
    }
365
366
    /**
367
     * @param $criteria

src/services/Object.php 2 locations

@@ 261-277 (lines=17) @@
258
     * @param string $toScenario
259
     * @return BaseObject[]
260
     */
261
    public function findAllByCondition($condition, string $toScenario = null): array
262
    {
263
264
        $objects = [];
265
266
        // Find record in db
267
        if ($records = $this->findAllRecordsByCondition($condition)) {
268
269
            foreach ($records as $record) {
270
                $objects[] = $this->findByRecord($record, $toScenario);
271
            }
272
273
        }
274
275
        return $objects;
276
277
    }
278
279
    /**
280
     * @param $condition
@@ 343-360 (lines=18) @@
340
     * @param string $toScenario
341
     * @return BaseObject[]
342
     */
343
    public function findAllByCriteria($criteria, string $toScenario = null): array
344
    {
345
346
        $objects = [];
347
348
        // Find record in db
349
        if ($records = $this->findAllRecordsByCriteria($criteria)
350
        ) {
351
352
            foreach ($records as $record) {
353
                $objects[] = $this->findByRecord($record, $toScenario);
354
            }
355
356
        }
357
358
        return $objects;
359
360
    }
361
362
    /**
363
     * @param $criteria