Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 8
CRAP
0.00% covered (danger)
0.00%
0 / 1
BoardContent
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 8
90
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 getTextForSearchIndex
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getWikitextForTransclusion
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getTextForSummary
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
6
 getSize
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 copy
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 isCountable
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getWorkflowId
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace Flow\Content;
4
5use Flow\Model\UUID;
6use MediaWiki\Content\AbstractContent;
7use MediaWiki\Content\Content;
8
9class BoardContent extends AbstractContent {
10    /** @var UUID|null */
11    protected $workflowId;
12
13    public function __construct( $contentModel = CONTENT_MODEL_FLOW_BOARD, ?UUID $workflowId = null ) {
14        parent::__construct( $contentModel );
15        $this->workflowId = $workflowId;
16    }
17
18    /**
19     * @since 1.21
20     *
21     * @return string A string representing the content in a way useful for
22     *   building a full text search index. If no useful representation exists,
23     *   this method returns an empty string.
24     *
25     * @todo Test that this actually works
26     * @todo Make sure this also works with LuceneSearch / WikiSearch
27     */
28    public function getTextForSearchIndex() {
29        return '';
30    }
31
32    /**
33     * @since 1.21
34     *
35     * @return string The wikitext to include when another page includes this
36     * content, or false if the content is not includable in a wikitext page.
37     *
38     * @todo Allow native handling, bypassing wikitext representation, like
39     *  for includable special pages.
40     * @todo Allow transclusion into other content models than Wikitext!
41     * @todo Used in WikiPage and MessageCache to get message text. Not so
42     *  nice. What should we use instead?!
43     */
44    public function getWikitextForTransclusion() {
45        return '<span class="error">' . wfMessage( 'flow-embedding-unsupported' )->plain() . '</span>';
46    }
47
48    /**
49     * Returns a textual representation of the content suitable for use in edit
50     * summaries and log messages.
51     *
52     * @since 1.21
53     *
54     * @param int $maxLength Maximum length of the summary text.
55     *
56     * @return string|false The summary text.
57     */
58    public function getTextForSummary( $maxLength = 250 ) {
59        $workflow = $this->getWorkflowId();
60        if ( !$workflow ) {
61            // This shouldn't happen but some Flow boards have no workflow
62            // due to ancient bugs, so don't crash
63            return '[Corrupt Flow board]';
64        }
65        return '[Flow board ' . $workflow->getAlphadecimal() . ']';
66    }
67
68    /**
69     * Returns the content's nominal size in bogo-bytes.
70     *
71     * @return int
72     */
73    public function getSize() {
74        return 1;
75    }
76
77    /**
78     * Return a copy of this Content object. The following must be true for the
79     * object returned:
80     *
81     * if $copy = $original->copy()
82     *
83     * - get_class($original) === get_class($copy)
84     * - $original->getModel() === $copy->getModel()
85     * - $original->equals( $copy )
86     *
87     * If and only if the Content object is immutable, the copy() method can and
88     * should return $this. That is, $copy === $original may be true, but only
89     * for immutable content objects.
90     *
91     * @since 1.21
92     *
93     * @return Content A copy of this object
94     */
95    public function copy() {
96        return $this;
97    }
98
99    /**
100     * Returns true if this content is countable as a "real" wiki page, provided
101     * that it's also in a countable location (e.g. a current revision in the
102     * main namespace).
103     *
104     * @since 1.21
105     *
106     * @param bool|null $hasLinks If it is known whether this content contains
107     *    links, provide this information here, to avoid redundant parsing to
108     *    find out.
109     *
110     * @return bool
111     */
112    public function isCountable( $hasLinks = null ) {
113        return true;
114    }
115
116    /**
117     * @return UUID|null
118     */
119    public function getWorkflowId() {
120        return $this->workflowId;
121    }
122}