protected function checkMissingParentsDependencies(array $choice): array
    {
        $missing = [];
        $depends = (array)$choice['depends'];
        foreach ($depends as $dependency) {
            if (!isset($this->selections[$dependency])) {
                foreach ($this->choices as $choice) {
                    if (is_array($choice) && $choice['key'] == $dependency) {
                        $missing[] = $choice['name'];
                        break;
                    }
                }
            }
        }
        return $missing;
    }
protected function checkMissingParentsDependencies(array $choice): array
    {
        $missing = [];
        $depends = (array)$choice['depends'];
        foreach ($depends as $dependency) {
            if (!isset($this->selections[$dependency])) {
                foreach ($this->choices as $choice) {
                    if (is_array($choice) && $choice['key'] == $dependency) {
                        $missing[] = $choice['name'];
                        break;
                    }
                }
            }
        }
        return $missing;
    }
protected function checkMissingParentsDependencies ( array $ choice ) : array { $ missing = [ ] ; $ depends = ( array ) $ choice [ 'depends' ] ; foreach ( $ depends as $ dependency ) { if ( ! isset ( $ this -> selections [ $ dependency ] ) ) { foreach ( $ this -> choices as $ choice ) { if ( is_array ( $ choice ) && $ choice [ 'key' ] == $ dependency ) { $ missing [ ] = $ choice [ 'name' ] ; break ; } } } } return $ missing ; }
Make sure all dependencies are already selected

@param array $choice Checked choice

@return array
Make sure all dependencies are already selected