Files
nl-mall-api/system/package.php

34 lines
749 B
PHP
Raw Normal View History

2011-08-02 22:07:40 -05:00
<?php namespace System;
class Package {
/**
* All of the loaded packages.
*
* @var array
*/
public static $loaded = array();
/**
* Load a package or set of packages.
*
2011-08-02 22:40:12 -05:00
* @param string|array $packages
2011-08-02 22:07:40 -05:00
* @return void
*/
2011-08-02 22:40:12 -05:00
public static function load($packages)
2011-08-02 22:07:40 -05:00
{
2011-08-02 22:40:12 -05:00
foreach ((array) $packages as $package)
2011-08-02 22:07:40 -05:00
{
2011-08-02 22:40:12 -05:00
// Packages may have a bootstrap file, which commonly is used to register auto-loaders
// and perform other initialization needed to use the package. If the package has a
// bootstrapper, we will require it here.
if ( ! array_key_exists($package, static::$loaded) and file_exists($path = PACKAGE_PATH.$package.'/bootstrap'.EXT))
2011-08-02 22:07:40 -05:00
{
2011-08-02 22:40:12 -05:00
require $path;
2011-08-02 22:07:40 -05:00
}
2011-08-02 22:29:48 -05:00
2011-08-02 22:40:12 -05:00
static::$loaded[] = $package;
2011-08-02 22:07:40 -05:00
}
}
}