Passed
Push — develop ( 02ffeb...d59462 )
by Jens
02:18
created
cloudcontrol/library/storage/storage/RedirectsStorage.php 1 patch
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -10,91 +10,91 @@
 block discarded – undo
10 10
 
11 11
 class RedirectsStorage extends AbstractStorage
12 12
 {
13
-    /**
14
-     * Get all redirects
15
-     *
16
-     * @return mixed
17
-     */
18
-    public function getRedirects()
19
-    {
20
-        $redirects = $this->repository->redirects;
21
-        usort($redirects, array($this, 'cmp'));
22
-        return $redirects;
23
-    }
13
+	/**
14
+	 * Get all redirects
15
+	 *
16
+	 * @return mixed
17
+	 */
18
+	public function getRedirects()
19
+	{
20
+		$redirects = $this->repository->redirects;
21
+		usort($redirects, array($this, 'cmp'));
22
+		return $redirects;
23
+	}
24 24
 
25
-    /**
26
-     * Add a new redirect
27
-     * @param $postValues
28
-     */
29
-    public function addRedirect($postValues) {
30
-        $redirectObject = RedirectsFactory::createRedirectFromPostValues($postValues);
31
-        $redirects = $this->repository->redirects;
32
-        $redirects[] = $redirectObject;
33
-        $this->repository->redirects = $redirects;
34
-        $this->save();
35
-    }
25
+	/**
26
+	 * Add a new redirect
27
+	 * @param $postValues
28
+	 */
29
+	public function addRedirect($postValues) {
30
+		$redirectObject = RedirectsFactory::createRedirectFromPostValues($postValues);
31
+		$redirects = $this->repository->redirects;
32
+		$redirects[] = $redirectObject;
33
+		$this->repository->redirects = $redirects;
34
+		$this->save();
35
+	}
36 36
 
37
-    /**
38
-     * Get a redirect by it's slug
39
-     *
40
-     * @param $slug
41
-     * @return \stdClass|null
42
-     */
43
-    public function getRedirectBySlug($slug)
44
-    {
45
-        $redirects = $this->repository->redirects;
46
-        foreach ($redirects as $redirect) {
47
-            if ($redirect->slug == $slug) {
48
-                return $redirect;
49
-            }
50
-        }
37
+	/**
38
+	 * Get a redirect by it's slug
39
+	 *
40
+	 * @param $slug
41
+	 * @return \stdClass|null
42
+	 */
43
+	public function getRedirectBySlug($slug)
44
+	{
45
+		$redirects = $this->repository->redirects;
46
+		foreach ($redirects as $redirect) {
47
+			if ($redirect->slug == $slug) {
48
+				return $redirect;
49
+			}
50
+		}
51 51
 
52
-        return null;
53
-    }
52
+		return null;
53
+	}
54 54
 
55
-    /**
56
-     * Save a redirect by it's slug
57
-     * @param $slug
58
-     * @param $postValues
59
-     */
60
-    public function saveRedirect($slug, $postValues)
61
-    {
62
-        $redirectObject = RedirectsFactory::createRedirectFromPostValues($postValues);
55
+	/**
56
+	 * Save a redirect by it's slug
57
+	 * @param $slug
58
+	 * @param $postValues
59
+	 */
60
+	public function saveRedirect($slug, $postValues)
61
+	{
62
+		$redirectObject = RedirectsFactory::createRedirectFromPostValues($postValues);
63 63
 
64
-        $redirects = $this->repository->redirects;
65
-        foreach ($redirects as $key => $redirect) {
66
-            if ($redirect->slug == $slug) {
67
-                $redirects[$key] = $redirectObject;
68
-            }
69
-        }
70
-        $this->repository->redirects = $redirects;
71
-        $this->save();
72
-    }
64
+		$redirects = $this->repository->redirects;
65
+		foreach ($redirects as $key => $redirect) {
66
+			if ($redirect->slug == $slug) {
67
+				$redirects[$key] = $redirectObject;
68
+			}
69
+		}
70
+		$this->repository->redirects = $redirects;
71
+		$this->save();
72
+	}
73 73
 
74
-    /**
75
-     * Delete a redirect by it's slug
76
-     * @param $slug
77
-     */
78
-    public function deleteRedirectBySlug($slug)
79
-    {
80
-        $redirects = $this->repository->redirects;
81
-        foreach ($redirects as $key => $redirect) {
82
-            if ($redirect->slug == $slug) {
83
-                unset($redirects[$key]);
84
-            }
85
-        }
86
-        $redirects = array_values($redirects);
87
-        $this->repository->redirects = $redirects;
88
-        $this->save();
89
-    }
74
+	/**
75
+	 * Delete a redirect by it's slug
76
+	 * @param $slug
77
+	 */
78
+	public function deleteRedirectBySlug($slug)
79
+	{
80
+		$redirects = $this->repository->redirects;
81
+		foreach ($redirects as $key => $redirect) {
82
+			if ($redirect->slug == $slug) {
83
+				unset($redirects[$key]);
84
+			}
85
+		}
86
+		$redirects = array_values($redirects);
87
+		$this->repository->redirects = $redirects;
88
+		$this->save();
89
+	}
90 90
 
91
-    /**
92
-     * Compare a redirect by it's title
93
-     * @param $a
94
-     * @param $b
95
-     * @return int
96
-     */
97
-    public static function cmp($a, $b) {
98
-        return strcmp($a->title, $b->title);
99
-    }
91
+	/**
92
+	 * Compare a redirect by it's title
93
+	 * @param $a
94
+	 * @param $b
95
+	 * @return int
96
+	 */
97
+	public static function cmp($a, $b) {
98
+		return strcmp($a->title, $b->title);
99
+	}
100 100
 }
