Skip to content

Commit 0e38ab0

Browse files
committed
Removed alias (die to exit), useless trim (use correct file option)
1 parent 79a63bd commit 0e38ab0

File tree

1 file changed

+11
-20
lines changed

1 file changed

+11
-20
lines changed

bin/vendors

100755100644
+11-20
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ $vendorDir = $rootDir.'/vendor';
1515

1616
array_shift($argv);
1717
if (!isset($argv[0])) {
18-
die(<<<EOF
18+
exit(<<<EOF
1919
Symfony2 vendors script management.
2020
2121
Specify a command to run:
@@ -29,7 +29,7 @@ EOF
2929
}
3030

3131
if (!in_array($command = array_shift($argv), array('install', 'update'))) {
32-
die(sprintf("Command \"%s\" does not exist.\n", $command));
32+
exit(sprintf("Command \"%s\" does not exist.\n", $command));
3333
}
3434

3535
if (!is_dir($vendorDir)) {
@@ -39,25 +39,19 @@ if (!is_dir($vendorDir)) {
3939
// versions
4040
$versions = array();
4141
if ('install' === $command && file_exists($rootDir.'/deps.lock')) {
42-
foreach (file($rootDir.'/deps.lock') as $line) {
43-
if (!trim($line)) {
44-
continue;
45-
}
46-
$parts = array_values(array_filter(explode(' ', trim($line))));
42+
foreach (file($rootDir.'/deps.lock', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) as $line) {
43+
$parts = array_values(array_filter(explode(' ', $line)));
4744
if (2 !== count($parts)) {
48-
die(sprintf('The deps version file is not valid (near "%s")', $line));
45+
exit(sprintf('The deps version file is not valid (near "%s")', $line));
4946
}
5047
$versions[$parts[0]] = $parts[1];
5148
}
5249
}
5350

54-
foreach (file($rootDir.'/deps') as $line) {
55-
if (!trim($line)) {
56-
continue;
57-
}
58-
$parts = array_values(array_filter(explode(' ', trim($line))));
51+
foreach (file($rootDir.'/deps', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) as $line) {
52+
$parts = array_values(array_filter(explode(' ', $line)));
5953
if (3 !== count($parts)) {
60-
die(sprintf('The deps file is not valid (near "%s")', $line));
54+
exit(sprintf('The deps file is not valid (near "%s")', $line));
6155
}
6256
list($name, $path, $url) = $parts;
6357

@@ -91,13 +85,10 @@ foreach (file($rootDir.'/deps') as $line) {
9185
// update?
9286
if ('update' === $command) {
9387
$deps = array();
94-
foreach (file($rootDir.'/deps') as $line) {
95-
if (!trim($line)) {
96-
continue;
97-
}
98-
$parts = array_values(array_filter(explode(' ', trim($line))));
88+
foreach (file($rootDir.'/deps', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) as $line) {
89+
$parts = array_values(array_filter(explode(' ', $line)));
9990
if (3 !== count($parts)) {
100-
die(sprintf('The deps file is not valid (near "%s")', $line));
91+
exit(sprintf('The deps file is not valid (near "%s")', $line));
10192
}
10293
list($name, $path, $url) = $parts;
10394

0 commit comments

Comments
 (0)