Passed
Push — master ( c8e4bc...17399e )
by Jacobo
04:15
created

PublishStreamBuilder   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 19
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A build() 0 12 2
1
<?php
2
3
namespace SquareetLabs\LaravelOpenVidu\Builders;
4
5
use SquareetLabs\LaravelOpenVidu\Exceptions\OpenViduStreamTypeInvalidException;
6
use SquareetLabs\LaravelOpenVidu\IPCameraOptions;
7
use SquareetLabs\LaravelOpenVidu\StreamInterface;
8
9
/**
10
 * Class PublishStreamBuilder
11
 * @package SquareetLabs\LaravelOpenVidu\Builders
12
 */
13
class PublishStreamBuilder implements BuilderInterface
14
{
15
    /**
16
     * @param  array  $properties
17
     * @return StreamInterface
18
     * @throws OpenViduStreamTypeInvalidException
19
     */
20
    public static function build(array $properties)
21
    {
22
        switch ($properties['type']) {
23
            case 'IPCAM':
24
                return new IPCameraOptions($properties['rtspUri'],
25
                    $properties['type'],
26
                    $properties['adaptativeBitrate'],
27
                    $properties['onlyPlayWithSubscribers'],
28
                    $properties['data']
29
                );
30
            default:
31
                throw new OpenViduStreamTypeInvalidException();
32
        }
33
    }
34
}