refactor: general code base refactor (#2950)

* refactor

* fix: bug in previous refactor

* chore: exclude phpcompat sniff due to bug in phpcompat

* fix: do not leak absolute paths

* refactor/fix: batch extensions checking, fix DOS issue
This commit is contained in:
Dag 2022-08-06 22:46:28 +02:00 committed by GitHub
parent b042412416
commit 2bbce8ebef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
45 changed files with 679 additions and 827 deletions

View file

@ -329,10 +329,10 @@ class FeedItem
$content = (string)$content;
}
if (!is_string($content)) {
Debug::log('Content must be a string!');
} else {
if (is_string($content)) {
$this->content = $content;
} else {
Debug::log('Content must be a string!');
}
return $this;
@ -361,11 +361,9 @@ class FeedItem
*/
public function setEnclosures($enclosures)
{
$this->enclosures = []; // Clear previous data
$this->enclosures = [];
if (!is_array($enclosures)) {
Debug::log('Enclosures must be an array!');
} else {
if (is_array($enclosures)) {
foreach ($enclosures as $enclosure) {
if (
!filter_var(
@ -379,6 +377,8 @@ class FeedItem
$this->enclosures[] = $enclosure;
}
}
} else {
Debug::log('Enclosures must be an array!');
}
return $this;
@ -407,11 +407,9 @@ class FeedItem
*/
public function setCategories($categories)
{
$this->categories = []; // Clear previous data
$this->categories = [];
if (!is_array($categories)) {
Debug::log('Categories must be an array!');
} else {
if (is_array($categories)) {
foreach ($categories as $category) {
if (!is_string($category)) {
Debug::log('Category must be a string!');
@ -419,6 +417,8 @@ class FeedItem
$this->categories[] = $category;
}
}
} else {
Debug::log('Categories must be an array!');
}
return $this;