Completed
Pull Request — master (#28)
by
unknown
01:38
created

BitrixWrapper::configProvider()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
namespace Arrilot\BitrixModels;
4
5
6
class BitrixWrapper
7
{
8
    protected static $configProvider;
9
    protected static $cacheManagerProvider;
10
    
11
    public static function registerConfigProvider($provider)
12
    {
13
        static::$configProvider = $provider;
14
    }
15
    
16
    /**
17
     * @return \COption
18
     */
19
    public static function configProvider()
20
    {
21
        if (!static::$configProvider) {
22
            static::$configProvider = new \COption();
23
        }
24
        
25
        return static::$configProvider;
26
    }
27
    
28
    public static function registerCacheManagerProvider($provider)
29
    {
30
        static::$cacheManagerProvider = $provider;
31
    }
32
    
33
    /**
34
     * @return \CCacheManager
35
     */
36
    public static function cacheManagerProvider()
37
    {
38
        if (!static::$cacheManagerProvider) {
39
            global $CACHE_MANAGER;
40
            static::$cacheManagerProvider = $CACHE_MANAGER;
41
        }
42
        
43
        return static::$cacheManagerProvider;
44
    }
45
}