Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 10
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
PostSummary
0.00% covered (danger)
0.00%
0 / 10
0.00% covered (danger)
0.00%
0 / 3
12
0.00% covered (danger)
0.00%
0 / 1
 create
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 1
2
 getRevisionType
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getCollection
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace Flow\Model;
4
5use Flow\Collection\PostSummaryCollection;
6use MediaWiki\Title\Title;
7use MediaWiki\User\User;
8
9class PostSummary extends AbstractSummary {
10
11    /**
12     * @param Title $title
13     * @param PostRevision $post
14     * @param User $user
15     * @param string $content
16     * @param string $format wikitext|html
17     * @param string $changeType
18     * @return PostSummary
19     */
20    public static function create( Title $title, PostRevision $post, User $user, $content, $format, $changeType ) {
21        $obj = new self;
22        $obj->revId = UUID::create();
23        $obj->user = UserTuple::newFromUser( $user );
24        $obj->prevRevision = null;
25        $obj->changeType = $changeType;
26        $obj->summaryTargetId = $post->getPostId();
27        $obj->setContent( $content, $format, $title );
28        return $obj;
29    }
30
31    /**
32     * @return string
33     */
34    public function getRevisionType() {
35        return 'post-summary';
36    }
37
38    /**
39     * @return PostSummaryCollection
40     */
41    public function getCollection() {
42        // @phan-suppress-next-line PhanTypeMismatchReturnSuperType
43        return PostSummaryCollection::newFromRevision( $this );
44    }
45}