PluginProbe
Groups – Memberships and Access Control / 1.11.0
Groups – Memberships and Access Control v1.11.0
4.7.1 4.7.0 4.6.0 4.5.0 4.4.0 4.3.0 trunk 1.0.0-beta-1 1.0.0-beta-2 1.0.0-beta-3 1.0.0-beta-3b 1.0.0-beta-3c 1.0.0-beta-3d 1.1.4 1.1.5 1.10.0 1.10.1 1.10.2 1.10.3 1.11.0 1.11.1 1.11.2 1.11.3 1.12.0 1.13.0 All 131 releases
groups / lib / core / class-groups-cache-object.php

class-groups-cache-object.php in Groups – Memberships and Access Control 1.11.0, at lib/core/class-groups-cache-object.php

89 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * class-groups-cache-object.php
4 *
5 * Copyright (c) "kento" Karim Rahimpur www.itthinx.com
6 *
7 * This code is released under the GNU General Public License.
8 * See COPYRIGHT.txt and LICENSE.txt.
9 *
10 * This code is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * This header and all notices must be kept intact.
16 *
17 * @author Karim Rahimpur
18 * @package groups
19 * @since groups 1.9.0
20 */
21
22 if ( !defined( 'ABSPATH' ) ) {
23 exit;
24 }
25
26 /**
27 * Cache entry encapsulation.
28 *
29 * @property string $key
30 * @property mixed $value
31 */
32 class Groups_Cache_Object {
33
34 /**
35 * Cache key.
36 * @var string
37 */
38 private $key = null;
39
40 /**
41 * Cached value.
42 * @var mixed
43 */
44 private $value = null;
45
46 /**
47 * Create a cache entry object that holds a value for the given key.
48 *
49 * @param string $key
50 * @param mixed $value
51 */
52 public function __construct( $key, $value ) {
53 $this->key = $key;
54 $this->value = $value;
55 }
56
57 /**
58 * Getter implementation for key and value properties.
59 *
60 * @param string $name
61 * @return property value or null
62 */
63 public function __get( $name ) {
64 $result = null;
65 switch ( $name ) {
66 case 'key' :
67 case 'value' :
68 $result = $this->$name;
69 break;
70 }
71 return $result;
72 }
73
74 /**
75 * Setter for key and value properties.
76 *
77 * @param string $name
78 * @param mixed $value
79 */
80 public function __set( $name, $value ) {
81 switch( $name ) {
82 case 'key' :
83 case 'value' :
84 $this->$name = $value;
85 break;
86 }
87 }
88 }
89