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.

UserBoardController   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 7
Metric Value
wmc 1
lcom 1
cbo 7
dl 0
loc 29
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A showAction() 0 19 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
/**
17
 *
18
 * @category CCDNForum
19
 * @package  ForumBundle
20
 *
21
 * @author   Reece Fowell <[email protected]>
22
 * @license  http://opensource.org/licenses/MIT MIT
23
 * @version  Release: 2.0
24
 * @link     https://github.com/codeconsortium/CCDNForumForumBundle
25
 *
26
 */
27
class UserBoardController extends BaseController
28
{
29
    /**
30
     *
31
     * @access public
32
     * @param  string                          $forumName
33
     * @param  int                             $boardId
34
     * @return RedirectResponse|RenderResponse
0 ignored issues
show
Documentation introduced by
Should the return type not be \Symfony\Component\HttpFoundation\Response?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
35
     */
36
    public function showAction($forumName, $boardId)
37
    {
38
        $this->isFound($forum = $this->getForumModel()->findOneForumByName($forumName));
0 ignored issues
show
Documentation introduced by
$forum = $this->getForum...ForumByName($forumName) is of type object<CCDNForum\ForumBundle\Entity\Forum>, but the function expects a object<Object>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
39
        $this->isFound($board = $this->getBoardModel()->findOneBoardByIdWithCategory($boardId));
0 ignored issues
show
Documentation introduced by
$board = $this->getBoard...dWithCategory($boardId) is of type object<CCDNForum\ForumBundle\Entity\Board>, but the function expects a object<Object>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
40
        $this->isAuthorised($this->getAuthorizer()->canShowBoard($board, $forum));
41
        $itemsPerPage = $this->getPageHelper()->getTopicsPerPageOnBoards();
42
        $stickyTopics = $this->getTopicModel()->findAllTopicsStickiedByBoardId($boardId, true);
43
        $topicsPager = $this->getTopicModel()->findAllTopicsPaginatedByBoardId($boardId, $this->getQuery('page', 1), $itemsPerPage, true);
44
45
        return $this->renderResponse('CCDNForumForumBundle:User:Board/show.html.', array(
46
            'crumbs' => $this->getCrumbs()->addUserBoardShow($forum, $board),
47
            'forum' => $forum,
48
            'forumName' => $forumName,
49
            'board' => $board,
50
            'pager' => $topicsPager,
51
            'posts_per_page' => $this->container->getParameter('ccdn_forum_forum.topic.user.show.posts_per_page'), // for working out last page per topic.
52
            'sticky_topics' => $stickyTopics,
53
        ));
54
    }
55
}
56