Exemplo n.º 1
0
$success = true;
try {
    $testPriorityQueue->push(new Types\Priority('towel', 7), new Types\Priority('gas mask', 50), new Types\Priority('cooler', 2));
} catch (\Exception $e) {
    $success = false;
}
if ($success) {
    echo "Success!\n\nQueue Internals -- \n\n";
    var_dump($testPriorityQueue->getList());
    echo "\n";
} else {
    echo "Failure...\n";
}
echo "    Top -> ";
try {
    echo $testPriorityQueue->top() . "\n";
} catch (\Exception $e) {
    echo "EXCEPTION CAUGHT!\n";
}
echo "    Pop -> ";
$val = null;
try {
    $val = $testPriorityQueue->pop();
    echo "{$val}\n";
} catch (\Exception $e) {
    echo "EXCEPTION CAUGHT!\n";
}
echo "\nQueue Internals --\n\n";
var_dump($testPriorityQueue->getList());
echo "\n";
echo "    Bottom -> ";