This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace SfCod\EmailEngineBundle\Template; |
||
4 | |||
5 | use SfCod\EmailEngineBundle\Repository\RepositoryInterface; |
||
6 | use SfCod\EmailEngineBundle\Template\Attachments\AttachmentInterface; |
||
7 | use SfCod\EmailEngineBundle\Template\Params\ParameterResolverInterface; |
||
8 | |||
9 | /** |
||
10 | * Abstract argumentative, repository aware template |
||
11 | * |
||
12 | * Class AbstractTemplate |
||
13 | * |
||
14 | * @author Virchenko Maksim <[email protected]> |
||
15 | * |
||
16 | * @package SfCod\EmailEngineBundle\Template |
||
17 | */ |
||
18 | abstract class AbstractTemplate implements TemplateInterface, RepositoryAwareInterface, ParametersAwareInterface, AttachmentsAwareInterface |
||
19 | { |
||
20 | /** |
||
21 | * Template data |
||
22 | * |
||
23 | * @var array |
||
24 | */ |
||
25 | protected $data = []; |
||
26 | |||
27 | /** |
||
28 | * Template options |
||
29 | * |
||
30 | * @var TemplateOptionsInterface |
||
31 | */ |
||
32 | protected $options; |
||
33 | |||
34 | /** |
||
35 | * Template repository |
||
36 | * |
||
37 | * @var RepositoryInterface |
||
38 | */ |
||
39 | protected $repository; |
||
40 | |||
41 | /** |
||
42 | * Parameter resolver |
||
43 | * |
||
44 | * @var ParameterResolverInterface |
||
45 | */ |
||
46 | protected $parameterResolver; |
||
47 | |||
48 | /** |
||
49 | * AbstractTemplate constructor. |
||
50 | * |
||
51 | * @param TemplateOptionsInterface $options |
||
52 | */ |
||
53 | public function __construct(TemplateOptionsInterface $options) |
||
54 | { |
||
55 | $this->options = $options; |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * Set parameter resolver |
||
60 | * |
||
61 | * @param ParameterResolverInterface $parameterResolver |
||
62 | * |
||
63 | * @return mixed|void |
||
64 | */ |
||
65 | public function setParameterResolver(ParameterResolverInterface $parameterResolver) |
||
66 | { |
||
67 | $this->parameterResolver = $parameterResolver; |
||
68 | } |
||
69 | |||
70 | /** |
||
71 | * Add data for template |
||
72 | * |
||
73 | * @param $key |
||
74 | * @param $value |
||
75 | */ |
||
76 | public function addData($key, $value) |
||
77 | { |
||
78 | $this->data[$key] = $value; |
||
79 | } |
||
80 | |||
81 | /** |
||
82 | * Set repository |
||
83 | * |
||
84 | * @param RepositoryInterface $repository |
||
85 | */ |
||
86 | public function setRepository(RepositoryInterface $repository) |
||
87 | { |
||
88 | $this->repository = $repository; |
||
89 | } |
||
90 | |||
91 | /** |
||
92 | * Get repository |
||
93 | * |
||
94 | * @return RepositoryInterface |
||
95 | */ |
||
96 | public function getRepository(): RepositoryInterface |
||
97 | { |
||
98 | return $this->repository; |
||
99 | } |
||
100 | |||
101 | /** |
||
102 | * Get email's subject |
||
103 | * |
||
104 | * @return string |
||
105 | */ |
||
106 | public function getSubject(): string |
||
107 | { |
||
108 | return $this->repository->getSubjectTemplate($this->getData()); |
||
109 | } |
||
110 | |||
111 | /** |
||
112 | * Get email's body |
||
113 | * |
||
114 | * @return string |
||
115 | */ |
||
116 | public function getBody(): string |
||
117 | { |
||
118 | return $this->repository->getBodyTemplate($this->getData()); |
||
119 | } |
||
120 | |||
121 | /** |
||
122 | * Get email's sender name |
||
123 | * |
||
124 | * @return string |
||
125 | */ |
||
126 | public function getSenderName(): string |
||
127 | { |
||
128 | return $this->repository->getSenderNameTemplate($this->getData()); |
||
129 | } |
||
130 | |||
131 | /** |
||
132 | * Get email's sender email |
||
133 | * |
||
134 | * @return string |
||
135 | */ |
||
136 | public function getSenderEmail(): string |
||
137 | { |
||
138 | return $this->repository->getSenderEmailTemplate($this->getData()); |
||
139 | } |
||
140 | |||
141 | /** |
||
142 | * Get priority |
||
143 | * |
||
144 | * @return int |
||
145 | */ |
||
146 | public function getPriority(): int |
||
147 | { |
||
148 | return self::PRIORITY_NORMAL; |
||
149 | } |
||
150 | |||
151 | /** |
||
152 | * Get template attachments |
||
153 | * |
||
154 | * @return AttachmentInterface[] |
||
155 | */ |
||
156 | public function getAttachments(): array |
||
157 | { |
||
158 | $attachments = []; |
||
159 | |||
160 | foreach (static::listAttachments() as $attachment) { |
||
161 | /** @var AttachmentInterface $attachment */ |
||
162 | $attachment = new $attachment($this->options); |
||
163 | |||
164 | $attachments[$attachment->getFileName()] = $attachment; |
||
165 | } |
||
166 | |||
167 | return $attachments; |
||
168 | } |
||
169 | |||
170 | /** |
||
171 | * List template attachments |
||
172 | * |
||
173 | * @return AttachmentInterface[] |
||
174 | */ |
||
175 | public static function listAttachments(): array |
||
176 | { |
||
177 | return []; |
||
178 | } |
||
179 | |||
180 | /** |
||
181 | * Get arguments list |
||
182 | * |
||
183 | * @return array |
||
184 | */ |
||
185 | protected function getData(): array |
||
186 | { |
||
187 | if (empty($this->data)) { |
||
188 | foreach (static::listParameters() as $parameterClass) { |
||
189 | $this->data[$parameterClass::getName()] = $this->parameterResolver->getParameterValue($parameterClass, $this->options); |
||
0 ignored issues
–
show
|
|||
190 | } |
||
191 | } |
||
192 | |||
193 | return $this->data; |
||
194 | } |
||
195 | } |
||
196 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: