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 Inbounder\Parsers; |
||
4 | |||
5 | use Illuminate\Support\Collection; |
||
6 | use Inbounder\Parsers\Contracts\EmailParserInterface; |
||
7 | use Inbounder\Parsers\Contracts\ParserInterface; |
||
8 | use Inbounder\Parsers\Objects\Attachment; |
||
9 | use Inbounder\Parsers\Objects\Email\Address; |
||
10 | use Inbounder\Parsers\Objects\Email\Header; |
||
11 | |||
12 | class PostmarkappParser extends AbstractParser implements EmailParserInterface |
||
13 | { |
||
14 | /** |
||
15 | * Parse the request and return itself. |
||
16 | * |
||
17 | * @return ParserInterface |
||
18 | */ |
||
19 | public function parse() : ParserInterface |
||
20 | { |
||
21 | $this->from = $this->from(); |
||
0 ignored issues
–
show
|
|||
22 | $this->replyTo = $this->replyTo(); |
||
0 ignored issues
–
show
The property
replyTo does not exist on object<Inbounder\Parsers\PostmarkappParser> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
23 | |||
24 | $this->to = $this->to(); |
||
0 ignored issues
–
show
The property
to does not exist on object<Inbounder\Parsers\PostmarkappParser> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
25 | $this->cc = $this->cc(); |
||
0 ignored issues
–
show
The property
cc does not exist on object<Inbounder\Parsers\PostmarkappParser> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
26 | $this->bcc = $this->bcc(); |
||
0 ignored issues
–
show
The property
bcc does not exist on object<Inbounder\Parsers\PostmarkappParser> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
27 | |||
28 | $this->subject = $this->subject(); |
||
0 ignored issues
–
show
The property
subject does not exist on object<Inbounder\Parsers\PostmarkappParser> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
29 | $this->body = $this->body(); |
||
0 ignored issues
–
show
The property
body does not exist on object<Inbounder\Parsers\PostmarkappParser> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
30 | |||
31 | $this->attachements = $this->attachements(); |
||
0 ignored issues
–
show
The property
attachements does not exist on object<Inbounder\Parsers\PostmarkappParser> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
32 | |||
33 | return $this; |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * Return an Address object from an input. |
||
38 | * |
||
39 | * @param array $input |
||
40 | * |
||
41 | * @return Address |
||
42 | */ |
||
43 | protected function address(array $input) : Address |
||
44 | { |
||
45 | return new Address($input['Email'], $input['Name'], $input['MailboxHash']); |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * Parse an array of addresses. |
||
50 | * |
||
51 | * @param array $input |
||
52 | * |
||
53 | * @return Collection |
||
54 | */ |
||
55 | protected function foreachAddress(array $input) : Collection |
||
56 | { |
||
57 | $collection = new Collection(); |
||
58 | |||
59 | foreach ($input as $address) { |
||
60 | $collection->push($this->address($address)); |
||
61 | } |
||
62 | |||
63 | return $collection; |
||
64 | } |
||
65 | |||
66 | /** |
||
67 | * From property. |
||
68 | * |
||
69 | * @return Address |
||
70 | */ |
||
71 | public function from() : Address |
||
72 | { |
||
73 | return $this->address($this->input('FromFull')); |
||
0 ignored issues
–
show
It seems like
$this->input('FromFull') targeting Inbounder\Parsers\AbstractParser::input() can also be of type string ; however, Inbounder\Parsers\PostmarkappParser::address() does only seem to accept array , maybe add an additional type check?
This check looks at variables that are passed out again to other methods. If the outgoing method call has stricter type requirements than the method itself, an issue is raised. An additional type check may prevent trouble. ![]() |
|||
74 | } |
||
75 | |||
76 | /** |
||
77 | * Reply-to property. |
||
78 | * |
||
79 | * @todo: edit this to handler the reply-to parameter |
||
80 | * |
||
81 | * @return Address |
||
82 | */ |
||
83 | public function replyTo() : Address |
||
84 | { |
||
85 | return $this->address($this->input('FromFull')); |
||
0 ignored issues
–
show
It seems like
$this->input('FromFull') targeting Inbounder\Parsers\AbstractParser::input() can also be of type string ; however, Inbounder\Parsers\PostmarkappParser::address() does only seem to accept array , maybe add an additional type check?
This check looks at variables that are passed out again to other methods. If the outgoing method call has stricter type requirements than the method itself, an issue is raised. An additional type check may prevent trouble. ![]() |
|||
86 | } |
||
87 | |||
88 | /** |
||
89 | * To property. |
||
90 | * |
||
91 | * @return Collection<Address> |
||
0 ignored issues
–
show
The doc-type
Collection<Address> could not be parsed: Expected "|" or "end of type", but got "<" at position 10. (view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. ![]() |
|||
92 | */ |
||
93 | public function to() : Collection |
||
94 | { |
||
95 | return $this->foreachAddress($this->input('ToFull')); |
||
0 ignored issues
–
show
It seems like
$this->input('ToFull') targeting Inbounder\Parsers\AbstractParser::input() can also be of type string ; however, Inbounder\Parsers\Postma...arser::foreachAddress() does only seem to accept array , maybe add an additional type check?
This check looks at variables that are passed out again to other methods. If the outgoing method call has stricter type requirements than the method itself, an issue is raised. An additional type check may prevent trouble. ![]() |
|||
96 | } |
||
97 | |||
98 | /** |
||
99 | * CC property. |
||
100 | * |
||
101 | * @return Collection<Address> |
||
0 ignored issues
–
show
The doc-type
Collection<Address> could not be parsed: Expected "|" or "end of type", but got "<" at position 10. (view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. ![]() |
|||
102 | */ |
||
103 | public function cc() : Collection |
||
104 | { |
||
105 | return $this->foreachAddress($this->input('CcFull')); |
||
0 ignored issues
–
show
It seems like
$this->input('CcFull') targeting Inbounder\Parsers\AbstractParser::input() can also be of type string ; however, Inbounder\Parsers\Postma...arser::foreachAddress() does only seem to accept array , maybe add an additional type check?
This check looks at variables that are passed out again to other methods. If the outgoing method call has stricter type requirements than the method itself, an issue is raised. An additional type check may prevent trouble. ![]() |
|||
106 | } |
||
107 | |||
108 | /** |
||
109 | * BCC property. |
||
110 | * |
||
111 | * @return Collection<Address> |
||
0 ignored issues
–
show
The doc-type
Collection<Address> could not be parsed: Expected "|" or "end of type", but got "<" at position 10. (view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. ![]() |
|||
112 | */ |
||
113 | public function bcc() : Collection |
||
114 | { |
||
115 | return $this->foreachAddress($this->input('BccFull')); |
||
0 ignored issues
–
show
It seems like
$this->input('BccFull') targeting Inbounder\Parsers\AbstractParser::input() can also be of type string ; however, Inbounder\Parsers\Postma...arser::foreachAddress() does only seem to accept array , maybe add an additional type check?
This check looks at variables that are passed out again to other methods. If the outgoing method call has stricter type requirements than the method itself, an issue is raised. An additional type check may prevent trouble. ![]() |
|||
116 | } |
||
117 | |||
118 | /** |
||
119 | * Subject property. |
||
120 | * |
||
121 | * @return string |
||
122 | */ |
||
123 | public function subject() |
||
124 | { |
||
125 | return $this->input('Subject'); |
||
0 ignored issues
–
show
|
|||
126 | } |
||
127 | |||
128 | /** |
||
129 | * Body. |
||
130 | * |
||
131 | * @return string |
||
132 | */ |
||
133 | public function body() |
||
134 | { |
||
135 | $body = $this->bodyHtml(); |
||
0 ignored issues
–
show
|
|||
136 | |||
137 | if ($this->bodyIsText()) { |
||
138 | $body = $this->bodyText(); |
||
0 ignored issues
–
show
|
|||
139 | } |
||
140 | |||
141 | return $body; |
||
142 | } |
||
143 | |||
144 | /** |
||
145 | * Return the body html. |
||
146 | * |
||
147 | * @return string |
||
148 | */ |
||
149 | public function bodyHtml() |
||
150 | { |
||
151 | return $this->input('HtmlBody'); |
||
152 | } |
||
153 | |||
154 | /** |
||
155 | * Return the body text. |
||
156 | * |
||
157 | * @return string |
||
158 | */ |
||
159 | public function bodyText() |
||
160 | { |
||
161 | return $this->input('TextBody'); |
||
162 | } |
||
163 | |||
164 | /** |
||
165 | * IsText. |
||
166 | * |
||
167 | * @return bool |
||
168 | */ |
||
169 | public function bodyIsText() |
||
170 | { |
||
171 | return !$this->bodyIsHtml(); |
||
172 | } |
||
173 | |||
174 | /** |
||
175 | * IsHtml. |
||
176 | * |
||
177 | * @return bool |
||
178 | */ |
||
179 | public function bodyIsHtml() |
||
180 | { |
||
181 | return !is_null($this->input('HtmlBody')) || $this->input('HtmlBody') !== ''; |
||
182 | } |
||
183 | |||
184 | /** |
||
185 | * Get email headers. |
||
186 | * |
||
187 | * @return Collection |
||
188 | */ |
||
189 | public function headers() : Collection |
||
190 | { |
||
191 | $collection = new Collection(); |
||
192 | |||
193 | foreach ($this->input('Headers') as $header) { |
||
0 ignored issues
–
show
The expression
$this->input('Headers') of type string|array is not guaranteed to be traversable. How about adding an additional type check?
There are different options of fixing this problem.
![]() |
|||
194 | $collection->push(new Header($header['Name'], $header['Value'])); |
||
195 | } |
||
196 | |||
197 | return $collection; |
||
198 | } |
||
199 | |||
200 | /** |
||
201 | * retrieve a email header. |
||
202 | * |
||
203 | * return Array |
||
204 | */ |
||
205 | public function header($name) |
||
206 | { |
||
207 | return $this->headers()->filter(function ($header) use ($name) { |
||
208 | return $header->name === $name; |
||
209 | })->first(); |
||
210 | } |
||
211 | |||
212 | /** |
||
213 | * Determinate if the email is marked as spam. |
||
214 | * |
||
215 | * @return bool |
||
216 | */ |
||
217 | public function isSpam() |
||
218 | { |
||
219 | $header = $this->header('X-Spam-Flag'); |
||
220 | |||
221 | return $header->value === 'NO' ? false : true; |
||
222 | } |
||
223 | |||
224 | /** |
||
225 | * Has attachements. |
||
226 | * |
||
227 | * @return bool |
||
228 | */ |
||
229 | public function hasAttachements() |
||
230 | { |
||
231 | return $this->attachements->isEmpty(); |
||
0 ignored issues
–
show
The property
attachements does not exist on object<Inbounder\Parsers\PostmarkappParser> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
232 | } |
||
233 | |||
234 | /** |
||
235 | * Attachments. |
||
236 | * |
||
237 | * @return Collection<File> |
||
0 ignored issues
–
show
The doc-type
Collection<File> could not be parsed: Expected "|" or "end of type", but got "<" at position 10. (view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. ![]() |
|||
238 | */ |
||
239 | public function attachements() : Collection |
||
240 | { |
||
241 | $collection = new Collection(); |
||
242 | |||
243 | foreach ($this->input('Attachments') as $attachment) { |
||
0 ignored issues
–
show
The expression
$this->input('Attachments') of type string|array is not guaranteed to be traversable. How about adding an additional type check?
There are different options of fixing this problem.
![]() |
|||
244 | $collection->push( |
||
245 | new Attachment( |
||
246 | $attachment['Name'], |
||
247 | (isset($attachment['Content']) ? $attachment['Content'] : ''), |
||
248 | $attachment['ContentType'], |
||
249 | $attachment['ContentLength'] |
||
250 | ) |
||
251 | ); |
||
252 | } |
||
253 | |||
254 | return $collection; |
||
255 | } |
||
256 | } |
||
257 |
Since your code implements the magic setter
_set
, this function will be called for any write access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.