# metricool/2.1.1/app/Support/Validation/Rules/MinRule.php

Metricool – Social media and site statistics, version 2.1.1. 29 lines.

- Page: https://pluginprobe.com/plugins/metricool/2.1.1/code/app/Support/Validation/Rules/MinRule.php
- Raw: https://pluginprobe.com/plugins/metricool/2.1.1/raw/app/Support/Validation/Rules/MinRule.php
- Modified: 2026-08-20T14:08:30+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/metricool/2.1.1/code/app/Support/Validation/Rules/MinRule.php#L10-L20`.

```php
<?php

declare(strict_types=1);

namespace Metricool\Support\Validation\Rules;

class MinRule extends AbstractRule
{
    /**
     * Checks if the size of the field is at least the given minimum. Uses the
     * numeric value for numbers, the length for strings and the count for
     * arrays.
     * @inheritDoc
     */
    public function validate(string $field, $value, array $data): void
    {
        $min = (float) ($this->parameters[0] ?? 0);

        if ($this->sizeOf($value) < $min) {
            $this->fail(sprintf(
                /* translators: %1$s is the field name, %2$s is the minimum size */
                __('%1$s must be at least %2$s.', 'metricool'),
                $field,
                $this->parameters[0] ?? '0'
            ));
        }
    }
}

```
