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
0ef606aa03
commit
e3d2215920
11 changed files with 145 additions and 139 deletions
|
@ -128,6 +128,7 @@ USAGE_TEXT;
|
||||||
} else {
|
} else {
|
||||||
return $this->userAddOrSetPassword("passwordSet", $args["<username>"], $args["<password>"], $args["--oldpass"]);
|
return $this->userAddOrSetPassword("passwordSet", $args["<username>"], $args["<password>"], $args["--oldpass"]);
|
||||||
}
|
}
|
||||||
|
// no break
|
||||||
case "unset-pass":
|
case "unset-pass":
|
||||||
if ($args['--fever']) {
|
if ($args['--fever']) {
|
||||||
$this->getFever()->unregister($args["<username>"]);
|
$this->getFever()->unregister($args["<username>"]);
|
||||||
|
|
|
@ -87,7 +87,7 @@ class ExclusionContext {
|
||||||
$spec[$a] = null;
|
$spec[$a] = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return array_values(array_unique(array_filter($spec, function ($v) {
|
return array_values(array_unique(array_filter($spec, function($v) {
|
||||||
return !is_null($v);
|
return !is_null($v);
|
||||||
})));
|
})));
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,7 @@ class Database {
|
||||||
$params = [];
|
$params = [];
|
||||||
$count = 0;
|
$count = 0;
|
||||||
$convType = Db\AbstractStatement::TYPE_NORM_MAP[Statement::TYPES[$type]];
|
$convType = Db\AbstractStatement::TYPE_NORM_MAP[Statement::TYPES[$type]];
|
||||||
foreach($values as $v) {
|
foreach ($values as $v) {
|
||||||
$v = ValueInfo::normalize($v, $convType, null, "sql");
|
$v = ValueInfo::normalize($v, $convType, null, "sql");
|
||||||
if (is_null($v)) {
|
if (is_null($v)) {
|
||||||
// nulls are pointless to have
|
// nulls are pointless to have
|
||||||
|
@ -194,7 +194,7 @@ class Database {
|
||||||
$values = [];
|
$values = [];
|
||||||
$like = $this->db->sqlToken("like");
|
$like = $this->db->sqlToken("like");
|
||||||
$embedSet = sizeof($terms) > ((int) (self::LIMIT_SET_SIZE / sizeof($cols)));
|
$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);
|
$embedTerm = ($embedSet && strlen($term) <= self::LIMIT_SET_STRING_LENGTH);
|
||||||
$term = str_replace(["%", "_", "^"], ["^%", "^_", "^^"], $term);
|
$term = str_replace(["%", "_", "^"], ["^%", "^_", "^^"], $term);
|
||||||
$term = "%$term%";
|
$term = "%$term%";
|
||||||
|
@ -1356,7 +1356,7 @@ class Database {
|
||||||
} elseif ($pair && $context->$pair()) {
|
} elseif ($pair && $context->$pair()) {
|
||||||
// option is paired with another which is also being used
|
// option is paired with another which is also being used
|
||||||
if ($op === ">=") {
|
if ($op === ">=") {
|
||||||
$q->setWhere("{$colDefs[$col]} BETWEEN ? AND ?", [$type, $type], [$context->$m, $context->$pair]);
|
$q->setWhere("{$colDefs[$col]} BETWEEN ? AND ?", [$type, $type], [$context->$m, $context->$pair]);
|
||||||
} else {
|
} else {
|
||||||
// option has already been paired
|
// option has already been paired
|
||||||
continue;
|
continue;
|
||||||
|
@ -1380,7 +1380,7 @@ class Database {
|
||||||
} elseif ($pair && $context->not->$pair()) {
|
} elseif ($pair && $context->not->$pair()) {
|
||||||
// option is paired with another which is also being used
|
// option is paired with another which is also being used
|
||||||
if ($op === ">=") {
|
if ($op === ">=") {
|
||||||
$q->setWhereNot("{$colDefs[$col]} BETWEEN ? AND ?", [$type, $type], [$context->not->$m, $context->not->$pair]);
|
$q->setWhereNot("{$colDefs[$col]} BETWEEN ? AND ?", [$type, $type], [$context->not->$m, $context->not->$pair]);
|
||||||
} else {
|
} else {
|
||||||
// option has already been paired
|
// option has already been paired
|
||||||
continue;
|
continue;
|
||||||
|
@ -1458,7 +1458,7 @@ class Database {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($seen) {
|
if ($seen) {
|
||||||
$spec = $opt['cte_name']."(".implode(",",$opt['cte_cols']).")";
|
$spec = $opt['cte_name']."(".implode(",", $opt['cte_cols']).")";
|
||||||
$q->setCTE($spec, $opt['cte_body'], $opt['cte_types'], $opt['cte_values']);
|
$q->setCTE($spec, $opt['cte_body'], $opt['cte_types'], $opt['cte_values']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,6 +82,7 @@ class Search {
|
||||||
$state = self::STATE_IN_TOKEN_OR_TAG;
|
$state = self::STATE_IN_TOKEN_OR_TAG;
|
||||||
continue 3;
|
continue 3;
|
||||||
}
|
}
|
||||||
|
// no break
|
||||||
case self::STATE_BEFORE_TOKEN_QUOTED:
|
case self::STATE_BEFORE_TOKEN_QUOTED:
|
||||||
switch ($char) {
|
switch ($char) {
|
||||||
case "":
|
case "":
|
||||||
|
@ -130,6 +131,7 @@ class Search {
|
||||||
$state = self::STATE_IN_TOKEN_OR_TAG_QUOTED;
|
$state = self::STATE_IN_TOKEN_OR_TAG_QUOTED;
|
||||||
continue 3;
|
continue 3;
|
||||||
}
|
}
|
||||||
|
// no break
|
||||||
case self::STATE_IN_DATE:
|
case self::STATE_IN_DATE:
|
||||||
while ($pos < $stop && $search[$pos] !== " ") {
|
while ($pos < $stop && $search[$pos] !== " ") {
|
||||||
$buffer .= $search[$pos++];
|
$buffer .= $search[$pos++];
|
||||||
|
@ -169,6 +171,7 @@ class Search {
|
||||||
$buffer .= $char;
|
$buffer .= $char;
|
||||||
continue 3;
|
continue 3;
|
||||||
}
|
}
|
||||||
|
// no break
|
||||||
case self::STATE_IN_TOKEN:
|
case self::STATE_IN_TOKEN:
|
||||||
while ($pos < $stop && $search[$pos] !== " ") {
|
while ($pos < $stop && $search[$pos] !== " ") {
|
||||||
$buffer .= $search[$pos++];
|
$buffer .= $search[$pos++];
|
||||||
|
@ -214,6 +217,7 @@ class Search {
|
||||||
$buffer .= $char;
|
$buffer .= $char;
|
||||||
continue 3;
|
continue 3;
|
||||||
}
|
}
|
||||||
|
// no break
|
||||||
case self::STATE_IN_TOKEN_OR_TAG:
|
case self::STATE_IN_TOKEN_OR_TAG:
|
||||||
switch ($char) {
|
switch ($char) {
|
||||||
case "":
|
case "":
|
||||||
|
@ -223,7 +227,7 @@ class Search {
|
||||||
$flag_negative = false;
|
$flag_negative = false;
|
||||||
$buffer = $tag = "";
|
$buffer = $tag = "";
|
||||||
continue 3;
|
continue 3;
|
||||||
case ":";
|
case ":":
|
||||||
$tag = $buffer;
|
$tag = $buffer;
|
||||||
$buffer = "";
|
$buffer = "";
|
||||||
$state = self::STATE_IN_TOKEN;
|
$state = self::STATE_IN_TOKEN;
|
||||||
|
@ -232,6 +236,7 @@ class Search {
|
||||||
$buffer .= $char;
|
$buffer .= $char;
|
||||||
continue 3;
|
continue 3;
|
||||||
}
|
}
|
||||||
|
// no break
|
||||||
case self::STATE_IN_TOKEN_OR_TAG_QUOTED:
|
case self::STATE_IN_TOKEN_OR_TAG_QUOTED:
|
||||||
switch ($char) {
|
switch ($char) {
|
||||||
case "":
|
case "":
|
||||||
|
@ -267,6 +272,7 @@ class Search {
|
||||||
$buffer .= $char;
|
$buffer .= $char;
|
||||||
continue 3;
|
continue 3;
|
||||||
}
|
}
|
||||||
|
// no break
|
||||||
default:
|
default:
|
||||||
throw new \Exception; // @codeCoverageIgnore
|
throw new \Exception; // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
|
|
|
@ -498,7 +498,7 @@ trait SeriesArticle {
|
||||||
'Excluded folder tree' => [(new Context)->not->folder(1), [1,2,3,4,19,20]],
|
'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 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]],
|
'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 1' => [(new Context)->tag(1), [5,6,7,8]],
|
||||||
'With tag ID 5' => [(new Context)->tag(5), [7,8,19,20]],
|
'With tag ID 5' => [(new Context)->tag(5), [7,8,19,20]],
|
||||||
'With tag ID 1 or 5' => [(new Context)->tags([1,5]), [5,6,7,8,19,20]],
|
'With tag ID 1 or 5' => [(new Context)->tags([1,5]), [5,6,7,8,19,20]],
|
||||||
|
@ -1060,7 +1060,7 @@ trait SeriesArticle {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provideArrayContextOptions() {
|
public function provideArrayContextOptions() {
|
||||||
foreach([
|
foreach ([
|
||||||
"articles", "editions",
|
"articles", "editions",
|
||||||
"subscriptions", "foldersShallow", //"folders",
|
"subscriptions", "foldersShallow", //"folders",
|
||||||
"tags", "tagNames", "labels", "labelNames",
|
"tags", "tagNames", "labels", "labelNames",
|
||||||
|
|
|
@ -26,7 +26,6 @@ use Zend\Diactoros\Response\EmptyResponse;
|
||||||
|
|
||||||
/** @covers \JKingWeb\Arsse\REST\Fever\API<extended> */
|
/** @covers \JKingWeb\Arsse\REST\Fever\API<extended> */
|
||||||
class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest {
|
class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
|
|
||||||
protected function v($value) {
|
protected function v($value) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue