@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * |
21 | 21 | * @param PropertyRegistry $propertyRegistry |
22 | 22 | */ |
23 | - public function register( $propertyRegistry ) { |
|
23 | + public function register($propertyRegistry) { |
|
24 | 24 | |
25 | 25 | $defs = [ |
26 | 26 | self::SAR_PROP_APPROVED_REV => [ |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | ] |
54 | 54 | ]; |
55 | 55 | |
56 | - foreach ( $defs as $key => $definition ) { |
|
56 | + foreach ($defs as $key => $definition) { |
|
57 | 57 | |
58 | 58 | $propertyRegistry->registerProperty( |
59 | 59 | $key, |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | $propertyRegistry->registerPropertyAlias( |
66 | 66 | $key, |
67 | - wfMessage( $definition['alias'] )->text() |
|
67 | + wfMessage($definition['alias'])->text() |
|
68 | 68 | ); |
69 | 69 | |
70 | 70 | $propertyRegistry->registerPropertyAliasByMsgKey( |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @param ApprovedRevsFacade $approvedRevsFacade |
34 | 34 | * @param RepoGroup|null $repoGroup |
35 | 35 | */ |
36 | - public function __construct( ApprovedRevsFacade $approvedRevsFacade, RepoGroup $repoGroup = null ) { |
|
36 | + public function __construct(ApprovedRevsFacade $approvedRevsFacade, RepoGroup $repoGroup = null) { |
|
37 | 37 | $this->approvedRevsFacade = $approvedRevsFacade; |
38 | 38 | $this->repoGroup = $repoGroup; |
39 | 39 | } |
@@ -46,13 +46,13 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @return boolean |
48 | 48 | */ |
49 | - public function isApprovedUpdate( Title $title, $latestRevID ) { |
|
49 | + public function isApprovedUpdate(Title $title, $latestRevID) { |
|
50 | 50 | |
51 | - if ( !$this->approvedRevsFacade->hasApprovedRevision( $title ) ) { |
|
51 | + if (!$this->approvedRevsFacade->hasApprovedRevision($title)) { |
|
52 | 52 | return true; |
53 | 53 | } |
54 | 54 | |
55 | - if ( ( $approvedRevID = $this->approvedRevsFacade->getApprovedRevID( $title ) ) !== null ) { |
|
55 | + if (($approvedRevID = $this->approvedRevsFacade->getApprovedRevID($title)) !== null) { |
|
56 | 56 | return $approvedRevID == $latestRevID; |
57 | 57 | } |
58 | 58 | |
@@ -65,14 +65,14 @@ discard block |
||
65 | 65 | * @param Title $title |
66 | 66 | * @param ?RevisionStoreRecord &$revision |
67 | 67 | */ |
68 | - public function doChangeRevision( Title $title, ?RevisionStoreRecord &$revision ) { |
|
68 | + public function doChangeRevision(Title $title, ?RevisionStoreRecord &$revision) { |
|
69 | 69 | |
70 | 70 | // Forcibly change the revision to match what ApprovedRevs sees as |
71 | 71 | // approved |
72 | - if ( ( $approvedRevID = $this->approvedRevsFacade->getApprovedRevID( $title ) ) !== null ) { |
|
72 | + if (($approvedRevID = $this->approvedRevsFacade->getApprovedRevID($title)) !== null) { |
|
73 | 73 | $approvedRev = MediaWikiServices::getInstance() |
74 | - ->getRevisionLookup()->getRevisionById( $approvedRevID ); |
|
75 | - if ( $approvedRev instanceof RevisionStoreRecord ) { |
|
74 | + ->getRevisionLookup()->getRevisionById($approvedRevID); |
|
75 | + if ($approvedRev instanceof RevisionStoreRecord) { |
|
76 | 76 | $revision = $approvedRev; |
77 | 77 | } |
78 | 78 | } |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | * @param Title $title |
85 | 85 | * @param integer &$revisionID |
86 | 86 | */ |
87 | - public function doChangeRevisionID( Title $title, &$revisionID ) { |
|
87 | + public function doChangeRevisionID(Title $title, &$revisionID) { |
|
88 | 88 | |
89 | - if ( ( $approvedRevID = $this->approvedRevsFacade->getApprovedRevID( $title ) ) !== null ) { |
|
89 | + if (($approvedRevID = $this->approvedRevsFacade->getApprovedRevID($title)) !== null) { |
|
90 | 90 | $revisionID = $approvedRevID; |
91 | 91 | } |
92 | 92 | } |
@@ -97,37 +97,37 @@ discard block |
||
97 | 97 | * @param Title $title |
98 | 98 | * @param File &$file |
99 | 99 | */ |
100 | - public function doChangeFile( Title $title, &$file ) { |
|
100 | + public function doChangeFile(Title $title, &$file) { |
|
101 | 101 | |
102 | 102 | // It has been observed that when running `runJobs.php` with `--wait` |
103 | 103 | // the `ApprovedRevs` instance holds an outdated cache entry therefore |
104 | 104 | // clear the static before trying to get the info |
105 | - $this->approvedRevsFacade->clearApprovedFileInfo( $title ); |
|
105 | + $this->approvedRevsFacade->clearApprovedFileInfo($title); |
|
106 | 106 | |
107 | - list( $timestamp, $file_sha1 ) = $this->approvedRevsFacade->getApprovedFileInfo( |
|
107 | + list($timestamp, $file_sha1) = $this->approvedRevsFacade->getApprovedFileInfo( |
|
108 | 108 | $title |
109 | 109 | ); |
110 | 110 | |
111 | - if ( $file_sha1 === false ) { |
|
111 | + if ($file_sha1 === false) { |
|
112 | 112 | return true; |
113 | 113 | } |
114 | 114 | |
115 | - if ( $this->repoGroup === null ) { |
|
115 | + if ($this->repoGroup === null) { |
|
116 | 116 | $this->repoGroup = RepoGroup::singleton(); |
117 | 117 | } |
118 | 118 | |
119 | 119 | $localRepo = $this->repoGroup->getLocalRepo(); |
120 | 120 | |
121 | 121 | // Retrievalable from the archive? |
122 | - $file = OldLocalFile::newFromKey( $file_sha1, $localRepo, $timestamp ); |
|
122 | + $file = OldLocalFile::newFromKey($file_sha1, $localRepo, $timestamp); |
|
123 | 123 | |
124 | 124 | // Try the local repo! |
125 | - if ( $file === false ) { |
|
126 | - $files = $localRepo->findBySha1( $file_sha1 ); |
|
127 | - $file = end( $files ); |
|
125 | + if ($file === false) { |
|
126 | + $files = $localRepo->findBySha1($file_sha1); |
|
127 | + $file = end($files); |
|
128 | 128 | } |
129 | 129 | |
130 | - if ( $file instanceof File ) { |
|
130 | + if ($file instanceof File) { |
|
131 | 131 | $file->file_sha1 = $file_sha1; |
132 | 132 | } |
133 | 133 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @param Title|null $title |
49 | 49 | * @param string $type of log (default: approval) |
50 | 50 | */ |
51 | - public function __construct( IDatabase $dbr, Title $title = null , $type = 'approval' ) { |
|
51 | + public function __construct(IDatabase $dbr, Title $title = null, $type = 'approval') { |
|
52 | 52 | $this->dbr = $dbr; |
53 | 53 | $this->dbKey = $title instanceof Title ? $title->getDBkey() : null; |
54 | 54 | $this->type = $type; |
@@ -80,13 +80,13 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return User |
82 | 82 | */ |
83 | - public function getUserForLogEntry( Title $title = null, $type = 'approval' ) { |
|
83 | + public function getUserForLogEntry(Title $title = null, $type = 'approval') { |
|
84 | 84 | |
85 | - $this->init( $title, $type ); |
|
85 | + $this->init($title, $type); |
|
86 | 86 | $logLine = $this->getLog()->current(); |
87 | 87 | |
88 | - if ( $logLine && $logLine->user_id ) { |
|
89 | - return User::newFromID( $logLine->user_id ); |
|
88 | + if ($logLine && $logLine->user_id) { |
|
89 | + return User::newFromID($logLine->user_id); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 | |
@@ -98,13 +98,13 @@ discard block |
||
98 | 98 | * |
99 | 99 | * @return Timestamp |
100 | 100 | */ |
101 | - public function getDateOfLogEntry( Title $title = null, $type = 'approval' ) { |
|
101 | + public function getDateOfLogEntry(Title $title = null, $type = 'approval') { |
|
102 | 102 | |
103 | - $this->init( $title, $type ); |
|
103 | + $this->init($title, $type); |
|
104 | 104 | $logLine = $this->getLog()->current(); |
105 | 105 | |
106 | - if ( $logLine && $logLine->log_timestamp ) { |
|
107 | - return new MWTimestamp( $logLine->log_timestamp ); |
|
106 | + if ($logLine && $logLine->log_timestamp) { |
|
107 | + return new MWTimestamp($logLine->log_timestamp); |
|
108 | 108 | } |
109 | 109 | } |
110 | 110 | |
@@ -116,12 +116,12 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @return string |
118 | 118 | */ |
119 | - public function getStatusOfLogEntry( Title $title = null, $type = 'approval' ) { |
|
119 | + public function getStatusOfLogEntry(Title $title = null, $type = 'approval') { |
|
120 | 120 | |
121 | - $this->init( $title, $type ); |
|
121 | + $this->init($title, $type); |
|
122 | 122 | $logLine = $this->getLog()->current(); |
123 | 123 | |
124 | - if ( $logLine && $logLine->log_action ) { |
|
124 | + if ($logLine && $logLine->log_action) { |
|
125 | 125 | return $logLine->log_action; |
126 | 126 | } |
127 | 127 | } |
@@ -129,26 +129,26 @@ discard block |
||
129 | 129 | /** |
130 | 130 | * Take care of loading from the cache or filling the query. |
131 | 131 | */ |
132 | - private function init( $title, $type ) { |
|
132 | + private function init($title, $type) { |
|
133 | 133 | |
134 | 134 | $this->dbKey = $title instanceof Title ? $title->getDBkey() : null; |
135 | 135 | $this->type = $type; |
136 | 136 | |
137 | - if ( $this->query ) { |
|
137 | + if ($this->query) { |
|
138 | 138 | return; |
139 | 139 | } |
140 | 140 | |
141 | - if ( !isset( self::$titleCache[ $this->dbKey . '#' . $this->type ] ) ) { |
|
141 | + if (!isset(self::$titleCache[$this->dbKey . '#' . $this->type])) { |
|
142 | 142 | $this->query = DatabaseLogEntry::getSelectQueryData(); |
143 | 143 | |
144 | 144 | $this->query['conds'] = [ |
145 | 145 | 'log_type' => $this->type, |
146 | 146 | 'log_title' => $this->dbKey |
147 | 147 | ]; |
148 | - $this->query['options'] = [ 'ORDER BY' => 'log_timestamp desc' ]; |
|
149 | - self::$titleCache[ $this->dbKey ] = $this; |
|
148 | + $this->query['options'] = ['ORDER BY' => 'log_timestamp desc']; |
|
149 | + self::$titleCache[$this->dbKey] = $this; |
|
150 | 150 | } else { |
151 | - $cache = self::$titleCache[ $this->dbKey . '#' . $this->type ]; |
|
151 | + $cache = self::$titleCache[$this->dbKey . '#' . $this->type]; |
|
152 | 152 | $this->query = $cache->getQuery(); |
153 | 153 | $this->log = $cache->getLog(); |
154 | 154 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | */ |
164 | 164 | private function getLog() { |
165 | 165 | |
166 | - if ( $this->log !== null ) { |
|
166 | + if ($this->log !== null) { |
|
167 | 167 | return $this->log; |
168 | 168 | } |
169 | 169 | |
@@ -178,13 +178,13 @@ discard block |
||
178 | 178 | $query['join_conds'] |
179 | 179 | ); |
180 | 180 | |
181 | - if ( $this->log === null ) { |
|
181 | + if ($this->log === null) { |
|
182 | 182 | $this->log = new ArrayIterator( |
183 | - [ (object)[ |
|
183 | + [(object)[ |
|
184 | 184 | 'user_id' => null, |
185 | 185 | 'log_timestamp' => null, |
186 | 186 | 'log_action' => null |
187 | - ] ] |
|
187 | + ]] |
|
188 | 188 | ); |
189 | 189 | } |
190 | 190 |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @param ServicesFactory $servicesFactory |
39 | 39 | */ |
40 | - public function __construct( ServicesFactory $servicesFactory ) { |
|
40 | + public function __construct(ServicesFactory $servicesFactory) { |
|
41 | 41 | $this->servicesFactory = $servicesFactory; |
42 | 42 | } |
43 | 43 | |
@@ -46,31 +46,31 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @param SemanticData $semanticData |
48 | 48 | */ |
49 | - public function addAnnotation( SemanticData $semanticData ) { |
|
49 | + public function addAnnotation(SemanticData $semanticData) { |
|
50 | 50 | |
51 | - $time = microtime( true ); |
|
51 | + $time = microtime(true); |
|
52 | 52 | |
53 | - if ( !$this->canAnnotate( $semanticData->getSubject() ) ) { |
|
53 | + if (!$this->canAnnotate($semanticData->getSubject())) { |
|
54 | 54 | return; |
55 | 55 | } |
56 | 56 | |
57 | - if ( $this->propertyAnnotators === [] ) { |
|
57 | + if ($this->propertyAnnotators === []) { |
|
58 | 58 | $this->initPropertyAnnotators(); |
59 | 59 | } |
60 | 60 | |
61 | - foreach ( $this->propertyAnnotators as $propertyAnnotator ) { |
|
62 | - $propertyAnnotator->addAnnotation( $semanticData ); |
|
61 | + foreach ($this->propertyAnnotators as $propertyAnnotator) { |
|
62 | + $propertyAnnotator->addAnnotation($semanticData); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | $this->logger->info( |
66 | - [ 'SemanticApprovedRevs', 'procTime:{procTime}' ], |
|
67 | - [ 'procTime' => round( ( microtime( true ) - $time ), 5 ) ] |
|
66 | + ['SemanticApprovedRevs', 'procTime:{procTime}'], |
|
67 | + ['procTime' => round((microtime(true) - $time), 5)] |
|
68 | 68 | ); |
69 | 69 | } |
70 | 70 | |
71 | - private function canAnnotate( $subject ) { |
|
71 | + private function canAnnotate($subject) { |
|
72 | 72 | |
73 | - if ( $subject === null || $subject->getTitle() === null || $subject->getTitle()->isSpecialPage() ) { |
|
73 | + if ($subject === null || $subject->getTitle() === null || $subject->getTitle()->isSpecialPage()) { |
|
74 | 74 | return false; |
75 | 75 | } |
76 | 76 |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | /** |
25 | 25 | * @since 1.0 |
26 | 26 | */ |
27 | - public function setConnection( \DatabaseBase $connection ) { |
|
27 | + public function setConnection(\DatabaseBase $connection) { |
|
28 | 28 | $this->connection = $connection; |
29 | 29 | } |
30 | 30 | |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function getConnection() { |
37 | 37 | |
38 | - if ( $this->connection === null ) { |
|
39 | - $this->connection = wfGetDB( DB_REPLICA ); |
|
38 | + if ($this->connection === null) { |
|
39 | + $this->connection = wfGetDB(DB_REPLICA); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | return $this->connection; |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | * @param string $type which log entries to get (default: approval) |
59 | 59 | * @return DatabaseLogReader |
60 | 60 | */ |
61 | - public function newDatabaseLogReader( Title $title = null, $type = 'approval' ) { |
|
62 | - return new DatabaseLogReader( $this->getConnection(), $title, $type ); |
|
61 | + public function newDatabaseLogReader(Title $title = null, $type = 'approval') { |
|
62 | + return new DatabaseLogReader($this->getConnection(), $title, $type); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @return ApprovedByPropertyAnnotator |
69 | 69 | */ |
70 | 70 | public function newApprovedByPropertyAnnotator() { |
71 | - return new ApprovedByPropertyAnnotator( $this->newDatabaseLogReader() ); |
|
71 | + return new ApprovedByPropertyAnnotator($this->newDatabaseLogReader()); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @return ApprovedStatusPropertyAnnotator |
78 | 78 | */ |
79 | 79 | public function newApprovedStatusPropertyAnnotator() { |
80 | - return new ApprovedStatusPropertyAnnotator( $this->newDatabaseLogReader() ); |
|
80 | + return new ApprovedStatusPropertyAnnotator($this->newDatabaseLogReader()); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @return ApprovedDatePropertyAnnotator |
87 | 87 | */ |
88 | 88 | public function newApprovedDatePropertyAnnotator() { |
89 | - return new ApprovedDatePropertyAnnotator( $this->newDatabaseLogReader() ); |
|
89 | + return new ApprovedDatePropertyAnnotator($this->newDatabaseLogReader()); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @return ApprovedRevPropertyAnnotator |
96 | 96 | */ |
97 | 97 | public function newApprovedRevPropertyAnnotator() { |
98 | - return new ApprovedRevPropertyAnnotator( $this->newApprovedRevsFacade() ); |
|
98 | + return new ApprovedRevPropertyAnnotator($this->newApprovedRevsFacade()); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | } |
@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @return integer|null |
26 | 26 | */ |
27 | - public function getApprovedRevID( Title $title ) { |
|
28 | - return ApprovedRevs::getApprovedRevID( $title ); |
|
27 | + public function getApprovedRevID(Title $title) { |
|
28 | + return ApprovedRevs::getApprovedRevID($title); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @return boolean |
37 | 37 | */ |
38 | - public function hasApprovedRevision( Title $title ) { |
|
39 | - return ApprovedRevs::hasApprovedRevision( $title ); |
|
38 | + public function hasApprovedRevision(Title $title) { |
|
39 | + return ApprovedRevs::hasApprovedRevision($title); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @return [] |
48 | 48 | */ |
49 | - public function getApprovedFileInfo( Title $title ) { |
|
50 | - return ApprovedRevs::getApprovedFileInfo( $title ); |
|
49 | + public function getApprovedFileInfo(Title $title) { |
|
50 | + return ApprovedRevs::getApprovedFileInfo($title); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | * |
56 | 56 | * @param Title $title |
57 | 57 | */ |
58 | - public function clearApprovedFileInfo( Title $title ) { |
|
59 | - ApprovedRevs::clearApprovedFileInfo( $title ); |
|
58 | + public function clearApprovedFileInfo(Title $title) { |
|
59 | + ApprovedRevs::clearApprovedFileInfo($title); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | } |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use SMW\DIProperty; |
6 | 6 | use SMW\SemanticData; |
7 | -use SMWDITime as DITime;; |
|
7 | +use SMWDITime as DITime; ; |
|
8 | 8 | use SMW\ApprovedRevs\DatabaseLogReader; |
9 | 9 | use SMW\ApprovedRevs\PropertyRegistry; |
10 | 10 | use User; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | /** |
30 | 30 | * @param DatabaseLogReader $databaseLogReader |
31 | 31 | */ |
32 | - public function __construct( DatabaseLogReader $databaseLogReader ) { |
|
32 | + public function __construct(DatabaseLogReader $databaseLogReader) { |
|
33 | 33 | $this->databaseLogReader = $databaseLogReader; |
34 | 34 | } |
35 | 35 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @param integer $approvedDate |
40 | 40 | */ |
41 | - public function setApprovedDate( $approvedDate ) { |
|
41 | + public function setApprovedDate($approvedDate) { |
|
42 | 42 | $this->approvedDate = $approvedDate; |
43 | 43 | } |
44 | 44 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @return DIProperty |
49 | 49 | */ |
50 | 50 | public function newDIProperty() { |
51 | - return new DIProperty( PropertyRegistry::SAR_PROP_APPROVED_DATE ); |
|
51 | + return new DIProperty(PropertyRegistry::SAR_PROP_APPROVED_DATE); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | * |
57 | 57 | * @param SemanticData $semanticData |
58 | 58 | */ |
59 | - public function addAnnotation( SemanticData $semanticData ) { |
|
59 | + public function addAnnotation(SemanticData $semanticData) { |
|
60 | 60 | |
61 | - if ( $this->approvedDate === null ) { |
|
61 | + if ($this->approvedDate === null) { |
|
62 | 62 | $this->approvedDate = $this->databaseLogReader->getDateOfLogEntry( |
63 | 63 | $semanticData->getSubject()->getTitle(), |
64 | 64 | 'approval' |
@@ -67,16 +67,16 @@ discard block |
||
67 | 67 | |
68 | 68 | $property = $this->newDIProperty(); |
69 | 69 | $dataItem = $this->newDITime(); |
70 | - $semanticData->removeProperty( $property ); |
|
70 | + $semanticData->removeProperty($property); |
|
71 | 71 | |
72 | - if ( $dataItem ) { |
|
73 | - $semanticData->addPropertyObjectValue( $property, $dataItem ); |
|
72 | + if ($dataItem) { |
|
73 | + $semanticData->addPropertyObjectValue($property, $dataItem); |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
77 | 77 | private function newDITime() { |
78 | 78 | |
79 | - if ( $this->approvedDate === null || is_bool( $this->approvedDate ) ) { |
|
79 | + if ($this->approvedDate === null || is_bool($this->approvedDate)) { |
|
80 | 80 | return; |
81 | 81 | } |
82 | 82 | |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | |
85 | 85 | return new DITime( |
86 | 86 | DITime::CM_GREGORIAN, |
87 | - $date->format( 'Y' ), |
|
88 | - $date->format( 'm' ), |
|
89 | - $date->format( 'd' ), |
|
90 | - $date->format( 'H' ), |
|
91 | - $date->format( 'i' ) |
|
87 | + $date->format('Y'), |
|
88 | + $date->format('m'), |
|
89 | + $date->format('d'), |
|
90 | + $date->format('H'), |
|
91 | + $date->format('i') |
|
92 | 92 | ); |
93 | 93 | } |
94 | 94 |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | /** |
29 | 29 | * @param DatabaseLogReader $databaseLogReader |
30 | 30 | */ |
31 | - public function __construct( DatabaseLogReader $databaseLogReader ) { |
|
31 | + public function __construct(DatabaseLogReader $databaseLogReader) { |
|
32 | 32 | $this->databaseLogReader = $databaseLogReader; |
33 | 33 | } |
34 | 34 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @param string $approvedStatus |
39 | 39 | */ |
40 | - public function setApprovedStatus( $approvedStatus ) { |
|
40 | + public function setApprovedStatus($approvedStatus) { |
|
41 | 41 | $this->approvedStatus = $approvedStatus; |
42 | 42 | } |
43 | 43 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @return DIProperty |
48 | 48 | */ |
49 | 49 | public function newDIProperty() { |
50 | - return new DIProperty( PropertyRegistry::SAR_PROP_APPROVED_STATUS ); |
|
50 | + return new DIProperty(PropertyRegistry::SAR_PROP_APPROVED_STATUS); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | * |
56 | 56 | * @param SemanticData $semanticData |
57 | 57 | */ |
58 | - public function addAnnotation( SemanticData $semanticData ) { |
|
58 | + public function addAnnotation(SemanticData $semanticData) { |
|
59 | 59 | |
60 | - if ( $this->approvedStatus === null ) { |
|
60 | + if ($this->approvedStatus === null) { |
|
61 | 61 | $this->approvedStatus = $this->databaseLogReader->getStatusOfLogEntry( |
62 | 62 | $semanticData->getSubject()->getTitle(), |
63 | 63 | 'approval' |
@@ -65,12 +65,12 @@ discard block |
||
65 | 65 | } |
66 | 66 | |
67 | 67 | $property = $this->newDIProperty(); |
68 | - $semanticData->removeProperty( $property ); |
|
68 | + $semanticData->removeProperty($property); |
|
69 | 69 | |
70 | - if ( is_string( $this->approvedStatus ) && $this->approvedStatus !== '' ) { |
|
70 | + if (is_string($this->approvedStatus) && $this->approvedStatus !== '') { |
|
71 | 71 | $semanticData->addPropertyObjectValue( |
72 | 72 | $property, |
73 | - new DIBlob( $this->approvedStatus ) |
|
73 | + new DIBlob($this->approvedStatus) |
|
74 | 74 | ); |
75 | 75 | } |
76 | 76 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | /** |
31 | 31 | * @param DatabaseLogReader $databaseLogReader |
32 | 32 | */ |
33 | - public function __construct( DatabaseLogReader $databaseLogReader ) { |
|
33 | + public function __construct(DatabaseLogReader $databaseLogReader) { |
|
34 | 34 | $this->databaseLogReader = $databaseLogReader; |
35 | 35 | } |
36 | 36 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * |
40 | 40 | * @param string $approvedBy |
41 | 41 | */ |
42 | - public function setApprovedBy( $approvedBy ) { |
|
42 | + public function setApprovedBy($approvedBy) { |
|
43 | 43 | $this->approvedBy = $approvedBy; |
44 | 44 | } |
45 | 45 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @return DIProperty |
50 | 50 | */ |
51 | 51 | public function newDIProperty() { |
52 | - return new DIProperty( PropertyRegistry::SAR_PROP_APPROVED_BY ); |
|
52 | + return new DIProperty(PropertyRegistry::SAR_PROP_APPROVED_BY); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @param SemanticData $semanticData |
59 | 59 | */ |
60 | - public function addAnnotation( SemanticData $semanticData ) { |
|
60 | + public function addAnnotation(SemanticData $semanticData) { |
|
61 | 61 | |
62 | - if ( $this->approvedBy === null ) { |
|
62 | + if ($this->approvedBy === null) { |
|
63 | 63 | $this->approvedBy = $this->databaseLogReader->getUserForLogEntry( |
64 | 64 | $semanticData->getSubject()->getTitle(), |
65 | 65 | 'approval' |
@@ -68,23 +68,23 @@ discard block |
||
68 | 68 | |
69 | 69 | $property = $this->newDIProperty(); |
70 | 70 | $dataItem = $this->newDIWikiPage(); |
71 | - $semanticData->removeProperty( $property ); |
|
71 | + $semanticData->removeProperty($property); |
|
72 | 72 | |
73 | - if ( $dataItem ) { |
|
74 | - $semanticData->addPropertyObjectValue( $property, $dataItem ); |
|
73 | + if ($dataItem) { |
|
74 | + $semanticData->addPropertyObjectValue($property, $dataItem); |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 | |
78 | 78 | private function newDIWikiPage() { |
79 | 79 | |
80 | - if ( !$this->approvedBy instanceof User ) { |
|
80 | + if (!$this->approvedBy instanceof User) { |
|
81 | 81 | return; |
82 | 82 | } |
83 | 83 | |
84 | 84 | $userPage = $this->approvedBy->getUserPage(); |
85 | 85 | |
86 | - if ( $userPage instanceof Title ) { |
|
87 | - return DIWikiPage::newFromTitle( $userPage ); |
|
86 | + if ($userPage instanceof Title) { |
|
87 | + return DIWikiPage::newFromTitle($userPage); |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 |