summaryrefslogtreecommitdiff
blob: ef8aa310d1db0fdfc3f01d33bc8c8460dc3e402e (plain)
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php

namespace SMW;

/**
 * Interface specifying methods for an accessible object
 *
 * @ingroup SMW
 *
 * @licence GNU GPL v2+
 * @since 1.9
 *
 * @author mwjames
 */
interface Accessible {

	/**
	 * Returns whether a specific element is accessible
	 *
	 * @since 1.9
	 *
	 * @param  mixed $key specific key
	 *
	 * @return boolean
	 */
	public function has( $key );

	/**
	 * Returns a element for a specific key
	 *
	 * @since 1.9
	 *
	 * @param  mixed $key specific key
	 *
	 * @return mixed
	 */
	public function get( $key );

}

/**
 * Interface specifying methods for a changeable object
 *
 * @ingroup Utility
 */
interface Changeable {

	/**
	 * Adds an new element (key, value pair) to an existing collection
	 *
	 * @since 1.9
	 *
	 * @param  mixed $key
	 * @param  mixed $value
	 */
	public function set( $key, $value );

	/**
	 * Removes an element from a collection
	 *
	 * @since 1.9
	 *
	 * @param  mixed $key specific key
	 */
	public function remove( $key );

}

/**
 * Interface specifying methods for a combinable object
 *
 * @ingroup Utility
 */
interface Combinable {

	/**
	 * Returns an array
	 *
	 * @since 1.9
	 *
	 * @return array
	 */
	public function toArray();

	/**
	 * Merges elements of one or more arrays together
	 *
	 * @since 1.9
	 *
	 * @param array $mergeable
	 */
	public function merge( array $mergeable );

}

/**
 * Interface specifying an object dictionary
 *
 * @ingroup Utility
 */
interface ObjectDictionary extends Accessible, Changeable, Combinable {}