Skip to content

Commit

Permalink
fix linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mrtnvgr committed Jul 18, 2023
1 parent b103bdd commit e162126
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions bridges/DoujinStyleBridge.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

class DoujinStyleBridge extends BridgeAbstract {
class DoujinStyleBridge extends BridgeAbstract
{
const NAME = 'DoujinStyle Bridge';
const URI = 'https://doujinstyle.com/';
const DESCRIPTION = 'Returns submissions from DoujinStyle';
Expand Down Expand Up @@ -45,13 +46,14 @@ class DoujinStyleBridge extends BridgeAbstract {
]
];

public function collectData() {
public function collectData()
{
$html = getSimpleHTMLDOM($this->getURI());
$html = defaultLinkTo($html, $this->getURI());

$submissions = $html->find('.gridBox .gridDetails');
foreach ($submissions as $submission) {
$item = array();
$item = [];

$item['uri'] = $submission->find('a', 0)->href;

Expand All @@ -70,11 +72,11 @@ public function collectData() {
$item['content'] = "<img src='$cover'/>";

$keys = [];
foreach ($content->find(".pageWrap .pageSpan1") as $key) {
$keys[] = $key->plaintext;
foreach ($content->find('.pageWrap .pageSpan') as $key) {
$keys[] = $key->plaintext;
}

$values = $content->find(".pageWrap .pageSpan2");
$values = $content->find('.pageWrap .pageSpan2');
$metadata = array_combine($keys, $values);

$format = 'Unknown';
Expand All @@ -89,11 +91,11 @@ public function collectData() {
case 'Tags:':
$item['categories'] = [];
foreach ($value->find('a') as $tag) {
$tag = str_replace("&#45;", "-", $tag->plaintext);
$tag = str_replace('&#45;', '-', $tag->plaintext);
$item['categories'][] = $tag;
}

$item['content'] .= '<br>Tags: ' . join(", ", $item['categories']);
$item['content'] .= '<br>Tags: ' . join(', ', $item['categories']);
break;
case 'Format:':
$item['content'] .= "<br>Format: $value->plaintext";
Expand All @@ -111,10 +113,11 @@ public function collectData() {
}
}

public function getURI() {
public function getURI()
{
$url = self::URI;

switch($this->queriedContext) {
switch ($this->queriedContext) {
case 'From search results':
$url .= '?p=search&type=blanket';
$url .= '&result=' . $this->getInput('query');
Expand All @@ -134,12 +137,12 @@ public function getURI() {
if ($this->getInput('ogg') == 1) {
$url .= '&format4=on';
}

break;
case 'Randomly selected items':
$url .= '?p=random';
break;
}

return $url;
}
}

0 comments on commit e162126

Please sign in to comment.