SchemaLocator.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * System configuration schema locator
  4. *
  5. * Copyright © Magento, Inc. All rights reserved.
  6. * See COPYING.txt for license details.
  7. */
  8. namespace Magento\Config\Model\Config;
  9. use Magento\Framework\Module\Dir;
  10. /**
  11. * @api
  12. * @since 100.0.2
  13. */
  14. class SchemaLocator implements \Magento\Framework\Config\SchemaLocatorInterface
  15. {
  16. /**
  17. * Path to corresponding XSD file with validation rules for merged config
  18. *
  19. * @var string
  20. */
  21. protected $_schema = null;
  22. /**
  23. * Path to corresponding XSD file with validation rules for separate config files
  24. *
  25. * @var string
  26. */
  27. protected $_perFileSchema = null;
  28. /**
  29. * @param \Magento\Framework\Module\Dir\Reader $moduleReader
  30. */
  31. public function __construct(\Magento\Framework\Module\Dir\Reader $moduleReader)
  32. {
  33. $etcDir = $moduleReader->getModuleDir(\Magento\Framework\Module\Dir::MODULE_ETC_DIR, 'Magento_Config');
  34. $this->_schema = $etcDir . '/system.xsd';
  35. $this->_perFileSchema = $etcDir . '/system_file.xsd';
  36. }
  37. /**
  38. * Get path to merged config schema
  39. *
  40. * @return string|null
  41. */
  42. public function getSchema()
  43. {
  44. return $this->_schema;
  45. }
  46. /**
  47. * Get path to pre file validation schema
  48. *
  49. * @return string|null
  50. */
  51. public function getPerFileSchema()
  52. {
  53. return $this->_perFileSchema;
  54. }
  55. }