mirror of
https://github.com/wiosna-dev/common-library.git
synced 2026-03-12 09:31:51 +01:00
Minor refactoring
This commit is contained in:
@@ -20,7 +20,7 @@ class Bundle
|
||||
* Returns path to view / template of given bundle
|
||||
*
|
||||
* @param string $viewPath Path of the view / template, e.g. "MyDirectory/my-template"
|
||||
* @param string $bundleName Name of the bundle, e.g. "MyExtraBundle"
|
||||
* @param string $bundleName Full name of the bundle, e.g. "MyExtraBundle"
|
||||
* @param string $extension (optional) Extension of the view / template
|
||||
* @return string|null
|
||||
*/
|
||||
|
||||
@@ -62,14 +62,14 @@ class Regex
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns information if given tax ID (in polish: NIP) is valid
|
||||
* Returns information if given tax ID is valid (in Poland it's named "NIP")
|
||||
*
|
||||
* @param string $taxidString Tax ID (NIP) string
|
||||
* @param string $taxIdString Tax ID (NIP) string
|
||||
* @return bool
|
||||
*/
|
||||
public static function isValidTaxid($taxidString)
|
||||
public static function isValidTaxId($taxIdString)
|
||||
{
|
||||
if (!empty($taxidString)) {
|
||||
if (!empty($taxIdString)) {
|
||||
$weights = [
|
||||
6,
|
||||
5,
|
||||
@@ -81,15 +81,15 @@ class Regex
|
||||
6,
|
||||
7,
|
||||
];
|
||||
$taxid = preg_replace('/[\s-]/', '', $taxidString);
|
||||
$taxId = preg_replace('/[\s-]/', '', $taxIdString);
|
||||
$sum = 0;
|
||||
|
||||
if (10 == strlen($taxid) && is_numeric($taxid)) {
|
||||
if (10 == strlen($taxId) && is_numeric($taxId)) {
|
||||
for ($x = 0; $x <= 8; ++$x) {
|
||||
$sum += $taxid[$x] * $weights[$x];
|
||||
$sum += $taxId[$x] * $weights[$x];
|
||||
}
|
||||
|
||||
if ((($sum % 11) % 10) == $taxid[9]) {
|
||||
if ((($sum % 11) % 10) == $taxId[9]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user