1 | <?php |
||
27 | abstract class AnnotationToImplementationBuilder |
||
28 | { |
||
29 | /** |
||
30 | * @var string |
||
31 | */ |
||
32 | protected $type; |
||
33 | /** |
||
34 | * @var mixed |
||
35 | */ |
||
36 | protected $specification; |
||
37 | |||
38 | /** |
||
39 | * Creator method. Creates an instance of this object. |
||
40 | * return $this |
||
41 | */ |
||
42 | 132 | public static function builder() |
|
46 | |||
47 | /** |
||
48 | * Sets the class name. |
||
49 | * |
||
50 | * @param string $type Name of the class given by the annotation. |
||
51 | * |
||
52 | * @return $this For fluent interface |
||
53 | */ |
||
54 | 132 | public function withClass($type) |
|
59 | |||
60 | /** |
||
61 | * Sets the specification of the validation or filter. |
||
62 | * |
||
63 | * @param mixed $specification Specification set in the annotation. |
||
64 | * |
||
65 | * @return $this For fluent interface |
||
66 | */ |
||
67 | 128 | public function withSpecification($specification) |
|
72 | |||
73 | /** |
||
74 | * Builds the object from the given specification. |
||
75 | * |
||
76 | * @return \Mcustiel\SimpleRequest\Interfaces\FilterInterface|\Mcustiel\SimpleRequest\Interfaces\ValidatorInterface |
||
77 | */ |
||
78 | 132 | public function build() |
|
86 | |||
87 | /** |
||
88 | * @param string $type The type to instantiate. |
||
89 | * |
||
90 | * @return \Mcustiel\SimpleRequest\Interfaces\FilterInterface|\Mcustiel\SimpleRequest\Interfaces\ValidatorInterface |
||
91 | * |
||
92 | * @throws \Mcustiel\SimpleRequest\Exception\FilterDoesNotExistException |
||
93 | * @throws \Mcustiel\SimpleRequest\Exception\ValidatorDoesNotExistException |
||
94 | */ |
||
95 | abstract protected function getClassForType($type); |
||
96 | } |
||
97 |