Code Duplication    Length = 7-7 lines in 2 locations

src/Space.php 2 locations

@@ 123-129 (lines=7) @@
120
            }
121
        }
122
123
        foreach ($config['fields'] as $property) {
124
            if (!$this->getPropertyType($property)) {
125
                throw new Exception("Unknown property $property", 1);
126
            }
127
            $options['parts'][] = $this->getPropertyIndex($property)+1;
128
            $options['parts'][] = $this->getPropertyType($property);
129
        }
130
131
        $name = array_key_exists('name', $config) ? $config['name'] : implode('_', $config['fields']);
132
@@ 377-383 (lines=7) @@
374
    {
375
        $key = [];
376
377
        foreach ($this->getPrimaryIndex()['parts'] as $part) {
378
            $name = $this->getFormat()[$part[0]]['name'];
379
            if (!property_exists($instance, $name)) {
380
                throw new Exception("Field $name is undefined", 1);
381
            }
382
            $key[] = $instance->$name;
383
        }
384
385
        return count($key) == 1 ? $key[0] : implode(':', $key);
386
    }