GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

UserPostBaseController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4
Metric Value
wmc 3
lcom 1
cbo 4
dl 0
loc 41
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getFormHandlerToEditPost() 0 15 2
A getFormHandlerToDeletePost() 0 10 1
1
<?php
2
3
/*
4
 * This file is part of the CCDNForum ForumBundle
5
 *
6
 * (c) CCDN (c) CodeConsortium <http://www.codeconsortium.com/>
7
 *
8
 * Available on github <http://www.github.com/codeconsortium/>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace CCDNForum\ForumBundle\Controller;
15
16
use CCDNForum\ForumBundle\Entity\Post;
17
18
/**
19
 *
20
 * @category CCDNForum
21
 * @package  ForumBundle
22
 *
23
 * @author   Reece Fowell <[email protected]>
24
 * @license  http://opensource.org/licenses/MIT MIT
25
 * @version  Release: 2.0
26
 * @link     https://github.com/codeconsortium/CCDNForumForumBundle
27
 *
28
 */
29
class UserPostBaseController extends BaseController
30
{
31
    /**
32
     *
33
     * @access protected
34
     * @param  \CCDNForum\ForumBundle\Entity\Post                        $post
35
     * @return \CCDNForum\ForumBundle\Form\Handler\PostUpdateFormHandler
36
     */
37
    protected function getFormHandlerToEditPost(Post $post)
38
    {
39
        // If post is the very first post of the topic then use a topic handler so user can change topic title.
40
        if ($post->getTopic()->getFirstPost()->getId() == $post->getId()) {
41
            $formHandler = $this->container->get('ccdn_forum_forum.form.handler.topic_update');
42
        } else {
43
            $formHandler = $this->container->get('ccdn_forum_forum.form.handler.post_update');
44
        }
45
46
        $formHandler->setPost($post);
47
        $formHandler->setUser($this->getUser());
48
        $formHandler->setRequest($this->getRequest());
49
50
        return $formHandler;
51
    }
52
53
    /**
54
     *
55
     * @access protected
56
     * @param  \CCDNForum\ForumBundle\Entity\Post                        $post
57
     * @return \CCDNForum\ForumBundle\Form\Handler\PostDeleteFormHandler
58
     */
59
    protected function getFormHandlerToDeletePost(Post $post)
60
    {
61
        $formHandler = $this->container->get('ccdn_forum_forum.form.handler.post_delete');
62
63
        $formHandler->setPost($post);
64
        $formHandler->setUser($this->getUser());
65
        $formHandler->setRequest($this->getRequest());
66
67
        return $formHandler;
68
    }
69
}
70