PHP - tarea

 
Vista:
sin imagen de perfil

tarea

Publicado por angel (1 intervención) el 20/09/2019 05:25:47
estimados me dejajaron una tarea para completar las clases donde sale @todo alguien q me pueda dar una mano

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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
 
/**
 * Class Schedule
 */
class Schedule implements Iterator, Countable {
    /**
     * @var array
     */
    private $timeslots;
 
    /**
     *
     */
    public function __construct()
    {
        $this->timeslots = array();
    }
 
    /**
     * @param Timeslot $timeslot
     * @return $this
     */
    public function addTimeslot(Timeslot $timeslot)
    {
        if (!$this->overlaps($timeslot)) {
            $this->timeslots[] = $timeslot;
        }
 
        $this->sortByStartTime();
    }
 
    /**
     * Sort slots by starting time
     */
    private function sortByStartTime()
    {
        usort($this->timeslots, function () {
            /**
             * @TODO: Implementation
             */
        });
    }
 
    /**
     * @param Timeslot $timeslot
     * @return bool
     */
    public function overlaps(Timeslot $timeslot)
    {
        foreach ($this->timeslots as $existingSlot) {
            if ($timeslot->overlaps($existingSlot)) {
                return true;
            }
        }
 
        return false;
    }
 
    /**
     * @return int
     */
    public function count()
    {
        /**
         * @TODO: Implementation
         */
    }
 
    /**
     * @return void
     */
    function rewind()
    {
        /**
         * @TODO: Implementation
         */
    }
 
    /**
     * @return mixed
     */
    function current()
    {
        /**
         * @TODO: Implementation
         */
    }
 
    /**
     * @return mixed
     */
    function key()
    {
        /**
         * @TODO: Implementation
         */
    }
 
    /**
     * @return void
     */
    function next()
    {
        /**
         * @TODO: Implementation
         */
    }
 
    /**
     * @return bool
     */
    function valid() {
        /**
         * @TODO: Implementation
         */
    }
}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
-2
Responder