Passed
Push — develop ( f5d3ab...1cfb3a )
by Jens
03:36
created
cloudcontrol/library/storage/Storage.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 		 */
83 83
 		private function config()
84 84
 		{
85
-			$storagePath = __DIR__ . '/../../' . $this->storageDir;
85
+			$storagePath = __DIR__.'/../../'.$this->storageDir;
86 86
 			if (realpath($storagePath) === false) {
87 87
 				initFramework();
88 88
 				if (Repository::create($storagePath)) {
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 					$repository->init();
91 91
 					$this->repository = $repository;
92 92
 				} else {
93
-					throw new \Exception('Could not create repository directory: ' . $storagePath);
93
+					throw new \Exception('Could not create repository directory: '.$storagePath);
94 94
 				}
95 95
 			} else {
96 96
 				$this->repository = new Repository($storagePath);
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
 		{
134 134
 			$documentFolderObject = DocumentFolderFactory::createDocumentFolderFromPostValues($postValues);
135 135
 			if ($postValues['path'] === '/') {
136
-				$documentFolderObject->path = $postValues['path'] . $documentFolderObject->slug;
136
+				$documentFolderObject->path = $postValues['path'].$documentFolderObject->slug;
137 137
 			} else {
138
-				$documentFolderObject->path = $postValues['path'] . '/' . $documentFolderObject->slug;
138
+				$documentFolderObject->path = $postValues['path'].'/'.$documentFolderObject->slug;
139 139
 			}
140 140
 			$this->repository->saveDocument($documentFolderObject, 'published');
141 141
 			$this->repository->saveDocument($documentFolderObject, 'unpublished');
@@ -150,20 +150,20 @@  discard block
 block discarded – undo
150 150
 		 */
151 151
 		public function deleteDocumentFolderBySlug($slug)
152 152
 		{
153
-			$path = '/' . $slug;
153
+			$path = '/'.$slug;
154 154
 			$this->repository->deleteDocumentByPath($path, 'published');
155 155
 			$this->repository->deleteDocumentByPath($path, 'unpublished');
156 156
 		}
157 157
 
158 158
 		public function publishDocumentBySlug($slug)
159 159
 		{
160
-			$path = '/' . $slug;
160
+			$path = '/'.$slug;
161 161
 			$this->repository->publishDocumentByPath($path);
162 162
 		}
163 163
 
164 164
 		public function unpublishDocumentBySlug($slug)
165 165
 		{
166
-			$path = '/' . $slug;
166
+			$path = '/'.$slug;
167 167
 			$this->repository->unpublishDocumentByPath($path);
168 168
 		}
169 169
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 		 */
178 178
 		public function getDocumentFolderBySlug($slug)
179 179
 		{
180
-			$path = '/' . $slug;
180
+			$path = '/'.$slug;
181 181
 
182 182
 			return $this->repository->getDocumentByPath($path);
183 183
 		}
Please login to merge, or discard this patch.
cloudcontrol/library/search/Indexer.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 		$this->resetIndex();
59 59
 		$this->addLog('Retrieving documents to be indexed.');
60 60
 		$documents = $this->storage->getDocuments()->getPublishedDocumentsNoFolders();
61
-		$this->addLog('Start Document Term Count for ' . count($documents) . ' documents');
61
+		$this->addLog('Start Document Term Count for '.count($documents).' documents');
62 62
 		$this->createDocumentTermCount($documents);
63 63
 		$this->addLog('Start Document Term Frequency.');
64 64
 		$this->createDocumentTermFrequency();
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	private function addLog($string)
160 160
 	{
161 161
 		$currentTime = round(microtime(true) * 1000);
162
-		$this->log .= date('d-m-Y H:i:s - ') . str_pad($string, 50, " ", STR_PAD_RIGHT) . "\t" . ($currentTime - $this->lastLog) . 'ms since last log. ' . "\t" . ($currentTime - $this->loggingStart) . 'ms since start.' . PHP_EOL;
162
+		$this->log .= date('d-m-Y H:i:s - ').str_pad($string, 50, " ", STR_PAD_RIGHT)."\t".($currentTime - $this->lastLog).'ms since last log. '."\t".($currentTime - $this->loggingStart).'ms since start.'.PHP_EOL;
163 163
 		$this->lastLog = round(microtime(true) * 1000);
164 164
 	}
165 165
 
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
 	protected function getSearchDbHandle()
172 172
 	{
173 173
 		if ($this->searchDbHandle === null) {
174
-			$path = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . $this->storageDir . DIRECTORY_SEPARATOR;
175
-			$this->searchDbHandle = new \PDO('sqlite:' . $path . self::SEARCH_TEMP_DB);
174
+			$path = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.$this->storageDir.DIRECTORY_SEPARATOR;
175
+			$this->searchDbHandle = new \PDO('sqlite:'.$path.self::SEARCH_TEMP_DB);
176 176
 		}
177 177
 		return $this->searchDbHandle;
178 178
 	}
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	public function replaceOldIndex()
184 184
 	{
185 185
 		$this->searchDbHandle = null;
186
-		$path = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . $this->storageDir . DIRECTORY_SEPARATOR;
187
-		rename($path . self::SEARCH_TEMP_DB, $path . 'search.db');
186
+		$path = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.$this->storageDir.DIRECTORY_SEPARATOR;
187
+		rename($path.self::SEARCH_TEMP_DB, $path.'search.db');
188 188
 	}
189 189
 }
190 190
\ No newline at end of file
Please login to merge, or discard this patch.
cloudcontrol/library/components/cms/DocumentRouting.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 		if (isset($request::$get[CmsComponent::PARAMETER_DOCUMENT_TYPE])) {
84 84
 			if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$get[CmsComponent::PARAMETER_DOCUMENT_TYPE], $request::$get[CmsComponent::GET_PARAMETER_PATH])) {
85 85
 				$cmsComponent->storage->getDocuments()->addDocument($request::$post);
86
-				header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents');
86
+				header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents');
87 87
 				exit;
88 88
 			}
89 89
 			$cmsComponent->setParameter(CmsComponent::PARAMETER_DOCUMENT_TYPE, $cmsComponent->storage->getDocumentTypes()->getDocumentTypeBySlug($request::$get[CmsComponent::PARAMETER_DOCUMENT_TYPE], true));
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 		} else {
92 92
 			$documentTypes = $cmsComponent->storage->getDocumentTypes()->getDocumentTypes();
93 93
 			if (count($documentTypes) < 1) {
94
-				throw new \Exception('No Document Types defined yet. <a href="' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/configuration/document-types/new">Please do so first.</a>');
94
+				throw new \Exception('No Document Types defined yet. <a href="'.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/configuration/document-types/new">Please do so first.</a>');
95 95
 			}
96 96
 			$cmsComponent->setParameter(CmsComponent::PARAMETER_DOCUMENT_TYPES, $documentTypes);
97 97
 		}
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 		$cmsComponent->setParameter(CmsComponent::PARAMETER_SMALLEST_IMAGE, $cmsComponent->storage->getImageSet()->getSmallestImageSet()->slug);
109 109
 		if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$get[CmsComponent::GET_PARAMETER_SLUG])) {
110 110
 			$cmsComponent->storage->getDocuments()->saveDocument($request::$post);
111
-			header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents');
111
+			header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents');
112 112
 			exit;
113 113
 		}
114 114
 		$cmsComponent->setParameter(CmsComponent::PARAMETER_DOCUMENT, $cmsComponent->storage->getDocuments()->getDocumentBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG], 'unpublished'));
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	private function deleteDocumentRoute($request, $cmsComponent)
146 146
 	{
147 147
 		$cmsComponent->storage->getDocuments()->deleteDocumentBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]);
148
-		header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents');
148
+		header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents');
149 149
 		exit;
150 150
 	}
151 151
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 		$cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_DOCUMENTS);
160 160
 		if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$post[CmsComponent::GET_PARAMETER_PATH])) {
161 161
 			$cmsComponent->storage->addDocumentFolder($request::$post);
162
-			header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents');
162
+			header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents');
163 163
 			exit;
164 164
 		}
165 165
 	}
@@ -178,11 +178,11 @@  discard block
 block discarded – undo
178 178
 		array_pop($path);
179 179
 		$path = implode('/', $path);
180 180
 
181
-		$request::$get[CmsComponent::GET_PARAMETER_PATH] = '/' . $path;
181
+		$request::$get[CmsComponent::GET_PARAMETER_PATH] = '/'.$path;
182 182
 
183 183
 		if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$post['content'])) {
184 184
 			$cmsComponent->storage->saveDocumentFolder($request::$post);
185
-			header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents');
185
+			header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents');
186 186
 			exit;
187 187
 		}
188 188
 
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	private function deleteFolderRoute($request, $cmsComponent)
198 198
 	{
199 199
 		$cmsComponent->storage->deleteDocumentFolderBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]);
200
-		header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents');
200
+		header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents');
201 201
 		exit;
202 202
 	}
203 203
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 	private function publishDocumentRoute($request, $cmsComponent)
209 209
 	{
210 210
 		$cmsComponent->storage->publishDocumentBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]);
211
-		header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents');
211
+		header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents');
212 212
 		exit;
213 213
 	}
214 214
 
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 	private function unpublishDocumentRoute($request, $cmsComponent)
220 220
 	{
221 221
 		$cmsComponent->storage->unpublishDocumentBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]);
222
-		header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents');
222
+		header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents');
223 223
 		exit;
224 224
 	}
225 225
 }
226 226
\ No newline at end of file
Please login to merge, or discard this patch.
cloudcontrol/library/components/cms/SearchRouting.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	}
73 73
 
74 74
 	private function showJson($obj, $httpHeader = 'HTTP/1.0 200 OK') {
75
-		header($_SERVER['SERVER_PROTOCOL'] . $httpHeader, true);
75
+		header($_SERVER['SERVER_PROTOCOL'].$httpHeader, true);
76 76
 		header('Content-type: application/json');
77 77
 		die(json_encode($obj));
78 78
 	}
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	private function stepRouting($step, $cmsComponent, $indexer)
86 86
 	{
87
-		switch($step) {
87
+		switch ($step) {
88 88
 			case 'resetIndex': $indexer->resetIndex(); break;
89 89
 			case 'createDocumentTermCount':
90 90
 				$documents = $cmsComponent->storage->getDocuments()->getPublishedDocumentsNoFolders();
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 			case 'createTermFieldLengthNorm': $indexer->createTermFieldLengthNorm(); break;
95 95
 			case 'createInverseDocumentFrequency': $indexer->createInverseDocumentFrequency(); break;
96 96
 			case 'replaceOldIndex': $indexer->replaceOldIndex(); break;
97
-			default : $this->showJson('Invalid step: ' . $step . '.', 'HTTP/1.0 500 Internal Server Error'); break;
97
+			default : $this->showJson('Invalid step: '.$step.'.', 'HTTP/1.0 500 Internal Server Error'); break;
98 98
 		}
99 99
 		$this->showJson('done');
100 100
 	}
Please login to merge, or discard this patch.