當前位置: 首頁>>代碼示例>>PHP>>正文


PHP AssetFactory::setAssetManager方法代碼示例

本文整理匯總了PHP中Assetic\Factory\AssetFactory::setAssetManager方法的典型用法代碼示例。如果您正苦於以下問題:PHP AssetFactory::setAssetManager方法的具體用法?PHP AssetFactory::setAssetManager怎麽用?PHP AssetFactory::setAssetManager使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Assetic\Factory\AssetFactory的用法示例。


在下文中一共展示了AssetFactory::setAssetManager方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 /**
  * Constructor
  * 
  * @param AssetFactory   $factory The AssetFactory 
  * @param CacheInterface $cache   The Cache Manager
  * @param AssetManager   $manager The Asset Manager
  * 
  * @return void 
  */
 public function __construct(AssetFactory $factory = null, CacheInterface $cache = null, $cacheDir = null, AssetManager $manager = null)
 {
     $this->factory = $factory;
     $this->manager = $manager;
     $this->cache = $cache;
     $this->cacheDirectory = $cacheDir;
     $this->factory->setAssetManager($this->getAssetManager());
 }
開發者ID:nitronet,項目名稱:fwk-assetic,代碼行數:17,代碼來源:AssetsService.php

示例2: setUp

 protected function setUp()
 {
     if (!class_exists('Twig_Environment')) {
         $this->markTestSkipped('Twig is not installed.');
     }
     $this->am = $this->getMock('Assetic\\AssetManager');
     $this->fm = $this->getMock('Assetic\\FilterManager');
     $this->valueSupplier = $this->getMock('Assetic\\ValueSupplierInterface');
     $this->factory = new AssetFactory(__DIR__ . '/templates');
     $this->factory->setAssetManager($this->am);
     $this->factory->setFilterManager($this->fm);
     $this->twig = new \Twig_Environment(new \Twig_Loader_Filesystem(__DIR__ . '/templates'));
     $this->twig->addExtension(new AsseticExtension($this->factory, array(), $this->valueSupplier));
 }
開發者ID:selimcr,項目名稱:servigases,代碼行數:14,代碼來源:AsseticExtensionTest.php

示例3: getAssetFactory

 /**
  * @param $rootPath
  * @param $debug
  * @return AssetFactory
  */
 private function getAssetFactory($rootPath, $debug)
 {
     $filterManager = new FilterManager();
     $filterManager->set('yui_js', new JsCompressorFilter(dirname(__DIR__) . '/../optimizers/yuicompressor/yuicompressor-2.4.7.jar'));
     $assetFactory = new AssetFactory($rootPath, $debug);
     $assetFactory->setFilterManager($filterManager);
     $assetFactory->setAssetManager(new AssetManager());
     return $assetFactory;
 }
開發者ID:eberhm,項目名稱:phoenix,代碼行數:14,代碼來源:Optimizer.php

示例4: initialize

 protected function initialize(InputInterface $input, OutputInterface $output)
 {
     $this->basePath = $input->getArgument('write_to') ?: $this->getConfig()->getWebBasePath();
     $this->verbose = $input->getOption('verbose');
     $assetFactory = new AssetFactory($this->getConfig()->getAssetsBasePath(), $this->getConfig()->isDebug());
     $loader = new TwigFormulaLoader($this->twig());
     $this->am = new LazyAssetManager($assetFactory);
     $assetFactory->setAssetManager($this->am);
     $this->am->setLoader('twig', $loader);
 }
開發者ID:NaszvadiG,項目名稱:codeigniter-extended,代碼行數:10,代碼來源:DumpCommand.php

示例5: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->am = $this->getMock('Assetic\\AssetManager');
     $this->fm = $this->getMock('Assetic\\FilterManager');
     $factory = new AssetFactory(__DIR__ . '/templates');
     $factory->setAssetManager($this->am);
     $factory->setFilterManager($this->fm);
     $this->engine->addExtension(new AsseticExtensionForTest($factory));
     $this->loader = new SmartyFormulaLoader($this->engine);
 }
開發者ID:Danack,項目名稱:SmartyBundle,代碼行數:11,代碼來源:SmartyFormulaLoaderTest.php

示例6: build

 /**
  * Builds the AssetFactory object
  *
  * @return \Assetic\Factory\AssetFactory
  */
 public function build()
 {
     $assetManager = new AssetManager();
     $filterManager = new FilterManager();
     foreach ($this->filters as $filterName => $filter) {
         $filterManager->set($filterName, $filter);
     }
     $assetsFactory = new AssetFactory($this->configurationHandler->webDir());
     $assetsFactory->setAssetManager($assetManager);
     $assetsFactory->setFilterManager($filterManager);
     return $assetsFactory;
 }
開發者ID:redkite-labs,項目名稱:redkitecms-framework,代碼行數:17,代碼來源:AsseticFactoryBuilder.php

示例7: renderThemeAssets

 public function renderThemeAssets()
 {
     $conf = (array) $this->getThemeAssets();
     $factory = new Factory\AssetFactory($conf['root_path']);
     $factory->setAssetManager($this->getAssetManager());
     $factory->setFilterManager($this->getFilterManager());
     $factory->setDebug($this->configuration->isDebug());
     $mobileDetect = $this->serviceManager->get('dxMobileDetect');
     $isTablet = $mobileDetect->isTablet();
     $assetName = 'assets';
     $filterName = 'filters';
     $optionName = 'options';
     $outputName = 'output';
     if ($mobileDetect->isMobile()) {
         $assetName = $assetName . 'Mobile';
         $filterName = $filterName . 'Mobile';
         $optionName = $optionName . 'Mobile';
         $outputName = $outputName . 'Mobile';
     }
     if ($mobileDetect->isTablet()) {
         $assetName = $assetName . 'Tablet';
         $filterName = $filterName . 'Tablet';
         $optionName = $optionName . 'Tablet';
         $outputName = $outputName . 'Mobile';
     }
     $collections = (array) $conf['collections'];
     foreach ($collections as $name => $options) {
         $assets = isset($options[$assetName]) ? $options[$assetName] : isset($options['assets']) ? $options['assets'] : array();
         $filtersx = isset($options[$filterName]) ? $options[$filterName] : isset($options['filters']) ? $options['filters'] : array();
         $options = isset($options[$optionName]) ? $options[$optionName] : isset($options['options']) ? $options['options'] : array();
         $options['output'] = isset($options[$outputName]) ? $options[$outputName] : isset($options['output']) ? $options['output'] : $name;
         $filters = $this->initFilters($filtersx);
         /** @var $asset \Assetic\Asset\AssetCollection */
         $asset = $factory->createAsset($assets, $filters, $options);
         # allow to move all files 1:1 to new directory
         # its particulary usefull when this assets are images.
         if (isset($options['move_raw']) && $options['move_raw']) {
             foreach ($asset as $key => $value) {
                 $name = md5($value->getSourceRoot() . $value->getSourcePath());
                 $value->setTargetPath($value->getSourcePath());
                 $value = $this->cache($value);
                 $this->assetManager->set($name, $value);
             }
         } else {
             $asset = $this->cache($asset);
             $this->assetManager->set($name, $asset);
         }
     }
     $writer = new AssetWriter($this->configuration->getWebPath());
     $writer->writeManagerAssets($this->assetManager);
 }
開發者ID:dennesabing,項目名稱:dxapp,代碼行數:51,代碼來源:ThemeAssets.php

示例8: setUp

 protected function setUp()
 {
     if (!class_exists('Twig_Environment')) {
         $this->markTestSkipped('Twig is not installed.');
     }
     $this->am = $this->getMock('Assetic\\AssetManager');
     $this->fm = $this->getMock('Assetic\\FilterManager');
     $factory = new AssetFactory(__DIR__ . '/templates');
     $factory->setAssetManager($this->am);
     $factory->setFilterManager($this->fm);
     $twig = new \Twig_Environment($this->getMock('Twig_LoaderInterface'));
     $twig->addExtension(new AsseticExtension($factory, array('some_func' => array('filter' => 'some_filter', 'options' => array('output' => 'css/*.css')))));
     $this->loader = new TwigFormulaLoader($twig);
 }
開發者ID:selimcr,項目名稱:servigases,代碼行數:14,代碼來源:TwigFormulaLoaderTest.php

示例9: init

 /**
  * {@inheritDoc}
  */
 public function init(Application $app)
 {
     $app['assets'] = $app->share(function () use($app) {
         $assetManager = new AssetManager();
         $filterManager = new FilterManager();
         $filterManager->set('less', new LessphpFilter());
         $filterManager->set('cssmin', new CssMinFilter());
         $filterManager->set('jsmin', new JSqueezeFilter());
         $factory = new AssetFactory($app['assets.path']);
         $factory->setAssetManager($assetManager);
         $factory->setFilterManager($filterManager);
         $factory->setDefaultOutput('misc/*');
         return $factory;
     });
 }
開發者ID:lukezbihlyj,項目名稱:silex-assets,代碼行數:18,代碼來源:Module.php

示例10: setUp

    protected function setUp()
    {
        if (!class_exists('Twig_Environment')) {
            $this->markTestSkipped('Twig is not installed.');
        }

        $this->am = $this->getMock('Assetic\\AssetManager');
        $this->fm = $this->getMock('Assetic\\FilterManager');

        $factory = new AssetFactory(__DIR__.'/templates');
        $factory->setAssetManager($this->am);
        $factory->setFilterManager($this->fm);

        $twig = new \Twig_Environment();
        $twig->addExtension(new AsseticExtension($factory));

        $this->loader = new TwigFormulaLoader($twig);
    }
開發者ID:naderman,項目名稱:assetic,代碼行數:18,代碼來源:TwigFormulaLoaderTest.php

示例11: register

 /**
  *
  * @param  Application $app
  */
 function register(Application $app)
 {
     $app['assetic.asset.root'] = '';
     $app['assetic.asset.output_root'] = '';
     $app['assetic.debug'] = false;
     $app['assetic.filter'] = array();
     $app['assetic.filter.default'] = array('cssmin' => '\\Assetic\\Filter\\CssMinFilter', 'cssrewrite' => '\\Assetic\\Filter\\CssRewriteFilter');
     $app['assetic.filter_manager'] = $app->share(function ($app) {
         $filterManager = new FilterManager();
         return $filterManager;
     });
     $app['assetic.asset_manager'] = $app->share(function ($app) {
         $assetManager = new AssetManager();
         return $assetManager;
     });
     $app['assetic.asset_factory'] = $app->share(function ($app) {
         $assetFactory = new AssetFactory($app['assetic.asset.root']);
         $assetFactory->setDefaultOutput($app['assetic.asset.output_root']);
         $assetFactory->setFilterManager($app['assetic.filter_manager']);
         $assetFactory->setAssetManager($app['assetic.asset_manager']);
         $assetFactory->setDebug($app['assetic.debug']);
         return $assetFactory;
     });
     $app['assetic.lazy_asset_manager'] = $app->share(function ($app) {
         $lazyAssetManager = new LazyAssetManager($app['assetic.asset_factory']);
         $lazyAssetManager->setLoader('twig', new TwigAsseticIntegrationFormulaLoader($app['twig'], null, $app));
         return $lazyAssetManager;
     });
     $app['assetic.asset_writer'] = $app->share(function ($app) {
         $assetWriter = new AssetWriter($app['assetic.asset.output_root']);
         return $assetWriter;
     });
     /*
      * Twig
      *
      */
     // Replace Twig loader
     $app['twig.loader.filesystem'] = $app->share(function ($app) {
         return new \Wake\Twig_AsseticLoader_Filesystem($app['twig.path']);
     });
     $app['twig.loader'] = $app->share(function ($app) {
         return new \Wake\Twig_AsseticLoader_Chain(array($app['twig.loader.array'], $app['twig.loader.filesystem']));
     });
 }
開發者ID:wake,項目名稱:twig-assetic-integration-provider,代碼行數:48,代碼來源:TwigAsseticIntegrationProvider.php

