CoreFiles by mySites.guru
StringPrepMatchingRule.php25 lines, 615 bytes, from Joomla_5.4.11-Stable-Full_Package.zip
Raw History Compare with 5.4.10
md5
d3790671bd5890829b7dd23f47cb19b1
sha1
b6eb9af8ddbb112f6a400fad57f4f09a6641342d
sha256
34cf53a5348c4d47fd5569029800107afd91c52f593586bde8c3d15530707ddb
<?php

declare(strict_types=1);

namespace SpomkyLabs\Pki\X501\MatchingRule;

use SpomkyLabs\Pki\X501\StringPrep\StringPreparer;

/**
 * Base class for matching rules employing string preparement semantics.
 */
abstract class StringPrepMatchingRule extends MatchingRule
{
    protected function __construct(
        private readonly StringPreparer $preparer
    ) {
    }

    public function compare(string $assertion, string $value): ?bool
    {
        $assertion = $this->preparer->prepare($assertion);
        $value = $this->preparer->prepare($value);
        return strcmp($assertion, $value) === 0;
    }
}

The same content is in 158 releases, Joomla 5.0.0-alpha1 to 6.3.0-alpha1. See them all, or every version of this file.