mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 21:22:40 +00:00
Style fixes
This commit is contained in:
parent
b9821d925a
commit
6ef13d0880
11 changed files with 145 additions and 140 deletions
|
@ -136,6 +136,7 @@ USAGE_TEXT;
|
|||
} else {
|
||||
return $this->userAddOrSetPassword("passwordSet", $args["<username>"], $args["<password>"], $args["--oldpass"]);
|
||||
}
|
||||
// no break
|
||||
case "unset-pass":
|
||||
if ($args['--fever']) {
|
||||
$this->getInstance(Fever::class)->unregister($args["<username>"]);
|
||||
|
|
|
@ -153,7 +153,7 @@ class Database {
|
|||
$params = [];
|
||||
$count = 0;
|
||||
$convType = Db\AbstractStatement::TYPE_NORM_MAP[Statement::TYPES[$type]];
|
||||
foreach($values as $v) {
|
||||
foreach ($values as $v) {
|
||||
$v = ValueInfo::normalize($v, $convType, null, "sql");
|
||||
if (is_null($v)) {
|
||||
// nulls are pointless to have
|
||||
|
@ -200,7 +200,7 @@ class Database {
|
|||
$values = [];
|
||||
$like = $this->db->sqlToken("like");
|
||||
$embedSet = sizeof($terms) > ((int) (self::LIMIT_SET_SIZE / sizeof($cols)));
|
||||
foreach($terms as $term) {
|
||||
foreach ($terms as $term) {
|
||||
$embedTerm = ($embedSet && strlen($term) <= self::LIMIT_SET_STRING_LENGTH);
|
||||
$term = str_replace(["%", "_", "^"], ["^%", "^_", "^^"], $term);
|
||||
$term = "%$term%";
|
||||
|
@ -1406,7 +1406,7 @@ class Database {
|
|||
$q->setWhere("coalesce(label_stats.assigned,0) $op 0");
|
||||
}
|
||||
if ($context->label() || $context->not->label() || $context->labelName() || $context->not->labelName()) {
|
||||
$q->setCTE("labelled(article,label_id,label_name)","SELECT m.article, l.id, l.name from arsse_label_members as m join arsse_labels as l on l.id = m.label where l.owner = ? and m.assigned = 1", "str", $user);
|
||||
$q->setCTE("labelled(article,label_id,label_name)", "SELECT m.article, l.id, l.name from arsse_label_members as m join arsse_labels as l on l.id = m.label where l.owner = ? and m.assigned = 1", "str", $user);
|
||||
if ($context->label()) {
|
||||
$q->setWhere("arsse_articles.id in (select article from labelled where label_id = ?)", "int", $context->label);
|
||||
}
|
||||
|
@ -1421,7 +1421,7 @@ class Database {
|
|||
}
|
||||
}
|
||||
if ($context->tag() || $context->not->tag() || $context->tagName() || $context->not->tagName()) {
|
||||
$q->setCTE("tagged(id,name,subscription)","SELECT arsse_tags.id, arsse_tags.name, arsse_tag_members.subscription FROM arsse_tag_members join arsse_tags on arsse_tags.id = arsse_tag_members.tag WHERE arsse_tags.owner = ? and assigned = 1", "str", $user);
|
||||
$q->setCTE("tagged(id,name,subscription)", "SELECT arsse_tags.id, arsse_tags.name, arsse_tag_members.subscription FROM arsse_tag_members join arsse_tags on arsse_tags.id = arsse_tag_members.tag WHERE arsse_tags.owner = ? and assigned = 1", "str", $user);
|
||||
if ($context->tag()) {
|
||||
$q->setWhere("arsse_subscriptions.id in (select subscription from tagged where id = ?)", "int", $context->tag);
|
||||
}
|
||||
|
|
|
@ -138,7 +138,7 @@ class OPML {
|
|||
return true;
|
||||
}
|
||||
|
||||
protected function parse(string $opml, bool $flat): array {
|
||||
public function parse(string $opml, bool $flat): array {
|
||||
$d = new \DOMDocument;
|
||||
if (!@$d->loadXML($opml)) {
|
||||
// not a valid XML document
|
||||
|
|
|
@ -82,6 +82,7 @@ class Search {
|
|||
$state = self::STATE_IN_TOKEN_OR_TAG;
|
||||
continue 3;
|
||||
}
|
||||
// no break
|
||||
case self::STATE_BEFORE_TOKEN_QUOTED:
|
||||
switch ($char) {
|
||||
case "":
|
||||
|
@ -130,6 +131,7 @@ class Search {
|
|||
$state = self::STATE_IN_TOKEN_OR_TAG_QUOTED;
|
||||
continue 3;
|
||||
}
|
||||
// no break
|
||||
case self::STATE_IN_DATE:
|
||||
while ($pos < $stop && $search[$pos] !== " ") {
|
||||
$buffer .= $search[$pos++];
|
||||
|
@ -169,6 +171,7 @@ class Search {
|
|||
$buffer .= $char;
|
||||
continue 3;
|
||||
}
|
||||
// no break
|
||||
case self::STATE_IN_TOKEN:
|
||||
while ($pos < $stop && $search[$pos] !== " ") {
|
||||
$buffer .= $search[$pos++];
|
||||
|
@ -214,6 +217,7 @@ class Search {
|
|||
$buffer .= $char;
|
||||
continue 3;
|
||||
}
|
||||
// no break
|
||||
case self::STATE_IN_TOKEN_OR_TAG:
|
||||
switch ($char) {
|
||||
case "":
|
||||
|
@ -223,7 +227,7 @@ class Search {
|
|||
$flag_negative = false;
|
||||
$buffer = $tag = "";
|
||||
continue 3;
|
||||
case ":";
|
||||
case ":":
|
||||
$tag = $buffer;
|
||||
$buffer = "";
|
||||
$state = self::STATE_IN_TOKEN;
|
||||
|
@ -232,6 +236,7 @@ class Search {
|
|||
$buffer .= $char;
|
||||
continue 3;
|
||||
}
|
||||
// no break
|
||||
case self::STATE_IN_TOKEN_OR_TAG_QUOTED:
|
||||
switch ($char) {
|
||||
case "":
|
||||
|
@ -267,6 +272,7 @@ class Search {
|
|||
$buffer .= $char;
|
||||
continue 3;
|
||||
}
|
||||
// no break
|
||||
default:
|
||||
throw new \Exception; // @codeCoverageIgnore
|
||||
}
|
||||
|
|
|
@ -491,7 +491,7 @@ trait SeriesArticle {
|
|||
'Excluded folder tree' => [(new Context)->not->folder(1), [1,2,3,4,19,20]],
|
||||
'Excluding label ID 2' => [(new Context)->not->label(2), [2,3,4,6,7,8,19]],
|
||||
'Excluding label "Fascinating"' => [(new Context)->not->labelName("Fascinating"), [2,3,4,6,7,8,19]],
|
||||
'Search 501 terms' => [(new Context)->searchTerms(array_merge(range(1,500),[str_repeat("a", 1000)])), []],
|
||||
'Search 501 terms' => [(new Context)->searchTerms(array_merge(range(1, 500), [str_repeat("a", 1000)])), []],
|
||||
'With tag ID 1' => [(new Context)->tag(1), [5,6,7,8]],
|
||||
'With tag ID 5' => [(new Context)->tag(5), [7,8,19,20]],
|
||||
'With tag "Technology"' => [(new Context)->tagName("Technology"), [5,6,7,8]],
|
||||
|
|
|
@ -10,7 +10,6 @@ use JKingWeb\Arsse\ImportExport\OPML;
|
|||
use JKingWeb\Arsse\ImportExport\Exception;
|
||||
use org\bovigo\vfs\vfsStream;
|
||||
|
||||
|
||||
/** @covers \JKingWeb\Arsse\ImportExport\OPML<extended> */
|
||||
class TestOPMLFile extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||
protected $vfs;
|
||||
|
|
|
@ -26,7 +26,6 @@ use Zend\Diactoros\Response\EmptyResponse;
|
|||
|
||||
/** @covers \JKingWeb\Arsse\REST\Fever\API<extended> */
|
||||
class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||
|
||||
protected function v($value) {
|
||||
return $value;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue