Code Duplication    Length = 7-7 lines in 2 locations

src/Space.php 2 locations

@@ 118-124 (lines=7) @@
115
            }
116
        }
117
118
        foreach ($config['fields'] as $property) {
119
            if (!$this->getPropertyType($property)) {
120
                throw new Exception("Unknown property $property", 1);
121
            }
122
            $options['parts'][] = $this->getPropertyIndex($property)+1;
123
            $options['parts'][] = $this->getPropertyType($property);
124
        }
125
126
        $name = array_key_exists('name', $config) ? $config['name'] : implode('_', $config['fields']);
127
@@ 358-364 (lines=7) @@
355
    {
356
        $key = [];
357
358
        foreach ($this->getPrimaryIndex()['parts'] as $part) {
359
            $name = $this->getFormat()[$part[0]]['name'];
360
            if (!property_exists($instance, $name)) {
361
                throw new Exception("Field $name is undefined", 1);
362
            }
363
            $key[] = $instance->$name;
364
        }
365
366
        return count($key) == 1 ? $key[0] : implode(':', $key);
367
    }