Code Duplication    Length = 19-19 lines in 2 locations

source/Spiral/ODM/ODM.php 1 location

@@ 233-251 (lines=19) @@
230
     *
231
     * @return InstantiatorInterface
232
     */
233
    protected function instantiator(string $class): InstantiatorInterface
234
    {
235
        if (isset($this->instantiators[$class])) {
236
            return $this->instantiators[$class];
237
        }
238
239
        //Potential optimization
240
        $instantiator = $this->factory->make(
241
            $this->define($class, self::D_INSTANTIATOR),
242
            [
243
                'class'  => $class,
244
                'odm'    => $this,
245
                'schema' => $this->define($class, self::D_SCHEMA)
246
            ]
247
        );
248
249
        //Constructing instantiator and storing it in cache
250
        return $this->instantiators[$class] = $instantiator;
251
    }
252
253
    /**
254
     * Load packed schema from memory.

source/Spiral/ORM/ORM.php 1 location

@@ 177-195 (lines=19) @@
174
     *
175
     * @return InstantiatorInterface
176
     */
177
    protected function instantiator(string $class): InstantiatorInterface
178
    {
179
        if (isset($this->instantiators[$class])) {
180
            return $this->instantiators[$class];
181
        }
182
183
        //Potential optimization
184
        $instantiator = $this->factory->make(
185
            $this->define($class, self::R_INSTANTIATOR),
186
            [
187
                'class'  => $class,
188
                'orm'    => $this,
189
                'schema' => $this->define($class, self::R_SCHEMA)
190
            ]
191
        );
192
193
        //Constructing instantiator and storing it in cache
194
        return $this->instantiators[$class] = $instantiator;
195
    }
196
197
    /**
198
     * Load packed schema from memory.