| | |
| | $diffNet = $added - $deleted; |
| | - $diffMsg = '0 lines changed'; |
| | $pluralize = function( int $count ): string { |
| | $suffix = ''; |
| | |
| | if( $count !== 1 ) { |
| | $suffix = 's'; |
| | } |
| | |
| | return $count . ' line' . $suffix; |
| | }; |
| | - |
| | - if( $diffNet > 0 ) { |
| | - $diffMsg = $pluralize( $diffNet ) . ' added'; |
| | - } elseif( $diffNet < 0 ) { |
| | - $diffMsg = $pluralize( abs( $diffNet ) ) . ' removed'; |
| | - } |
| | |
| | - echo '<tr>' . |
| | - '<th class="commit-info-label">Added</th>' . |
| | - '<td class="commit-info-value">' . |
| | - $pluralize( $added ) . '</td></tr>'; |
| | + $deltaMsg = $pluralize( $added ) . ' added, ' . |
| | + $pluralize( $deleted ) . ' removed'; |
| | |
| | - echo '<tr>' . |
| | - '<th class="commit-info-label">Deleted</th>' . |
| | - '<td class="commit-info-value">' . |
| | - $pluralize( $deleted ) . '</td></tr>'; |
| | + if( $diffNet === 0 ) { |
| | + $deltaMsg .= ', 0 lines changed'; |
| | + } elseif( $added > 0 && $deleted > 0 ) { |
| | + if( $diffNet > 0 ) { |
| | + $deltaMsg .= ', ' . $diffNet . '-line increase'; |
| | + } else { |
| | + $deltaMsg .= ', ' . abs( $diffNet ) . '-line decrease'; |
| | + } |
| | + } |
| | |
| | echo '<tr>' . |
| | - '<th class="commit-info-label">Total</th>' . |
| | + '<th class="commit-info-label">Delta</th>' . |
| | '<td class="commit-info-value">' . |
| | - $diffMsg . '</td></tr>'; |
| | + $deltaMsg . '</td></tr>'; |
| | |
| | echo '</tbody></table></div></div>'; |