1: <?php
2: /**
3: * Pinoco: makes existing static web site dynamic transparently.
4: * Copyright 2010-2012, Hisateru Tanaka <tanakahisateru@gmail.com>
5: *
6: * Licensed under The MIT License
7: * Redistributions of files must retain the above copyright notice.
8: *
9: * PHP Version 5
10: *
11: * @author Hisateru Tanaka <tanakahisateru@gmail.com>
12: * @copyright Copyright 2010-2012, Hisateru Tanaka <tanakahisateru@gmail.com>
13: * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
14: * @package Pinoco
15: */
16:
17: /**
18: * Array wrapper interface
19: *
20: * @package Pinoco
21: */
22: interface Pinoco_ArrayConvertible
23: {
24: /**
25: * Makes a new object from Array.
26: *
27: * @param array $src
28: * @return Pinoco_ArrayConvertible
29: */
30: public static function fromArray($src);
31:
32: /**
33: * Wraps an existing Array.
34: *
35: * @param array &$srcref
36: * @return Pinoco_ArrayConvertible
37: */
38: public static function wrap(&$srcref);
39:
40: /**
41: * Exports elements to Array.
42: *
43: * @param array $modifier
44: * @return array
45: */
46: public function toArray($modifier=null);
47:
48: /**
49: * Exports properties to Array recursively.
50: *
51: * @param int $depth
52: * @return array
53: */
54: public function toArrayRecurse($depth=null);
55:
56: /**
57: * Returns value or default by key.
58: *
59: * @param mixed $key
60: * @param mixed $default
61: * @return mixed
62: */
63: public function get($key, $default=Pinoco_OptionalParam::UNSPECIFIED);
64:
65: /**
66: * Returns a value or default by tree expression.
67: *
68: * @param string $expression
69: * @param mixed $default
70: * @return mixed
71: */
72: public function rget($expression, $default=Pinoco_OptionalParam::UNSPECIFIED);
73: }