PermaClassroom::build()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
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