public function isValid() {
        if ($this->type == 'AND') {
            foreach ($this->dependencies as $dependency) {
                if (!$dependency->isValid())
                    return false;
            }
            return true;
        }

        if ($this->type == 'OR' ) {
            foreach ($this->dependencies as $dependency) {
                if ($dependency->isValid())
                    return true;
            }
            return false;
        }

        throw new RuntimeException('Unreachable code reached');
    }