當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。