Code Duplication    Length = 19-19 lines in 2 locations

source/Spiral/ODM/ODM.php 1 location

@@ 105-123 (lines=19) @@
102
     *
103
     * @throws SchemaException
104
     */
105
    public function schemaBuilder(bool $locate = true): SchemaBuilder
106
    {
107
        /**
108
         * @var SchemaBuilder $builder
109
         */
110
        $builder = $this->factory->make(SchemaBuilder::class, ['manager' => $this->manager]);
111
112
        if ($locate) {
113
            foreach ($this->locator->locateSchemas() as $schema) {
114
                $builder->addSchema($schema);
115
            }
116
117
            foreach ($this->locator->locateSources() as $class => $source) {
118
                $builder->addSource($class, $source);
119
            }
120
        }
121
122
        return $builder;
123
    }
124
125
    /**
126
     * Specify behaviour schema for ODM to be used.

source/Spiral/ORM/ORM.php 1 location

@@ 96-114 (lines=19) @@
93
     *
94
     * @throws SchemaException
95
     */
96
    public function schemaBuilder(bool $locate = true): SchemaBuilder
97
    {
98
        /**
99
         * @var SchemaBuilder $builder
100
         */
101
        $builder = $this->factory->make(SchemaBuilder::class, ['manager' => $this->manager]);
102
103
        if ($locate) {
104
            foreach ($this->locator->locateSchemas() as $schema) {
105
                $builder->addSchema($schema);
106
            }
107
108
            foreach ($this->locator->locateSources() as $class => $source) {
109
                $builder->addSource($class, $source);
110
            }
111
        }
112
113
        return $builder;
114
    }
115
116
    /**
117
     * Specify behaviour schema for ORM to be used.