Skip to content

Commit

Permalink
Merge 214e152 into d66ae5c
Browse files Browse the repository at this point in the history
  • Loading branch information
hummer2k committed Oct 17, 2015
2 parents d66ae5c + 214e152 commit c803414
Show file tree
Hide file tree
Showing 39 changed files with 235 additions and 141 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
language: php

php:
- 5.4
- 5.5
- 5.6
- 7.0
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
}
],
"require": {
"php": ">=5.4.0",
"php": ">=5.5.0",
"zendframework/zend-mvc": "2.*",
"zendframework/zend-servicemanager": "2.*",
"zendframework/zend-eventmanager": "2.*",
Expand Down
22 changes: 15 additions & 7 deletions config/con-layout.global.php.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<?php
use \ConLayout\Updater\LayoutUpdaterInterface;

use ConLayout\Updater\LayoutUpdaterInterface;
use ConLayout\View\Helper\Proxy\HeadLinkProxy;
use ConLayout\View\Helper\Proxy\HeadMetaProxy;
use ConLayout\View\Helper\Proxy\HeadScriptProxy;
use ConLayout\View\Helper\Proxy\HeadTitleProxy;
use ConLayout\View\Helper\Proxy\InlineScriptProxy;
use Zend\View\Model\ViewModel;

return [
'con-layout' => [
/**
Expand Down Expand Up @@ -84,7 +92,7 @@ return [
'block_defaults' => [
'capture_to' => 'content',
'append' => true,
'class' => 'Zend\View\Model\ViewModel',
'class' => ViewModel::class,
'options' => [],
'variables' => [],
'template' => '',
Expand All @@ -106,7 +114,7 @@ return [
'cacheBuster' => 10
]
],
'proxy' => 'ConLayout\View\Helper\Proxy\HeadLinkProxy'
'proxy' => HeadLinkProxy::class
],
'headScript' => [
'method' => 'appendFile',
Expand All @@ -117,7 +125,7 @@ return [
'cacheBuster' => 10
]
],
'proxy' => 'ConLayout\View\Helper\Proxy\HeadScriptProxy'
'proxy' => HeadScriptProxy::class
],
'inlineScript' => [
'method' => 'appendFile',
Expand All @@ -128,17 +136,17 @@ return [
'cacheBuster' => 10
]
],
'proxy' => 'ConLayout\View\Helper\Proxy\InlineScriptProxy'
'proxy' => InlineScriptProxy::class
],
'headTitle' => [
'method' => 'append',
'default_param' => 'value',
'proxy' => 'ConLayout\View\Helper\Proxy\HeadTitleProxy'
'proxy' => HeadTitleProxy::class
],
'headMeta' => [
'method' => 'appendName',
'default_param' => 'name',
'proxy' => 'ConLayout\View\Helper\Proxy\HeadMetaProxy'
'proxy' => HeadMetaProxy::class
],
'bodyClass' => [
'method' => 'addClass',
Expand Down
20 changes: 14 additions & 6 deletions config/filter.config.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
<?php

use ConLayout\Filter\BasePathFilter;
use ConLayout\Filter\BasePathFilterFactory;
use ConLayout\Filter\CacheBusterFilter;
use ConLayout\Filter\CacheBusterFilterFactory;
use ConLayout\Filter\TranslateFilter;
use ConLayout\Filter\TranslateFilterFactory;

return [
'factories' => [
'ConLayout\Filter\BasePathFilter' => 'ConLayout\Filter\BasePathFilterFactory',
'ConLayout\Filter\TranslateFilter' => 'ConLayout\Filter\TranslateFilterFactory',
'ConLayout\Filter\CacheBusterFilter' => 'ConLayout\Filter\CacheBusterFilterFactory',
BasePathFilter::class => BasePathFilterFactory::class,
TranslateFilter::class => TranslateFilterFactory::class,
CacheBusterFilter::class => CacheBusterFilterFactory::class,
],
'aliases' => [
'basePath' => 'ConLayout\Filter\BasePathFilter',
'translate' => 'ConLayout\Filter\TranslateFilter',
'cacheBuster' => 'ConLayout\Filter\CacheBusterFilter'
'basePath' => BasePathFilter::class,
'translate' => TranslateFilter::class,
'cacheBuster' => CacheBusterFilter::class
]
];
7 changes: 5 additions & 2 deletions config/module.config.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

use ConLayout\Controller\Plugin\LayoutManagerFactory;
use ConLayout\Zdt\Collector\LayoutCollector;
return [
'view_manager' => [
'template_path_stack' => [
Expand All @@ -16,13 +19,13 @@
],
'controller_plugins' => [
'factories' => [
'layoutManager' => 'ConLayout\Controller\Plugin\LayoutManagerFactory'
'layoutManager' => LayoutManagerFactory::class
]
],
'zenddevelopertools' => [
'profiler' => [
'collectors' => [
'con-layout' => 'ConLayout\Zdt\Collector\LayoutCollector',
'con-layout' => LayoutCollector::class,
],
],
'toolbar' => [
Expand Down
75 changes: 50 additions & 25 deletions config/service.config.php
Original file line number Diff line number Diff line change
@@ -1,34 +1,59 @@
<?php
return [
'factories' => [
'ConLayout\BlockManager' => 'ConLayout\BlockManagerFactory',

'ConLayout\Block\Factory\BlockFactoryInterface' => 'ConLayout\Block\Factory\BlockFactoryFactory',

'ConLayout\Listener\ActionHandlesListener' => 'ConLayout\Listener\Factory\ActionHandlesListenerFactory',
'ConLayout\Listener\BodyClassListener' => 'ConLayout\Listener\Factory\BodyClassListenerFactory',
'ConLayout\Listener\LoadLayoutListener' => 'ConLayout\Listener\Factory\LoadLayoutListenerFactory',
'ConLayout\Listener\LayoutTemplateListener' => 'ConLayout\Listener\Factory\LayoutTemplateListenerFactory',
'ConLayout\Listener\ViewHelperListener' => 'ConLayout\Listener\Factory\ViewHelperListenerFactory',
'ConLayout\Listener\LayoutUpdateListener' => 'ConLayout\Listener\Factory\LayoutUpdateListenerFactory',

'ConLayout\Layout\LayoutInterface' => 'ConLayout\Layout\LayoutFactory',
'ConLayout\Updater\LayoutUpdaterInterface' => 'ConLayout\Updater\LayoutUpdaterFactory',
'ConLayout\View\Renderer\BlockRenderer' => 'ConLayout\View\Renderer\BlockRendererFactory',
'ConLayout\View\Strategy\BlockRendererStrategy' => 'ConLayout\View\Strategy\BlockRendererStrategyFactory',
use ConLayout\Block\Factory\BlockFactoryFactory;
use ConLayout\Block\Factory\BlockFactoryInterface;
use ConLayout\BlockManager;
use ConLayout\BlockManagerFactory;
use ConLayout\Layout\LayoutFactory;
use ConLayout\Layout\LayoutInterface;
use ConLayout\Listener\ActionHandlesListener;
use ConLayout\Listener\BodyClassListener;
use ConLayout\Listener\Factory\ActionHandlesListenerFactory;
use ConLayout\Listener\Factory\BodyClassListenerFactory;
use ConLayout\Listener\Factory\LayoutTemplateListenerFactory;
use ConLayout\Listener\Factory\LayoutUpdateListenerFactory;
use ConLayout\Listener\Factory\LoadLayoutListenerFactory;
use ConLayout\Listener\Factory\ViewHelperListenerFactory;
use ConLayout\Listener\LayoutTemplateListener;
use ConLayout\Listener\LayoutUpdateListener;
use ConLayout\Listener\LoadLayoutListener;
use ConLayout\Listener\PrepareActionViewModelListener;
use ConLayout\Listener\ViewHelperListener;
use ConLayout\Options\ModuleOptions;
use ConLayout\Options\ModuleOptionsFactory;
use ConLayout\Updater\LayoutUpdaterFactory;
use ConLayout\Updater\LayoutUpdaterInterface;
use ConLayout\View\Renderer\BlockRenderer;
use ConLayout\View\Renderer\BlockRendererFactory;
use ConLayout\View\Strategy\BlockRendererStrategy;
use ConLayout\View\Strategy\BlockRendererStrategyFactory;
use ConLayout\Zdt\Collector\LayoutCollector;
use ConLayout\Zdt\Collector\LayoutCollectorFactory;

'ConLayout\Zdt\Collector\LayoutCollector' => 'ConLayout\Zdt\Collector\LayoutCollectorFactory',

'ConLayout\Options\ModuleOptions' => 'ConLayout\Options\ModuleOptionsFactory',
return [
'factories' => [
BlockManager::class => BlockManagerFactory::class,
BlockFactoryInterface::class => BlockFactoryFactory::class,
ActionHandlesListener::class => ActionHandlesListenerFactory::class,
BodyClassListener::class => BodyClassListenerFactory::class,
LoadLayoutListener::class => LoadLayoutListenerFactory::class,
LayoutTemplateListener::class => LayoutTemplateListenerFactory::class,
ViewHelperListener::class => ViewHelperListenerFactory::class,
LayoutUpdateListener::class => LayoutUpdateListenerFactory::class,
LayoutInterface::class => LayoutFactory::class,
LayoutUpdaterInterface::class => LayoutUpdaterFactory::class,
BlockRenderer::class => BlockRendererFactory::class,
BlockRendererStrategy::class => BlockRendererStrategyFactory::class,
LayoutCollector::class => LayoutCollectorFactory::class,
ModuleOptions::class => ModuleOptionsFactory::class,
],
'aliases' => [
'Layout' => 'ConLayout\Layout\LayoutInterface',
'BlockRendererStrategy' => 'ConLayout\View\Strategy\BlockRendererStrategy',
'BlockRenderer' => 'ConLayout\View\Renderer\BlockRenderer',
'BlockManager' => 'ConLayout\BlockManager'
'Layout' => LayoutInterface::class,
'BlockRendererStrategy' => BlockRendererStrategy::class,
'BlockRenderer' => BlockRenderer::class,
'BlockManager' => BlockManager::class
],
'invokables' => [
'ConLayout\Listener\PrepareActionViewModelListener'
=> 'ConLayout\Listener\PrepareActionViewModelListener'
PrepareActionViewModelListener::class => PrepareActionViewModelListener::class
]
];
21 changes: 14 additions & 7 deletions config/viewhelper.config.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
<?php

use ConLayout\View\Helper\Block;
use ConLayout\View\Helper\BlockFactory;
use ConLayout\View\Helper\BodyClass;
use ConLayout\View\Helper\Proxy\ViewHelperProxyAbstractFactory;
use ConLayout\View\Helper\Wrapper;

return [
'invokables' => [
'ConLayout\View\Helper\Wrapper' => 'ConLayout\View\Helper\Wrapper',
'ConLayout\View\Helper\BodyClass' => 'ConLayout\View\Helper\BodyClass',
Wrapper::class => Wrapper::class,
BodyClass::class => BodyClass::class
],
'factories' => [
'ConLayout\View\Helper\Block' => 'ConLayout\View\Helper\BlockFactory'
Block::class => BlockFactory::class
],
'aliases' => [
'bodyClass' => 'ConLayout\View\Helper\BodyClass',
'block' => 'ConLayout\View\Helper\Block',
'wrapper' => 'ConLayout\View\Helper\Wrapper'
'bodyClass' => BodyClass::class,
'block' => Block::class,
'wrapper' => Wrapper::class
],
'abstract_factories' => [
'ConLayout\View\Helper\Proxy\ViewHelperProxyAbstractFactory'
ViewHelperProxyAbstractFactory::class
]
];
3 changes: 2 additions & 1 deletion src/ConLayout/Block/Factory/BlockFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Zend\ServiceManager\ServiceLocatorInterface;
use Zend\Stdlib\ArrayUtils;
use Zend\View\Model\ModelInterface;
use Zend\View\Model\ViewModel;

/**
* @package ConLayout
Expand All @@ -33,7 +34,7 @@ class BlockFactory implements
protected $blockDefaults = [
'capture_to' => 'content',
'append' => true,
'class' => 'Zend\View\Model\ViewModel',
'class' => ViewModel::class,
'options' => [],
'variables' => [],
'template' => '',
Expand Down
5 changes: 3 additions & 2 deletions src/ConLayout/Block/Factory/BlockFactoryFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace ConLayout\Block\Factory;

use ConLayout\BlockManager;
use ConLayout\Options\ModuleOptions;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
Expand All @@ -15,10 +16,10 @@ class BlockFactoryFactory implements FactoryInterface
public function createService(ServiceLocatorInterface $serviceLocator)
{
/* @var $options ModuleOptions */
$options = $serviceLocator->get('ConLayout\Options\ModuleOptions');
$options = $serviceLocator->get(ModuleOptions::class);
$blockFactory = new BlockFactory(
$options->getBlockDefaults(),
$serviceLocator->get('ConLayout\BlockManager')
$serviceLocator->get(BlockManager::class)
);
return $blockFactory;
}
Expand Down
9 changes: 6 additions & 3 deletions src/ConLayout/Controller/Plugin/LayoutManagerFactory.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?php
namespace ConLayout\Controller\Plugin;

use ConLayout\Layout\LayoutInterface;
use ConLayout\Updater\LayoutUpdaterInterface;
use ConLayout\View\Renderer\BlockRenderer;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;

Expand All @@ -19,9 +22,9 @@ public function createService(ServiceLocatorInterface $serviceLocator)
{
$sl = $serviceLocator->getServiceLocator();
return new LayoutManager(
$sl->get('ConLayout\Layout\LayoutInterface'),
$sl->get('ConLayout\Updater\LayoutUpdaterInterface'),
$sl->get('ConLayout\View\Renderer\BlockRenderer')
$sl->get(LayoutInterface::class),
$sl->get(LayoutUpdaterInterface::class),
$sl->get(BlockRenderer::class)
);
}
}
2 changes: 1 addition & 1 deletion src/ConLayout/Filter/CacheBusterFilterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function createService(ServiceLocatorInterface $serviceLocator)
{
$serviceManager = $serviceLocator->getServiceLocator();
/* @var $options ModuleOptions */
$options = $serviceManager->get('ConLayout\Options\ModuleOptions');
$options = $serviceManager->get(ModuleOptions::class);
$internalBaseDir = $options->getCacheBusterInternalBaseDir();
$cacheBuster = new CacheBusterFilter($internalBaseDir);
return $cacheBuster;
Expand Down
9 changes: 4 additions & 5 deletions src/ConLayout/Layout/LayoutFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

namespace ConLayout\Layout;

use ConLayout\Options\ModuleOptions;
use ConLayout\Block\Factory\BlockFactoryInterface;
use ConLayout\Updater\LayoutUpdaterInterface;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;

Expand All @@ -19,11 +20,9 @@ class LayoutFactory implements FactoryInterface
*/
public function createService(ServiceLocatorInterface $serviceLocator)
{
/* @var $moduleOptions ModuleOptions */
$moduleOptions = $serviceLocator->get('ConLayout\Options\ModuleOptions');
$layout = new Layout(
$serviceLocator->get('ConLayout\Block\Factory\BlockFactoryInterface'),
$serviceLocator->get('ConLayout\Updater\LayoutUpdaterInterface')
$serviceLocator->get(BlockFactoryInterface::class),
$serviceLocator->get(LayoutUpdaterInterface::class)
);
return $layout;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

use ConLayout\Listener\ActionHandlesListener;
use ConLayout\Options\ModuleOptions;
use ConLayout\Updater\LayoutUpdaterInterface;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;

Expand All @@ -20,13 +21,13 @@ class ActionHandlesListenerFactory implements FactoryInterface
public function createService(ServiceLocatorInterface $serviceLocator)
{
/* @var $moduleOptions ModuleOptions */
$moduleOptions = $serviceLocator->get('ConLayout\Options\ModuleOptions');
$updater = $serviceLocator->get('ConLayout\Updater\LayoutUpdaterInterface');
$moduleOptions = $serviceLocator->get(ModuleOptions::class);
$updater = $serviceLocator->get(LayoutUpdaterInterface::class);
$actionHandlesListener = new ActionHandlesListener();
$actionHandlesListener->setUpdater($updater);
$actionHandlesListener->setControllerMap($moduleOptions->getControllerMap());
$actionHandlesListener->setPreferRouteMatchController($moduleOptions->isPreferRouteMatchController());

return $actionHandlesListener;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace ConLayout\Listener\Factory;

use ConLayout\Listener\LayoutTemplateListener;
use ConLayout\Updater\LayoutUpdaterInterface;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;

Expand All @@ -20,7 +21,7 @@ class LayoutTemplateListenerFactory implements FactoryInterface
public function createService(ServiceLocatorInterface $serviceLocator)
{
$layoutTemplateListener = new LayoutTemplateListener(
$serviceLocator->get('ConLayout\Updater\LayoutUpdaterInterface')
$serviceLocator->get(LayoutUpdaterInterface::class)
);
return $layoutTemplateListener;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class LayoutUpdateListenerFactory implements FactoryInterface
public function createService(ServiceLocatorInterface $serviceLocator)
{
/* @var $options ModuleOptions */
$options = $serviceLocator->get('ConLayout\Options\ModuleOptions');
$options = $serviceLocator->get(ModuleOptions::class);
$paths = $options->getLayoutUpdatePaths();
$extensions = $options->getLayoutUpdateExtensions();
$defaultArea = $options->getDefaultArea();
Expand Down
Loading

0 comments on commit c803414

Please sign in to comment.