1 | <?php |
||
23 | class MongoId implements Serializable, TypeInterface, JsonSerializable |
||
24 | { |
||
25 | /* |
||
26 | * @var ObjectID |
||
27 | */ |
||
28 | private $objectID; |
||
29 | |||
30 | /** |
||
31 | * Creates a new id |
||
32 | * |
||
33 | * |
||
34 | * @link http://www.php.net/manual/en/mongoid.construct.php |
||
35 | * @param string $id [optional] A string to use as the id. Must be 24 hexidecimal characters. If an invalid string is passed to this constructor, the constructor will ignore it and create a new id value. |
||
36 | * |
||
37 | * @throws MongoException |
||
38 | */ |
||
39 | public function __construct($id = null) |
||
43 | |||
44 | /** |
||
45 | * Check if a value is a valid ObjectId |
||
46 | * |
||
47 | * @link http://php.net/manual/en/mongoid.isvalid.php |
||
48 | * @param mixed $value The value to check for validity. |
||
49 | * @return bool |
||
50 | */ |
||
51 | public static function isValid($value) |
||
61 | |||
62 | /** |
||
63 | * Returns a hexidecimal representation of this id |
||
64 | * @link http://www.php.net/manual/en/mongoid.tostring.php |
||
65 | * @return string |
||
66 | */ |
||
67 | public function __toString() |
||
71 | |||
72 | /** |
||
73 | * Converts this MongoId to the new BSON ObjectID type |
||
74 | * |
||
75 | * @return ObjectID |
||
76 | * @internal This method is not part of the ext-mongo API |
||
77 | */ |
||
78 | public function toBSONType() |
||
82 | |||
83 | /** |
||
84 | * @param string $name |
||
85 | * |
||
86 | * @return null|string |
||
87 | */ |
||
88 | public function __get($name) |
||
96 | |||
97 | /** |
||
98 | * @param string $name |
||
99 | * @param mixed $value |
||
100 | */ |
||
101 | public function __set($name, $value) |
||
108 | |||
109 | /** |
||
110 | * @param string $name |
||
111 | * @return bool |
||
112 | */ |
||
113 | public function __isset($name) |
||
117 | |||
118 | /** |
||
119 | * @param string $name |
||
120 | */ |
||
121 | public function __unset($name) |
||
128 | |||
129 | /** |
||
130 | * @return string |
||
131 | */ |
||
132 | public function serialize() |
||
136 | |||
137 | /** |
||
138 | * @param string $serialized |
||
139 | */ |
||
140 | public function unserialize($serialized) |
||
144 | |||
145 | /** |
||
146 | * Gets the incremented value to create this id |
||
147 | * @link http://php.net/manual/en/mongoid.getinc.php |
||
148 | * @return int Returns the incremented value used to create this MongoId. |
||
149 | */ |
||
150 | public function getInc() |
||
154 | |||
155 | /** |
||
156 | * (PECL mongo >= 1.0.11) |
||
157 | * Gets the process ID |
||
158 | * @link http://php.net/manual/en/mongoid.getpid.php |
||
159 | * @return int Returns the PID of the MongoId. |
||
160 | */ |
||
161 | public function getPID() |
||
169 | |||
170 | /** |
||
171 | * (PECL mongo >= 1.0.1) |
||
172 | * Gets the number of seconds since the epoch that this id was created |
||
173 | * @link http://www.php.net/manual/en/mongoid.gettimestamp.php |
||
174 | * @return int |
||
175 | */ |
||
176 | public function getTimestamp() |
||
180 | |||
181 | /** |
||
182 | * Gets the hostname being used for this machine's ids |
||
183 | * @link http://www.php.net/manual/en/mongoid.gethostname.php |
||
184 | * @return string |
||
185 | */ |
||
186 | public static function getHostname() |
||
190 | |||
191 | /** |
||
192 | * (PECL mongo >= 1.0.8) |
||
193 | * Create a dummy MongoId |
||
194 | * @link http://php.net/manual/en/mongoid.set-state.php |
||
195 | * @param array $props <p>Theoretically, an array of properties used to create the new id. However, as MongoId instances have no properties, this is not used.</p> |
||
196 | * @return MongoId A new id with the value "000000000000000000000000". |
||
197 | */ |
||
198 | public static function __set_state(array $props) |
||
201 | |||
202 | /** |
||
203 | * @return stdClass |
||
204 | */ |
||
205 | public function jsonSerialize() |
||
211 | |||
212 | /** |
||
213 | * @param $id |
||
214 | * @throws MongoException |
||
215 | */ |
||
216 | private function createObjectID($id) |
||
230 | } |
||
231 |