Completed
Push — master ( f2b8d7...c7becd )
by Roeland
11:44 queued 10:17
created

Wopi::isTemplateToken()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 6
1
<?php
2
/**
3
 * @copyright 2018, Roeland Jago Douma <[email protected]>
4
 *
5
 * @author Roeland Jago Douma <[email protected]>
6
 *
7
 * @license GNU AGPL version 3 or any later version
8
 *
9
 * This program is free software: you can redistribute it and/or modify
10
 * it under the terms of the GNU Affero General Public License as
11
 * published by the Free Software Foundation, either version 3 of the
12
 * License, or (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU Affero General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU Affero General Public License
20
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
 *
22
 */
23
namespace OCA\Richdocuments\Db;
24
25
use OCP\AppFramework\Db\Entity;
26
27
/**
28
 * Class WopiEntity
29
 *
30
 * @package OCA\Richdocuments\Db
31
 *
32
 * @method void setOwnerUid(string $uid)
33
 * @method string getOwnerUid()
34
 * @method void setEditorUid(string $uid)
35
 * @method string getEditorUid()
36
 * @method void setFileid(int $fileid)
37
 * @method int getFileid()
38
 * @method void setVersion(int $version)
39
 * @method int getVersion()
40
 * @method void setCanwrite(bool $canwrite)
41
 * @method bool getCanwrite()
42
 * @method void setServerHost(string $host)
43
 * @method string getServerHost()
44
 * @method void setToken(string $token)
45
 * @method string getToken()
46
 * @method void setExpiry(int $expiry)
47
 * @method int getExpiry()
48
 * @method void setGuestDisplayname(string $token)
49
 * @method string getGuestDisplayname()
50
 * @method void setTemplateDestination(int $fileId)
51
 * @method int getTemplateDestination()
52
 */
53
class Wopi extends Entity {
54
	/** @var string */
55
	protected $ownerUid;
56
57
	/** @var string */
58
	protected $editorUid;
59
60
	/** @var int */
61
	protected $fileid;
62
63
	/** @var int */
64
	protected $version;
65
66
	/** @var bool */
67
	protected $canwrite;
68
69
	/** @var string */
70
	protected $serverHost;
71
72
	/** @var string */
73
	protected $token;
74
75
	/** @var int */
76
	protected $expiry;
77
78
	/** @var string */
79
	protected $guestDisplayname;
80
81
	/** @var int */
82
	protected $templateDestination;
83
84
	public function __construct() {
85
		$this->addType('owner_uid', 'string');
86
		$this->addType('editor_uid', 'string');
87
		$this->addType('fileid', 'int');
88
		$this->addType('version', 'int');
89
		$this->addType('canwrite', 'bool');
90
		$this->addType('server_host', 'string');
91
		$this->addType('token', 'string');
92
		$this->addType('expiry', 'int');
93
		$this->addType('guest_displayname', 'string');
94
		$this->addType('templateDestination', 'int');
95
	}
96
97
	public function isTemplateToken() {
98
		return $this->getTemplateDestination() !== 0 && $this->getTemplateDestination() !== null;
99
	}
100
101
}
102