GoogleAnalytics4/Modules/Application/Model/Category.php
MaxBUhe 5d5b3459cd [Changed] phpStan - set level to 4, clear files by level
Also changed method, to get the category for items (products)
2024-01-17 15:53:51 +01:00

44 lines
1.1 KiB
PHP

<?php
namespace D3\GoogleAnalytics4\Modules\Application\Model;
class Category extends Category_parent
{
/**
* @param int $indexOfArray
* @return string
*/
public function getSplitCategoryArray(int $indexOfArray = -1, bool $bShallTakeStd = false) :string
{
if ($bShallTakeStd){
$splitCatArray =
array_values(
array_filter(
explode(
'/',
trim(
parse_url(
$this->getLink(),
5
)
)
)
)
);
if (($indexOfArray >= 0) and (false === empty($splitCatArray[$indexOfArray]))){
return $splitCatArray[$indexOfArray];
}else{
return "";
}
}
return
trim(
parse_url(
$this->getLink(),
5
)
);
}
}