PluginProbe
Media Cloud Sync / 1.4.1
Media Cloud Sync v1.4.1
1.4.1 1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 All 35 releases
media-cloud-sync / includes / sdk / google / ramsey / collection / src / Map / MapInterface.php

MapInterface.php in Media Cloud Sync 1.4.1, at includes/sdk/google/ramsey/collection/src/Map/MapInterface.php

131 lines 4.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * This file is part of the ramsey/collection library
5 *
6 * For the full copyright and license information, please view the LICENSE
7 * file that was distributed with this source code.
8 *
9 * @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
10 * @license http://opensource.org/licenses/MIT MIT
11 */
12 declare (strict_types=1);
13 namespace Dudlewebs\WPMCS\GCP\Ramsey\Collection\Map;
14
15 use Dudlewebs\WPMCS\GCP\Ramsey\Collection\ArrayInterface;
16 /**
17 * An object that maps keys to values.
18 *
19 * A map cannot contain duplicate keys; each key can map to at most one value.
20 *
21 * @template K of array-key
22 * @template T
23 * @extends ArrayInterface<T>
24 */
25 interface MapInterface extends ArrayInterface
26 {
27 /**
28 * Returns `true` if this map contains a mapping for the specified key.
29 *
30 * @param K $key The key to check in the map.
31 */
32 public function containsKey(int|string $key) : bool;
33 /**
34 * Returns `true` if this map maps one or more keys to the specified value.
35 *
36 * This performs a strict type check on the value.
37 *
38 * @param T $value The value to check in the map.
39 */
40 public function containsValue(mixed $value) : bool;
41 /**
42 * Return an array of the keys contained in this map.
43 *
44 * @return list<K>
45 */
46 public function keys() : array;
47 /**
48 * Returns the value to which the specified key is mapped, `null` if this
49 * map contains no mapping for the key, or (optionally) `$defaultValue` if
50 * this map contains no mapping for the key.
51 *
52 * @param K $key The key to return from the map.
53 * @param T | null $defaultValue The default value to use if `$key` is not found.
54 *
55 * @return T | null the value or `null` if the key could not be found.
56 */
57 public function get(int|string $key, mixed $defaultValue = null) : mixed;
58 /**
59 * Associates the specified value with the specified key in this map.
60 *
61 * If the map previously contained a mapping for the key, the old value is
62 * replaced by the specified value.
63 *
64 * @param K $key The key to put or replace in the map.
65 * @param T $value The value to store at `$key`.
66 *
67 * @return T | null the previous value associated with key, or `null` if
68 * there was no mapping for `$key`.
69 */
70 public function put(int|string $key, mixed $value) : mixed;
71 /**
72 * Associates the specified value with the specified key in this map only if
73 * it is not already set.
74 *
75 * If there is already a value associated with `$key`, this returns that
76 * value without replacing it.
77 *
78 * @param K $key The key to put in the map.
79 * @param T $value The value to store at `$key`.
80 *
81 * @return T | null the previous value associated with key, or `null` if
82 * there was no mapping for `$key`.
83 */
84 public function putIfAbsent(int|string $key, mixed $value) : mixed;
85 /**
86 * Removes the mapping for a key from this map if it is present.
87 *
88 * @param K $key The key to remove from the map.
89 *
90 * @return T | null the previous value associated with key, or `null` if
91 * there was no mapping for `$key`.
92 */
93 public function remove(int|string $key) : mixed;
94 /**
95 * Removes the entry for the specified key only if it is currently mapped to
96 * the specified value.
97 *
98 * This performs a strict type check on the value.
99 *
100 * @param K $key The key to remove from the map.
101 * @param T $value The value to match.
102 *
103 * @return bool true if the value was removed.
104 */
105 public function removeIf(int|string $key, mixed $value) : bool;
106 /**
107 * Replaces the entry for the specified key only if it is currently mapped
108 * to some value.
109 *
110 * @param K $key The key to replace.
111 * @param T $value The value to set at `$key`.
112 *
113 * @return T | null the previous value associated with key, or `null` if
114 * there was no mapping for `$key`.
115 */
116 public function replace(int|string $key, mixed $value) : mixed;
117 /**
118 * Replaces the entry for the specified key only if currently mapped to the
119 * specified value.
120 *
121 * This performs a strict type check on the value.
122 *
123 * @param K $key The key to remove from the map.
124 * @param T $oldValue The value to match.
125 * @param T $newValue The value to use as a replacement.
126 *
127 * @return bool true if the value was replaced.
128 */
129 public function replaceIf(int|string $key, mixed $oldValue, mixed $newValue) : bool;
130 }
131