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

ZF3 #213

Merged
merged 28 commits into from
Jun 27, 2016
Merged

ZF3 #213

Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
2089b51
Update ZDT for use with modern ZF components
Apr 27, 2016
07fc76c
use PSR4 autoloader
Apr 27, 2016
69cc60c
Merge branch 'master' of github.com:alex-oleshkevich/ZendDeveloperTools
Apr 27, 2016
dd79364
Merge branch 'master' of github.com:alex-oleshkevich/ZendDeveloperTools
Apr 27, 2016
a41ee4c
Merge branch 'master' of github.com:alex-oleshkevich/ZendDeveloperTools
Apr 27, 2016
183d6e8
Remove phpunit.xml
Apr 27, 2016
f2dc619
remove 5.3 and 5.4 versions of php from travis
Apr 27, 2016
bf4d652
Update composer.json
alex-oleshkevich May 4, 2016
e063b7d
remove Module::getAutoloaderConfig() as https://github.com/zendframew…
samsonasik Jun 24, 2016
9aaca7d
update zend-mvc dependency
samsonasik Jun 24, 2016
3125403
short array syntax
samsonasik Jun 25, 2016
cb1b467
another short array syntax
samsonasik Jun 25, 2016
6f272e5
remove php 7 from allow_failures
samsonasik Jun 25, 2016
616ba68
uses "test" instead of "tests" folder for consistency
samsonasik Jun 25, 2016
50cf2f2
psr-4 autoloader
samsonasik Jun 25, 2016
c47b1db
use phpunit: ~4 || ~5
samsonasik Jun 25, 2016
a2554cf
update include module.config.php path
samsonasik Jun 25, 2016
75f6fb7
use ZendDeveloperToolsTest for test
samsonasik Jun 25, 2016
498cb0d
one empty line at the end of .travis.yml
samsonasik Jun 25, 2016
891d3e8
remove whitespace in ToolbarListener
samsonasik Jun 25, 2016
6981ee0
another white character
samsonasik Jun 25, 2016
8d0c9be
remove duplicated autoload-dev
samsonasik Jun 25, 2016
219eb58
added php-cs check and checks for lowest, locked, latest in .travis.yml
samsonasik Jun 25, 2016
ca71be4
cs fix
samsonasik Jun 25, 2016
0419000
whitespace fix
samsonasik Jun 25, 2016
f554d92
commit composer.lock
samsonasik Jun 25, 2016
3232f51
remove DEPS=locked from php 5.5
samsonasik Jun 25, 2016
fdaaf23
re-update composer.lock
samsonasik Jun 25, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
language: php

