Code Duplication    Length = 7-9 lines in 2 locations

src/Model.php 2 locations

@@ 1540-1546 (lines=7) @@
1537
            $valid = Validate::is($value, $property['validate']);
1538
        }
1539
1540
        if (!$valid) {
1541
            $this->getErrors()->push([
1542
                'error' => self::ERROR_VALIDATION_FAILED,
1543
                'params' => [
1544
                    'field' => $propertyName,
1545
                    'field_name' => (isset($property['title'])) ? $property['title'] : Inflector::get()->titleize($propertyName), ], ]);
1546
        }
1547
1548
        return [$valid, $value];
1549
    }
@@ 1563-1571 (lines=9) @@
1560
    private function checkUniqueness(array $property, $propertyName, $value)
1561
    {
1562
        $n = static::where([$propertyName => $value])->count();
1563
        if ($n > 0) {
1564
            $this->getErrors()->push([
1565
                'error' => self::ERROR_NOT_UNIQUE,
1566
                'params' => [
1567
                    'field' => $propertyName,
1568
                    'field_name' => (isset($property['title'])) ? $property['title'] : Inflector::get()->titleize($propertyName), ], ]);
1569
1570
            return false;
1571
        }
1572
1573
        return true;
1574
    }