Skip to content

Latest commit

 

History

History
123 lines (85 loc) · 2.48 KB

preprocessors.md

File metadata and controls

123 lines (85 loc) · 2.48 KB

Preprocessors

Preprocessor is defined for specific result column and applies on each record.

Creating own preprocessor

use Tlapnet\Report\Preprocessor\Preprocessor;

class FooPreprocessor extends
{

    /**
     * @param mixed $data
     * @return mixed
     */
    public function preprocess($data);

}

Usage

Define preprocessors for column referenced by its title.

preprocessors:
    <columnTitle>:
        - Tlapnet\Report\Preprocessor\Impl\AppendPreprocessor('$')
        - Tlapnet\Report\Preprocessor\Impl\PrependPreprocessor('@')

Available preprocessors

Adds string to start.

preprocessors:
    count:
        - Tlapnet\Report\Preprocessor\Impl\PrependPreprocessor('@')

Adds string to end.

preprocessors:
    count:
        - Tlapnet\Report\Preprocessor\Impl\AppendPreprocessor('$')

Displays Yes / No.

preprocessors:
    paid:
        - Tlapnet\Report\Preprocessor\Impl\BooleanPreprocessor('Yes', 'No')

Formats currency.

preprocessors:
    price:
        - Tlapnet\Report\Preprocessor\Impl\CurrencyPreprocessor('CZK')

Formats datetime.

preprocessors:
    date:
        - Tlapnet\Report\Preprocessor\Impl\DatePreprocessor('Y/m/d')

Formats value as email with mailto: link.

preprocessors:
    email:
        - Tlapnet\Report\Bridges\Nette\Preprocessors\EmailPreprocessor

Shows number in ratio. E.g. 0.3 is shown as 30 / 100

preprocessors:
    total:
        - Tlapnet\Report\Preprocessor\Impl\MathRatioPreprocessor(100)

Formats number.

preprocessors:
    size:
        class: Tlapnet\Report\Preprocessor\Impl\NumberPreprocessor
        setup:
          - setDecimalPoint(',')
          - setThousandsPoint('-')

For tests

Do nothing.