Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3/**
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; under version 2
7 * of the License (non-upgradable).
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17 *
18 * Copyright (c) 2016 (original work) Open Assessment Technologies SA ;
19 */
20
21/**
22 * @author Jean-Sébastien Conan <jean-sebastien.conan@vesperiagroup.com>
23 */
24
25namespace oat\taoTests\models\runner\time;
26
27/**
28 * Interface TimeLine
29 *
30 * Describes the API needed to build and manage a time line.
31 * A TimeLine is represented by a list of TimePoint.
32 * These TimePoint represents the bounds of time ranges.
33 * Each time range must be represented by two TimePoint: START and END.
34 *
35 * @package oat\taoTests\models\runner\time
36 */
37interface TimeLine
38{
39    /**
40     * Gets the list of TimePoint present in the TimeLine
41     * @return array
42     */
43    public function getPoints();
44
45    /**
46     * Adds another TimePoint inside the TimeLine
47     * @param TimePoint $point
48     * @return TimeLine
49     */
50    public function add(TimePoint $point);
51
52    /**
53     * Removes all TimePoint corresponding to the provided criteria
54     * @param string|array $tag A tag or a list of tags to filter
55     * @param int $target The type of target TimePoint to filter
56     * @param int $type The type of TimePoint to filter
57     * @return int Returns the number of removed TimePoints
58     */
59    public function remove($tag, $target = TimePoint::TARGET_ALL, $type = TimePoint::TYPE_ALL);
60
61    /**
62     * Clears the TimeLine from all its TimePoint
63     * @return TimeLine
64     */
65    public function clear();
66
67    /**
68     * Gets a filtered TimeLine, containing the TimePoint corresponding to the provided criteria
69     * @param string|array $tag A tag or a list of tags to filter
70     * @param int $target The type of target TimePoint to filter
71     * @param int $type The type of TimePoint to filter
72     * @return TimeLine Returns a subset corresponding to the found TimePoints
73     */
74    public function filter($tag = null, $target = TimePoint::TARGET_ALL, $type = TimePoint::TYPE_ALL);
75
76    /**
77     * Finds all TimePoint corresponding to the provided criteria
78     * @param string|array $tag A tag or a list of tags to filter
79     * @param int $target The type of target TimePoint to filter
80     * @param int $type The type of TimePoint to filter
81     * @return array Returns a list of the found TimePoints
82     */
83    public function find($tag = null, $target = TimePoint::TARGET_ALL, $type = TimePoint::TYPE_ALL);
84
85    /**
86     * Computes the total duration represented by the filtered TimePoints
87     * @param string|array $tag A tag or a list of tags to filter
88     * @param int $target The type of target TimePoint to filter
89     * @param int $lastTimestamp An optional timestamp that will be utilized to close the last open range, if any
90     * @return float Returns the total computed duration
91     * @throws TimeException
92     */
93    public function compute($tag = null, $target = TimePoint::TARGET_ALL, $lastTimestamp = 0);
94}