OcrJob::jsonSerialize()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 15
c 0
b 0
f 0
ccs 12
cts 12
cp 1
rs 9.7666
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
/**
4
 * Nextcloud - OCR
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
namespace OCA\Ocr\Db;
12
13
use OCP\AppFramework\Db\Entity;
14
use JsonSerializable;
15
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
 * @method boolean getReplace()
39
 * @method void setReplace(boolean $replace)
40
 */
41
class OcrJob extends Entity implements JsonSerializable {
42
43
    /**
44
     *
45
     * @var string
46
     */
47
    protected $status;
48
49
    /**
50
     *
51
     * @var string
52
     */
53
    protected $source;
54
55
    /**
56
     *
57
     * @var string
58
     */
59
    protected $target;
60
61
    /**
62
     *
63
     * @var string
64
     */
65
    protected $tempFile;
66
67
    /**
68
     *
69
     * @var string
70
     */
71
    protected $type;
72
73
    /**
74
     *
75
     * @var string
76
     */
77
    protected $userId;
78
79
    /**
80
     *
81
     * @var boolean
82
     */
83
    protected $errorDisplayed;
84
85
    /**
86
     *
87
     * @var string
88
     */
89
    protected $originalFilename;
90
91
    /**
92
     *
93
     * @var string
94
     */
95
    protected $errorLog;
96
    
97
    /**
98
     * 
99
     * @var boolean
100
     */
101
    protected $replace;
102
103
    /**
104
     * OcrJob constructor.
105
     * 
106
     * @param string $status            
107
     * @param string $source            
108
     * @param string $target            
109
     * @param string $tempFile            
110
     * @param string $type            
111
     * @param string $userId            
112
     * @param boolean $errorDisplayed            
113
     * @param string $originalFilename            
114
     * @param string $errorLog  
115
     * @param boolean $replace          
116
     */
117 21
    public function __construct($status = null, $source = null, $target = null, $tempFile = null, $type = null, $userId = null, 
118
            $errorDisplayed = null, $originalFilename = null, $errorLog = null, $replace = null) {
119 21
        $this->setStatus($status);
120 21
        $this->setSource($source);
121 21
        $this->setTarget($target);
122 21
        $this->setTempFile($tempFile);
123 21
        $this->setType($type);
124 21
        $this->setUserId($userId);
125 21
        $this->setErrorDisplayed($errorDisplayed);
126 21
        $this->setOriginalFilename($originalFilename);
127 21
        $this->setErrorLog($errorLog);
128 21
        $this->setReplace($replace);
129 21
    }
130
131
    /**
132
     * Specify data which should be serialized to JSON
133
     * 
134
     * @link http://php.net/manual/en/jsonserializable.jsonserialize.php
135
     * @return mixed data which can be serialized by <b>json_encode</b>,
136
     *         which is a value of any type other than a resource.
137
     * @since 5.4.0
138
     */
139 2
    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...
140
        return [
141 2
                'id' => $this->id,
142 2
                'status' => $this->status,
143 2
                'source' => $this->source,
144 2
                'target' => $this->target,
145 2
                'tempFile' => $this->tempFile,
146 2
                'type' => $this->type,
147 2
                'userId' => $this->userId,
148 2
                'errorDisplayed' => $this->errorDisplayed,
149 2
                'originalFilename' => $this->originalFilename,
150 2
                'errorLog' => $this->errorLog,
151 2
                'replace' => $this->replace
152
        ];
153
    }
154
}