Completed
Pull Request — master (#172)
by Gorka
05:15
created

DefaultController   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 4
dl 0
loc 34
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B indexAction() 0 28 1
1
<?php
2
3
/*
4
 * This file is part of the Kreta package.
5
 *
6
 * (c) Beñat Espiña <[email protected]>
7
 * (c) Gorka Laucirica <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace Kreta\AppBundle\Controller;
14
15
use Kreta\TaskManager\Domain\Model\Organization\MemberId;
16
use Kreta\TaskManager\Domain\Model\Organization\Organization;
17
use Kreta\TaskManager\Domain\Model\Organization\OrganizationMember;
18
use Kreta\TaskManager\Domain\Model\Organization\OrganizationMemberId;
19
use Kreta\TaskManager\Domain\Model\User\UserId;
20
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
21
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
22
use Symfony\Component\HttpFoundation\Request;
23
24
class DefaultController extends Controller
25
{
26
    /**
27
     * @Route("/", name="homepage")
28
     */
29
    public function indexAction(Request $request)
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
30
    {
31
        $organization = $this->getDoctrine()->getRepository(Organization::class)->findOneBy([
32
            'name' => 'Organization name',
33
        ]);
34
35
        dump(
36
            $organization->owners(),
37
            $organization->organizationMembers(),
38
            $organization->isOwner(UserId::generate('ffede864-efef-47ab-b6bb-8c24badae2be')),
39
            $organization->isOrganzationMember(UserId::generate('ffede864-efef-47ab-b6bb-8c24badae2be')),
40
            $organization->addOwner(UserId::generate('ffede864-efef-47ab-b6bb-8c24badae2be')),
41
            $organization->isOwner(UserId::generate('ffede864-efef-47ab-b6bb-8c24badae2be')),
42
            $organization->owners()->contains(
43
                new OrganizationMember(
44
                    OrganizationMemberId::generate(),
45
                    UserId::generate('ffede864-efef-47ab-b6bb-8c24badae2be'),
46
                    $organization
47
                )
48
49
            )
50
        );
51
        die;
0 ignored issues
show
Coding Style Compatibility introduced by
The method indexAction() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
52
53
        return $this->render('default/index.html.twig', [
0 ignored issues
show
Unused Code introduced by
return $this->render('de...ay('pages' => $pages)); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
54
            'pages' => $pages,
55
        ]);
56
    }
57
}
58