Completed
Push — master ( 0b41d4...adde54 )
by
unknown
02:12
created

Lang::getConfig()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 5
rs 9.4285
cc 1
eloc 2
nc 1
nop 0
1
<?php namespace OpenCafe\Tools;
2
3
/************************************************************
4
 * Lang class tranlate every expresion according to lang
5
 ************************************************************
6
 *
7
 * table in lang folder
8
 * @since Aug, 21 2015
9
 *
10
 *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
11
 */
12
class Lang {
13
14
    /**
15
     * Store language table
16
     * @var array
17
     */
18
    protected static $langTable;
19
20
    /**
21
     * Language translated words
22
     * @var array
23
     */
24
    protected static $config;
25
26
    protected static $obj;
27
28
    /************************************************************
29
     * Return translated expression
30
     ************************************************************
31
     *
32
     * @since Aug, 21 2015
33
     * @param text string
34
     * @return mixed
35
     *
36
     *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
37
     */
38
    public static function setConfig( $language ) {
39
40
      /**
41
       * Fetch translated file to config attribute
42
       */
43
       self::$config = include( 'src/CalendarSettings/Jalali.php' );
44
45
       /**
46
        * Fetch translated expression to langTable attribute
47
        */
48
       self::$langTable = include( 'lang/' . $language . '/general.php' );
49
50
       foreach( self::$langTable as $key => $translate ){
51
52
         if ( isset( self::$config[ $key ] ) ) {
53
54
           if ( self::$config[ $key ] ) {
55
56
             self::$config[ $key ] = $translate;
57
58
           }
59
60
         }
61
62
       }
63
64
    }
65
66
    public static function getConfig() {
67
68
      return self::$config;
69
70
    }
71
72
}
73