|
1
|
|
|
<?php |
|
2
|
|
|
namespace src; |
|
3
|
|
|
|
|
4
|
|
|
use src\{Trabajador,IdDeTrabajador}; |
|
|
|
|
|
|
5
|
|
|
|
|
6
|
|
|
class TrabajadorConId |
|
7
|
|
|
{ |
|
8
|
|
|
public $_trabajador; |
|
9
|
|
|
|
|
10
|
|
|
public $_idDeTrabajador; |
|
11
|
|
|
|
|
12
|
|
|
public function __construct(Trabajador $Trabajador, IdDeTrabajador $IdDeTrabajador) |
|
13
|
|
|
{ |
|
14
|
|
|
$this->_trabajador = $Trabajador; |
|
15
|
|
|
$this->_idDeTrabajador = $IdDeTrabajador; |
|
16
|
|
|
} |
|
17
|
|
|
|
|
18
|
|
|
public function idDeTrabajador(): string |
|
19
|
|
|
{ |
|
20
|
|
|
return $this->_idDeTrabajador->idDeTrabajador(); |
|
21
|
|
|
} |
|
22
|
|
|
|
|
23
|
|
|
public function sexo(): string |
|
24
|
|
|
{ |
|
25
|
|
|
return $this->_trabajador->sexo(); |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
public function edad(): int |
|
29
|
|
|
{ |
|
30
|
|
|
return $this->_trabajador->edad(); |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
public function rangoDeEdad(): string |
|
34
|
|
|
{ |
|
35
|
|
|
return $this->_trabajador->rangoDeEdad(); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
public function estadoCivil(): string |
|
39
|
|
|
{ |
|
40
|
|
|
return $this->_trabajador->estadoCivil(); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
public function nivelDeEstudios(): string |
|
44
|
|
|
{ |
|
45
|
|
|
return $this->_trabajador->nivelDeEstudios(); |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
public function ocupacion(): string |
|
49
|
|
|
{ |
|
50
|
|
|
return $this->_trabajador->ocupacion(); |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
public function departamento(): string |
|
54
|
|
|
{ |
|
55
|
|
|
return $this->_trabajador->departamento(); |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
public function tipoDePuesto(): string |
|
59
|
|
|
{ |
|
60
|
|
|
return $this->_trabajador->tipoDePuesto(); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
public function tipoDeContratacion(): string |
|
64
|
|
|
{ |
|
65
|
|
|
return $this->_trabajador->tipoDeContratacion(); |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
public function tipoDePersonal(): string |
|
69
|
|
|
{ |
|
70
|
|
|
return $this->_trabajador->tipoDePersonal(); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
public function tipoDeJornada(): string |
|
74
|
|
|
{ |
|
75
|
|
|
return $this->_trabajador->tipoDeJornada(); |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
public function realizaRotacion(): string |
|
79
|
|
|
{ |
|
80
|
|
|
return $this->_trabajador->realizaRotacion(); |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
public function rangoTiempoenPuesto(): string |
|
84
|
|
|
{ |
|
85
|
|
|
return $this->_trabajador->rangoTiempoenPuesto(); |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
public function rangoExperienciaLaboral(): string |
|
89
|
|
|
{ |
|
90
|
|
|
return $this->_trabajador->rangoExperienciaLaboral(); |
|
91
|
|
|
} |
|
92
|
|
|
} |
Let?s assume that you have a directory layout like this:
. |-- OtherDir | |-- Bar.php | `-- Foo.php `-- SomeDir `-- Foo.phpand let?s assume the following content of
Bar.php:If both files
OtherDir/Foo.phpandSomeDir/Foo.phpare loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.phpHowever, as
OtherDir/Foo.phpdoes not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: