ConfigInterface.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <?php
  2. /*
  3. * This file is part of PHP CS Fixer.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. * Dariusz Rumiński <dariusz.ruminski@gmail.com>
  7. *
  8. * This source file is subject to the MIT license that is bundled
  9. * with this source code in the file LICENSE.
  10. */
  11. namespace PhpCsFixer;
  12. use PhpCsFixer\Fixer\FixerInterface;
  13. /**
  14. * @author Fabien Potencier <fabien@symfony.com>
  15. * @author Dariusz Rumiński <dariusz.ruminski@gmail.com>
  16. */
  17. interface ConfigInterface
  18. {
  19. /**
  20. * Returns the path to the cache file.
  21. *
  22. * @return null|string Returns null if not using cache
  23. */
  24. public function getCacheFile();
  25. /**
  26. * Returns the custom fixers to use.
  27. *
  28. * @return FixerInterface[]
  29. */
  30. public function getCustomFixers();
  31. /**
  32. * Returns files to scan.
  33. *
  34. * @return iterable|\Traversable
  35. */
  36. public function getFinder();
  37. /**
  38. * @return string
  39. */
  40. public function getFormat();
  41. /**
  42. * Returns true if progress should be hidden.
  43. *
  44. * @return bool
  45. */
  46. public function getHideProgress();
  47. /**
  48. * @return string
  49. */
  50. public function getIndent();
  51. /**
  52. * @return string
  53. */
  54. public function getLineEnding();
  55. /**
  56. * Returns the name of the configuration.
  57. *
  58. * The name must be all lowercase and without any spaces.
  59. *
  60. * @return string The name of the configuration
  61. */
  62. public function getName();
  63. /**
  64. * Get configured PHP executable, if any.
  65. *
  66. * @return null|string
  67. */
  68. public function getPhpExecutable();
  69. /**
  70. * Check if it is allowed to run risky fixers.
  71. *
  72. * @return bool
  73. */
  74. public function getRiskyAllowed();
  75. /**
  76. * Get rules.
  77. *
  78. * Keys of array are names of fixers/sets, values are true/false.
  79. *
  80. * @return array
  81. */
  82. public function getRules();
  83. /**
  84. * Returns true if caching should be enabled.
  85. *
  86. * @return bool
  87. */
  88. public function getUsingCache();
  89. /**
  90. * Adds a suite of custom fixers.
  91. *
  92. * Name of custom fixer should follow `VendorName/rule_name` convention.
  93. *
  94. * @param FixerInterface[]|iterable|\Traversable $fixers
  95. */
  96. public function registerCustomFixers($fixers);
  97. /**
  98. * Sets the path to the cache file.
  99. *
  100. * @param string $cacheFile
  101. *
  102. * @return self
  103. */
  104. public function setCacheFile($cacheFile);
  105. /**
  106. * @param iterable|string[]|\Traversable $finder
  107. *
  108. * @return self
  109. */
  110. public function setFinder($finder);
  111. /**
  112. * @param string $format
  113. *
  114. * @return self
  115. */
  116. public function setFormat($format);
  117. /**
  118. * @param bool $hideProgress
  119. *
  120. * @return self
  121. */
  122. public function setHideProgress($hideProgress);
  123. /**
  124. * @param string $indent
  125. *
  126. * @return self
  127. */
  128. public function setIndent($indent);
  129. /**
  130. * @param string $lineEnding
  131. *
  132. * @return self
  133. */
  134. public function setLineEnding($lineEnding);
  135. /**
  136. * Set PHP executable.
  137. *
  138. * @param null|string $phpExecutable
  139. *
  140. * @return self
  141. */
  142. public function setPhpExecutable($phpExecutable);
  143. /**
  144. * Set if it is allowed to run risky fixers.
  145. *
  146. * @param bool $isRiskyAllowed
  147. *
  148. * @return self
  149. */
  150. public function setRiskyAllowed($isRiskyAllowed);
  151. /**
  152. * Set rules.
  153. *
  154. * Keys of array are names of fixers or sets.
  155. * Value for set must be bool (turn it on or off).
  156. * Value for fixer may be bool (turn it on or off) or array of configuration
  157. * (turn it on and contains configuration for FixerInterface::configure method).
  158. *
  159. * @return self
  160. */
  161. public function setRules(array $rules);
  162. /**
  163. * @param bool $usingCache
  164. *
  165. * @return self
  166. */
  167. public function setUsingCache($usingCache);
  168. }