CoreFiles by mySites.guru
ExpressionLanguageProvider.php32 lines, 1,117 bytes, from Joomla_5.2.5-Stable-Full_Package.zip
Raw History Compare with 5.2.4
md5
3f09a89cd31df7386bdff2841672242c
sha1
7b1fa68e355fe3277c4ce9c3693d77a308dd33c1
sha256
f23b655ad6463c386e2fa13decf68f452e934249e34e82961a86829e23235ed2
<?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 63 releases, Joomla 5.1.0-beta1 to 6.0.0-alpha3. See them all, or every version of this file.