Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Removed ZendModule and ZendMvc modules; now in ZF2 master library

  • Loading branch information...
commit 60775ef24d61fb71fd48b4a4bbf81d99f2872608 1 parent 1f9285c
@weierophinney authored
Showing with 0 additions and 5,836 deletions.
  1. +0 −2  configs/application.config.php
  2. +0 −8 modules/ZendModule/Module.php
  3. +0 −8 modules/ZendModule/autoload_classmap.php
  4. +0 −12 modules/ZendModule/autoload_function.php
  5. +0 −2  modules/ZendModule/autoload_register.php
  6. +0 −20 modules/ZendModule/composer.json
  7. +0 −66 modules/ZendModule/docs/README.md
  8. +0 −189 modules/ZendModule/src/Zend/Loader/ModuleAutoloader.php
  9. +0 −244 modules/ZendModule/src/Zend/Module/Manager.php
  10. +0 −181 modules/ZendModule/src/Zend/Module/ManagerOptions.php
  11. +0 −149 modules/ZendModule/tests/Zend/Loader/ModuleAutoloaderTest.php
  12. +0 −6 modules/ZendModule/tests/Zend/Loader/TestAsset/FooModule/Module.php
  13. +0 −7 modules/ZendModule/tests/Zend/Loader/TestAsset/FooModule/SubModule/Module.php
  14. BIN  modules/ZendModule/tests/Zend/Loader/TestAsset/PharModule.phar
  15. BIN  modules/ZendModule/tests/Zend/Loader/TestAsset/PharModuleBz2.phar.bz2
  16. +0 −2  modules/ZendModule/tests/Zend/Loader/TestAsset/PharModuleFake.tar/readme
  17. BIN  modules/ZendModule/tests/Zend/Loader/TestAsset/PharModuleFake.zip
  18. BIN  modules/ZendModule/tests/Zend/Loader/TestAsset/PharModuleGz.phar.gz
  19. BIN  modules/ZendModule/tests/Zend/Loader/TestAsset/PharModulePharTar.phar.tar
  20. BIN  modules/ZendModule/tests/Zend/Loader/TestAsset/PharModulePharTarBz2.phar.tar.bz2
  21. BIN  modules/ZendModule/tests/Zend/Loader/TestAsset/PharModulePharTarGz.phar.tar.gz
  22. BIN  modules/ZendModule/tests/Zend/Loader/TestAsset/PharModulePharZip.phar.zip
  23. BIN  modules/ZendModule/tests/Zend/Loader/TestAsset/PharModuleTar.tar
  24. BIN  modules/ZendModule/tests/Zend/Loader/TestAsset/PharModuleTarBz2.tar.bz2
  25. BIN  modules/ZendModule/tests/Zend/Loader/TestAsset/PharModuleTarGz.tar.gz
  26. BIN  modules/ZendModule/tests/Zend/Loader/TestAsset/PharModuleZip.zip
  27. +0 −63 modules/ZendModule/tests/Zend/Loader/TestAsset/_buildPhars.php
  28. +0 −62 modules/ZendModule/tests/Zend/Module/ManagerOptionsTest.php
  29. +0 −114 modules/ZendModule/tests/Zend/Module/ManagerTest.php
  30. +0 −23 modules/ZendModule/tests/Zend/Module/TestAsset/BarModule/Module.php
  31. +0 −4 modules/ZendModule/tests/Zend/Module/TestAsset/BarModule/autoload_classmap.php
  32. +0 −12 modules/ZendModule/tests/Zend/Module/TestAsset/BarModule/autoload_function.php
  33. +0 −2  modules/ZendModule/tests/Zend/Module/TestAsset/BarModule/autoload_register.php
  34. +0 −4 modules/ZendModule/tests/Zend/Module/TestAsset/BarModule/configs/config.php
  35. +0 −1  modules/ZendModule/tests/Zend/Module/TestAsset/BarModule/tests/loljk
  36. +0 −23 modules/ZendModule/tests/Zend/Module/TestAsset/BazModule/Module.php
  37. +0 −4 modules/ZendModule/tests/Zend/Module/TestAsset/BazModule/autoload_classmap.php
  38. +0 −12 modules/ZendModule/tests/Zend/Module/TestAsset/BazModule/autoload_function.php
  39. +0 −2  modules/ZendModule/tests/Zend/Module/TestAsset/BazModule/autoload_register.php
  40. +0 −4 modules/ZendModule/tests/Zend/Module/TestAsset/BazModule/configs/config.php
  41. +0 −1  modules/ZendModule/tests/Zend/Module/TestAsset/BazModule/tests/loljk
  42. +0 −23 modules/ZendModule/tests/Zend/Module/TestAsset/SomeModule/Module.php
  43. +0 −4 modules/ZendModule/tests/Zend/Module/TestAsset/SomeModule/autoload_classmap.php
  44. +0 −12 modules/ZendModule/tests/Zend/Module/TestAsset/SomeModule/autoload_function.php
  45. +0 −2  modules/ZendModule/tests/Zend/Module/TestAsset/SomeModule/autoload_register.php
  46. +0 −4 modules/ZendModule/tests/Zend/Module/TestAsset/SomeModule/configs/config.php
  47. +0 −30 modules/ZendModule/tests/bootstrap.php
  48. +0 −17 modules/ZendModule/tests/phpunit.xml
  49. +0 −78 modules/ZendMvc/.vimproject
  50. +0 −23 modules/ZendMvc/Module.php
  51. +0 −27 modules/ZendMvc/autoload_classmap.php
  52. +0 −12 modules/ZendMvc/autoload_function.php
  53. +0 −2  modules/ZendMvc/autoload_register.php
  54. +0 −20 modules/ZendMvc/composer.json
  55. +0 −236 modules/ZendMvc/docs/zf2-mvc.examples.md
  56. +0 −97 modules/ZendMvc/src/Zend/Mvc/AppContext.php
  57. +0 −351 modules/ZendMvc/src/Zend/Mvc/Application.php
  58. +0 −215 modules/ZendMvc/src/Zend/Mvc/Controller/ActionController.php
  59. +0 −285 modules/ZendMvc/src/Zend/Mvc/Controller/RestfulController.php
  60. +0 −6 modules/ZendMvc/src/Zend/Mvc/Exception.php
  61. +0 −10 modules/ZendMvc/src/Zend/Mvc/Exception/InvalidArgumentException.php
  62. +0 −9 modules/ZendMvc/src/Zend/Mvc/Exception/MissingLocatorException.php
  63. +0 −11 modules/ZendMvc/src/Zend/Mvc/LocatorAware.php
  64. +0 −103 modules/ZendMvc/src/Zend/Mvc/MvcEvent.php
  65. +0 −195 modules/ZendMvc/src/Zend/Mvc/PhpEnvironment/GetContainer.php
  66. +0 −196 modules/ZendMvc/src/Zend/Mvc/PhpEnvironment/PostContainer.php
  67. +0 −32 modules/ZendMvc/src/Zend/Mvc/Router/Exception.php
  68. +0 −37 modules/ZendMvc/src/Zend/Mvc/Router/Exception/InvalidArgumentException.php
  69. +0 −36 modules/ZendMvc/src/Zend/Mvc/Router/Exception/RuntimeException.php
  70. +0 −126 modules/ZendMvc/src/Zend/Mvc/Router/Http/Literal.php
  71. +0 −168 modules/ZendMvc/src/Zend/Mvc/Router/Http/Part.php
  72. +0 −158 modules/ZendMvc/src/Zend/Mvc/Router/Http/Regex.php
  73. +0 −81 modules/ZendMvc/src/Zend/Mvc/Router/Http/TreeRouteStack.php
  74. +0 −217 modules/ZendMvc/src/Zend/Mvc/Router/PriorityList.php
  75. +0 −61 modules/ZendMvc/src/Zend/Mvc/Router/Route.php
  76. +0 −119 modules/ZendMvc/src/Zend/Mvc/Router/RouteMatch.php
  77. +0 −59 modules/ZendMvc/src/Zend/Mvc/Router/RouteStack.php
  78. +0 −267 modules/ZendMvc/src/Zend/Mvc/Router/SimpleRouteStack.php
  79. +0 −90 modules/ZendMvc/src/Zend/Mvc/SendableResponse.php
  80. +0 −503 modules/ZendMvc/tests/Zend/Mvc/ApplicationTest.php
  81. +0 −128 modules/ZendMvc/tests/Zend/Mvc/Controller/ActionControllerTest.php
  82. +0 −176 modules/ZendMvc/tests/Zend/Mvc/Controller/RestfulControllerTest.php
  83. +0 −13 modules/ZendMvc/tests/Zend/Mvc/Controller/TestAsset/BadController.php
  84. +0 −2  modules/ZendMvc/tests/Zend/Mvc/Controller/TestAsset/RestfulController.php
  85. +0 −78 modules/ZendMvc/tests/Zend/Mvc/Controller/TestAsset/RestfulTestController.php
  86. +0 −18 modules/ZendMvc/tests/Zend/Mvc/Controller/TestAsset/SampleController.php
  87. +0 −107 modules/ZendMvc/tests/Zend/Mvc/PhpEnvironment/AbstractContainerTest.php
  88. +0 −19 modules/ZendMvc/tests/Zend/Mvc/PhpEnvironment/GetContainerTest.php
  89. +0 −19 modules/ZendMvc/tests/Zend/Mvc/PhpEnvironment/PostContainerTest.php
  90. +0 −36 modules/ZendMvc/tests/Zend/Mvc/TestAsset/Locator.php
  91. +0 −23 modules/ZendMvc/tests/Zend/Mvc/TestAsset/LocatorAwareController.php
  92. +0 −19 modules/ZendMvc/tests/Zend/Mvc/TestAsset/PathController.php
  93. +0 −29 modules/ZendMvc/tests/bootstrap.php
  94. +0 −17 modules/ZendMvc/tests/phpunit.xml
  95. +0 −3  public/index.php
