private static function findRootDir($path, array $roots)
    {
        foreach ($roots as $root) {
            if (0 === strpos($path, $root)) {
                return $root;
            }
        }
    }
private static function findRootDir($path, array $roots)
    {
        foreach ($roots as $root) {
            if (0 === strpos($path, $root)) {
                return $root;
            }
        }
    }
private static function findRootDir ( $ path , array $ roots ) { foreach ( $ roots as $ root ) { if ( 0 === strpos ( $ path , $ root ) ) { return $ root ; } } }
Loops through the root directories and returns the first match.

@param string $path  An absolute path
@param array  $roots An array of root directories

@return string|null The matching root directory, if found
Loops through the root directories and returns the first match .