public function alignText($array, $delimiter = '')
    {
        // Get max column widths
        $widths = [];
        foreach ($array as $row) {
            $lengths = array_map('strlen', $row);

            for ($i = 0; $i < count($lengths); $i++) {
                if (isset($widths[$i])) {
                    $widths[$i] = max($widths[$i], $lengths[$i]);
                } else {
                    $widths[$i] = $lengths[$i];
                }
            }
        }

        // Pad lines columns and return an array
        $output = [];
        foreach($array as $row) {
            $entries = [];
            for ($i = 0; $i < count($row); $i++) {
                $entries[] = str_pad($row[$i], $widths[$i]);
            }

            $output[] = implode($entries, $delimiter);
        }

        return $output;
    }