[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/releeph/field/selector/ -> ReleephDefaultFieldSelector.php (source)

   1  <?php
   2  
   3  final class ReleephDefaultFieldSelector extends ReleephFieldSelector {
   4  
   5    /**
   6     * Determine if this install is Facebook.
   7     *
   8     * TODO: This is a giant hacky mess because I am dumb and moved forward on
   9     * Releeph changes with partial information. Recover from this as gracefully
  10     * as possible. This obivously is an abomination. -epriestley
  11     */
  12    public static function isFacebook() {
  13      try {
  14        class_exists('ReleephFacebookKarmaFieldSpecification');
  15        return true;
  16      } catch (Exception $ex) {
  17        return false;
  18      }
  19    }
  20  
  21    /**
  22     * @phutil-external-symbol class ReleephFacebookKarmaFieldSpecification
  23     * @phutil-external-symbol class ReleephFacebookSeverityFieldSpecification
  24     * @phutil-external-symbol class ReleephFacebookTagFieldSpecification
  25     * @phutil-external-symbol class ReleephFacebookTasksFieldSpecification
  26     */
  27    public function getFieldSpecifications() {
  28      if (self::isFacebook()) {
  29        return array(
  30          new ReleephCommitMessageFieldSpecification(),
  31          new ReleephSummaryFieldSpecification(),
  32          new ReleephReasonFieldSpecification(),
  33          new ReleephAuthorFieldSpecification(),
  34          new ReleephRevisionFieldSpecification(),
  35          new ReleephRequestorFieldSpecification(),
  36          new ReleephFacebookKarmaFieldSpecification(),
  37          new ReleephFacebookSeverityFieldSpecification(),
  38          new ReleephOriginalCommitFieldSpecification(),
  39          new ReleephDiffMessageFieldSpecification(),
  40          new ReleephIntentFieldSpecification(),
  41          new ReleephBranchCommitFieldSpecification(),
  42          new ReleephDiffSizeFieldSpecification(),
  43          new ReleephDiffChurnFieldSpecification(),
  44          new ReleephDependsOnFieldSpecification(),
  45          new ReleephFacebookTagFieldSpecification(),
  46          new ReleephFacebookTasksFieldSpecification(),
  47        );
  48      } else {
  49        return array(
  50          new ReleephCommitMessageFieldSpecification(),
  51          new ReleephSummaryFieldSpecification(),
  52          new ReleephReasonFieldSpecification(),
  53          new ReleephAuthorFieldSpecification(),
  54          new ReleephRevisionFieldSpecification(),
  55          new ReleephRequestorFieldSpecification(),
  56          new ReleephSeverityFieldSpecification(),
  57          new ReleephOriginalCommitFieldSpecification(),
  58          new ReleephDiffMessageFieldSpecification(),
  59          new ReleephIntentFieldSpecification(),
  60          new ReleephBranchCommitFieldSpecification(),
  61          new ReleephDiffSizeFieldSpecification(),
  62          new ReleephDiffChurnFieldSpecification(),
  63        );
  64      }
  65    }
  66  
  67    public function sortFieldsForCommitMessage(array $fields) {
  68      return self::selectFields($fields, array(
  69        'ReleephCommitMessageFieldSpecification',
  70        'ReleephRequestorFieldSpecification',
  71        'ReleephIntentFieldSpecification',
  72        'ReleephReasonFieldSpecification',
  73      ));
  74    }
  75  
  76  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1