4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC. All rights reserved. |
7 | This work is published under the GNU AGPLv3 license with some |
8 | permitted exceptions and without any warranty. For full license |
9 | and copyright information, see https://civicrm.org/licensing |
10 +--------------------------------------------------------------------+
16 * @copyright CiviCRM LLC https://civicrm.org/licensing
22 namespace api\v
4\Mock
;
25 * Simple data backend for mock basic api.
27 class MockEntityDataStorage
{
29 private static $data = [];
31 private static $nextId = 1;
33 public static function get() {
37 public static function write($record) {
38 if (empty($record['id'])) {
39 $record['id'] = self
::$nextId++
;
40 self
::$data[$record['id']] = $record;
43 self
::$data[$record['id']] = $record + self
::$data[$record['id']];
48 public static function delete($record) {
49 unset(self
::$data[$record['id']]);