Use pathinfo instead of substr
parent
f93ec9daa4
commit
48ae8bf3ec
|
@ -84,7 +84,7 @@ EOT
|
|||
|
||||
if (null === $repositoryUrl) {
|
||||
$sourceRepo = new ComposerRepository(array('url' => 'http://packagist.org'), $io);
|
||||
} elseif (".json" === substr($repositoryUrl, -5)) {
|
||||
} elseif ("json" === pathinfo($repositoryUrl, PATHINFO_EXTENSION)) {
|
||||
$sourceRepo = new FilesystemRepository(new JsonFile($repositoryUrl, new RemoteFilesystem($io)));
|
||||
} elseif (0 === strpos($repositoryUrl, 'http')) {
|
||||
$sourceRepo = new ComposerRepository(array('url' => $repositoryUrl), $io);
|
||||
|
|
|
@ -125,7 +125,9 @@ class Factory
|
|||
|
||||
// init locker if possible
|
||||
if (isset($composerFile)) {
|
||||
$lockFile = substr($composerFile, -5) === '.json' ? substr($composerFile, 0, -4).'lock' : $composerFile . '.lock';
|
||||
$lockFile = "json" === pathinfo($composerFile, PATHINFO_EXTENSION)
|
||||
? substr($composerFile, 0, -4).'lock'
|
||||
: $composerFile . '.lock';
|
||||
$locker = new Package\Locker(new JsonFile($lockFile, new RemoteFilesystem($io)), $rm, md5_file($composerFile));
|
||||
$composer->setLocker($locker);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue