SchemaLocator.php 1.3 KB

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