~ubuntu-branches/ubuntu/wily/phabricator/wily

« back to all changes in this revision

Viewing changes to src/lint/linter/ArcanistFutureLinter.php

  • Committer: Package Import Robot
  • Author(s): Richard Sellam
  • Date: 2014-11-01 23:20:06 UTC
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: package-import@ubuntu.com-20141101232006-mvlnp0cil67tsboe
Tags: upstream-0~git20141101/arcanist
Import upstream version 0~git20141101, component arcanist

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
abstract class ArcanistFutureLinter extends ArcanistLinter {
 
4
 
 
5
  private $futures;
 
6
 
 
7
  abstract protected function buildFutures(array $paths);
 
8
  abstract protected function resolveFuture($path, Future $future);
 
9
 
 
10
  final protected function getFuturesLimit() {
 
11
    return 8;
 
12
  }
 
13
 
 
14
  final public function willLintPaths(array $paths) {
 
15
    $limit = $this->getFuturesLimit();
 
16
    $this->futures = Futures(array())->limit($limit);
 
17
    foreach ($this->buildFutures($paths) as $path => $future) {
 
18
      $this->futures->addFuture($future, $path);
 
19
    }
 
20
  }
 
21
 
 
22
  final public function lintPath($path) {}
 
23
 
 
24
  final public function didRunLinters() {
 
25
    if ($this->futures) {
 
26
      foreach ($this->futures as $path => $future) {
 
27
        $this->willLintPath($path);
 
28
        $this->resolveFuture($path, $future);
 
29
      }
 
30
    }
 
31
  }
 
32
 
 
33
}