GeneratorConfig.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  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 Symfony\Component\Intl\Data\Generator;
  11. use Symfony\Component\Intl\Data\Bundle\Writer\BundleWriterInterface;
  12. /**
  13. * Stores contextual information for resource bundle generation.
  14. *
  15. * @author Bernhard Schussek <bschussek@gmail.com>
  16. *
  17. * @internal
  18. */
  19. class GeneratorConfig
  20. {
  21. /**
  22. * @var string
  23. */
  24. private $sourceDir;
  25. /**
  26. * @var string
  27. */
  28. private $icuVersion;
  29. /**
  30. * @var BundleWriterInterface[]
  31. */
  32. private $bundleWriters = array();
  33. public function __construct($sourceDir, $icuVersion)
  34. {
  35. $this->sourceDir = $sourceDir;
  36. $this->icuVersion = $icuVersion;
  37. }
  38. /**
  39. * Adds a writer to be used during the data conversion.
  40. *
  41. * @param string $targetDir The output directory
  42. * @param BundleWriterInterface $writer The writer instance
  43. */
  44. public function addBundleWriter($targetDir, BundleWriterInterface $writer)
  45. {
  46. $this->bundleWriters[$targetDir] = $writer;
  47. }
  48. /**
  49. * Returns the writers indexed by their output directories.
  50. *
  51. * @return BundleWriterInterface[]
  52. */
  53. public function getBundleWriters()
  54. {
  55. return $this->bundleWriters;
  56. }
  57. /**
  58. * Returns the directory where the source versions of the resource bundles
  59. * are stored.
  60. *
  61. * @return string An absolute path to a directory
  62. */
  63. public function getSourceDir()
  64. {
  65. return $this->sourceDir;
  66. }
  67. /**
  68. * Returns the ICU version of the bundles being converted.
  69. *
  70. * @return string The ICU version string
  71. */
  72. public function getIcuVersion()
  73. {
  74. return $this->icuVersion;
  75. }
  76. }