Code Duplication    Length = 14-14 lines in 2 locations

src/Core/ClassInfo.php 2 locations

@@ 272-285 (lines=14) @@
269
     * @param string $filePath Path to a PHP file (absolute or relative to webroot)
270
     * @return array
271
     */
272
    public static function classes_for_file($filePath)
273
    {
274
        $absFilePath    = Director::getAbsFile($filePath);
275
        $matchedClasses = array();
276
        $manifest       = ClassLoader::inst()->getManifest()->getClasses();
277
278
        foreach ($manifest as $class => $compareFilePath) {
279
            if ($absFilePath == $compareFilePath) {
280
                $matchedClasses[] = $class;
281
            }
282
        }
283
284
        return $matchedClasses;
285
    }
286
287
    /**
288
     * Returns all classes contained in a certain folder.
@@ 296-309 (lines=14) @@
293
     * @param string $folderPath Relative or absolute folder path
294
     * @return array Array of class names
295
     */
296
    public static function classes_for_folder($folderPath)
297
    {
298
        $absFolderPath  = Director::getAbsFile($folderPath);
299
        $matchedClasses = array();
300
        $manifest       = ClassLoader::inst()->getManifest()->getClasses();
301
302
        foreach ($manifest as $class => $compareFilePath) {
303
            if (stripos($compareFilePath, $absFolderPath) === 0) {
304
                $matchedClasses[] = $class;
305
            }
306
        }
307
308
        return $matchedClasses;
309
    }
310
311
    private static $method_from_cache = array();
312