Passed
Push — master ( 65060b...2b54a2 )
by Julito
10:15
created

ImsLtiServiceResponseFactory::create()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
eloc 8
c 1
b 0
f 0
nc 4
nop 3
dl 0
loc 12
rs 10
1
<?php
2
/* For licensing terms, see /license.txt */
3
4
/**
5
 * Class ImsLtiServiceResponseFactory.
6
 */
7
class ImsLtiServiceResponseFactory
8
{
9
    /**
10
     * @param string                      $type
11
     * @param ImsLtiServiceResponseStatus $statusInfo
12
     * @param mixed                       $bodyParam
13
     *
14
     * @return ImsLtiServiceResponse|null
15
     */
16
    public static function create($type, ImsLtiServiceResponseStatus $statusInfo, $bodyParam = null)
17
    {
18
        switch ($type) {
19
            case ImsLtiServiceResponse::TYPE_REPLACE:
20
                return new ImsLtiServiceReplaceResponse($statusInfo, $bodyParam);
21
            case ImsLtiServiceResponse::TYPE_READ:
22
                return new ImsLtiServiceReadResponse($statusInfo, $bodyParam);
23
            case ImsLtiServiceResponse::TYPE_DELETE:
24
                return new ImsLtiServiceDeleteResponse($statusInfo, $bodyParam);
25
        }
26
27
        return null;
28
    }
29
}