getType() public method

public getType ( ) : integer
return integer
 /**
  * @param Activity $activity
  * @param string   $type
  *
  * @return string
  */
 public function bundleActivityMessage(Activity $activity, $type = 'long')
 {
     switch ($activity->getType()) {
         case Activity::ACTIVITY_TYPE_COMMIT:
             return 'long' == $type ? $activity->getMessage() : 'commited into';
             break;
         case Activity::ACTIVITY_TYPE_RECOMMEND:
             return 'long' == $type ? 'Bundle was recommended' : 'recommended';
             break;
         case Activity::ACTIVITY_TYPE_TRAVIS_BUILD:
             return ('long' == $type ? 'Travis-CI build of the bundle' : 'CI build') . (Activity::STATE_OPEN == $activity->getState() ? ' passed' : ' failed');
             break;
         case Activity::ACTIVITY_TYPE_TWEETED:
             return 'long' == $type ? 'Bundle archived top trending badge' : 'archived';
             break;
         default:
             return $activity->getMessage() ?: 'Various info';
     }
 }
Example #2
0
 /**
  * @param Activity $activity
  *
  * @return boolean
  */
 public function isEqualTo(Activity $activity)
 {
     if ($activity->getBundle()->getId() !== $this->bundle->getId()) {
         return false;
     }
     // Compare developers only if actual activity has one
     if (null !== $this->developer && $activity->getDeveloper()->getId() !== $this->developer->getId()) {
         return false;
     }
     if ($activity->getType() !== $this->type) {
         return false;
     }
     if ($activity->getState() !== $this->state) {
         return false;
     }
     // Compare dates only when state of activity allows it
     if (self::STATE_FIXED !== $this->state && $activity->getCreatedAt()->getTimestamp() !== $this->createdAt->getTimestamp()) {
         return false;
     }
     return true;
 }