JavaClass   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 8
c 2
b 1
f 0
dl 0
loc 34
ccs 11
cts 11
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getClass() 0 3 1
A getName() 0 3 1
A __construct() 0 9 1
1
<?php
2
3
declare(strict_types=1);
4
/**
5
 * soluble-japha / PHPJavaBridge driver client.
6
 *
7
 * Refactored version of phpjababridge's Java.inc file compatible
8
 * with php java bridge 6.2
9
 *
10
 *
11
 * @credits   http://php-java-bridge.sourceforge.net/pjb/
12
 *
13
 * @see      http://github.com/belgattitude/soluble-japha
14
 *
15
 * @author Jost Boekemeier
16
 * @author Vanvelthem Sébastien (refactoring and fixes from original implementation)
17
 * @license   MIT
18
 *
19
 * The MIT License (MIT)
20
 * Copyright (c) 2014-2017 Jost Boekemeier
21
 * Permission is hereby granted, free of charge, to any person obtaining a copy
22
 * of this software and associated documentation files (the "Software"), to deal
23
 * in the Software without restriction, including without limitation the rights
24
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
25
 * copies of the Software, and to permit persons to whom the Software is
26
 * furnished to do so, subject to the following conditions:
27
 *
28
 * The above copyright notice and this permission notice shall be included in
29
 * all copies or substantial portions of the Software.
30
 *
31
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
34
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
36
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
37
 * THE SOFTWARE.
38
 */
39
40
namespace Soluble\Japha\Bridge\Driver\Pjb62;
41
42
use Soluble\Japha\Interfaces;
43
44
/**
45
 * @method \Soluble\Japha\Interfaces\JavaObject forName(string $name)
46
 */
47
class JavaClass extends Java implements Interfaces\JavaClass
48
{
49
    /**
50
     * JavaClass constructor.
51
     *
52
     * @param string $name Java FQCN
53
     */
54 25
    public function __construct(string $name)
55
    {
56 25
        $this->__client = PjbProxyClient::getInstance()->getClient();
57
58 24
        $args = []; // no arguments for JavaClass
59 24
        $this->__delegate = $this->__client->referenceObject($name, $args);
60
61 19
        $this->__java = $this->__delegate->__java;
62 19
        $this->__signature = $this->__delegate->__signature;
63 19
    }
64
65
    /**
66
     * @return Interfaces\JavaClass Java('java.lang.Class')
67
     */
68 2
    public function getClass(): Interfaces\JavaObject
69
    {
70 2
        return $this->__delegate->getClass();
0 ignored issues
show
Bug introduced by
The method getClass() does not exist on Soluble\Japha\Bridge\Driver\Pjb62\JavaType. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

70
        return $this->__delegate->/** @scrutinizer ignore-call */ getClass();
Loading history...
71
    }
72
73
    /**
74
     * Return class name.
75
     *
76
     * @return string java class name as string
77
     */
78 2
    public function getName(): string
79
    {
80 2
        return (string) $this->__delegate->getName();
0 ignored issues
show
Bug introduced by
The method getName() does not exist on Soluble\Japha\Bridge\Driver\Pjb62\JavaType. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

80
        return (string) $this->__delegate->/** @scrutinizer ignore-call */ getName();
Loading history...
81
    }
82
}
83