144 if (empty(self::$objectStorage))
146 register_shutdown_function([__CLASS__,
"shutdown"]);
149 $c = get_called_class();
150 $innerId =
$id = intval(
$id);
151 if (!array_key_exists($c, self::$objectStorage))
153 self::$objectStorage[$c] = [
"maxId" => 0,
"data" => []];
155 if ($shouldBeNewIfIdIsNull ===
true &&
$id <= 0)
157 $innerId = implode(
"", [
"n", self::$objectStorage[$c][
"maxId"]++]);
159 if (array_key_exists($innerId, self::$objectStorage[$c][
"data"]))
161 $obj = self::$objectStorage[$c][
"data"][$innerId];
166 self::$objectStorage[$c][
"data"][$innerId] = $obj;