Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' into rfc/escaper
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 106 changed files with 4,625 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/Exception/ExceptionInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace Zend\ModuleManager\Exception;

/**
* @category Zend
* @package Zend_ModuleManager
*/
interface ExceptionInterface
{}
22 changes: 22 additions & 0 deletions src/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace Zend\ModuleManager\Exception;

/**
* Invalid Argument Exception
*
* @category Zend
* @package Zend_ModuleManager
* @subpackage Exception
*/
class InvalidArgumentException extends \InvalidArgumentException implements
ExceptionInterface
{}
21 changes: 21 additions & 0 deletions src/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace Zend\ModuleManager\Exception;

/**
* Runtime Exception
*
* @category Zend
* @package Zend_ModuleManager
* @subpackage Exception
*/
class RuntimeException extends \RuntimeException implements ExceptionInterface
{}
28 changes: 28 additions & 0 deletions src/Feature/AutoloaderProviderInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace Zend\ModuleManager\Feature;

/**
* Autoloader provider interface
*
* @category Zend
* @package Zend_ModuleManager
* @subpackage Feature
*/
interface AutoloaderProviderInterface
{
/**
* Return an array for passing to Zend\Loader\AutoloaderFactory.
*
* @return array
*/
public function getAutoloaderConfig();
}
30 changes: 30 additions & 0 deletions src/Feature/BootstrapListenerInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace Zend\ModuleManager\Feature;

use Zend\EventManager\Event;

/**
* Boostrap listener provider interface
*
* @category Zend
* @package Zend_ModuleManager
* @subpackage Feature
*/
interface BootstrapListenerInterface
{
/**
* Listen to the bootstrap event
*
* @return array
*/
public function onBootstrap(Event $e);
}
39 changes: 39 additions & 0 deletions src/Feature/ConfigProviderInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_ModuleManager
* @subpackage Feature
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

namespace Zend\ModuleManager\Feature;

/**
* @category Zend
* @package Zend_ModuleManager
* @subpackage Feature
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface ConfigProviderInterface
{
/**
* Returns configuration to merge with application configuration
*
* @return array|\Traversable
*/
public function getConfig();
}
42 changes: 42 additions & 0 deletions src/Feature/InitProviderInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_ModuleManager
* @subpackage Feature
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

namespace Zend\ModuleManager\Feature;

use Zend\ModuleManager\ModuleManagerInterface;

/**
* @category Zend
* @package Zend_ModuleManager
* @subpackage Feature
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface InitProviderInterface
{
/**
* Initialize workflow
*
* @param \Zend\ModuleManager\ModuleManagerInterface $manager
* @return void
*/
public function init(ModuleManagerInterface $manager);
}
28 changes: 28 additions & 0 deletions src/Feature/LocatorRegisteredInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace Zend\ModuleManager\Feature;

/**
* LocatorRegistered
*
* By implementing this interface in a Module class, the instance of the Module
* class will be automatically injected into any DI-configured object which has
* a constructor or setter parameter which is type hinted with the Module class
* name. Implementing this interface obviously does not require adding any
* methods to your class.
*
* @category Zend
* @package Zend_ModuleManager
* @subpackage Feature
*/
interface LocatorRegisteredInterface
{
}
40 changes: 40 additions & 0 deletions src/Feature/ServiceProviderInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_ModuleManager
* @subpackage Feature
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

namespace Zend\ModuleManager\Feature;

/**
* @category Zend
* @package Zend_ModuleManager
* @subpackage Feature
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface ServiceProviderInterface
{
/**
* Expected to return \Zend\ServiceManager\Configuration object or array to
* seed such an object.
*
* @return array|\Zend\ServiceManager\Configuration
*/
public function getServiceConfiguration();
}
77 changes: 77 additions & 0 deletions src/Listener/AbstractListener.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace Zend\ModuleManager\Listener;

/**
* Abstract listener
*
* @category Zend
* @package Zend_ModuleManager
* @subpackage Listener
*/
abstract class AbstractListener
{
/**
* @var ListenerOptions
*/
protected $options;

/**
* __construct
*
* @param ListenerOptions $options
* @return void
*/
public function __construct(ListenerOptions $options = null)
{
if (null === $options) {
$this->setOptions(new ListenerOptions);
} else {
$this->setOptions($options);
}
}

/**
* Get options.
*
* @return ListenerOptions
*/
public function getOptions()
{
return $this->options;
}

/**
* Set options.
*
* @param ListenerOptions $options the value to be set
* @return AbstractListener
*/
public function setOptions(ListenerOptions $options)
{
$this->options = $options;
return $this;
}

/**
* Write a simple array of scalars to a file
*
* @param string $filePath
* @param array $array
* @return AbstractListener
*/
protected function writeArrayToFile($filePath, $array)
{
$content = "<?php\nreturn " . var_export($array, 1) . ';';
file_put_contents($filePath, $content);
return $this;
}
}
42 changes: 42 additions & 0 deletions src/Listener/AutoloaderListener.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace Zend\ModuleManager\Listener;

use Zend\Loader\AutoloaderFactory;
use Zend\ModuleManager\Feature\AutoloaderProviderInterface;
use Zend\ModuleManager\ModuleEvent;

/**
* Autoloader listener
*
* @category Zend
* @package Zend_ModuleManager
* @subpackage Listener
*/
class AutoloaderListener extends AbstractListener
{

/**
* @param ModuleEvent $e
* @return void
*/
public function __invoke(ModuleEvent $e)
{
$module = $e->getModule();
if (!$module instanceof AutoloaderProviderInterface
&& !method_exists($module, 'getAutoloaderConfig')
) {
return;
}
$autoloaderConfig = $module->getAutoloaderConfig();
AutoloaderFactory::factory($autoloaderConfig);
}
}
Loading

0 comments on commit 9e453d7

Please sign in to comment.