This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Custom\View\Strategy; | |
use Zend\EventManager\EventCollection, | |
Zend\EventManager\ListenerAggregate, | |
Zend\Http\Request as HttpRequest, | |
Zend\Http\Response as HttpResponse, | |
Zend\View\Model, | |
Zend\View\Renderer\JsonRenderer, | |
Zend\View\ViewEvent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* A listener attached as such: | |
* $app->events()->attach('route', $listener, -100); | |
*/ | |
public function onRouteComplete($e) | |
{ | |
$routeMatch = $e->getRouteMatch(); | |
if (!$routeMatch) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
return array( | |
'modules' => array( | |
'Application', | |
/* ... */ | |
), | |
'module_listeners' => array( | |
'use_defaults' => true, /* false to disable them */ | |
/* list additional module listeners to use here */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Use case 1: | |
// Providing additional constructor arguments | |
$im->composeService('foo', $myservice); | |
class MyService extends ComposedServiceFactory | |
{ | |
public function __invoke($im, $name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace ZendTest\Validator\TestAsset; | |
use Zend\I18n\Translator; | |
class ArrayTranslator implements Translator\Loader\LoaderInterface | |
{ | |
public $translations; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo "Analyzing {$argv[1]}\n"; | |
$file = file_get_contents($argv[1]); | |
$matches = null; | |
preg_match('/\n(use .*?)(?:\r?\n(?:\/\*|interface|abstract|class|trait))/s', $file, $matches); | |
if (!$matches || !$matches[1]) { | |
echo " Did not match initial pattern\n"; | |
exit(0); | |
} | |
// echo " Matches: " . var_export($matches, 1) . "\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// our test cases | |
interface A {} | |
class B implements A {} | |
class C extends B {} | |
class D {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"minimum-stability": "dev", | |
"repositories": [ | |
{ | |
"type": "composer", | |
"url": "http://packages.zendframework.com/" | |
} | |
], | |
"require": { | |
"zendframework/zend-permissions-acl": "*", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$factory = function ($controllers) { | |
$services = $controllers->getServiceLocator(); | |
$config = $services->get('Config'); | |
$moduleConfig = $config['my_module_key']; | |
$controller = new Controller\SomeController(); | |
$controller->setSomeConfigInfo($moduleConfig['some_config_info']); | |
return $controller; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Zend\Mvc\Router\RouteMatch; | |
// Listener on dispatch.error event | |
$listener = function ($e) { | |
$app = $e->getTarget(); | |
$events = $app->getEventManager(); | |
$event = clone $e; | |
$matches = new RouteMatch(array('controller' => 'Some\Controller\Alias')); | |
$event->setRouteMatch($matches); |