Passed
Push — develop ( cb779b...18e359 )
by Jens
02:35
created
src/search/filters/StopWordsFilter.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -11,37 +11,37 @@
 block discarded – undo
11 11
 
12 12
 abstract class StopWordsFilter implements Filter
13 13
 {
14
-    protected $tokens;
15
-    protected $stopWords = array();
14
+	protected $tokens;
15
+	protected $stopWords = array();
16 16
 
17
-    /**
18
-     * StopWordsFilter constructor.
19
-     * @param array $tokens
20
-     */
21
-    public function __construct($tokens)
22
-    {
23
-        $this->tokens = $tokens;
24
-    }
17
+	/**
18
+	 * StopWordsFilter constructor.
19
+	 * @param array $tokens
20
+	 */
21
+	public function __construct($tokens)
22
+	{
23
+		$this->tokens = $tokens;
24
+	}
25 25
 
26
-    /**
27
-     * @return array
28
-     */
29
-    public function getFilterResults()
30
-    {
31
-        foreach ($this->stopWords as $stopWord) {
32
-            foreach ($this->tokens as $field => $tokens) {
33
-                if (isset($tokens[$stopWord])) {
34
-                    $tokens[$stopWord] = null;
35
-                    unset($tokens[$stopWord]);
36
-                    $tokens = array_filter($tokens);
37
-                    asort($tokens);
38
-                }
26
+	/**
27
+	 * @return array
28
+	 */
29
+	public function getFilterResults()
30
+	{
31
+		foreach ($this->stopWords as $stopWord) {
32
+			foreach ($this->tokens as $field => $tokens) {
33
+				if (isset($tokens[$stopWord])) {
34
+					$tokens[$stopWord] = null;
35
+					unset($tokens[$stopWord]);
36
+					$tokens = array_filter($tokens);
37
+					asort($tokens);
38
+				}
39 39
 
40
-                $this->tokens[$field] = $tokens;
41
-            }
42
-        }
43
-        $this->tokens = array_filter($this->tokens);
44
-        asort($this->tokens);
45
-        return $this->tokens;
46
-    }
40
+				$this->tokens[$field] = $tokens;
41
+			}
42
+		}
43
+		$this->tokens = array_filter($this->tokens);
44
+		asort($this->tokens);
45
+		return $this->tokens;
46
+	}
47 47
 }
