Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

CS fixes.

  • Loading branch information...
commit 228659a76e1fb4c7a625bdccd7218e767b35a3bc 1 parent e02ce26
@nrk authored
View
2  examples/multiple.php
@@ -25,7 +25,7 @@
));
/** routes **/
-$app->get('/', function() use($app) {
+$app->get('/', function () use ($app) {
$first = var_export($app['predis.first']->info(), true);
$second = var_export($app['predis.second']->info(), true);
$third = var_export($app['predis.third']->info(), true);
View
2  examples/simple.php
@@ -13,7 +13,7 @@
));
/** routes **/
-$app->get('/', function() use($app) {
+$app->get('/', function () use ($app) {
return var_export($app['predis']->info(), true);
});
View
19 lib/Predis/Silex/PredisServiceProvider.php
@@ -63,7 +63,7 @@ public function boot(Application $app)
throw new \InvalidArgumentException("The specified alias '$alias' is not valid.");
}
- $app["$prefix.$alias"] = $app->share(function() use($app, $prefix, $args) {
+ $app["$prefix.$alias"] = $app->share(function () use ($app, $prefix, $args) {
$initializer = $app["$prefix.client_initializer"];
if (!isset($args['parameters'])) {
@@ -76,14 +76,13 @@ public function boot(Application $app)
});
if (is_array($args) && isset($args['default']) && $args['default'] == true) {
- $app[$prefix] = $app->share(function() use($app, $prefix, $alias) {
+ $app[$prefix] = $app->share(function () use ($app, $prefix, $alias) {
return $app["$prefix.$alias"];
});
}
}
- }
- else {
- $app[$prefix] = $app->share(function() use($app, $prefix) {
+ } else {
+ $app[$prefix] = $app->share(function () use ($app, $prefix) {
$initializer = $app["$prefix.client_initializer"];
return $initializer($app);
@@ -98,15 +97,18 @@ public function register(Application $app)
{
$prefix = $this->prefix;
- $app["$prefix.client_initializer"] = $app->protect(function($arguments) use($app, $prefix) {
- $extract = function($bag, $key) use ($app, $prefix) {
+ $app["$prefix.client_initializer"] = $app->protect(function ($arguments) use ($app, $prefix) {
+ $extract = function ($bag, $key) use ($app, $prefix) {
$default = "default_$key";
+
if ($bag instanceof Application) {
$key = "$prefix.$key";
}
+
if (!isset($bag[$key])) {
return $app["$prefix.$default"];
}
+
if (is_array($bag[$key])) {
return array_merge($app["$prefix.$default"], $bag[$key]);
}
@@ -117,8 +119,7 @@ public function register(Application $app)
if (is_string($arguments)) {
$parameters = $arguments;
$options = $app["$prefix.default_options"];
- }
- else {
+ } else {
$parameters = $extract($arguments, 'parameters');
$options = $extract($arguments, 'options');
}
Please sign in to comment.
Something went wrong with that request. Please try again.