FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
DesignPatternsPHP/Proxy/Record.php at master · NandoKstroNet/DesignPatternsPHP · GitHub
NandoKstroNet
/
DesignPatternsPHP
Public
forked from
DesignPatternsPHP/DesignPatternsPHP
Notifications
You must be signed in to change notification settings
Fork
0
Star
2
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
DesignPatternsPHP
/
Proxy
/
Record.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
59 lines (54 loc) · 1.08 KB
Breadcrumbs
DesignPatternsPHP
/
Proxy
/
Record.php
Copy path
File metadata and controls
59 lines (54 loc) · 1.08 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
namespace
DesignPatterns
\
Proxy
;
/**
* Proxy pattern
*
* Purpose:
* to interface to anything that is expensive or impossible to duplicate
*
* Examples:
* - Doctrine2 uses proxies to implement framework magic (e.g. lazy initialization) in them, while the user still works
* with his own entity classes and will never use nor touch the proxies
*
*/
class
Record
{
/**
* @var array|null
*/
protected
$
data
;
/**
* @param null $data
*/
public
function
__construct
(
$
data
=
null
)
{
$
this
->
data
= (
array
)
$
data
;
}
/**
* magic setter
*
* @param string $name
* @param mixed $value
*
* @return void
*/
public
function
__set
(
$
name
,
$
value
)
{
$
this
->
data
[(
string
)
$
name
] =
$
value
;
}
/**
* magic getter
*
* @param string $name
*
* @return mixed|null
*/
public
function
__get
(
$
name
)
{
if
(
array_key_exists
(
$
name
,
$
this
->
data
)) {
return
$
this
->
data
[(
string
)
$
name
];
}
else
{
return
null
;
}
}
}
Back
|
FazBrowse Home
|
New Git URL