ptc_watch('var');
    // PtcDebug::watch( )
    $var = 'some new value';
    // the variable changed
}
/* STOP CODE COVERAGE ANALYSIS */
ptc_stop_coverage();
// PtcDebug::stopCoverage( )
/* STOP FUNCTION CALLS TRACING */
ptc_stop_trace();
// PtcDebug::stopTrace( )
/*** PTC HANDYMAN HELPERPS ****************************************************/
/* ADDING APPLICATION PATHS FOR LATER USAGE ( PtcHandMan::addAppPath( ) ) */
ptc_add_path(array('lib' => dirname(__FILE__) . '/autoloader-example-files'));
/* ADDING CLASS FILES ( PtcHandMan::addFile( ) ) */
ptc_add_file(array('HmTestClassFile' => ptc_path('lib') . '/class-file.php', 'ns\\HmTestClassFile' => ptc_path('lib') . '/ns-class-file.php'));
/* ADDING DIRECTORIES WITH CLASSES TO THE AUTOLOADER ( PtcHandMan::addDir( ) ) */
ptc_add_dir(ptc_path('lib'));
// PtcHandMan::getAppPath(
/* ADDING A NAMESPACED DIRECTORY WITH CLASSES TO THE AUTOLOADER */
ptc_add_dir(array('nsTest' => ptc_path('lib') . '/namespaceTest'));
/* GETTING THE DIRECTORIES OF THE AUTOLOADER ( PtcHandyMan::getDirs( ) )*/
$dirs = ptc_dir();
// PtcHandyMan::getDirs( ) params: ( files , directories , ns )
ptc_log($dirs, 'getting all directories and files to be autoloaded');
//PtcDebug::bufferLog( );
/*** PTC EVENT HELPERPS ****************************************************/
/* ADDING EVENT LISTENERS ( PtcEvent::listen( ) ) */
ptc_listen('some.event', function ($data) {
    // do some stuff
    ptc_log($data, 'Called event with closure as call back');
Exemplo n.º 2
0
 /**
  * Application bootstrap configuration
  */
 protected static function _setAppConfig()
 {
     /* paths */
     static::option('paths', Module::merge(ptc_path('root') . '/app/config/paths.php'));
     ptc_add_path(ptc_array_get(static::$_config, 'paths'));
     /* application */
     static::option('app', Module::merge(ptc_path('root') . '/app/config/app.php'));
     HandyMan::addAlias(ptc_array_get(static::$_config, 'app.aliases'));
     if ($locale = ptc_array_get(static::$_config, 'app.locale')) {
         setlocale(LC_ALL, $locale . 'UTF-8');
     }
     if ($timezone = ptc_array_get(static::$_config, 'app.timezone')) {
         date_default_timezone_set($timezone);
     }
     ptc_add_file(ptc_array_get(static::$_config, 'app.files'));
     ptc_add_dir(ptc_array_get(static::$_config, 'app.directories'));
     ptc_add_dir(ptc_array_get(static::$_config, 'app.namespaces'));
     if ($sep = ptc_array_get(static::$_config, 'app.separators')) {
         HandyMan::addSeparators($sep);
     }
     if ($conv = ptc_array_get(static::$_config, 'app.conventions')) {
         HandyMan::addConventions($conv);
     }
     /* database */
     static::option('db', Module::merge(ptc_path('root') . '/app/config/db.php'));
     if ($db = ptc_array_get(static::$_config, 'db')) {
         $loop = static::option('app.test_env') ? $db['develop'] : $db['prod'];
         foreach ($loop as $k => $v) {
             if (ptc_array_get($v, 'user')) {
                 DB::add($v, $k);
             }
         }
     }
     /* auth */
     static::option('auth', Module::merge(ptc_path('root') . '/app/config/auth.php'));
 }