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


PHP Phing::getOutputStream方法代码示例

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


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

示例1: main

 /**
  *  Run the task.
  *
  * @throws BuildException  trouble, probably file IO
  */
 public function main()
 {
     if ($this->prefix != null && $this->regex != null) {
         throw new BuildException("Please specify either prefix or regex, but not both", $this->getLocation());
     }
     //copy the properties file
     $allProps = array();
     /* load properties from file if specified, otherwise use Phing's properties */
     if ($this->inFile == null) {
         // add phing properties
         $allProps = $this->getProject()->getProperties();
     } elseif ($this->inFile != null) {
         if ($this->inFile->exists() && $this->inFile->isDirectory()) {
             $message = "srcfile is a directory!";
             $this->failOnErrorAction(null, $message, Project::MSG_ERR);
             return;
         }
         if ($this->inFile->exists() && !$this->inFile->canRead()) {
             $message = "Can not read from the specified srcfile!";
             $this->failOnErrorAction(null, $message, Project::MSG_ERR);
             return;
         }
         try {
             $props = new Properties();
             $props->load(new PhingFile($this->inFile));
             $allProps = $props->getProperties();
         } catch (IOException $ioe) {
             $message = "Could not read file " . $this->inFile->getAbsolutePath();
             $this->failOnErrorAction($ioe, $message, Project::MSG_WARN);
             return;
         }
     }
     $os = null;
     try {
         if ($this->destfile == null) {
             $os = Phing::getOutputStream();
             $this->saveProperties($allProps, $os);
             $this->log($os, Project::MSG_INFO);
         } else {
             if ($this->destfile->exists() && $this->destfile->isDirectory()) {
                 $message = "destfile is a directory!";
                 $this->failOnErrorAction(null, $message, Project::MSG_ERR);
                 return;
             }
             if ($this->destfile->exists() && !$this->destfile->canWrite()) {
                 $message = "Can not write to the specified destfile!";
                 $this->failOnErrorAction(null, $message, Project::MSG_ERR);
                 return;
             }
             $os = new FileOutputStream($this->destfile);
             $this->saveProperties($allProps, $os);
         }
     } catch (IOException $ioe) {
         $this->failOnErrorAction($ioe);
     }
 }
开发者ID:TheTypoMaster,项目名称:SPHERE-Framework,代码行数:61,代码来源:EchoProperties.php

示例2: main

 /**
  * Execute the task.
  * This delegates to the Diagnostics class.
  * @throws BuildException on error.
  */
 public function main()
 {
     Diagnostics::doReport(new PrintStream(Phing::getOutputStream()));
 }
开发者ID:Ingewikkeld,项目名称:phing,代码行数:9,代码来源:DiagnosticsTask.php


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