예제 #1
0
 /**
  *
  */
 private function _show($inbox)
 {
     pr(\ConsoleHelper::table(['subject', 'date', 'from', 'to', 'id'], [[$inbox->getSubject(), date('Y-m-d H:i:s', $inbox->getEmailCreateTime()), $inbox->getFromEmail(), $inbox->getToEmail(), $inbox->getId()]]));
     pr($inbox->getContent());
     pr('<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<');
     $data = $inbox->getProperty('data');
     $attachs = [];
     foreach ($data as $item) {
         if (!isset($item['name'])) {
             // 不是附件
             continue;
         }
         $attachs[] = $item['name'];
     }
     $count = count($attachs);
     if ($count > 0) {
         pr("---------- attachments x {$count} ----------");
         foreach ($attachs as $name) {
             pr($name);
         }
     }
     pr('');
 }
function table(array $rows, $headers = null)
{
    if (null === $headers) {
        $headers = array_keys($rows[0]);
    }
    echo ConsoleHelper::table($headers, $rows);
}