<commit_before><?php

namespace AnyContent\CMCK\Modules\Backend\Core\Start;

use AnyContent\CMCK\Modules\Backend\Core\Application\Application;

use CMDL\ContentTypeDefinition;
use CMDL\ViewDefinition;

use AnyContent\Client\Repository;
use AnyContent\Client\Record;

use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;

use AnyContent\CMCK\Modules\Backend\Core\Repositories\RepositoryManager;

class Controller
{

    public static function index(Application $app)
    {
        $app['layout']->addCssFile('listing.css');

        $vars = array();

        $vars['menu_mainmenu'] = $app['menus']->renderMainMenu();

        /** @var RepositoryManager $repositoryManager */
        $repositoryManager = $app['repos'];

        $items = array();
        foreach ($repositoryManager->listRepositories() as $repositoryUrl => $repositoryItem)
        {

            $items[] = self::extractRepositoryInfos($app, $repositoryUrl, $repositoryItem, false);

        }

        $vars['repositories'] = $items;

        return $app->renderPage('index.twig', $vars);
    }


    public static function indexRepository(Application $app, $repositoryAccessHash)
    {
        $app['layout']->addCssFile('listing.css');

        $vars = array();

        $vars['menu_mainmenu'] = $app['menus']->renderMainMenu();

        /** @var RepositoryManager $repositoryManager */
        $repositoryManager = $app['repos'];

        foreach ($repositoryManager->listRepositories() as $repositoryUrl => $repositoryItem)
        {
            if ($repositoryAccessHash == $repositoryItem['accessHash'])
            {
                $item               = self::extractRepositoryInfos($app, $repositoryUrl, $repositoryItem, true);
                $vars['repository'] = $item;
            }
        }<commit_msg>don't crash, when repository server isn't accessible<commit_after><?php

namespace AnyContent\CMCK\Modules\Backend\Core\Start;

use AnyContent\CMCK\Modules\Backend\Core\Application\Application;

use CMDL\ContentTypeDefinition;
use CMDL\ViewDefinition;

use AnyContent\Client\Repository;
use AnyContent\Client\Record;

use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;

use AnyContent\CMCK\Modules\Backend\Core\Repositories\RepositoryManager;

class Controller
{

    public static function index(Application $app)
    {
        $app['layout']->addCssFile('listing.css');

        $vars = array();

        $vars['menu_mainmenu'] = $app['menus']->renderMainMenu();

        /** @var RepositoryManager $repositoryManager */
        $repositoryManager = $app['repos'];

        $items = array();
        foreach ($repositoryManager->listRepositories() as $repositoryUrl => $repositoryItem)
        {
            try
            {
                $items[] = self::extractRepositoryInfos($app, $repositoryUrl, $repositoryItem, false);
            }
            catch (\Exception $e)
            {

            }
        }

        $vars['repositories'] = $items;

        return $app->renderPage('index.twig', $vars);
    }


    public static function indexRepository(Application $app, $repositoryAccessHash)
    {
        $app['layout']->addCssFile('listing.css');

        $vars = array();

        $vars['menu_mainmenu'] = $app['menus']->renderMainMenu();

        /** @var RepositoryManager $repositoryManager */
        $repositoryManager = $app['repos'];

        foreach ($repositoryManager->listRepositories() as $repositoryUrl => $repositoryItem)
        {
            if ($repositoryAccessHash == $repositoryItem['accessHash'])
            {
                $item               = self::extractRepositoryInfos($app, $repositoryUrl, $repositoryItem, true);
                $vars['repository'] = $item;
            }
        }
{'fraction_non_alphanumeric': 0.13338453661034305, 'fraction_numerical': 0.0, 'mean_word_length': 2.966497461928934, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3226251', 'n_tokens_mistral': 1073, 'n_tokens_neox': 1035, 'n_words': 182}