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


PHP PHP_CodeSniffer::realpath方法代码示例

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


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

示例1: processUnknownArgument

 /**
  * Processes an unknown command line argument.
  *
  * Assumes all unknown arguments are files and folders to check.
  *
  * @param string $arg The command line argument.
  * @param int    $pos The position of the argument on the command line.
  *
  * @return void
  */
 public function processUnknownArgument($arg, $pos)
 {
     $file = PHP_CodeSniffer::realpath($arg);
     if (file_exists($file) === false) {
         if ($this->dieOnUnknownArg === false) {
             return;
         }
         echo 'ERROR: The file "' . $arg . '" does not exist.' . PHP_EOL . PHP_EOL;
         $this->printUsage();
         exit(2);
     } else {
         $this->values['files'][] = $file;
     }
 }
开发者ID:eduardobenito10,项目名称:jenkins-php-quickstart,代码行数:24,代码来源:CLI.php

示例2: processUnknownArgument

 /**
  * Processes an unknown command line argument.
  *
  * Assumes all unknown arguments are files and folders to check.
  *
  * @param string $arg The command line argument.
  * @param int    $pos The position of the argument on the command line.
  *
  * @return void
  */
 public function processUnknownArgument($arg, $pos)
 {
     // We don't know about any additional switches; just files.
     if ($arg[0] === '-') {
         if ($this->dieOnUnknownArg === false) {
             return;
         }
         echo 'ERROR: option "' . $arg . '" not known.' . PHP_EOL . PHP_EOL;
         $this->printUsage();
         exit(2);
     }
     $file = PHP_CodeSniffer::realpath($arg);
     if (file_exists($file) === false) {
         if ($this->dieOnUnknownArg === false) {
             return;
         }
         echo 'ERROR: The file "' . $arg . '" does not exist.' . PHP_EOL . PHP_EOL;
         $this->printUsage();
         exit(2);
     } else {
         $this->values['files'][] = $file;
     }
 }
开发者ID:ghermans,项目名称:PHP_CodeSniffer,代码行数:33,代码来源:CLI.php

示例3: processUnknownArgument

 /**
  * Processes an unknown command line argument.
  *
  * Assumes all unknown arguments are files and folders to check.
  *
  * @param string $arg The command line argument.
  * @param int    $pos The position of the argument on the command line.
  *
  * @return void
  */
 public function processUnknownArgument($arg, $pos)
 {
     // We don't know about any additional switches; just files.
     if ($arg[0] === '-') {
         if ($this->dieOnUnknownArg === false) {
             return;
         }
         echo 'ERROR: option "' . $arg . '" not known.' . PHP_EOL . PHP_EOL;
         $this->printUsage();
         exit(2);
     }
     $file = PHP_CodeSniffer::realpath($arg);
     if (file_exists($file) === false) {
         // Check if anything was passed via STDIN.
         $read = array(STDIN);
         $write = array();
         $except = array();
         $result = stream_select($read, $write, $except, 0);
         if ($result === 1) {
             return;
         }
         if ($this->dieOnUnknownArg === false) {
             return;
         }
         echo 'ERROR: The file "' . $arg . '" does not exist.' . PHP_EOL . PHP_EOL;
         $this->printUsage();
         exit(2);
     } else {
         $this->values['files'][] = $file;
     }
 }
开发者ID:mambaru,项目名称:PHP_CodeSniffer,代码行数:41,代码来源:CLI.php


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