48 48
\ No newline at end of file
Please login to merge, or discard this patch.
src/storage/Storage.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace CloudControl\Cms\storage {
3 3
 
4
-    use CloudControl\Cms\storage\factories\DocumentFolderFactory;
5
-    use CloudControl\Cms\storage\storage\ApplicationComponentsStorage;
6
-    use CloudControl\Cms\storage\storage\BricksStorage;
7
-    use CloudControl\Cms\storage\storage\DocumentStorage;
8
-    use CloudControl\Cms\storage\storage\DocumentTypesStorage;
9
-    use CloudControl\Cms\storage\storage\FilesStorage;
10
-    use CloudControl\Cms\storage\storage\ImageSetStorage;
11
-    use CloudControl\Cms\storage\storage\ImagesStorage;
12
-    use CloudControl\Cms\storage\storage\RedirectsStorage;
13
-    use CloudControl\Cms\storage\storage\SitemapStorage;
14
-    use CloudControl\Cms\storage\storage\UsersStorage;
15
-    use CloudControl\Cms\storage\storage\ValuelistsStorage;
4
+	use CloudControl\Cms\storage\factories\DocumentFolderFactory;
5
+	use CloudControl\Cms\storage\storage\ApplicationComponentsStorage;
6
+	use CloudControl\Cms\storage\storage\BricksStorage;
7
+	use CloudControl\Cms\storage\storage\DocumentStorage;
8
+	use CloudControl\Cms\storage\storage\DocumentTypesStorage;
9
+	use CloudControl\Cms\storage\storage\FilesStorage;
10
+	use CloudControl\Cms\storage\storage\ImageSetStorage;
11
+	use CloudControl\Cms\storage\storage\ImagesStorage;
12
+	use CloudControl\Cms\storage\storage\RedirectsStorage;
13
+	use CloudControl\Cms\storage\storage\SitemapStorage;
14
+	use CloudControl\Cms\storage\storage\UsersStorage;
15
+	use CloudControl\Cms\storage\storage\ValuelistsStorage;
16 16
 
17
-    /**
17
+	/**
18 18
 	 * Class JsonStorage
19
-     * @package CloudControl\Cms\storage
19
+	 * @package CloudControl\Cms\storage
20 20
 	 */
21 21
 	class Storage
22 22
 	{
@@ -61,20 +61,20 @@  discard block
 block discarded – undo
61 61
 		 * @var DocumentStorage
62 62
 		 */
63 63
 		protected $documents;
64
-        /**
65
-         * @var RedirectsStorage
66
-         */
67
-        protected $redirects;
68
-        /**
69
-         * @var String
70
-         */
71
-        protected $imagesDir;
72
-        /**
73
-         * @var String
74
-         */
75
-        protected $filesDir;
64
+		/**
65
+		 * @var RedirectsStorage
66
+		 */
67
+		protected $redirects;
68
+		/**
69
+		 * @var String
70
+		 */
71
+		protected $imagesDir;
72
+		/**
73
+		 * @var String
74
+		 */
75
+		protected $filesDir;
76 76
 
77
-        /**
77
+		/**
78 78
 		 * @var String
79 79
 		 */
80 80
 		private $storageDir;
@@ -83,18 +83,18 @@  discard block
 block discarded – undo
83 83
 		 */
84 84
 		private $repository;
85 85
 
86
-        /**
87
-         * JsonStorage constructor.
88
-         *
89
-         * @param string $storageDir
90
-         * @param $imagesDir
91
-         * @param $filesDir
92
-         */
93
-        public function __construct($storageDir, $imagesDir, $filesDir)
86
+		/**
87
+		 * JsonStorage constructor.
88
+		 *
89
+		 * @param string $storageDir
90
+		 * @param $imagesDir
91
+		 * @param $filesDir
92
+		 */
93
+		public function __construct($storageDir, $imagesDir, $filesDir)
94 94
 		{
95 95
 			$this->storageDir = $storageDir;
96
-            $this->imagesDir = $imagesDir;
97
-            $this->filesDir = $filesDir;
96
+			$this->imagesDir = $imagesDir;
97
+			$this->filesDir = $filesDir;
98 98
 			$this->config();
99 99
 		}
100 100
 
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 		{
239 239
 			if (!$this->images instanceof ImagesStorage) {
240 240
 
241
-                $this->images = new ImagesStorage($this->repository, $this->imagesDir);
241
+				$this->images = new ImagesStorage($this->repository, $this->imagesDir);
242 242
 			}
243 243
 			return $this->images;
244 244
 		}
@@ -337,16 +337,16 @@  discard block
 block discarded – undo
337 337
 			return $this->valuelists;
338 338
 		}
339 339
 
340
-        /**
341
-         * @return \CloudControl\Cms\storage\storage\RedirectsStorage
342
-         */
343
-        public function getRedirects()
344
-        {
345
-            if (!$this->redirects instanceof RedirectsStorage) {
346
-                $this->redirects = new RedirectsStorage($this->repository);
347
-            }
348
-            return $this->redirects;
349
-        }
340
+		/**
341
+		 * @return \CloudControl\Cms\storage\storage\RedirectsStorage
342
+		 */
343
+		public function getRedirects()
344
+		{
345
+			if (!$this->redirects instanceof RedirectsStorage) {
346
+				$this->redirects = new RedirectsStorage($this->repository);
347
+			}
348
+			return $this->redirects;
349
+		}
350 350
 
351 351
 	}
352 352
 }
353 353
\ No newline at end of file
Please login to merge, or discard this patch.
src/storage/Document.php 1 patch
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -20,60 +20,60 @@  discard block
 block discarded – undo
20 20
  */
21 21
 class Document
