Esempio n. 1
0
 /**
  * Includes a file with an empty variable scope.
  *
  * @param  string     $file    The path to the file to import.
  * @param  array|null $scope   A custom scope to give to the file.
  * @param  boolean    $require Whether to use require() or include().
  * @return mixed               Anything the file returns.
  */
 function import($file, $scope = null, $require = true)
 {
     return Brads\Importer::import($file, $scope, $require);
 }
Esempio n. 2
0
//              |    __) \_  __ \  |  \_/ ___\   __\  \   __<   |  |
//              |     \   |  | \/  |  /\  \___|  | |  ||  |  \___  |
//              \___  /   |__|  |____/  \___  >__| |__||__|  / ____|
//                  \/                      \/               \/
// -----------------------------------------------------------------------------
//                          https://github.com/fructify
//
//          Designed and Developed by Brad Jones <brad @="bjc.id.au" />
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
use DI\ContainerBuilder;
use Stringy\Stringy as s;
use Fructify\Contracts\IKernel;
// Install the import function globally.
// see: https://github.com/brad-jones/import/
Brads\Importer::globalise();
/**
 * The Theme IoC Container.
 *
 * Wrap everything up into a closure because the global scope is already pretty
 * crowded being a wordpress environment and all... :) Additonally it stops
 * anyone from cheating and say requesting the IoC Container by using something
 * like ```$GLOBALS['app']```.
 */
call_user_func(function () {
    $builder = new ContainerBuilder();
    // We will enable @Inject annotation support. Between autowiring &
    // annotations I am hoping we won't need to have much in the way of
    // custom definitions in the ```container.php``` file.
    // http://php-di.org/doc/annotations.html
    $builder->useAnnotations(true);