Checks to see if a file has been uploaded.

@param string $draftitemid The draft id
@return bool True if files exist, false if not.
490322
public static function file_uploaded($draftitemid) {
        $draftareafiles = file_get_drafarea_files($draftitemid);
        do {
            $draftareafile = array_shift($draftareafiles->list);
        } while ($draftareafile !== null && $draftareafile->filename == '.');
        if ($draftareafile === null) {
            return false;
        }
        return true;
    }
1128570
private function checkFormIdInPost($request)
    {
        if (!isset($request::$post[self::PARAMETER_FORM_ID])) {
            return false;
        }

        if (!$request::$post[self::PARAMETER_FORM_ID] === $this->formId) {
            return false;
        }

        return true;
    }
383979
public static function hasValidMimeType(UploadedFile $uploadedFile, array $arrMimeType) : bool
    {
        return count($arrMimeType) > 0 ? in_array($uploadedFile->getMimeType(), $arrMimeType) : true;
    }
829345
public function hasNextPost()
    {
        return ($this->nextPost && $this->nextPost->ID !== $this->get('ID')) ? true : false;
    }
326609
private function executeCommit(AbstractClassContent $content, Revision $draft)
    {
        $content->setDraft(null);

        if ($content instanceof ContentSet) {
            $content->clear();
            while ($subcontent = $draft->next()) {
                if ($subcontent instanceof AbstractClassContent) {
                    $subcontent = $this->entityManager->getRepository(ClassUtils::getRealClass($subcontent))->load($subcontent);
                    if (null !== $subcontent) {
                        $content->push($subcontent);
                    }
                }
            }
        } else {
            foreach ($draft->getData() as $key => $values) {
                $values = is_array($values) ? $values : [$values];
                foreach ($values as &$subcontent) {
                    if ($subcontent instanceof AbstractClassContent) {
                        $subcontent = $this->entityManager->getRepository(ClassUtils::getRealClass($subcontent))
                            ->load($subcontent)
                        ;
                    }
                }

                unset($subcontent);
                if (in_array('Element\Keyword', $content->getAccept()[$key])) {
                    $this->entityManager
                        ->getRepository('BackBee\ClassContent\Element\Keyword')
                        ->cleanKeywordLinks($content, $values);
                }

                $content->$key = $values;
            }
        }

        $draft->commit();
        $content->setLabel($draft->getLabel());

        foreach ($draft->getAllParams() as $key => $params) {
            $content->setParam($key, $params['value']);
        }

        $content->setRevision($draft->getRevision())
            ->setState(AbstractClassContent::STATE_NORMAL)
            ->addRevision($draft)
        ;

        return $this;
    }
1201636
public function hasItem($nameOrId)
    {
        foreach ($this->getItems() as $item) {
            if ($item['name'] === $nameOrId || (isset($item['id']) && $item['id'] === $nameOrId)) {
                return true;
            }
        }

        return false;
    }
1204489
public function hasItem($identifier) {
        return isset($this->itemsPool[$this->prefix . '.' . $identifier]) || isset($this->itemsPool[$identifier]);
    }
1351475
private function prepareDraftForCommit(AbstractClassContent $content, Revision $draft, array $data)
    {
        if ($content instanceof ContentSet) {
            if (!isset($data['elements']) || false === $data['elements']) {
                $draft->clear();
                foreach ($content->getData() as $element) {
                    $draft->push($element);
                }
            }
        } elseif (AbstractClassContent::STATE_NORMAL === $content->getState()) {
            foreach ($content->getData() as $key => $element) {
                if (!isset($data['elements']) || !in_array($key, $data['elements'])) {
                    $draft->$key = $content->$key;
                }
            }
        }

        if (isset($data['parameters'])) {
            foreach ($content->getAllParams() as $key => $params) {
                if (!in_array($key, $data['parameters'])) {
                    $draft->setParam($key, $content->getParamValue($key));
                }
            }
        }

        if (isset($data['message'])) {
            $draft->setComment($data['message']);
        }

        return $this;
    }
1034518
public function hasDocument(string $id): bool
    {
        if (isset($this->documents[$id])) {
            return true;
        }

        $path = $this->getDocumentPath($id);

        if ($this->filesystem->has($path)) {
            $info = $this->filesystem->getMetadata($path);

            return $info['type'] === 'file';
        }

        return false;
    }
668327
private function checkFormIdInSession()
    {
        if (!isset($_SESSION[self::SESSION_PARAMETER_FORM_COMPONENT][$this->formParameterName][self::PARAMETER_FORM_ID])) {
            return false;
        }

        if (!$_SESSION[self::SESSION_PARAMETER_FORM_COMPONENT][$this->formParameterName][self::PARAMETER_FORM_ID] === $this->formId) {
            return false;
        }

        return true;
    }
1034128
public function getFilesArrayItem($fileId)
    {
        return isset($this->filesArray[$fileId]) ? $this->filesArray[$fileId] : false;
    }
1212226
public function findById($id, $draft = true)
    {
        if ($draft) {
            $this->setDraftVersionFilter(! $draft);
        }

        $blocks = $this->getRepository()->findById($id);

        if ($draft) {
            foreach ($blocks as $block) {
                if (null !== $revision = $this->revisionManager->getDraftRevision($block)) {
                    $this->revisionManager->revert($block, $revision);
                }
            }
        }

        return $blocks;
    }
910894
public static function add_user_private_files($draftid) {
        global $CFG, $USER;
        require_once($CFG->libdir . "/filelib.php");

        $params = self::validate_parameters(self::add_user_private_files_parameters(), array('draftid' => $draftid));

        if (isguestuser()) {
            throw new invalid_parameter_exception('Guest users cannot upload files');
        }

        $context = context_user::instance($USER->id);
        require_capability('moodle/user:manageownfiles', $context);

        $maxbytes = $CFG->userquota;
        $maxareabytes = $CFG->userquota;
        if (has_capability('moodle/user:ignoreuserquota', $context)) {
            $maxbytes = USER_CAN_IGNORE_FILE_SIZE_LIMITS;
            $maxareabytes = FILE_AREA_MAX_BYTES_UNLIMITED;
        }

        $options = array('subdirs' => 1,
                         'maxbytes' => $maxbytes,
                         'maxfiles' => -1,
                         'areamaxbytes' => $maxareabytes);

        file_merge_files_from_draft_area_into_filearea($draftid, $context->id, 'user', 'private', 0, $options);

        return null;
    }
1073212
private function didAnyFileChange(array $changedFiles) : bool
    {
        foreach ($this->filesToWatch as $file) {
            if (in_array($file, $changedFiles)) {
                return true;
            }
        }
        return false;
    }
477749
public function GetID($DraftID) {
      $this->DraftQuery();
      return $this->SQL
         ->Where('d.DraftID', $DraftID)
         ->Get()
         ->FirstRow();
   }
586753
public function hasNext(): bool
    {
        return !empty($this->entries) && ($this->getStartIndex() + $this->getItemsPerPage() - 1 < $this->getTotalResults());
    }
16424
public function isAncestor(ItemInterface $item, $depth = null): bool
    {
        $request = $this->request_stack->getCurrentRequest();

        return 0 === strpos($request->getPathInfo(), $item->getUri());
    }