MagpieFromSimplePie::increment_element PHP Method

increment_element() public method

MagpieFromSimplePie::increment_element
public increment_element ( &$data, string $childTag, string $ns, array $path )
$childTag string
$ns string
$path array
    function increment_element(&$data, $childTag, $ns, $path)
    {
        $counterIndex = strtolower(implode('_', array_merge($path, array($childTag . '#'))));
        if ($this->is_namespaced($ns)) {
            if (!isset($data[$ns])) {
                $data[$ns] = array();
            }
            if (!isset($data[$ns][$counterIndex])) {
                $data[$ns][$counterIndex] = 0;
            }
            $data[$ns][$counterIndex] += 1;
            $N = $data[$ns][$counterIndex];
        } else {
            if (!isset($data[$counterIndex])) {
                $data[$counterIndex] = 0;
            }
            $data[$counterIndex] += 1;
            $N = $data[$counterIndex];
        }
        if ($N > 1) {
            $childTag .= '#' . $N;
        }
        return $childTag;
    }