SchemaLocator.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Webapi\Model\Config;
  7. use Magento\Framework\Module\Dir;
  8. /**
  9. * Web API 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. $this->_schema = $moduleReader->getModuleDir(Dir::MODULE_ETC_DIR, 'Magento_Webapi') . '/webapi.xsd';
  31. }
  32. /**
  33. * Get path to merged config schema
  34. *
  35. * @return string|null
  36. */
  37. public function getSchema()
  38. {
  39. return $this->_schema;
  40. }
  41. /**
  42. * Get path to per file validation schema
  43. *
  44. * @return string|null
  45. */
  46. public function getPerFileSchema()
  47. {
  48. return $this->_perFileSchema;
  49. }
  50. }