Completed
Pull Request — master (#40)
by Janis
123:40 queued 121:18
created

OcrStatus::jsonSerialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 13
ccs 10
cts 10
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 10
nc 1
nop 0
crap 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 2016
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 status.
19
 *
20
 * @method string getStatus()
21
 * @method void setStatus(string $status)
22
 * @method integer getFileId()
23
 * @method void setFileId(integer $fileId)
24
 * @method string getNewName()
25
 * @method void setNewName(string $newName)
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 OcrStatus extends Entity implements JsonSerializable {
36
37
	/**
38
	 * @var string
39
	 */
40
	protected $status;
41
42
	/**
43
	 * @var integer
44
	 */
45
	protected $fileId;
46
47
	/**
48
	 * @var string
49
	 */
50
	protected $newName;
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
	 * OcrStatus constructor.
75
	 *
76
	 * @param null $status
77
	 * @param null $fileId
78
	 * @param null $newName
79
	 * @param null $tempFile
80
	 * @param null $type
81
	 * @param null $userId
82
	 * @param null $errorDisplayed
83
	 */
84 18
	public function __construct($status = null, $fileId = null, $newName = null, $tempFile = null, $type = null, $userId = null, $errorDisplayed = null) {
85 18
		$this->setStatus($status);
86 18
		$this->setFileId($fileId);
87 18
		$this->setNewName($newName);
88 18
		$this->setTempFile($tempFile);
89 18
		$this->setType($type);
90 18
		$this->setUserId($userId);
91 18
		$this->setErrorDisplayed($errorDisplayed);
92 18
	}
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 1
    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 1
            'id' => $this->id,
105 1
            'status' => $this->status,
106 1
            'fileId' => $this->fileId,
107 1
            'newName' => $this->newName,
108 1
            'tempFile' => $this->tempFile,
109 1
            'type' => $this->type,
110 1
            'userId' => $this->userId,
111 1
            'errorDisplayed' => $this->errorDisplayed
112 1
        ];
113
    }
114
}