Exemple #1
0
 private static function _load_service($recipe, $classtype, $params = [])
 {
     /*
      * Capture initial recipe. Save reference as
      * $recipe_str and make $recipe array
      */
     if (is_string($recipe)) {
         $recipe_str = $recipe;
         $recipe = explode(',', $recipe);
     } else {
         $recipe = implode(',', $recipe);
     }
     /*
      * Check to see if maybe there is a prequisite file referred to as a
      * recipe.
      */
     self::$service_root = self::$emroot . DS . 'services';
     $recipe_file = self::$service_root . DS . $recipe[count($recipe) - 1] . DS . 'recipe.txt';
     $recipe = self::_load_service_recipe($recipe, $recipe_file, $classtype);
     $count = count($recipe);
     for ($i = 0; $i < $count; ++$i) {
         $recipe_root = self::$service_root . DS . $recipe[$i];
         self::run('before_service_load', $recipe_root);
         if (!isset(self::$loadedfolders[self::$service_root . DS . $recipe[$i]])) {
             em\Load::_($recipe_root);
         }
         if (isset(self::$loadedfolders[self::$service_root . DS . $recipe[$i]])) {
             self::run('after_service_load', $recipe_root);
             /*
              * Here is another opportunity to override the lang folder location.
              * We dupe the same logic(different method tho) as above here as the
              * language file location might change at every fork instance, but
              * I really, really really wouldn't recommend using multiple
              * different language file locations.
              */
             $langdir = self::$emroot . $ds . 'lang';
             /*
              * Load translation files by the current language.
              */
             em\Lang::load_language($langdir . $ds . $this->lang_type . $ds . $this->lang_type . '.' . $recipe[$i] . '.ini');
         }
     }
     $class = ucwords($recipe[$count - 1]) . $this->signature . $classtype;
     /*
      * if a class or otherwise known as a fork file exist then instantiate a
      * new fork instance.
      */
     if ($class && class_exists($class)) {
         $return = self::app($class);
     }
 }
Exemple #2
0
<?php

error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);
require_once __DIR__ . '/../src/load.php';
em\Load::_([__DIR__ . '/../src/traits', __DIR__ . '/../src']);
em\Park::log(['Passing in a %s.', 'directive']);
em\Park::init();
em\Park::app();
em\Park::config(['myvar' => 'value']);
em\Lang::_('en');
em\Park::err(em\Park::app()->myvar);