Files
GoogleAnalytics4/Modules/Application/Model/articleTreeStructure.php
2024-11-25 18:48:39 +01:00

45 lines
1.1 KiB
PHP

<?php
namespace D3\GoogleAnalytics4\Modules\Application\Model;
trait articleTreeStructure
{
/**
* @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
)
);
}
}