[ Index ]
 

Code source de Symfony 1.0.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/vendor/phing/tasks/system/ -> MatchingTask.php (source)

   1  <?php
   2  /*
   3   *  $Id: MatchingTask.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  require_once 'phing/Task.php';
  23  require_once 'phing/types/selectors/SelectorContainer.php';
  24  include_once 'phing/types/FileSet.php';
  25  include_once 'phing/types/PatternSet.php';
  26  include_once 'phing/util/DirectoryScanner.php';
  27  
  28  /**
  29   * This is an abstract task that should be used by all those tasks that 
  30   * require to include or exclude files based on pattern matching.
  31   *
  32   * This is very closely based on the ANT class of the same name.
  33   * 
  34   * @author    Hans Lellelid <hans@xmpl.org> (Phing)
  35   * @author    Arnout J. Kuiper <ajkuiper@wxs.nl> (Ant)
  36   * @author    Stefano Mazzocchi  <stefano@apache.org> (Ant)
  37   * @author    Sam Ruby <rubys@us.ibm.com> (Ant)
  38   * @author    Jon S. Stevens <jon@clearink.com> (Ant
  39   * @author    Stefan Bodewig <stefan.bodewig@epost.de> (Ant)
  40   * @author    Bruce Atherton <bruce@callenish.com> (Ant)
  41   * @version   $Revision: 1.4 $
  42   * @package   phing.tasks.system
  43   */
  44  abstract class MatchingTask extends Task implements SelectorContainer {
  45  
  46      /** @var boolean */
  47      protected $useDefaultExcludes = true;
  48      
  49      /** @var FileSet */
  50      protected $fileset;
  51      
  52      /**
  53       * Create instance; set fileset to new FileSet.
  54       */
  55      public function __construct() {
  56          $this->fileset = new FileSet();
  57      }
  58      
  59      /**
  60       * @see ProjectComponent::setProject()
  61       */
  62      public function setProject(Project $project) {
  63          parent::setProject($project);
  64          $this->fileset->setProject($project);
  65      }
  66  
  67      /**
  68       * add a name entry on the include list
  69       * @return PatternSetNameEntry
  70       */
  71      public function createInclude() {
  72          return $this->fileset->createInclude();
  73      }
  74  
  75      /**
  76       * add a name entry on the include files list
  77       * @return PatternSetNameEntry
  78       */
  79      public function createIncludesFile() {
  80          return $this->fileset->createIncludesFile();
  81      }
  82  
  83      /**
  84       * add a name entry on the exclude list
  85       * @return PatternSetNameEntry
  86       */
  87      public function createExclude() {
  88          return $this->fileset->createExclude();
  89      }
  90  
  91      /**
  92       * add a name entry on the include files list
  93       * @return PatternSetNameEntry
  94       */
  95      public function createExcludesFile() {
  96          return $this->fileset->createExcludesFile();
  97      }
  98  
  99      /**
 100       * add a set of patterns
 101       * @return PatternSet
 102       */
 103      public function createPatternSet() {
 104          return $this->fileset->createPatternSet();
 105      }
 106  
 107      /**
 108       * Sets the set of include patterns. Patterns may be separated by a comma
 109       * or a space.
 110       *
 111       * @param string $includes the string containing the include patterns
 112       * @return void
 113       */
 114      public function setIncludes($includes) {
 115          $this->fileset->setIncludes($includes);
 116      }    
 117  
 118      /**
 119       * Sets the set of exclude patterns. Patterns may be separated by a comma
 120       * or a space.
 121       *
 122       * @param string $excludes the string containing the exclude patterns
 123       */
 124      public function setExcludes($excludes) {
 125          $this->fileset->setExcludes($excludes);
 126      }
 127  
 128      
 129      /**
 130       * Sets whether default exclusions should be used or not.
 131       *
 132       * @param boolean $useDefaultExcludes "true"|"on"|"yes" when default exclusions
 133       *                           should be used, "false"|"off"|"no" when they
 134       *                           shouldn't be used.
 135       */
 136      public function setDefaultexcludes($useDefaultExcludes) {
 137          $this->useDefaultExcludes = (boolean) $useDefaultExcludes;
 138      }
 139  
 140      /**
 141       * Returns the directory scanner needed to access the files to process.
 142       * @return DirectoryScanner
 143       */
 144      protected function getDirectoryScanner(PhingFile $baseDir) {
 145          $this->fileset->setDir($baseDir);
 146          $this->fileset->setDefaultexcludes($this->useDefaultExcludes);
 147          return $this->fileset->getDirectoryScanner($this->project);
 148      }
 149  
 150      /**
 151       * Sets the name of the file containing the includes patterns.
 152       *
 153       * @param PhingFile $includesfile A string containing the filename to fetch
 154       * the include patterns from.
 155       * @return void
 156       */
 157      public function setIncludesfile(PhingFile $includesfile) {
 158          $this->fileset->setIncludesfile(includesfile);
 159      }
 160  
 161      /**
 162       * Sets the name of the file containing the includes patterns.
 163       *
 164       * @param PhingFile $excludesfile A string containing the filename to fetch
 165       * the include patterns from.
 166       * @return void
 167       */
 168      public function setExcludesfile(PhingFile $excludesfile) {
 169          $this->fileset->setExcludesfile($excludesfile);
 170      }
 171  
 172      /**
 173       * Sets case sensitivity of the file system
 174       *
 175       * @param boolean $isCaseSensitive "true"|"on"|"yes" if file system is case
 176       *                           sensitive, "false"|"off"|"no" when not.
 177       * @return void
 178       */
 179      public function setCaseSensitive($isCaseSensitive) {
 180          $this->fileset->setCaseSensitive($isCaseSensitive);
 181      }
 182  
 183      /**
 184       * Sets whether or not symbolic links should be followed.
 185       *
 186       * @param boolean $followSymlinks whether or not symbolic links should be followed
 187       * @return void
 188       */
 189      public function setFollowSymlinks($followSymlinks) {
 190          $this->fileset->setFollowSymlinks($followSymlinks);
 191      }
 192  
 193      /**
 194       * Indicates whether there are any selectors here.
 195       *
 196       * @return boolean Whether any selectors are in this container
 197       */
 198      public function hasSelectors() {
 199          return $this->fileset->hasSelectors();
 200      }
 201  
 202      /**
 203       * Gives the count of the number of selectors in this container
 204       *
 205       * @return int The number of selectors in this container
 206       */
 207      public function selectorCount() {
 208          return $this->fileset->selectorCount();
 209      }
 210  
 211      /**
 212       * Returns the set of selectors as an array.
 213       *
 214       * @return array FileSelector[] An array of selectors in this container
 215       */
 216      public function getSelectors(Project $p) {
 217          return $this->fileset->getSelectors($p);
 218      }
 219  
 220      /**
 221       * Returns an enumerator for accessing the set of selectors.
 222       *
 223       * @return an enumerator that goes through each of the selectors
 224       */
 225      public function selectorElements() {
 226          return $this->fileset->selectorElements();
 227      }
 228  
 229      /**
 230       * Add a new selector into this container.
 231       *
 232       * @param FileSelector $selector the new selector to add
 233       * @return void
 234       */
 235      public function appendSelector(FileSelector $selector) {
 236          $this->fileset->appendSelector($selector);
 237      }
 238  
 239      /* Methods below all add specific selectors */
 240  
 241      /**
 242       * add a "Select" selector entry on the selector list
 243       * @return SelectSelector
 244       */
 245      public function createSelector() {
 246          return $this->fileset->createSelector();
 247      }
 248  
 249      /**
 250       * add an "And" selector entry on the selector list
 251       * @return AndSelector
 252       */
 253      public function createAnd() {
 254          return $this->fileset->createAnd();
 255      }
 256  
 257      /**
 258       * add an "Or" selector entry on the selector list
 259       * @return void
 260       */
 261      public function createOr() {
 262          return $this->fileset->createOr();
 263      }
 264  
 265      /**
 266       * add a "Not" selector entry on the selector list
 267       * @return NotSelector
 268       */
 269      public function createNot() {
 270          return $this->fileset->createNot();
 271      }
 272  
 273      /**
 274       * add a "None" selector entry on the selector list
 275       * @return NoneSelector
 276       */
 277      public function createNone() {
 278          return $this->fileset->createNone();
 279      }
 280  
 281      /**
 282       * add a majority selector entry on the selector list
 283       * @return MajoritySelector
 284       */
 285      public function createMajority() {
 286          return $this->fileset->createMajority();
 287      }
 288  
 289      /**
 290       * add a selector date entry on the selector list
 291       * @return DateSelector
 292       */
 293      public function createDate() {
 294          return $this->fileset->addDate();
 295      }
 296  
 297      /**
 298       * add a selector size entry on the selector list
 299       * @return SizeSelector
 300       */
 301      public function createSize() {
 302          return $this->fileset->createSize();
 303      }
 304  
 305      /**
 306       * add a selector filename entry on the selector list
 307       * @return FilenameSelector
 308       */
 309      public function createFilename() {
 310          return $this->fileset->createFilename();
 311      }
 312  
 313      /**
 314       * add an extended selector entry on the selector list
 315       * @return ExtendSelector
 316       */
 317      public function createCustom() {
 318          return $this->fileset->createCustom();
 319      }
 320  
 321      /**
 322       * add a contains selector entry on the selector list
 323       * @return ContainsSelector
 324       */
 325      public function createContains() {
 326          return $this->fileset->createContains();
 327      }
 328  
 329      /**
 330       * add a present selector entry on the selector list
 331       * @return PresentSelector
 332       */
 333      public function createPresent() {
 334          return $this->fileset->createPresent();
 335      }
 336  
 337      /**
 338       * add a depth selector entry on the selector list
 339       * @return DepthSelector
 340       */
 341      public function createDepth() {
 342          return $this->fileset->createDepth();
 343      }
 344  
 345      /**
 346       * add a depends selector entry on the selector list
 347       * @return DependSelector
 348       */
 349      public function createDepend() {
 350          return $this->fileset->createDepend();
 351      }
 352  
 353      /**
 354       * Accessor for the implict fileset.
 355       *
 356       * @return FileSet
 357       */
 358      protected final function getImplicitFileSet() {
 359          return $this->fileset;
 360      }
 361  }


Généré le : Fri Mar 16 22:42:14 2007 par Balluche grâce à PHPXref 0.7