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

OcrJob::jsonSerialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 13
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 10
nc 1
nop 0
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
 */
35
class OcrJob extends Entity implements JsonSerializable {
36
37
	/**
38
	 * @var string
39
	 */
40
	protected $status;
41
42
	/**
43
	 * @var string
44
	 */
45
	protected $source;
46
47
	/**
48
	 * @var string
49
	 */
50
	protected $target;
51
52
	/**
53
	 * @var string
54
	 */
55
	protected $tempFile;
56
57
	/**
58
	 * @var string
59
	 */
60
	protected $type;
61
62
	/**
63
	 * @var string
64
	 */
65
	protected $userId;
66
67
68
	/**
69
	 * @var boolean
70
	 */
71
	protected $errorDisplayed;
72
73
	/**
74
	 * OcrJob constructor.
75
	 *
76
	 * @param string $status
77
	 * @param string $source
78
	 * @param string $target
79
	 * @param null $tempFile
80
	 * @param string $type
81
	 * @param null $userId
82
	 * @param boolean $errorDisplayed
83
	 */
84
	public function __construct($status = null, $source = null, $target = null, $tempFile = null, $type = null, $userId = null, $errorDisplayed = null) {
85
		$this->setStatus($status);
86
		$this->setSource($source);
87
		$this->setTarget($target);
88
		$this->setTempFile($tempFile);
89
		$this->setType($type);
90
		$this->setUserId($userId);
91
		$this->setErrorDisplayed($errorDisplayed);
92
	}
93
94
	/**
95
	 * Specify data which should be serialized to JSON
96
	 * @link http://php.net/manual/en/jsonserializable.jsonserialize.php
97
	 * @return mixed data which can be serialized by <b>json_encode</b>,
98
	 * which is a value of any type other than a resource.
99
	 * @since 5.4.0
100
	 */
101
	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...
102
	{
103
		return [
104
			'id' => $this->id,
105
			'status' => $this->status,
106
			'source' => $this->source,
107
			'target' => $this->target,
108
			'tempFile' => $this->tempFile,
109
			'type' => $this->type,
110
			'userId' => $this->userId,
111
			'errorDisplayed' => $this->errorDisplayed
112
		];
113
	}
114
}