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 / Set.php

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

57 lines 1.6 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;
14
15 /**
16 * A set is a collection that contains no duplicate elements.
17 *
18 * Great care must be exercised if mutable objects are used as set elements.
19 * The behavior of a set is not specified if the value of an object is changed
20 * in a manner that affects equals comparisons while the object is an element in
21 * the set.
22 *
23 * Example usage:
24 *
25 * ```
26 * $foo = new \My\Foo();
27 * $set = new Set(\My\Foo::class);
28 *
29 * $set->add($foo); // returns TRUE, the element doesn't exist
30 * $set->add($foo); // returns FALSE, the element already exists
31 *
32 * $bar = new \My\Foo();
33 * $set->add($bar); // returns TRUE, $bar !== $foo
34 * ```
35 *
36 * @template T
37 * @extends AbstractSet<T>
38 */
39 class Set extends AbstractSet
40 {
41 /**
42 * Constructs a set object of the specified type, optionally with the
43 * specified data.
44 *
45 * @param string $setType The type or class name associated with this set.
46 * @param array<array-key, T> $data The initial items to store in the set.
47 */
48 public function __construct(private readonly string $setType, array $data = [])
49 {
50 parent::__construct($data);
51 }
52 public function getType() : string
53 {
54 return $this->setType;
55 }
56 }
57