PluginProbe
Media Cloud Sync / 1.0.2
Media Cloud Sync v1.0.2
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 1.3.0 All 34 releases
media-cloud-sync / includes / sdk / google / ramsey / collection / src / Map / MapInterface.php

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

138 lines 5.1 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\Ramsey\Collection\Map;
14
15 use Dudlewebs\WPMCS\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 T
22 * @extends ArrayInterface<T>
23 */
24 interface MapInterface extends ArrayInterface
25 {
26 /**
27 * Returns `true` if this map contains a mapping for the specified key.
28 *
29 * @param array-key $key The key to check in the map.
30 */
31 public function containsKey($key): bool;
32 /**
33 * Returns `true` if this map maps one or more keys to the specified value.
34 *
35 * This performs a strict type check on the value.
36 *
37 * @param T $value The value to check in the map.
38 */
39 // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
40 public function containsValue($value): bool;
41 /**
42 * Return an array of the keys contained in this map.
43 *
44 * @return list<array-key>
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 array-key $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 // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
58 public function get($key, $defaultValue = null);
59 /**
60 * Associates the specified value with the specified key in this map.
61 *
62 * If the map previously contained a mapping for the key, the old value is
63 * replaced by the specified value.
64 *
65 * @param array-key $key The key to put or replace in the map.
66 * @param T $value The value to store at `$key`.
67 *
68 * @return T|null the previous value associated with key, or `null` if
69 * there was no mapping for `$key`.
70 */
71 // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
72 public function put($key, $value);
73 /**
74 * Associates the specified value with the specified key in this map only if
75 * it is not already set.
76 *
77 * If there is already a value associated with `$key`, this returns that
78 * value without replacing it.
79 *
80 * @param array-key $key The key to put in the map.
81 * @param T $value The value to store at `$key`.
82 *
83 * @return T|null the previous value associated with key, or `null` if
84 * there was no mapping for `$key`.
85 */
86 // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
87 public function putIfAbsent($key, $value);
88 /**
89 * Removes the mapping for a key from this map if it is present.
90 *
91 * @param array-key $key The key to remove from the map.
92 *
93 * @return T|null the previous value associated with key, or `null` if
94 * there was no mapping for `$key`.
95 */
96 // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
97 public function remove($key);
98 /**
99 * Removes the entry for the specified key only if it is currently mapped to
100 * the specified value.
101 *
102 * This performs a strict type check on the value.
103 *
104 * @param array-key $key The key to remove from the map.
105 * @param T $value The value to match.
106 *
107 * @return bool true if the value was removed.
108 */
109 // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
110 public function removeIf($key, $value): bool;
111 /**
112 * Replaces the entry for the specified key only if it is currently mapped
113 * to some value.
114 *
115 * @param array-key $key The key to replace.
116 * @param T $value The value to set at `$key`.
117 *
118 * @return T|null the previous value associated with key, or `null` if
119 * there was no mapping for `$key`.
120 */
121 // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
122 public function replace($key, $value);
123 /**
124 * Replaces the entry for the specified key only if currently mapped to the
125 * specified value.
126 *
127 * This performs a strict type check on the value.
128 *
129 * @param array-key $key The key to remove from the map.
130 * @param T $oldValue The value to match.
131 * @param T $newValue The value to use as a replacement.
132 *
133 * @return bool true if the value was replaced.
134 */
135 // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
136 public function replaceIf($key, $oldValue, $newValue): bool;
137 }
138