Provides a way to validate local Pact JSON files.

@param array $files paths to pact json files

@throws FileDownloadFailureException
@throws NoDownloaderFoundException

@return Verifier
962426
public function verifyFiles(array $files): self
    {
        $arguments = \array_merge($files, $this->getArguments());

        $this->verifyAction($arguments);

        return $this;
    }
1078884
public function setMinified(array $files)
    {
        if (!empty($files)) {
            foreach ($files as $_file) {
                $this->addMinified($_file);
            }
        }
        return $this;
    }
395982
protected function validateTypeCache($type, $files)
    {
        // If the files isn't cached we have to cache the file
        $hash = $this->getTypeHash($type);
        if (!isset($this->cachedFiles[$hash])) {
            return false;
        } 
        
        $data = $this->cachedFiles[$hash];
        $checksums = $data['checksums'];

        // Are all files existing?
        foreach ($files as $file) {
            if (!file_exists($file->getFileName())) {
                return false;
            }
            
            $fileHash = $this->getHash($file->getFileName());
            $contentHash = md5_file($file->getFileName());
            if (!isset($checksums[$fileHash]) || $contentHash !== $checksums[$fileHash]) {
                return false;
            }
        }
        
        return true;
    }
194840
public function validation($data, $files) {

        $pluginman = core_plugin_manager::instance();
        $errors = parent::validation($data, $files);

        if (!empty($data['plugintype'])) {
            if (!$pluginman->is_plugintype_writable($data['plugintype'])) {
                $path = $pluginman->get_plugintype_root($data['plugintype']);
                $errors['plugintype'] = get_string('permcheckresultno', 'tool_installaddon', array('path' => $path));
            }
        }

        return $errors;
    }
1005644
protected function checkForConflicts(array $files)
    {
        $conflicts = $this->concentrator->getConflicts($files);
        if (count($conflicts) > 0) {
            $conflictList = '';
            $count = 0;
            foreach ($conflicts as $file => $conflict) {
                $conflictList.= sprintf(
                    "\n- %s conflicts with %s",
                    $file,
                    implode(', ', $conflict)
                );
                $count++;
            }
            throw new Exception(
                'The following conflicts were detected: ' . $conflictList
            );
        }
    }
1154441
public function validation($data, $files) {
        global $USER;

        if ($errors = parent::validation($data, $files)) {
            return $errors;
        }

        $usercontext = context_user::instance($USER->id);
        $fs = get_file_storage();

        if (!$files = $fs->get_area_files($usercontext->id, 'user', 'draft', $data['package'], 'id', false)) {
            if (!$this->current->instance) {
                $errors['package'] = get_string('required');
                return $errors;
            }
        } else {
            $file = reset($files);
            if ($file->get_mimetype() != 'application/zip') {
                $errors['package'] = get_string('invalidfiletype', 'error', '', $file);
                // Better delete current file, it is not usable anyway.
                $fs->delete_area_files($usercontext->id, 'user', 'draft', $data['package']);
            }
        }

        return $errors;
    }
1182480
public function validation($data, $files) {
        $errors = parent::validation($data, $files);

        // We don't need to verify the email address if we're clearing a pending email verification attempt.
        if (!isset($data['revertbutton'])) {
            $check = new stdClass();
            $check->backpackurl = BADGE_BACKPACKURL;
            $check->email = $data['email'];

            $bp = new OpenBadgesBackpackHandler($check);
            $request = $bp->curl_request('user');
            if (isset($request->status) && $request->status == 'missing') {
                $errors['email'] = get_string('error:nosuchuser', 'badges');
            } else if (!isset($request->status) || $request->status !== 'okay') {
                $errors['email'] = get_string('backpackconnectionunexpectedresult', 'badges');
            }
        }
        return $errors;
    }
271622
public function addFiles(array $files)
    {
        $added_files = 0;
        try {
            foreach ($files as $localName => $filename) {
                if (!is_null($filename)) {
                    $this->sevenZip->addEntry($filename);
                    $this->sevenZip->renameEntry($filename, $localName);
                    $added_files++;
                }
            }
        } catch (Exception $e) {
            throw new Exception('Could not modify archive: '.$e->getMessage(), $e->getCode(), $e);
        }
        return $added_files;
    }
