Knp\Bundle\KnpBundlesBundle\Twig\Extension\BundleUtilsExtension::bundleActivityMessage PHP Method

bundleActivityMessage() public method

public bundleActivityMessage ( Activity $activity, string $type = 'long' ) : string
$activity Knp\Bundle\KnpBundlesBundle\Entity\Activity
$type string
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';
        }
    }