/*!
\static
\return an array with directories which acts as collaboration repositories.
\sa defaultRepositories, extensionRepositories
977985
static function handlerRepositories()
    {
        $extensions = eZCollaborationItemHandler::extensionRepositories();
        $repositories = eZCollaborationItemHandler::defaultRepositories();
        $extensionRoot = eZExtension::baseDirectory();
        foreach ( $extensions as $extension )
        {
            $handlerPath = eZDir::path( array( $extensionRoot, $extension, 'collaboration' ) );
            if ( file_exists( $handlerPath ) )
                $repositories[] = $handlerPath;
        }
        return $repositories;
    }
422647
public function getDirectories() : array
    {
        if(!$this->_isLoaded) {
            $this->load();
        }

        return array_map(function($directory) {
            return new Directory($this->getPath(). DIRECTORY_SEPARATOR .$directory);
        }, $this->_directories);
    }
883080
public function folderContent()
    {
        $result = [];
        $path = $this->ensureUserPath($this->blob->path);

        $list = collect($this->storage->getDriver()->listContents($path))
            ->pluck('path');

        $exclude = (new ThumbService($this->package))->getSizes()->all();
        $isExcluded = function ($path) use ($exclude) {
            $parts = explode('/', Str::normalizePath($path));
            if (count($parts) > 0) {
                return array_key_exists($parts[0], $exclude);
            }

            return false;
        };

        $list->each(function ($glob) use (&$result, $isExcluded) {
            if ($isExcluded($glob)) {
                // skip any thumbs dir and do not show it for users
                return;
            }

            $result[] = (new Blob($this->package))
                ->setPath($glob)
                ->fullDetails();
        });

        return $result;
    }
1154355
public function listCollaborators(): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/collaborators',
            $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo()));
    }
77432
protected File[] listRepositoryChoices() {
        // check current location
        String currentDir = System.getProperty("log.repository.root");
        if (currentDir == null)
            currentDir = System.getProperty("user.dir");
        File logDir = new File(currentDir);
        if (logDir.isDirectory()) {
            File[] result = RepositoryReaderImpl.listRepositories(logDir);
            if (result.length == 0 && (RepositoryReaderImpl.containsLogFiles(logDir) || tailInterval > 0)) {
                return new File[] { logDir };
            } else {
                return result;
            }
        } else {
            return new File[] {};
        }
    }
410655
static function repositoryPath()
    {
        $ini = eZINI::instance();
        $packageIni = eZINI::instance( 'package.ini' );

        return eZDir::path( array( 'var',
                                   $ini->variable( 'FileSettings', 'StorageDir' ),
                                   $packageIni->variable( 'RepositorySettings', 'RepositoryDirectory' ) ) );
    }
945865
public function getRepositorySubscription(): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/subscription',
            $this->getActivity()->getOwner(), $this->getActivity()->getRepo()));
    }
919577
public function listRepositoryEvents(): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/events',
            $this->getIssues()->getOwner(), $this->getIssues()->getRepo()));
    }
125442
public function getNodeRepositories($ids)
    {
        $types = $this->getService('repos:base.node')
                ->getQuery()
                ->disableChain()
                ->id($ids);

        $types->distinct = true;
        $repositories = array();
        foreach ($types->fetchValues('type') as $key => $type) {
            $type = explode(',', $type);
            $identifier = end($type);
            $repositories[] = AnDomain::getRepository($identifier);
        }

        return $repositories;
    }
1371030
public static function apps(): array
    {
        self::initialize();
        $apps = [];
        foreach (self::$repositories as $name => $repository) {
            $apps[] = $name;
        }
        return $apps;
    }
469879
protected function getRepositoryCredentials()
    {
        $config = (array) $this->config->getContextually('vcs');
        $credentials = (array) $this->localStorage->get('credentials');

        return array_merge($config, $credentials);
    }
1088812
public static function getDirectories($bb_directory = null, $repository_directory, $context, $environment)
    {
        $directories = BootstrapDirectory::getDirectories($repository_directory, $context, $environment);
        if (null !== $bb_directory) {
            array_push($directories, $bb_directory.DIRECTORY_SEPARATOR.'Config');
        }

        $directories = array_reverse($directories);

        return $directories;
    }
606550
protected function mapDirectories(array $directories): array
    {
        if (!isset($directories['root'])) {
            throw new BootException("Missing required directory `root`.");
        }

        if (!isset($directories['app'])) {
            $directories['app'] = $directories['root'] . '/app/';
        }

        return array_merge([
            // public root
            'public'    => $directories['root'] . '/public/',

            // vendor libraries
            'vendor'    => $directories['root'] . '/vendor/',

            // data directories
            'runtime'   => $directories['root'] . '/runtime/',
            'cache'     => $directories['root'] . '/runtime/cache/',

            // application directories
            'config'    => $directories['app'] . '/config/',
            'resources' => $directories['app'] . '/resources/',
        ], $directories);
    }
1194145
public function getDefaultUploadDestinations()
    {
        $user = $this->container->get('security.token_storage')->getToken()->getUser();
        if ($user == 'anon.') return array();

        $pws = $user->getPersonalWorkspace();
        $defaults = [];

        if ($pws) {
            $defaults = array_merge(
                $defaults,
                $this->directoryRepo->findDefaultUploadDirectories($pws)
            );
        }

        $node = $this->container->get('request')->getSession()->get('current_resource_node');

        if ($node && $node->getWorkspace()) {
            $root = $this->directoryRepo->findDefaultUploadDirectories($node->getWorkspace());
            
            if ($this->container->get('security.authorization_checker')->isGranted('CREATE', $root)) {
                $defaults = array_merge($defaults, $root);
            }
        }

        return $defaults;
    }
1291041
public function collectSiteMapItems()
    {
        $itemCollection = [];
        $modules = config('site-mapped-modules', [
            'blog' => 'Grafite\Cms\Repositories\BlogRepository',
            'page' => 'Grafite\Cms\Repositories\PageRepository',
            'events' => 'Grafite\Cms\Repositories\EventRepository',
        ]);

        foreach ($modules as $module => $repository) {
            try {
                $items = collect([]);

                if (method_exists($repository, 'arePublic')) {
                    $items = app($repository)->arePublic();
                }

                foreach ($items as $item) {
                    $itemCollection[] = [
                        'url' => url($module.'/'.$item->url),
                        'updated_at' => $item->updated_at->format('Y-m-d'),
                    ];
                }
            } catch (ReflectionException $e) {
                // It just means we couldn't find
                // the Repository class
            }
        }

        return collect($itemCollection);
    }
313206
public static function getAssetCompressFiles(): array
    {
        $helper = new FrontendBridgeHelper(new View());
        $dependencies = $helper->compileDependencies();
        $plugins = array_map('\Cake\Utility\Inflector::underscore', Plugin::loaded());

        foreach ($dependencies as $n => $dependency) {
            $parts = explode('/', $dependency);
            if (empty($parts[0]) && in_array($parts[1], $plugins)) {
                $prefix = '/' . $parts[1] . '/';
                $dependency = preg_replace(
                    '/^' . str_replace('/', '\/', $prefix) . '/',
                    'plugin:' . Inflector::camelize($parts[1]) . ':',
                    $dependency
                );
            }
            if (substr($dependency, 0, 4) == '/js/') {
                $dependency = substr($dependency, 4);
            }
            $dependencies[$n] = $dependency;
        }

        return $dependencies;
    }
1031177
def remove_repositories(repositories, default_repositories):
    
    repos = []
    for repo in repositories:
        if repo in default_repositories:
            repos.append(repo)
    return repos