Skip to content
This repository was archived by the owner on Jan 14, 2019. It is now read-only.

Commit df7852f

Browse files
author
Martin Damien
authored
Merge pull request #21 from notFloran/typehint-and-php-73-deprecations
Add typehint and remove deprecation of FILTER_FLAG_SCHEME_REQUIRED in PHP 7.3
2 parents fd05bed + 4d56284 commit df7852f

File tree

1 file changed

+8
-26
lines changed

1 file changed

+8
-26
lines changed

src/ImageEmbedPlugin.php

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,12 @@
1010

1111
class ImageEmbedPlugin implements Swift_Events_SendListener
1212
{
13-
14-
private $basePath = '';
15-
1613
/**
17-
* ImageEmbedPlugin constructor.
18-
*
19-
* @param string $basePath
14+
* @var string
2015
*/
21-
public function __construct($basePath = '')
16+
private $basePath;
17+
18+
public function __construct(string $basePath = '')
2219
{
2320
$this->basePath = $basePath;
2421
}
@@ -87,22 +84,12 @@ protected function embedImages(Swift_Mime_SimpleMessage $message, Swift_Mime_Sim
8784
return $dom->saveHTML();
8885
}
8986

90-
/**
91-
* @param $path
92-
*
93-
* @return bool
94-
*/
95-
protected function isUrl($path)
87+
protected function isUrl(string $path) : bool
9688
{
97-
return filter_var($path, FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED) !== false;
89+
return filter_var($path, FILTER_VALIDATE_URL) !== false;
9890
}
9991

100-
/**
101-
* @param $src
102-
*
103-
* @return string
104-
*/
105-
protected function getPathFromSrc($src)
92+
protected function getPathFromSrc(string $src) : string
10693
{
10794
if ($this->isUrl($src)) {
10895
return $src;
@@ -111,12 +98,7 @@ protected function getPathFromSrc($src)
11198
return $this->basePath . $src;
11299
}
113100

114-
/**
115-
* @param $path
116-
*
117-
* @return bool
118-
*/
119-
protected function fileExists($path)
101+
protected function fileExists(string $path) : bool
120102
{
121103
if ($this->isUrl($path)) {
122104
return !!@getimagesize($path);

0 commit comments

Comments
 (0)