DefaultValueSupplier.php 799B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace Symfony\Bundle\AsseticBundle;
  3. use Assetic\ValueSupplierInterface;
  4. use Symfony\Component\DependencyInjection\ContainerInterface;
  5. /**
  6. * Default Value Supplier.
  7. *
  8. * @author Johannes M. Schmitt <schmittjoh@gmail.com>
  9. */
  10. class DefaultValueSupplier implements ValueSupplierInterface
  11. {
  12. protected $container;
  13. public function __construct(ContainerInterface $container)
  14. {
  15. $this->container = $container;
  16. }
  17. public function getValues()
  18. {
  19. if (!$this->container->isScopeActive('request')) {
  20. return array();
  21. }
  22. $request = $this->container->get('request');
  23. return array(
  24. 'locale' => $request->getLocale(),
  25. 'env' => $this->container->getParameter('kernel.environment'),
  26. );
  27. }
  28. }