| @@ -9,9 +9,9 @@ | ||
| 9 | 9 | * @copyright Copyright (c) Ben Ramsey <ben@benramsey.com> |
| 10 | 10 | * @license http://opensource.org/licenses/MIT MIT |
| 11 | 11 | */ |
| 12 | 12 | declare (strict_types=1); |
| 13 | -namespace Dudlewebs\WPMCS\Ramsey\Collection; | |
| 13 | +namespace Dudlewebs\WPMCS\GCP\Ramsey\Collection; | |
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * A set is a collection that contains no duplicate elements. |
| 17 | 17 | * |
| @@ -21,13 +21,13 @@ | ||
| 21 | 21 | * the set. |
| 22 | 22 | * |
| 23 | 23 | * Example usage: |
| 24 | 24 | * |
| 25 | - * ``` php | |
| 25 | + * ``` | |
| 26 | 26 | * $foo = new \My\Foo(); |
| 27 | 27 | * $set = new Set(\My\Foo::class); |
| 28 | 28 | * |
| 29 | - * $set->add($foo); // returns TRUE, the element don't exists | |
| 29 | + * $set->add($foo); // returns TRUE, the element doesn't exist | |
| 30 | 30 | * $set->add($foo); // returns FALSE, the element already exists |
| 31 | 31 | * |
| 32 | 32 | * $bar = new \My\Foo(); |
| 33 | 33 | * $set->add($bar); // returns TRUE, $bar !== $foo |
| @@ -38,26 +38,19 @@ | ||
| 38 | 38 | */ |
| 39 | 39 | class Set extends AbstractSet |
| 40 | 40 | { |
| 41 | 41 | /** |
| 42 | - * The type of elements stored in this set | |
| 43 | - * | |
| 44 | - * A set's type is immutable. For this reason, this property is private. | |
| 45 | - */ | |
| 46 | - private string $setType; | |
| 47 | - /** | |
| 48 | 42 | * Constructs a set object of the specified type, optionally with the |
| 49 | 43 | * specified data. |
| 50 | 44 | * |
| 51 | - * @param string $setType The type (FQCN) associated with this set. | |
| 45 | + * @param string $setType The type or class name associated with this set. | |
| 52 | 46 | * @param array<array-key, T> $data The initial items to store in the set. |
| 53 | 47 | */ |
| 54 | - public function __construct(string $setType, array $data = []) | |
| 48 | + public function __construct(private readonly string $setType, array $data = []) | |
| 55 | 49 | { |
| 56 | - $this->setType = $setType; | |
| 57 | 50 | parent::__construct($data); |
| 58 | 51 | } |
| 59 | - public function getType(): string | |
| 52 | + public function getType() : string | |
| 60 | 53 | { |
| 61 | 54 | return $this->setType; |
| 62 | 55 | } |
| 63 | 56 | } |