373311
public function setFiles(array $files)
    {
        foreach ($files as $file) {
            if (is_file($file)) {
                $file = new SplFileInfo($file, $file, $file);
            }

            if (!($file instanceof SplFileInfo)) {
                throw new InvalidArgumentException("File $file not exists.");
            }

            $this->files[$file->getRealPath()] = $file;
        }

        return $this;
    }
773612
protected function processJSONValidations($file)
    {
        $json = File::get($file);
        $fields = json_decode($json);

        if (!property_exists($fields, 'validations')) {
            return '';
        }

        $validationsString = '';
        foreach ($fields->validations as $validation) {
            $validationsString .= $validation->field . '#' . $validation->rules . ';';
        }

        $validationsString = rtrim($validationsString, ';');

        return $validationsString;
    }
588175
public function validation($data, $files) {
        $errors = parent::validation($data, $files);

        if (isset($data['clustered']) && ($data['clustered'] == 1)) {
            // Set servers is required with in cluster mode.
            if (!isset($data['setservers'])) {
                $errors['setservers'] = get_string('required');
            } else {
                $trimmed = trim($data['setservers']);
                if (empty($trimmed)) {
                    $errors['setservers'] = get_string('required');
                }
            }

            $validservers = false;
            if (isset($data['servers'])) {
                $servers = trim($data['servers']);
                $servers = explode("\n", $servers);
                if (count($servers) === 1) {
                    $validservers = true;
                }
            }

            if (!$validservers) {
                $errors['servers'] = get_string('serversclusterinvalid', 'cachestore_memcached');
            }
        }

        return $errors;
    }
553050
public static function loadRoutingFiles(array $files)
    {
        $routing = new Structure();

        foreach ($files as $file) {
            if (!in_array(pathinfo($file, PATHINFO_EXTENSION), ['json', 'yml', 'yaml'])) {
                continue;
            }

            $routing = $routing->loadFile($file, pathinfo($file, PATHINFO_EXTENSION));
        }

        return $routing->toArray();
    }
53394
public function filesExist($files) {
    foreach ($files as $file) {
      if (!file_exists($file)) {
        $this->logger->warning("Required file $file does not exist.");
        return FALSE;
      }
    }

    return TRUE;
  }
159797
private function setExists(array $files)
    {
        $exists = false;
        foreach ($files as $file) {
            if (true === (bool) preg_match('/^composer\.(json|lock)$/', $file->value())) {
                $exists = true;
            }
        }

        return $exists;
    }
1305044
private function loadConfigItems(array $files = [])
        {
            $configs = [];
            foreach ($files as $name => $path) {
                if (file_exists($path)) {
                    $return = include $path;
                    if (is_array($return)) {
                        $configs[$name] = $return;
                    } else {
                        throw new ThereIsntReturnedValueException(
                            sprintf(
                                '%s ayar dosyasında herhangi bir değer döndürülmemiş
                                 veya yanlış ayar döndürüldü',
                                $path
                            )
                        );
                    }
                }
            }

            return $configs;
        }
1244925
public function validation($data, $files) {
        $errors = parent::validation($data, $files);
        if ($data['issueremail'] && !validate_email($data['issueremail'])) {
            $errors['issueremail'] = get_string('invalidemail');
        }
        if ($data['issuerurl'] && !preg_match('@^https?://.+@', $data['issuerurl'])) {
            $errors['issuerurl'] = get_string('invalidurl', 'badges');
        }
        if ($data['claimid'] && !preg_match('@^https?://.+@', $data['claimid'])) {
            $errors['claimid'] = get_string('invalidurl', 'badges');
        }
        return $errors;
    }
141713
public function validateAssetFile($file)
    {
        $filePath = substr($file, 1);

        if (!is_file($filePath))
            throw new FileNotFoundException("File ".$filePath." was not found");

        $path_parts = pathinfo($filePath);

        if( !in_array($path_parts['extension'], array(
            "js", "css", "png", "jpg", "jpeg", "gif", "ttf", "otf", "woff"
        )))
            throw new WrongFileExtensionException("Wrong file format\n
            Supported formats: js, css, png, jpg, jpeg, gif, ttf, otf, woff");
    }