Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[AsseticExtension] CS fixes

  • Loading branch information...
commit cce4ab0a7812fe3f5518cdbd3f1f29e99533f09c 1 parent e807a80
@igorw igorw authored
Showing with 31 additions and 31 deletions.
  1. +31 −31 src/SilexExtension/AsseticExtension.php
View
62 src/SilexExtension/AsseticExtension.php
@@ -17,40 +17,40 @@
class AsseticExtension implements ExtensionInterface
{
public function register(Application $app)
- {
+ {
/**
* Default options
*/
$options = array(
'debug' => false,
- 'formulae_cache_dir' => null,
+ 'formulae_cache_dir' => null,
);
-
+
/**
* Asset Factory conifguration happens here
*/
$app['assetic'] = $app->share(function () use ($app, $options) {
- $app['assetic.options'] = isset($app['assetic.options'])
+ $app['assetic.options'] = isset($app['assetic.options'])
? array_merge($options, $app['assetic.options']) : $options;
// initializing lazy asset manager
- if( isset($app['assetic.formulae']) &&
- !is_array($app['assetic.formulae']) &&
+ if (isset($app['assetic.formulae']) &&
+ !is_array($app['assetic.formulae']) &&
!empty($app['assetic.formulae'])
) {
$app['assetic.lazy_asset_manager'];
}
-
+
return $app['assetic.factory'];
});
-
+
/**
* Factory
* @return Assetic\Factory\AssetFactory
*/
- $app['assetic.factory'] = $app->share(function() use($app) {
+ $app['assetic.factory'] = $app->share(function() use ($app) {
$options = $app['assetic.options'];
- if(!isset($options['path_to_web'])) {
+ if (!isset($options['path_to_web'])) {
throw new \Exception("Missing option 'path_to_web' in assetic.options");
}
$factory = new AssetFactory($options['path_to_web'], $options['debug']);
@@ -62,67 +62,67 @@ public function register(Application $app)
/**
* Writes down all lazy asset manager and asset managers assets
*/
- $app->after(function() use($app) {
+ $app->after(function() use ($app) {
$app['assetic.asset_writer']->writeManagerAssets(
$app['assetic.lazy_asset_manager']);
$app['assetic.asset_writer']->writeManagerAssets(
$app['assetic.asset_manager']);
});
-
+
/**
* Asset writer, writes to the 'path_to_web' folder
*/
- $app['assetic.asset_writer'] = $app->share(function () use($app) {
+ $app['assetic.asset_writer'] = $app->share(function () use ($app) {
return new AssetWriter($app['assetic.options']['path_to_web']);
});
-
+
/**
* Asset manager, can be accessed via $app['assetic.asset_manager']
* and can be configured via $app['assetic.assets'], just provide a
- * protected callback $app->protect(function($am) { }) and add
+ * protected callback $app->protect(function($am) { }) and add
* your assets inside the function to asset manager ($am->set())
*/
- $app['assetic.asset_manager'] = $app->share(function () use($app) {
+ $app['assetic.asset_manager'] = $app->share(function () use ($app) {
$assets = isset($app['assetic.assets']) ? $app['assetic.assets'] : function() {};
$manager = new AssetManager();
-
+
call_user_func_array($assets, array($manager, $app['assetic.filter_manager']));
return $manager;
});
-
+
/**
* Filter manager, can be accessed via $app['assetic.filter_manager']
* and can be configured via $app['assetic.filters'], just provide a
- * protected callback $app->protect(function($fm) { }) and add
+ * protected callback $app->protect(function($fm) { }) and add
* your filters inside the function to filter manager ($fm->set())
*/
- $app['assetic.filter_manager'] = $app->share(function () use($app) {
+ $app['assetic.filter_manager'] = $app->share(function () use ($app) {
$filters = isset($app['assetic.filters']) ? $app['assetic.filters'] : function() {};
$manager = new FilterManager();
-
+
call_user_func_array($filters, array($manager));
return $manager;
});
-
+
/**
* Lazy asset manager for loading assets from $app['assetic.formulae']
* (will be later maybe removed)
*/
- $app['assetic.lazy_asset_manager'] = $app->share(function () use($app) {
+ $app['assetic.lazy_asset_manager'] = $app->share(function () use ($app) {
$formulae = isset($app['assetic.formulae']) ? $app['assetic.formulae'] : array();
$options = $app['assetic.options'];
$lazy = new LazyAssetmanager($app['assetic.factory']);
-
- if(empty($formulae)) {
+
+ if (empty($formulae)) {
return $lazy;
}
-
- foreach($formulae as $name => $formula) {
+
+ foreach ($formulae as $name => $formula) {
$lazy->setFormula($name, $formula);
}
-
- if($options['formulae_cache_dir'] !== null && $options['debug'] !== true) {
- foreach($lazy->getNames() as $name) {
+
+ if ($options['formulae_cache_dir'] !== null && $options['debug'] !== true) {
+ foreach ($lazy->getNames() as $name) {
$lazy->set($name, new AssetCache(
$lazy->get($name),
new FilesystemCache($options['formulae_cache_dir'])
@@ -138,7 +138,7 @@ public function register(Application $app)
$app['twig']->addExtension(new TwigAsseticExtension($app['assetic.factory']));
}
});
-
+
// autoloading the assetic library
if (isset($app['assetic.class_path'])) {
$app['autoloader']->registerNamespace('Assetic', $app['assetic.class_path']);
Please sign in to comment.
Something went wrong with that request. Please try again.