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


PHP Region::isEmpty方法代码示例

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


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

示例1: __construct

 public function __construct(array $diffs, $originalFileName = '', $newFileName = '', $originalTimestamp = '', $newTimestamp = '', $contextLines = 1)
 {
     $this->diffs = $diffs;
     $this->originalFileName = $originalFileName;
     $this->newfileName = $newFileName;
     $this->originalTimetamp = $originalTimestamp;
     $this->newTimestamp = $newTimestamp;
     $this->contextLines = $contextLines >= 1 ? $contextLines : 1;
     for ($currentChunk = 0; $currentChunk < count($this->diffs); $currentChunk++) {
         $this->regionMap[$currentChunk] = 0;
     }
     for ($currentChunk = 0; $currentChunk < count($this->diffs); $currentChunk++) {
         if ($this->diffs[$currentChunk] instanceof AddDiff || $this->diffs[$currentChunk] instanceof DeleteDiff) {
             $this->regionMap[$currentChunk] = 1;
             for ($currentRegion = max($currentChunk - $this->contextLines, 0); $currentRegion < $currentChunk; $currentRegion++) {
                 $this->regionMap[$currentRegion] = 1;
             }
             for ($currentRegion = min($currentChunk + $this->contextLines, count($this->diffs)); $currentRegion > $currentChunk; $currentRegion--) {
                 $this->regionMap[$currentRegion] = 1;
             }
         }
     }
     $region = new Region();
     for ($currentRegion = 0; $currentRegion < count($this->diffs); $currentRegion++) {
         if ($this->regionMap[$currentRegion] == 1) {
             $region->addDiff($this->diffs[$currentRegion]);
         } else {
             if (!$region->isEmpty()) {
                 $this->regions[$this->regionsArrayPointer++] = $region;
                 $region = new Region();
             }
         }
     }
     if (!$region->isEmpty()) {
         $this->regions[$this->regionsArrayPointer++] = $region;
     }
 }
开发者ID:brunsa2,项目名称:merge,代码行数:37,代码来源:UnifiedDiffs.php


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