PluginProbe
Media Cloud Sync / 1.0.3
Media Cloud Sync v1.0.3
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 / AbstractSet.php

AbstractSet.php in Media Cloud Sync 1.0.3, at includes/sdk/google/ramsey/collection/src/AbstractSet.php

46 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 /**
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;
14
15 /**
16 * This class contains the basic implementation of a collection that does not
17 * allow duplicated values (a set), to minimize the effort required to implement
18 * this specific type of collection.
19 *
20 * @template T
21 * @extends AbstractCollection<T>
22 */
23 abstract class AbstractSet extends AbstractCollection
24 {
25 /**
26 * @inheritDoc
27 */
28 public function add($element): bool
29 {
30 if ($this->contains($element)) {
31 return \false;
32 }
33 return parent::add($element);
34 }
35 /**
36 * @inheritDoc
37 */
38 public function offsetSet($offset, $value): void
39 {
40 if ($this->contains($value)) {
41 return;
42 }
43 parent::offsetSet($offset, $value);
44 }
45 }
46