View
2  configs/application.config.php
@@ -4,8 +4,6 @@
realpath(__DIR__ . '/../modules'),
),
'modules' => array(
- 'ZendModule',
- 'ZendMvc',
'site',
'Guestbook',
),
View
8 modules/ZendModule/Module.php
@@ -1,8 +0,0 @@
-<?php
-
-namespace ZendModule;
-
-class Module
-{
- // Okay, the loader can't load itself. It'd be cool though!
-}
View
8 modules/ZendModule/autoload_classmap.php
@@ -1,8 +0,0 @@
-<?php
-return array (
- 'ZendTest\\Module\\ManagerTest' => __DIR__ . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR . 'Zend' . DIRECTORY_SEPARATOR . 'Module' . DIRECTORY_SEPARATOR . 'ManagerTest.php',
- 'ZendModule\\Module' => __DIR__ . DIRECTORY_SEPARATOR . 'Module.php',
- 'Zend\\Loader\\ModuleAutoloader' => __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Zend' . DIRECTORY_SEPARATOR . 'Loader' . DIRECTORY_SEPARATOR . 'ModuleAutoloader.php',
- 'Zend\\Module\\Manager' => __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Zend' . DIRECTORY_SEPARATOR . 'Module' . DIRECTORY_SEPARATOR . 'Manager.php',
- 'Zend\\Module\\ManagerOptions' => __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Zend' . DIRECTORY_SEPARATOR . 'Module' . DIRECTORY_SEPARATOR . 'ManagerOptions.php',
-);
View
12 modules/ZendModule/autoload_function.php
@@ -1,12 +0,0 @@
-<?php
-return function ($class) {
- static $map;
- if (!$map) {
- $map = include __DIR__ . '/autoload_classmap.php';
- }
-
- if (!isset($map[$class])) {
- return false;
- }
- return include $map[$class];
-};
View
2  modules/ZendModule/autoload_register.php
@@ -1,2 +0,0 @@
-<?php
-spl_autoload_register(include __DIR__ . '/autoload_function.php');
View
20 modules/ZendModule/composer.json
@@ -1,20 +0,0 @@
-{
- "name": "Zf2Module",
- "type": "Library",
- "description": "Module loader prototype for ZF2",
- "keywords": ["zf2","module"],
- "homepage": "http://framework.zend.com/zf2",
- "version": "0.0.1",
- "license": "New BSD",
- "authors": [
- {
- "name": "Evan Coury",
- "email": "me@evancoury.com",
- "homepage": "http://framework.zend.com/"
- }
- ],
- "require": {
- "php": ">=5.3.0",
- "zf2": ">=2.0.0dev4"
- }
-}
View
66 modules/ZendModule/docs/README.md
@@ -1,66 +0,0 @@
-ZF2 Module Manager Prototype
-============================
-
-Description
------------
-This is a prototype of how a module loader and manager for ZF2 might work.
-
-Currently Implemented
----------------------
-
-* **Phar support:**
- Modules can be packaged, distributed, installed, and ran as phar archives.
- Supports both executable and non-executable archives; with and without a stub.
- Module class must be made available by either Module.php in the root of the
- phar or in the stub if it is an executable phar. Below is a list of phar
- archive/compression formats that are supported and their respective extensions,
- as detected by the module loader:
- * **Executable** (can be included directly, which executes stub):
- * phar (.phar)
- * phar + gz (.phar.gz)
- * phar + bz2 (.phar.bz2)
- * tar (.phar.tar)
- * tar + gz (.phar.tar.gz)
- * tar + bz2 (.phar.tar.bz2)
- * zip (.zip)
- * **Non-executable** (phar cannot be included directly; no stub can be set):
- * tar (.tar)
- * tar + gz (.tar.gz)
- * tar + bz2 (.tar.bz2)
- * zip (.zip)
-* **Configuration merging:**
- The module manager goes through each enabled module, loads its
- `Zend\Config\Config` object via the `getConfig()` method of the respective
- `Module` class; merging them into a single configuration object to be passed
- along to the bootstrap class, which can be defined inthe config of course!
-* **Caching merged configuration:**
- To avoid the overhead of loading and merging the configuration of each
- module for every execution, the module manager supports caching the merged
- configuration as an array via `var_export()`. Subsequent requests will bypass
- the entire configuration loading/merging process, nearly eliminating any
- configuration-induced overhead.
-* **Module init()**
- The module manager calls on the `init()` method on the `Module` class of
- each enabled module, passing itself as the only parameter. This gives
- modules a chance to register their own autoloaders or perform any other
- initial setup required. **Warning:** The `init()` method is called for every
- enabled module for every single request. The work it performs should be kept
- to an absolute minimum (such as registering a simple classmap autoloader).
-* **100% unit test coverage**
- Much effort has been put into extensive unit testing of the module loader
- and manager. In addition to covering every line of code, further effort was
- made to test other use-cases such as nested/sub-modules and various other
- behaviors.
-
-
-Stuff that still needs figured out:
------------------------------------
-
-* How to expire the merged config cache in production and/or development.
-* Ability for modules to cleanly "share" resources? For example, you have 5 module which all use a database connection (or maybe two: master for writes, slave for reads).
-* How can modules use varying view templating types? For example, one module uses twig, another uses smarty, another mustache, and yet another uses phtml. Does it make sense to have modules for each template library or system, then modules can just declare the respective one as a dependency?
-* How to handle static assets such as images, js, and css files ([assetic](https://github.com/kriswallsmith/assetic) has been suggested).
-* Should dependencies also be resolved outside of the distribution channel (such as pyrus) to better handle manual / alternate installation methods?
-* Should we, and if so, how would we handle DB schemas for installation, update/migrations, and uninstallation of modules?
-* When a module is uninstalled, what's removed, what should stay? Do we put the responsibility of uninstallation in the hands of each module developer?
-* When a module is uninstalled, should it check for other modules that are still depending on it? How much is too much, and when do we just leave it up to the developers?
View
189 modules/ZendModule/src/Zend/Loader/ModuleAutoloader.php
@@ -1,189 +0,0 @@
-<?php
-
-namespace Zend\Loader;
-
-use SplFileInfo,
- Zend\Loader\SplAutoloader, // @TODO: Remove once ported to the _real_ Zend\Loader namespace
- Traversable;
-
-class ModuleAutoloader implements SplAutoloader
-{
- /**
- * @var array An array of module paths to scan
- */
- protected $paths = array();
-
- /**
- * Constructor
- *
- * Allow configuration of the autoloader via the constructor.
- *
- * @param null|array|Traversable $options
- * @return void
- */
- public function __construct($options = null)
- {
- if (null !== $options) {
- $this->setOptions($options);
- }
- }
-
- /**
- * Configure the autoloader
- *
- * In most cases, $options should be either an associative array or
- * Traversable object.
- *
- * @param array|Traversable $options
- * @return SplAutoloader
- */
- public function setOptions($options)
- {
- $this->registerPaths($options);
- return $this;
- }
-
- /**
- * Autoload a class
- *
- * @param $class
- * @return mixed
- * False [if unable to load $class]
- * get_class($class) [if $class is successfully loaded]
- */
- public function autoload($class)
- {
- // Limit scope of this autoloader
- if (substr($class, -7) !== '\Module') {
- return false;
- }
- $moduleClassPath = str_replace('\\', DIRECTORY_SEPARATOR, $class) . '.php';
-
- foreach ($this->paths as $path) {
- $file = new SplFileInfo($path . $moduleClassPath);
- if ($file->isReadable()) {
- // Found directory with Module.php in it
- require_once $file->getRealPath();
- return $class;
- }
- // No directory with Module.php, searching for phars
- $moduleName = substr($class, 0, strpos($class, '\\'));
-
- // Find executable phars
- $matches = glob($path . $moduleName . '.{phar,phar.gz,phar.bz2,phar.tar,phar.tar.gz,phar.tar.bz2,phar.zip}', GLOB_BRACE);
- $executable = true;
- if (count($matches) == 0) {
- $matches = glob($path . $moduleName . '.{tar,tar.gz,tar.bz2,zip}', GLOB_BRACE);
- $executable = false;
- }
- foreach ($matches as $phar) {
- $file = new SplFileInfo($phar);
- if ($file->isReadable() && $file->isFile()) {
- if ($executable) {
- // First see if the stub makes the Module class available
- require_once $file->getRealPath();
- if (class_exists($class)) {
- return $class;
- }
- }
- // No stub, or stub did not provide Module class; try Module.php directly
- $moduleClassFile = 'phar://' . $file->getRealPath() . '/Module.php';
- $file = new SplFileInfo($moduleClassFile);
- if ($file->isReadable() && $file->isFile()) {
- require_once $moduleClassFile;
- if (class_exists($class)) {
- return $class;
- }
- }
- }
- }
- }
- return false;
- }
-
- /**
- * Register the autoloader with spl_autoload registry
- *
- * @return void
- */
- public function register()
- {
- spl_autoload_register(array($this, 'autoload'));
- }
-
- /**
- * Unregister the autoloader with spl_autoload registry
- *
- * @return void
- */
- public function unregister()
- {
- $test = spl_autoload_unregister(array($this, 'autoload'));
- }
-
- /**
- * registerPaths
- *
- * @param array|Traversable $paths
- * @return ModuleLoader
- */
- public function registerPaths($paths)
- {
- if (is_array($paths) || $paths instanceof Traversable) {
- foreach ($paths as $path) {
- $this->registerPath($path);
- }
- } else {
- throw new \InvalidArgumentException(
- 'Parameter to \\Zend\\Loader\\ModuleAutoloader\'s '
- . 'registerPaths method must be an array or '
- . 'implement the \\Traversable interface'
- );
- }
- return $this;
- }
-
- /**
- * registerPath
- *
- * @param string $path
- * @return ModuleLoader
- */
- public function registerPath($path)
- {
- if (!is_string($path)) {
- throw new \InvalidArgumentException(sprintf(
- 'Invalid path provided; must be a string, received %s',
- gettype($path)
- ));
- }
- $this->paths[] = static::normalizePath($path);
- return $this;
- }
-
- /**
- * getPaths
- *
- * This is primarily for unit testing, but could have other uses.
- *
- * @return array
- */
- public function getPaths()
- {
- return $this->paths;
- }
-
- /**
- * Normalize a path for insertion in the stack
- *
- * @param string $path
- * @return string
- */
- public static function normalizePath($path)
- {
- $path = rtrim($path, '/');
- $path = rtrim($path, '\\');
- $path .= DIRECTORY_SEPARATOR;
- return $path;
- }
-}
View
244 modules/ZendModule/src/Zend/Module/Manager.php
@@ -1,244 +0,0 @@
-<?php
-
-namespace Zend\Module;
-
-use Traversable,
- Zend\Config\Config,
- Zend\EventManager\EventCollection,
- Zend\EventManager\EventManager;
-
-class Manager
-{
- /**
- * @var array An array of Module classes of loaded modules
- */
- protected $loadedModules = array();
-
- /**
- * @var EventCollection
- */
- protected $events;
-
- /**
- * @var ManagerOptions
- */
- protected $options;
-
- /**
- * @var Zend\Config\Config
- */
- protected $mergedConfig;
-
- /**
- * @var bool
- */
- protected $skipConfig = false;
-
- /**
- * __construct
- *
- * @param array|Traversable $modules
- * @param ManagerOptions $options
- * @return void
- */
- public function __construct($modules, ManagerOptions $options = null)
- {
- if ($options === null) {
- $this->setOptions(new ManagerOptions);
- } else {
- $this->setOptions($options);
- }
- if ($this->hasCachedConfig()) {
- $this->skipConfig = true;
- $this->setMergedConfig($this->getCachedConfig());
- }
- $this->loadModules($modules);
- $this->updateCache();
- $this->events()->trigger('init.post', $this);
- }
-
- /**
- * loadModules
- *
- * @param array|Traversable $modules
- * @return Manager
- */
- public function loadModules($modules)
- {
- if (is_array($modules) || $modules instanceof Traversable) {
- foreach ($modules as $moduleName) {
- $this->loadModule($moduleName);
- }
- } else {
- throw new \InvalidArgumentException(
- 'Parameter to \\ZendModule\\Manager\'s '
- . 'loadModules method must be an array or '
- . 'implement the \\Traversable interface'
- );
- }
- return $this;
- }
-
- /**
- * loadModule
- *
- * @param string $moduleName
- * @return mixed Module's Module class
- */
- public function loadModule($moduleName)
- {
- if (!isset($this->loadedModules[$moduleName])) {
- $class = $moduleName . '\Module';
- $module = new $class;
- $this->runModuleInit($module);
- $this->mergeModuleConfig($module);
- $this->loadedModules[$moduleName] = $module;
- }
- return $this->loadedModules[$moduleName];
- }
-
-
- /**
- * Set the event manager instance used by this context
- *
- * @param EventCollection $events
- * @return Manager
- */
- public function setEventManager(EventCollection $events)
- {
- $this->events = $events;
- return $this;
- }
-
- /**
- * Retrieve the event manager
- *
- * Lazy-loads an EventManager instance if none registered.
- *
- * @return EventCollection
- */
- public function events()
- {
- if (!$this->events instanceof EventCollection) {
- $this->setEventManager(new EventManager(array(__CLASS__, get_class($this))));
- }
- return $this->events;
- }
-
- /**
- * Get options.
- *
- * @return ManagerOptions
- */
- public function getOptions()
- {
- return $this->options;
- }
-
- /**
- * Set options
- *
- * @param ManagerOptions $options
- * @return Manager
- */
- public function setOptions(ManagerOptions $options)
- {
- $this->options = $options;
- return $this;
- }
-
- /**
- * Get loadedModules.
- *
- * @return array
- */
- public function getLoadedModules()
- {
- return $this->loadedModules;
- }
-
- /**
- * getMergedConfig
- * Build a merged config object for all loaded modules
- *
- * @return Zend\Config\Config
- */
- public function getMergedConfig($readOnly = true)
- {
- if (null === $this->mergedConfig) {
- $this->setMergedConfig(new Config(array(), true));
- }
- if (true === $readOnly) {
- $this->mergedConfig->setReadOnly();
- }
- return $this->mergedConfig;
- }
-
- /**
- * setMergedConfig
- *
- * @param Config $config
- * @return Manager
- */
- public function setMergedConfig(Config $config)
- {
- $this->mergedConfig = $config;
- return $this;
- }
-
- /**
- * mergeModuleConfig
- *
- * @param mixed $module
- * @return Manager
- */
- public function mergeModuleConfig($module)
- {
- if ((false === $this->skipConfig)
- && (is_callable(array($module, 'getConfig')))
- ) {
- $this->getMergedConfig(false)->merge($module->getConfig($this->getOptions()->getApplicationEnv()));
- }
- return $this;
- }
-
- protected function runModuleInit($module)
- {
- if (is_callable(array($module, 'init'))) {
- $module->init($this);
- }
- return $this;
- }
-
- protected function hasCachedConfig()
- {
- if (($this->getOptions()->getCacheConfig())
- && (file_exists($this->getOptions()->getCacheFilePath()))
- ) {
- return true;
- }
- return false;
- }
-
- protected function getCachedConfig()
- {
- return new Config(include $this->getOptions()->getCacheFilePath());
- }
-
- protected function updateCache()
- {
- if (($this->getOptions()->getCacheConfig())
- && (false === $this->skipConfig)
- ) {
- $this->saveConfigCache($this->getMergedConfig());
- }
- return $this;
- }
-
- protected function saveConfigCache($config)
- {
- $content = "<?php\nreturn " . var_export($config->toArray(), 1) . ';';
- file_put_contents($this->getOptions()->getCacheFilePath(), $content);
- return $this;
- }
-}
View
181 modules/ZendModule/src/Zend/Module/ManagerOptions.php
@@ -1,181 +0,0 @@
-<?php
-
-namespace Zend\Module;
-
-// use Zend\StdLib\Options;
-
-class ManagerOptions
- // extends Options
-{
- /**
- * @var bool
- */
- protected $cacheConfig = false;
-
- /**
- * @var string
- */
- protected $cacheDir = NULL;
-
- /**
- * Get cacheConfig.
- *
- * @return bool
- */
- public function getCacheConfig()
- {
- return $this->cacheConfig;
- }
-
- /**
- * Set cacheConfig.
- *
- * @param bool $cacheConfig the value to be set
- * @return ManagerConfig
- */
- public function setCacheConfig($cacheConfig)
- {
- if (!is_bool($cacheConfig)) {
- throw new \InvalidArgumentException(
- 'Parameter to \\Zend\\Module\\ManagerOption\'s '
- . 'setCacheConfig method must be boolean.'
- );
- }
- $this->cacheConfig = $cacheConfig;
- return $this;
- }
-
- /**
- * Get cacheDir.
- *
- * @return string
- */
- public function getCacheDir()
- {
- return $this->cacheDir;
- }
-
- /**
- * Set cacheDir.
- *
- * @param string $cacheDir the value to be set
- * @return ManagerConfig
- */
- public function setCacheDir($cacheDir)
- {
- if (null === $cacheDir) {
- $this->cacheDir = $cacheDir;
- } else {
- $this->cacheDir = rtrim(rtrim($cacheDir, '/'), '\\');
- }
- return $this;
- }
-
- /**
- * getCacheFilePath
- *
- * Should this be an option, or should the dir option include the
- * filename, or should it simply remain hard-coded? Thoughts?
- *
- * @return string
- */
- public function getCacheFilePath()
- {
- return $this->getCacheDir() . '/module-config-cache.'.$this->getApplicationEnv().'.php';
- }
-
- public function getApplicationEnv()
- {
- return defined('APPLICATION_ENV') ? APPLICATION_ENV : NULL;
- }
-
- /**
- * Begin Pádraic Brady's options methods.
- * (To be replaced with Zend\StdLib\Options
- */
-
- public function __construct($config = null)
- {
- if (!is_null($config)) {
- if (is_array($config) || $config instanceof \Traversable) {
- $this->processArray($config);
- } else {
- throw new \InvalidArgumentException(
- 'Parameter to \\Zend\\Stdlib\\Configuration\'s '
- . 'constructor must be an array or implement the '
- . '\\Traversable interface'
- );
- }
- }
- }
-
- protected function processArray($config)
- {
- foreach ($config as $key => $value) {
- $setter = $this->assembleSetterNameFromConfigKey($key);
- $this->{$setter}($value);
- }
- }
-
- protected function assembleSetterNameFromConfigKey($key)
- {
- $parts = explode('_', $key);
- $parts = array_map('ucfirst', $parts);
- $setter = 'set' . implode('', $parts);
- if (!method_exists($this, $setter)) {
- throw new \BadMethodCallException(
- 'The configuration key "' . $key . '" does not '
- . 'have a matching ' . $setter . ' setter method '
- . 'which must be defined'
- );
- }
- return $setter;
- }
-
- protected function assembleGetterNameFromConfigKey($key)
- {
- $parts = explode('_', $key);
- $parts = array_map('ucfirst', $parts);
- $getter = 'get' . implode('', $parts);
- if (!method_exists($this, $getter)) {
- throw new \BadMethodCallException(
- 'The configuration key "' . $key . '" does not '
- . 'have a matching ' . $getter . ' getter method '
- . 'which must be defined'
- );
- }
- return $getter;
- }
-
- public function __set($key, $value)
- {
- $setter = $this->assembleSetterNameFromConfigKey($key);
- $this->{$setter}($value);
- }
-
- public function __get($key)
- {
- $getter = $this->assembleGetterNameFromConfigKey($key);
- return $this->{$getter}();
- }
-
- public function __isset($key)
- {
- $getter = $this->assembleGetterNameFromConfigKey($key);
- return !is_null($this->{$getter}());
- }
-
- public function __unset($key)
- {
- $setter = $this->assembleSetterNameFromConfigKey($key);
- try {
- $this->{$setter}(null);
- } catch(\InvalidArgumentException $e) {
- throw new \InvalidArgumentException(
- 'The class property $' . $key . ' cannot be unset as'
- . ' NULL is an invalid value for it: ' . $e->getMessage()
- );
- }
- }
-
-}
View
149 modules/ZendModule/tests/Zend/Loader/ModuleAutoloaderTest.php
@@ -1,149 +0,0 @@
-<?php
-
-namespace ZendTest\Loader\ModuleAutoloaderTest;
-
-use PHPUnit_Framework_TestCase as TestCase,
- Zend\Loader\ModuleAutoloader,
- InvalidArgumentException;
-
-class ManagerTest extends TestCase
-{
- public function setUp()
- {
- // Store original autoloaders
- $this->loaders = spl_autoload_functions();
- if (!is_array($this->loaders)) {
- // spl_autoload_functions does not return empty array when no
- // autoloaders registered...
- $this->loaders = array();
- }
-
- // Store original include_path
- $this->includePath = get_include_path();
- }
-
- public function tearDown()
- {
- // Restore original autoloaders
- $loaders = spl_autoload_functions();
- if (is_array($loaders)) {
- foreach ($loaders as $loader) {
- spl_autoload_unregister($loader);
- }
- }
-
- foreach ($this->loaders as $loader) {
- spl_autoload_register($loader);
- }
-
- // Restore original include_path
- set_include_path($this->includePath);
- }
-
- public function testCanRegisterPathsFromConstructor()
- {
- $paths = array(__DIR__ . '/TestAsset/');
- $loader = new ModuleAutoloader($paths);
- $registeredPaths = $loader->getPaths();
- $this->assertSame($paths, $registeredPaths);
- }
-
- public function testPathsNormalizedWithTrailingSlash()
- {
- $paths = array(
- __DIR__ . DIRECTORY_SEPARATOR . 'TestAsset',
- __DIR__ . DIRECTORY_SEPARATOR . 'TestAsset///',
- __DIR__ . DIRECTORY_SEPARATOR . 'TestAsset\\\\',
- );
- $loader = new ModuleAutoloader($paths);
- $registeredPaths = $loader->getPaths();
- $this->assertSame(__DIR__ . DIRECTORY_SEPARATOR . 'TestAsset' . DIRECTORY_SEPARATOR, $registeredPaths[0]);
- $this->assertSame(__DIR__ . DIRECTORY_SEPARATOR . 'TestAsset' . DIRECTORY_SEPARATOR, $registeredPaths[1]);
- $this->assertSame(__DIR__ . DIRECTORY_SEPARATOR . 'TestAsset' . DIRECTORY_SEPARATOR, $registeredPaths[2]);
- }
-
- public function testCanAutoloadModule()
- {
- $loader = new ModuleAutoloader;
- $loader->registerPath(__DIR__ . '/TestAsset/');
- $moduleClass = $loader->autoload('FooModule\Module');
- $this->assertSame('FooModule\Module', $moduleClass);
- $module = new \FooModule\Module;
- $this->assertInstanceOf('FooModule\Module', $module);
- }
-
- public function testCanAutoloadSubModule()
- {
- $loader = new ModuleAutoloader;
- $loader->registerPath(__DIR__ . '/TestAsset/');
- $loader->register();
- $subModule = new \FooModule\SubModule\Module;
- $this->assertInstanceOf('FooModule\SubModule\Module', $subModule);
- $loader->unregister();
- }
-
- public function testCanAutoloadPharModules()
- {
- $loader = new ModuleAutoloader;
- $loader->registerPath(__DIR__ . '/TestAsset/');
- $loader->register();
- $this->assertTrue(class_exists('PharModule\Module'));
- $this->assertTrue(class_exists('PharModuleGz\Module'));
- $this->assertTrue(class_exists('PharModuleBz2\Module'));
- $this->assertTrue(class_exists('PharModulePharTar\Module'));
- $this->assertTrue(class_exists('PharModulePharTarGz\Module'));
- $this->assertTrue(class_exists('PharModulePharTarBz2\Module'));
- $this->assertTrue(class_exists('PharModulePharZip\Module'));
- $this->assertTrue(class_exists('PharModuleTar\Module'));
- $this->assertTrue(class_exists('PharModuleTarGz\Module'));
- $this->assertTrue(class_exists('PharModuleTarBz2\Module'));
- $this->assertTrue(class_exists('PharModuleZip\Module'));
- $loader->unregister();
- }
-
- public function testProvidesFluidInterface()
- {
- $loader = new ModuleAutoloader;
- $this->assertInstanceOf('Zend\Loader\ModuleAutoloader', $loader->setOptions(array('foo')));
- $this->assertInstanceOf('Zend\Loader\ModuleAutoloader', $loader->registerPaths(array('foo')));
- $this->assertInstanceOf('Zend\Loader\ModuleAutoloader', $loader->registerPath('foo'));
- }
-
- public function testReturnsFalseForNonModuleClass()
- {
- $loader = new ModuleAutoloader;
- $loader->registerPath(__DIR__ . '/TestAsset/');
- $moduleClass = $loader->autoload('FooModule\NotModule');
- $this->assertFalse($moduleClass);
- }
-
- public function testReturnsFalseForNonExistantModuleClass()
- {
- $loader = new ModuleAutoloader;
- $loader->registerPath(__DIR__ . '/TestAsset/');
- $moduleClass = $loader->autoload('NonExistantModule\Module');
- $this->assertFalse($moduleClass);
- }
-
- public function testReturnsFalseForNonModulePhar()
- {
- $loader = new ModuleAutoloader;
- $loader->registerPath(__DIR__ . '/TestAsset/');
- $moduleClass = $loader->autoload('PharModuleFake\Module');
- $this->assertFalse($moduleClass);
- }
-
- public function testInvalidPathThrowsException()
- {
- $loader = new ModuleAutoloader;
- $this->setExpectedException('InvalidArgumentException');
- $loader->registerPath(123);
- }
-
- public function testInvalidPathsThrowsException()
- {
- $loader = new ModuleAutoloader;
- $this->setExpectedException('InvalidArgumentException');
- $loader->registerPaths(123);
- }
-}
View
6 modules/ZendModule/tests/Zend/Loader/TestAsset/FooModule/Module.php
@@ -1,6 +0,0 @@
-<?php
-namespace FooModule;
-
-class Module
-{
-}
View
7 modules/ZendModule/tests/Zend/Loader/TestAsset/FooModule/SubModule/Module.php
@@ -1,7 +0,0 @@
-<?php
-
-namespace FooModule\SubModule;
-
-class Module
-{
-}
View
BIN  modules/ZendModule/tests/Zend/Loader/TestAsset/PharModule.phar
Binary file not shown
View
BIN  modules/ZendModule/tests/Zend/Loader/TestAsset/PharModuleBz2.phar.bz2
Binary file not shown
View
2  modules/ZendModule/tests/Zend/Loader/TestAsset/PharModuleFake.tar/readme
@@ -1,2 +0,0 @@
-This directory is just here to confirm that the autoloader prefers Phar files
-over directories that match the glob.
View
BIN  modules/ZendModule/tests/Zend/Loader/TestAsset/PharModuleFake.zip
Binary file not shown
View
BIN  modules/ZendModule/tests/Zend/Loader/TestAsset/PharModuleGz.phar.gz
Binary file not shown
View
BIN  modules/ZendModule/tests/Zend/Loader/TestAsset/PharModulePharTar.phar.tar
Binary file not shown
View
BIN  modules/ZendModule/tests/Zend/Loader/TestAsset/PharModulePharTarBz2.phar.tar.bz2
Binary file not shown
View
BIN  modules/ZendModule/tests/Zend/Loader/TestAsset/PharModulePharTarGz.phar.tar.gz
Binary file not shown
View
BIN  modules/ZendModule/tests/Zend/Loader/TestAsset/PharModulePharZip.phar.zip
Binary file not shown
View
BIN  modules/ZendModule/tests/Zend/Loader/TestAsset/PharModuleTar.tar
Binary file not shown
View
BIN  modules/ZendModule/tests/Zend/Loader/TestAsset/PharModuleTarBz2.tar.bz2
Binary file not shown
View
BIN  modules/ZendModule/tests/Zend/Loader/TestAsset/PharModuleTarGz.tar.gz
Binary file not shown
View
BIN  modules/ZendModule/tests/Zend/Loader/TestAsset/PharModuleZip.zip
Binary file not shown
View
63 modules/ZendModule/tests/Zend/Loader/TestAsset/_buildPhars.php
@@ -1,63 +0,0 @@
-<?php
-ini_set('phar.readonly', '0');
-
-// Executable
-// .phar
-buildModulePhar('PharModule');
-// .phar.gz
-buildModulePhar('PharModuleGz', Phar::PHAR, Phar::GZ);
-// .phar.bz2
-buildModulePhar('PharModuleBz2', Phar::PHAR, Phar::BZ2);
-// .phar.tar
-buildModulePhar('PharModulePharTar', Phar::TAR, Phar::NONE);
-// .phar.tar.gz
-buildModulePhar('PharModulePharTarGz', Phar::TAR, Phar::GZ);
-// .phar.tar.bz2
-buildModulePhar('PharModulePharTarBz2', Phar::TAR, Phar::BZ2);
-// .phar.zip
-buildModulePhar('PharModulePharZip', Phar::ZIP);
-
-// Non-executable
-// .tar
-buildModulePhar('PharModuleTar', Phar::TAR, Phar::NONE, false);
-// .tar.gz
-buildModulePhar('PharModuleTarGz', Phar::TAR, Phar::GZ, false);
-// .tar.bz2
-buildModulePhar('PharModuleTarBz2', Phar::TAR, Phar::BZ2, false);
-// .zip
-buildModulePhar('PharModuleZip', Phar::ZIP, Phar::NONE, false);
-
-// Fake Module
-buildModulePhar('PharModuleFake', Phar::ZIP, Phar::NONE, false, true);
-
-function buildModulePhar($name, $format = Phar::PHAR, $compression = Phar::NONE, $executable = true, $fake = false)
-{
- echo "Building {$name}...\t";
- $glob = glob($name.'.*');
- if (count($glob) > 0) {
- foreach ($glob as $file) {
- if (!is_dir($file)) {
- unlink($file);
- }
- }
- }
- $filename = $name . '.phar';
- $phar = new Phar($filename);
- if ($fake) {
- $phar['Module.php'] = '<?php //no class here';
- } else {
- $phar['Module.php'] = "<?php \n\nnamespace $name;\n\nclass Module\n{}";
- }
- if (false === $executable) {
- $phar->convertToData($format, $compression);
- } else {
- $phar->setDefaultStub('Module.php', 'Module.php');
- if ($format !== Phar::PHAR || $compression !== Phar::NONE) {
- $phar->convertToExecutable($format, $compression);
- }
- }
- if ($format !== Phar::PHAR || $compression !== Phar::NONE) {
- unlink($filename);
- }
- echo "Done!\n";
-}
View
62 modules/ZendModule/tests/Zend/Module/ManagerOptionsTest.php
@@ -1,62 +0,0 @@
-<?php
-
-namespace ZendTest\Module;
-
-use PHPUnit_Framework_TestCase as TestCase,
- Zend\Module\ManagerOptions,
- InvalidArgumentException,
- BadMethodCallException;
-
-class ManagerOptionsTest extends TestCase
-{
- public function testCanConfigureWithArrayInConstructor()
- {
- $options = new ManagerOptions(array(
- 'cache_dir' => __DIR__,
- 'cache_config' => true,
- ));
- $this->assertSame($options->getCacheDir(), __DIR__);
- $this->assertTrue($options->getCacheConfig());
- $this->assertNotNull(strstr($options->getCacheFilePath(), __DIR__));
- $this->assertNotNull(strstr($options->getCacheFilePath(), '.php'));
- }
-
- public function testCanAccessKeysAsProperties()
- {
- $options = new ManagerOptions(array(
- 'cache_dir' => __DIR__,
- 'cache_config' => true,
- ));
- $this->assertSame($options->cache_dir, __DIR__);
- $this->assertTrue($options->cache_config);
- $options->cache_dir = 'foo';
- $this->assertSame($options->cache_dir, 'foo');
- $options->cache_config = false;
- $this->assertFalse($options->cache_config);
- $this->assertTrue(isset($options->cache_dir));
- unset($options->cache_dir);
- $this->assertFalse(isset($options->cache_dir));
- $this->setExpectedException('InvalidArgumentException');
- unset($options->cache_config);
- }
-
- public function testContructorThrowsInvalidArgumentException()
- {
- $this->setExpectedException('InvalidArgumentException');
- $options = new ManagerOptions('foo');
- }
-
- public function testThrowsBadMethodCallExceptionForBadSetterKey()
- {
- $this->setExpectedException('BadMethodCallException');
- $options = new ManagerOptions;
- $options->bad = true;
- }
-
- public function testThrowsBadMethodCallExceptionForBadGetterKey()
- {
- $this->setExpectedException('BadMethodCallException');
- $options = new ManagerOptions;
- $bad = $options->bad;
- }
-}
View
114 modules/ZendModule/tests/Zend/Module/ManagerTest.php
@@ -1,114 +0,0 @@
-<?php
-
-namespace ZendTest\Module;
-
-use PHPUnit_Framework_TestCase as TestCase,
- Zend\Loader\ModuleAutoloader,
- Zend\Module\Manager,
- Zend\Module\ManagerOptions,
- InvalidArgumentException;
-
-class ManagerTest extends TestCase
-{
-
- public function setUp()
- {
- $this->tmpdir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'zend_module_cache_dir';
- @mkdir($this->tmpdir);
- $this->configCache = $this->tmpdir . DIRECTORY_SEPARATOR . 'config.cache.php';
- // Store original autoloaders
- $this->loaders = spl_autoload_functions();
- if (!is_array($this->loaders)) {
- // spl_autoload_functions does not return empty array when no
- // autoloaders registered...
- $this->loaders = array();
- }
-
- // Store original include_path
- $this->includePath = get_include_path();
-
- $autoloader = new ModuleAutoloader(array(
- __DIR__ . '/TestAsset',
- ));
- $autoloader->register();
- }
-
- public function tearDown()
- {
- $file = glob($this->tmpdir . DIRECTORY_SEPARATOR . '*');
- @unlink($file[0]); // change this if there's ever > 1 file
- @rmdir($this->tmpdir);
- // Restore original autoloaders
- $loaders = spl_autoload_functions();
- if (is_array($loaders)) {
- foreach ($loaders as $loader) {
- spl_autoload_unregister($loader);
- }
- }
-
- foreach ($this->loaders as $loader) {
- spl_autoload_register($loader);
- }
-
- // Restore original include_path
- set_include_path($this->includePath);
- }
-
- public function testDefaultManagerOptions()
- {
- $moduleManager = new Manager(array());
- $this->assertInstanceOf('Zend\Module\ManagerOptions', $moduleManager->getOptions());
- }
-
- public function testCanSetManagerOptionsInConstructor()
- {
- $options = new ManagerOptions(array('cache_dir' => __DIR__));
- $moduleManager = new Manager(array(), $options);
- $this->assertSame(__DIR__, $moduleManager->getOptions()->cache_dir);
- }
-
- public function testCanLoadSomeModule()
- {
- $moduleManager = new Manager(array('SomeModule'));
- $loadedModules = $moduleManager->getLoadedModules();
- $this->assertInstanceOf('SomeModule\Module', $loadedModules['SomeModule']);
- $config = $moduleManager->getMergedConfig();
- $this->assertSame($config->some, 'thing');
- }
-
- public function testCanLoadMultipleModules()
- {
- $moduleManager = new Manager(array('BarModule', 'BazModule'));
- $loadedModules = $moduleManager->getLoadedModules();
- $this->assertInstanceOf('BarModule\Module', $loadedModules['BarModule']);
- $this->assertInstanceOf('BazModule\Module', $loadedModules['BazModule']);
- $config = $moduleManager->getMergedConfig();
- $this->assertSame('foo', $config->bar);
- $this->assertSame('bar', $config->baz);
- }
-
- public function testCanCacheMerchedConfig()
- {
- $options = new ManagerOptions(array(
- 'cache_config' => true,
- 'cache_dir' => $this->tmpdir,
- ));
- // build the cache
- $moduleManager = new Manager(array('BarModule', 'BazModule'), $options);
- $config = $moduleManager->getMergedConfig();
- $this->assertSame('foo', $config->bar);
- $this->assertSame('bar', $config->baz);
-
- // use the cache
- $moduleManager = new Manager(array('BarModule', 'BazModule'), $options);
- $config = $moduleManager->getMergedConfig();
- $this->assertSame('foo', $config->bar);
- $this->assertSame('bar', $config->baz);
- }
-
- public function testConstructorThrowsInvalidArgumentException()
- {
- $this->setExpectedException('InvalidArgumentException');
- $moduleManager = new Manager('stringShouldBeArray');
- }
-}
View
23 modules/ZendModule/tests/Zend/Module/TestAsset/BarModule/Module.php
@@ -1,23 +0,0 @@
-<?php
-
-namespace BarModule;
-
-use Zend\Config\Config;
-
-class Module
-{
- public function init()
- {
- $this->initAutoloader();
- }
-
- protected function initAutoloader()
- {
- include __DIR__ . '/autoload_register.php';
- }
-
- public function getConfig()
- {
- return new Config(include __DIR__ . '/configs/config.php');
- }
-}
View
4 modules/ZendModule/tests/Zend/Module/TestAsset/BarModule/autoload_classmap.php
@@ -1,4 +0,0 @@
-<?php
-return array (
- 'BarModule\\Module' => __DIR__ . DIRECTORY_SEPARATOR . 'Module.php',
-);
View
12 modules/ZendModule/tests/Zend/Module/TestAsset/BarModule/autoload_function.php
@@ -1,12 +0,0 @@
-<?php
-return function ($class) {
- static $map;
- if (!$map) {
- $map = include __DIR__ . '/autoload_classmap.php';
- }
-
- if (!isset($map[$class])) {
- return false;
- }
- return include $map[$class];
-};
View
2  modules/ZendModule/tests/Zend/Module/TestAsset/BarModule/autoload_register.php
@@ -1,2 +0,0 @@
-<?php
-spl_autoload_register(include __DIR__ . '/autoload_function.php');
View
4 modules/ZendModule/tests/Zend/Module/TestAsset/BarModule/configs/config.php
@@ -1,4 +0,0 @@
-<?php
-return array(
- 'bar' => 'foo',
-);
View
1  modules/ZendModule/tests/Zend/Module/TestAsset/BarModule/tests/loljk
@@ -1 +0,0 @@
-;)
View
23 modules/ZendModule/tests/Zend/Module/TestAsset/BazModule/Module.php
@@ -1,23 +0,0 @@
-<?php
-
-namespace BazModule;
-
-use Zend\Config\Config;
-
-class Module
-{
- public function init()
- {
- $this->initAutoloader();
- }
-
- protected function initAutoloader()
- {
- include __DIR__ . '/autoload_register.php';
- }
-
- public function getConfig()
- {
- return new Config(include __DIR__ . '/configs/config.php');
- }
-}
View
4 modules/ZendModule/tests/Zend/Module/TestAsset/BazModule/autoload_classmap.php
@@ -1,4 +0,0 @@
-<?php
-return array (
- 'BazModule\\Module' => __DIR__ . DIRECTORY_SEPARATOR . 'Module.php',
-);
View
12 modules/ZendModule/tests/Zend/Module/TestAsset/BazModule/autoload_function.php
@@ -1,12 +0,0 @@
-<?php
-return function ($class) {
- static $map;
- if (!$map) {
- $map = include __DIR__ . '/autoload_classmap.php';
- }
-
- if (!isset($map[$class])) {
- return false;
- }
- return include $map[$class];
-};
View
2  modules/ZendModule/tests/Zend/Module/TestAsset/BazModule/autoload_register.php
@@ -1,2 +0,0 @@
-<?php
-spl_autoload_register(include __DIR__ . '/autoload_function.php');
View
4 modules/ZendModule/tests/Zend/Module/TestAsset/BazModule/configs/config.php
@@ -1,4 +0,0 @@
-<?php
-return array(
- 'baz' => 'bar',
-);
View
1  modules/ZendModule/tests/Zend/Module/TestAsset/BazModule/tests/loljk
@@ -1 +0,0 @@
-;)
View
23 modules/ZendModule/tests/Zend/Module/TestAsset/SomeModule/Module.php
@@ -1,23 +0,0 @@
-<?php
-
-namespace SomeModule;
-
-use Zend\Config\Config;
-
-class Module
-{
- public function init()
- {
- $this->initAutoloader();
- }
-
- protected function initAutoloader()
- {
- include __DIR__ . '/autoload_register.php';
- }
-
- public function getConfig()
- {
- return new Config(include __DIR__ . '/configs/config.php');
- }
-}
View
4 modules/ZendModule/tests/Zend/Module/TestAsset/SomeModule/autoload_classmap.php
@@ -1,4 +0,0 @@
-<?php
-return array (
- 'BazModule\\Module' => __DIR__ . DIRECTORY_SEPARATOR . 'Module.php',
-);
View
12 modules/ZendModule/tests/Zend/Module/TestAsset/SomeModule/autoload_function.php
@@ -1,12 +0,0 @@
-<?php
-return function ($class) {
- static $map;
- if (!$map) {
- $map = include __DIR__ . '/autoload_classmap.php';
- }
-
- if (!isset($map[$class])) {
- return false;
- }
- return include $map[$class];
-};
View
2  modules/ZendModule/tests/Zend/Module/TestAsset/SomeModule/autoload_register.php
@@ -1,2 +0,0 @@
-<?php
-spl_autoload_register(include __DIR__ . '/autoload_function.php');
View
4 modules/ZendModule/tests/Zend/Module/TestAsset/SomeModule/configs/config.php
@@ -1,4 +0,0 @@
-<?php
-return array(
- 'some' => 'thing',
-);
View
30 modules/ZendModule/tests/bootstrap.php
@@ -1,30 +0,0 @@
-<?php
-/*
- * Report all errors
- */
-ini_set('display_errors', true);
-error_reporting(-1);
-
-/*
- * Add this directory and the src directory to the include_path.
- */
-set_include_path(implode(PATH_SEPARATOR, array(
- '.',
- __DIR__ . '/../src',
- __DIR__ . '/../../../library',
- get_include_path(),
-)));
-
-/**
- * Setup autoloading
- */
-spl_autoload_register(function($classname) {
- $classname = ltrim($classname, '\\');
- $filename = str_replace(array('\\', '_'), DIRECTORY_SEPARATOR, $classname)
- . '.php';
- $realpath = stream_resolve_include_path($filename);
- if (!$realpath) {
- return false;
- }
- return include_once($realpath);
-});
View
17 modules/ZendModule/tests/phpunit.xml
@@ -1,17 +0,0 @@
-<phpunit bootstrap="./bootstrap.php" colors="true">
- <testsuite name="ZF2 Module Manager Test Suite">
- <directory>./</directory>
- </testsuite>
-
- <groups>
- <exclude>
- <group>disable</group>
- </exclude>
- </groups>
-
- <filter>
- <whitelist>
- <directory suffix=".php">../src/</directory>
- </whitelist>
- </filter>
-</phpunit>
View
78 modules/ZendMvc/.vimproject
@@ -1,78 +0,0 @@
-zf2-mvc=/home/matthew/git/zf2/modules/ZendMvc CD=. filter="*.php *.xml .htaccess *.json" {
- Module.php
- autoload_classmap.php
- autoload_function.php
- autoload_register.php
- composer.json
- docs=docs filter="*.md" {
- zf2-mvc.examples.md
- }
- public=public {
- }
- src=src {
- Zf2Mvc=Zend/Mvc {
- AppContext.php
- Application.php
- Exception.php
- LocatorAware.php
- MvcEvent.php
- SendableResponse.php
- Controller=Controller {
- ActionController.php
- RestfulController.php
- }
- Exception=Exception {
- InvalidArgumentException.php
- MissingLocatorException.php
- }
- PhpEnvironment=PhpEnvironment {
- GetContainer.php
- PostContainer.php
- }
- Router=Router {
- Exception.php
- PriorityList.php
- Route.php
- RouteMatch.php
- RouteStack.php
- SimpleRouteStack.php
- Exception=Exception {
- InvalidArgumentException.php
- RuntimeException.php
- }
- Http=Http {
- Literal.php
- Part.php
- Regex.php
- TreeRouteStack.php
- }
- }
- }
- }
- tests=tests CD="." {
- bootstrap.php
- phpunit.xml
- Zf2Mvc=Zend/Mvc {
- ApplicationTest.php
- Controller=Controller {
- ActionControllerTest.php
- RestfulControllerTest.php
- TestAsset=TestAsset {
- BadController.php
- RestfulTestController.php
- SampleController.php
- }
- }
- PhpEnvironment=PhpEnvironment {
- AbstractContainerTest.php
- GetContainerTest.php
- PostContainerTest.php
- }
- TestAsset=TestAsset {
- Locator.php
- PathController.php
- LocatorAwareController.php
- }
- }
- }
-}
View
23 modules/ZendMvc/Module.php
@@ -1,23 +0,0 @@
-<?php
-
-namespace ZendMvc;
-
-use Zend\Loader\AutoLoaderFactory;
-
-/**
- * Class detailing metadata about this module
- *
- * Ideas include exposing DI definitions, event listeners, configuration, etc.
- */
-class Module
-{
- public function init()
- {
- $this->initAutoloader();
- }
-
- protected function initAutoloader()
- {
- require __DIR__ . '/autoload_register.php';
- }
-}
View
27 modules/ZendMvc/autoload_classmap.php
@@ -1,27 +0,0 @@
-<?php
-return array (
- 'Zend\\Mvc\\Application' => __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Zend' . DIRECTORY_SEPARATOR . 'Mvc' . DIRECTORY_SEPARATOR . 'Application.php',
- 'Zend\\Mvc\\LocatorAware' => __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Zend' . DIRECTORY_SEPARATOR . 'Mvc' . DIRECTORY_SEPARATOR . 'LocatorAware.php',
- 'Zend\\Mvc\\Router\\Http\\TreeRouteStack' => __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Zend' . DIRECTORY_SEPARATOR . 'Mvc' . DIRECTORY_SEPARATOR . 'Router' . DIRECTORY_SEPARATOR . 'Http' . DIRECTORY_SEPARATOR . 'TreeRouteStack.php',
- 'Zend\\Mvc\\Router\\Http\\Regex' => __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Zend' . DIRECTORY_SEPARATOR . 'Mvc' . DIRECTORY_SEPARATOR . 'Router' . DIRECTORY_SEPARATOR . 'Http' . DIRECTORY_SEPARATOR . 'Regex.php',
- 'Zend\\Router\\Http\\Part' => __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Zend' . DIRECTORY_SEPARATOR . 'Mvc' . DIRECTORY_SEPARATOR . 'Router' . DIRECTORY_SEPARATOR . 'Http' . DIRECTORY_SEPARATOR . 'Part.php',
- 'Zend\\Mvc\\Router\\Http\\Literal' => __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Zend' . DIRECTORY_SEPARATOR . 'Mvc' . DIRECTORY_SEPARATOR . 'Router' . DIRECTORY_SEPARATOR . 'Http' . DIRECTORY_SEPARATOR . 'Literal.php',
- 'Zend\\Mvc\\Router\\Exception\\InvalidArgumentException' => __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Zend' . DIRECTORY_SEPARATOR . 'Mvc' . DIRECTORY_SEPARATOR . 'Router' . DIRECTORY_SEPARATOR . 'Exception' . DIRECTORY_SEPARATOR . 'InvalidArgumentException.php',
- 'Zend\\Mvc\\Router\\Exception\\RuntimeException' => __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Zend' . DIRECTORY_SEPARATOR . 'Mvc' . DIRECTORY_SEPARATOR . 'Router' . DIRECTORY_SEPARATOR . 'Exception' . DIRECTORY_SEPARATOR . 'RuntimeException.php',
- 'Zend\\Mvc\\Router\\Exception' => __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Zend' . DIRECTORY_SEPARATOR . 'Mvc' . DIRECTORY_SEPARATOR . 'Router' . DIRECTORY_SEPARATOR . 'Exception.php',
- 'Zend\\Mvc\\Router\\PriorityList' => __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Zend' . DIRECTORY_SEPARATOR . 'Mvc' . DIRECTORY_SEPARATOR . 'Router' . DIRECTORY_SEPARATOR . 'PriorityList.php',
- 'Zend\\Mvc\\Router\\RouteMatch' => __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Zend' . DIRECTORY_SEPARATOR . 'Mvc' . DIRECTORY_SEPARATOR . 'Router' . DIRECTORY_SEPARATOR . 'RouteMatch.php',
- 'Zend\\Mvc\\Router\\SimpleRouteStack' => __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Zend' . DIRECTORY_SEPARATOR . 'Mvc' . DIRECTORY_SEPARATOR . 'Router' . DIRECTORY_SEPARATOR . 'SimpleRouteStack.php',
- 'Zend\\Mvc\\Router\\RouteStack' => __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Zend' . DIRECTORY_SEPARATOR . 'Mvc' . DIRECTORY_SEPARATOR . 'Router' . DIRECTORY_SEPARATOR . 'RouteStack.php',
- 'Zend\\Mvc\\Router\\Route' => __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Zend' . DIRECTORY_SEPARATOR . 'Mvc' . DIRECTORY_SEPARATOR . 'Router' . DIRECTORY_SEPARATOR . 'Route.php',
- 'Zend\\Mvc\\Exception\\InvalidArgumentException' => __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Zend' . DIRECTORY_SEPARATOR . 'Mvc' . DIRECTORY_SEPARATOR . 'Exception' . DIRECTORY_SEPARATOR . 'InvalidArgumentException.php',
- 'Zend\\Mvc\\Exception\\MissingLocatorException' => __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Zend' . DIRECTORY_SEPARATOR . 'Mvc' . DIRECTORY_SEPARATOR . 'Exception' . DIRECTORY_SEPARATOR . 'MissingLocatorException.php',
- 'Zend\\Mvc\\SendableResponse' => __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Zend' . DIRECTORY_SEPARATOR . 'Mvc' . DIRECTORY_SEPARATOR . 'SendableResponse.php',
- 'Zend\\Mvc\\Exception' => __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Zend' . DIRECTORY_SEPARATOR . 'Mvc' . DIRECTORY_SEPARATOR . 'Exception.php',
- 'Zend\\Mvc\\Controller\\ActionController' => __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Zend' . DIRECTORY_SEPARATOR . 'Mvc' . DIRECTORY_SEPARATOR . 'Controller' . DIRECTORY_SEPARATOR . 'ActionController.php',
- 'Zend\\Mvc\\Controller\\RestfulController' => __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Zend' . DIRECTORY_SEPARATOR . 'Mvc' . DIRECTORY_SEPARATOR . 'Controller' . DIRECTORY_SEPARATOR . 'RestfulController.php',
- 'Zend\\Mvc\\PhpEnvironment\\PostContainer' => __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Zend' . DIRECTORY_SEPARATOR . 'Mvc' . DIRECTORY_SEPARATOR . 'PhpEnvironment' . DIRECTORY_SEPARATOR . 'PostContainer.php',
- 'Zend\\Mvc\\PhpEnvironment\\GetContainer' => __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Zend' . DIRECTORY_SEPARATOR . 'Mvc' . DIRECTORY_SEPARATOR . 'PhpEnvironment' . DIRECTORY_SEPARATOR . 'GetContainer.php',
- 'Zend\\Mvc\\AppContext' => __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Zend' . DIRECTORY_SEPARATOR . 'Mvc' . DIRECTORY_SEPARATOR . 'AppContext.php',
- 'Zend\\Mvc\\MvcEvent' => __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Zend' . DIRECTORY_SEPARATOR . 'Mvc' . DIRECTORY_SEPARATOR . 'MvcEvent.php',
-);
View
12 modules/ZendMvc/autoload_function.php
@@ -1,12 +0,0 @@
-<?php
-return function ($class) {
- static $map;
- if (!$map) {
- $map = include __DIR__ . '/autoload_classmap.php';
- }
-
- if (!isset($map[$class])) {
- return false;
- }
- return include $map[$class];
-};
View
2  modules/ZendMvc/autoload_register.php
@@ -1,2 +0,0 @@
-<?php
-spl_autoload_register(include __DIR__ . '/autoload_function.php');
View
20 modules/ZendMvc/composer.json
@@ -1,20 +0,0 @@
-{
- "name": "Zf2Mvc",
- "type": "Library",
- "description": "MVC prototype for ZF2 utilizing Zend\\Di",
- "keywords": ["zf2","mvc"],
- "homepage": "http://framework.zend.com/zf2",
- "version": "0.0.1",
- "license": "New BSD",
- "authors": [
- {
- "name": "Matthew Weier O'Phinney",
- "email": "matthew@zend.com",
- "homepage": "http://framework.zend.com/"
- }
- ],
- "require": {
- "php": ">=5.3.0",
- "zf2": ">=2.0.0dev4"
- }
-}
View
236 modules/ZendMvc/docs/zf2-mvc.examples.md
@@ -1,236 +0,0 @@
-MVC Examples
-============
-
-Example 1 - Bootstrapping
--------------------------
-
-While the `Application` class will actually perform execution of the
-application, you still need to provide some configuration -- for instance,
-setting up the Dependency Injector or Service Locator instance you plan to use,
-and providing routes to the router.
-
-The best way to accomplish this is via composition. Consider the following
-`Bootstrap` class. It accepts an `Application` instance to its `bootstrap()`
-method and configures it.
-
-use Zend\Config\Config,
- Zf2Mvc\Application;
-
- class Bootstrap
- {
- protected $config;
-
- public function __construct(Config $config)
- {
- $this->config = $config;
- }
-
- public function bootstrap(Application $app)
- {
- $this->setupLocator($app);
- $this->setupRoutes($app);
- $this->setupEvents($app);
- }
-
- protected function setupLocator(Application $app)
- {
- /**
- * Instantiate and configure a DependencyInjector instance, or
- * a ServiceLocator, and return it.
- */
- }
-
- protected function setupRoutes(Application $app)
- {
- /**
- * Pull the routing table from configuration, and pass it to the
- * router composed in the Application instance.
- */
- }
-
- protected function setupEvents(Application $app)
- {
- /**
- * Wire events into the Application's EventManager, and/or setup
- * static listeners for events that may be invoked.
- */
- }
- }
-
-From here, the gateway script, `public/index.php` might look like this:
-
- // Assume autoloading is configured
-
- $env = getenv('APPLICATION_ENV');
- if (!$env) {
- $env = 'production';
- }
-
- $config = Zend\Config\Factory::factory(
- __DIR__ . '/../configs/' . $env . '.config.xml'
- );
- $app = new Zf2Mvc\Application();
- $bootstrap = new Bootstrap();
- $bootstrap->bootstrap($app);
-
- $response = $app->run();
- $response->send();
-
-Example 2 - Controllers
------------------------
-
-Controllers are simply classes that implement `Zend\Stdlib\Dispatchable`. As
-such, it's up to the developer to determine how they handle a request.
-
-To hand off the request to the controller requires two wirings:
-
-* A route that, when matched, returns a controller name
-* A DI manager that composes a definition that includes that controller name,
- or composes configuration that aliases the controller name to a valid class
- in the composed DI definition.
-
-Let's assume we have a "Hello" controller:
-
- namespace HelloWorld\Controller;
-
- use Zend\Http\Response as HttpResponse,
- Zend\Stdlib\Dispatchable,
- Zend\Stdlib\RequestDescription as Request,
- Zend\Stdlib\ResponseDescription as Response;
-
- class HelloController implements Dispatchable
- {
- public function dispatch(Request $request, Response $response = null)
- {
- if (null === $response) {
- $response = new HttpResponse();
- }
- $response->setContent('<h1>Hello, world!</h1>');
- return $response;
- }
- }
-
-Let's now create a route:
-
- use Zf2Mvc\Router\Http\LiteralRoute;
-
- // Assume this is likely in some bootstrap
- $route = new LiteralRoute(array(
- 'route' => '/hello',
- 'defaults' => array(
- 'controller' => 'controller.hello-world.hello',
- ),
- ));
- $app->getRouter()->addRoute('hello', $route);
-
-Finally, our DI configuration needs to know about the controller.
-
- use Zend\Di\Configuration;
-
- $config = new Configuration(array(
- 'di' => array(
- 'instance' => array(
- 'alias' => array(
- 'controller.hello-world.hello' => 'HelloWorld\Controller\HelloController',
- ),
- ),
- ),
- ));
- $config->configure($di); // assuming we've created it previously
-
-Once these are in place, when navigating to the url "/hello", we'll now execute
-our controller's `dispatch()` method.
-
-While this approach is portable and allows you to handle any request, we doubt
-you'll want to write `dispatch()` logic for each and every controller you write,
-much less each and every action. As such, this module also includes two base
-controllers you can extend, the `ActionController` and the `RestfulController`.
-
-h3. The ActionController
-
-`Zf2Mvc\Controller\ActionController` is very similar to `Zend_Controller_Action`
-in the Zend Framework 1.X series. It checks for a matched "action" token in the
-returned array from a router, and then maps this to a corresponding "Action"
-method. As some examples:
-
-* Action "foo" maps to method "fooAction"
-* Action "foo-bar" maps to method "fooBarAction"
-* Action "bar.baz" maps to method "barBazAction"
-* Action "baz\_.bat" maps to method "bazBatAction"
-
-As you can see, the simple rule is that "-", ".", and "\_" all become word
-separators, and the individual words are camelCased and appended with the word
-"Action".
-
-The "action" token is something your route will discover. For instance given a
-standard route of:
-
- /:controller/:action
-
-and the invoked URL:
-
- /foo/bar
-
-the assumption is that the controller name is "foo" and will map to a
-Dispatchable class, and the action name is "bar". These values are returned by
-the router as members of an instance of `Zf2Mvc\Router\RouteMatch`. That class
-allows you to pull such members using the method `getParam()`, which also
-allows you to specify a default value to return if the parameter is not found.
-
- $action = $routeMatch->getParam('action', false);
- if (!$action) {
- // No action found!
- // ...
- }
-
-Two special actions are defined by default, "index" and "not-found". The former
-is used whenever an ActionController is invoked without an "action" parameter
-in the route match. The latter is invoked if the discovered action does not map
-to an existing method in the controller.
-
-Normal development using an `ActionController` is very straight-forward: you
-identify needed functionality, and simply create an action method for that
-endpoint. As an example, let's return to the "/foo/bar" URL from earlier:
-
- namespace SomeModule\Controller;
-
- use Zf2Mvc\Controller\ActionController;
-
- class FooController extends ActionController
- {
- public function barAction()
- {
- // do some stuff
- }
- }
-
-It is up to you as a developer what you will return from an action method. We
-suggest returning either an associative array, or a value object of some kind.
-This can then easily be passed to some sort of renderer during the execution
-chain in order to generate a response payload.
-
-Alternately, you could return a response object from your method. This allows
-you to essentially return as early as possible from execution.
-
-h3. RestfulController
-
-`Zf2Mvc\Controller\RestfulController` is a somewhat naive interpretation of the
-REST paradigm. It operates primarily as a CRUD (Create-Read-Update-Delete)-style
-controller, but uses HTTP verbs in order to determine what to do.
-
-* GET can return either a list of resources, or a single resource.
- * With no identifier provided, a list of resources is returned.
- * With an identifier provided -- perhaps by the query string, potentially
- via routing -- a single resource is returned.
-* POST creates a new resource. Ideally, you will return it, as well as a
- Location header indicating the new URI to the resource, and a 201 HTTP
- response code.
-* PUT requires an identifier, and uses the data provided to update the
- specified resource, assuming it exists.
-* DELETE requires an identifier, and should delete the given resource;
- typically, a 204 response code should be returned.
-
-Additionally, you can define "action" methods like you would with a standard
-`ActionController`. If an "action" token is found in the route match, it will
-look for a matching action method and execute it, or a "not-found" action if
-no match exists.
View
97 modules/ZendMvc/src/Zend/Mvc/AppContext.php
@@ -1,97 +0,0 @@
-<?php
-
-namespace Zend\Mvc;
-
-use Zend\Di\Locator,
- Zend\EventManager\EventCollection,
- Zend\Stdlib\RequestDescription as Request,
- Zend\Stdlib\ResponseDescription as Response;
-
-interface AppContext
-{
- /**
- * Set the event manager instance used by this context
- *
- * @param EventCollection $events
- * @return AppContext
- */
- public function setEventManager(EventCollection $events);
-
- /**
- * Set a service locator/DI object
- *
- * @param Locator $locator
- * @return AppContext
- */
- public function setLocator(Locator $locator);
-
- /**
- * Set request object that will be consumed
- *
- * @param Request $request
- * @return AppContext
- */
- public function setRequest(Request $request);
-
- /**
- * Set response object that will be returned
- *
- * @param Response $request
- * @return AppContext
- */
- public function setResponse(Response $response);
-
- /**
- * Set the router used to decompose the request
- *
- * A router should return a metadata object containing a controller key.
- *
- * @param Router\RouteStack $router
- * @return AppContext
- */
- public function setRouter(Router\RouteStack $router);
-
- /**
- * Get the locator object
- *
- * @return Locator
- */
- public function getLocator();
-
- /**
- * Get the request object
- *
- * @return Request
- */
- public function getRequest();
-
- /**
- * Get the response object
- *
- * @return Response
- */
- public function getResponse();
-
- /**
- * Get the router object
- *
- * @return Router
- */
- public function getRouter();
-
- /**
- * Retrieve the event manager
- *
- * Lazy-loads an EventManager instance if none registered.
- *
- * @return EventCollection
- */
- public function events();
-
- /**
- * Run the application
- *
- * @return \Zend\Http\Response
- */
- public function run();
-}
View
351 modules/ZendMvc/src/Zend/Mvc/Application.php
@@ -1,351 +0,0 @@
-<?php
-
-namespace Zend\Mvc;
-
-use ArrayObject,
- Zend\Di\Exception\ClassNotFoundException,
- Zend\Di\Locator,
- Zend\EventManager\EventCollection,
- Zend\EventManager\EventManager,
- Zend\Http\Header\Cookie,
- Zend\Http\Request as HttpRequest,
- Zend\Http\Response as HttpResponse,
- Zend\Stdlib\Dispatchable,
- Zend\Stdlib\IsAssocArray,
- Zend\Stdlib\Parameters,
- Zend\Stdlib\RequestDescription as Request,
- Zend\Stdlib\ResponseDescription as Response;
-
-/**
- * Main application class for invoking applications
- *
- * Expects the user will provide a Service Locator or Dependency Injector, as
- * well as a configured router. Once done, calling run() will invoke the
- * application, first routing, then dispatching the discovered controller. A
- * response will then be returned, which may then be sent to the caller.
- */
-class Application implements AppContext
-{
- const ERROR_CONTROLLER_NOT_FOUND = 404;
- const ERROR_CONTROLLER_INVALID = 404;
- const ERROR_EXCEPTION = 500;
-
- protected $events;
- protected $locator;
- protected $request;
- protected $response;
- protected