101 101
\ No newline at end of file
Please login to merge, or discard this patch.
cloudcontrol/library/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.
cloudcontrol/library/components/cms/SitemapRouting.php 2 patches
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -14,26 +14,26 @@  discard block
 block discarded – undo
14 14
 class SitemapRouting implements CmsRouting
15 15
 {
16 16
 
17
-    /**
18
-     * SitemapRouting constructor.
19
-     * @param \library\cc\Request $request
20
-     * @param mixed|string $relativeCmsUri
21
-     * @param CmsComponent $cmsComponent
22
-     */
23
-    public function __construct($request, $relativeCmsUri, $cmsComponent)
24
-    {
25
-        if ($relativeCmsUri == '/sitemap') {
17
+	/**
18
+	 * SitemapRouting constructor.
19
+	 * @param \library\cc\Request $request
20
+	 * @param mixed|string $relativeCmsUri
21
+	 * @param CmsComponent $cmsComponent
22
+	 */
23
+	public function __construct($request, $relativeCmsUri, $cmsComponent)
24
+	{
25
+		if ($relativeCmsUri == '/sitemap') {
26 26
 			$this->overviewRoute($request, $cmsComponent);
27
-        } elseif ($relativeCmsUri == '/sitemap/new') {
27
+		} elseif ($relativeCmsUri == '/sitemap/new') {
28 28
 			$this->newRoute($request, $cmsComponent);
29
-        } elseif ($relativeCmsUri == '/sitemap/edit' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) {
29
+		} elseif ($relativeCmsUri == '/sitemap/edit' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) {
30 30
 			$this->editRoute($request, $cmsComponent);
31
-        } elseif ($relativeCmsUri == '/sitemap/delete' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) {
31
+		} elseif ($relativeCmsUri == '/sitemap/delete' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) {
32 32
 			$this->deleteRoute($request, $cmsComponent);
33
-        } else {
34
-            $this->redirectRoutes($relativeCmsUri, $request, $cmsComponent);
35
-        }
36
-    }
33
+		} else {
34
+			$this->redirectRoutes($relativeCmsUri, $request, $cmsComponent);
35
+		}
36
+	}
37 37
 
38 38
 	/**
39 39
 	 * @param $request
@@ -92,54 +92,54 @@  discard block
 block discarded – undo
92 92
 		exit;
93 93
 	}
94 94
 
95
-    private function redirectRoutes($relativeCmsUri, $request, $cmsComponent)
96
-    {
97
-        if ($relativeCmsUri == '/sitemap/redirects') {
98
-            $this->redirectsOverviewRoute($cmsComponent);
99
-        } elseif ($relativeCmsUri == '/sitemap/redirects/new') {
100
-            $this->redirectsNewRoute($request, $cmsComponent);
101
-        } elseif ($relativeCmsUri == '/sitemap/redirects/edit' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) {
102
-            $this->redirectEditRoute($request, $cmsComponent);
103
-        } elseif ($relativeCmsUri == '/sitemap/redirects/delete' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) {
104
-            $this->redirectDeleteRoute($request, $cmsComponent);
105
-        }
106
-    }
95
+	private function redirectRoutes($relativeCmsUri, $request, $cmsComponent)
96
+	{
97
+		if ($relativeCmsUri == '/sitemap/redirects') {
98
+			$this->redirectsOverviewRoute($cmsComponent);
99
+		} elseif ($relativeCmsUri == '/sitemap/redirects/new') {
100
+			$this->redirectsNewRoute($request, $cmsComponent);
101
+		} elseif ($relativeCmsUri == '/sitemap/redirects/edit' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) {
102
+			$this->redirectEditRoute($request, $cmsComponent);
103
+		} elseif ($relativeCmsUri == '/sitemap/redirects/delete' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) {
104
+			$this->redirectDeleteRoute($request, $cmsComponent);
105
+		}
106
+	}
107 107
 
108
-    private function redirectsOverviewRoute($cmsComponent)
109
-    {
110
-        $cmsComponent->subTemplate = 'cms/sitemap/redirects';
111
-        $cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_SITEMAP);
112
-        $cmsComponent->setParameter(CmsComponent::PARAMETER_REDIRECTS, $cmsComponent->storage->getRedirects()->getRedirects());
113
-    }
108
+	private function redirectsOverviewRoute($cmsComponent)
109
+	{
110
+		$cmsComponent->subTemplate = 'cms/sitemap/redirects';
111
+		$cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_SITEMAP);
112
+		$cmsComponent->setParameter(CmsComponent::PARAMETER_REDIRECTS, $cmsComponent->storage->getRedirects()->getRedirects());
113
+	}
114 114
 
115
-    private function redirectsNewRoute($request, $cmsComponent)
116
-    {
117
-        $cmsComponent->subTemplate = 'cms/sitemap/redirects-form';
118
-        $cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_SITEMAP);
119
-        if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$post[CmsComponent::POST_PARAMETER_FROM_URL], $request::$post[CmsComponent::POST_PARAMETER_TO_URL])) {
120
-            $cmsComponent->storage->getRedirects()->addRedirect($request::$post);
121
-            header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/sitemap/redirects');
122
-            exit;
123
-        }
124
-    }
115
+	private function redirectsNewRoute($request, $cmsComponent)
116
+	{
117
+		$cmsComponent->subTemplate = 'cms/sitemap/redirects-form';
118
+		$cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_SITEMAP);
119
+		if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$post[CmsComponent::POST_PARAMETER_FROM_URL], $request::$post[CmsComponent::POST_PARAMETER_TO_URL])) {
120
+			$cmsComponent->storage->getRedirects()->addRedirect($request::$post);
121
+			header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/sitemap/redirects');
122
+			exit;
123
+		}
124
+	}
125 125
 
126
-    private function redirectEditRoute($request, $cmsComponent)
127
-    {
128
-        $cmsComponent->subTemplate = 'cms/sitemap/redirects-form';
129
-        $cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_SITEMAP);
130
-        $redirect = $cmsComponent->storage->getRedirects()->getRedirectBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]);
131
-        if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$post[CmsComponent::POST_PARAMETER_FROM_URL], $request::$post[CmsComponent::POST_PARAMETER_TO_URL])) {
132
-            $cmsComponent->storage->getRedirects()->saveRedirect($request::$get[CmsComponent::GET_PARAMETER_SLUG], $request::$post);
133
-            header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/sitemap/redirects');
134
-            exit;
135
-        }
136
-        $cmsComponent->setParameter(CmsComponent::PARAMETER_REDIRECT, $redirect);
137
-    }
126
+	private function redirectEditRoute($request, $cmsComponent)
127
+	{
128
+		$cmsComponent->subTemplate = 'cms/sitemap/redirects-form';
129
+		$cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_SITEMAP);
130
+		$redirect = $cmsComponent->storage->getRedirects()->getRedirectBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]);
131
+		if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$post[CmsComponent::POST_PARAMETER_FROM_URL], $request::$post[CmsComponent::POST_PARAMETER_TO_URL])) {
132
+			$cmsComponent->storage->getRedirects()->saveRedirect($request::$get[CmsComponent::GET_PARAMETER_SLUG], $request::$post);
133
+			header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/sitemap/redirects');
134
+			exit;
135
+		}
136
+		$cmsComponent->setParameter(CmsComponent::PARAMETER_REDIRECT, $redirect);
137
+	}
138 138
 
139
-    private function redirectDeleteRoute($request, $cmsComponent)
140
-    {
141
-        $cmsComponent->storage->getRedirects()->deleteRedirectBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]);
142
-        header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/sitemap/redirects');
143
-        exit;
144
-    }
139
+	private function redirectDeleteRoute($request, $cmsComponent)
140
+	{
141
+		$cmsComponent->storage->getRedirects()->deleteRedirectBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]);
142
+		header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/sitemap/redirects');
143
+		exit;
144
+	}
145 145
 }
146 146
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 		$cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_SITEMAP);
60 60
 		if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$post[CmsComponent::POST_PARAMETER_TEMPLATE], $request::$post[CmsComponent::POST_PARAMETER_COMPONENT])) {
61 61
 			$cmsComponent->storage->getSitemap()->addSitemapItem($request::$post);
62
-			header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/sitemap');
62
+			header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/sitemap');
63 63
 			exit;
64 64
 		}
65 65
 	}
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 		$sitemapItem = $cmsComponent->storage->getSitemap()->getSitemapItemBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]);
76 76
 		if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$post[CmsComponent::POST_PARAMETER_TEMPLATE], $request::$post[CmsComponent::POST_PARAMETER_COMPONENT])) {
77 77
 			$cmsComponent->storage->getSitemap()->saveSitemapItem($request::$get[CmsComponent::GET_PARAMETER_SLUG], $request::$post);
78
-			header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/sitemap');
78
+			header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/sitemap');
79 79
 			exit;
80 80
 		}
81 81
 		$cmsComponent->setParameter(CmsComponent::PARAMETER_SITEMAP_ITEM, $sitemapItem);
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	private function deleteRoute($request, $cmsComponent)
89 89
 	{
90 90
 		$cmsComponent->storage->getSitemap()->deleteSitemapItemBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]);
91
-		header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/sitemap');
91
+		header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/sitemap');
92 92
 		exit;
93 93
 	}
94 94
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
         $cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_SITEMAP);
119 119
         if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$post[CmsComponent::POST_PARAMETER_FROM_URL], $request::$post[CmsComponent::POST_PARAMETER_TO_URL])) {
120 120
             $cmsComponent->storage->getRedirects()->addRedirect($request::$post);
121
-            header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/sitemap/redirects');
121
+            header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/sitemap/redirects');
122 122
             exit;
123 123
         }
124 124
     }
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
         $redirect = $cmsComponent->storage->getRedirects()->getRedirectBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]);
131 131
         if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$post[CmsComponent::POST_PARAMETER_FROM_URL], $request::$post[CmsComponent::POST_PARAMETER_TO_URL])) {
132 132
             $cmsComponent->storage->getRedirects()->saveRedirect($request::$get[CmsComponent::GET_PARAMETER_SLUG], $request::$post);
133
-            header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/sitemap/redirects');
133
+            header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/sitemap/redirects');
134 134
             exit;
135 135
         }
136 136
         $cmsComponent->setParameter(CmsComponent::PARAMETER_REDIRECT, $redirect);
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
     private function redirectDeleteRoute($request, $cmsComponent)
140 140
     {
141 141
         $cmsComponent->storage->getRedirects()->deleteRedirectBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]);
142
-        header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/sitemap/redirects');
142
+        header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/sitemap/redirects');
143 143
         exit;
144 144
     }
145 145
 }
146 146
\ No newline at end of file
Please login to merge, or discard this patch.
cloudcontrol/library/cc/Application.php 2 patches
Indentation   +267 added lines, -267 removed lines patch added patch discarded remove patch
@@ -2,271 +2,271 @@
 block discarded – undo
2 2
 
3 3
 namespace library\cc {
4 4
 
5
-    use library\components\Component;
6
-    use library\storage\Storage;
7
-
8
-    /**
9
-     * Class Application
10
-     * @package library\cc
11
-     */
12
-    class Application
13
-    {
14
-        /**
15
-         * @var \stdClass
16
-         */
17
-        private $config;
18
-        /**
19
-         * @var \library\storage\Storage $config
20
-         */
21
-        private $storage;
22
-
23
-        /**
24
-         * @var Request
25
-         */
26
-        private $request;
27
-
28
-        /**
29
-         * @var array
30
-         */
31
-        private $matchedSitemapItems = array();
32
-
33
-        /**
34
-         * @var array
35
-         */
36
-        private $applicationComponents = array();
37
-
38
-        /**
39
-         * Application constructor.
40
-         */
41
-        public function __construct()
42
-        {
43
-            $this->config();
44
-            $this->storage();
45
-
46
-            $this->request = new Request();
47
-
48
-            $this->redirectMatching($this->request);
49
-            $this->sitemapMatching($this->request);
50
-
51
-            $this->getApplicationComponents();
52
-
53
-            $this->runApplicationComponents();
54
-            $this->runSitemapComponents();
55
-
56
-            $this->renderApplicationComponents();
57
-            $this->renderSitemapComponents();
58
-        }
59
-
60
-        /**
61
-         * Initialize the config
62
-         *
63
-         * @throws \Exception
64
-         */
65
-        private function config()
66
-        {
67
-            $configPath = __DIR__ . '/../../config.json';
68
-            if (realpath($configPath) !== false) {
69
-                $json = file_get_contents($configPath);
70
-                $this->config = json_decode($json);
71
-            } else {
72
-                initFramework();
73
-                $this->config();
74
-            }
75
-        }
76
-
77
-        /**
78
-         * Initialize the storage
79
-         */
80
-        private function storage()
81
-        {
82
-            $this->storage = new Storage($this->getStorageDir());
83
-        }
84
-
85
-        private function redirectMatching($request)
86
-        {
87
-            $redirects = $this->storage->getRedirects()->getRedirects();
88
-            $relativeUri = '/' . $request::$relativeUri;
89
-
90
-            foreach ($redirects as $redirect) {
91
-                if (preg_match_all($redirect->fromUrl, $relativeUri, $matches)) {
92
-                    $toUrl = preg_replace($redirect->fromUrl, $redirect->toUrl, $relativeUri);
93
-                    if (substr($toUrl, 0, 1) == '/') {
94
-                        $toUrl = substr($toUrl, 1);
95
-                    }
96
-                    if ($redirect->type == '301') {
97
-                        header('HTTP/1.1 301 Moved Permanently');
98
-                        header('Location: ' . $request::$subfolders . $toUrl);
99
-                        exit;
100
-                    } elseif ($redirect->type == '302') {
101
-                        header('Location: ' . $request::$subfolders . $toUrl, true, 302);
102
-                        exit;
103
-                    } else {
104
-                        throw new \Exception('Invalid redirect type.');
105
-                    }
106
-                }
107
-            }
108
-        }
109
-
110
-        /**
111
-         * Loop through sitemap items and see if one matches the requestUri.
112
-         * If it does, add it tot the matchedSitemapItems array
113
-         *
114
-         * @param $request
115
-         */
116
-        private function sitemapMatching($request)
117
-        {
118
-            $sitemap = $this->storage->getSitemap()->getSitemap();
119
-            $relativeUri = '/' . $request::$relativeUri;
120
-
121
-            foreach ($sitemap as $sitemapItem) {
122
-                if ($sitemapItem->regex) {
123
-                    $matches = array();
124
-                    if (preg_match_all($sitemapItem->url, $relativeUri, $matches)) {
125
-                        // Make a clone, so it doesnt add the matches to the original
126
-                        $matchedClone = clone $sitemapItem;
127
-                        $matchedClone->matches = $matches;
128
-                        $this->matchedSitemapItems[] = $matchedClone;
129
-                        return;
130
-                    }
131
-                } else {
132
-                    if ($sitemapItem->url == $relativeUri) {
133
-                        $this->matchedSitemapItems[] = $sitemapItem;
134
-                        return;
135
-                    }
136
-                }
137
-            }
138
-        }
139
-
140
-        /**
141
-         * Loop through all application components and run them
142
-         *
143
-         * @throws \Exception
144
-         */
145
-        private function runApplicationComponents()
146
-        {
147
-            foreach ($this->applicationComponents as $key => $applicationComponent) {
148
-                $class = $applicationComponent->component;
149
-                $parameters = $applicationComponent->parameters;
150
-                $this->applicationComponents[$key]->{'object'} = $this->getComponentObject($class, null, $parameters, null);
151
-                $this->applicationComponents[$key]->{'object'}->run($this->storage);
152
-            }
153
-        }
154
-
155
-        /**
156
-         * Loop through all (matched) sitemap components and run them
157
-         *
158
-         * @throws \Exception
159
-         */
160
-        private function runSitemapComponents()
161
-        {
162
-            foreach ($this->matchedSitemapItems as $key => $sitemapItem) {
163
-                $class = $sitemapItem->component;
164
-                $template = $sitemapItem->template;
165
-                $parameters = $sitemapItem->parameters;
166
-
167
-                $this->matchedSitemapItems[$key]->object = $this->getComponentObject($class, $template, $parameters, $sitemapItem);
168
-
169
-                $this->matchedSitemapItems[$key]->object->run($this->storage);
170
-            }
171
-        }
172
-
173
-        /**
174
-         * @param string $class
175
-         * @param string $template
176
-         * @param array $parameters
177
-         * @param \stdClass|null $matchedSitemapItem
178
-         *
179
-         * @return mixed
180
-         * @throws \Exception
181
-         */
182
-        private function getComponentObject($class = '', $template = '', $parameters = array(), $matchedSitemapItem)
183
-        {
184
-            $libraryComponentName = '\\library\\components\\' . $class;
185
-            $userComponentName = '\\components\\' . $class;
186
-
187
-            if (AutoloadUtil::autoLoad($libraryComponentName, false)) {
188
-                $component = new $libraryComponentName($template, $this->request, $parameters, $matchedSitemapItem);
189
-            } elseif (AutoloadUtil::autoLoad($userComponentName, false)) {
190
-                $component = new $userComponentName($template, $this->request, $parameters, $matchedSitemapItem);
191
-            } else {
192
-                throw new \Exception('Could not load component ' . $class);
193
-            }
194
-
195
-            if (!$component instanceof Component) {
196
-                throw new \Exception('Component not of type Component. Must inherit \library\components\Component');
197
-            }
198
-
199
-            return $component;
200
-        }
201
-
202
-        /**
203
-         * Loop through all application components and render them
204
-         */
205
-        private function renderApplicationComponents()
206
-        {
207
-            foreach ($this->applicationComponents as $applicationComponent) {
208
-                $applicationComponent->{'object'}->render();
209
-            }
210
-        }
211
-
212
-        /**
213
-         * Loop through all (matched) sitemap components and render them
214
-         */
215
-        private function renderSitemapComponents()
216
-        {
217
-            foreach ($this->matchedSitemapItems as $sitemapItem) {
218
-                $this->setCachingHeaders();
219
-                $sitemapItem->object->render($this);
220
-                ob_clean();
221
-                echo $sitemapItem->object->get();
222
-                ob_end_flush();
223
-                exit;
224
-            }
225
-        }
226
-
227
-        public function getAllApplicationComponentParameters()
228
-        {
229
-            $allParameters = array();
230
-            foreach ($this->applicationComponents as $applicationComponent) {
231
-                $parameters = $applicationComponent->{'object'}->getParameters();
232
-                $allParameters[] = $parameters;
233
-            }
234
-            return $allParameters;
235
-        }
236
-
237
-        public function unlockApplicationComponentParameters()
238
-        {
239
-            foreach ($this->applicationComponents as $applicationComponent) {
240
-                $parameters = $applicationComponent->{'object'}->getParameters();
241
-                extract($parameters);
242
-            }
243
-        }
244
-
245
-        /**
246
-         * Set the default caching of pages to 2 days
247
-         */
248
-        public function setCachingHeaders()
249
-        {
250
-            header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + (60 * 60 * 24 * 2))); // 2 days
251
-            header("Cache-Control: max-age=" . (60 * 60 * 24 * 2));
252
-        }
253
-
254
-        /**
255
-         * @return string
256
-         */
257
-        public function getStoragePath()
258
-        {
259
-            return $this->config->storagePath;
260
-        }
261
-
262
-        public function getStorageDir()
263
-        {
264
-            return $this->config->storageDir;
265
-        }
266
-
267
-        public function getApplicationComponents()
268
-        {
269
-            $this->applicationComponents = $this->storage->getApplicationComponents()->getApplicationComponents();
270
-        }
271
-    }
5
+	use library\components\Component;
6
+	use library\storage\Storage;
7
+
8
+	/**
9
+	 * Class Application
10
+	 * @package library\cc
11
+	 */
12
+	class Application
13
+	{
14
+		/**
15
+		 * @var \stdClass
16
+		 */
17
+		private $config;
18
+		/**
19
+		 * @var \library\storage\Storage $config
20
+		 */
21
+		private $storage;
22
+
23
+		/**
24
+		 * @var Request
25
+		 */
26
+		private $request;
27
+
28
+		/**
29
+		 * @var array
30
+		 */
31
+		private $matchedSitemapItems = array();
32
+
33
+		/**
34
+		 * @var array
35
+		 */
36
+		private $applicationComponents = array();
37
+
38
+		/**
39
+		 * Application constructor.
40
+		 */
41
+		public function __construct()
42
+		{
43
+			$this->config();
44
+			$this->storage();
45
+
46
+			$this->request = new Request();
47
+
48
+			$this->redirectMatching($this->request);
49
+			$this->sitemapMatching($this->request);
50
+
51
+			$this->getApplicationComponents();
52
+
53
+			$this->runApplicationComponents();
54
+			$this->runSitemapComponents();
55
+
56
+			$this->renderApplicationComponents();
57
+			$this->renderSitemapComponents();
58
+		}
59
+
60
+		/**
61
+		 * Initialize the config
62
+		 *
63
+		 * @throws \Exception
64
+		 */
65
+		private function config()
66
+		{
67
+			$configPath = __DIR__ . '/../../config.json';
68
+			if (realpath($configPath) !== false) {
69
+				$json = file_get_contents($configPath);
70
+				$this->config = json_decode($json);
71
+			} else {
72
+				initFramework();
73
+				$this->config();
74
+			}
75
+		}
76
+
77
+		/**
78
+		 * Initialize the storage
79
+		 */
80
+		private function storage()
81
+		{
82
+			$this->storage = new Storage($this->getStorageDir());
83
+		}
84
+
85
+		private function redirectMatching($request)
86
+		{
87
+			$redirects = $this->storage->getRedirects()->getRedirects();
88
+			$relativeUri = '/' . $request::$relativeUri;
89
+
90
+			foreach ($redirects as $redirect) {
91
+				if (preg_match_all($redirect->fromUrl, $relativeUri, $matches)) {
92
+					$toUrl = preg_replace($redirect->fromUrl, $redirect->toUrl, $relativeUri);
93
+					if (substr($toUrl, 0, 1) == '/') {
94
+						$toUrl = substr($toUrl, 1);
95
+					}
96
+					if ($redirect->type == '301') {
97
+						header('HTTP/1.1 301 Moved Permanently');
98
+						header('Location: ' . $request::$subfolders . $toUrl);
99
+						exit;
100
+					} elseif ($redirect->type == '302') {
101
+						header('Location: ' . $request::$subfolders . $toUrl, true, 302);
102
+						exit;
103
+					} else {
104
+						throw new \Exception('Invalid redirect type.');
105
+					}
106
+				}
107
+			}
108
+		}
109
+
110
+		/**
111
+		 * Loop through sitemap items and see if one matches the requestUri.
112
+		 * If it does, add it tot the matchedSitemapItems array
113
+		 *
114
+		 * @param $request
115
+		 */
116
+		private function sitemapMatching($request)
117
+		{
118
+			$sitemap = $this->storage->getSitemap()->getSitemap();
119
+			$relativeUri = '/' . $request::$relativeUri;
120
+
121
+			foreach ($sitemap as $sitemapItem) {
122
+				if ($sitemapItem->regex) {
123
+					$matches = array();
124
+					if (preg_match_all($sitemapItem->url, $relativeUri, $matches)) {
125
+						// Make a clone, so it doesnt add the matches to the original
126
+						$matchedClone = clone $sitemapItem;
127
+						$matchedClone->matches = $matches;
128
+						$this->matchedSitemapItems[] = $matchedClone;
129
+						return;
130
+					}
131
+				} else {
132
+					if ($sitemapItem->url == $relativeUri) {
133
+						$this->matchedSitemapItems[] = $sitemapItem;
134
+						return;
135
+					}
136
+				}
137
+			}
138
+		}
139
+
140
+		/**
141
+		 * Loop through all application components and run them
142
+		 *
143
+		 * @throws \Exception
144
+		 */
145
+		private function runApplicationComponents()
146
+		{
147
+			foreach ($this->applicationComponents as $key => $applicationComponent) {
148
+				$class = $applicationComponent->component;
149
+				$parameters = $applicationComponent->parameters;
150
+				$this->applicationComponents[$key]->{'object'} = $this->getComponentObject($class, null, $parameters, null);
151
+				$this->applicationComponents[$key]->{'object'}->run($this->storage);
152
+			}
153
+		}
154
+
155
+		/**
156
+		 * Loop through all (matched) sitemap components and run them
157
+		 *
158
+		 * @throws \Exception
159
+		 */
160
+		private function runSitemapComponents()
161
+		{
162
+			foreach ($this->matchedSitemapItems as $key => $sitemapItem) {
163
+				$class = $sitemapItem->component;
164
+				$template = $sitemapItem->template;
165
+				$parameters = $sitemapItem->parameters;
166
+
167
+				$this->matchedSitemapItems[$key]->object = $this->getComponentObject($class, $template, $parameters, $sitemapItem);
168
+
169
+				$this->matchedSitemapItems[$key]->object->run($this->storage);
170
+			}
171
+		}
172
+
173
+		/**
174
+		 * @param string $class
175
+		 * @param string $template
176
+		 * @param array $parameters
177
+		 * @param \stdClass|null $matchedSitemapItem
178
+		 *
179
+		 * @return mixed
180
+		 * @throws \Exception
181
+		 */
182
+		private function getComponentObject($class = '', $template = '', $parameters = array(), $matchedSitemapItem)
183
+		{
184
+			$libraryComponentName = '\\library\\components\\' . $class;
185
+			$userComponentName = '\\components\\' . $class;
186
+
187
+			if (AutoloadUtil::autoLoad($libraryComponentName, false)) {
188
+				$component = new $libraryComponentName($template, $this->request, $parameters, $matchedSitemapItem);
189
+			} elseif (AutoloadUtil::autoLoad($userComponentName, false)) {
190
+				$component = new $userComponentName($template, $this->request, $parameters, $matchedSitemapItem);
191
+			} else {
192
+				throw new \Exception('Could not load component ' . $class);
193
+			}
194
+
195
+			if (!$component instanceof Component) {
196
+				throw new \Exception('Component not of type Component. Must inherit \library\components\Component');
197
+			}
198
+
199
+			return $component;
200
+		}
201
+
202
+		/**
203
+		 * Loop through all application components and render them
204
+		 */
205
+		private function renderApplicationComponents()
206
+		{
207
+			foreach ($this->applicationComponents as $applicationComponent) {
208
+				$applicationComponent->{'object'}->render();
209
+			}
210
+		}
211
+
212
+		/**
213
+		 * Loop through all (matched) sitemap components and render them
214
+		 */
215
+		private function renderSitemapComponents()
216
+		{
217
+			foreach ($this->matchedSitemapItems as $sitemapItem) {
218
+				$this->setCachingHeaders();
219
+				$sitemapItem->object->render($this);
220
+				ob_clean();
221
+				echo $sitemapItem->object->get();
222
+				ob_end_flush();
223
+				exit;
224
+			}
225
+		}
226
+
227
+		public function getAllApplicationComponentParameters()
228
+		{
229
+			$allParameters = array();
230
+			foreach ($this->applicationComponents as $applicationComponent) {
231
+				$parameters = $applicationComponent->{'object'}->getParameters();
232
+				$allParameters[] = $parameters;
233
+			}
234
+			return $allParameters;
235
+		}
236
+
237
+		public function unlockApplicationComponentParameters()
238
+		{
239
+			foreach ($this->applicationComponents as $applicationComponent) {
240
+				$parameters = $applicationComponent->{'object'}->getParameters();
241
+				extract($parameters);
242
+			}
243
+		}
244
+
245
+		/**
246
+		 * Set the default caching of pages to 2 days
247
+		 */
248
+		public function setCachingHeaders()
249
+		{
250
+			header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + (60 * 60 * 24 * 2))); // 2 days
251
+			header("Cache-Control: max-age=" . (60 * 60 * 24 * 2));
252
+		}
253
+
254
+		/**
255
+		 * @return string
256
+		 */
257
+		public function getStoragePath()
258
+		{
259
+			return $this->config->storagePath;
260
+		}
261
+
262
+		public function getStorageDir()
263
+		{
264
+			return $this->config->storageDir;
265
+		}
266
+
267
+		public function getApplicationComponents()
268
+		{
269
+			$this->applicationComponents = $this->storage->getApplicationComponents()->getApplicationComponents();
270
+		}
271
+	}
272 272
 }
