$cert, 1 => $x509['subject']['CN'], 2 => date( 'Y-m-d H:i:s T', $x509['validTo_time_t'] ), 3 => (int) round( ( $x509['validTo_time_t'] - time() ) / 86400 ), ]; // Alert if any expire within the next 30 days. if ( ! $dir_includes_expired && $cert_data[3] - 30 <= 0 ) { $dir_includes_expired = true; } $data[] = $cert_data; } $table = new \cli\Table( array_shift( $data ), $data ); $table->setRenderer( new \cli\table\Ascii() ); $table->sort( 2 ); $table->display(); if ( $dir_includes_expired ) { echo "EXPIRING CERTIFICATES FOUND!\n"; } if ( $exit ) { exit( $dir_includes_expired ? 1 : 0 ); } } report();