-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathISet.php
More file actions
89 lines (77 loc) · 2.33 KB
/
ISet.php
File metadata and controls
89 lines (77 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
/*
* Opulence
*
* @link https://www.opulencephp.com
* @copyright Copyright (C) 2021 David Young
* @license https://github.com/opulencephp/Opulence/blob/1.2/LICENSE.md
*/
namespace Opulence\Collections;
use Countable;
use IteratorAggregate;
use RuntimeException;
/**
* Defines the interface for sets to implement
*/
interface ISet extends Countable, IteratorAggregate
{
/**
* Adds a value
*
* @param mixed $value The value to add
* @throws RuntimeException Thrown if the value's key could not be calculated
*/
public function add($value) : void;
/**
* Adds a range of values
*
* @param array $values The values to add
* @throws RuntimeException Thrown if the values' keys could not be calculated
*/
public function addRange(array $values) : void;
/**
* Clears all values from the set
*/
public function clear() : void;
/**
* Gets whether or not the value exists
*
* @param mixed $value The value to search for
* @return bool True if the value exists, otherwise false
* @throws RuntimeException Thrown if the value's key could not be calculated
*/
public function containsValue($value) : bool;
/**
* Intersects the values of the input array with the values already in the set
*
* @param array $values The values to intersect with
* @throws RuntimeException Thrown if the values' keys could not be calculated
*/
public function intersect(array $values) : void;
/**
* Removes a value from the set
*
* @param mixed $value The value to remove
* @throws RuntimeException Thrown if the value's key could not be calculated
*/
public function removeValue($value) : void;
/**
* Sorts the values of the set
*
* @param callable $comparer The comparer to sort with
*/
public function sort(callable $comparer) : void;
/**
* Gets all of the values as an array
*
* @return array All of the values
*/
public function toArray() : array;
/**
* Unions the values of the input array with the values already in the set
*
* @param array $values The values to union with
* @throws RuntimeException Thrown if the values' keys could not be calculated
*/
public function union(array $values) : void;
}