CoreFiles by mySites.guru
ExpressionLanguageProvider.php32 lines, 1,118 bytes, from Joomla_5.4.4-Stable-Full_Package.zip
Raw History Compare with 5.4.3
md5
5479c97a667a80e2df39c7e4cbc7fe7a
sha1
8aac5662550c83e829fd9e60a636df966e3a559c
sha256
6b318301f7e86b2d82f16685357bbe08e89f66cf5693018e5effd2ea6818e659
<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Validator\Constraints;

use Symfony\Component\ExpressionLanguage\ExpressionFunction;
use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;

class ExpressionLanguageProvider implements ExpressionFunctionProviderInterface
{
    public function getFunctions(): array
    {
        return [
            new ExpressionFunction('is_valid', function (...$arguments) {
                return \sprintf(
                    '0 === $context->getValidator()->inContext($context)->validate(%s)->getViolations()->count()',
                    implode(', ', $arguments)
                );
            }, function (array $variables, ...$arguments): bool {
                return 0 === $variables['context']->getValidator()->inContext($variables['context'])->validate(...$arguments)->getViolations()->count();
            }),
        ];
    }
}

The same content is in 61 releases, Joomla 5.4.0-rc1 to 6.2.0-alpha1. See them all, or every version of this file.