示例12: register

 public function register()
 {
     // Register the asset manager singleton
     $this->app->bindShared('Concrete\\Package\\AssetPipeline\\Src\\Asset\\UtilityInterface', function ($app) {
         return new AssetUtility($app);
     });
     // Register filter settings repository singleton
     $this->app->singleton('Concrete\\Package\\AssetPipeline\\Src\\Asset\\Filter\\SettingsRepositoryInterface', 'Concrete\\Package\\AssetPipeline\\Src\\Asset\\Filter\\SettingsRepository');
     // Register Assetic's AssetFactory
     $this->app->bindShared('Assetic\\Factory\\AssetFactory', function ($app) {
         $am = new AssetManager();
         $fm = new FilterManager();
         $factory = new AssetFactory(DIR_BASE);
         $factory->setAssetManager($am);
         $factory->setFilterManager($fm);
         return $factory;
     });
     $singletons = array('helper/assets' => '\\Concrete\\Package\\AssetPipeline\\Src\\Service\\Assets');
     foreach ($singletons as $key => $value) {
         $this->app->singleton($this->pkgHandle . '/' . $key, $value);
     }
 }
開發者ID:mainio,項目名稱:c5_asset_pipeline,代碼行數:22,代碼來源:PackageServiceProvider.php

示例13: register

 public function register(Container $app)
 {
     $app['assetic.assets'] = $app['assetic.filters'] = $app['assetic.workers'] = array();
     $app['assetic.asset_manager'] = function () use($app) {
         $am = new AssetManager();
         if (isset($app['assetic.assets'])) {
             $assets = $app['assetic.assets'];
             if (!is_array($assets)) {
                 $assets = array($assets);
             }
             foreach ($assets as $name => $asset) {
                 if (!is_array($asset)) {
                     // não collection, transformar em collection
                     $asset = array($asset);
                 }
                 $col = new AssetCollection();
                 foreach ($asset as $a) {
                     if (is_string($a)) {
                         // é referencia
                         $a = new AssetReference($am, $a);
                     }
                     if (!$a instanceof AssetInterface) {
                         throw new \InvalidArgumentException("'assetic.assets' precisa ser um array de AssetInterface");
                     }
                     $col->add($a);
                 }
                 $am->set($name, $col);
             }
         }
         return $am;
     };
     $app['assetic.filter_manager'] = function () use($app) {
         $fm = new FilterManager();
         if (isset($app['assetic.filters'])) {
             $filters = $app['assetic.filters'];
             if (!is_array($filters)) {
                 $filters = array($filters);
             }
             foreach ($filters as $name => $filter) {
                 $fm->set($name, $filter);
             }
         }
         return $fm;
     };
     $app['assetic.factory'] = function () use($app) {
         $factory = new AssetFactory($app['assetic.dist_path']);
         $factory->setAssetManager($app['assetic.asset_manager']);
         $factory->setFilterManager($app['assetic.filter_manager']);
         $factory->setDebug(isset($app['debug']) ? $app['debug'] : false);
         $factory->setDefaultOutput($app['assetic.dist_path']);
         if (isset($app['assetic.workers']) && is_array($app['assetic.workers'])) {
             foreach ($app['assetic.workers'] as $worker) {
                 $factory->addWorker($worker);
             }
         }
         return $factory;
     };
     $app['assetic.lazy_asset_manager'] = function () use($app) {
         $am = new LazyAssetManager($app['assetic.factory']);
         if (isset($app['twig'])) {
             // carrega os assets pelo twig
             $am->setLoader('twig', new TwigFormulaLoader($app['twig']));
             $loader = $app['twig.loader.filesystem'];
             $namespaces = $loader->getNamespaces();
             foreach ($namespaces as $ns) {
                 if (count($loader->getPaths($ns)) > 0) {
                     $iterator = Finder::create()->files()->in($loader->getPaths($ns));
                     foreach ($iterator as $file) {
                         $resource = new TwigResource($loader, '@' . $ns . '/' . $file->getRelativePathname());
                         $am->addResource($resource, 'twig');
                     }
                 }
             }
         }
         return $am;
     };
     $app['assetic.asset_writer'] = function () use($app) {
         return new AssetWriter($app['assetic.dist_path']);
     };
     if (isset($app['twig'])) {
         $app['twig'] = $app->extend('twig', function ($twig, $app) {
             $functions = array('cssrewrite' => array('options' => array('combine' => true)));
             $twig->addExtension(new AsseticExtension($app['assetic.factory'], $functions));
             return $twig;
         });
     }
 }
開發者ID:brodaproject,項目名稱:broda,代碼行數:87,代碼來源:AsseticServiceProvider.php

