<commit_before><?php

namespace User\View\Helper;

use Zend\View\Helper\AbstractHelper;
use Zend\View\Model\ViewModel;
use Zend\ServiceManager\ServiceLocatorAwareInterface;
use Zend\ServiceManager\ServiceLocatorInterface;

use Zend\EventManager\EventManagerAwareInterface;
use Zend\EventManager\EventManagerInterface;
use Zend\EventManager\EventManager;

class UserRepositories extends AbstractHelper implements ServiceLocatorAwareInterface, EventManagerAwareInterface
{
    /**
     * $var string template used for view
     */
    protected $viewTemplate;

    /**
     * @var ServiceLocator
     */
    protected $serviceLocator;

    /**
     * @var EventManager
     */
    protected $events;

    /**
     * __invoke
     *
     * @access public
     * @param array $options array of options
     * @return string
     */
    public function __invoke($options = array())
    {
        $sl = $this->getServiceLocator();

        //fetch top lvl ServiceLocator
        $sl = $sl->getServiceLocator();
        $client = $sl->get('EdpGithub\Client');

        $repositories = array();

        $ownerRepos = $client->api('current_user')->repos(array('type' =>'owner'));
        foreach ($ownerRepos as $repo) {
            if (!$repo->fork) {
                $repositories[] = $repo;
            }
        }

        $memberRepos = $client->api('current_user')->repos(array('type' =>'member'));
        foreach ($memberRepos as $repo) {
            $repositories[] = $repo;
        }

        $mapper = $sl->get('application_module_mapper');
        foreach ($repositories as $key => $repo) {
            if ($repo->fork) {
                unset($repositories[$key]);
            } else {
                $module = $mapper->findByName($repo->name);
                if ($module) {
                    unset($repositories[$key]);
                } else {
                    $em = $client->getHttpClient()->getEventManager();
                    $errorListener = $sl->get('EdpGithub\Listener\Error');
                    $em->detachAggregate($errorListener);
                    $module = $client->api('repos')->content($repo->full_name, 'Module.php');
                    $response = $client->getHttpClient()->getResponse();
                    if (!$response->isSuccess()) {
                        unset($repositories[$key]);
                    }
                    $em->attachAggregate($errorListener);<commit_msg>Fix: Unknown service<commit_after><?php

namespace User\View\Helper;

use Zend\View\Helper\AbstractHelper;
use Zend\View\Model\ViewModel;
use Zend\ServiceManager\ServiceLocatorAwareInterface;
use Zend\ServiceManager\ServiceLocatorInterface;

use Zend\EventManager\EventManagerAwareInterface;
use Zend\EventManager\EventManagerInterface;
use Zend\EventManager\EventManager;

class UserRepositories extends AbstractHelper implements ServiceLocatorAwareInterface, EventManagerAwareInterface
{
    /**
     * $var string template used for view
     */
    protected $viewTemplate;

    /**
     * @var ServiceLocator
     */
    protected $serviceLocator;

    /**
     * @var EventManager
     */
    protected $events;

    /**
     * __invoke
     *
     * @access public
     * @param array $options array of options
     * @return string
     */
    public function __invoke($options = array())
    {
        $sl = $this->getServiceLocator();

        //fetch top lvl ServiceLocator
        $sl = $sl->getServiceLocator();
        $client = $sl->get('EdpGithub\Client');

        $repositories = array();

        $ownerRepos = $client->api('current_user')->repos(array('type' =>'owner'));
        foreach ($ownerRepos as $repo) {
            if (!$repo->fork) {
                $repositories[] = $repo;
            }
        }

        $memberRepos = $client->api('current_user')->repos(array('type' =>'member'));
        foreach ($memberRepos as $repo) {
            $repositories[] = $repo;
        }

        $mapper = $sl->get('zfmodule_mapper_module');
        foreach ($repositories as $key => $repo) {
            if ($repo->fork) {
                unset($repositories[$key]);
            } else {
                $module = $mapper->findByName($repo->name);
                if ($module) {
                    unset($repositories[$key]);
                } else {
                    $em = $client->getHttpClient()->getEventManager();
                    $errorListener = $sl->get('EdpGithub\Listener\Error');
                    $em->detachAggregate($errorListener);
                    $module = $client->api('repos')->content($repo->full_name, 'Module.php');
                    $response = $client->getHttpClient()->getResponse();
                    if (!$response->isSuccess()) {
                        unset($repositories[$key]);
                    }
                    $em->attachAggregate($errorListener);
{'fraction_non_alphanumeric': 0.138934764657308, 'fraction_numerical': 0.0, 'mean_word_length': 2.111753371868979, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 55, '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': '2009087', 'n_tokens_mistral': 1355, 'n_tokens_neox': 1285, 'n_words': 237}