HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: /var/www/html/shootinschool/wp-content/plugins/wp-mail-logging/src/Renderer/Column/ErrorColumn.php
<?php

namespace No3x\WPML\Renderer\Column;


class ErrorColumn extends GenericColumn {

    /**
     * Max number of character to display before we
     * truncate with ellipsis.
     *
     * @var int
     */
    const MAX_ERROR_CHAR_LENGTH = 90;

    /**
     * TimestampColumn constructor.
     */
    public function __construct() {
        parent::__construct("error");
    }

    /**
     * @inheritdoc
     */
    public function render(array $mailArray, $format) {
        if($format == ColumnFormat::SIMPLE) {
            return parent::render($mailArray, $format);
        } elseif ($format == ColumnFormat::FULL) {
            return $this->error_column($mailArray);
        }
        throw new \Exception("Unknown Format");
    }

    /**
     * Renders the error column.
     * @since 1.8.0
     * @param $item
     * @return string
     */
    function error_column($item) {

        if ( empty( $item['error'] ) ) {
            return '';
        }

        if ( strlen( $item['error'] ) <= self::MAX_ERROR_CHAR_LENGTH ) {
            return $item['error'];
        }

        echo substr( $item['error'], 0, self::MAX_ERROR_CHAR_LENGTH ) . '...';
    }

}