RegexpEngine.php 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. /*
  3. * $Id: RegexpEngine.php 905 2010-10-05 16:28:03Z mrook $
  4. *
  5. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  6. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  7. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  8. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  9. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  10. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  11. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  12. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  13. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  14. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  15. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  16. *
  17. * This software consists of voluntary contributions made by many individuals
  18. * and is licensed under the LGPL. For more information please see
  19. * <http://phing.info>.
  20. */
  21. /**
  22. * Contains some shared attributes and methods -- and some abstract methods with
  23. * engine-specific implementations that sub-classes must override.
  24. *
  25. * @author Hans Lellelid <hans@velum.net>
  26. * @package phing.util.regex
  27. * @version $Revision: 905 $
  28. */
  29. interface RegexpEngine {
  30. /**
  31. * Sets whether or not regex operation should ingore case.
  32. * @param boolean $bit
  33. * @return void
  34. */
  35. public function setIgnoreCase($bit);
  36. /**
  37. * Returns status of ignore case flag.
  38. * @return boolean
  39. */
  40. public function getIgnoreCase();
  41. /**
  42. * Matches pattern against source string and sets the matches array.
  43. * @param string $pattern The regex pattern to match.
  44. * @param string $source The source string.
  45. * @param array $matches The array in which to store matches.
  46. * @return boolean Success of matching operation.
  47. */
  48. function match($pattern, $source, &$matches);
  49. /**
  50. * Matches all patterns in source string and sets the matches array.
  51. * @param string $pattern The regex pattern to match.
  52. * @param string $source The source string.
  53. * @param array $matches The array in which to store matches.
  54. * @return boolean Success of matching operation.
  55. */
  56. function matchAll($pattern, $source, &$matches);
  57. /**
  58. * Replaces $pattern with $replace in $source string.
  59. * @param string $pattern The regex pattern to match.
  60. * @param string $replace The string with which to replace matches.
  61. * @param string $source The source string.
  62. * @return string The replaced source string.
  63. */
  64. function replace($pattern, $replace, $source);
  65. }