[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/feed/story/ -> PhabricatorFeedStoryAggregate.php (source)

   1  <?php
   2  
   3  abstract class PhabricatorFeedStoryAggregate extends PhabricatorFeedStory {
   4  
   5    private $aggregateStories = array();
   6  
   7    public function getHasViewed() {
   8      return head($this->getAggregateStories())->getHasViewed();
   9    }
  10  
  11    public function getPrimaryObjectPHID() {
  12      return head($this->getAggregateStories())->getPrimaryObjectPHID();
  13    }
  14  
  15    public function getRequiredHandlePHIDs() {
  16      $phids = array();
  17      foreach ($this->getAggregateStories() as $story) {
  18        $phids[] = $story->getRequiredHandlePHIDs();
  19      }
  20      return array_mergev($phids);
  21    }
  22  
  23    public function getRequiredObjectPHIDs() {
  24      $phids = array();
  25      foreach ($this->getAggregateStories() as $story) {
  26        $phids[] = $story->getRequiredObjectPHIDs();
  27      }
  28      return array_mergev($phids);
  29    }
  30  
  31    protected function getAuthorPHIDs() {
  32      $authors = array();
  33      foreach ($this->getAggregateStories() as $story) {
  34        $authors[] = $story->getStoryData()->getAuthorPHID();
  35      }
  36      return array_unique(array_filter($authors));
  37    }
  38  
  39    protected function getDataValues($key, $default) {
  40      $result = array();
  41      foreach ($this->getAggregateStories() as $key => $story) {
  42        $result[$key] = $story->getStoryData()->getValue($key, $default);
  43      }
  44      return $result;
  45    }
  46  
  47    final public function setAggregateStories(array $aggregate_stories) {
  48      assert_instances_of($aggregate_stories, 'PhabricatorFeedStory');
  49      $this->aggregateStories = $aggregate_stories;
  50  
  51      $objects = array();
  52      $handles = array();
  53  
  54      foreach ($this->aggregateStories as $story) {
  55        $objects += $story->getObjects();
  56        $handles += $story->getHandles();
  57      }
  58  
  59      $this->setObjects($objects);
  60      $this->setHandles($handles);
  61  
  62      return $this;
  63    }
  64  
  65    final public function getAggregateStories() {
  66      return $this->aggregateStories;
  67    }
  68  
  69    final public function getNotificationAggregations() {
  70      throw new Exception(
  71        'You can not get aggregations for an aggregate story.');
  72    }
  73  
  74  }


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