22 22
 {
23
-    public $id;
24
-    public $path;
25
-    public $title;
26
-    public $slug;
27
-    public $type;
28
-    public $documentType;
29
-    public $documentTypeSlug;
30
-    public $state;
31
-    public $lastModificationDate;
32
-    public $creationDate;
33
-    public $lastModifiedBy;
34
-    protected $fields;
35
-    protected $bricks;
36
-    protected $dynamicBricks;
37
-    protected $content;
23
+	public $id;
24
+	public $path;
25
+	public $title;
26
+	public $slug;
27
+	public $type;
28
+	public $documentType;
29
+	public $documentTypeSlug;
30
+	public $state;
31
+	public $lastModificationDate;
32
+	public $creationDate;
33
+	public $lastModifiedBy;
34
+	protected $fields;
35
+	protected $bricks;
36
+	protected $dynamicBricks;
37
+	protected $content;
38 38
 
39
-    protected $dbHandle;
39
+	protected $dbHandle;
40 40
 
41
-    protected $jsonEncodedFields = array('fields', 'bricks', 'dynamicBricks');
42
-    protected $orderableFields = array('title', 'slug', 'type', 'documentType', 'documentTypeSlug', 'state', 'lastModificationDate', 'creationDate', 'lastModifiedBy');
41
+	protected $jsonEncodedFields = array('fields', 'bricks', 'dynamicBricks');
42
+	protected $orderableFields = array('title', 'slug', 'type', 'documentType', 'documentTypeSlug', 'state', 'lastModificationDate', 'creationDate', 'lastModifiedBy');
43 43
 
44
-    public static $DOCUMENT_STATES = array('published', 'unpublished');
44
+	public static $DOCUMENT_STATES = array('published', 'unpublished');
45 45
 
46
-    public function __get($name) {
47
-        if (in_array($name, $this->jsonEncodedFields)) {
48
-            if (is_string($this->$name)) {
49
-                return json_decode($this->$name);
50
-            } else {
51
-                return $this->$name;
52
-            }
53
-        } elseif ($name === 'content') {
54
-            if ($this->dbHandle === null) {
55
-                throw new \Exception('Document doesnt have a dbHandle handle. (path: ' . $this->path . ')');
56
-            } else {
57
-                if ($this->content === null) {
58
-                    return $this->getContent();
59
-                }
60
-            }
61
-        } elseif ($name === 'dbHandle') {
62
-            throw new \Exception('Trying to get protected property repository.');
63
-        }
64
-        return $this->$name;
65
-    }
46
+	public function __get($name) {
47
+		if (in_array($name, $this->jsonEncodedFields)) {
48
+			if (is_string($this->$name)) {
49
+				return json_decode($this->$name);
50
+			} else {
51
+				return $this->$name;
52
+			}
53
+		} elseif ($name === 'content') {
54
+			if ($this->dbHandle === null) {
55
+				throw new \Exception('Document doesnt have a dbHandle handle. (path: ' . $this->path . ')');
56
+			} else {
57
+				if ($this->content === null) {
58
+					return $this->getContent();
59
+				}
60
+			}
61
+		} elseif ($name === 'dbHandle') {
62
+			throw new \Exception('Trying to get protected property repository.');
63
+		}
64
+		return $this->$name;
65
+	}
66 66
 
67
-    public function __set($name, $value) {
68
-        if (in_array($name, $this->jsonEncodedFields)) {
69
-            $this->$name = json_encode($value);
70
-        } elseif ($name === 'content') {
71
-            // Dont do anything for now..
72
-            return;
73
-        }
67
+	public function __set($name, $value) {
68
+		if (in_array($name, $this->jsonEncodedFields)) {
69
+			$this->$name = json_encode($value);
70
+		} elseif ($name === 'content') {
71
+			// Dont do anything for now..
72
+			return;
73
+		}
74 74
 
75
-        $this->$name = $value;
76
-    }
75
+		$this->$name = $value;
76
+	}
77 77
 
78 78
 	/**
79 79
 	 * @param string $orderBy
@@ -82,15 +82,15 @@  discard block
 block discarded – undo
82 82
 	 * @return array
83 83
 	 * @throws \Exception
84 84
 	 */
85
-    public function getContent($orderBy = 'title', $order = 'ASC')
86
-    {
87
-        if (empty($this->content)) {
88
-            $docs = $this->documentStorage->getDocumentsWithState($this->path);
89
-            $this->content = $docs;
90
-        }
85
+	public function getContent($orderBy = 'title', $order = 'ASC')
86
+	{
87
+		if (empty($this->content)) {
88
+			$docs = $this->documentStorage->getDocumentsWithState($this->path);
89
+			$this->content = $docs;
90
+		}
91 91
 
92
-    	return $this->content;
93
-    }
92
+		return $this->content;
93
+	}
94 94
 
95 95
 	/**
96 96
 	 * @return string
Please login to merge, or discard this patch.
src/storage/factories/RedirectsFactory.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -10,26 +10,26 @@
 block discarded – undo
10 10
 
11 11
 class RedirectsFactory
12 12
 {
13
-    /**
14
-     * Create a new redirect object from postvalues
15
-     *
16
-     * @param $postValues
17
-     * @return \stdClass
18
-     * @throws \Exception
19
-     */
20
-    public static function createRedirectFromPostValues($postValues)
21
-    {
22
-        if (isset($postValues['title'], $postValues['fromUrl'], $postValues['toUrl'])) {
23
-            $redirectObject = new \stdClass();
24
-            $redirectObject->title = $postValues['title'];
25
-            $redirectObject->slug = StringUtil::slugify($postValues['title']);
26
-            $redirectObject->fromUrl = $postValues['fromUrl'];
27
-            $redirectObject->toUrl = $postValues['toUrl'];
28
-            $redirectObject->type = $postValues['type'];
13
+	/**
14
+	 * Create a new redirect object from postvalues
15
+	 *
16
+	 * @param $postValues
17
+	 * @return \stdClass
18
+	 * @throws \Exception
19
+	 */
20
+	public static function createRedirectFromPostValues($postValues)
21
+	{
22
+		if (isset($postValues['title'], $postValues['fromUrl'], $postValues['toUrl'])) {
23
+			$redirectObject = new \stdClass();
24
+			$redirectObject->title = $postValues['title'];
25
+			$redirectObject->slug = StringUtil::slugify($postValues['title']);
26
+			$redirectObject->fromUrl = $postValues['fromUrl'];
27
+			$redirectObject->toUrl = $postValues['toUrl'];
28
+			$redirectObject->type = $postValues['type'];
29 29
 
30
-            return $redirectObject;
31
-        } else {
32
-            throw new \Exception('Trying to create valuelist with invalid data.');
33
-        }
34
-    }
30
+			return $redirectObject;
31
+		} else {
32
+			throw new \Exception('Trying to create valuelist with invalid data.');
33
+		}
34
+	}
35 35
 }