273 273
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
          */
65 65
         private function config()
66 66
         {
67
-            $configPath = __DIR__ . '/../../config.json';
67
+            $configPath = __DIR__.'/../../config.json';
68 68
             if (realpath($configPath) !== false) {
69 69
                 $json = file_get_contents($configPath);
70 70
                 $this->config = json_decode($json);
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         private function redirectMatching($request)
86 86
         {
87 87
             $redirects = $this->storage->getRedirects()->getRedirects();
88
-            $relativeUri = '/' . $request::$relativeUri;
88
+            $relativeUri = '/'.$request::$relativeUri;
89 89
 
90 90
             foreach ($redirects as $redirect) {
91 91
                 if (preg_match_all($redirect->fromUrl, $relativeUri, $matches)) {
@@ -95,10 +95,10 @@  discard block
 block discarded – undo
95 95
                     }
96 96
                     if ($redirect->type == '301') {
97 97
                         header('HTTP/1.1 301 Moved Permanently');
98
-                        header('Location: ' . $request::$subfolders . $toUrl);
98
+                        header('Location: '.$request::$subfolders.$toUrl);
99 99
                         exit;
100 100
                     } elseif ($redirect->type == '302') {
101
-                        header('Location: ' . $request::$subfolders . $toUrl, true, 302);
101
+                        header('Location: '.$request::$subfolders.$toUrl, true, 302);
102 102
                         exit;
103 103
                     } else {
104 104
                         throw new \Exception('Invalid redirect type.');
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
         private function sitemapMatching($request)
117 117
         {
118 118
             $sitemap = $this->storage->getSitemap()->getSitemap();
119
-            $relativeUri = '/' . $request::$relativeUri;
119
+            $relativeUri = '/'.$request::$relativeUri;
120 120
 
121 121
             foreach ($sitemap as $sitemapItem) {
122 122
                 if ($sitemapItem->regex) {
@@ -181,15 +181,15 @@  discard block
 block discarded – undo
181 181
          */
182 182
         private function getComponentObject($class = '', $template = '', $parameters = array(), $matchedSitemapItem)
183 183
         {
184
-            $libraryComponentName = '\\library\\components\\' . $class;
185
-            $userComponentName = '\\components\\' . $class;
184
+            $libraryComponentName = '\\library\\components\\'.$class;
185
+            $userComponentName = '\\components\\'.$class;
186 186
 
187 187
             if (AutoloadUtil::autoLoad($libraryComponentName, false)) {
188 188
                 $component = new $libraryComponentName($template, $this->request, $parameters, $matchedSitemapItem);
189 189
             } elseif (AutoloadUtil::autoLoad($userComponentName, false)) {
190 190
                 $component = new $userComponentName($template, $this->request, $parameters, $matchedSitemapItem);
191 191
             } else {
192
-                throw new \Exception('Could not load component ' . $class);
192
+                throw new \Exception('Could not load component '.$class);
193 193
             }
194 194
 
195 195
             if (!$component instanceof Component) {
@@ -247,8 +247,8 @@  discard block
 block discarded – undo
247 247
          */
248 248
         public function setCachingHeaders()
249 249
         {
250
-            header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + (60 * 60 * 24 * 2))); // 2 days
251
-            header("Cache-Control: max-age=" . (60 * 60 * 24 * 2));
250
+            header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + (60 * 60 * 24 * 2))); // 2 days
251
+            header("Cache-Control: max-age=".(60 * 60 * 24 * 2));
252 252
         }
253 253
 
254 254
         /**
Please login to merge, or discard this patch.
cloudcontrol/library/storage/Document.php 2 patches
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.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
             }
53 53
         } elseif ($name === 'content') {
54 54
             if ($this->dbHandle === null) {
55
-                throw new \Exception('Document doesnt have a dbHandle handle. (path: ' . $this->path . ')');
55
+                throw new \Exception('Document doesnt have a dbHandle handle. (path: '.$this->path.')');
56 56
             } else {
57 57
                 if ($this->content === null) {
58 58
                     return $this->getContent();
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	 */
98 98
 	public function __toString()
99 99
 	{
100
-		return 'Document:' . $this->title;
100
+		return 'Document:'.$this->title;
101 101
 	}
102 102
 
103 103
 
Please login to merge, or discard this patch.