Completed
Push — master ( b3758e...d24b37 )
by Sébastien
04:19
created

JasperReport   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 76
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 8
dl 0
loc 76
c 0
b 0
f 0
ccs 21
cts 21
cp 1
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A getProperty() 0 3 1
A getResourceBundle() 0 3 1
A getReport() 0 3 1
A getPropertyNames() 0 3 1
A removeProperty() 0 3 1
A setProperty() 0 3 1
A getJavaProxiedObject() 0 3 1
A __construct() 0 5 1
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;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 11 spaces but found 1 space

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

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
45 12
        $this->jasperReport = $jasperReport;
46 12
        $this->report = $report;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space

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

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
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