36 36
\ No newline at end of file
Please login to merge, or discard this patch.
src/storage/factories/ValuelistFactory.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -12,34 +12,34 @@
 block discarded – undo
12 12
 
13 13
 class ValuelistFactory
14 14
 {
15
-    /**
16
-     * Create a sitemap item from post values
17
-     *
18
-     * @param $postValues
19
-     *
20
-     * @return \stdClass
21
-     * @throws \Exception
22
-     */
23
-    public static function createValuelistFromPostValues($postValues)
24
-    {
25
-        if (isset($postValues['title'])) {
26
-            $valuelistObject = new \stdClass();
27
-            $valuelistObject->title = $postValues['title'];
28
-            $valuelistObject->slug = StringUtil::slugify($postValues['title']);
29
-            $valuelistObject->pairs = new \stdClass();
30
-            if (isset($postValues['keys'], $postValues['values'])) {
31
-                foreach ($postValues['keys'] as $key => $value) {
32
-                    $valuelistObject->pairs->$value = $postValues['values'][$key];
33
-                }
34
-            }
35
-            $object_vars = get_object_vars($valuelistObject->pairs);
36
-            ksort($object_vars);
37
-            $valuelistObject->pairs = (object) $object_vars;
15
+	/**
16
+	 * Create a sitemap item from post values
17
+	 *
18
+	 * @param $postValues
19
+	 *
20
+	 * @return \stdClass
21
+	 * @throws \Exception
22
+	 */
23
+	public static function createValuelistFromPostValues($postValues)
24
+	{
25
+		if (isset($postValues['title'])) {
26
+			$valuelistObject = new \stdClass();
27
+			$valuelistObject->title = $postValues['title'];
28
+			$valuelistObject->slug = StringUtil::slugify($postValues['title']);
29
+			$valuelistObject->pairs = new \stdClass();
30
+			if (isset($postValues['keys'], $postValues['values'])) {
31
+				foreach ($postValues['keys'] as $key => $value) {
32
+					$valuelistObject->pairs->$value = $postValues['values'][$key];
33
+				}
34
+			}
35
+			$object_vars = get_object_vars($valuelistObject->pairs);
36
+			ksort($object_vars);
37
+			$valuelistObject->pairs = (object) $object_vars;
38 38
 
39
-            return $valuelistObject;
40
-        } else {
41
-            throw new \Exception('Trying to create valuelist with invalid data.');
42
-        }
43
-    }
39
+			return $valuelistObject;
40
+		} else {
41
+			throw new \Exception('Trying to create valuelist with invalid data.');
42
+		}
43
+	}
44 44
 
45 45
 }
