for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Jackal\Downloader\Parser;
class URLRegexParser
{
protected $downloaderClass;
public function __construct(string $downloaderClass)
$this->downloaderClass = $downloaderClass;
}
/**
* @param string $publicWatchUrl
* @return string|null
*/
public function parse(string $publicWatchUrl) : ?string{
preg_match($this->downloaderClass::getPublicUrlRegex(), $publicWatchUrl, $matches);
if(isset($matches[1])){
return $matches[1];
return null;
* @return bool
public function isValidUrl(string $publicWatchUrl) : bool {
return $this->parse($publicWatchUrl) == true;