/** * Construct a new cached ConfigIO * * @param zibo\core\environment\Environment $environment the environment currently operating in * @param ConfigIO $configIO the ConfigIO implementation to decorate * @param zibo\library\cache\Cache $cache the Cache to use for caching, omit it to use the default * file based cache at the path application/data/cache/config */ public function __construct(Environment $environment, ConfigIO $configIO, Cache $cache = null) { $this->configIO = $configIO; $this->cacheType = $environment->getName(); $this->cache = $cache; $this->isCacheEnabled = null; }
/** * Construct a new cached ConfigIO * * @param ConfigIO $configIO the ConfigIO implementation to decorate * @param zibo\core\environment\Environment $environment the environment * currently operating in * @param zibo\library\cache\Cache $cache the Cache to use for caching, * omit it to use the default file based cache at the path * application/data/cache/config */ public function __construct(ConfigIO $configIO, Environment $environment, Cache $cache = null) { $this->configIO = $configIO; $this->cacheType = $environment->getName(); $this->cache = $cache; $this->setIsCacheEnabled($this->getConfigValue(self::CONFIG_CACHE_ENABLED, false)); }
public function setUp() { $path = new File(__DIR__ . '/../../../../../'); $this->setUpApplication($path->getPath()); $browser = new GenericBrowser(new File(getcwd())); $configIO = new IniConfigIO(Environment::getInstance(), $browser); Zibo::getInstance($browser, $configIO); }
/** * Get the path of the environment configuration * @return string */ private function getEnvironmentPath() { if (!$this->environmentPath) { $environmentName = $this->environment->getName(); $writePath = $this->getWritePath(); $this->environmentPath = new File($writePath, $environmentName); } return $this->environmentPath; }
protected function setUp() { $path = new File(__DIR__ . '/../../../../'); $this->setUpApplication($path->getPath()); $browser = new GenericBrowser(new File(getcwd())); $configIO = new IniConfigIO(Environment::getInstance(), $browser); Zibo::getInstance($browser, $configIO); $validationFactory = ValidationFactory::getInstance(); $validationFactory->registerValidator('email', 'zibo\\library\\mail\\AddressValidator'); }
protected function setUp() { $path = new File(__DIR__ . '/../../../../'); $this->setUpApplication($path->getPath()); $browser = new GenericBrowser(new File(getcwd())); $configIO = new IniConfigIO(Environment::getInstance(), $browser); Zibo::getInstance($browser, $configIO); if (!DatabaseManager::getInstance()->hasConnection('mysql')) { $this->markTestSkipped('No dsn found for database.connection.mysql, check config/database.ini'); } $this->manager = ModelManager::getInstance(); Reflection::setProperty($this->manager, 'models', array()); }
protected function setUp() { $path = new File(__DIR__ . '/../../../../'); $this->setUpApplication($path->getPath()); try { $browser = new GenericBrowser(new File(getcwd())); $configIO = new IniConfigIO(Environment::getInstance(), $browser); Zibo::getInstance($browser, $configIO); } catch (ZiboException $e) { } $this->server = new Server(); $this->service = new SumService(); $this->serviceName = 'test.sum'; $this->callback = array($this->service, 'sum'); $this->resultType = 'int'; $this->parameterTypes = array('int', 'int'); }
public function setUp() { $browser = new GenericBrowser(new File(getcwd())); $configIO = new IniConfigIO(Environment::getInstance(), $browser); $zibo = Zibo::getInstance($browser, $configIO); }
} /* * Here we go then, let's boot. You can stop editing... */ use zibo\core\environment\Environment; use zibo\core\Autoloader; use zibo\core\ErrorHandler; use zibo\library\config\io\CachedConfigIO; use zibo\library\filesystem\File; require_once $rootPath . '/system/src/zibo/ZiboException.php'; require_once $rootPath . '/system/src/zibo/core/Autoloader.php'; require_once $rootPath . '/system/src/zibo/core/ErrorHandler.php'; require_once $rootPath . '/system/src/zibo/core/Zibo.php'; require_once $rootPath . '/system/src/zibo/library/filesystem/browser/Browser.php'; require_once $rootPath . '/system/src/zibo/library/filesystem/browser/AbstractBrowser.php'; require_once $rootPath . '/system/src/' . str_replace('\\', '/', $fileBrowserClass) . '.php'; require_once $rootPath . '/system/src/zibo/library/filesystem/exception/FileSystemException.php'; require_once $rootPath . '/system/src/zibo/library/filesystem/File.php'; require_once $rootPath . '/system/src/zibo/library/filesystem/FileSystem.php'; require_once $rootPath . '/system/src/zibo/library/String.php'; $errorHandler = new ErrorHandler(); $errorHandler->registerErrorHandler(); $rootPath = new File($rootPath); $fileBrowser = new $fileBrowserClass($rootPath); $autoloader = new Autoloader($fileBrowser); $autoloader->registerAutoloader(); $environment = Environment::getInstance(); $innerConfigIO = new $configIOClass($environment, $fileBrowser); $configIO = new CachedConfigIO($environment, $innerConfigIO); unset($fileBrowserClass); unset($configIOClass);
/** * Creates a request object with the provided parameters and adds the * query parameters and the body parameters to it * @param string $baseUrl The base URL * @param string $basePath The base URL with the action path concatted * @param string $controller The full class name of the controller * @param string|null $action The name of the action method * @param array $parameters Array with the parameters for the action method * @return zibo\core\Request The created request */ protected final function createRequest($baseUrl, $basePath, $controller, $action, $parameters) { $queryParameters = $this->environment->getQueryArguments(); $bodyParameters = $this->environment->getBodyArguments(); return new Request($baseUrl, $basePath, $controller, $action, $parameters, $queryParameters, $bodyParameters); }
/** * Constructs a new security manager * @return null */ private function __construct() { $zibo = Zibo::getInstance(); $objectFactory = new ObjectFactory(); $this->initializeSecurityModel($zibo, $objectFactory); $this->initializeAuthenticator($zibo, $objectFactory); $this->initializeHashAlgorithm($zibo, $objectFactory); $this->routeMatcher = new RouteMatcher(); $environment = Environment::getInstance()->getName(); $this->isCli = $environment == CliEnvironment::NAME; }
/** * Get the environment we are running in * @return zibo\core\environment\Environment */ public function getEnvironment() { if ($this->environment === null) { $this->setEnvironment(Environment::getEnvironment()); } return $this->environment; }
/** * Sets the environment * @param zibo\core\environment\Environment $environment * @return null */ public function setEnvironment(Environment $environment) { $this->environment = $environment; $this->environment->setZibo($this); }
// include necessairy classes use zibo\core\environment\Environment; use zibo\core\config\io\CachedConfigIO; use zibo\core\Autoloader; use zibo\core\ErrorHandler; use zibo\library\filesystem\File; require_once $rootPath . '/system/src/zibo/ZiboException.php'; require_once $rootPath . '/system/src/zibo/library/String.php'; require_once $rootPath . '/system/src/zibo/library/filesystem/exception/FileSystemException.php'; require_once $rootPath . '/system/src/zibo/library/filesystem/File.php'; require_once $rootPath . '/system/src/zibo/library/filesystem/FileSystem.php'; require_once $rootPath . '/system/src/zibo/core/Autoloader.php'; require_once $rootPath . '/system/src/zibo/core/ErrorHandler.php'; require_once $rootPath . '/system/src/zibo/core/Zibo.php'; require_once $rootPath . '/system/src/zibo/core/filesystem/FileBrowser.php'; require_once $rootPath . '/system/src/zibo/core/filesystem/AbstractFileBrowser.php'; require_once $rootPath . '/system/src/' . str_replace('\\', '/', $fileBrowserClass) . '.php'; // register the error handler $errorHandler = new ErrorHandler(); $errorHandler->registerErrorHandler(); // initialize the file browser $rootPath = new File($rootPath); $fileBrowser = new $fileBrowserClass($rootPath); // register the autoloader $autoloader = new Autoloader($fileBrowser); $autoloader->registerAutoloader(); // get the environment $environment = Environment::getEnvironment(); // initialize the configuration i/o $configIO = new $configIOClass($environment, $fileBrowser); $configIO = new CachedConfigIO($configIO, $environment);