@@ -34,12 +34,21 @@ if ($opts['md']) {
34
34
}
35
35
36
36
$ table_titles = array (
37
- 'changes ' => 'Production Changes ' ,
38
- 'changes-dev ' => 'Dev Changes ' ,
37
+ true => array (
38
+ 'changes ' => 'Production Changes ' ,
39
+ 'changes-dev ' => 'Dev Changes ' ,
40
+ ),
41
+ false => array (
42
+ 'changes ' => 'Indirect Production Changes ' ,
43
+ 'changes-dev ' => 'Indirect Dev Changes ' ,
44
+ )
39
45
);
40
46
41
- foreach ($ changes as $ k => $ diff ) {
42
- print tableize ($ table_titles [$ k ], $ diff , $ table_opts );
47
+ foreach (array (true , false ) as $ direct ) {
48
+ foreach ($ changes as $ k => $ diff ) {
49
+ $ diff = filterDirect ($ diff , $ direct );
50
+ print tableize ($ table_titles [$ direct ][$ k ], $ diff , $ table_opts );
51
+ }
43
52
}
44
53
45
54
function diff ($ key , $ data_from , $ data_to ) {
@@ -70,6 +79,18 @@ function diff($key, $data_from, $data_to) {
70
79
return $ pkgs ;
71
80
}
72
81
82
+ function filterDirect ($ diff , $ direct )
83
+ {
84
+ if (empty ($ diff )) return $ diff ;
85
+
86
+ $ filtered = array ();
87
+ foreach ($ diff as $ key => $ v ) {
88
+ if ($ v [3 ]['direct ' ] != $ direct ) continue ;
89
+ $ filtered [$ key ] = $ v ;
90
+ }
91
+ return $ filtered ;
92
+ }
93
+
73
94
function version ($ pkg )
74
95
{
75
96
if ((substr ($ pkg ->version ,0 ,4 ) == 'dev- ' || '-dev ' === substr ($ pkg ->version , -4 )) && isset ($ pkg ->source ) && isset ($ pkg ->source ->reference )) {
@@ -104,7 +125,7 @@ function tableize($header, $data, $opts = array()) {
104
125
105
126
$ widths = array (maxLength (array_merge (array ($ header ), array_keys ($ data ))));
106
127
107
- $ count = 3 ; // it will always be 3. The fourth item is a properties array
128
+ $ count = count ( reset ( $ data )) - 1 ;
108
129
for ($ i = 0 ; $ i < $ count ; $ i ++) {
109
130
$ widths [] = max (strlen ($ titles [$ i + 1 ]), maxLength (array_map (function ($ k ) use ($ data , $ i ) { return $ data [$ k ][$ i ]; }, array_keys ($ data ))));
110
131
}
@@ -116,17 +137,7 @@ function tableize($header, $data, $opts = array()) {
116
137
$ lines [] = tabelizeLine ($ titles , $ widths );
117
138
$ lines [] = separatorLine ($ widths , $ opts ['joint ' ]);
118
139
119
- $ lines [] = fillLine (array ("Direct " ), '~ ' , $ widths );
120
-
121
140
foreach ($ data as $ key => $ v ) {
122
- if (! $ v [3 ]['direct ' ]) continue ;
123
- $ lines [] = tabelizeLine (array_merge (array ($ key ), array_slice ($ v , 0 , $ count )), $ widths );
124
- }
125
-
126
- $ lines [] = fillLine (array ("Indirect " ), '~ ' , $ widths );
127
-
128
- foreach ($ data as $ key => $ v ) {
129
- if ($ v [3 ]['direct ' ]) continue ;
130
141
$ lines [] = tabelizeLine (array_merge (array ($ key ), array_slice ($ v , 0 , $ count )), $ widths );
131
142
}
132
143
542
553
exit (0 );
543
554
}
544
555
# vim: ff=unix ts=4 ss=4 sr et
545
-
0 commit comments