Score dependency health from failed and total counts and assign a status label.

dependency health Dependency health scoring reduces a set of component checks to a single status label.

Dependency Health Report

failedDeps
dependency_health.php
Replay: real traced execution (multi-file project)
<?php
$failedDeps = 1;
$totalDeps = 5;
$healthyDeps = $totalDeps - $failedDeps;
$depStatus = "green";

if ($failedDeps >= 3) {
    $depStatus = "red";
} elseif ($failedDeps > 0) {
    $depStatus = "watch";
}

echo "failed=" . $failedDeps . " healthy=" . $healthyDeps . " status=" . $depStatus . "\n";
<?php
$failedDeps = 0;
$totalDeps = 5;
$healthyDeps = $totalDeps - $failedDeps;
$depStatus = "green";

if ($failedDeps >= 3) {
    $depStatus = "red";
} elseif ($failedDeps > 0) {
    $depStatus = "watch";
}

echo "failed=" . $failedDeps . " healthy=" . $healthyDeps . " status=" . $depStatus . "\n";
<?php
$failedDeps = 3;
$totalDeps = 5;
$healthyDeps = $totalDeps - $failedDeps;
$depStatus = "green";

if ($failedDeps >= 3) {
    $depStatus = "red";
} elseif ($failedDeps > 0) {
    $depStatus = "watch";
}

echo "failed=" . $failedDeps . " healthy=" . $healthyDeps . " status=" . $depStatus . "\n";
  1. $failedDeps ← 1, $totalDeps ← 5, $healthyDeps ← 4, $depStatus ← green

    1<?php2$failedDeps→ 1 = 1; //@failedDeps=0, 33$totalDeps→ 5 = 5;4$healthyDeps→ 4 = $totalDeps5 - $failedDeps1;5$depStatus→ green = "green";67if ($failedDeps >= 3) {8    $depStatus = "red";9} elseif ($failedDeps > 0) {10    $depStatus→ watch = "watch";11}1213echo "failed=" . $failedDeps1 . " healthy=" . $healthyDeps4 . " status=" . $depStatuswatch . "\n";
    outputfailed=1 healthy=4 status=watch
  1. $failedDeps ← 0, $totalDeps ← 5, $healthyDeps ← 5, $depStatus ← green

    1<?php2$failedDeps→ 0 = 0;3$totalDeps→ 5 = 5;4$healthyDeps→ 5 = $totalDeps5 - $failedDeps0;5$depStatus→ green = "green";67if ($failedDeps >= 3) {8    $depStatus = "red";9} elseif ($failedDeps > 0) {10    $depStatus = "watch";11}1213echo "failed=" . $failedDeps0 . " healthy=" . $healthyDeps5 . " status=" . $depStatusgreen . "\n";
    outputfailed=0 healthy=5 status=green
  1. $failedDeps ← 3, $totalDeps ← 5, $healthyDeps ← 2, $depStatus ← green

    1<?php2$failedDeps→ 3 = 3;3$totalDeps→ 5 = 5;4$healthyDeps→ 2 = $totalDeps5 - $failedDeps3;5$depStatus→ green = "green";
  2. $depStatus ← red

    7if ($failedDeps3 >= 3) {8    $depStatus→ red = "red";9} elseif ($failedDeps > 0) {
  3. echo "failed=" . $failedDeps . " healthy=" . $healthyDeps . " status="…

    13echo "failed=" . $failedDeps3 . " healthy=" . $healthyDeps2 . " status=" . $depStatusred . "\n";
    outputfailed=3 healthy=2 status=red