src/ResourceValidationsTrait.php
protected function getKnownFormat(string $formatName)
    {
        $knownFormats = [
            "email" => "/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,}$/ix",
            "swiftCode" => "/^[A-Za-z]{6}[A-Za-z0-9]{2}[0-9A-Za-z]{0,3}$/",
            "uri" => "/^\w+:(\/\/)?[^\s]+$/",
            "url" => "/^((\w+:)?\/\/[^\s\/]+)?(\/[^\s]+)*\/?$/",
        ];

        if (array_key_exists($formatName, $knownFormats)) {
            return $knownFormats[$formatName];
        } else {
            return null;
        }
    }
protected function getKnownFormat(string $formatName)
    {
        $knownFormats = [
            "email" => "/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,}$/ix",
            "swiftCode" => "/^[A-Za-z]{6}[A-Za-z0-9]{2}[0-9A-Za-z]{0,3}$/",
            "uri" => "/^\w+:(\/\/)?[^\s]+$/",
            "url" => "/^((\w+:)?\/\/[^\s\/]+)?(\/[^\s]+)*\/?$/",
        ];

        if (array_key_exists($formatName, $knownFormats)) {
            return $knownFormats[$formatName];
        } else {
            return null;
        }
    }
protected function getKnownFormat ( string $ formatName ) { $ knownFormats = [ "email" => "/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,}$/ix" , "swiftCode" => "/^[A-Za-z]{6}[A-Za-z0-9]{2}[0-9A-Za-z]{0,3}$/" , "uri" => "/^\w+:(\/\/)?[^\s]+$/" , "url" => "/^((\w+:)?\/\/[^\s\/]+)?(\/[^\s]+)*\/?$/" , ] ; if ( array_key_exists ( $ formatName , $ knownFormats ) ) { return $ knownFormats [ $ formatName ] ; } else { return null ; } }
Returns a list of known formats for validation

@param string $formatName The name of the format to get
@return string|null The regexp string representing the requested format, or null if format is not known
Returns a list of known formats for validation