Skip to content

France Metropolitan Lyon Region Validation #63

@SLourenco

Description

@SLourenco

On the region digits, there is at least one case Metropolitan Lyon which has a letter in the COG.

'69M' => 'Metropolitan Lyon',

But the validation algorithm for France will throw a cast error when trying to parse an id that includes that COG.

public function validate(string $id): bool
{
  $id = $this->sanitize($id);

  $checksum = (int) substr($id, -2);
  $id = substr($id, 0, -2);

  $result = 97 - ((int) $id % 97); // cast error for an id like 1510269M02043

  return $checksum === $result;
}

I can't find any documentation on how to perform the control digit calculation for a scenario like that though.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghelp wantedExtra attention is needed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions