当前位置: 首页>>代码示例>>PHP>>正文


PHP PhingFile::isAbsolute方法代码示例

本文整理汇总了PHP中PhingFile::isAbsolute方法的典型用法代码示例。如果您正苦于以下问题:PHP PhingFile::isAbsolute方法的具体用法?PHP PhingFile::isAbsolute怎么用?PHP PhingFile::isAbsolute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhingFile的用法示例。


在下文中一共展示了PhingFile::isAbsolute方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: initialize

 /**
  * Scans the parameters list for the "lines" parameter and uses
  * it to set the number of lines to be returned in the filtered stream.
  * also scan for skip parameter.
  *
  * @throws BuildException
  */
 private function initialize()
 {
     // get parameters
     $params = $this->getParameters();
     if ($params !== null) {
         /** @var Parameter $param */
         foreach ($params as $param) {
             if ('prepend' === $param->getName()) {
                 $this->setPrepend(new PhingFile($param->getValue()));
                 continue;
             }
             if ('append' === $param->getName()) {
                 $this->setAppend(new PhingFile($param->getValue()));
                 continue;
             }
         }
     }
     if ($this->prepend !== null) {
         if (!$this->prepend->isAbsolute()) {
             $this->prepend = new PhingFile($this->getProject()->getBasedir(), $this->prepend->getPath());
         }
         $this->prependReader = new BufferedReader(new FileReader($this->prepend));
     }
     if ($this->append !== null) {
         if (!$this->append->isAbsolute()) {
             $this->append = new PhingFile($this->getProject()->getBasedir(), $this->append->getPath());
         }
         $this->appendReader = new BufferedReader(new FileReader($this->append));
     }
 }
开发者ID:Ingewikkeld,项目名称:phing,代码行数:37,代码来源:ConcatFilter.php

示例2: init

 /**
  * Executes initialization actions required to setup the project. Usually
  * this method handles the attributes of a tag.
  *
  * @param  string  the tag that comes in
  * @param  array   attributes the tag carries
  * @param  object  the ProjectConfigurator object
  * @throws ExpatParseException if attributes are incomplete or invalid
  * @access public
  */
 function init($tag, $attrs)
 {
     $def = null;
     $name = null;
     $id = null;
     $desc = null;
     $baseDir = null;
     // some shorthands
     $project = $this->configurator->project;
     $buildFileParent = $this->configurator->buildFileParent;
     foreach ($attrs as $key => $value) {
         if ($key === "default") {
             $def = $value;
         } elseif ($key === "name") {
             $name = $value;
         } elseif ($key === "id") {
             $id = $value;
         } elseif ($key === "basedir") {
             $baseDir = $value;
         } elseif ($key === "description") {
             $desc = $value;
         } else {
             throw new ExpatParseException("Unexpected attribute '{$key}'");
         }
     }
     if ($def === null) {
         throw new ExpatParseException("The default attribute of project is required");
     }
     $project->setDefaultTarget($def);
     if ($name !== null) {
         $project->setName($name);
         $project->addReference($name, $project);
     }
     if ($id !== null) {
         $project->addReference($id, $project);
     }
     if ($desc !== null) {
         $project->setDescription($desc);
     }
     if ($project->getProperty("project.basedir") !== null) {
         $project->setBasedir($project->getProperty("project.basedir"));
     } else {
         if ($baseDir === null) {
             $project->setBasedir($buildFileParent->getAbsolutePath());
         } else {
             // check whether the user has specified an absolute path
             $f = new PhingFile($baseDir);
             if ($f->isAbsolute()) {
                 $project->setBasedir($baseDir);
             } else {
                 $project->setBaseDir($project->resolveFile($baseDir, $buildFileParent));
             }
         }
     }
 }
开发者ID:pmoutet,项目名称:navinum,代码行数:65,代码来源:ProjectHandler.php

