@@ -15,7 +15,7 @@ $vendorDir = $rootDir.'/vendor';
15
15
16
16
array_shift ($ argv );
17
17
if (!isset ($ argv [0 ])) {
18
- die (<<<EOF
18
+ exit (<<<EOF
19
19
Symfony2 vendors script management.
20
20
21
21
Specify a command to run:
29
29
}
30
30
31
31
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 ));
33
33
}
34
34
35
35
if (!is_dir ($ vendorDir )) {
@@ -39,25 +39,19 @@ if (!is_dir($vendorDir)) {
39
39
// versions
40
40
$ versions = array ();
41
41
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 )));
47
44
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 ));
49
46
}
50
47
$ versions [$ parts [0 ]] = $ parts [1 ];
51
48
}
52
49
}
53
50
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 )));
59
53
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 ));
61
55
}
62
56
list ($ name , $ path , $ url ) = $ parts ;
63
57
@@ -91,13 +85,10 @@ foreach (file($rootDir.'/deps') as $line) {
91
85
// update?
92
86
if ('update ' === $ command ) {
93
87
$ 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 )));
99
90
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 ));
101
92
}
102
93
list ($ name , $ path , $ url ) = $ parts ;
103
94
0 commit comments