CollectionInterface::sortOn()
last analyzed

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 1
ccs 0
cts 0
cp 0
c 0
b 0
f 0
1
<?php
2
/*
3
 * This file is part of Graze DataStructure
4
 *
5
 * Copyright (c) 2014 Nature Delivered Ltd. <http://graze.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @see  http://github.com/graze/data-structure/blob/master/LICENSE
11
 * @link http://github.com/graze/data-structure
12
 */
13
14
namespace Graze\DataStructure\Collection;
15
16
use Countable;
17
use Graze\Sort;
18
use IteratorAggregate;
19
20
interface CollectionInterface extends Countable, IteratorAggregate
21
{
22
    /**
23
     * @param mixed $value
24
     *
25
     * @return CollectionInterface
26
     */
27
    public function add($value);
28
29
    /**
30
     * @param mixed $value
31
     *
32
     * @return bool
33
     */
34
    public function contains($value);
35
36
    /**
37
     * return array.
38
     */
39
    public function getAll();
0 ignored issues
show
Documentation introduced by
For interfaces and abstract methods it is generally a good practice to add a @return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.

For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a @return doc comment to communicate to implementors of these methods what they are expected to return.

Loading history...
40
41
    /**
42
     * @param callable $fn
43
     *
44
     * @return CollectionInterface
45
     */
46
    public function filter(callable $fn);
47
48
    /**
49
     * @param callable $fn
50
     *
51
     * @return mixed[]
52
     */
53
    public function map(callable $fn);
54
55
    /**
56
     * @param callable $fn
57
     * @param mixed $initial
58
     *
59
     * @return mixed
60
     */
61
    public function reduce(callable $fn, $initial = null);
62
63
    /**
64
     * @link http://php.net/manual/en/function.usort.php
65
     *
66
     * @param callable $fn
67
     *
68
     * @return CollectionInterface
69
     */
70
    public function sort(callable $fn);
71
72
    /**
73
     * @param callable $fn
74
     * @param int $order
75
     *
76
     * @return CollectionInterface
77
     */
78
    public function sortOn(callable $fn, $order = Sort\ASC);
79
}
80