fix phpstan/phpcs

This commit is contained in:
Dennis Eichhorn 2021-06-26 14:38:08 +02:00
parent 83798b7545
commit e96311893f
3 changed files with 17 additions and 13 deletions

View File

@ -309,7 +309,9 @@ export class Form
{
action = typeof action !== 'undefined' ? action : null;
if (!form.isValid()) {
const data = form.getData();
if (!form.isValid(data)) {
this.app.notifyManager.send(
new NotificationMessage(
NotificationLevel.INFO,
@ -334,7 +336,7 @@ export class Form
const request = new Request(),
self = this;
request.setData(form.getData());
request.setData(data);
request.setType(RequestType.FORM_DATA);
request.setUri(action ? action : form.getAction());
request.setMethod(form.getMethod());
@ -347,6 +349,7 @@ export class Form
const doc = document.createElement('a');
doc.style = 'display: none';
document.body.appendChild(doc);
const url = window.URL.createObjectURL(blob);
doc.href = url;
@ -355,6 +358,7 @@ export class Form
if (disposition && disposition.indexOf('attachment') !== -1) {
const filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
const matches = filenameRegex.exec(disposition);
if (matches !== null && matches[1]) {
filename = matches[1].replace(/['"]/g, '');
}

View File

@ -482,10 +482,10 @@ export class FormView
*
* @since 1.0.0
*/
isValid ()
isValid (data)
{
const elements = this.getFormElements(),
length = elements.length;
const elements = typeof data === 'undefined' ? this.getFormElements() : data;
const length = elements.length;
try {
for (let i = 0; i < length; ++i) {