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


PHP ArcanistLintMessage::toDictionary方法代码示例

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


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

示例1: isRelevantMessage

 private final function isRelevantMessage(ArcanistLintMessage $message)
 {
     // When a user runs "arc lint", we default to raising only warnings on
     // lines they have changed (errors are still raised anywhere in the
     // file). The list of $changed lines may be null, to indicate that the
     // path is a directory or a binary file so we should not exclude
     // warnings.
     if (!$this->changedLines || $message->isError() || $message->shouldBypassChangedLineFiltering()) {
         return true;
     }
     $locations = $message->getOtherLocations();
     $locations[] = $message->toDictionary();
     foreach ($locations as $location) {
         $path = idx($location, 'path', $message->getPath());
         if (!array_key_exists($path, $this->changedLines)) {
             continue;
         }
         $changed = $this->getPathChangedLines($path);
         if ($changed === null || !$location['line']) {
             return true;
         }
         $last_line = $location['line'];
         if (isset($location['original'])) {
             $last_line += substr_count($location['original'], "\n");
         }
         for ($l = $location['line']; $l <= $last_line; $l++) {
             if (!empty($changed[$l])) {
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:fengshao0907,项目名称:arcanist,代码行数:33,代码来源:ArcanistLintEngine.php

示例2: isRelevantMessage

 private final function isRelevantMessage(ArcanistLintMessage $message)
 {
     // When a user runs "arc lint", we default to raising only warnings on
     // lines they have changed (errors are still raised anywhere in the
     // file). The list of $changed lines may be null, to indicate that the
     // path is a directory or a binary file so we should not exclude
     // warnings.
     if (!$this->changedLines || $message->isError() || $message->shouldBypassChangedLineFiltering()) {
         return true;
     }
     $locations = $message->getOtherLocations();
     $locations[] = $message->toDictionary();
     foreach ($locations as $location) {
         $path = idx($location, 'path', $message->getPath());
         if (!array_key_exists($path, $this->changedLines)) {
             if (phutil_is_windows()) {
                 // We try checking the UNIX path form as well, on Windows.  Linters
                 // store noramlized paths, which use the Windows-style "\" as a
                 // delimiter; as such, they don't match the UNIX-style paths stored
                 // in changedLines, which come from the VCS.
                 $path = str_replace('\\', '/', $path);
                 if (!array_key_exists($path, $this->changedLines)) {
                     continue;
                 }
             } else {
                 continue;
             }
         }
         $changed = $this->getPathChangedLines($path);
         if ($changed === null || !$location['line']) {
             return true;
         }
         $last_line = $location['line'];
         if (isset($location['original'])) {
             $last_line += substr_count($location['original'], "\n");
         }
         for ($l = $location['line']; $l <= $last_line; $l++) {
             if (!empty($changed[$l])) {
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:endlessm,项目名称:arcanist,代码行数:44,代码来源:ArcanistLintEngine.php


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