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

ImsLtiServiceResponseFactory   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 21
rs 10
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 12 4
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
}