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

BitrixWrapper   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Importance

Changes 0
Metric Value
wmc 6
lcom 2
cbo 0
dl 0
loc 40
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A registerConfigProvider() 0 4 1
A configProvider() 0 8 2
A registerCacheManagerProvider() 0 4 1
A cacheManagerProvider() 0 9 2
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
}