Code Duplication    Length = 9-14 lines in 4 locations

source/Spiral/ODM/Document.php 1 location

@@ 278-286 (lines=9) @@
275
     * @return DocumentSource
276
     * @throws ODMException
277
     */
278
    public static function source(ODM $odm = null)
279
    {
280
        if (empty($odm)) {
281
            //Using global container as fallback
282
            $odm = self::staticContainer()->get(ODM::class);
283
        }
284
285
        return $odm->source(static::class);
286
    }
287
288
    /**
289
     * {@inheritdoc}

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

@@ 74-87 (lines=14) @@
71
     * @return DocumentSource
72
     * @throws ORMException
73
     */
74
    public static function source(ODM $odm = null)
75
    {
76
        /**
77
         * Using global container as fallback.
78
         *
79
         * @var ODM $odm
80
         */
81
        if (empty($odm)) {
82
            //Using global container as fallback
83
            $odm = self::staticContainer()->get(ODM::class);
84
        }
85
86
        return $odm->source(static::class);
87
    }
88
}

source/Spiral/ORM/Record.php 1 location

@@ 132-145 (lines=14) @@
129
     * @return RecordSource
130
     * @throws ORMException
131
     */
132
    public static function source(ORM $orm = null)
133
    {
134
        /**
135
         * Using global container as fallback.
136
         *
137
         * @var ORM $orm
138
         */
139
        if (empty($orm)) {
140
            //Using global container as fallback
141
            $orm = self::staticContainer()->get(ORM::class);
142
        }
143
144
        return $orm->source(static::class);
145
    }
146
147
    /**
148
     * Save embedded relations.

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

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