Remove dependency on filter_var
parent
639e6ba487
commit
774e9d0da6
|
@ -1,6 +1,7 @@
|
||||||
* 1.0.0-alpha2
|
* 1.0.0-alpha2
|
||||||
|
|
||||||
* Added "file" downloader type to download plain files
|
* Added "file" downloader type to download plain files
|
||||||
|
* Dependency on filter_var is now optional
|
||||||
|
|
||||||
* 1.0.0-alpha1 (2012-03-01)
|
* 1.0.0-alpha1 (2012-03-01)
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ class InitCommand extends Command
|
||||||
public function parseAuthorString($author)
|
public function parseAuthorString($author)
|
||||||
{
|
{
|
||||||
if (preg_match('/^(?P<name>[- \.,a-z0-9]+) <(?P<email>.+?)>$/i', $author, $match)) {
|
if (preg_match('/^(?P<name>[- \.,a-z0-9]+) <(?P<email>.+?)>$/i', $author, $match)) {
|
||||||
if ($match['email'] === filter_var($match['email'], FILTER_VALIDATE_EMAIL)) {
|
if (!function_exists('filter_var') || $match['email'] === filter_var($match['email'], FILTER_VALIDATE_EMAIL)) {
|
||||||
return array(
|
return array(
|
||||||
'name' => trim($match['name']),
|
'name' => trim($match['name']),
|
||||||
'email' => $match['email']
|
'email' => $match['email']
|
||||||
|
|
|
@ -31,7 +31,7 @@ class ComposerRepository extends ArrayRepository
|
||||||
$config['url'] = 'http://'.$config['url'];
|
$config['url'] = 'http://'.$config['url'];
|
||||||
}
|
}
|
||||||
$config['url'] = rtrim($config['url'], '/');
|
$config['url'] = rtrim($config['url'], '/');
|
||||||
if (!filter_var($config['url'], FILTER_VALIDATE_URL)) {
|
if (function_exists('filter_var') && !filter_var($config['url'], FILTER_VALIDATE_URL)) {
|
||||||
throw new \UnexpectedValueException('Invalid url given for Composer repository: '.$config['url']);
|
throw new \UnexpectedValueException('Invalid url given for Composer repository: '.$config['url']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ class PearRepository extends ArrayRepository
|
||||||
$config['url'] = 'http://'.$config['url'];
|
$config['url'] = 'http://'.$config['url'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!filter_var($config['url'], FILTER_VALIDATE_URL)) {
|
if (function_exists('filter_var') && !filter_var($config['url'], FILTER_VALIDATE_URL)) {
|
||||||
throw new \UnexpectedValueException('Invalid url given for PEAR repository: '.$config['url']);
|
throw new \UnexpectedValueException('Invalid url given for PEAR repository: '.$config['url']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue