IConfigurable.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace clagiordano\weblibs\configmanager;
  3. use RuntimeException;
  4. /**
  5. * Class ConfigManager, class for easily read and access to php config array file.
  6. * @package clagiordano\weblibs\configmanager
  7. */
  8. interface IConfigurable
  9. {
  10. /**
  11. * Load config data from file and store it into internal property
  12. *
  13. * @param null|string $configFilePath
  14. *
  15. * @return IConfigurable
  16. */
  17. public function loadConfig($configFilePath = null);
  18. /**
  19. * Prepare and write config file on disk
  20. *
  21. * @param null|string $configFilePath
  22. * @param bool $autoReloadConfig
  23. *
  24. * @return IConfigurable
  25. * @throws RuntimeException
  26. */
  27. public function saveConfigFile($configFilePath = null, $autoReloadConfig = false);
  28. /**
  29. * Get value from config data throught keyValue path
  30. *
  31. * @param string $configPath
  32. * @param mixed $defaultValue
  33. *
  34. * @return mixed
  35. */
  36. public function getValue($configPath, $defaultValue = null);
  37. /**
  38. * Check if exist required config for keyValue
  39. *
  40. * @param string $keyValue
  41. *
  42. * @return mixed
  43. */
  44. public function existValue($keyValue);
  45. /**
  46. * Set value in config path
  47. *
  48. * @param string $configPath
  49. * @param mixed $newValue
  50. *
  51. * @return IConfigurable
  52. */
  53. public function setValue($configPath, $newValue);
  54. }