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