46 46
\ No newline at end of file
Please login to merge, or discard this patch.
src/storage/storage/ImagesStorage.php 1 patch
Indentation   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -11,124 +11,124 @@
 block discarded – undo
11 11
 
12 12
 class ImagesStorage extends AbstractStorage
13 13
 {
14
-    protected $imagesDir;
15
-
16
-    public function __construct($repository, $imagesDir)
17
-    {
18
-        parent::__construct($repository);
19
-        $this->imagesDir = $imagesDir;
20
-    }
21
-
22
-
23
-    /**
24
-     * @var ImageSetStorage
25
-     */
26
-    protected $imageSet;
27
-
28
-    /**
29
-     * Get all images
30
-     *
31
-     * @return array
32
-     */
33
-    public function getImages()
34
-    {
35
-        return $this->repository->images;
36
-    }
37
-
38
-    /**
39
-     * @param $postValues
40
-     *
41
-     * @throws \Exception
42
-     */
43
-    public function addImage($postValues)
44
-    {
45
-        $destinationPath = $this->getDestinationPath();
46
-
47
-        $filename = $this->validateFilename($postValues['name'], $destinationPath);
48
-        $destination = $destinationPath . DIRECTORY_SEPARATOR . $filename;
49
-
50
-        if ($postValues['error'] != '0') {
51
-            throw new \Exception('Error uploading file. Error code: ' . $postValues['error']);
52
-        }
53
-
54
-        if (move_uploaded_file($postValues['tmp_name'], $destination)) {
55
-            $imageResizer = new ImageResizer($this->getImageSet()->getImageSet());
56
-            $fileNames = $imageResizer->applyImageSetToImage($destination);
57
-            $fileNames['original'] = $filename;
58
-            $imageObject = ImageFactory::createImageFromPostValues($postValues, $filename, $fileNames);
59
-
60
-            $images = $this->repository->images;
61
-            $images[] = $imageObject;
62
-            $this->repository->images = $images;
63
-
64
-            $this->save();
65
-        } else {
66
-            throw new \Exception('Error moving uploaded file');
67
-        }
68
-    }
69
-
70
-    /**
71
-     * Delete image by name
72
-     * @param $filename
73
-     */
74
-    public function deleteImageByName($filename)
75
-    {
76
-        $destinationPath = $this->getDestinationPath();
77
-
78
-        $images = $this->getImages();
79
-
80
-        foreach ($images as $key => $image) {
81
-            if ($image->file == $filename) {
82
-                foreach ($image->set as $imageSetFilename) {
83
-                    $destination = $destinationPath . '/' . $imageSetFilename;
84
-                    if (file_exists($destination)) {
85
-                        unlink($destination);
86
-                    } else {
87
-                        dump($destination);
88
-                    }
89
-                }
90
-                unset($images[$key]);
91
-            }
92
-        }
93
-
94
-        $this->repository->images = $images;
95
-        $this->save();
96
-    }
97
-
98
-    /**
99
-     * @param $filename
100
-     *
101
-     * @return null
102
-     */
103
-    public function getImageByName($filename)
104
-    {
105
-        $images = $this->getImages();
106
-        foreach ($images as $image) {
107
-            if ($image->file == $filename) {
108
-                return $image;
109
-            }
110
-        }
111
-
112
-        return null;
113
-    }
114
-
115
-    /**
116
-     * @return \CloudControl\Cms\storage\storage\ImageSetStorage
117
-     */
118
-    private function getImageSet()
119
-    {
120
-        if (!$this->imageSet instanceof ImageSetStorage) {
121
-            $this->imageSet = new ImageSetStorage($this->repository);
122
-        }
123
-        return $this->imageSet;
124
-    }
125
-
126
-    /**
127
-     * @return bool|string
128
-     */
129
-    private function getDestinationPath()
130
-    {
131
-        $destinationPath = realpath($this->imagesDir . DIRECTORY_SEPARATOR);
132
-        return $destinationPath;
133
-    }
14
+	protected $imagesDir;
15
+
16
+	public function __construct($repository, $imagesDir)
17
+	{
18
+		parent::__construct($repository);
19
+		$this->imagesDir = $imagesDir;
20
+	}
21
+
22
+
23
+	/**
24
+	 * @var ImageSetStorage
25
+	 */
26
+	protected $imageSet;
27
+
28
+	/**
29
+	 * Get all images
30
+	 *
31
+	 * @return array
32
+	 */
33
+	public function getImages()
34
+	{
35
+		return $this->repository->images;
36
+	}
37
+
38
+	/**
39
+	 * @param $postValues
40
+	 *
41
+	 * @throws \Exception
42
+	 */
43
+	public function addImage($postValues)
44
+	{
45
+		$destinationPath = $this->getDestinationPath();
46
+
47
+		$filename = $this->validateFilename($postValues['name'], $destinationPath);
48
+		$destination = $destinationPath . DIRECTORY_SEPARATOR . $filename;
49
+
50
+		if ($postValues['error'] != '0') {
51
+			throw new \Exception('Error uploading file. Error code: ' . $postValues['error']);
52
+		}
53
+
54
+		if (move_uploaded_file($postValues['tmp_name'], $destination)) {
55
+			$imageResizer = new ImageResizer($this->getImageSet()->getImageSet());
56
+			$fileNames = $imageResizer->applyImageSetToImage($destination);
57
+			$fileNames['original'] = $filename;
58
+			$imageObject = ImageFactory::createImageFromPostValues($postValues, $filename, $fileNames);
59
+
60
+			$images = $this->repository->images;
61
+			$images[] = $imageObject;
62
+			$this->repository->images = $images;
63
+
64
+			$this->save();
65
+		} else {
66
+			throw new \Exception('Error moving uploaded file');
67
+		}
68
+	}
69
+
70
+	/**
71
+	 * Delete image by name
72
+	 * @param $filename
73
+	 */
74
+	public function deleteImageByName($filename)
75
+	{
76
+		$destinationPath = $this->getDestinationPath();
77
+
78
+		$images = $this->getImages();
79
+
80
+		foreach ($images as $key => $image) {
81
+			if ($image->file == $filename) {
82
+				foreach ($image->set as $imageSetFilename) {
83
+					$destination = $destinationPath . '/' . $imageSetFilename;
84
+					if (file_exists($destination)) {
85
+						unlink($destination);
86
+					} else {
87
+						dump($destination);
88
+					}
89
+				}
90
+				unset($images[$key]);
91
+			}
92
+		}
93
+
94
+		$this->repository->images = $images;
95
+		$this->save();
96
+	}
97
+
98
+	/**
99
+	 * @param $filename
100
+	 *
101
+	 * @return null
102
+	 */
103
+	public function getImageByName($filename)
104
+	{
105
+		$images = $this->getImages();
106
+		foreach ($images as $image) {
107
+			if ($image->file == $filename) {
108
+				return $image;
109
+			}
110
+		}
111
+
112
+		return null;
113
+	}
114
+
115
+	/**
116
+	 * @return \CloudControl\Cms\storage\storage\ImageSetStorage
117
+	 */
118
+	private function getImageSet()
119
+	{
120
+		if (!$this->imageSet instanceof ImageSetStorage) {
121
+			$this->imageSet = new ImageSetStorage($this->repository);
122
+		}
123
+		return $this->imageSet;
124
+	}
125
+
126
+	/**
127
+	 * @return bool|string
128
+	 */
129
+	private function getDestinationPath()
130
+	{
131
+		$destinationPath = realpath($this->imagesDir . DIRECTORY_SEPARATOR);
132
+		return $destinationPath;
133
+	}
134 134
 }
