# fluent-cart/1.6.4/app/Http/Rules/MaxPostCodeRule.php

FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler, version 1.6.4. 35 lines.

- Page: https://pluginprobe.com/plugins/fluent-cart/1.6.4/code/app/Http/Rules/MaxPostCodeRule.php
- Raw: https://pluginprobe.com/plugins/fluent-cart/1.6.4/raw/app/Http/Rules/MaxPostCodeRule.php
- Modified: 2025-11-20T13:11:16+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/fluent-cart/1.6.4/code/app/Http/Rules/MaxPostCodeRule.php#L10-L20`.

```php
<?php

namespace FluentCart\App\Http\Rules;

class MaxPostCodeRule
{
    public function __invoke($attr, $value, $rules, $data, ...$params)
    {
        if (is_numeric($value)) {
            $value = (string)$value;
        }

        if(!is_string($value)) {
            return sprintf(
                /* translators: 1: attribute name */
                __("The %s must be a valid text", "fluent-cart"),
                $attr
            );
        }

        if(strlen($value) > 100) {
            return sprintf(
                /* translators: 1: attribute name */
                __("The %s must not be greater than 100 characters.", "fluent-cart"),
                $attr
            );
        }


        return null;
    }


}

```
