SchemaLocator.php 1.4 KB

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