From 55bb9d7136ce2b9cbd32b8de38832447baaceefa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 26 Aug 2023 10:16:46 +0200 Subject: [PATCH] Fix warnings --- dev/tools/apstats.php | 50 +++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/dev/tools/apstats.php b/dev/tools/apstats.php index 52374841b56..44735513053 100755 --- a/dev/tools/apstats.php +++ b/dev/tools/apstats.php @@ -157,13 +157,15 @@ foreach (array('proj', 'dep') as $source) { } } - foreach ($arrayoflineofcode[$source] as $key => $val) { - $arrayofmetrics[$source]['Files'] += $val['Files']; - $arrayofmetrics[$source]['Lines'] += $val['Lines']; - $arrayofmetrics[$source]['Blanks'] += $val['Blanks']; - $arrayofmetrics[$source]['Comments'] += $val['Comments']; - $arrayofmetrics[$source]['Code'] += $val['Code']; - $arrayofmetrics[$source]['Complexity'] += $val['Complexity']; + if (!empty($arrayoflineofcode[$source])) { + foreach ($arrayoflineofcode[$source] as $key => $val) { + $arrayofmetrics[$source]['Files'] += $val['Files']; + $arrayofmetrics[$source]['Lines'] += $val['Lines']; + $arrayofmetrics[$source]['Blanks'] += $val['Blanks']; + $arrayofmetrics[$source]['Comments'] += $val['Comments']; + $arrayofmetrics[$source]['Code'] += $val['Code']; + $arrayofmetrics[$source]['Complexity'] += $val['Complexity']; + } } } @@ -267,18 +269,20 @@ foreach (array('proj', 'dep') as $source) { $html .= ''.formatNumber($arrayofmetrics[$source]['Code']).''; $html .= 'TODO graph here...'; $html .= ''; - foreach ($arrayoflineofcode[$source] as $key => $val) { - $html .= ''; - $html .= ''.$key.''; - $html .= ''; - $html .= ''.(empty($val['Files']) ? '' : formatNumber($val['Files'])).''; - $html .= ''.(empty($val['Lines']) ? '' : formatNumber($val['Lines'])).''; - $html .= ''.(empty($val['Blanks']) ? '' : formatNumber($val['Blanks'])).''; - $html .= ''.(empty($val['Comments']) ? '' : formatNumber($val['Comments'])).''; - $html .= ''.(empty($val['Code']) ? '' : formatNumber($val['Code'])).''; - //$html .= ''.(empty($val['Complexity']) ? '' : $val['Complexity']).''; - $html .= 'TODO graph here...'; - $html .= ''; + if (!empty($arrayoflineofcode[$source])) { + foreach ($arrayoflineofcode[$source] as $key => $val) { + $html .= ''; + $html .= ''.$key.''; + $html .= ''; + $html .= ''.(empty($val['Files']) ? '' : formatNumber($val['Files'])).''; + $html .= ''.(empty($val['Lines']) ? '' : formatNumber($val['Lines'])).''; + $html .= ''.(empty($val['Blanks']) ? '' : formatNumber($val['Blanks'])).''; + $html .= ''.(empty($val['Comments']) ? '' : formatNumber($val['Comments'])).''; + $html .= ''.(empty($val['Code']) ? '' : formatNumber($val['Code'])).''; + //$html .= ''.(empty($val['Complexity']) ? '' : $val['Complexity']).''; + $html .= 'TODO graph here...'; + $html .= ''; + } } } @@ -299,8 +303,12 @@ $html .= ''; $html .= '
'; $html .= '

Project value


'; -$html .= 'COCOMO (Basic organic model) value: $'.formatNumber($arraycocomo['proj']['currency'] + $arraycocomo['dep']['currency'], 2).'
'; -$html .= 'COCOMO (Basic organic model) effort: '.formatNumber($arraycocomo['proj']['people'] * $arraycocomo['proj']['effort'] + $arraycocomo['dep']['people'] * $arraycocomo['dep']['effort']).' monthes people
'; +$html .= 'COCOMO (Basic organic model) value: $'; +$html .= formatNumber($arraycocomo['proj']['currency'] + $arraycocomo['dep']['currency'], 2); +$html .= '
'; +$html .= 'COCOMO (Basic organic model) effort: '; +$html .= formatNumber($arraycocomo['proj']['people'] * $arraycocomo['proj']['effort'] + $arraycocomo['dep']['people'] * $arraycocomo['dep']['effort']); +$html .= ' monthes people
'; $html .= '
'; $html .= '
';