1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* Jasper report integration for PHP |
7
|
|
|
* |
8
|
|
|
* @link https://github.com/belgattitude/soluble-jasper |
9
|
|
|
* @author Vanvelthem Sébastien |
10
|
|
|
* @copyright Copyright (c) 2017 Vanvelthem Sébastien |
11
|
|
|
* @license MIT |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace Soluble\Jasper\Proxy\Engine; |
15
|
|
|
|
16
|
|
|
use Soluble\Japha\Bridge\Adapter as BridgeAdapter; |
17
|
|
|
use Soluble\Japha\Interfaces\JavaObject; |
18
|
|
|
use Soluble\Jasper\Proxy\RemoteJavaObjectProxyInterface; |
19
|
|
|
use Soluble\Jasper\Report; |
20
|
|
|
|
21
|
|
|
class JasperReport implements RemoteJavaObjectProxyInterface |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* @var BridgeAdapter |
25
|
|
|
*/ |
26
|
|
|
private $ba; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @var JavaObject Java('net.sf.jasperreports.engine.JasperReport') |
30
|
|
|
*/ |
31
|
|
|
private $jasperReport; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @var Report |
35
|
|
|
*/ |
36
|
|
|
private $report; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @param JavaObject $jasperReport Java('net.sf.jasperreports.engine.JasperReport') |
40
|
|
|
* @param Report $report original report |
41
|
|
|
*/ |
42
|
12 |
|
public function __construct(BridgeAdapter $bridgeAdapter, JavaObject $jasperReport, Report $report) |
43
|
|
|
{ |
44
|
12 |
|
$this->ba = $bridgeAdapter; |
|
|
|
|
45
|
12 |
|
$this->jasperReport = $jasperReport; |
46
|
12 |
|
$this->report = $report; |
|
|
|
|
47
|
12 |
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Return original report. |
51
|
|
|
*/ |
52
|
9 |
|
public function getReport(): Report |
53
|
|
|
{ |
54
|
9 |
|
return $this->report; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @return mixed |
59
|
|
|
*/ |
60
|
1 |
|
public function getProperty(string $name) |
61
|
|
|
{ |
62
|
1 |
|
return $this->jasperReport->getProperty($name); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @param mixed $value |
67
|
|
|
*/ |
68
|
1 |
|
public function setProperty(string $name, $value): void |
69
|
|
|
{ |
70
|
1 |
|
$this->jasperReport->setProperty($name, $value); |
71
|
1 |
|
} |
72
|
|
|
|
73
|
1 |
|
public function removeProperty(string $name): void |
74
|
|
|
{ |
75
|
1 |
|
$this->jasperReport->removeProperty($name); |
76
|
1 |
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @return string[] |
80
|
|
|
*/ |
81
|
1 |
|
public function getPropertyNames(): array |
82
|
|
|
{ |
83
|
1 |
|
return $this->ba->values($this->jasperReport->getPropertyNames()); |
84
|
|
|
} |
85
|
|
|
|
86
|
1 |
|
public function getResourceBundle(): ?string |
87
|
|
|
{ |
88
|
1 |
|
return $this->jasperReport->getResourceBundle(); |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @return JavaObject Java('net.sf.jasperreports.engine.JasperReport') |
93
|
|
|
*/ |
94
|
10 |
|
public function getJavaProxiedObject(): JavaObject |
95
|
|
|
{ |
96
|
10 |
|
return $this->jasperReport; |
97
|
|
|
} |
98
|
|
|
} |
99
|
|
|
|
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.