-
Notifications
You must be signed in to change notification settings - Fork 2
/
Element.php
64 lines (55 loc) · 1.83 KB
/
Element.php
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
<?php
namespace Qmaker\Linq\Operation;
interface Element
{
/**
* Returns the element at a specified index in a collection
* @param int $position
* @throws \OutOfRangeException
*/
function elementAt($position);
/**
* Returns the element at a specified index in a collection or a default value if the index is out of range
* @param int $position
* @param mixed $default
* @return mixed
* @throws \OutOfRangeException
*/
function elementAtOrDefault($position, $default = null);
/**
* Returns the first element of a collection, or the first element that satisfies a condition
* @return mixed
*/
function first();
/**
* Returns the first element of a collection, or the first element that satisfies a condition. Returns a default
* value if no such element exists
* @param mixed $default
* @return mixed
*/
function firstOrDefault($default = null);
/**
* Returns the last element of a collection, or the last element that satisfies a condition
* @return mixed
*/
function last();
/**
* Returns the last element of a collection, or the last element that satisfies a condition. Returns a default value
* if no such element exists
* @param mixed $default
* @return mixed
*/
function lastOrDefault($default = null);
/**
* Returns the only element of a collection, or the only element that satisfies a condition
* @return mixed
*/
function single();
/**
* Returns the only element of a collection, or the only element that satisfies a condition. Returns a default value
* if no such element exists or the collection does not contain exactly one element
* @param mixed $default
* @return mixed
*/
function singleOrDefault($default = null);
}