diff --git a/src/Adapters/Archive/Detectors/Code.php b/src/Adapters/Archive/Detectors/Code.php index c6afd83b..1840621f 100644 --- a/src/Adapters/Archive/Detectors/Code.php +++ b/src/Adapters/Archive/Detectors/Code.php @@ -6,7 +6,7 @@ use Embed\Detectors\Code as Detector; use Embed\EmbedCode; use function Embed\html; -use function Embed\match; +use function Embed\matchPath; class Code extends Detector { @@ -15,7 +15,7 @@ public function detect(): ?EmbedCode $uri = $this->extractor->getUri(); $path = $uri->getPath(); - if (!match('/details/*', $path)) { + if (!matchPath('/details/*', $path)) { return null; } diff --git a/src/Adapters/CadenaSer/Detectors/Code.php b/src/Adapters/CadenaSer/Detectors/Code.php index 9bb8bd6a..d279e7b2 100644 --- a/src/Adapters/CadenaSer/Detectors/Code.php +++ b/src/Adapters/CadenaSer/Detectors/Code.php @@ -7,7 +7,7 @@ use Embed\Detectors\Code as Detector; use Embed\EmbedCode; use function Embed\html; -use function Embed\match; +use function Embed\matchPath; class Code extends Detector { @@ -21,7 +21,7 @@ private function fallback(): ?EmbedCode { $uri = $this->extractor->getUri(); - if (!match('/audio/*', $uri->getPath())) { + if (!matchPath('/audio/*', $uri->getPath())) { return null; } diff --git a/src/Adapters/Flickr/Detectors/Code.php b/src/Adapters/Flickr/Detectors/Code.php index 86c148e6..1dfe50ae 100644 --- a/src/Adapters/Flickr/Detectors/Code.php +++ b/src/Adapters/Flickr/Detectors/Code.php @@ -7,7 +7,7 @@ use Embed\Detectors\Code as Detector; use Embed\EmbedCode; use function Embed\html; -use function Embed\match; +use function Embed\matchPath; class Code extends Detector { @@ -21,7 +21,7 @@ private function fallback(): ?EmbedCode { $uri = $this->extractor->getUri(); - if (!match('/photos/*', $uri->getPath())) { + if (!matchPath('/photos/*', $uri->getPath())) { return null; } diff --git a/src/Adapters/Github/Detectors/Code.php b/src/Adapters/Github/Detectors/Code.php index a579ace6..350e15c4 100644 --- a/src/Adapters/Github/Detectors/Code.php +++ b/src/Adapters/Github/Detectors/Code.php @@ -6,7 +6,7 @@ use Embed\Detectors\Code as Detector; use Embed\EmbedCode; use function Embed\html; -use function Embed\match; +use function Embed\matchPath; class Code extends Detector { @@ -21,7 +21,7 @@ private function fallback(): ?EmbedCode $uri = $this->extractor->getUri(); $path = $uri->getPath(); - if (!match('/*/*/blob/*', $path)) { + if (!matchPath('/*/*/blob/*', $path)) { return null; } diff --git a/src/Adapters/ImageShack/Api.php b/src/Adapters/ImageShack/Api.php index 1a199f2f..a5bc3ec0 100644 --- a/src/Adapters/ImageShack/Api.php +++ b/src/Adapters/ImageShack/Api.php @@ -5,7 +5,7 @@ use function Embed\getDirectory; use Embed\HttpApiTrait; -use function Embed\match; +use function Embed\matchPath; class Api { @@ -15,10 +15,10 @@ protected function fetchData(): array { $uri = $this->extractor->getUri(); - if (!match('/i/*', $uri->getPath())) { + if (!matchPath('/i/*', $uri->getPath())) { $uri = $this->extractor->getRequest()->getUri(); - if (!match('/i/*', $uri->getPath())) { + if (!matchPath('/i/*', $uri->getPath())) { return []; } } diff --git a/src/Adapters/Pinterest/Detectors/Code.php b/src/Adapters/Pinterest/Detectors/Code.php index a2b81071..4d38724e 100644 --- a/src/Adapters/Pinterest/Detectors/Code.php +++ b/src/Adapters/Pinterest/Detectors/Code.php @@ -6,7 +6,7 @@ use Embed\Detectors\Code as Detector; use Embed\EmbedCode; use function Embed\html; -use function Embed\match; +use function Embed\matchPath; class Code extends Detector { @@ -20,7 +20,7 @@ private function fallback(): ?EmbedCode { $uri = $this->extractor->getUri(); - if (!match('/pin/*', $uri->getPath())) { + if (!matchPath('/pin/*', $uri->getPath())) { return null; } diff --git a/src/Adapters/Sassmeister/Detectors/Code.php b/src/Adapters/Sassmeister/Detectors/Code.php index 5236f927..7ad83746 100644 --- a/src/Adapters/Sassmeister/Detectors/Code.php +++ b/src/Adapters/Sassmeister/Detectors/Code.php @@ -6,7 +6,7 @@ use Embed\Detectors\Code as Detector; use Embed\EmbedCode; use function Embed\html; -use function Embed\match; +use function Embed\matchPath; class Code extends Detector { @@ -20,7 +20,7 @@ private function fallback(): ?EmbedCode { $uri = $this->extractor->getUri(); - if (!match('/gist/*', $uri->getPath())) { + if (!matchPath('/gist/*', $uri->getPath())) { return null; } diff --git a/src/Adapters/Snipplr/Detectors/Code.php b/src/Adapters/Snipplr/Detectors/Code.php index 4df3e89e..aadbb1d9 100644 --- a/src/Adapters/Snipplr/Detectors/Code.php +++ b/src/Adapters/Snipplr/Detectors/Code.php @@ -6,7 +6,7 @@ use Embed\Detectors\Code as Detector; use Embed\EmbedCode; use function Embed\html; -use function Embed\match; +use function Embed\matchPath; class Code extends Detector { @@ -20,7 +20,7 @@ private function fallback(): ?EmbedCode { $uri = $this->extractor->getUri(); - if (!match('/view/*', $uri->getPath())) { + if (!matchPath('/view/*', $uri->getPath())) { return null; } diff --git a/src/Adapters/Wikipedia/Api.php b/src/Adapters/Wikipedia/Api.php index 8f134bd1..36b5233b 100644 --- a/src/Adapters/Wikipedia/Api.php +++ b/src/Adapters/Wikipedia/Api.php @@ -5,7 +5,7 @@ use function Embed\getDirectory; use Embed\HttpApiTrait; -use function Embed\match; +use function Embed\matchPath; class Api { @@ -15,7 +15,7 @@ protected function fetchData(): array { $uri = $this->extractor->getUri(); - if (!match('/wiki/*', $uri->getPath())) { + if (!matchPath('/wiki/*', $uri->getPath())) { return []; } diff --git a/src/Adapters/Youtube/Detectors/Feeds.php b/src/Adapters/Youtube/Detectors/Feeds.php index 91318664..aac95531 100644 --- a/src/Adapters/Youtube/Detectors/Feeds.php +++ b/src/Adapters/Youtube/Detectors/Feeds.php @@ -5,7 +5,7 @@ use Embed\Detectors\Feeds as Detector; use function Embed\getDirectory; -use function Embed\match; +use function Embed\matchPath; use Psr\Http\Message\UriInterface; class Feeds extends Detector @@ -23,7 +23,7 @@ private function fallback(): array { $uri = $this->extractor->getUri(); - if (!match('/channel/*', $uri->getPath())) { + if (!matchPath('/channel/*', $uri->getPath())) { return []; } diff --git a/src/functions.php b/src/functions.php index 35aebfa2..ff0e705d 100644 --- a/src/functions.php +++ b/src/functions.php @@ -116,7 +116,7 @@ function cleanPath(string $path): string return $path; } -function match(string $pattern, string $subject): bool +function matchPath(string $pattern, string $subject): bool { $pattern = str_replace('\\*', '.*', preg_quote($pattern, '|'));