Completed
Pull Request — master (#93)
by Janis
14:36
created

OcrJob   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 98
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 98
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 1
A jsonSerialize() 0 15 1
1
<?php
2
/**
3
 * Nextcloud - OCR
4
 *
5
 * This file is licensed under the Affero General Public License version 3 or
6
 * later. See the COPYING file.
7
 *
8
 * @author Janis Koehr <[email protected]>
9
 * @copyright Janis Koehr 2017
10
 */
11
12
namespace OCA\Ocr\Db;
13
14
use OCP\AppFramework\Db\Entity;
15
use JsonSerializable;
16
17
/**
18
 * Class to represent a ocr job.
19
 *
20
 * @method string getStatus()
21
 * @method void setStatus(string $status)
22
 * @method string getSource()
23
 * @method void setSource(integer $source)
24
 * @method string getTarget()
25
 * @method void setTarget(string $target)
26
 * @method string getTempFile()
27
 * @method void setTempFile(string $tempFile)
28
 * @method string getType()
29
 * @method void setType(string $type)
30
 * @method string getUserId()
31
 * @method void setUserId(string $userId)
32
 * @method boolean getErrorDisplayed()
33
 * @method void setErrorDisplayed(boolean $errorDisplayed)
34
 * @method void setOriginalFilename(string $originalFilename)
35
 * @method string getOriginalFilename()
36
 * @method void setErrorLog(string $errorLog)
37
 * @method string getErrorLog()
38
 */
39
class OcrJob extends Entity implements JsonSerializable {
40
41
	/**
42
	 * @var string
43
	 */
44
	protected $status;
45
46
	/**
47
	 * @var string
48
	 */
49
	protected $source;
50
51
	/**
52
	 * @var string
53
	 */
54
	protected $target;
55
56
	/**
57
	 * @var string
58
	 */
59
	protected $tempFile;
60
61
	/**
62
	 * @var string
63
	 */
64
	protected $type;
65
66
	/**
67
	 * @var string
68
	 */
69
	protected $userId;
70
71
72
	/**
73
	 * @var boolean
74
	 */
75
	protected $errorDisplayed;
76
	
77
	/**
78
	 * 
79
	 * @var string
80
	 */
81
	protected $originalFilename;
82
	
83
	/**
84
	 * 
85
	 * @var string
86
	 */
87
	protected $errorLog;
88
89
	/**
90
	 * OcrJob constructor.
91
	 *
92
	 * @param string $status
93
	 * @param string $source
94
	 * @param string $target
95
	 * @param string $tempFile
96
	 * @param string $type
97
	 * @param string $userId
98
	 * @param boolean $errorDisplayed
99
	 * @param string $originalFilename
100
	 * @param string $errorLog
101
	 */
102
	public function __construct($status = null, $source = null, $target = null, $tempFile = null, $type = null, $userId = null, $errorDisplayed = null, $originalFilename = null, $errorLog= null) {
103
		$this->setStatus($status);
104
		$this->setSource($source);
105
		$this->setTarget($target);
106
		$this->setTempFile($tempFile);
107
		$this->setType($type);
108
		$this->setUserId($userId);
109
		$this->setErrorDisplayed($errorDisplayed);
110
		$this->setOriginalFilename($originalFilename);
111
		$this->setErrorLog($errorLog);
112
	}
113
114
	/**
115
	 * Specify data which should be serialized to JSON
116
	 * @link http://php.net/manual/en/jsonserializable.jsonserialize.php
117
	 * @return mixed data which can be serialized by <b>json_encode</b>,
118
	 * which is a value of any type other than a resource.
119
	 * @since 5.4.0
120
	 */
121
	function jsonSerialize()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
122
	{
123
		return [
124
			'id' => $this->id,
125
			'status' => $this->status,
126
			'source' => $this->source,
127
			'target' => $this->target,
128
			'tempFile' => $this->tempFile,
129
			'type' => $this->type,
130
			'userId' => $this->userId,
131
			'errorDisplayed' => $this->errorDisplayed,
132
			'originalFilename' => $this->originalFilename,
133
			'errorLog' => $this->errorLog
134
		];
135
	}
136
}