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

View File

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