Completed
Push — master ( 194a08...1a7130 )
by Bernhard
9s
created

Clipping::canStartTask()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/**
4
 * \Wicked\Timely\Entities\Clipping
5
 *
6
 * NOTICE OF LICENSE
7
 *
8
 * This source file is subject to the Open Software License (OSL 3.0)
9
 * that is available through the world-wide-web at this URL:
10
 * http://opensource.org/licenses/osl-3.0.php
11
 *
12
 * PHP version 5
13
 *
14
 * @author    Bernhard Wick <[email protected]>
15
 * @copyright 2016 Bernhard Wick
16
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
 * @link      https://github.com/wick-ed/timely
18
 */
19
20
namespace Wicked\Timely\Entities;
21
22
/**
23
 * Clipping entity
24
 * A special type of booking which acts as a boundary for tasks which stretch over the time period shown to the user
25
 *
26
 * @author    Bernhard Wick <[email protected]>
27
 * @copyright 2016 Bernhard Wick
28
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
29
 * @link      https://github.com/wick-ed/timely
30
 */
31
class Clipping extends Booking
32
{
33
34
    /**
35
     * Constant for the clipping mark tag
36
     *
37
     * @var string CLIPPING_TAG_FRONT
38
     */
39
    const CLIPPING_TAG_FRONT = '--cf--';
40
41
    /**
42
     * Constant for the clipping mark tag
43
     *
44
     * @var string CLIPPING_TAG_REAR
45
     */
46
    const CLIPPING_TAG_REAR = '--cr--';
47
48
    /**
49
     * Default constructor
50
     *
51
     * @param boolean     $clipFront Whether or not this clipping comes up front or at the end of booking list
52
     * @param null|string $time      Time of this booking
53
     */
54
    public function __construct($clipFront, $time = null)
55
    {
56
        // add the clipping tags as special meta ticket IDs
57
        $this->metaTicketIds[] = self::CLIPPING_TAG_FRONT;
58
        $this->metaTicketIds[] = self::CLIPPING_TAG_REAR;
59
60
        if ($clipFront) {
61
            parent::__construct('', self::CLIPPING_TAG_FRONT, $time);
62
        } else {
63
            parent::__construct('', self::CLIPPING_TAG_REAR, $time);
64
        }
65
    }
66
67
    /**
68
     * Whether or not this booking can be the start of a task
69
     *
70
     * @return boolean
71
     */
72
    public function canStartTask()
73
    {
74
        return false;
75
    }
76
77
    /**
78
     * Whether or not this booking can be the end of a task
79
     *
80
     * @return boolean
81
     */
82
    public function canEndTask()
83
    {
84
        return true;
85
    }
86
}
87