public function create($repository)
    {

        //if repository is a string
        //given repository should be a valid directory path
        if (is_string($repository)) {
            //clear stat cache to avoid loading cached files,
            //which where unlinked in system
            clearstatcache(TRUE);
            if (!is_dir($repository)) {
                throw new FileNotFoundException($repository);
            }

            $repository = new FilesystemRepository($repository);
        }

        //if there is no valid instance cancel creation
        if (!($repository instanceof FilesystemRepository)) {
            throw new \RuntimeException(sprintf('Expected instance of FilesystemRepository. %s given', get_class($repository)));
        }

        $locator = new Locator($repository);

        return $locator;
    }