PermaClassroom   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 47
Duplicated Lines 12.77 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 6
loc 47
ccs 21
cts 21
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A build() 0 4 1
A toArray() 6 22 2

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
namespace mikemix\Wiziq\Entity;
3
4
use mikemix\Wiziq\Entity\Traits\ClassroomTrait;
5
6
class PermaClassroom
7
{
8
    use ClassroomTrait;
9
10
    /**
11
     * @param string $title
12
     */
13 11
    private function __construct($title)
14
    {
15 11
        $this->title = (string)$title;
16 11
    }
17
18
    /**
19
     * @param string $title
20
     * @return self
21
     */
22 11
    public static function build($title)
23
    {
24 11
        return new self($title);
25
    }
26
27
    /**
28
     * @return array
29
     */
30 10
    public function toArray()
31
    {
32
        $params = [
33 10
            'title'                      => $this->title,
34 10
            'attendee_limit'             => $this->attendeeLimit,
35 10
            'presenter_default_controls' => $this->presenterDefaultControls,
36 10
            'attendee_default_controls'  => $this->attendeeDefaultControls,
37 10
            'create_recording'           => $this->createRecording,
38 10
            'language_culture_name'      => $this->languageCultureName,
39 10
            'return_url'                 => $this->returnUrl,
40 10
            'status_ping_url'            => $this->statusPingUrl,
41 10
        ];
42
43 10 View Code Duplication
        if ($this->presenterEmail) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
44 1
            $params['presenter_email'] = $this->presenterEmail;
45 1
        } else {
46 9
            $params['presenter_id']   = $this->presenterId;
47 9
            $params['presenter_name'] = $this->presenterName;
48
        }
49
50 10
        return $params;
51
    }
52
}
53