Completed
Pull Request — master (#410)
by Anton
06:09
created

HttpCacheControl   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
dl 0
loc 17
ccs 3
cts 4
cp 0.75
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A initInstance() 0 7 2
1
<?php
2
/**
3
 * Bluz Framework Component
4
 *
5
 * @copyright Bluz PHP Team
6
 * @link https://github.com/bluzphp/framework
7
 */
8
9
declare(strict_types=1);
10
11
namespace Bluz\Proxy;
12
13
use Bluz\Common\Nil;
14
use Bluz\Http\CacheControl as Instance;
15
16
/**
17
 * Proxy to Http\CacheControl
18
 *
19
 * Example of usage
20
 * <code>
21
 *     use Bluz\Proxy\HttpCacheControl;
22
 * </code>
23
 *
24
 * @package  Bluz\Proxy
25
 * @author   Anton Shevchuk
26
 *
27
 * @method   static Instance getInstance()
28
 *
29
 * @method   static void setPrivate()
30
 * @see      Instance::setPrivate()
31
 *
32
 * @method   static void setPublic()
33
 * @see      Instance::setPublic()
34
 *
35
 * @method   static integer getMaxAge()
36
 * @see      Instance::getMaxAge()
37
 *
38
 * @method   static void setMaxAge($value)
39
 * @see      Instance::getMaxAge()
40
 *
41
 * @method   static void setSharedMaxAge($value)
42
 * @see      Instance::getMaxAge()
43
 *
44
 * @method   static integer getTtl()
45
 * @see      Instance::getTtl()
46
 *
47
 * @method   static void setTtl($seconds)
48
 * @see      Instance::setTtl()
49
 *
50
 * @method   static void setClientTtl($seconds)
51
 * @see      Instance::setClientTtl()
52
 *
53
 * @method   static string getEtag()
54
 * @see      Instance::getEtag()
55
 *
56
 * @method   static void setEtag($etag, $weak = false)
57
 * @see      Instance::setEtag()
58
 *
59
 * @method   static integer getAge()
60
 * @see      Instance::getAge()
61
 *
62
 * @method   static void setAge($age)
63
 * @see      Instance::setAge()
64
 *
65
 * @method   static \DateTime getExpires()
66
 * @see      Instance::getExpires()
67
 *
68
 * @method   static void setExpires($date)
69
 * @see      Instance::setExpires()
70
 *
71
 * @method   static \DateTime|null getLastModified()
72
 * @see      Instance::getLastModified()
73
 *
74
 * @method   static void setLastModified($date)
75
 * @see      Instance::setLastModified()
76
 */
77
class HttpCacheControl
78
{
79
    use ProxyTrait;
80
81
    /**
82
     * Init instance
83
     *
84
     * @return Instance|Nil
85
     */
86 1
    protected static function initInstance()
87
    {
88 1
        if (PHP_SAPI === 'cli') {
89 1
            return new Nil();
90
        }
91
        return new Instance(Response::getInstance());
92
    }
93
}
94