/[cvs]/nfo/php/libs/org.netfrag.glib/Data/Deep.php
ViewVC logotype

Contents of /nfo/php/libs/org.netfrag.glib/Data/Deep.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Mon Mar 3 21:28:11 2003 UTC (21 years, 5 months ago) by joko
Branch: MAIN
Changes since 1.1: +8 -2 lines
updated comments

1 <?
2 // -------------------------------------------------------------------------
3 // $Id: Deep.php,v 1.1 2003/02/03 14:51:44 joko Exp $
4 // -------------------------------------------------------------------------
5 // $Log: Deep.php,v $
6 // Revision 1.1 2003/02/03 14:51:44 joko
7 // + initial commit
8 // + refactored from flib/...
9 //
10 // -------------------------------------------------------------------------
11
12
13 // rename to Data::Hash::Addressable???
14
15 class Data_Deep {
16
17 var $payload;
18
19 function Data_Deep(&$payload) {
20 $this->payload = &$payload;
21 }
22
23 function &get($attr) {
24 $evalstr = 'return $this->payload' . $this->_getHKR($attr) . ';';
25 $val = eval($evalstr);
26 return $val;
27 }
28
29 function set($attr, $val) {
30 //$evalstr = '$this->payload' . $this->_getHKR($attr) . ' = \'' . $val . '\';';
31 $evalstr = '$this->payload' . $this->_getHKR($attr) . ' = $val;';
32 eval($evalstr);
33 }
34
35 function getPayload() {
36 return $this->payload;
37 }
38
39 function _getHKR($key) {
40 $attr_arr = split('\.', $key);
41 $attr_hkr = '["' . join('"]["', $attr_arr) . '"]';
42 return $attr_hkr;
43 }
44
45 }
46
47 ?>

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed