Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
6 / 6
CRAP
100.00% covered (success)
100.00%
1 / 1
Revision
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
6 / 6
6
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
1
 getResourceId
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getVersion
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getMessage
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getDateCreated
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getAuthorId
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
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) 2015 (original work) Open Assessment Technologies SA;
19 *
20 *
21 */
22
23namespace oat\taoRevision\model;
24
25/**
26 * A revision of a resource
27 *
28 * @author Joel Bout <joel@taotesting.com>
29 */
30final class Revision
31{
32    /** @var string Resource Identifier */
33    private $resourceId;
34
35    /** @var int Version number of the resource */
36    private $version;
37
38    /** @var int Creation date of the revision in UNIX timestamp */
39    private $created;
40
41    /** @var string User who created the revision */
42    private $author;
43
44    /** @var string Commit message */
45    private $message;
46
47    public function __construct(string $resourceId, int $version, int $created, string $author, string $message)
48    {
49        $this->resourceId = $resourceId;
50        $this->version = $version;
51        $this->created = $created;
52        $this->author = $author;
53        $this->message = $message;
54    }
55
56    /**
57     * Returns the revisioned resource identifier
58     * @return string
59     */
60    public function getResourceId()
61    {
62        return $this->resourceId;
63    }
64
65    /**
66     * Returns the version of the revision
67     * @return int
68     */
69    public function getVersion()
70    {
71        return $this->version;
72    }
73
74    /**
75     * Returns the message associated with the revision
76     * @return string
77     */
78    public function getMessage()
79    {
80        return $this->message;
81    }
82
83    /**
84     * Returns the creation date as epoch timestamp
85     * @return int
86     */
87    public function getDateCreated()
88    {
89        return $this->created;
90    }
91
92    /**
93     * Returns the identifier of the user that created
94     * the revision
95     * @return string
96     */
97    public function getAuthorId()
98    {
99        return $this->author;
100    }
101}