Code Duplication    Length = 9-14 lines in 3 locations

source/Spiral/ORM/Traits/FindTrait.php 1 location

@@ 80-93 (lines=14) @@
77
     * @return RecordSource
78
     * @throws ORMException
79
     */
80
    public static function source(ORM $orm = null)
81
    {
82
        /**
83
         * Using global container as fallback.
84
         *
85
         * @var ORM $orm
86
         */
87
        if (empty($orm)) {
88
            //Using global container as fallback
89
            $orm = self::staticContainer()->get(ORM::class);
90
        }
91
92
        return $orm->source(static::class);
93
    }
94
}

source/Spiral/ODM/Document.php 1 location

@@ 272-280 (lines=9) @@
269
     * @return DocumentSource
270
     * @throws ODMException
271
     */
272
    public static function source(ODM $odm = null)
273
    {
274
        if (empty($odm)) {
275
            //Using global container as fallback
276
            $odm = self::staticContainer()->get(ODM::class);
277
        }
278
279
        return $odm->source(static::class);
280
    }
281
282
    /**
283
     * Just an alias.

source/Spiral/ORM/Record.php 1 location

@@ 126-139 (lines=14) @@
123
     * @return RecordSource
124
     * @throws ORMException
125
     */
126
    public static function source(ORM $orm = null)
127
    {
128
        /**
129
         * Using global container as fallback.
130
         *
131
         * @var ORM $orm
132
         */
133
        if (empty($orm)) {
134
            //Using global container as fallback
135
            $orm = self::staticContainer()->get(ORM::class);
136
        }
137
138
        return $orm->source(static::class);
139
    }
140
141
    /**
142
     * Just an alias.