protected function normalizeRelativePathAtoms(array $atoms)
    {
        $resultingAtoms = array();
        $resultingAtomsCount = 0;
        $numAtoms = count($atoms);

        for ($i = 0; $i < $numAtoms; $i++) {
            if (AbstractPath::SELF_ATOM !== $atoms[$i]) {
                $resultingAtoms[] = $atoms[$i];
                $resultingAtomsCount++;
            }

            if (
                $resultingAtomsCount > 1 &&
                AbstractPath::PARENT_ATOM === $resultingAtoms[$resultingAtomsCount - 1] &&
                AbstractPath::PARENT_ATOM !== $resultingAtoms[$resultingAtomsCount - 2]
            ) {
                array_splice($resultingAtoms, $resultingAtomsCount - 2, 2);
                $resultingAtomsCount -= 2;
            }
        }

        if (count($resultingAtoms) < 1) {
            $resultingAtoms = array(AbstractPath::SELF_ATOM);
        }

        return $resultingAtoms;
    }
protected function normalizeRelativePathAtoms(array $atoms)
    {
        $resultingAtoms = array();
        $resultingAtomsCount = 0;
        $numAtoms = count($atoms);

        for ($i = 0; $i < $numAtoms; $i++) {
            if (AbstractPath::SELF_ATOM !== $atoms[$i]) {
                $resultingAtoms[] = $atoms[$i];
                $resultingAtomsCount++;
            }

            if (
                $resultingAtomsCount > 1 &&
                AbstractPath::PARENT_ATOM === $resultingAtoms[$resultingAtomsCount - 1] &&
                AbstractPath::PARENT_ATOM !== $resultingAtoms[$resultingAtomsCount - 2]
            ) {
                array_splice($resultingAtoms, $resultingAtomsCount - 2, 2);
                $resultingAtomsCount -= 2;
            }
        }

        if (count($resultingAtoms) < 1) {
            $resultingAtoms = array(AbstractPath::SELF_ATOM);
        }

        return $resultingAtoms;
    }
protected function normalizeRelativePathAtoms ( array $ atoms ) { $ resultingAtoms = array ( ) ; $ resultingAtomsCount = 0 ; $ numAtoms = count ( $ atoms ) ; for ( $ i = 0 ; $ i < $ numAtoms ; $ i ++ ) { if ( AbstractPath :: SELF_ATOM !== $ atoms [ $ i ] ) { $ resultingAtoms [ ] = $ atoms [ $ i ] ; $ resultingAtomsCount ++ ; } if ( $ resultingAtomsCount > 1 && AbstractPath :: PARENT_ATOM === $ resultingAtoms [ $ resultingAtomsCount - 1 ] && AbstractPath :: PARENT_ATOM !== $ resultingAtoms [ $ resultingAtomsCount - 2 ] ) { array_splice ( $ resultingAtoms , $ resultingAtomsCount - 2 , 2 ) ; $ resultingAtomsCount -= 2 ; } } if ( count ( $ resultingAtoms ) < 1 ) { $ resultingAtoms = array ( AbstractPath :: SELF_ATOM ) ; } return $ resultingAtoms ; }
Normalize the supplied path atoms for a relative path.

@param array<string> $atoms The path atoms to normalize.

@return array<string> The normalized path atoms.
Normalize the supplied path atoms for a relative path .