Completed
Push — master ( 1dcf13...e7ea38 )
by Rafidison
02:42
created
Controller/CommentsController.php 4 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
 	/**
62 62
 	 * @param $params
63
-	 * @param $request
63
+	 * @param Request $request
64 64
 	 * @param $comment_class
65 65
 	 * @return Response
66 66
 	 */
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 * Return a template
99 99
 	 * @param $comment
100 100
 	 * @param $request
101
-	 * @param $max_depth
101
+	 * @param boolean $max_depth
102 102
 	 * @return string
103 103
 	 */
104 104
 	private function renderResponse($comment,$request,$max_depth)
@@ -213,8 +213,8 @@  discard block
 block discarded – undo
213 213
 	}
214 214
 
215 215
 	/**
216
-	 * @param $request
217
-	 * @param $session
216
+	 * @param Request $request
217
+	 * @param \Symfony\Component\HttpFoundation\Session\SessionInterface $session
218 218
 	 */
219 219
 	private function error($request, $session)
220 220
 	{
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 
246 246
 	/**
247 247
 	 * Error message for Ajax
248
-	 * @param $form
248
+	 * @param \Symfony\Component\Form\Form $form
249 249
 	 * @return Response
250 250
 	 */
251 251
 	private function returnAjaxErrors($form)
Please login to merge, or discard this patch.
Indentation   +245 added lines, -245 removed lines patch added patch discarded remove patch
@@ -8,249 +8,249 @@
 block discarded – undo
8 8
 
9 9
 class CommentsController extends Controller
10 10
 {
11
-	private function gEm()
12
-	{
13
-		return $this->getDoctrine()->getManager();
14
-	}
15
-
16
-	/**
17
-	 * Manage comment process
18
-	 * @param Request $request
19
-	 * @return \Symfony\Component\HttpFoundation\RedirectResponse
20
-	 * @internal param $bundle
21
-	 * @internal param $ref
22
-	 * @internal param $ref_id
23
-	 */
24
-	public function manageAction(Request $request)
25
-	{
26
-		$params = [
27
-			'manager'=>$this->get('mykees.comment.manager'),
28
-			'session'=>$request->getSession(),
29
-			'ref'    => $request->request->get('model') ? $request->request->get('model') : $request->request->get('mykees_comment')['model'],
30
-			'ref_id' => $request->request->get('modelId') ? $request->request->get('modelId') : $request->request->get('mykees_comment')['modelId']
31
-		];
32
-
33
-		$comment_class_name = $this->container->getParameter('mykees_comment.comment.class');
34
-		$comment_class = new $comment_class_name();
35
-		$form = $this->createForm($this->get('mykees.comment.form'),$comment_class);
36
-
37
-		if('POST' == $request->getMethod()) {
38
-
39
-			if ($form->handleRequest($request)->isValid()) {
40
-
41
-				if($request->isXmlHttpRequest()) {
42
-					return $this->ajaxInfo($params,$request,$comment_class);
43
-				}
44
-
45
-				$this->postInfo($params, $request, $comment_class, $params['session']);
46
-
47
-			}else{
48
-
49
-				if($request->isXmlHttpRequest()) {
50
-					return $this->returnAjaxErrors($form);
51
-				}else{
52
-					$this->error($request, $params['session']);
53
-				}
54
-			}
55
-
56
-		}
57
-
58
-		return $this->redirect($request->headers->get('referer') . '#comments_area');
59
-	}
60
-
61
-	/**
62
-	 * @param $params
63
-	 * @param $request
64
-	 * @param $comment_class
65
-	 * @return Response
66
-	 */
67
-	private function ajaxInfo($params,$request,$comment_class)
68
-	{
69
-
70
-		$comment = $this->postInfo($params, $request, $comment_class, $params['session']);
71
-		$comment_depth = $this->container->getParameter('comment.depth');
72
-
73
-		// Si la profondeur du commentaire parent est inférieure ou égale à la profondeur définis
74
-		if($request->request->get('depth') < $comment_depth && $comment_depth >= 1)
75
-		{
76
-			$comment->setDepthReached($request->request->get('depth') + 1);//On incremente la profondeur max
77
-			$comment->setDepth($comment->getId()); //la profondeur de réponse est égale a l'id
78
-			$max_depth = false;
79
-		}else{
80
-			$comment->setDepthReached($request->request->get('depth'));//On à atteint la profondeur max
81
-			$comment->setDepth($comment->getParentId());//la profondeur de réponse est éagle au commentaire parent
82
-			$max_depth = true;
83
-		}
84
-
85
-		$template = $this->renderResponse($comment,$request,$max_depth);
86
-		$json = json_encode([
87
-			'template'=>$template,
88
-			"parent_id"=>$comment->getParentId(),
89
-			'comment_id'=>$comment->getId(),
90
-			'max_depth'=>$max_depth,
91
-			'success_message'=>$this->get('session')->getFlashBag()->get('comment_success')
92
-		]);
93
-
94
-		return new Response($json);
95
-	}
96
-
97
-	/**
98
-	 * Return a template
99
-	 * @param $comment
100
-	 * @param $request
101
-	 * @param $max_depth
102
-	 * @return string
103
-	 */
104
-	private function renderResponse($comment,$request,$max_depth)
105
-	{
106
-		if($comment->getParentId() > 0)
107
-		{
108
-			if( ($request->request->get('response_type') === "true" && $max_depth === true) ||
109
-				($request->request->get('response_type') === "false" && $max_depth === true) ||
110
-				($request->request->get('response_type') === "true" && $max_depth === false)
111
-			){
112
-				return $this->renderView('MykeesCommentBundle:Comments:unwrap_replies.html.twig',['comment'=>$comment,'recent_reply'=>true]);
113
-			}else{
114
-				return $this->renderView('MykeesCommentBundle:Comments:replies.html.twig',['comment'=>$comment,'recent_reply'=>true]);
115
-			}
116
-		}else{
117
-			return $this->renderView('MykeesCommentBundle:Comments:comment.html.twig',['comment'=>$comment,'recent_reply'=>true]);
118
-		}
119
-	}
120
-
121
-
122
-	/**
123
-	 * Init/save comment and user info
124
-	 * @param $request
125
-	 * @param $comment
126
-	 * @param $params
127
-	 * @param $session
128
-	 * @return
129
-	 */
130
-	private function postInfo($params, $request, $comment, $session)
131
-	{
132
-		$this->userInfo($request, $comment);
133
-		$this->commentInfo($params,$comment,$request,$params['ref_id']);
134
-
135
-		$this->save($comment);
136
-		$this->messageFlash($session);
137
-
138
-		return $comment;
139
-	}
140
-
141
-	/**
142
-	 * Save comment entity
143
-	 * @param $comment
144
-	 */
145
-	private function save($comment)
146
-	{
147
-		$this->gEm()->persist($comment);
148
-		$this->gEm()->flush();
149
-
150
-		return $comment;
151
-	}
152
-
153
-	/**
154
-	 * Init comment info
155
-	 * @param $params
156
-	 * @param $comment
157
-	 * @param $request
158
-	 * @param $ref_id
159
-	 * @return mixed
160
-	 */
161
-	private function commentInfo($params,$comment,$request,$ref_id)
162
-	{
163
-		$comment->setIp($request->getClientIp());
164
-		$comment->setModel($params['ref']);
165
-		$comment->setModelId($ref_id);
166
-		//Spam ?
167
-		$akismet = $this->container->hasParameter('akismet') ? $this->container->getParameter('akismet') : null;
168
-		$params['manager']->isSpam($comment,$request,$akismet) ? $comment->setSpam(1) : $comment->setSpam(0);
169
-
170
-		return $comment;
171
-	}
172
-
173
-	/**
174
-	 * Init user info
175
-	 * @param $request
176
-	 * @param $comment
177
-	 * @return boo|\Symfony\Component\HttpFoundation\RedirectResponse
178
-	 */
179
-	private function userInfo($request, $comment)
180
-	{
181
-		$is_join = method_exists($comment,'getUser') ? true : false;
182
-
183
-		if($this->getUser() !== null)
184
-		{
185
-			if($this->getUser()->getUsername() != $comment->getUsername() || $this->getUser()->getEmail() != $comment->getEmail())
186
-			{
187
-				return $this->redirect($request->headers->get('referer') . '#comments_area');
188
-			}
189
-			if($is_join)
190
-			{
191
-				$comment->setUser($this->getUser());
192
-			}
193
-		}
194
-
195
-		return true;
196
-	}
197
-
198
-	/**
199
-	 * Init message flash
200
-	 * @param $session
201
-	 * @return bool
202
-	 */
203
-	private function messageFlash($session)
204
-	{
205
-		$html = $session->has('success_message') ? $session->get('success_message') : "<strong>Merci!</strong> Votre message à bien été posté.";
206
-		if($this->get('session')->getFlashBag()->has('comment_success'))
207
-		{
208
-			$this->get('session')->getFlashBag()->set('comment_success','');
209
-		}
210
-		$this->get('session')->getFlashBag()->add('comment_success',$html);
211
-
212
-		return true;
213
-	}
214
-
215
-	/**
216
-	 * @param $request
217
-	 * @param $session
218
-	 */
219
-	private function error($request, $session)
220
-	{
221
-		$requestData = $request->request->get('mykees_comment');
222
-		if(!empty($requestData))
223
-		{
224
-			$session->set('form_comment_data',$request->request->get('mykees_comment'));
225
-		}
226
-	}
227
-
228
-	/**
229
-	 * Get errors form for ajax
230
-	 * @param $form
231
-	 * @return array
232
-	 */
233
-	protected function getErrorsAsArray($form)
234
-	{
235
-		$errors = array();
236
-		foreach ($form->getErrors() as $error)
237
-			$errors[] = $error->getMessage();
238
-
239
-		foreach ($form->all() as $key => $child) {
240
-			if ($err = $this->getErrorsAsArray($child))
241
-				$errors[$key] = $err;
242
-		}
243
-		return $errors;
244
-	}
245
-
246
-	/**
247
-	 * Error message for Ajax
248
-	 * @param $form
249
-	 * @return Response
250
-	 */
251
-	private function returnAjaxErrors($form)
252
-	{
253
-		$json = json_encode(['error'=>'error','error_fields'=>$this->getErrorsAsArray($form)]);
254
-		return new Response($json);
255
-	}
11
+    private function gEm()
12
+    {
13
+        return $this->getDoctrine()->getManager();
14
+    }
15
+
16
+    /**
17
+     * Manage comment process
18
+     * @param Request $request
19
+     * @return \Symfony\Component\HttpFoundation\RedirectResponse
20
+     * @internal param $bundle
21
+     * @internal param $ref
22
+     * @internal param $ref_id
23
+     */
24
+    public function manageAction(Request $request)
25
+    {
26
+        $params = [
27
+            'manager'=>$this->get('mykees.comment.manager'),
28
+            'session'=>$request->getSession(),
29
+            'ref'    => $request->request->get('model') ? $request->request->get('model') : $request->request->get('mykees_comment')['model'],
30
+            'ref_id' => $request->request->get('modelId') ? $request->request->get('modelId') : $request->request->get('mykees_comment')['modelId']
31
+        ];
32
+
33
+        $comment_class_name = $this->container->getParameter('mykees_comment.comment.class');
34
+        $comment_class = new $comment_class_name();
35
+        $form = $this->createForm($this->get('mykees.comment.form'),$comment_class);
36
+
37
+        if('POST' == $request->getMethod()) {
38
+
39
+            if ($form->handleRequest($request)->isValid()) {
40
+
41
+                if($request->isXmlHttpRequest()) {
42
+                    return $this->ajaxInfo($params,$request,$comment_class);
43
+                }
44
+
45
+                $this->postInfo($params, $request, $comment_class, $params['session']);
46
+
47
+            }else{
48
+
49
+                if($request->isXmlHttpRequest()) {
50
+                    return $this->returnAjaxErrors($form);
51
+                }else{
52
+                    $this->error($request, $params['session']);
53
+                }
54
+            }
55
+
56
+        }
57
+
58
+        return $this->redirect($request->headers->get('referer') . '#comments_area');
59
+    }
60
+
61
+    /**
62
+     * @param $params
63
+     * @param $request
64
+     * @param $comment_class
65
+     * @return Response
66
+     */
67
+    private function ajaxInfo($params,$request,$comment_class)
68
+    {
69
+
70
+        $comment = $this->postInfo($params, $request, $comment_class, $params['session']);
71
+        $comment_depth = $this->container->getParameter('comment.depth');
72
+
73
+        // Si la profondeur du commentaire parent est inférieure ou égale à la profondeur définis
74
+        if($request->request->get('depth') < $comment_depth && $comment_depth >= 1)
75
+        {
76
+            $comment->setDepthReached($request->request->get('depth') + 1);//On incremente la profondeur max
77
+            $comment->setDepth($comment->getId()); //la profondeur de réponse est égale a l'id
78
+            $max_depth = false;
79
+        }else{
80
+            $comment->setDepthReached($request->request->get('depth'));//On à atteint la profondeur max
81
+            $comment->setDepth($comment->getParentId());//la profondeur de réponse est éagle au commentaire parent
82
+            $max_depth = true;
83
+        }
84
+
85
+        $template = $this->renderResponse($comment,$request,$max_depth);
86
+        $json = json_encode([
87
+            'template'=>$template,
88
+            "parent_id"=>$comment->getParentId(),
89
+            'comment_id'=>$comment->getId(),
90
+            'max_depth'=>$max_depth,
91
+            'success_message'=>$this->get('session')->getFlashBag()->get('comment_success')
92
+        ]);
93
+
94
+        return new Response($json);
95
+    }
96
+
97
+    /**
98
+     * Return a template
99
+     * @param $comment
100
+     * @param $request
101
+     * @param $max_depth
102
+     * @return string
103
+     */
104
+    private function renderResponse($comment,$request,$max_depth)
105
+    {
106
+        if($comment->getParentId() > 0)
107
+        {
108
+            if( ($request->request->get('response_type') === "true" && $max_depth === true) ||
109
+                ($request->request->get('response_type') === "false" && $max_depth === true) ||
110
+                ($request->request->get('response_type') === "true" && $max_depth === false)
111
+            ){
112
+                return $this->renderView('MykeesCommentBundle:Comments:unwrap_replies.html.twig',['comment'=>$comment,'recent_reply'=>true]);
113
+            }else{
114
+                return $this->renderView('MykeesCommentBundle:Comments:replies.html.twig',['comment'=>$comment,'recent_reply'=>true]);
115
+            }
116
+        }else{
117
+            return $this->renderView('MykeesCommentBundle:Comments:comment.html.twig',['comment'=>$comment,'recent_reply'=>true]);
118
+        }
119
+    }
120
+
121
+
122
+    /**
123
+     * Init/save comment and user info
124
+     * @param $request
125
+     * @param $comment
126
+     * @param $params
127
+     * @param $session
128
+     * @return
129
+     */
130
+    private function postInfo($params, $request, $comment, $session)
131
+    {
132
+        $this->userInfo($request, $comment);
133
+        $this->commentInfo($params,$comment,$request,$params['ref_id']);
134
+
135
+        $this->save($comment);
136
+        $this->messageFlash($session);
137
+
138
+        return $comment;
139
+    }
140
+
141
+    /**
142
+     * Save comment entity
143
+     * @param $comment
144
+     */
145
+    private function save($comment)
146
+    {
147
+        $this->gEm()->persist($comment);
148
+        $this->gEm()->flush();
149
+
150
+        return $comment;
151
+    }
152
+
153
+    /**
154
+     * Init comment info
155
+     * @param $params
156
+     * @param $comment
157
+     * @param $request
158
+     * @param $ref_id
159
+     * @return mixed
160
+     */
161
+    private function commentInfo($params,$comment,$request,$ref_id)
162
+    {
163
+        $comment->setIp($request->getClientIp());
164
+        $comment->setModel($params['ref']);
165
+        $comment->setModelId($ref_id);
166
+        //Spam ?
167
+        $akismet = $this->container->hasParameter('akismet') ? $this->container->getParameter('akismet') : null;
168
+        $params['manager']->isSpam($comment,$request,$akismet) ? $comment->setSpam(1) : $comment->setSpam(0);
169
+
170
+        return $comment;
171
+    }
172
+
173
+    /**
174
+     * Init user info
175
+     * @param $request
176
+     * @param $comment
177
+     * @return boo|\Symfony\Component\HttpFoundation\RedirectResponse
178
+     */
179
+    private function userInfo($request, $comment)
180
+    {
181
+        $is_join = method_exists($comment,'getUser') ? true : false;
182
+
183
+        if($this->getUser() !== null)
184
+        {
185
+            if($this->getUser()->getUsername() != $comment->getUsername() || $this->getUser()->getEmail() != $comment->getEmail())
186
+            {
187
+                return $this->redirect($request->headers->get('referer') . '#comments_area');
188
+            }
189
+            if($is_join)
190
+            {
191
+                $comment->setUser($this->getUser());
192
+            }
193
+        }
194
+
195
+        return true;
196
+    }
197
+
198
+    /**
199
+     * Init message flash
200
+     * @param $session
201
+     * @return bool
202
+     */
203
+    private function messageFlash($session)
204
+    {
205
+        $html = $session->has('success_message') ? $session->get('success_message') : "<strong>Merci!</strong> Votre message à bien été posté.";
206
+        if($this->get('session')->getFlashBag()->has('comment_success'))
207
+        {
208
+            $this->get('session')->getFlashBag()->set('comment_success','');
209
+        }
210
+        $this->get('session')->getFlashBag()->add('comment_success',$html);
211
+
212
+        return true;
213
+    }
214
+
215
+    /**
216
+     * @param $request
217
+     * @param $session
218
+     */
219
+    private function error($request, $session)
220
+    {
221
+        $requestData = $request->request->get('mykees_comment');
222
+        if(!empty($requestData))
223
+        {
224
+            $session->set('form_comment_data',$request->request->get('mykees_comment'));
225
+        }
226
+    }
227
+
228
+    /**
229
+     * Get errors form for ajax
230
+     * @param $form
231
+     * @return array
232
+     */
233
+    protected function getErrorsAsArray($form)
234
+    {
235
+        $errors = array();
236
+        foreach ($form->getErrors() as $error)
237
+            $errors[] = $error->getMessage();
238
+
239
+        foreach ($form->all() as $key => $child) {
240
+            if ($err = $this->getErrorsAsArray($child))
241
+                $errors[$key] = $err;
242
+        }
243
+        return $errors;
244
+    }
245
+
246
+    /**
247
+     * Error message for Ajax
248
+     * @param $form
249
+     * @return Response
250
+     */
251
+    private function returnAjaxErrors($form)
252
+    {
253
+        $json = json_encode(['error'=>'error','error_fields'=>$this->getErrorsAsArray($form)]);
254
+        return new Response($json);
255
+    }
256 256
 }
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -32,30 +32,30 @@  discard block
 block discarded – undo
32 32
 
33 33
 		$comment_class_name = $this->container->getParameter('mykees_comment.comment.class');
34 34
 		$comment_class = new $comment_class_name();
35
-		$form = $this->createForm($this->get('mykees.comment.form'),$comment_class);
35
+		$form = $this->createForm($this->get('mykees.comment.form'), $comment_class);
36 36
 
37
-		if('POST' == $request->getMethod()) {
37
+		if ('POST' == $request->getMethod()) {
38 38
 
39 39
 			if ($form->handleRequest($request)->isValid()) {
40 40
 
41
-				if($request->isXmlHttpRequest()) {
42
-					return $this->ajaxInfo($params,$request,$comment_class);
41
+				if ($request->isXmlHttpRequest()) {
42
+					return $this->ajaxInfo($params, $request, $comment_class);
43 43
 				}
44 44
 
45 45
 				$this->postInfo($params, $request, $comment_class, $params['session']);
46 46
 
47
-			}else{
47
+			}else {
48 48
 
49
-				if($request->isXmlHttpRequest()) {
49
+				if ($request->isXmlHttpRequest()) {
50 50
 					return $this->returnAjaxErrors($form);
51
-				}else{
51
+				}else {
52 52
 					$this->error($request, $params['session']);
53 53
 				}
54 54
 			}
55 55
 
56 56
 		}
57 57
 
58
-		return $this->redirect($request->headers->get('referer') . '#comments_area');
58
+		return $this->redirect($request->headers->get('referer').'#comments_area');
59 59
 	}
60 60
 
61 61
 	/**
@@ -64,25 +64,25 @@  discard block
 block discarded – undo
64 64
 	 * @param $comment_class
65 65
 	 * @return Response
66 66
 	 */
67
-	private function ajaxInfo($params,$request,$comment_class)
67
+	private function ajaxInfo($params, $request, $comment_class)
68 68
 	{
69 69
 
70 70
 		$comment = $this->postInfo($params, $request, $comment_class, $params['session']);
71 71
 		$comment_depth = $this->container->getParameter('comment.depth');
72 72
 
73 73
 		// Si la profondeur du commentaire parent est inférieure ou égale à la profondeur définis
74
-		if($request->request->get('depth') < $comment_depth && $comment_depth >= 1)
74
+		if ($request->request->get('depth') < $comment_depth && $comment_depth >= 1)
75 75
 		{
76
-			$comment->setDepthReached($request->request->get('depth') + 1);//On incremente la profondeur max
76
+			$comment->setDepthReached($request->request->get('depth') + 1); //On incremente la profondeur max
77 77
 			$comment->setDepth($comment->getId()); //la profondeur de réponse est égale a l'id
78 78
 			$max_depth = false;
79
-		}else{
80
-			$comment->setDepthReached($request->request->get('depth'));//On à atteint la profondeur max
81
-			$comment->setDepth($comment->getParentId());//la profondeur de réponse est éagle au commentaire parent
79
+		}else {
80
+			$comment->setDepthReached($request->request->get('depth')); //On à atteint la profondeur max
81
+			$comment->setDepth($comment->getParentId()); //la profondeur de réponse est éagle au commentaire parent
82 82
 			$max_depth = true;
83 83
 		}
84 84
 
85
-		$template = $this->renderResponse($comment,$request,$max_depth);
85
+		$template = $this->renderResponse($comment, $request, $max_depth);
86 86
 		$json = json_encode([
87 87
 			'template'=>$template,
88 88
 			"parent_id"=>$comment->getParentId(),
@@ -101,20 +101,20 @@  discard block
 block discarded – undo
101 101
 	 * @param $max_depth
102 102
 	 * @return string
103 103
 	 */
104
-	private function renderResponse($comment,$request,$max_depth)
104
+	private function renderResponse($comment, $request, $max_depth)
105 105
 	{
106
-		if($comment->getParentId() > 0)
106
+		if ($comment->getParentId() > 0)
107 107
 		{
108
-			if( ($request->request->get('response_type') === "true" && $max_depth === true) ||
108
+			if (($request->request->get('response_type') === "true" && $max_depth === true) ||
109 109
 				($request->request->get('response_type') === "false" && $max_depth === true) ||
110 110
 				($request->request->get('response_type') === "true" && $max_depth === false)
111
-			){
112
-				return $this->renderView('MykeesCommentBundle:Comments:unwrap_replies.html.twig',['comment'=>$comment,'recent_reply'=>true]);
113
-			}else{
114
-				return $this->renderView('MykeesCommentBundle:Comments:replies.html.twig',['comment'=>$comment,'recent_reply'=>true]);
111
+			) {
112
+				return $this->renderView('MykeesCommentBundle:Comments:unwrap_replies.html.twig', ['comment'=>$comment, 'recent_reply'=>true]);
113
+			}else {
114
+				return $this->renderView('MykeesCommentBundle:Comments:replies.html.twig', ['comment'=>$comment, 'recent_reply'=>true]);
115 115
 			}
116
-		}else{
117
-			return $this->renderView('MykeesCommentBundle:Comments:comment.html.twig',['comment'=>$comment,'recent_reply'=>true]);
116
+		}else {
117
+			return $this->renderView('MykeesCommentBundle:Comments:comment.html.twig', ['comment'=>$comment, 'recent_reply'=>true]);
118 118
 		}
119 119
 	}
120 120
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	private function postInfo($params, $request, $comment, $session)
131 131
 	{
132 132
 		$this->userInfo($request, $comment);
133
-		$this->commentInfo($params,$comment,$request,$params['ref_id']);
133
+		$this->commentInfo($params, $comment, $request, $params['ref_id']);
134 134
 
135 135
 		$this->save($comment);
136 136
 		$this->messageFlash($session);
@@ -158,14 +158,14 @@  discard block
 block discarded – undo
158 158
 	 * @param $ref_id
159 159
 	 * @return mixed
160 160
 	 */
161
-	private function commentInfo($params,$comment,$request,$ref_id)
161
+	private function commentInfo($params, $comment, $request, $ref_id)
162 162
 	{
163 163
 		$comment->setIp($request->getClientIp());
164 164
 		$comment->setModel($params['ref']);
165 165
 		$comment->setModelId($ref_id);
166 166
 		//Spam ?
167 167
 		$akismet = $this->container->hasParameter('akismet') ? $this->container->getParameter('akismet') : null;
168
-		$params['manager']->isSpam($comment,$request,$akismet) ? $comment->setSpam(1) : $comment->setSpam(0);
168
+		$params['manager']->isSpam($comment, $request, $akismet) ? $comment->setSpam(1) : $comment->setSpam(0);
169 169
 
170 170
 		return $comment;
171 171
 	}
@@ -178,15 +178,15 @@  discard block
 block discarded – undo
178 178
 	 */
179 179
 	private function userInfo($request, $comment)
180 180
 	{
181
-		$is_join = method_exists($comment,'getUser') ? true : false;
181
+		$is_join = method_exists($comment, 'getUser') ? true : false;
182 182
 
183
-		if($this->getUser() !== null)
183
+		if ($this->getUser() !== null)
184 184
 		{
185
-			if($this->getUser()->getUsername() != $comment->getUsername() || $this->getUser()->getEmail() != $comment->getEmail())
185
+			if ($this->getUser()->getUsername() != $comment->getUsername() || $this->getUser()->getEmail() != $comment->getEmail())
186 186
 			{
187
-				return $this->redirect($request->headers->get('referer') . '#comments_area');
187
+				return $this->redirect($request->headers->get('referer').'#comments_area');
188 188
 			}
189
-			if($is_join)
189
+			if ($is_join)
190 190
 			{
191 191
 				$comment->setUser($this->getUser());
192 192
 			}
@@ -203,11 +203,11 @@  discard block
 block discarded – undo
203 203
 	private function messageFlash($session)
204 204
 	{
205 205
 		$html = $session->has('success_message') ? $session->get('success_message') : "<strong>Merci!</strong> Votre message à bien été posté.";
206
-		if($this->get('session')->getFlashBag()->has('comment_success'))
206
+		if ($this->get('session')->getFlashBag()->has('comment_success'))
207 207
 		{
208
-			$this->get('session')->getFlashBag()->set('comment_success','');
208
+			$this->get('session')->getFlashBag()->set('comment_success', '');
209 209
 		}
210
-		$this->get('session')->getFlashBag()->add('comment_success',$html);
210
+		$this->get('session')->getFlashBag()->add('comment_success', $html);
211 211
 
212 212
 		return true;
213 213
 	}
@@ -219,9 +219,9 @@  discard block
 block discarded – undo
219 219
 	private function error($request, $session)
220 220
 	{
221 221
 		$requestData = $request->request->get('mykees_comment');
222
-		if(!empty($requestData))
222
+		if (!empty($requestData))
223 223
 		{
224
-			$session->set('form_comment_data',$request->request->get('mykees_comment'));
224
+			$session->set('form_comment_data', $request->request->get('mykees_comment'));
225 225
 		}
226 226
 	}
227 227
 
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 	 */
251 251
 	private function returnAjaxErrors($form)
252 252
 	{
253
-		$json = json_encode(['error'=>'error','error_fields'=>$this->getErrorsAsArray($form)]);
253
+		$json = json_encode(['error'=>'error', 'error_fields'=>$this->getErrorsAsArray($form)]);
254 254
 		return new Response($json);
255 255
 	}
256 256
 }
Please login to merge, or discard this patch.
Braces   +11 added lines, -9 removed lines patch added patch discarded remove patch
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
 
45 45
 				$this->postInfo($params, $request, $comment_class, $params['session']);
46 46
 
47
-			}else{
47
+			} else{
48 48
 
49 49
 				if($request->isXmlHttpRequest()) {
50 50
 					return $this->returnAjaxErrors($form);
51
-				}else{
51
+				} else{
52 52
 					$this->error($request, $params['session']);
53 53
 				}
54 54
 			}
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 			$comment->setDepthReached($request->request->get('depth') + 1);//On incremente la profondeur max
77 77
 			$comment->setDepth($comment->getId()); //la profondeur de réponse est égale a l'id
78 78
 			$max_depth = false;
79
-		}else{
79
+		} else{
80 80
 			$comment->setDepthReached($request->request->get('depth'));//On à atteint la profondeur max
81 81
 			$comment->setDepth($comment->getParentId());//la profondeur de réponse est éagle au commentaire parent
82 82
 			$max_depth = true;
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
 				($request->request->get('response_type') === "true" && $max_depth === false)
111 111
 			){
112 112
 				return $this->renderView('MykeesCommentBundle:Comments:unwrap_replies.html.twig',['comment'=>$comment,'recent_reply'=>true]);
113
-			}else{
113
+			} else{
114 114
 				return $this->renderView('MykeesCommentBundle:Comments:replies.html.twig',['comment'=>$comment,'recent_reply'=>true]);
115 115
 			}
116
-		}else{
116
+		} else{
117 117
 			return $this->renderView('MykeesCommentBundle:Comments:comment.html.twig',['comment'=>$comment,'recent_reply'=>true]);
118 118
 		}
119 119
 	}
@@ -233,12 +233,14 @@  discard block
 block discarded – undo
233 233
 	protected function getErrorsAsArray($form)
234 234
 	{
235 235
 		$errors = array();
236
-		foreach ($form->getErrors() as $error)
237
-			$errors[] = $error->getMessage();
236
+		foreach ($form->getErrors() as $error) {
237
+					$errors[] = $error->getMessage();
238
+		}
238 239
 
239 240
 		foreach ($form->all() as $key => $child) {
240
-			if ($err = $this->getErrorsAsArray($child))
241
-				$errors[$key] = $err;
241
+			if ($err = $this->getErrorsAsArray($child)) {
242
+							$errors[$key] = $err;
243
+			}
242 244
 		}
243 245
 		return $errors;
244 246
 	}
Please login to merge, or discard this patch.
Twig/Extension/CommentExtension.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
 	/**
17 17
 	 * Returns a list of functions to add to the existing list.
18 18
 	 *
19
-	 * @return array An array of functions
19
+	 * @return \Twig_SimpleFunction[] An array of functions
20 20
 	 */
21 21
 	public function getFunctions()
22 22
 	{
Please login to merge, or discard this patch.
Indentation   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -13,115 +13,115 @@
 block discarded – undo
13 13
 
14 14
 class CommentExtension extends \Twig_Extension{
15 15
 
16
-	/**
17
-	 * Returns a list of functions to add to the existing list.
18
-	 *
19
-	 * @return array An array of functions
20
-	 */
21
-	public function getFunctions()
22
-	{
23
-		return array(
24
-			new \Twig_SimpleFunction('helper_comment_form', [$this, 'commentForm'], [
25
-				'is_safe'=>array('html'),
26
-				'needs_environment'=>true
27
-			]),
28
-			new \Twig_SimpleFunction('helper_comments_list', [$this, 'commentsList'], [
29
-				'is_safe'=>['html'],
30
-				'needs_environment'=>true
31
-			]),
32
-			new \Twig_SimpleFunction('date_interval', [$this, 'dateInterval'], [
33
-				'is_safe'=>array('html')
34
-			]),
35
-		);
36
-	}
37
-
38
-	public function getFilters() {
39
-		return array(
40
-			'url_decode' => new \Twig_Filter_Method($this, 'urlDecode')
41
-		);
42
-	}
43
-
44
-
45
-	public function commentForm(\Twig_Environment $env, $form, $ajax=false, $options=[])
46
-	{
47
-		return $env->render('MykeesCommentBundle:Comments:form.html.twig',[
48
-			'form'=>$form,
49
-			'ajax'=>$ajax,
50
-			'options'=>$options
51
-		]);
52
-	}
53
-
54
-	/**
55
-	 * @param \Twig_Environment $env
56
-	 * @param $comments
57
-	 * @param array $options
58
-	 * @param bool $canAdminComment
59
-	 * @return string
60
-	 */
61
-	public function commentsList(\Twig_Environment $env,$comments, $canAdminComment=false, $options=[])
62
-	{
63
-		return $env->render('MykeesCommentBundle:Comments:comments.html.twig',[
64
-			'comments'=>$comments,
65
-			"canAdminComment"=>$canAdminComment
66
-		]);
67
-	}
68
-
69
-
70
-	public function dateInterval($date,$locale)
71
-	{
72
-		$comment_date = new \DateTime($date);
73
-		$dateNow = new \DateTime('NOW');
74
-		$interval = $dateNow->diff($comment_date);
75
-
76
-		$periodes = [
77
-			$interval->format('%y'),
78
-			$interval->format('%m'),
79
-			$interval->format('%d'),
80
-			$interval->format('%h'),
81
-			$interval->format('%i')
82
-		];
83
-		$unity_en = [
84
-			['year','years'],
85
-			['month','months'],
86
-			['day','days'],
87
-			['hour','hours'],
88
-			['minute','minutes']
89
-		];
90
-		$unity_fr = [
91
-			['an','ans'],
92
-			['mois','mois'],
93
-			['jour','jours'],
94
-			['heure','heures'],
95
-			['minute','minutes']
96
-		];
97
-
98
-		$periodesLength = count($periodes);
99
-
100
-		for($i=0; $i < $periodesLength; $i++)
101
-		{
102
-			if(intval($periodes[$i]) >= 1 && $i < count($periodes))
103
-			{
104
-				$locale_unity = $locale == "fr" ? $unity_fr : $unity_en;
105
-				$u = $periodes[$i] > 1 ? $locale_unity[$i][1] : $locale_unity[$i][0];
106
-
107
-				return $periodes[$i].' '.$u;
108
-			}
109
-		}
110
-		if($locale == 'fr')
111
-		{
112
-			return "moins d'une minute";
113
-		}else{
114
-			return 'less than a minute';
115
-		}
116
-	}
117
-
118
-	/**
119
-	 * Returns the name of the extension.
120
-	 *
121
-	 * @return string The extension name
122
-	 */
123
-	public function getName()
124
-	{
125
-		return 'mykees_helper_comment';
126
-	}
16
+    /**
17
+     * Returns a list of functions to add to the existing list.
18
+     *
19
+     * @return array An array of functions
20
+     */
21
+    public function getFunctions()
22
+    {
23
+        return array(
24
+            new \Twig_SimpleFunction('helper_comment_form', [$this, 'commentForm'], [
25
+                'is_safe'=>array('html'),
26
+                'needs_environment'=>true
27
+            ]),
28
+            new \Twig_SimpleFunction('helper_comments_list', [$this, 'commentsList'], [
29
+                'is_safe'=>['html'],
30
+                'needs_environment'=>true
31
+            ]),
32
+            new \Twig_SimpleFunction('date_interval', [$this, 'dateInterval'], [
33
+                'is_safe'=>array('html')
34
+            ]),
35
+        );
36
+    }
37
+
38
+    public function getFilters() {
39
+        return array(
40
+            'url_decode' => new \Twig_Filter_Method($this, 'urlDecode')
41
+        );
42
+    }
43
+
44
+
45
+    public function commentForm(\Twig_Environment $env, $form, $ajax=false, $options=[])
46
+    {
47
+        return $env->render('MykeesCommentBundle:Comments:form.html.twig',[
48
+            'form'=>$form,
49
+            'ajax'=>$ajax,
50
+            'options'=>$options
51
+        ]);
52
+    }
53
+
54
+    /**
55
+     * @param \Twig_Environment $env
56
+     * @param $comments
57
+     * @param array $options
58
+     * @param bool $canAdminComment
59
+     * @return string
60
+     */
61
+    public function commentsList(\Twig_Environment $env,$comments, $canAdminComment=false, $options=[])
62
+    {
63
+        return $env->render('MykeesCommentBundle:Comments:comments.html.twig',[
64
+            'comments'=>$comments,
65
+            "canAdminComment"=>$canAdminComment
66
+        ]);
67
+    }
68
+
69
+
70
+    public function dateInterval($date,$locale)
71
+    {
72
+        $comment_date = new \DateTime($date);
73
+        $dateNow = new \DateTime('NOW');
74
+        $interval = $dateNow->diff($comment_date);
75
+
76
+        $periodes = [
77
+            $interval->format('%y'),
78
+            $interval->format('%m'),
79
+            $interval->format('%d'),
80
+            $interval->format('%h'),
81
+            $interval->format('%i')
82
+        ];
83
+        $unity_en = [
84
+            ['year','years'],
85
+            ['month','months'],
86
+            ['day','days'],
87
+            ['hour','hours'],
88
+            ['minute','minutes']
89
+        ];
90
+        $unity_fr = [
91
+            ['an','ans'],
92
+            ['mois','mois'],
93
+            ['jour','jours'],
94
+            ['heure','heures'],
95
+            ['minute','minutes']
96
+        ];
97
+
98
+        $periodesLength = count($periodes);
99
+
100
+        for($i=0; $i < $periodesLength; $i++)
101
+        {
102
+            if(intval($periodes[$i]) >= 1 && $i < count($periodes))
103
+            {
104
+                $locale_unity = $locale == "fr" ? $unity_fr : $unity_en;
105
+                $u = $periodes[$i] > 1 ? $locale_unity[$i][1] : $locale_unity[$i][0];
106
+
107
+                return $periodes[$i].' '.$u;
108
+            }
109
+        }
110
+        if($locale == 'fr')
111
+        {
112
+            return "moins d'une minute";
113
+        }else{
114
+            return 'less than a minute';
115
+        }
116
+    }
117
+
118
+    /**
119
+     * Returns the name of the extension.
120
+     *
121
+     * @return string The extension name
122
+     */
123
+    public function getName()
124
+    {
125
+        return 'mykees_helper_comment';
126
+    }
127 127
 }
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 use Symfony\Component\Validator\Constraints\DateTime;
13 13
 
14
-class CommentExtension extends \Twig_Extension{
14
+class CommentExtension extends \Twig_Extension {
15 15
 
16 16
 	/**
17 17
 	 * Returns a list of functions to add to the existing list.
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
 	}
43 43
 
44 44
 
45
-	public function commentForm(\Twig_Environment $env, $form, $ajax=false, $options=[])
45
+	public function commentForm(\Twig_Environment $env, $form, $ajax = false, $options = [])
46 46
 	{
47
-		return $env->render('MykeesCommentBundle:Comments:form.html.twig',[
47
+		return $env->render('MykeesCommentBundle:Comments:form.html.twig', [
48 48
 			'form'=>$form,
49 49
 			'ajax'=>$ajax,
50 50
 			'options'=>$options
@@ -58,16 +58,16 @@  discard block
 block discarded – undo
58 58
 	 * @param bool $canAdminComment
59 59
 	 * @return string
60 60
 	 */
61
-	public function commentsList(\Twig_Environment $env,$comments, $canAdminComment=false, $options=[])
61
+	public function commentsList(\Twig_Environment $env, $comments, $canAdminComment = false, $options = [])
62 62
 	{
63
-		return $env->render('MykeesCommentBundle:Comments:comments.html.twig',[
63
+		return $env->render('MykeesCommentBundle:Comments:comments.html.twig', [
64 64
 			'comments'=>$comments,
65 65
 			"canAdminComment"=>$canAdminComment
66 66
 		]);
67 67
 	}
68 68
 
69 69
 
70
-	public function dateInterval($date,$locale)
70
+	public function dateInterval($date, $locale)
71 71
 	{
72 72
 		$comment_date = new \DateTime($date);
73 73
 		$dateNow = new \DateTime('NOW');
@@ -81,25 +81,25 @@  discard block
 block discarded – undo
81 81
 			$interval->format('%i')
82 82
 		];
83 83
 		$unity_en = [
84
-			['year','years'],
85
-			['month','months'],
86
-			['day','days'],
87
-			['hour','hours'],
88
-			['minute','minutes']
84
+			['year', 'years'],
85
+			['month', 'months'],
86
+			['day', 'days'],
87
+			['hour', 'hours'],
88
+			['minute', 'minutes']
89 89
 		];
90 90
 		$unity_fr = [
91
-			['an','ans'],
92
-			['mois','mois'],
93
-			['jour','jours'],
94
-			['heure','heures'],
95
-			['minute','minutes']
91
+			['an', 'ans'],
92
+			['mois', 'mois'],
93
+			['jour', 'jours'],
94
+			['heure', 'heures'],
95
+			['minute', 'minutes']
96 96
 		];
97 97
 
98 98
 		$periodesLength = count($periodes);
99 99
 
100
-		for($i=0; $i < $periodesLength; $i++)
100
+		for ($i = 0; $i < $periodesLength; $i++)
101 101
 		{
102
-			if(intval($periodes[$i]) >= 1 && $i < count($periodes))
102
+			if (intval($periodes[$i]) >= 1 && $i < count($periodes))
103 103
 			{
104 104
 				$locale_unity = $locale == "fr" ? $unity_fr : $unity_en;
105 105
 				$u = $periodes[$i] > 1 ? $locale_unity[$i][1] : $locale_unity[$i][0];
@@ -107,10 +107,10 @@  discard block
 block discarded – undo
107 107
 				return $periodes[$i].' '.$u;
108 108
 			}
109 109
 		}
110
-		if($locale == 'fr')
110
+		if ($locale == 'fr')
111 111
 		{
112 112
 			return "moins d'une minute";
113
-		}else{
113
+		}else {
114 114
 			return 'less than a minute';
115 115
 		}
116 116
 	}
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@
 block discarded – undo
110 110
 		if($locale == 'fr')
111 111
 		{
112 112
 			return "moins d'une minute";
113
-		}else{
113
+		} else{
114 114
 			return 'less than a minute';
115 115
 		}
116 116
 	}
Please login to merge, or discard this patch.
Controller/AdminCommentsController.php 2 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -7,35 +7,35 @@
 block discarded – undo
7 7
 
8 8
 class AdminCommentsController extends Controller
9 9
 {
10
-	private function gEm()
11
-	{
12
-		return $this->getDoctrine()->getManager();
13
-	}
10
+    private function gEm()
11
+    {
12
+        return $this->getDoctrine()->getManager();
13
+    }
14 14
 
15
-	public function deleteWithChildrenAction($model, $model_id, $comment_id, Request $request)
16
-	{
17
-		$manager = $this->get('mykees.comment.query.manager');
18
-		$comments = $manager->findCommentsByModelAndId($model, $model_id,true);
19
-		$children_ids = $manager->getChildren($comments[$comment_id]);
15
+    public function deleteWithChildrenAction($model, $model_id, $comment_id, Request $request)
16
+    {
17
+        $manager = $this->get('mykees.comment.query.manager');
18
+        $comments = $manager->findCommentsByModelAndId($model, $model_id,true);
19
+        $children_ids = $manager->getChildren($comments[$comment_id]);
20 20
 
21
-		array_push($children_ids,$comment_id);
21
+        array_push($children_ids,$comment_id);
22 22
 
23
-		$manager->deleteByCommentIds($children_ids);
23
+        $manager->deleteByCommentIds($children_ids);
24 24
 
25
-		return $this->redirect($request->headers->get('referer'));
26
-	}
25
+        return $this->redirect($request->headers->get('referer'));
26
+    }
27 27
 
28 28
 
29
-	public function deleteAction($id, Request $request)
30
-	{
31
-		$class = $this->container->getParameter('mykees_comment.comment.class');
32
-		$explose_class = explode('\\',$class);
33
-		$repository = $explose_class[0].$explose_class[1].':'.$explose_class[3];
34
-		$comment = $this->gEm()->getRepository($repository)->find($id);
29
+    public function deleteAction($id, Request $request)
30
+    {
31
+        $class = $this->container->getParameter('mykees_comment.comment.class');
32
+        $explose_class = explode('\\',$class);
33
+        $repository = $explose_class[0].$explose_class[1].':'.$explose_class[3];
34
+        $comment = $this->gEm()->getRepository($repository)->find($id);
35 35
 
36
-		$this->gEm()->remove($comment);
37
-		$this->gEm()->flush();
36
+        $this->gEm()->remove($comment);
37
+        $this->gEm()->flush();
38 38
 
39
-		return $this->redirect($request->headers->get('referer'));
40
-	}
39
+        return $this->redirect($request->headers->get('referer'));
40
+    }
41 41
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,10 +15,10 @@  discard block
 block discarded – undo
15 15
 	public function deleteWithChildrenAction($model, $model_id, $comment_id, Request $request)
16 16
 	{
17 17
 		$manager = $this->get('mykees.comment.query.manager');
18
-		$comments = $manager->findCommentsByModelAndId($model, $model_id,true);
18
+		$comments = $manager->findCommentsByModelAndId($model, $model_id, true);
19 19
 		$children_ids = $manager->getChildren($comments[$comment_id]);
20 20
 
21
-		array_push($children_ids,$comment_id);
21
+		array_push($children_ids, $comment_id);
22 22
 
23 23
 		$manager->deleteByCommentIds($children_ids);
24 24
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	public function deleteAction($id, Request $request)
30 30
 	{
31 31
 		$class = $this->container->getParameter('mykees_comment.comment.class');
32
-		$explose_class = explode('\\',$class);
32
+		$explose_class = explode('\\', $class);
33 33
 		$repository = $explose_class[0].$explose_class[1].':'.$explose_class[3];
34 34
 		$comment = $this->gEm()->getRepository($repository)->find($id);
35 35
 
Please login to merge, or discard this patch.
DataFixtures/ORM/LoadCommentData.php 3 patches
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Created by PhpStorm.
4
- * User: Rafidion Michael
5
- * Date: 10/09/2015
6
- * Time: 00:23
7
- */
3
+     * Created by PhpStorm.
4
+     * User: Rafidion Michael
5
+     * Date: 10/09/2015
6
+     * Time: 00:23
7
+     */
8 8
 
9 9
 namespace Mykees\CommentBundle\DataFixtures\ORM;
10 10
 
@@ -15,51 +15,51 @@  discard block
 block discarded – undo
15 15
 
16 16
 class LoadCommentData implements FixtureInterface,ContainerAwareInterface{
17 17
 
18
-	public $container;
18
+    public $container;
19 19
 
20
-	/**
21
-	 * Sets the Container.
22
-	 *
23
-	 * @param ContainerInterface|null $container A ContainerInterface instance or null
24
-	 *
25
-	 * @api
26
-	 */
27
-	public function setContainer(ContainerInterface $container = null)
28
-	{
29
-		$this->container = $container;
30
-	}
20
+    /**
21
+     * Sets the Container.
22
+     *
23
+     * @param ContainerInterface|null $container A ContainerInterface instance or null
24
+     *
25
+     * @api
26
+     */
27
+    public function setContainer(ContainerInterface $container = null)
28
+    {
29
+        $this->container = $container;
30
+    }
31 31
 
32
-	/**
33
-	 * Load data fixtures with the passed EntityManager
34
-	 *
35
-	 * @param ObjectManager $manager
36
-	 */
37
-	public function load(ObjectManager $manager)
38
-	{
39
-		$comment_class = $this->container->getParameter('mykees_comment.comment.class');
32
+    /**
33
+     * Load data fixtures with the passed EntityManager
34
+     *
35
+     * @param ObjectManager $manager
36
+     */
37
+    public function load(ObjectManager $manager)
38
+    {
39
+        $comment_class = $this->container->getParameter('mykees_comment.comment.class');
40 40
 
41
-		for($i=1; $i<=5 ;$i++)
42
-		{
43
-			$comment = new $comment_class();
44
-			$comment->setUsername('admin'.$i);
45
-			$comment->setEmail("admin-{$i}@gmail.com");
46
-			$comment->setContent('contenu n-'.$i);
47
-			$comment->setCreatedAt(new \DateTime());
48
-			$comment->setModel('Post');
49
-			if($i <= 3)
50
-			{
51
-				$comment->setModelId(1);
52
-			}else{
53
-				$comment->setModelId($i);
54
-			}
55
-			$comment->setParentId(0);
56
-			$comment->setSpam(0);
57
-			$comment->setIp("192.168.56.1");
58
-			$comment->setDepth(0);
59
-			$comment->setDepthReached(0);
41
+        for($i=1; $i<=5 ;$i++)
42
+        {
43
+            $comment = new $comment_class();
44
+            $comment->setUsername('admin'.$i);
45
+            $comment->setEmail("admin-{$i}@gmail.com");
46
+            $comment->setContent('contenu n-'.$i);
47
+            $comment->setCreatedAt(new \DateTime());
48
+            $comment->setModel('Post');
49
+            if($i <= 3)
50
+            {
51
+                $comment->setModelId(1);
52
+            }else{
53
+                $comment->setModelId($i);
54
+            }
55
+            $comment->setParentId(0);
56
+            $comment->setSpam(0);
57
+            $comment->setIp("192.168.56.1");
58
+            $comment->setDepth(0);
59
+            $comment->setDepthReached(0);
60 60
 
61
-			$manager->persist($comment);
62
-			$manager->flush();
63
-		}
64
-	}
61
+            $manager->persist($comment);
62
+            $manager->flush();
63
+        }
64
+    }
65 65
 }
66 66
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 use Symfony\Component\DependencyInjection\ContainerAwareInterface;
14 14
 use Symfony\Component\DependencyInjection\ContainerInterface;
15 15
 
16
-class LoadCommentData implements FixtureInterface,ContainerAwareInterface{
16
+class LoadCommentData implements FixtureInterface, ContainerAwareInterface{
17 17
 
18 18
 	public $container;
19 19
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	{
39 39
 		$comment_class = $this->container->getParameter('mykees_comment.comment.class');
40 40
 
41
-		for($i=1; $i<=5 ;$i++)
41
+		for ($i = 1; $i <= 5; $i++)
42 42
 		{
43 43
 			$comment = new $comment_class();
44 44
 			$comment->setUsername('admin'.$i);
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
 			$comment->setContent('contenu n-'.$i);
47 47
 			$comment->setCreatedAt(new \DateTime());
48 48
 			$comment->setModel('Post');
49
-			if($i <= 3)
49
+			if ($i <= 3)
50 50
 			{
51 51
 				$comment->setModelId(1);
52
-			}else{
52
+			}else {
53 53
 				$comment->setModelId($i);
54 54
 			}
55 55
 			$comment->setParentId(0);
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
 			if($i <= 3)
50 50
 			{
51 51
 				$comment->setModelId(1);
52
-			}else{
52
+			} else{
53 53
 				$comment->setModelId($i);
54 54
 			}
55 55
 			$comment->setParentId(0);
Please login to merge, or discard this patch.
DependencyInjection/Configuration.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -20,19 +20,19 @@
 block discarded – undo
20 20
         $treeBuilder = new TreeBuilder();
21 21
         $rootNode = $treeBuilder->root('mykees_comment');
22 22
 
23
-	    $rootNode
24
-		    ->children()
25
-		        ->scalarNode('comment_class')->isRequired()->cannotBeEmpty()->end()
26
-		        ->scalarNode('depth')->end()
27
-		        ->arrayNode('akismet')
28
-		            ->children()
29
-		                ->scalarNode('api_key')->end()
30
-		                ->scalarNode('website')->end()
31
-		            ->end()
32
-		        ->end()
33
-		        ->scalarNode('success_message')->end()
34
-		    ->end()
35
-	    ;
23
+        $rootNode
24
+            ->children()
25
+                ->scalarNode('comment_class')->isRequired()->cannotBeEmpty()->end()
26
+                ->scalarNode('depth')->end()
27
+                ->arrayNode('akismet')
28
+                    ->children()
29
+                        ->scalarNode('api_key')->end()
30
+                        ->scalarNode('website')->end()
31
+                    ->end()
32
+                ->end()
33
+                ->scalarNode('success_message')->end()
34
+            ->end()
35
+        ;
36 36
 
37 37
         return $treeBuilder;
38 38
     }
Please login to merge, or discard this patch.
DependencyInjection/MykeesCommentExtension.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,10 +23,10 @@
 block discarded – undo
23 23
         $config = $this->processConfiguration($configuration, $configs);
24 24
 
25 25
 
26
-	    $container->setParameter("mykees_comment.comment.class", isset($config["comment_class"]) ? $config["comment_class"] : null);
27
-	    $container->setParameter('success_message', !empty($config['success_message']) ? $config['success_message'] : null);
28
-	    $container->setParameter('akismet', !empty($config['akismet']) ? $config['akismet'] : '');
29
-	    $container->setParameter('comment.depth', !empty($config['depth']) ? $config['depth'] : 0);
26
+        $container->setParameter("mykees_comment.comment.class", isset($config["comment_class"]) ? $config["comment_class"] : null);
27
+        $container->setParameter('success_message', !empty($config['success_message']) ? $config['success_message'] : null);
28
+        $container->setParameter('akismet', !empty($config['akismet']) ? $config['akismet'] : '');
29
+        $container->setParameter('comment.depth', !empty($config['depth']) ? $config['depth'] : 0);
30 30
 
31 31
         $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
32 32
         $loader->load('services.yml');
Please login to merge, or discard this patch.
Entity/Comment.php 2 patches
Indentation   +337 added lines, -337 removed lines patch added patch discarded remove patch
@@ -11,342 +11,342 @@
 block discarded – undo
11 11
  */
12 12
 abstract class Comment implements Commentable
13 13
 {
14
-	/**
15
-	 * @var string
16
-	 *
17
-	 * @ORM\Column(name="username", type="string", length=100)
18
-	 * @Assert\NotBlank(message="Vous devez entre un Nom")
19
-	 */
20
-	private $username;
21
-
22
-	/**
23
-	 * @var string
24
-	 *
25
-	 * @ORM\Column(name="email", type="string", length=255)
26
-	 * @Assert\Email(message="L'Email n'est pas valid")
27
-	 * @Assert\NotBlank(message="Vous devez préciser un Email.")
28
-	 */
29
-	private $email;
30
-
31
-	/**
32
-	 * @var string
33
-	 *
34
-	 * @ORM\Column(name="content", type="text")
35
-	 * @Assert\NotBlank(message="Vous devez entrer un Message.")
36
-	 */
37
-	private $content;
38
-
39
-	/**
40
-	 * @var \DateTime
41
-	 *
42
-	 * @ORM\Column(name="created_at", type="datetime")
43
-	 * @Assert\DateTime()
44
-	 */
45
-	private $createdAt;
46
-
47
-	/**
48
-	 * @var string
49
-	 *
50
-	 * @ORM\Column(name="model", type="string", length=60)
51
-	 */
52
-	private $model;
53
-
54
-	/**
55
-	 * @var integer
56
-	 *
57
-	 * @ORM\Column(name="model_id", type="integer")
58
-	 */
59
-	private $modelId;
60
-
61
-	/**
62
-	 * @var integer
63
-	 *
64
-	 * @ORM\Column(name="parent_id", type="integer")
65
-	 */
66
-	private $parentId;
67
-
68
-	/**
69
-	 * @var boolean
70
-	 *
71
-	 * @ORM\Column(name="spam", type="boolean")
72
-	 */
73
-	private $spam;
74
-
75
-	/**
76
-	 * @var string
77
-	 *
78
-	 * @ORM\Column(name="ip", type="string", length=255)
79
-	 */
80
-	private $ip;
81
-
82
-	private $depth = 0;
83
-
84
-	private $depthReached;
85
-
86
-
87
-	private $children = [];
88
-
89
-	/**
90
-	 * @ORM\PrePersist
91
-	 */
92
-	public function updateDate()
93
-	{
94
-		$this->setCreatedAt(new \DateTime());
95
-	}
96
-
97
-	/**
98
-	 * Set username
99
-	 *
100
-	 * @param string $username
101
-	 * @return Comment
102
-	 */
103
-	public function setUsername($username)
104
-	{
105
-		$this->username = $username;
106
-
107
-		return $this;
108
-	}
109
-
110
-	/**
111
-	 * Get username
112
-	 *
113
-	 * @return string
114
-	 */
115
-	public function getUsername()
116
-	{
117
-		return $this->username;
118
-	}
119
-
120
-	/**
121
-	 * Set email
122
-	 *
123
-	 * @param string $email
124
-	 * @return Comment
125
-	 */
126
-	public function setEmail($email)
127
-	{
128
-		$this->email = $email;
129
-
130
-		return $this;
131
-	}
132
-
133
-	/**
134
-	 * Get email
135
-	 *
136
-	 * @return string
137
-	 */
138
-	public function getEmail()
139
-	{
140
-		return $this->email;
141
-	}
142
-
143
-	/**
144
-	 * Set content
145
-	 *
146
-	 * @param string $content
147
-	 * @return Comment
148
-	 */
149
-	public function setContent($content)
150
-	{
151
-		$this->content = $content;
152
-
153
-		return $this;
154
-	}
155
-
156
-	/**
157
-	 * Get content
158
-	 *
159
-	 * @return string
160
-	 */
161
-	public function getContent()
162
-	{
163
-		return $this->content;
164
-	}
165
-
166
-	/**
167
-	 * Set createdAt
168
-	 *
169
-	 * @param \DateTime $createdAt
170
-	 * @return Comment
171
-	 */
172
-	public function setCreatedAt($createdAt)
173
-	{
174
-		$this->createdAt = $createdAt;
175
-
176
-		return $this;
177
-	}
178
-
179
-	/**
180
-	 * Get createdAt
181
-	 *
182
-	 * @return \DateTime
183
-	 */
184
-	public function getCreatedAt()
185
-	{
186
-		return $this->createdAt;
187
-	}
188
-
189
-	/**
190
-	 * Set model
191
-	 *
192
-	 * @param string $model
193
-	 * @return Comment
194
-	 */
195
-	public function setModel($model)
196
-	{
197
-		$this->model = $model;
198
-
199
-		return $this;
200
-	}
201
-
202
-	/**
203
-	 * Get model
204
-	 *
205
-	 * @return string
206
-	 */
207
-	public function getModel()
208
-	{
209
-		return $this->model;
210
-	}
211
-
212
-	/**
213
-	 * Set modelId
214
-	 *
215
-	 * @param integer $modelId
216
-	 * @return Comment
217
-	 */
218
-	public function setModelId($modelId)
219
-	{
220
-		$this->modelId = $modelId;
221
-
222
-		return $this;
223
-	}
224
-
225
-	/**
226
-	 * Get modelId
227
-	 *
228
-	 * @return integer
229
-	 */
230
-	public function getModelId()
231
-	{
232
-		return $this->modelId;
233
-	}
234
-
235
-	/**
236
-	 * Set parentId
237
-	 *
238
-	 * @param integer $parentId
239
-	 * @return Comment
240
-	 */
241
-	public function setParentId($parentId)
242
-	{
243
-		$this->parentId = $parentId;
244
-
245
-		return $this;
246
-	}
247
-
248
-	/**
249
-	 * Get parentId
250
-	 *
251
-	 * @return integer
252
-	 */
253
-	public function getParentId()
254
-	{
255
-		return $this->parentId;
256
-	}
257
-
258
-	/**
259
-	 * Set spam
260
-	 *
261
-	 * @param boolean $spam
262
-	 * @return Comment
263
-	 */
264
-	public function setSpam($spam)
265
-	{
266
-		$this->spam = $spam;
267
-
268
-		return $this;
269
-	}
270
-
271
-	/**
272
-	 * Get spam
273
-	 *
274
-	 * @return boolean
275
-	 */
276
-	public function getSpam()
277
-	{
278
-		return $this->spam;
279
-	}
280
-
281
-	/**
282
-	 * Set ip
283
-	 *
284
-	 * @param string $ip
285
-	 * @return Comment
286
-	 */
287
-	public function setIp($ip)
288
-	{
289
-		$this->ip = $ip;
290
-
291
-		return $this;
292
-	}
293
-
294
-	/**
295
-	 * Get ip
296
-	 *
297
-	 * @return string
298
-	 */
299
-	public function getIp()
300
-	{
301
-		return $this->ip;
302
-	}
303
-
304
-	/**
305
-	 * @return mixed
306
-	 */
307
-	public function getChildren()
308
-	{
309
-		return $this->children;
310
-	}
311
-
312
-	/**
313
-	 * @param mixed $children
314
-	 */
315
-	public function setChildren(Comment $children)
316
-	{
317
-		array_unshift($this->children,$children);
318
-	}
319
-
320
-	/**
321
-	 * @return int
322
-	 */
323
-	public function getDepth()
324
-	{
325
-		return $this->depth;
326
-	}
327
-
328
-	/**
329
-	 * @param int $depth
330
-	 */
331
-	public function setDepth($depth)
332
-	{
333
-		$this->depth = $depth;
334
-	}
335
-
336
-	/**
337
-	 * @return mixed
338
-	 */
339
-	public function getDepthReached()
340
-	{
341
-		return $this->depthReached;
342
-	}
343
-
344
-	/**
345
-	 * @param mixed $depthReached
346
-	 */
347
-	public function setDepthReached($depthReached)
348
-	{
349
-		$this->depthReached = $depthReached;
350
-	}
14
+    /**
15
+     * @var string
16
+     *
17
+     * @ORM\Column(name="username", type="string", length=100)
18
+     * @Assert\NotBlank(message="Vous devez entre un Nom")
19
+     */
20
+    private $username;
21
+
22
+    /**
23
+     * @var string
24
+     *
25
+     * @ORM\Column(name="email", type="string", length=255)
26
+     * @Assert\Email(message="L'Email n'est pas valid")
27
+     * @Assert\NotBlank(message="Vous devez préciser un Email.")
28
+     */
29
+    private $email;
30
+
31
+    /**
32
+     * @var string
33
+     *
34
+     * @ORM\Column(name="content", type="text")
35
+     * @Assert\NotBlank(message="Vous devez entrer un Message.")
36
+     */
37
+    private $content;
38
+
39
+    /**
40
+     * @var \DateTime
41
+     *
42
+     * @ORM\Column(name="created_at", type="datetime")
43
+     * @Assert\DateTime()
44
+     */
45
+    private $createdAt;
46
+
47
+    /**
48
+     * @var string
49
+     *
50
+     * @ORM\Column(name="model", type="string", length=60)
51
+     */
52
+    private $model;
53
+
54
+    /**
55
+     * @var integer
56
+     *
57
+     * @ORM\Column(name="model_id", type="integer")
58
+     */
59
+    private $modelId;
60
+
61
+    /**
62
+     * @var integer
63
+     *
64
+     * @ORM\Column(name="parent_id", type="integer")
65
+     */
66
+    private $parentId;
67
+
68
+    /**
69
+     * @var boolean
70
+     *
71
+     * @ORM\Column(name="spam", type="boolean")
72
+     */
73
+    private $spam;
74
+
75
+    /**
76
+     * @var string
77
+     *
78
+     * @ORM\Column(name="ip", type="string", length=255)
79
+     */
80
+    private $ip;
81
+
82
+    private $depth = 0;
83
+
84
+    private $depthReached;
85
+
86
+
87
+    private $children = [];
88
+
89
+    /**
90
+     * @ORM\PrePersist
91
+     */
92
+    public function updateDate()
93
+    {
94
+        $this->setCreatedAt(new \DateTime());
95
+    }
96
+
97
+    /**
98
+     * Set username
99
+     *
100
+     * @param string $username
101
+     * @return Comment
102
+     */
103
+    public function setUsername($username)
104
+    {
105
+        $this->username = $username;
106
+
107
+        return $this;
108
+    }
109
+
110
+    /**
111
+     * Get username
112
+     *
113
+     * @return string
114
+     */
115
+    public function getUsername()
116
+    {
117
+        return $this->username;
118
+    }
119
+
120
+    /**
121
+     * Set email
122
+     *
123
+     * @param string $email
124
+     * @return Comment
125
+     */
126
+    public function setEmail($email)
127
+    {
128
+        $this->email = $email;
129
+
130
+        return $this;
131
+    }
132
+
133
+    /**
134
+     * Get email
135
+     *
136
+     * @return string
137
+     */
138
+    public function getEmail()
139
+    {
140
+        return $this->email;
141
+    }
142
+
143
+    /**
144
+     * Set content
145
+     *
146
+     * @param string $content
147
+     * @return Comment
148
+     */
149
+    public function setContent($content)
150
+    {
151
+        $this->content = $content;
152
+
153
+        return $this;
154
+    }
155
+
156
+    /**
157
+     * Get content
158
+     *
159
+     * @return string
160
+     */
161
+    public function getContent()
162
+    {
163
+        return $this->content;
164
+    }
165
+
166
+    /**
167
+     * Set createdAt
168
+     *
169
+     * @param \DateTime $createdAt
170
+     * @return Comment
171
+     */
172
+    public function setCreatedAt($createdAt)
173
+    {
174
+        $this->createdAt = $createdAt;
175
+
176
+        return $this;
177
+    }
178
+
179
+    /**
180
+     * Get createdAt
181
+     *
182
+     * @return \DateTime
183
+     */
184
+    public function getCreatedAt()
185
+    {
186
+        return $this->createdAt;
187
+    }
188
+
189
+    /**
190
+     * Set model
191
+     *
192
+     * @param string $model
193
+     * @return Comment
194
+     */
195
+    public function setModel($model)
196
+    {
197
+        $this->model = $model;
198
+
199
+        return $this;
200
+    }
201
+
202
+    /**
203
+     * Get model
204
+     *
205
+     * @return string
206
+     */
207
+    public function getModel()
208
+    {
209
+        return $this->model;
210
+    }
211
+
212
+    /**
213
+     * Set modelId
214
+     *
215
+     * @param integer $modelId
216
+     * @return Comment
217
+     */
218
+    public function setModelId($modelId)
219
+    {
220
+        $this->modelId = $modelId;
221
+
222
+        return $this;
223
+    }
224
+
225
+    /**
226
+     * Get modelId
227
+     *
228
+     * @return integer
229
+     */
230
+    public function getModelId()
231
+    {
232
+        return $this->modelId;
233
+    }
234
+
235
+    /**
236
+     * Set parentId
237
+     *
238
+     * @param integer $parentId
239
+     * @return Comment
240
+     */
241
+    public function setParentId($parentId)
242
+    {
243
+        $this->parentId = $parentId;
244
+
245
+        return $this;
246
+    }
247
+
248
+    /**
249
+     * Get parentId
250
+     *
251
+     * @return integer
252
+     */
253
+    public function getParentId()
254
+    {
255
+        return $this->parentId;
256
+    }
257
+
258
+    /**
259
+     * Set spam
260
+     *
261
+     * @param boolean $spam
262
+     * @return Comment
263
+     */
264
+    public function setSpam($spam)
265
+    {
266
+        $this->spam = $spam;
267
+
268
+        return $this;
269
+    }
270
+
271
+    /**
272
+     * Get spam
273
+     *
274
+     * @return boolean
275
+     */
276
+    public function getSpam()
277
+    {
278
+        return $this->spam;
279
+    }
280
+
281
+    /**
282
+     * Set ip
283
+     *
284
+     * @param string $ip
285
+     * @return Comment
286
+     */
287
+    public function setIp($ip)
288
+    {
289
+        $this->ip = $ip;
290
+
291
+        return $this;
292
+    }
293
+
294
+    /**
295
+     * Get ip
296
+     *
297
+     * @return string
298
+     */
299
+    public function getIp()
300
+    {
301
+        return $this->ip;
302
+    }
303
+
304
+    /**
305
+     * @return mixed
306
+     */
307
+    public function getChildren()
308
+    {
309
+        return $this->children;
310
+    }
311
+
312
+    /**
313
+     * @param mixed $children
314
+     */
315
+    public function setChildren(Comment $children)
316
+    {
317
+        array_unshift($this->children,$children);
318
+    }
319
+
320
+    /**
321
+     * @return int
322
+     */
323
+    public function getDepth()
324
+    {
325
+        return $this->depth;
326
+    }
327
+
328
+    /**
329
+     * @param int $depth
330
+     */
331
+    public function setDepth($depth)
332
+    {
333
+        $this->depth = $depth;
334
+    }
335
+
336
+    /**
337
+     * @return mixed
338
+     */
339
+    public function getDepthReached()
340
+    {
341
+        return $this->depthReached;
342
+    }
343
+
344
+    /**
345
+     * @param mixed $depthReached
346
+     */
347
+    public function setDepthReached($depthReached)
348
+    {
349
+        $this->depthReached = $depthReached;
350
+    }
351 351
 
352 352
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -314,7 +314,7 @@
 block discarded – undo
314 314
 	 */
315 315
 	public function setChildren(Comment $children)
316 316
 	{
317
-		array_unshift($this->children,$children);
317
+		array_unshift($this->children, $children);
318 318
 	}
319 319
 
320 320
 	/**
Please login to merge, or discard this patch.
Form/Type/CommentFormEditType.php 2 patches
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -14,50 +14,50 @@
 block discarded – undo
14 14
 
15 15
 class CommentFormEditType extends AbstractType {
16 16
 
17
-	/**
18
-	 * @param FormBuilderInterface $builder
19
-	 * @param array $options
20
-	 */
21
-	public function buildForm(FormBuilderInterface $builder, array $options)
22
-	{
23
-		$builder
24
-			->add('username')
25
-			->add('email')
26
-			->add('content')
27
-			->add('model',"text",[
28
-				'required'=>false
29
-			])
30
-			->add('modelId',"text",[
31
-				'required'=>false
32
-			])
33
-			->add('parentId',"text",[
34
-				'required'=>false
35
-			])
36
-			->add('spam',"text",[
37
-				'required'=>false,
38
-				'data'=>0
39
-			])
40
-			->add('ip',"text",[
41
-				'required'=>false
42
-			])
43
-		;
44
-	}
17
+    /**
18
+     * @param FormBuilderInterface $builder
19
+     * @param array $options
20
+     */
21
+    public function buildForm(FormBuilderInterface $builder, array $options)
22
+    {
23
+        $builder
24
+            ->add('username')
25
+            ->add('email')
26
+            ->add('content')
27
+            ->add('model',"text",[
28
+                'required'=>false
29
+            ])
30
+            ->add('modelId',"text",[
31
+                'required'=>false
32
+            ])
33
+            ->add('parentId',"text",[
34
+                'required'=>false
35
+            ])
36
+            ->add('spam',"text",[
37
+                'required'=>false,
38
+                'data'=>0
39
+            ])
40
+            ->add('ip',"text",[
41
+                'required'=>false
42
+            ])
43
+        ;
44
+    }
45 45
 
46
-	/**
47
-	 * @param OptionsResolverInterface $resolver
48
-	 */
49
-	public function setDefaultOptions(OptionsResolverInterface $resolver)
50
-	{
51
-		$resolver->setDefaults(array(
52
-			'data_class' => 'Mykees\CommentBundle\Entity\Comment'
53
-		));
54
-	}
46
+    /**
47
+     * @param OptionsResolverInterface $resolver
48
+     */
49
+    public function setDefaultOptions(OptionsResolverInterface $resolver)
50
+    {
51
+        $resolver->setDefaults(array(
52
+            'data_class' => 'Mykees\CommentBundle\Entity\Comment'
53
+        ));
54
+    }
55 55
 
56
-	/**
57
-	 * @return string
58
-	 */
59
-	public function getName()
60
-	{
61
-		return 'mykees_comment_edit';
62
-	}
56
+    /**
57
+     * @return string
58
+     */
59
+    public function getName()
60
+    {
61
+        return 'mykees_comment_edit';
62
+    }
63 63
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -24,20 +24,20 @@
 block discarded – undo
24 24
 			->add('username')
25 25
 			->add('email')
26 26
 			->add('content')
27
-			->add('model',"text",[
27
+			->add('model', "text", [
28 28
 				'required'=>false
29 29
 			])
30
-			->add('modelId',"text",[
30
+			->add('modelId', "text", [
31 31
 				'required'=>false
32 32
 			])
33
-			->add('parentId',"text",[
33
+			->add('parentId', "text", [
34 34
 				'required'=>false
35 35
 			])
36
-			->add('spam',"text",[
36
+			->add('spam', "text", [
37 37
 				'required'=>false,
38 38
 				'data'=>0
39 39
 			])
40
-			->add('ip',"text",[
40
+			->add('ip', "text", [
41 41
 				'required'=>false
42 42
 			])
43 43
 		;
Please login to merge, or discard this patch.
Form/Type/CommentFormType.php 3 patches
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -10,53 +10,53 @@
 block discarded – undo
10 10
 class CommentFormType extends AbstractType
11 11
 {
12 12
 
13
-	protected $tokenStorage;
14
-	public $user;
15
-	public $username;
16
-	public $email;
17
-	public $content;
13
+    protected $tokenStorage;
14
+    public $user;
15
+    public $username;
16
+    public $email;
17
+    public $content;
18 18
 
19
-	public function __construct(TokenStorageInterface $tokenStorage)
20
-	{
21
-		$this->tokenStorage = $tokenStorage->getToken();
22
-		$this->user = method_exists($this->tokenStorage,'getUser') ? $this->tokenStorage->getUser() : array();
23
-	}
19
+    public function __construct(TokenStorageInterface $tokenStorage)
20
+    {
21
+        $this->tokenStorage = $tokenStorage->getToken();
22
+        $this->user = method_exists($this->tokenStorage,'getUser') ? $this->tokenStorage->getUser() : array();
23
+    }
24 24
     /**
25 25
      * @param FormBuilderInterface $builder
26 26
      * @param array $options
27 27
      */
28 28
     public function buildForm(FormBuilderInterface $builder, array $options)
29 29
     {
30
-	    if(empty($this->user) || $this->user == 'anon.')
31
-	    {
32
-		    $builder
33
-			    ->add('username','text',[
34
-				    'label'=> $this->username
35
-			    ])
36
-			    ->add('email','text',[
37
-				    'label'=> $this->email
38
-			    ])
39
-			    ->add('content','textarea',[
40
-				    'label'=> $this->content
41
-			    ])
42
-			    ->add('parentId','hidden',['data'=>0])
43
-			    ->add('model','hidden')
44
-			    ->add('modelId','hidden')
45
-		    ;
46
-	    }else{
47
-		    $builder
48
-			    ->add('username','hidden',[
49
-				    'data'=>$this->user->getUsername()
50
-			    ])
51
-			    ->add('email','hidden',[
52
-				    'data'=>$this->user->getEmail()
53
-			    ])
54
-			    ->add('content')
55
-			    ->add('parentId','hidden',['data'=>0])
56
-			    ->add('model','hidden')
57
-			    ->add('modelId','hidden')
58
-		    ;
59
-	    }
30
+        if(empty($this->user) || $this->user == 'anon.')
31
+        {
32
+            $builder
33
+                ->add('username','text',[
34
+                    'label'=> $this->username
35
+                ])
36
+                ->add('email','text',[
37
+                    'label'=> $this->email
38
+                ])
39
+                ->add('content','textarea',[
40
+                    'label'=> $this->content
41
+                ])
42
+                ->add('parentId','hidden',['data'=>0])
43
+                ->add('model','hidden')
44
+                ->add('modelId','hidden')
45
+            ;
46
+        }else{
47
+            $builder
48
+                ->add('username','hidden',[
49
+                    'data'=>$this->user->getUsername()
50
+                ])
51
+                ->add('email','hidden',[
52
+                    'data'=>$this->user->getEmail()
53
+                ])
54
+                ->add('content')
55
+                ->add('parentId','hidden',['data'=>0])
56
+                ->add('model','hidden')
57
+                ->add('modelId','hidden')
58
+            ;
59
+        }
60 60
     }
61 61
     
62 62
     /**
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	public function __construct(TokenStorageInterface $tokenStorage)
20 20
 	{
21 21
 		$this->tokenStorage = $tokenStorage->getToken();
22
-		$this->user = method_exists($this->tokenStorage,'getUser') ? $this->tokenStorage->getUser() : array();
22
+		$this->user = method_exists($this->tokenStorage, 'getUser') ? $this->tokenStorage->getUser() : array();
23 23
 	}
24 24
     /**
25 25
      * @param FormBuilderInterface $builder
@@ -27,34 +27,34 @@  discard block
 block discarded – undo
27 27
      */
28 28
     public function buildForm(FormBuilderInterface $builder, array $options)
29 29
     {
30
-	    if(empty($this->user) || $this->user == 'anon.')
30
+	    if (empty($this->user) || $this->user == 'anon.')
31 31
 	    {
32 32
 		    $builder
33
-			    ->add('username','text',[
33
+			    ->add('username', 'text', [
34 34
 				    'label'=> $this->username
35 35
 			    ])
36
-			    ->add('email','text',[
36
+			    ->add('email', 'text', [
37 37
 				    'label'=> $this->email
38 38
 			    ])
39
-			    ->add('content','textarea',[
39
+			    ->add('content', 'textarea', [
40 40
 				    'label'=> $this->content
41 41
 			    ])
42
-			    ->add('parentId','hidden',['data'=>0])
43
-			    ->add('model','hidden')
44
-			    ->add('modelId','hidden')
42
+			    ->add('parentId', 'hidden', ['data'=>0])
43
+			    ->add('model', 'hidden')
44
+			    ->add('modelId', 'hidden')
45 45
 		    ;
46
-	    }else{
46
+	    }else {
47 47
 		    $builder
48
-			    ->add('username','hidden',[
48
+			    ->add('username', 'hidden', [
49 49
 				    'data'=>$this->user->getUsername()
50 50
 			    ])
51
-			    ->add('email','hidden',[
51
+			    ->add('email', 'hidden', [
52 52
 				    'data'=>$this->user->getEmail()
53 53
 			    ])
54 54
 			    ->add('content')
55
-			    ->add('parentId','hidden',['data'=>0])
56
-			    ->add('model','hidden')
57
-			    ->add('modelId','hidden')
55
+			    ->add('parentId', 'hidden', ['data'=>0])
56
+			    ->add('model', 'hidden')
57
+			    ->add('modelId', 'hidden')
58 58
 		    ;
59 59
 	    }
60 60
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
 			    ->add('model','hidden')
44 44
 			    ->add('modelId','hidden')
45 45
 		    ;
46
-	    }else{
46
+	    } else{
47 47
 		    $builder
48 48
 			    ->add('username','hidden',[
49 49
 				    'data'=>$this->user->getUsername()
Please login to merge, or discard this patch.