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());
@ -344,17 +346,19 @@ export class Form
if (xhr.getResponseHeader('content-type') === 'application/octet-stream') { if (xhr.getResponseHeader('content-type') === 'application/octet-stream') {
const blob = new Blob([xhr.response], { type: 'application/octet-stream' }); const blob = new Blob([xhr.response], { type: 'application/octet-stream' });
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;
const disposition = xhr.getResponseHeader('content-disposition'); const disposition = xhr.getResponseHeader('content-disposition');
let filename = ''; let filename = '';
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

@ -373,10 +373,10 @@ export class Table
{ {
checkbox.addEventListener('click', function (event) checkbox.addEventListener('click', function (event)
{ {
const columnId = checkbox.closest('td').cellIndex; const columnId = checkbox.closest('td').cellIndex;
const rows = checkbox.closest('table').querySelectorAll('tbody tr'); const rows = checkbox.closest('table').querySelectorAll('tbody tr');
const rowLength = rows.length; const rowLength = rows.length;
const status = checkbox.checked; const status = checkbox.checked;
for (let i = 0; i < rowLength; ++i) { for (let i = 0; i < rowLength; ++i) {
const box = rows[i].cells[columnId].querySelector('input[type=checkbox]'); const box = rows[i].cells[columnId].querySelector('input[type=checkbox]');

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) {