VersionPress\Git\CommitMessage::getBody PHP Method

getBody() public method

Rest of the commit message (all text except the subject). Usually just the VP tags but body might also contain some other information.
public getBody ( ) : string
return string
    public function getBody()
    {
        return $this->body;
    }

Usage Example

コード例 #1
0
 /**
  * @param CommitMessage $commitMessage
  * @return ChangeInfoEnvelope
  */
 public function parse(CommitMessage $commitMessage)
 {
     $fullBody = $commitMessage->getBody();
     $splittedBodies = explode("\n\n", $fullBody);
     $lastBody = $splittedBodies[count($splittedBodies) - 1];
     $changeInfoList = [];
     $version = null;
     $environment = null;
     if (self::containsVersion($lastBody)) {
         $version = self::extractTag(ChangeInfoEnvelope::VP_VERSION_TAG, $lastBody);
         $environment = self::extractTag(ChangeInfoEnvelope::VP_ENVIRONMENT_TAG, $lastBody);
         array_pop($splittedBodies);
     }
     if (!self::isTrackedChangeInfo($fullBody)) {
         return new ChangeInfoEnvelope([new UntrackedChangeInfo($commitMessage)], $version, $environment);
     }
     foreach ($splittedBodies as $body) {
         $partialCommitMessage = new CommitMessage("", $body);
         $actionTag = $partialCommitMessage->getVersionPressTag(TrackedChangeInfo::ACTION_TAG);
         list($scope, $action, $id) = array_pad(explode('/', $actionTag, 3), 3, null);
         $tags = $partialCommitMessage->getVersionPressTags();
         unset($tags[TrackedChangeInfo::ACTION_TAG]);
         $actionsInfo = $this->actionsInfoProvider->getActionsInfo($scope);
         if ($this->dbSchema->isEntity($scope)) {
             $entityInfo = $this->dbSchema->getEntityInfo($scope);
             $changeInfoList[] = new EntityChangeInfo($entityInfo, $actionsInfo, $action, $id, $tags, []);
         } else {
             $changeInfoList[] = new TrackedChangeInfo($scope, $actionsInfo, $action, $id, $tags, []);
         }
     }
     return new ChangeInfoEnvelope($changeInfoList, $version, $environment);
 }
All Usage Examples Of VersionPress\Git\CommitMessage::getBody