<commit_before><?php
// Jivoo
// Copyright (c) 2015 <NAME> (http://nielssp.dk)
// Licensed under the MIT license.
// See the LICENSE file or http://opensource.org/licenses/MIT for more information.
namespace Jivoo\Core\Units;

use Jivoo\Core\UnitBase;
use Jivoo\Core\App;
use Jivoo\Core\Store\Document;
use Jivoo\Controllers\ActionDispatcher;
use Jivoo\Controllers\Controllers;
use Jivoo\Core\LoadableModule;
use Jivoo\Snippets\SnippetDispatcher;
use Jivoo\Snippets\Snippets;
use Jivoo\Routing\Routing;

/**
 * Initializes the routing module.
 */
class RoutingUnit extends UnitBase {
  /**
   * {@inheritdoc}
   */
  protected $requires = array('Request');
  
  /**
   * {@inheritdoc}
   */
  public function run(App $app, Document $config) {
    $app->m->routing = new Routing($app, false);
    
    $app->m->routing->dispatchers->add(
      new ActionDispatcher($app)
    );

    $app->m->routing->dispatchers->add(
      new SnippetDispatcher($app)
    );
  }
}<commit_msg>Attach event handlers in routing unit.<commit_after><?php
// Jivoo
// Copyright (c) 2015 <NAME> (http://nielssp.dk)
// Licensed under the MIT license.
// See the LICENSE file or http://opensource.org/licenses/MIT for more information.
namespace Jivoo\Core\Units;

use Jivoo\Core\UnitBase;
use Jivoo\Core\App;
use Jivoo\Core\Store\Document;
use Jivoo\Controllers\ActionDispatcher;
use Jivoo\Controllers\Controllers;
use Jivoo\Core\LoadableModule;
use Jivoo\Snippets\SnippetDispatcher;
use Jivoo\Snippets\Snippets;
use Jivoo\Routing\Routing;

/**
 * Initializes the routing module.
 */
class RoutingUnit extends UnitBase {
  /**
   * {@inheritdoc}
   */
  protected $requires = array('Request');
  
  /**
   * {@inheritdoc}
   */
  public function run(App $app, Document $config) {
    $app->m->routing = new Routing($app, false);
    
    $app->m->routing->dispatchers->add(
      new ActionDispatcher($app)
    );

    $app->m->routing->dispatchers->add(
      new SnippetDispatcher($app)
    );

    $app->attachEventHandler('afterLoadModules', array($app->m->routing, 'loadRoutes'));
    $app->attachEventHandler('afterInit', array($app->m->routing, 'findRoute'));
  }
}
{'fraction_non_alphanumeric': 0.15223463687150837, 'fraction_numerical': 0.0037243947858473, 'mean_word_length': 3.7334801762114536, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 31, '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': '2185626', 'n_tokens_mistral': 742, 'n_tokens_neox': 738, 'n_words': 151}