示例3: _checkFile1

 /**
  * @param PhingFile $file
  * @return bool
  * @throws IOException
  */
 private function _checkFile1(PhingFile $file)
 {
     // Resolve symbolic links
     if ($this->followSymlinks && $file->isLink()) {
         $linkTarget = new PhingFile($file->getLinkTarget());
         if ($linkTarget->isAbsolute()) {
             $file = $linkTarget;
         } else {
             $fs = FileSystem::getFileSystem();
             $file = new PhingFile($fs->resolve($fs->normalize($file->getParent()), $fs->normalize($file->getLinkTarget())));
         }
     }
     if ($this->type !== null) {
         if ($this->type === "dir") {
             return $file->isDirectory();
         } else {
             if ($this->type === "file") {
                 return $file->isFile();
             }
         }
     }
     return $file->exists();
 }
开发者ID:Ingewikkeld,项目名称:phing,代码行数:28,代码来源:AvailableTask.php

示例4: _getFullPath

 private function _getFullPath($filename)
 {
     $file = new PhingFile($filename);
     if (!$file->isAbsolute()) {
         $file = new PhingFile($this->project->getBasedir(), $filename);
     }
     $result = $file->getPath();
     return $result;
 }
开发者ID:sergeytsivin,项目名称:haru,代码行数:9,代码来源:GenerateFileTask.php

示例5: init

 /**
  * Executes initialization actions required to setup the project. Usually
  * this method handles the attributes of a tag.
  *
  * @param  string  the tag that comes in
  * @param  array   attributes the tag carries
  * @param  object  the ProjectConfigurator object
  * @throws ExpatParseException if attributes are incomplete or invalid
  * @access public
  */
 function init($tag, $attrs)
 {
     $def = null;
     $name = null;
     $id = null;
     $desc = null;
     $baseDir = null;
     $ver = null;
     // some shorthands
     $project = $this->configurator->project;
     $buildFileParent = $this->configurator->buildFileParent;
     foreach ($attrs as $key => $value) {
         if ($key === "default") {
             $def = $value;
         } elseif ($key === "name") {
             $name = $value;
         } elseif ($key === "id") {
             $id = $value;
         } elseif ($key === "basedir") {
             $baseDir = $value;
         } elseif ($key === "description") {
             $desc = $value;
         } elseif ($key === "phingVersion") {
             $ver = $value;
         } else {
             throw new ExpatParseException("Unexpected attribute '{$key}'");
         }
     }
     // these things get done no matter what
     if (null != $name) {
         $canonicalName = self::canonicalName($name);
         $this->configurator->setCurrentProjectName($canonicalName);
         $path = (string) $this->configurator->getBuildFile();
         $project->setUserProperty("phing.file.{$canonicalName}", $path);
         $project->setUserProperty("phing.dir.{$canonicalName}", dirname($path));
     }
     if (!$this->configurator->isIgnoringProjectTag()) {
         if ($def === null) {
             throw new ExpatParseException("The default attribute of project is required");
         }
         $project->setDefaultTarget($def);
         if ($name !== null) {
             $project->setName($name);
             $project->addReference($name, $project);
         }
         if ($id !== null) {
             $project->addReference($id, $project);
         }
         if ($desc !== null) {
             $project->setDescription($desc);
         }
         if ($ver !== null) {
             $project->setPhingVersion($ver);
         }
         if ($project->getProperty("project.basedir") !== null) {
             $project->setBasedir($project->getProperty("project.basedir"));
         } else {
             if ($baseDir === null) {
                 $project->setBasedir($buildFileParent->getAbsolutePath());
             } else {
                 // check whether the user has specified an absolute path
                 $f = new PhingFile($baseDir);
                 if ($f->isAbsolute()) {
                     $project->setBasedir($baseDir);
                 } else {
                     $project->setBaseDir($project->resolveFile($baseDir, new PhingFile(getcwd())));
                 }
             }
         }
     }
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:81,代码来源:ProjectHandler.php

示例6: main

 /**
  * Parse a Phing build file and copy the properties, tasks, data types and
  * targets it defines into the current project.
  *
  * @throws BuildException
  * @return void
  */
 public function main()
 {
     if ($this->getOwningTarget() == null || $this->getOwningTarget()->getName() != '') {
         throw new BuildException("import only allowed as a top-level task");
     }
     // Single file.
     if ($this->file !== null) {
         $file = new PhingFile($this->file);
         if (!$file->isAbsolute()) {
             $file = new PhingFile($this->project->getBasedir(), $this->file);
         }
         if (!$file->exists()) {
             $msg = "Unable to find build file: {$file->getPath()}";
             if ($this->optional) {
                 $this->log($msg . '... skipped');
                 return;
             } else {
                 throw new BuildException($msg);
             }
         }
         $this->importFile($file);
     }
     // Filesets.
     $total_files = 0;
     $total_dirs = 0;
     foreach ($this->filesets as $fs) {
         $ds = $fs->getDirectoryScanner($this->project);
         $fromDir = $fs->getDir($this->project);
         $srcFiles = $ds->getIncludedFiles();
         $srcDirs = $ds->getIncludedDirectories();
         $filecount = count($srcFiles);
         $total_files = $total_files + $filecount;
         for ($j = 0; $j < $filecount; $j++) {
             $this->importFile(new PhingFile($fromDir, $srcFiles[$j]));
         }
         $dircount = count($srcDirs);
         $total_dirs = $total_dirs + $dircount;
         for ($j = 0; $j < $dircount; $j++) {
             $this->importFile(new PhingFile($fromDir, $srcDirs[$j]));
         }
     }
 }
开发者ID:alangalipaud,项目名称:ProjetQCM,代码行数:49,代码来源:ImportTask.php

示例7: main

 /**
  * Parse a Phing build file and copy the properties, tasks, data types and 
  * targets it defines into the current project.
  *
  * @return void
  */
 public function main()
 {
     if (!isset($this->file)) {
         throw new BuildException("Missing attribute 'file'");
     }
     $file = new PhingFile($this->file);
     if (!$file->isAbsolute()) {
         $file = new PhingFile($this->project->getBasedir(), $this->file);
     }
     if (!$file->exists()) {
         $msg = "Unable to find build file: {$file->getPath()}";
         if ($this->optional) {
             $this->log($msg . '... skipped');
             return;
         } else {
             throw new BuildException($msg);
         }
     }
     $ctx = $this->project->getReference("phing.parsing.context");
     $cfg = $ctx->getConfigurator();
     if (null !== $cfg && $cfg->isParsing()) {
         // because there isn't a top level implicit target in phing like there is
         // in Ant 1.6, we will be called as soon as our xml is parsed. This isn't
         // really what we want to have happen. Instead we will register ourself
         // with the parse context to be called at the end of the current file's
         // parse phase.
         $cfg->delayTaskUntilParseEnd($this);
     } else {
         // Import xml file into current project scope
         // Since this is delayed until after the importing file has been
         // processed, the properties and targets of this new file may not take
         // effect if they have alreday been defined in the outer scope.
         $this->log("Importing configuration from {$file->getName()}", Project::MSG_VERBOSE);
         ProjectConfigurator::configureProject($this->project, $file);
         $this->log("Configuration imported.", Project::MSG_VERBOSE);
     }
 }
开发者ID:sergeytsivin,项目名称:haru,代码行数:43,代码来源:ImportTask.php

示例8: main

 /**
  * Parse a Phing build file and copy the properties, tasks, data types and
  * targets it defines into the current project.
  *
  * @throws BuildException
  * @return void
  */
 public function main()
 {
     if (!isset($this->file)) {
         throw new BuildException("Missing attribute 'file'");
     }
     if ($this->getOwningTarget() == null || $this->getOwningTarget()->getName() != '') {
         throw new BuildException("import only allowed as a top-level task");
     }
     $file = new PhingFile($this->file);
     if (!$file->isAbsolute()) {
         $file = new PhingFile($this->project->getBasedir(), $this->file);
     }
     if (!$file->exists()) {
         $msg = "Unable to find build file: {$file->getPath()}";
         if ($this->optional) {
             $this->log($msg . '... skipped');
             return;
         } else {
             throw new BuildException($msg);
         }
     }
     $ctx = $this->project->getReference("phing.parsing.context");
     $cfg = $ctx->getConfigurator();
     // Import xml file into current project scope
     // Since this is delayed until after the importing file has been
     // processed, the properties and targets of this new file may not take
     // effect if they have alreday been defined in the outer scope.
     $this->log("Importing file from {$file->getAbsolutePath()}", Project::MSG_VERBOSE);
     ProjectConfigurator::configureProject($this->project, $file);
 }
开发者ID:codebubb,项目名称:web_ssh,代码行数:37,代码来源:ImportTask.php


注:本文中的PhingFile::isAbsolute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。