Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 12 |
|
0.00% |
0 / 6 |
CRAP | |
0.00% |
0 / 1 |
BoardHistoryStorage | |
0.00% |
0 / 12 |
|
0.00% |
0 / 6 |
90 | |
0.00% |
0 / 1 |
find | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | |||||
findMulti | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
12 | |||
validate | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
6 | |||
getPrimaryKeyColumns | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
insert | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
update | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
remove | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace Flow\Data\Storage; |
4 | |
5 | use Flow\Exception\DataModelException; |
6 | |
7 | /** |
8 | * SQL backing for BoardHistoryIndex fetches revisions related |
9 | * to a specific TopicList (board workflow) |
10 | * Subclassed for each type that needs it, so each TopKIndex |
11 | * has a distinct backend. |
12 | */ |
13 | abstract class BoardHistoryStorage extends DbStorage { |
14 | abstract public function find( array $attributes, array $options = [] ); |
15 | |
16 | public function findMulti( array $queries, array $options = [] ) { |
17 | if ( count( $queries ) !== 1 ) { |
18 | throw new DataModelException( __METHOD__ . ' expects exactly one value in $queries', 'process-data' ); |
19 | } |
20 | |
21 | $result = []; |
22 | foreach ( $queries as $i => $attributes ) { |
23 | $result[$i] = $this->find( $attributes, $options ); |
24 | } |
25 | |
26 | $result = RevisionStorage::mergeExternalContent( $result ); |
27 | |
28 | return $result; |
29 | } |
30 | |
31 | /** |
32 | * When retrieving revisions from DB, RevisionStorage::mergeExternalContent |
33 | * will be called to fetch the content. This could fail, resulting in the |
34 | * content being a 'false' value. |
35 | * |
36 | * @inheritDoc |
37 | */ |
38 | public function validate( array $row ) { |
39 | return !isset( $row['rev_content'] ) || $row['rev_content'] !== false; |
40 | } |
41 | |
42 | public function getPrimaryKeyColumns() { |
43 | return [ 'topic_list_id' ]; |
44 | } |
45 | |
46 | public function insert( array $row ) { |
47 | // @phan-suppress-previous-line PhanPluginNeverReturnMethod LSP violation. |
48 | throw new DataModelException( __CLASS__ . ' does not support insert action', 'process-data' ); |
49 | } |
50 | |
51 | public function update( array $old, array $new ) { |
52 | // @phan-suppress-previous-line PhanPluginNeverReturnMethod LSP violation. |
53 | throw new DataModelException( __CLASS__ . ' does not support update action', 'process-data' ); |
54 | } |
55 | |
56 | public function remove( array $row ) { |
57 | // @phan-suppress-previous-line PhanPluginNeverReturnMethod LSP violation. |
58 | throw new DataModelException( __CLASS__ . ' does not support remove action', 'process-data' ); |
59 | } |
60 | } |