@@ -18,7 +18,7 @@ |
||
18 | 18 | /** |
19 | 19 | * @var HydrationLogger |
20 | 20 | */ |
21 | - private $hydrationLogger = array (); |
|
21 | + private $hydrationLogger = array(); |
|
22 | 22 | |
23 | 23 | public function __construct(HydrationLogger $logger) |
24 | 24 | { |
@@ -9,7 +9,6 @@ |
||
9 | 9 | use Doctrine\DBAL\Types\Type; |
10 | 10 | use Pimple\Container; |
11 | 11 | use Pimple\ServiceProviderInterface; |
12 | -use Silex\Application; |
|
13 | 12 | use Symfony\Component\HttpKernel\Controller\ControllerReference; |
14 | 13 | |
15 | 14 | class SilexDoctrineHydrationProfileProvider implements ServiceProviderInterface |
@@ -24,11 +24,11 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function register(Container $app) |
26 | 26 | { |
27 | - $app["debesha.doctrine_extra_profiler.logger"] = function () use ($app) { |
|
27 | + $app["debesha.doctrine_extra_profiler.logger"] = function() use ($app) { |
|
28 | 28 | return new HydrationLogger($app->offsetGet("orm.em")); |
29 | 29 | }; |
30 | 30 | $app['debesha.class.hydrationDataCollector'] = 'SilexDoctrineHydrationProfile\Fix\DataCollector'; |
31 | - $app["debesha.doctrine_extra_profiler.data_collector"] = function () use ($app) { |
|
31 | + $app["debesha.doctrine_extra_profiler.data_collector"] = function() use ($app) { |
|
32 | 32 | $class = $app['debesha.class.hydrationDataCollector']; |
33 | 33 | return new $class( |
34 | 34 | $app->offsetGet("debesha.doctrine_extra_profiler.logger") |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $config = $app['orm.ems.config'][$name]; |
74 | 74 | } |
75 | 75 | |
76 | - $ems[$name] = function () use ($app, $options, $config) { |
|
76 | + $ems[$name] = function() use ($app, $options, $config) { |
|
77 | 77 | /** |
78 | 78 | * @var $entityManagerClassName \Doctrine\ORM\EntityManager |
79 | 79 | */ |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | } |
132 | 132 | |
133 | 133 | if (!empty($entity['resources_namespace'])) { |
134 | - if($app->offsetExists('psr0_resource_locator')) { |
|
134 | + if ($app->offsetExists('psr0_resource_locator')) { |
|
135 | 135 | $entity['path'] = $app['psr0_resource_locator']->findFirstDirectory($entity['resources_namespace']); |
136 | 136 | } else { |
137 | 137 | throw new \InvalidArgumentException('Not exist psr0_resource_locator'); |
@@ -142,13 +142,13 @@ discard block |
||
142 | 142 | $config->addEntityNamespace($entity['alias'], $entity['namespace']); |
143 | 143 | } |
144 | 144 | |
145 | - if('annotation' === $entity['type']){ |
|
145 | + if ('annotation' === $entity['type']) { |
|
146 | 146 | $useSimpleAnnotationReader = isset($entity['use_simple_annotation_reader']) |
147 | 147 | ? $entity['use_simple_annotation_reader'] |
148 | 148 | : true; |
149 | - $driver = $config->newDefaultAnnotationDriver((array) $entity['path'], $useSimpleAnnotationReader); |
|
149 | + $driver = $config->newDefaultAnnotationDriver((array) $entity['path'], $useSimpleAnnotationReader); |
|
150 | 150 | } else { |
151 | - $driver = $app['orm.driver.factory']( $entity, $options ); |
|
151 | + $driver = $app['orm.driver.factory']($entity, $options); |
|
152 | 152 | } |
153 | 153 | $chain->addDriver($driver, $entity['namespace']); |
154 | 154 | } |
@@ -169,15 +169,15 @@ discard block |
||
169 | 169 | }; |
170 | 170 | |
171 | 171 | |
172 | - $app['orm.driver.factory'] = function(){ |
|
172 | + $app['orm.driver.factory'] = function() { |
|
173 | 173 | $simpleList = array( |
174 | 174 | 'simple_yml', |
175 | 175 | 'simple_xml', |
176 | 176 | ); |
177 | - return function ( $entity, $options ) use ($simpleList) { |
|
178 | - if (isset($options[ 'class.driver.' . $entity['type'] ])) { |
|
179 | - $className = $options[ 'class.driver.' . $entity['type'] ]; |
|
180 | - if( in_array($entity['type'], $simpleList) ) { |
|
177 | + return function($entity, $options) use ($simpleList) { |
|
178 | + if (isset($options['class.driver.'.$entity['type']])) { |
|
179 | + $className = $options['class.driver.'.$entity['type']]; |
|
180 | + if (in_array($entity['type'], $simpleList)) { |
|
181 | 181 | $param = array($entity['path'] => $entity['namespace']); |
182 | 182 | } else { |
183 | 183 | $param = $entity['path']; |
@@ -189,22 +189,22 @@ discard block |
||
189 | 189 | }; |
190 | 190 | |
191 | 191 | $app->extend('data_collectors', function($collectors) { |
192 | - $collectors["hydrations"] = function ($app) { |
|
192 | + $collectors["hydrations"] = function($app) { |
|
193 | 193 | return $app["debesha.doctrine_extra_profiler.data_collector"]; |
194 | 194 | }; |
195 | 195 | return $collectors; |
196 | 196 | }); |
197 | - $app->extend("data_collector.templates", function ($templates) { |
|
197 | + $app->extend("data_collector.templates", function($templates) { |
|
198 | 198 | $templates[] = array("hydrations", "@DebeshaDoctrineProfileExtraBundle/Collector/hydrations.html.twig"); |
199 | 199 | return $templates; |
200 | 200 | } ); |
201 | - $app->extend('twig', function ($twig) use($app) { |
|
201 | + $app->extend('twig', function($twig) use($app) { |
|
202 | 202 | $options = array('is_safe' => array('html')); |
203 | - $callable = function ($controller, $attributes = array(), $query = array()) { |
|
203 | + $callable = function($controller, $attributes = array(), $query = array()) { |
|
204 | 204 | return new ControllerReference($controller, $attributes, $query); |
205 | 205 | }; |
206 | 206 | $twig->addFunction(new \Twig_SimpleFunction("controller", $callable, $options)); |
207 | - $app['twig.loader.filesystem']->addPath(dirname(__FILE__) . DIRECTORY_SEPARATOR . "Views", "DebeshaDoctrineProfileExtraBundle"); |
|
207 | + $app['twig.loader.filesystem']->addPath(dirname(__FILE__).DIRECTORY_SEPARATOR."Views", "DebeshaDoctrineProfileExtraBundle"); |
|
208 | 208 | return $twig; |
209 | 209 | }); |
210 | 210 | } |