|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace WsdlToPhp\PhpGenerator\Component; |
|
6
|
|
|
|
|
7
|
|
|
use WsdlToPhp\PhpGenerator\Element\PhpInterface as PhpInterfaceElement; |
|
8
|
|
|
use WsdlToPhp\PhpGenerator\Element\PhpMethod as PhpMethodElement; |
|
9
|
|
|
use WsdlToPhp\PhpGenerator\Element\PhpProperty as PhpPropertyElement; |
|
10
|
|
|
|
|
11
|
|
|
class PhpInterface extends PhpClass |
|
12
|
|
|
{ |
|
13
|
6 |
|
public function __construct(string $name, bool $abstract = false, ?string $extends = null, array $interfaces = []) |
|
14
|
|
|
{ |
|
15
|
6 |
|
$this->setMainElement(new PhpInterfaceElement($name, $abstract, $extends, $interfaces)); |
|
16
|
6 |
|
} |
|
17
|
|
|
|
|
18
|
6 |
|
public function addMethodElement(PhpMethodElement $method): self |
|
19
|
|
|
{ |
|
20
|
6 |
|
if ($method->getHasBody()) { |
|
21
|
4 |
|
$method->setHasBody(false); |
|
22
|
|
|
} |
|
23
|
|
|
|
|
24
|
6 |
|
parent::addMethodElement($method); |
|
25
|
|
|
|
|
26
|
|
|
return $this; |
|
27
|
6 |
|
} |
|
28
|
|
|
|
|
29
|
6 |
|
public function addMethod(string $name, array $parameters = [], ?string $returnType = null, string $access = PhpMethodElement::ACCESS_PUBLIC, bool $abstract = false, bool $static = false, bool $final = false, bool $hasBody = true): self |
|
30
|
|
|
{ |
|
31
|
|
|
return $this->addMethodElement(new PhpMethodElement($name, $parameters, $returnType, $access, $abstract, $static, $final, false)); |
|
32
|
6 |
|
} |
|
33
|
|
|
|
|
34
|
6 |
|
public function addPropertyElement(PhpPropertyElement $property): self |
|
35
|
|
|
{ |
|
36
|
|
|
return $this; |
|
37
|
6 |
|
} |
|
38
|
|
|
|
|
39
|
6 |
|
public function addProperty(string $name, $value = null, string $access = PhpPropertyElement::ACCESS_PUBLIC, $type = null): self |
|
40
|
|
|
{ |
|
41
|
|
|
return $this; |
|
42
|
|
|
} |
|
43
|
|
|
} |
|
44
|
|
|
|