示例14: createAssetFactory

 /**
  * @param array $configuration
  * @return Factory\AssetFactory
  */
 public function createAssetFactory(array $configuration)
 {
     $factory = new Factory\AssetFactory($configuration['root_path']);
     $factory->setAssetManager($this->getAssetManager());
     $factory->setFilterManager($this->getFilterManager());
     // Cache buster should be add only if cache is enabled and if is available.
     if ($this->configuration->getCacheEnabled()) {
         $worker = $this->getCacheBusterStrategy();
         if ($worker instanceof WorkerInterface) {
             $factory->addWorker($worker);
         }
     }
     $factory->setDebug($this->configuration->isDebug());
     return $factory;
 }
開發者ID:supa86000,項目名稱:zf2-assetic-module,代碼行數:19,代碼來源:Service.php

示例15: register

 /**
  * Registers services on the given container.
  *
  * This method should only be used to configure services and parameters.
  * It should not get services.
  *
  * @param Container $pimple An Container instance
  */
 public function register(Container $pimple)
 {
     /*
      * Default configuration.
      */
     $pimple['assetic.debug'] = false;
     $pimple['assetic.assets'] = array();
     $pimple['assetic.variables'] = array();
     $pimple['assetic.register_functions'] = true;
     $pimple['assetic.java.bin'] = '/usr/bin/java';
     $pimple['assetic.node.bin'] = '/usr/bin/node';
     $pimple['assetic.node.paths'] = array();
     $pimple['assetic.ruby.bin'] = '/usr/bin/ruby';
     $pimple['assetic.sass.bin'] = '/usr/bin/sass';
     /*
      * Finds IDs of all Asset Manager services.
      */
     $pimple['assetic.asset_managers'] = $pimple->factory(function (Container $c) {
         $ids = preg_grep(self::ASSET_MANAGER_MATCH, $c->keys());
         return $ids;
     });
     /*
      * Asset Factory configuration happens here
      *
      * @param Container $c
      * @return mixed
      */
     $pimple['assetic'] = function (Container $c) {
         // initializing lazy asset manager
         if (isset($c['assetic.assets']) && is_array($c['assetic.assets']) && !empty($c['assetic.assets'])) {
             $c['assetic.lazy_asset_manager'];
         }
         return $c['assetic.factory'];
     };
     /*
      * Factory
      *
      * @param Container $c
      * @return AssetFactory
      */
     $pimple['assetic.factory'] = function (Container $c) {
         $root = isset($c['assetic.read_from']) ? $c['assetic.read_from'] : $c['assetic.write_to'];
         $factory = new AssetFactory($root, $c['assetic.debug']);
         $factory->setAssetManager($c['assetic.asset_manager']);
         $factory->setFilterManager($c['assetic.filter_manager']);
         // Optionally enable the global asset functions.
         if ($c['assetic.register_functions']) {
             assetic_init($factory);
         }
         return $factory;
     };
     /*
      * Asset writer, writes to the 'assetic.write_to' folder
      *
      * @param Container $c
      * @return AssetWriter
      */
     $pimple['assetic.asset_writer'] = function (Container $c) {
         return new AssetWriter($c['assetic.write_to']);
     };
     /*
      * Asset manager
      *
      * @return AssetManager
      */
     $pimple['assetic.asset_manager'] = function () {
         return new AssetManager();
     };
     /*
      * Filter manager
      *
      * @return FilterManager
      */
     $pimple['assetic.filter_manager'] = function () {
         return new FilterManager();
     };
     /*
      * Lazy asset manager for loading assets from $pimple['assetic.assets']
      *
      * @param Container $c
      * @return \Assetic\Factory\LazyAssetManager
      */
     $pimple['assetic.lazy.asset_manager'] = function (Container $c) {
         $lazy = new LazyAssetManager($c['assetic.factory']);
         foreach ($c['assetic.assets'] as $name => $formula) {
             $lazy->setFormula($name, $formula);
         }
         return $lazy;
     };
 }
開發者ID:bangpound,項目名稱:assetic-service-provider,代碼行數:98,代碼來源:AsseticServiceProvider.php


注:本文中的Assetic\Factory\AssetFactory::setAssetManager方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。