<commit_before><?php
/**
 * This is our "dispatcher", you should invoke this one from your dialplan.
 * This script will assume the existance of the following environment variables:
 * -- PAGIApplication: Name of the class that extends PAGIApplication that you
 * want to run.
 * -- PAGIBootstrap: Name of the file (like a.php) that you want to include_once
 * before running the application.
 * -- log4php: Absolute full path to the log4php.properties (may be a dummy
 * path, in this case you may gain some performance but wont be able to see
 * any logs apart from the asterisk console).
 *
 * PHP Version 5
 *
 * @category Pagi
 * @package  Application
 * @author   <NAME> <<EMAIL>>
 * @license  http://www.noneyet.ar/ Apache License 2.0
 * @version  SVN: $Id$
 * @link     http://www.noneyet.ar/
 */
require_once 'PAGI/Autoloader/PAGI_Autoloader.php'; // Include PAGI autoloader.
PAGI_Autoloader::register(); // Call autoloader register for PAGI autoloader.
use PAGI\Application\Exception\InvalidApplicationException;

$appName = getenv('PAGIApplication');
$bootstrap = getenv('PAGIBootstrap');
$log4php = realpath(getenv('log4php_properties'));
$myApp = '';
//\Logger::configure($log4php);
//$logger = \Logger::getLogger('PAGI.Launcher');
$neededMethods = array(
	'init', 'run', 'shutdown', 'errorHandler', 'signalHandler'
);
try
{

    include_once $bootstrap;
    if (!class_exists($appName, true)) {
        throw new InvalidApplicationException($appName . ' is not loaded.');
    }
    foreach ($neededMethods as $method) {
        if (!method_exists($appName, $method)) {
            throw new InvalidApplicationException($appName . ': Missing ' . $method);
        }
    }
    $myApp = new $appName(array('log4php.properties' => $log4php));
    $myApp->init();
    $myApp->run();
} catch (\Exception $e) {
    $myApp->log($e);
}<commit_msg>changed method_exists by instanceof PAGIApplicatino doh :P<commit_after><?php
/**
 * This is our "dispatcher", you should invoke this one from your dialplan.
 * This script will assume the existance of the following environment variables:
 * -- PAGIApplication: Name of the class that extends PAGIApplication that you
 * want to run.
 * -- PAGIBootstrap: Name of the file (like a.php) that you want to include_once
 * before running the application.
 * -- log4php: Absolute full path to the log4php.properties (may be a dummy
 * path, in this case you may gain some performance but wont be able to see
 * any logs apart from the asterisk console).
 *
 * PHP Version 5
 *
 * @category Pagi
 * @package  Application
 * @author   <NAME> <<EMAIL>>
 * @license  http://www.noneyet.ar/ Apache License 2.0
 * @version  SVN: $Id$
 * @link     http://www.noneyet.ar/
 */
require_once 'PAGI/Autoloader/PAGI_Autoloader.php'; // Include PAGI autoloader.
PAGI_Autoloader::register(); // Call autoloader register for PAGI autoloader.
use PAGI\Application\Exception\InvalidApplicationException;

$appName = getenv('PAGIApplication');
$bootstrap = getenv('PAGIBootstrap');
$log4php = realpath(getenv('log4php_properties'));
$myApp = '';
//\Logger::configure($log4php);
//$logger = \Logger::getLogger('PAGI.Launcher');
try
{

    include_once $bootstrap;
    if (!class_exists($appName, true)) {
        throw new InvalidApplicationException($appName . ' is not loaded');
    }

    if (!($appName instanceof PAGIApplication)) {
        throw new InvalidApplicationException($appName . ': Invalid application');
    }
    $myApp = new $appName(array('log4php.properties' => $log4php));
    $myApp->init();
    $myApp->run();
} catch (\Exception $e) {
    $myApp->log($e);
}
{'fraction_non_alphanumeric': 0.13386917960088693, 'fraction_numerical': 0.005543237250554324, 'mean_word_length': 3.991701244813278, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '5204157', 'n_tokens_mistral': 1146, 'n_tokens_neox': 1129, 'n_words': 338}