-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathValidatedSpecificationFilesItem.php
More file actions
81 lines (67 loc) · 1.94 KB
/
Copy pathValidatedSpecificationFilesItem.php
File metadata and controls
81 lines (67 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
declare(strict_types=1);
namespace Helmich\Schema2Class\Spec;
class ValidatedSpecificationFilesItem
{
private string $targetNamespace;
private string $targetClass;
private string $targetDirectory;
/**
* ValidatedSpecificationFilesItem constructor.
* @param string $targetNamespace
* @param string $targetClass
* @param string $targetDirectory
*/
public function __construct(string $targetNamespace, string $targetClass, string $targetDirectory)
{
$this->targetNamespace = $targetNamespace;
$this->targetClass = $targetClass;
$this->targetDirectory = $targetDirectory;
}
public static function fromSpecificationFilesItem(SpecificationFilesItem $input, string $fallbackNamespace): ValidatedSpecificationFilesItem {
return new ValidatedSpecificationFilesItem(
$input->getTargetNamespace() ?? $fallbackNamespace,
$input->getClassName(),
$input->getTargetDirectory(),
);
}
/**
* @return string
*/
public function getTargetNamespace(): string
{
return $this->targetNamespace;
}
/**
* @return string
*/
public function getTargetClass(): string
{
return $this->targetClass;
}
/**
* @return string
*/
public function getTargetDirectory(): string
{
return $this->targetDirectory;
}
public function withTargetClass(string $targetClass): self
{
$c = clone $this;
$c->targetClass = $targetClass;
return $c;
}
public function withTargetNamespace(string $targetNamespace): self
{
$c = clone $this;
$c->targetNamespace = $targetNamespace;
return $c;
}
public function withTargetDirectory(string $targetDirectory): self
{
$c = clone $this;
$c->targetDirectory = $targetDirectory;
return $c;
}
}