| 1 |
lars |
1 |
<?php
|
|
|
2 |
/*
|
|
|
3 |
* $Id: RegexpEngine.php 325 2007-12-20 15:44:58Z hans $
|
|
|
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 |
/**
|
|
|
23 |
* Contains some shared attributes and methods -- and some abstract methods with
|
|
|
24 |
* engine-specific implementations that sub-classes must override.
|
|
|
25 |
*
|
|
|
26 |
* @author Hans Lellelid <hans@velum.net>
|
|
|
27 |
* @package phing.util.regex
|
|
|
28 |
* @version $Revision: 1.4 $
|
|
|
29 |
*/
|
|
|
30 |
interface RegexpEngine {
|
|
|
31 |
|
|
|
32 |
/**
|
|
|
33 |
* Sets whether or not regex operation should ingore case.
|
|
|
34 |
* @param boolean $bit
|
|
|
35 |
* @return void
|
|
|
36 |
*/
|
|
|
37 |
public function setIgnoreCase($bit);
|
|
|
38 |
|
|
|
39 |
/**
|
|
|
40 |
* Returns status of ignore case flag.
|
|
|
41 |
* @return boolean
|
|
|
42 |
*/
|
|
|
43 |
public function getIgnoreCase();
|
|
|
44 |
|
|
|
45 |
/**
|
|
|
46 |
* Matches pattern against source string and sets the matches array.
|
|
|
47 |
* @param string $pattern The regex pattern to match.
|
|
|
48 |
* @param string $source The source string.
|
|
|
49 |
* @param array $matches The array in which to store matches.
|
|
|
50 |
* @return boolean Success of matching operation.
|
|
|
51 |
*/
|
|
|
52 |
function match($pattern, $source, &$matches);
|
|
|
53 |
|
|
|
54 |
/**
|
|
|
55 |
* Matches all patterns in source string and sets the matches array.
|
|
|
56 |
* @param string $pattern The regex pattern to match.
|
|
|
57 |
* @param string $source The source string.
|
|
|
58 |
* @param array $matches The array in which to store matches.
|
|
|
59 |
* @return boolean Success of matching operation.
|
|
|
60 |
*/
|
|
|
61 |
function matchAll($pattern, $source, &$matches);
|
|
|
62 |
|
|
|
63 |
/**
|
|
|
64 |
* Replaces $pattern with $replace in $source string.
|
|
|
65 |
* @param string $pattern The regex pattern to match.
|
|
|
66 |
* @param string $replace The string with which to replace matches.
|
|
|
67 |
* @param string $source The source string.
|
|
|
68 |
* @return string The replaced source string.
|
|
|
69 |
*/
|
|
|
70 |
function replace($pattern, $replace, $source);
|
|
|
71 |
|
|
|
72 |
}
|
|
|
73 |
|