SemanticMediaWiki /
SemanticApprovedRevs
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | namespace SMW\ApprovedRevs; |
||
| 4 | |||
| 5 | use SMW\ApprovedRevs\PropertyAnnotators\ApprovedByPropertyAnnotator; |
||
| 6 | use SMW\ApprovedRevs\PropertyAnnotators\ApprovedStatusPropertyAnnotator; |
||
| 7 | use SMW\ApprovedRevs\PropertyAnnotators\ApprovedDatePropertyAnnotator; |
||
| 8 | use SMW\ApprovedRevs\PropertyAnnotators\ApprovedRevPropertyAnnotator; |
||
| 9 | use Title; |
||
| 10 | |||
| 11 | /** |
||
| 12 | * @license GNU GPL v2+ |
||
| 13 | * @since 1.0 |
||
| 14 | * |
||
| 15 | * @author mwjames |
||
| 16 | */ |
||
| 17 | class ServicesFactory { |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var DatabaseBase |
||
| 21 | */ |
||
| 22 | private $connection; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @since 1.0 |
||
| 26 | */ |
||
| 27 | 2 | public function setConnection( \DatabaseBase $connection ) { |
|
| 28 | 2 | $this->connection = $connection; |
|
|
0 ignored issues
–
show
|
|||
| 29 | 2 | } |
|
| 30 | |||
| 31 | /** |
||
| 32 | * @since 1.3 |
||
| 33 | * |
||
| 34 | * @return DatabaseBase |
||
| 35 | */ |
||
| 36 | 5 | public function getConnection() { |
|
| 37 | |||
| 38 | 5 | if ( $this->connection === null ) { |
|
| 39 | 3 | $this->connection = wfGetDB( DB_SLAVE ); |
|
| 40 | } |
||
| 41 | |||
| 42 | 5 | return $this->connection; |
|
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @since 1.0 |
||
| 47 | * |
||
| 48 | * @return ApprovedRevsFacade |
||
| 49 | */ |
||
| 50 | 2 | public function newApprovedRevsFacade() { |
|
| 51 | 2 | return new ApprovedRevsFacade(); |
|
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @since 1.0 |
||
| 56 | * |
||
| 57 | * @param null|Title $title to get the DBLogReader |
||
| 58 | * @param string $type which log entries to get (default: approval) |
||
| 59 | * @return DatabaseLogReader |
||
| 60 | */ |
||
| 61 | 4 | public function newDatabaseLogReader( Title $title = null, $type = 'approval' ) { |
|
| 62 | 4 | return new DatabaseLogReader( $this->getConnection(), $title, $type ); |
|
| 63 | } |
||
| 64 | |||
| 65 | /** |
||
| 66 | * @since 1.0 |
||
| 67 | * |
||
| 68 | * @return ApprovedByPropertyAnnotator |
||
| 69 | */ |
||
| 70 | 1 | public function newApprovedByPropertyAnnotator() { |
|
| 71 | 1 | return new ApprovedByPropertyAnnotator( $this->newDatabaseLogReader() ); |
|
| 72 | } |
||
| 73 | |||
| 74 | /** |
||
| 75 | * @since 1.0 |
||
| 76 | * |
||
| 77 | * @return ApprovedStatusPropertyAnnotator |
||
| 78 | */ |
||
| 79 | 1 | public function newApprovedStatusPropertyAnnotator() { |
|
| 80 | 1 | return new ApprovedStatusPropertyAnnotator( $this->newDatabaseLogReader() ); |
|
| 81 | } |
||
| 82 | |||
| 83 | /** |
||
| 84 | * @since 1.0 |
||
| 85 | * |
||
| 86 | * @return ApprovedDatePropertyAnnotator |
||
| 87 | */ |
||
| 88 | 1 | public function newApprovedDatePropertyAnnotator() { |
|
| 89 | 1 | return new ApprovedDatePropertyAnnotator( $this->newDatabaseLogReader() ); |
|
| 90 | } |
||
| 91 | |||
| 92 | /** |
||
| 93 | * @since 1.0 |
||
| 94 | * |
||
| 95 | * @return ApprovedRevPropertyAnnotator |
||
| 96 | */ |
||
| 97 | 1 | public function newApprovedRevPropertyAnnotator() { |
|
| 98 | 1 | return new ApprovedRevPropertyAnnotator( $this->newApprovedRevsFacade() ); |
|
| 99 | } |
||
| 100 | |||
| 101 | } |
||
| 102 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..