models/classes/runner/OfflineQtiRunnerService.php
private function getSubIdentifiersRecursively($array, $identifiers)
    {
        $identifier = array_shift($identifiers);
        if (count($identifiers) > 0) {
            $result = [];

            foreach ($array[$identifier] as $key => $value) {
                $result[] = $this->getSubIdentifiersRecursively(
                    $array[$identifier][$key],
                    $identifiers
                );
            }

            return array_merge(...$result);
        }

        return array_keys($array[$identifier]);
    }
private function getSubIdentifiersRecursively($array, $identifiers)
    {
        $identifier = array_shift($identifiers);
        if (count($identifiers) > 0) {
            $result = [];

            foreach ($array[$identifier] as $key => $value) {
                $result[] = $this->getSubIdentifiersRecursively(
                    $array[$identifier][$key],
                    $identifiers
                );
            }

            return array_merge(...$result);
        }

        return array_keys($array[$identifier]);
    }
private function getSubIdentifiersRecursively ( $ array , $ identifiers ) { $ identifier = array_shift ( $ identifiers ) ; if ( count ( $ identifiers ) > 0 ) { $ result = [ ] ; foreach ( $ array [ $ identifier ] as $ key => $ value ) { $ result [ ] = $ this -> getSubIdentifiersRecursively ( $ array [ $ identifier ] [ $ key ] , $ identifiers ) ; } return array_merge ( ... $ result ) ; } return array_keys ( $ array [ $ identifier ] ) ; }
Calls itself recursively to return identifiers from nested arrays

@param $array
@param $identifiers
@return array
Calls itself recursively to return identifiers from nested arrays