Passed
Push — develop ( a5e1bf...c22bc5 )
by Jens
02:34
created
src/storage/storage/DocumentStorage.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	public function getDocuments($state = 'published')
22 22
 	{
23 23
 		if (!in_array($state, Document::$DOCUMENT_STATES)) {
24
-			throw new \Exception('Unsupported document state: ' . $state);
24
+			throw new \Exception('Unsupported document state: '.$state);
25 25
 		}
26 26
 		return $this->repository->getDocuments($state);
27 27
 	}
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
 	public function getDocumentBySlug($slug, $state = 'published')
51 51
 	{
52 52
 		if (!in_array($state, Document::$DOCUMENT_STATES)) {
53
-			throw new \Exception('Unsupported document state: ' . $state);
53
+			throw new \Exception('Unsupported document state: '.$state);
54 54
 		}
55
-		$path = '/' . $slug;
55
+		$path = '/'.$slug;
56 56
 
57 57
 		return $this->repository->getDocumentByPath($path, $state);
58 58
 	}
@@ -66,16 +66,16 @@  discard block
 block discarded – undo
66 66
 	public function saveDocument($postValues, $state = 'unpublished')
67 67
 	{
68 68
 		if (!in_array($state, Document::$DOCUMENT_STATES)) {
69
-			throw new \Exception('Unsupported document state: ' . $state);
69
+			throw new \Exception('Unsupported document state: '.$state);
70 70
 		}
71
-		$oldPath = '/' . $postValues['path'];
71
+		$oldPath = '/'.$postValues['path'];
72 72
 
73 73
 		$container = $this->getDocumentContainerByPath($oldPath);
74 74
 		$documentObject = DocumentFactory::createDocumentFromPostValues($postValues, new DocumentTypesStorage($this->repository));
75 75
 		if ($container->path === '/') {
76
-			$newPath = $container->path . $documentObject->slug;
76
+			$newPath = $container->path.$documentObject->slug;
77 77
 		} else {
78
-			$newPath = $container->path . '/' . $documentObject->slug;
78
+			$newPath = $container->path.'/'.$documentObject->slug;
79 79
 		}
80 80
 		$documentObject->path = $newPath;
81 81
 		$this->repository->saveDocument($documentObject, $state);
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
 	{
90 90
 		$documentObject = DocumentFactory::createDocumentFromPostValues($postValues, new DocumentTypesStorage($this->repository));
91 91
 		if ($postValues['path'] === '/') {
92
-			$documentObject->path = $postValues['path'] . $documentObject->slug;
92
+			$documentObject->path = $postValues['path'].$documentObject->slug;
93 93
 		} else {
94
-			$documentObject->path = $postValues['path'] . '/' . $documentObject->slug;
94
+			$documentObject->path = $postValues['path'].'/'.$documentObject->slug;
95 95
 		}
96 96
 
97 97
 		$this->repository->saveDocument($documentObject, $state);
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public function deleteDocumentBySlug($slug)
104 104
 	{
105
-		$path = '/' . $slug;
105
+		$path = '/'.$slug;
106 106
 		$this->repository->deleteDocumentByPath($path);
107 107
 	}
108 108
 
Please login to merge, or discard this patch.
src/storage/storage/AbstractStorage.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,19 +38,19 @@
 block discarded – undo
38 38
 			array_pop($fileParts);
39 39
 			$fileNameWithoutExtension = implode('-', $fileParts);
40 40
 			$fileNameWithoutExtension = StringUtil::slugify($fileNameWithoutExtension);
41
-			$filename = $fileNameWithoutExtension . '.' . $extension;
41
+			$filename = $fileNameWithoutExtension.'.'.$extension;
42 42
 		} else {
43 43
 			$filename = StringUtil::slugify($filename);
44 44
 		}
45 45
 
46
-		if (file_exists($path . '/' . $filename)) {
46
+		if (file_exists($path.'/'.$filename)) {
47 47
 			$fileParts = explode('.', $filename);
48 48
 			if (count($fileParts) > 1) {
49 49
 				$extension = end($fileParts);
50 50
 				array_pop($fileParts);
51 51
 				$fileNameWithoutExtension = implode('-', $fileParts);
52 52
 				$fileNameWithoutExtension .= '-copy';
53
-				$filename = $fileNameWithoutExtension . '.' . $extension;
53
+				$filename = $fileNameWithoutExtension.'.'.$extension;
54 54
 			} else {
55 55
 				$filename .= '-copy';
56 56
 			}
Please login to merge, or discard this patch.
src/storage/storage/FilesStorage.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -25,13 +25,13 @@  discard block
 block discarded – undo
25 25
 	 */
26 26
 	public function addFile($postValues)
27 27
 	{
28
-		$destinationPath = realpath(__DIR__ . '/../../../www/files/');
28
+		$destinationPath = realpath(__DIR__.'/../../../www/files/');
29 29
 
30 30
 		$filename = $this->validateFilename($postValues['name'], $destinationPath);
31
-		$destination = $destinationPath . '/' . $filename;
31
+		$destination = $destinationPath.'/'.$filename;
32 32
 
33 33
 		if ($postValues['error'] != '0') {
34
-			throw new \Exception('Error uploading file. Error code: ' . $postValues['error']);
34
+			throw new \Exception('Error uploading file. Error code: '.$postValues['error']);
35 35
 		}
36 36
 
37 37
 		if (move_uploaded_file($postValues['tmp_name'], $destination)) {
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public function deleteFileByName($filename)
75 75
 	{
76
-		$destinationPath = realpath(__DIR__ . '/../../../www/files/');
77
-		$destination = $destinationPath . '/' . $filename;
76
+		$destinationPath = realpath(__DIR__.'/../../../www/files/');
77
+		$destination = $destinationPath.'/'.$filename;
78 78
 
79 79
 		if (file_exists($destination)) {
80 80
 			$files = $this->getFiles();
Please login to merge, or discard this patch.
src/storage/storage/ValuelistsStorage.php 1 patch
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -12,83 +12,83 @@
 block discarded – undo
12 12
 
13 13
 class ValuelistsStorage extends AbstractStorage
14 14
 {
15
-    /**
16
-     * Get all valuelists
17
-     *
18
-     * @return mixed
19
-     */
20
-    public function getValuelists()
21
-    {
22
-        return $this->repository->valuelists;
23
-    }
15
+	/**
16
+	 * Get all valuelists
17
+	 *
18
+	 * @return mixed
19
+	 */
20
+	public function getValuelists()
21
+	{
22
+		return $this->repository->valuelists;
23
+	}
24 24
 
25
-    public function addValuelist($postValues)
26
-    {
27
-        $valueListObject = ValuelistFactory::createValuelistFromPostValues($postValues);
28
-        $valuelists = $this->repository->valuelists;
29
-        $valuelists[] = $valueListObject;
30
-        $this->repository->valuelists = $valuelists;
31
-        $this->save();
32
-    }
25
+	public function addValuelist($postValues)
26
+	{
27
+		$valueListObject = ValuelistFactory::createValuelistFromPostValues($postValues);
28
+		$valuelists = $this->repository->valuelists;
29
+		$valuelists[] = $valueListObject;
30
+		$this->repository->valuelists = $valuelists;
31
+		$this->save();
32
+	}
33 33
 
34
-    /**
35
-     * Save changes to a valuelist
36
-     *
37
-     * @param $slug
38
-     * @param $postValues
39
-     *
40
-     * @throws \Exception
41
-     */
42
-    public function saveValuelist($slug, $postValues)
43
-    {
44
-        $valuelistObject = ValuelistFactory::createValuelistFromPostValues($postValues);
34
+	/**
35
+	 * Save changes to a valuelist
36
+	 *
37
+	 * @param $slug
38
+	 * @param $postValues
39
+	 *
40
+	 * @throws \Exception
41
+	 */
42
+	public function saveValuelist($slug, $postValues)
43
+	{
44
+		$valuelistObject = ValuelistFactory::createValuelistFromPostValues($postValues);
45 45
 
46
-        $valuelists = $this->repository->valuelists;
47
-        foreach ($valuelists as $key => $valuelist) {
48
-            if ($valuelist->slug == $slug) {
49
-                $valuelists[$key] = $valuelistObject;
50
-            }
51
-        }
52
-        $this->repository->valuelists = $valuelists;
53
-        $this->save();
54
-    }
46
+		$valuelists = $this->repository->valuelists;
47
+		foreach ($valuelists as $key => $valuelist) {
48
+			if ($valuelist->slug == $slug) {
49
+				$valuelists[$key] = $valuelistObject;
50
+			}
51
+		}
52
+		$this->repository->valuelists = $valuelists;
53
+		$this->save();
54
+	}
55 55
 
56
-    /**
57
-     * Get a valuelist by its slug
58
-     *
59
-     * @param $slug
60
-     *
61
-     * @return mixed
62
-     */
63
-    public function getValuelistBySlug($slug)
64
-    {
65
-        $valuelists = $this->repository->valuelists;
66
-        foreach ($valuelists as $valuelist) {
67
-            if ($valuelist->slug == $slug) {
68
-                return $valuelist;
69
-            }
70
-        }
56
+	/**
57
+	 * Get a valuelist by its slug
58
+	 *
59
+	 * @param $slug
60
+	 *
61
+	 * @return mixed
62
+	 */
63
+	public function getValuelistBySlug($slug)
64
+	{
65
+		$valuelists = $this->repository->valuelists;
66
+		foreach ($valuelists as $valuelist) {
67
+			if ($valuelist->slug == $slug) {
68
+				return $valuelist;
69
+			}
70
+		}
71 71
 
72
-        return null;
73
-    }
72
+		return null;
73
+	}
74 74
 
75
-    /**
76
-     * Delete a sitemap item by its slug
77
-     *
78
-     * @param $slug
79
-     *
80
-     * @throws \Exception
81
-     */
82
-    public function deleteValuelistBySlug($slug)
83
-    {
84
-        $valuelists = $this->repository->valuelists;
85
-        foreach ($valuelists as $key => $valuelist) {
86
-            if ($valuelist->slug == $slug) {
87
-                unset($valuelists[$key]);
88
-            }
89
-        }
90
-        $valuelists = array_values($valuelists);
91
-        $this->repository->valuelists = $valuelists;
92
-        $this->save();
93
-    }
75
+	/**
76
+	 * Delete a sitemap item by its slug
77
+	 *
78
+	 * @param $slug
79
+	 *
80
+	 * @throws \Exception
81
+	 */
82
+	public function deleteValuelistBySlug($slug)
83
+	{
84
+		$valuelists = $this->repository->valuelists;
85
+		foreach ($valuelists as $key => $valuelist) {
86
+			if ($valuelist->slug == $slug) {
87
+				unset($valuelists[$key]);
88
+			}
89
+		}
90
+		$valuelists = array_values($valuelists);
91
+		$this->repository->valuelists = $valuelists;
92
+		$this->save();
93
+	}
94 94
 }
95 95
\ No newline at end of file
Please login to merge, or discard this patch.