Example #1
0
function showParts($mail, $level)
{
    switch (get_class($mail)) {
        case 'ezcMail':
            printf("%s%s\n", str_repeat('  ', $level), 'Mail');
            showParts($mail->body, $level + 1);
            break;
        case 'ezcMailText':
            printf("%s%s (%s, %s)\n", str_repeat('  ', $level), 'Text', $mail->subType, $mail->charset);
            echo "---\n", htmlspecialchars($mail->text), "\n---\n";
            break;
        case 'ezcMailFile':
            printf("%s%s (%s)\n", str_repeat('  ', $level), 'File', $mail->fileName);
            break;
        case 'ezcMailMultipartMixed':
            printf("%s%s\n", str_repeat('  ', $level), 'Multipart (mixed)');
            foreach ($mail->getParts() as $part) {
                showParts($part, $level + 1);
            }
            break;
        case 'ezcMailMultipartAlternative':
            printf("%s%s\n", str_repeat('  ', $level), 'Multipart (alternative)');
            foreach ($mail->getParts() as $part) {
                showParts($part, $level + 1);
            }
            break;
        case 'ezcMailMultipartRelated':
            printf("%s%s\n", str_repeat('  ', $level), 'Multipart (mixed)');
            $mail = fixLinks($mail);
            showParts($mail->getMainPart(), $level + 1);
            foreach ($mail->getRelatedParts() as $part) {
                showParts($part, $level + 1);
            }
            break;
    }
}
function dumpGraph(Graph $g, $message)
{
    $c = get_class($g);
    echo "\n\n\n====== " . get_class($g) . " : {$message} ======\n\n";
    echo $g . "\n";
    dumpRooted($g);
    $ids = $g->getNodeIds();
    // Add non existing node to the list.
    $ids[] = 'z';
    dumpParticipants($g);
    showParts($g);
    if ($g instanceof DirectedGraph) {
        dumpReverse($g);
    }
    if ($g instanceof DirectedAcyclicGraph) {
        dumpTSL($g);
    }
}