Code Duplication    Length = 9-9 lines in 2 locations

lib/Property/Collection.php 1 location

@@ 384-392 (lines=9) @@
381
    public function validateConfig($name, &$value)
382
    {
383
        switch ($name) {
384
            case 'default':
385
                if (!is_array($value)) {
386
                    if (is_object($value) && method_exists($value, 'toArray')) {
387
                        $value = $value->toArray();
388
                    } else {
389
                        throw new \InvalidArgumentException('Only arrays are accepted as default values for collection properties');
390
                    }
391
                }
392
                break;
393
            case 'allowed':
394
                $valid = false;
395
                if (($value === null) || is_callable($value)) {

lib/Property/Enum.php 1 location

@@ 24-32 (lines=9) @@
21
    {
22
        /** @noinspection DegradedSwitchInspection */
23
        switch ($name) {
24
            case 'values':
25
                if (!is_array($value)) {
26
                    if (is_object($value) && method_exists($value, 'toArray')) {
27
                        $value = $value->toArray();
28
                    } else {
29
                        throw new \InvalidArgumentException('Only arrays are accepted as list of values for enum property');
30
                    }
31
                }
32
                break;
33
            default:
34
                return parent::validateConfig($name, $value);
35
                break;