Completed
Pull Request — master (#7)
by
unknown
02:06
created

Queue::poll()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
/**
3
 * This file is part of the ramsey/collection library
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * @copyright Copyright (c) Ben Ramsey <[email protected]>
9
 * @license http://opensource.org/licenses/MIT MIT
10
 * @link https://benramsey.com/projects/ramsey-collection/ Documentation
11
 * @link https://packagist.org/packages/ramsey/collection Packagist
12
 * @link https://github.com/ramsey/collection GitHub
13
 */
14
15
namespace Ramsey\Collection;
16
17
class Queue extends AbstractArray implements QueueInterface
18
{
19
20
    /**
21
     * Ensures that this queue contains the specified element (optional
22
     * operation). Returns true if this queue changed as a result of the
23
     * call. (Returns false if this queue does not permit duplicates and
24
     * already contains the specified element.)
25
     *
26
     * Queues that support this operation may place limitations on what
27
     * elements may be added to this queue. In particular, some
28
     * queues will refuse to add null elements, and others will impose
29
     * restrictions on the type of elements that may be added. Queue
30
     * classes should clearly specify in their documentation any restrictions
31
     * on what elements may be added.
32
     *
33
     * If a queue refuses to add a particular element for any reason other
34
     * than that it already contains the element, it must throw an exception
35
     * (rather than returning false). This preserves the invariant that a
36
     * queue always contains the specified element after this call returns.
37
     *
38
     * @param mixed $element
39
     * @return bool true if this queue changed as a result of the call
40
     */
41
    public function add($element)
42
    {
43
        // TODO: Implement add() method.
44
    }
45
46
    /**
47
     * Retrieves, but does not remove, the head of this queue. This method
48
     * differs from peek only in that it throws an exception if this queue is empty.
49
     *
50
     * @return mixed the head of this queue
51
     * @throws \Ramsey\Collection\Exception\NoSuchElementException
52
     */
53
    public function element()
54
    {
55
        // TODO: Implement element() method.
56
    }
57
58
    /**
59
     * Inserts the specified element into this queue if it is possible to do so
60
     * immediately without violating capacity restrictions. When using a
61
     * capacity-restricted queue, this method is generally preferable to add(E),
62
     * which can fail to insert an element only by throwing an exception.
63
     *
64
     * @param $element
65
     * @return mixed true if the element was added to this queue, else false
66
     */
67
    public function offer($element)
68
    {
69
        // TODO: Implement offer() method.
70
    }
71
72
    /**
73
     * Retrieves, but does not remove, the head of this queue, or returns null
74
     * if this queue is empty.
75
     *
76
     * @return mixed the head of this queue, or null if this queue is empty
77
     */
78
    public function peek()
79
    {
80
        // TODO: Implement peek() method.
81
    }
82
83
    /**
84
     * Retrieves and removes the head of this queue, or returns null
85
     * if this queue is empty.
86
     *
87
     * @return mixed the head of this queue, or null if this queue is empty
88
     */
89
    public function poll()
90
    {
91
        // TODO: Implement poll() method.
92
    }
93
94
    /**
95
     * Retrieves and removes the head of this queue. This method differs
96
     * from poll only in that it throws an
97
     * exception if this queue is empty.
98
     *
99
     * @return mixed the head of this queue
100
     * @throws \Ramsey\Collection\Exception\NoSuchElementException
101
     */
102
    public function remove()
103
    {
104
        // TODO: Implement remove() method.
105
    }
106
107
    /**
108
     * Returns the type associated with this collection
109
     *
110
     * @return string
111
     */
112
    public function getType()
113
    {
114
        // TODO: Implement getType() method.
115
    }
116
}
117