1 | <?php |
||
13 | class MslsBlog { |
||
14 | |||
15 | /** |
||
16 | * WordPress generates such an object |
||
17 | * @var StdClass |
||
18 | */ |
||
19 | private $obj; |
||
20 | |||
21 | /** |
||
22 | * Language-code eg. de_DE |
||
23 | * @var string |
||
24 | */ |
||
25 | private $language; |
||
26 | |||
27 | /** |
||
28 | * Description eg. Deutsch |
||
29 | * @var string |
||
30 | */ |
||
31 | private $description; |
||
32 | |||
33 | /** |
||
34 | * Constructor |
||
35 | * |
||
36 | * @param StdClass $obj |
||
37 | * @param string $description |
||
38 | */ |
||
39 | public function __construct( $obj, $description ) { |
||
48 | |||
49 | /** |
||
50 | * Get a member of the StdClass-object by name |
||
51 | * |
||
52 | * The method return <em>null</em> if the requested member does not exists. |
||
53 | * |
||
54 | * @param string $key |
||
55 | * |
||
56 | * @return mixed|null |
||
57 | */ |
||
58 | final public function __get( $key ) { |
||
61 | |||
62 | /** |
||
63 | * Get the description stored in this object |
||
64 | * |
||
65 | * The method returns the stored language if the description is empty. |
||
66 | * @return string |
||
67 | */ |
||
68 | public function get_description() { |
||
75 | |||
76 | /** |
||
77 | * Get the language stored in this object |
||
78 | * |
||
79 | * This method returns the string 'us' if there is an empty value in language. |
||
80 | * @return string |
||
81 | */ |
||
82 | public function get_language() { |
||
85 | |||
86 | /** |
||
87 | * Get the alpha2-part of the language-code |
||
88 | * |
||
89 | * This method returns the string 'en' if the language-code contains just 'us'. |
||
90 | * @return string |
||
91 | */ |
||
92 | public function get_alpha2() { |
||
97 | |||
98 | /** |
||
99 | * Sort objects helper |
||
100 | * |
||
101 | * @param string $a |
||
102 | * @param string $b |
||
103 | * |
||
104 | * @return int |
||
105 | */ |
||
106 | public static function _cmp( $a, $b ) { |
||
113 | |||
114 | /** |
||
115 | * Sort objects by language |
||
116 | * |
||
117 | * @param MslsBlog $a |
||
118 | * @param MslsBlog $b |
||
119 | * |
||
120 | * @return int |
||
121 | */ |
||
122 | public static function language( MslsBlog $a, MslsBlog $b ) { |
||
125 | |||
126 | /** |
||
127 | * Sort objects by description |
||
128 | * |
||
129 | * @param MslsBlog $a |
||
130 | * @param MslsBlog $b |
||
131 | * |
||
132 | * @return int |
||
133 | */ |
||
134 | public static function description( MslsBlog $a, MslsBlog $b ) { |
||
137 | |||
138 | } |
||
139 |