[ Index ] |
|
Code source de Symfony 1.0.0 |
1 <?php 2 /* 3 * $Id: RegularExpression.php 3076 2006-12-18 08:52:12Z fabien $ 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 include_once 'phing/types/DataType.php'; 23 include_once 'phing/Project.php'; 24 include_once 'phing/util/regexp/Regexp.php'; 25 26 /* 27 * A regular expression datatype. Keeps an instance of the 28 * compiled expression for speed purposes. This compiled 29 * expression is lazily evaluated (it is compiled the first 30 * time it is needed). The syntax is the dependent on which 31 * regular expression type you are using. 32 * 33 * @author <a href="mailto:yl@seasonfive.com">Yannick Lecaillez</a> 34 * @version $Revision: 1.6 $ $Date: 2003/12/24 12:38:42 $ 35 * @access public 36 * @see phing.util.regex.RegexMatcher 37 * @package phing.types 38 */ 39 class RegularExpression extends DataType { 40 41 private $regexp = null; 42 private $ignoreCase = false; 43 44 function __construct() { 45 $this->regexp = new Regexp(); 46 } 47 48 function setPattern($pattern) { 49 $this->regexp->setPattern($pattern); 50 } 51 52 function setReplace($replace) { 53 $this->regexp->setReplace($replace); 54 } 55 56 function getPattern($p) { 57 if ( $this->isReference() ) { 58 $ref = $this->getRef($p); 59 return $ref->getPattern($p); 60 } 61 return $this->regexp->getPattern(); 62 } 63 64 function getReplace($p) { 65 if ( $this->isReference() ) { 66 $ref = $this->getRef($p); 67 return $ref->getReplace($p); 68 } 69 70 return $this->regexp->getReplace(); 71 } 72 73 function setIgnoreCase($bit) { 74 $this->regexp->setIgnoreCase($bit); 75 } 76 77 function getIgnoreCase() { 78 return $this->regexp->getIgnoreCase(); 79 } 80 81 function getRegexp(Project $p) { 82 if ( $this->isReference() ) { 83 $ref = $this->getRef($p); 84 return $ref->getRegexp($p); 85 } 86 return $this->regexp; 87 } 88 89 function getRef(Project $p) { 90 if ( !$this->checked ) { 91 $stk = array(); 92 array_push($stk, $this); 93 $this->dieOnCircularReference($stk, $p); 94 } 95 96 $o = $this->ref->getReferencedObject($p); 97 if ( !($o instanceof RegularExpression) ) { 98 throw new BuildException($this->ref->getRefId()." doesn't denote a RegularExpression"); 99 } else { 100 return $o; 101 } 102 } 103 } 104 105 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Mar 16 22:42:14 2007 | par Balluche grâce à PHPXref 0.7 |