135 135
\ No newline at end of file
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.
src/components/BaseComponent.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -2,11 +2,11 @@  discard block
 block discarded – undo
2 2
 namespace CloudControl\Cms\components
3 3
 {
4 4
 
5
-    use CloudControl\Cms\cc\Application;
6
-    use CloudControl\Cms\cc\Request;
7
-    use CloudControl\Cms\storage\Storage;
5
+	use CloudControl\Cms\cc\Application;
6
+	use CloudControl\Cms\cc\Request;
7
+	use CloudControl\Cms\storage\Storage;
8 8
 
9
-    class BaseComponent implements Component
9
+	class BaseComponent implements Component
10 10
 	{
11 11
 		/**
12 12
 		 * @var string
@@ -94,17 +94,17 @@  discard block
 block discarded – undo
94 94
 		 */
95 95
 		public function renderTemplate($template='', $obClean = true, $application=null)
96 96
 		{
97
-		    $templateDir = $this->getTemplateDir($template, $application);
98
-		    if ($application !== null) {
99
-                $rootDir = $application->getRootDir();
100
-                if (strpos($templateDir, $rootDir) === false) {
101
-                    $templatePath = $rootDir . DIRECTORY_SEPARATOR . $templateDir;
102
-                } else {
103
-                    $templatePath = $templateDir;
104
-                }
105
-            } else {
106
-		        $templatePath = $templateDir;
107
-            }
97
+			$templateDir = $this->getTemplateDir($template, $application);
98
+			if ($application !== null) {
99
+				$rootDir = $application->getRootDir();
100
+				if (strpos($templateDir, $rootDir) === false) {
101
+					$templatePath = $rootDir . DIRECTORY_SEPARATOR . $templateDir;
102
+				} else {
103
+					$templatePath = $templateDir;
104
+				}
105
+			} else {
106
+				$templatePath = $templateDir;
107
+			}
108 108
 			if (realpath($templatePath) !== false) {
109 109
 				if ($obClean) {
110 110
 					ob_clean();
@@ -151,19 +151,19 @@  discard block
 block discarded – undo
151 151
 			return $this->parameters;
152 152
 		}
153 153
 
154
-        /**
155
-         * @param $template
156
-         * @param null | Application $application
157
-         * @return string
158
-         */
159
-        protected function getTemplateDir($template, $application=null)
160
-        {
161
-            $templatePath = '';
162
-            if ($application !== null) {
163
-                $templatePath = $application->getTemplateDir();
164
-            }
165
-            $templatePath = $templatePath . $template . '.php';
166
-            return $templatePath;
167
-        }
168
-    }
154
+		/**
155
+		 * @param $template
156
+		 * @param null | Application $application
157
+		 * @return string
158
+		 */
159
+		protected function getTemplateDir($template, $application=null)
160
+		{
161
+			$templatePath = '';
162
+			if ($application !== null) {
163
+				$templatePath = $application->getTemplateDir();
164
+			}
165
+			$templatePath = $templatePath . $template . '.php';
166
+			return $templatePath;
167
+		}
168
+	}
169 169
 }
170 170
\ No newline at end of file
Please login to merge, or discard this patch.
src/components/CmsComponent.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace CloudControl\Cms\components {
3 3
 
4
-    use CloudControl\Cms\components\cms\ConfigurationRouting;
5
-    use CloudControl\Cms\components\cms\DocumentRouting;
6
-    use CloudControl\Cms\components\cms\FilesRouting;
7
-    use CloudControl\Cms\components\cms\ImagesRouting;
8
-    use CloudControl\Cms\components\cms\SearchRouting;
9
-    use CloudControl\Cms\components\cms\SitemapRouting;
10
-    use CloudControl\Cms\crypt\Crypt;
11
-    use CloudControl\Cms\storage\Storage;
12
-
13
-    class CmsComponent extends BaseComponent
4
+	use CloudControl\Cms\components\cms\ConfigurationRouting;
5
+	use CloudControl\Cms\components\cms\DocumentRouting;
6
+	use CloudControl\Cms\components\cms\FilesRouting;
7
+	use CloudControl\Cms\components\cms\ImagesRouting;
8
+	use CloudControl\Cms\components\cms\SearchRouting;
9
+	use CloudControl\Cms\components\cms\SitemapRouting;
10
+	use CloudControl\Cms\crypt\Crypt;
11
+	use CloudControl\Cms\storage\Storage;
12
+
13
+	class CmsComponent extends BaseComponent
14 14
 	{
15
-        /**
15
+		/**
16 16
 		 * @var \CloudControl\Cms\storage\Storage
17 17
 		 */
18 18
 		public $storage;
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 		const PARAMETER_IMAGE_SET = 'imageSet';
42 42
 		const PARAMETER_MAIN_NAV_CLASS = 'mainNavClass';
43 43
 		const PARAMETER_MY_BRICK_SLUG = 'myBrickSlug';
44
-        const PARAMETER_REDIRECT = 'redirect';
45
-        const PARAMETER_REDIRECTS = 'redirects';
44
+		const PARAMETER_REDIRECT = 'redirect';
45
+		const PARAMETER_REDIRECTS = 'redirects';
46 46
 		const PARAMETER_SEARCH = 'search';
47 47
 		const PARAMETER_SEARCH_LOG = "searchLog";
48 48
 		const PARAMETER_SEARCH_NEEDS_UPDATE = "searchNeedsUpdate";
@@ -57,14 +57,14 @@  discard block
 block discarded – undo
57 57
 		const PARAMETER_VALUELISTS = "valuelists";
58 58
 		const PARAMETER_WHITELIST_IPS = 'whitelistIps';
59 59
 
60
-        const POST_PARAMETER_COMPONENT = 'component';
61
-        const POST_PARAMETER_FROM_URL = "fromUrl";
62
-        const POST_PARAMETER_PASSWORD = 'password';
63
-        const POST_PARAMETER_SAVE = 'save';
64
-        const POST_PARAMETER_TEMPLATE = 'template';
65
-        const POST_PARAMETER_TITLE = 'title';
66
-        const POST_PARAMETER_TO_URL = "toUrl";
67
-        const POST_PARAMETER_USERNAME = 'username';
60
+		const POST_PARAMETER_COMPONENT = 'component';
61
+		const POST_PARAMETER_FROM_URL = "fromUrl";
62
+		const POST_PARAMETER_PASSWORD = 'password';
63
+		const POST_PARAMETER_SAVE = 'save';
64
+		const POST_PARAMETER_TEMPLATE = 'template';
65
+		const POST_PARAMETER_TITLE = 'title';
66
+		const POST_PARAMETER_TO_URL = "toUrl";
67
+		const POST_PARAMETER_USERNAME = 'username';
68 68
 
69 69
 		const GET_PARAMETER_PATH = 'path';
70 70
 		const GET_PARAMETER_SLUG = 'slug';
@@ -369,9 +369,9 @@  discard block
 block discarded – undo
369 369
 			}
370 370
 		}
371 371
 
372
-        protected function getTemplateDir($template, $application = null)
373
-        {
374
-            return __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . $template . '.php';
375
-        }
376
-    }
372
+		protected function getTemplateDir($template, $application = null)
373
+		{
374
+			return __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . $template . '.php';
375
+		}
376
+	}
377 377
 }
378 378
\ No newline at end of file
Please login to merge, or discard this patch.