php:
- 5.3.3
- 5.4
- 5.5
- 5.6
- 7
Expand Down
18 changes: 9 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
}
],
"require": {
"php": ">=5.3.3",
"zendframework/zend-mvc": "2.*",
"zendframework/zend-eventmanager": "2.*",
"zendframework/zend-stdlib": "2.*",
"zendframework/zend-servicemanager": "2.*",
"zendframework/zend-modulemanager": "2.*",
"zendframework/zend-version": "2.*",
"zendframework/zend-debug": "2.*",
"zendframework/zend-view": "2.*"
"php": "^5.5 || ^7.0",
"zendframework/zend-mvc": "^2.7 || ^3.0.1",
"zendframework/zend-eventmanager": "^2.6.2 || ^3.0",
"zendframework/zend-stdlib": "^2.7 || ^3.0",
"zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3",
"zendframework/zend-modulemanager": "^2.7",
"zendframework/zend-version": "^2.5",
"zendframework/zend-debug": "^2.5 || ^3.0",
"zendframework/zend-view": "^2.6"
},
"require-dev": {
"phpunit/phpunit": "~4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@

use Zend\EventManager\Event;
use Zend\EventManager\SharedEventManagerInterface;
use Zend\EventManager\SharedListenerAggregateInterface;
use Zend\ServiceManager\Exception\ServiceNotFoundException;
use ZendDeveloperTools\Collector\CollectorInterface;
use ZendDeveloperTools\Collector\EventCollectorInterface;
use ZendDeveloperTools\Profiler;

/**
Expand All @@ -22,10 +21,10 @@
* @author Mark Garrett <[email protected]>
* @since 0.0.3
*/
class EventLoggingListenerAggregate implements SharedListenerAggregateInterface
class EventLoggingListenerAggregate
{
/**
* @var \ZendDeveloperTools\Collector\EventCollectorInterface[]
* @var EventCollectorInterface[]
*/
protected $collectors;

Expand All @@ -37,7 +36,7 @@ class EventLoggingListenerAggregate implements SharedListenerAggregateInterface
/**
* Constructor.
*
* @param \ZendDeveloperTools\Collector\EventCollectorInterface[] $collectors
* @param EventCollectorInterface[] $collectors
* @param string[] $identifiers
*/
public function __construct(array $collectors, array $identifiers)
Expand All @@ -61,7 +60,9 @@ function ($identifier) {
*/
public function attachShared(SharedEventManagerInterface $events)
{
$events->attach($this->identifiers, '*', array($this,'onCollectEvent'), Profiler::PRIORITY_EVENT_COLLECTOR);
foreach ($this->identifiers as $id) {
$events->attach($id, '*', array($this,'onCollectEvent'), Profiler::PRIORITY_EVENT_COLLECTOR);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

short array syntax plz

}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/ZendDeveloperTools/Listener/FirePhpListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function __construct(ServiceLocatorInterface $serviceLocator)
/**
* {@inheritdoc}
*/
public function attach(EventManagerInterface $events)
public function attach(EventManagerInterface $events, $priority = 1)
{
$this->listeners[] = $events->attach(
ProfilerEvent::EVENT_COLLECTED,
Expand Down
2 changes: 1 addition & 1 deletion src/ZendDeveloperTools/Listener/FlushListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class FlushListener implements ListenerAggregateInterface
/**
* {@inheritdoc}
*/
public function attach(EventManagerInterface $events)
public function attach(EventManagerInterface $events, $priority = 1)
{
$this->listeners[] = $events->attach(
MvcEvent::EVENT_FINISH,
Expand Down
2 changes: 1 addition & 1 deletion src/ZendDeveloperTools/Listener/ProfilerListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function __construct(ServiceLocatorInterface $serviceLocator, Options $op
/**
* {@inheritdoc}
*/
public function attach(EventManagerInterface $events)
public function attach(EventManagerInterface $events, $priority = 1)
{
$this->listeners[] = $events->attach(
MvcEvent::EVENT_FINISH,
Expand Down
2 changes: 1 addition & 1 deletion src/ZendDeveloperTools/Listener/StorageListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function __construct(ServiceLocatorInterface $serviceLocator)
/**
* {@inheritdoc}
*/
public function attach(EventManagerInterface $events)
public function attach(EventManagerInterface $events, $priority = 1)
{
$this->listeners[] = $events->attach(
ProfilerEvent::EVENT_COLLECTED,
Expand Down
10 changes: 3 additions & 7 deletions src/ZendDeveloperTools/Listener/ToolbarListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,11 @@ public function __construct($viewRenderer, Options $options)
/**
* {@inheritdoc}
*/
public function attach(EventManagerInterface $events)
public function attach(EventManagerInterface $events, $priority = 1)
{
$this->listeners[] = $events->attach(
ProfilerEvent::EVENT_COLLECTED,
array($this, 'onCollected'),
Profiler::PRIORITY_TOOLBAR
);
$this->listeners[] = $events->getSharedManager()->attach('profiler', ProfilerEvent::EVENT_COLLECTED, array($this, 'onCollected'), Profiler::PRIORITY_TOOLBAR);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use please short array syntax?

}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove white characters above

/**
* {@inheritdoc}
*/
Expand Down
12 changes: 8 additions & 4 deletions src/ZendDeveloperTools/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,25 @@ public function onBootstrap(EventInterface $event)
$report = $sm->get('ZendDeveloperTools\Report');

if ($options->canFlushEarly()) {
$em->attachAggregate($sm->get('ZendDeveloperTools\FlushListener'));
$flushListener = $sm->get('ZendDeveloperTools\FlushListener');
$flushListener->attach($em);
}

if ($options->isStrict() && $report->hasErrors()) {
throw new Exception\InvalidOptionException(implode(' ', $report->getErrors()));
}

if ($options->eventCollectionEnabled()) {
$sem->attachAggregate($sm->get('ZendDeveloperTools\EventLoggingListenerAggregate'));
$eventLoggingListener = $sm->get('ZendDeveloperTools\EventLoggingListenerAggregate');
$eventLoggingListener->attachShared($sem);
}

$em->attachAggregate($sm->get('ZendDeveloperTools\ProfilerListener'));
$profilerListener = $sm->get('ZendDeveloperTools\ProfilerListener');
$profilerListener->attach($em);

if ($options->isToolbarEnabled()) {
$sem->attach('profiler', $sm->get('ZendDeveloperTools\ToolbarListener'), null);
$toolbarListener = $sm->get('ZendDeveloperTools\ToolbarListener');
$toolbarListener->attach($em);
}

if ($options->isStrict() && $report->hasErrors()) {
Expand Down
4 changes: 3 additions & 1 deletion src/ZendDeveloperTools/Profiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,9 @@ public function collect(MvcEvent $mvcEvent)
$this->report->addCollector($collector);
}

$this->eventManager->trigger(ProfilerEvent::EVENT_COLLECTED, $this->getEvent());
$event = $this->getEvent();
$event->setName(ProfilerEvent::EVENT_COLLECTED);
$this->eventManager->triggerEvent($event);

return $this;
}
Expand Down