ReservationController   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A ReservationForm() 6 6 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/**
3
 * ReservationController.php
4
 *
5
 * @author Bram de Leeuw
6
 * Date: 14/03/17
7
 */
8
9
namespace Broarm\EventTickets;
10
11
/**
12
 * Class ReservationController
13
 *
14
 * @package Broarm\EventTickets
15
 */
16 View Code Duplication
class ReservationController extends CheckoutStepController
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
17
{
18
    private static $allowed_actions = array(
19
        'ReservationForm'
20
    );
21
22
    protected $step = 'register';
23
24
    /**
25
     * Get the reservation form
26
     *
27
     * @return ReservationForm
28
     */
29
    public function ReservationForm()
30
    {
31
        $reservationForm = new ReservationForm($this, 'ReservationForm', ReservationSession::get());
0 ignored issues
show
Bug introduced by
It seems like \Broarm\EventTickets\ReservationSession::get() targeting Broarm\EventTickets\ReservationSession::get() can also be of type object<DataObject>; however, Broarm\EventTickets\ReservationForm::__construct() does only seem to accept null|object<Broarm\EventTickets\Reservation>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
32
        $reservationForm->setNextStep(CheckoutSteps::nextStep($this->step));
33
        return $reservationForm;
34
    }
35
}
36