PHPExiftoolServiceProvider.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. * This file is part of the PHPExiftool package.
  4. *
  5. * (c) Alchemy <support@alchemy.fr>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace PHPExiftool;
  11. use Monolog\Logger;
  12. use Monolog\Handler\NullHandler;
  13. use Silex\Application;
  14. use Silex\ServiceProviderInterface;
  15. class PHPExiftoolServiceProvider implements ServiceProviderInterface
  16. {
  17. public function register(Application $app)
  18. {
  19. $app['exiftool.logger'] = $app->share(function() {
  20. $logger = new Logger('Exiftool Logger');
  21. $logger->pushHandler(new NullHandler());
  22. return $logger;
  23. });
  24. $app['exiftool.processor'] = $app->share(function(Application $app) {
  25. return new Exiftool($app['exiftool.logger']);
  26. });
  27. $app['exiftool.reader'] = $app->share(function(Application $app) {
  28. return new Reader($app['exiftool.processor'], new RDFParser());
  29. });
  30. $app['exiftool.writer'] = $app->share(function(Application $app) {
  31. return new Writer($app['exiftool.processor']);
  32. });
  33. $app['exiftool.preview-extractor'] = $app->share(function(Application $app) {
  34. return new PreviewExtractor($app['exiftool.processor']);
  35. });
  36. }
  37. public function boot(Application $app)
  38. {
  39. }
  40. }