PluginProbe
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin / 1.1.9
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin v1.1.9
1.1.9 1.1.8 1.1.7 1.1.6 1.1.5 1.1.4 1.1.3 1.1.2 1.1.1 1.1.0 1.0.1 1.0.0 0.9.8 0.9.7 0.9.6 0.9.4 0.9.5 0.9.3 0.9.2 0.9.1 0.9.0 0.8.9 0.8.8 0.8.7 0.8.6 All 33 releases
desktop-mode / includes / framework / app / standalone / class-store.php

class-store.php in OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin 1.1.9, at includes/framework/app/standalone/class-store.php

50 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * OpenStation App Framework — standalone Store adapter.
4 *
5 * In-memory. A bare PHP host that needs durability passes its own
6 * implementation to `Os::standalone( array( 'store' => … ) )`.
7 *
8 * @package OpenStation
9 */
10
11 namespace OpenStation\App\Standalone;
12
13 use OpenStation\App\Contracts\Store as StoreContract;
14
15 // Direct access, unless a standalone host is booting on bare PHP.
16 if ( ! defined( 'ABSPATH' ) ) {
17 defined( 'OPENSTATION_STANDALONE' ) || exit;
18 }
19
20 /**
21 * In-memory key/value store.
22 */
23 final class Store implements StoreContract {
24
25 /**
26 * @var array<string,array<string,mixed>>
27 */
28 private $data = array(
29 'user' => array(),
30 'site' => array(),
31 );
32
33 /** {@inheritDoc} */
34 public function get( $scope, $key, $fallback = null ) {
35 return isset( $this->data[ $scope ] ) && array_key_exists( $key, $this->data[ $scope ] )
36 ? $this->data[ $scope ][ $key ]
37 : $fallback;
38 }
39
40 /** {@inheritDoc} */
41 public function set( $scope, $key, $value ) {
42 $this->data[ $scope ][ $key ] = $value;
43 }
44
45 /** {@inheritDoc} */
46 public function delete( $scope, $key ) {
47 unset( $this->data[ $scope ][ $key ] );
48 }
49 }
50