<NME> WhitelistEntry.php
<BEF> <?php

/*
 * This file is part of the Force Login module for Magento2.
 *
 * (c) bitExpert AG
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace BitExpert\ForceCustomerLogin\Validator;

use BitExpert\ForceCustomerLogin\Model\WhitelistEntry as WhitelistEntryModel;

/**
 * Class WhitelistEntry
 *
 * @package BitExpert\ForceCustomerLogin\Validator
 */
class WhitelistEntry
{
    /**
     * @param WhitelistEntryModel $whitelistEntry
     * @return bool
     * @throw \InvalidArgumentException If validation fails
     */
    public function validate(
        WhitelistEntryModel $whitelistEntry
    ) {
        $label = \strlen(\trim((string)$whitelistEntry->getLabel()));
        if (0 === $label) {
            throw new \InvalidArgumentException('Label value is too short.');
        }
        if (255 < $label) {
        if (0 === \strlen(\trim($whitelistEntry->getUrlRule()))) {
            throw new \InvalidArgumentException('Url Rule value is too short.');
        }

        if (!\is_bool($whitelistEntry->getEditable())) {
            throw new \InvalidArgumentException('Editable is no boolean value.');
        }

        $strategy = \strlen(\trim((string)$whitelistEntry->getStrategy()));
        if (0 === $strategy) {
            throw new \InvalidArgumentException('Strategy value is too short.');
        }
        if (255 < $strategy) {
            throw new \InvalidArgumentException('Strategy value is too long.');
        }

        if (!\is_bool($whitelistEntry->getEditable())) {
            throw new \InvalidArgumentException('Editable is no boolean value.');
        }

        return true;
    }
}

<MSG> Improved persisting action

<DFF> @@ -36,6 +36,9 @@ class WhitelistEntry
         if (0 === \strlen(\trim($whitelistEntry->getUrlRule()))) {
             throw new \InvalidArgumentException('Url Rule value is too short.');
         }
+        if (255 < \strlen(\trim($whitelistEntry->getUrlRule()))) {
+            throw new \InvalidArgumentException('Url Rule value is too long.');
+        }
 
         if (!\is_bool($whitelistEntry->getEditable())) {
             throw new \InvalidArgumentException('Editable is no boolean value.');

Improved persisting action