mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2025-04-15 10:55:51 +00:00
Merge branch 'csfixer3'
Code style cleanup to mostly conform to PSR-12
This commit is contained in:
commit
1b80ad37bc
223 changed files with 308 additions and 94 deletions
.php-cs-fixer.dist.phpRoboFile.phparsse.php
lib
AbstractException.phpArsse.phpCLI.phpConf.php
Conf
Context
AbstractContext.phpBooleanMembers.phpContext.phpExclusionContext.phpExclusionMembers.phpRootContext.phpUnionContext.php
Database.phpDb
AbstractDriver.phpAbstractResult.phpAbstractStatement.phpDriver.phpException.phpExceptionInput.phpExceptionRetry.phpExceptionTimeout.php
Exception.phpExceptionFatal.phpExceptionType.phpFactory.phpFeed.phpMySQL
PDODriver.phpPDOError.phpPDOResult.phpPDOStatement.phpPostgreSQL
Result.phpResultAggregate.phpResultEmpty.phpSQLState.phpSQLite3
AbstractPDODriver.phpDriver.phpExceptionBuilder.phpPDODriver.phpPDOStatement.phpResult.phpStatement.php
Statement.phpTransaction.phpFeed
ImportExport
Lang.phpLang
Misc
REST.phpREST
Rule
Service.phpService
User.phpUser
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse;
|
||||
|
||||
const BASE = __DIR__.DIRECTORY_SEPARATOR;
|
||||
|
@ -13,7 +14,10 @@ $paths = [
|
|||
BASE."arsse.php",
|
||||
BASE."RoboFile.php",
|
||||
BASE."lib",
|
||||
BASE."tests",
|
||||
BASE."tests/cases",
|
||||
BASE."tests/lib",
|
||||
BASE."tests/bootstrap.php",
|
||||
BASE."tests/server.php",
|
||||
];
|
||||
$rules = [
|
||||
// house rules where PSR series is silent
|
||||
|
@ -35,6 +39,7 @@ $rules = [
|
|||
'no_blank_lines_after_phpdoc' => true,
|
||||
'no_empty_comment' => true,
|
||||
'no_empty_phpdoc' => true,
|
||||
'no_empty_statement' => true,
|
||||
'no_extra_blank_lines' => true, // this could probably use more configuration
|
||||
'no_mixed_echo_print' => ['use' => "echo"],
|
||||
'no_short_bool_cast' => true,
|
||||
|
@ -48,26 +53,11 @@ $rules = [
|
|||
'pow_to_exponentiation' => true,
|
||||
'set_type_to_cast' => true,
|
||||
'standardize_not_equals' => true,
|
||||
'trailing_comma_in_multiline_array' => true,
|
||||
'trailing_comma_in_multiline' => ['elements' => ["arrays"]],
|
||||
'unary_operator_spaces' => true,
|
||||
'yoda_style' => false,
|
||||
// PSR standard to apply
|
||||
'@PSR2' => true,
|
||||
// PSR-12 rules; php-cs-fixer does not yet support PSR-12 natively
|
||||
'compact_nullable_typehint' => true,
|
||||
'declare_equal_normalize' => ['space' => "none"],
|
||||
'function_typehint_space' => true,
|
||||
'lowercase_cast' => true,
|
||||
'lowercase_static_reference' => true,
|
||||
'no_alternative_syntax' => true,
|
||||
'no_empty_statement' => true,
|
||||
'no_leading_import_slash' => true,
|
||||
'no_leading_namespace_whitespace' => true,
|
||||
'no_whitespace_in_blank_line' => true,
|
||||
'return_type_declaration' => ['space_before' => "none"],
|
||||
'single_trait_insert_per_statement' => true,
|
||||
'short_scalar_cast' => true,
|
||||
'visibility_required' => ['elements' => ["const", "property", "method"]],
|
||||
'@PSR12' => true,
|
||||
// house exceptions to PSR rules
|
||||
'braces' => ['position_after_functions_and_oop_constructs' => "same"],
|
||||
'function_declaration' => ['closure_function_spacing' => "none"],
|
||||
|
@ -82,4 +72,4 @@ foreach ($paths as $path) {
|
|||
$finder = $finder->in($path);
|
||||
}
|
||||
}
|
||||
return \PhpCsFixer\Config::create()->setRiskyAllowed(true)->setRules($rules)->setFinder($finder);
|
||||
return (new \PhpCsFixer\Config)->setRiskyAllowed(true)->setRules($rules)->setFinder($finder);
|
|
@ -164,7 +164,7 @@ class RoboFile extends \Robo\Tasks {
|
|||
if (
|
||||
(IS_WIN && (!exec(escapeshellarg($bin)." --help $blackhole", $junk, $status) || $status))
|
||||
|| (!IS_WIN && (!exec("which ".escapeshellarg($bin)." $blackhole", $junk, $status) || $status))
|
||||
) {
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse;
|
||||
|
||||
const BASE = __DIR__.DIRECTORY_SEPARATOR;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse;
|
||||
|
||||
abstract class AbstractException extends \Exception {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse;
|
||||
|
||||
class Arsse {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse;
|
||||
|
||||
use JKingWeb\Arsse\REST\Fever\User as Fever;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
/** Conf class */
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse;
|
||||
|
||||
use AllowDynamicProperties;
|
||||
|
@ -15,7 +16,7 @@ use JKingWeb\Arsse\Misc\ValueInfo as Value;
|
|||
* The Conf class serves both as a means of importing and querying configuration information, as well as a source for default parameters when a configuration file does not specify a value.
|
||||
* All public properties are configuration parameters that may be set by the server administrator. */
|
||||
#[AllowDynamicProperties]
|
||||
class Conf {
|
||||
class Conf {
|
||||
/** @var string Default language to use for logging and errors */
|
||||
public $lang = "en";
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Conf;
|
||||
|
||||
class Exception extends \JKingWeb\Arsse\AbstractException {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Context;
|
||||
|
||||
abstract class AbstractContext {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Context;
|
||||
|
||||
trait BooleanMembers {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Context;
|
||||
|
||||
class Context extends RootContext {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Context;
|
||||
|
||||
class ExclusionContext extends AbstractContext {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Context;
|
||||
|
||||
use JKingWeb\Arsse\Misc\ValueInfo;
|
||||
|
@ -243,7 +244,6 @@ trait ExclusionMembers {
|
|||
return $this->act(__FUNCTION__, func_num_args(), $spec);
|
||||
}
|
||||
|
||||
|
||||
public function markedRange($start = null, $end = null) {
|
||||
if ($start === null && $end === null) {
|
||||
$spec = null;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Context;
|
||||
|
||||
abstract class RootContext extends AbstractContext {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Context;
|
||||
|
||||
class UnionContext extends RootContext implements \ArrayAccess, \Countable, \IteratorAggregate {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse;
|
||||
|
||||
use JKingWeb\DrUUID\UUID;
|
||||
|
@ -280,7 +281,7 @@ class Database {
|
|||
}
|
||||
|
||||
/** Renames a user
|
||||
*
|
||||
*
|
||||
* This does not have an effect on their numeric ID, but has a cascading effect on many tables
|
||||
*/
|
||||
public function userRename(string $user, string $name): bool {
|
||||
|
@ -337,7 +338,7 @@ class Database {
|
|||
}
|
||||
|
||||
/** Retrieves any metadata associated with a user
|
||||
*
|
||||
*
|
||||
* @param string $user The user whose metadata is to be retrieved
|
||||
* @param bool $includeLarge Whether to include values which can be arbitrarily large text
|
||||
*/
|
||||
|
@ -855,8 +856,8 @@ class Database {
|
|||
sum(case when \"read\" = 1 and hidden = 0 then 1 else 0 end) as marked
|
||||
from arsse_marks group by subscription
|
||||
) as mark_stats on mark_stats.subscription = s.id",
|
||||
["str", "int"],
|
||||
[$user, $folder]
|
||||
["str", "int"],
|
||||
[$user, $folder]
|
||||
);
|
||||
$q->setWhere("s.owner = ?", ["str"], [$user]);
|
||||
$nocase = $this->db->sqlToken("nocase");
|
||||
|
@ -1613,26 +1614,26 @@ class Database {
|
|||
}
|
||||
// ensure any used array-type context options contain at least one member
|
||||
foreach ([
|
||||
"articles",
|
||||
"articles",
|
||||
"editions",
|
||||
"subscriptions",
|
||||
"folders",
|
||||
"foldersShallow",
|
||||
"labels",
|
||||
"labelNames",
|
||||
"tags",
|
||||
"tagNames",
|
||||
"searchTerms",
|
||||
"titleTerms",
|
||||
"authorTerms",
|
||||
"folders",
|
||||
"foldersShallow",
|
||||
"labels",
|
||||
"labelNames",
|
||||
"tags",
|
||||
"tagNames",
|
||||
"searchTerms",
|
||||
"titleTerms",
|
||||
"authorTerms",
|
||||
"annotationTerms",
|
||||
"modifiedRanges",
|
||||
"markedRanges",
|
||||
] as $m) {
|
||||
if ($context->$m() && !$context->$m) {
|
||||
throw new Db\ExceptionInput("tooShort", ['field' => $m, 'action' => $this->caller(), 'min' => 1]);
|
||||
}
|
||||
if ($context->$m() && !$context->$m) {
|
||||
throw new Db\ExceptionInput("tooShort", ['field' => $m, 'action' => $this->caller(), 'min' => 1]);
|
||||
}
|
||||
}
|
||||
// next compute the context, supplying the query to manipulate directly
|
||||
$this->articleFilter($context, $q);
|
||||
}
|
||||
|
@ -1921,8 +1922,8 @@ class Database {
|
|||
touched = 1
|
||||
where
|
||||
article in (select article from target_articles)
|
||||
and subscription in (select distinct subscription from target_articles)",
|
||||
[$subq->getTypes(), "bool"],
|
||||
and subscription in (select distinct subscription from target_articles)",
|
||||
[$subq->getTypes(), "bool"],
|
||||
[$subq->getValues(), $data['read']]
|
||||
);
|
||||
$this->db->prepare($q->getQuery(), $q->getTypes())->run($q->getValues());
|
||||
|
@ -1952,7 +1953,7 @@ class Database {
|
|||
where
|
||||
article in (select article from target_articles)
|
||||
and subscription in (select distinct subscription from target_articles)",
|
||||
[$subq->getTypes(), $setTypes],
|
||||
[$subq->getTypes(), $setTypes],
|
||||
[$subq->getValues(), $setValues]
|
||||
);
|
||||
$this->db->prepare($q->getQuery(), $q->getTypes())->run($q->getValues());
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db;
|
||||
|
||||
use JKingWeb\Arsse\Arsse;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db;
|
||||
|
||||
abstract class AbstractResult implements Result {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db;
|
||||
|
||||
use JKingWeb\Arsse\Misc\Date;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db;
|
||||
|
||||
interface Driver {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db;
|
||||
|
||||
class Exception extends \JKingWeb\Arsse\AbstractException {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db;
|
||||
|
||||
class ExceptionInput extends \JKingWeb\Arsse\AbstractException {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db;
|
||||
|
||||
class ExceptionRetry extends \JKingWeb\Arsse\AbstractException {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db;
|
||||
|
||||
class ExceptionTimeout extends \JKingWeb\Arsse\AbstractException {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db\MySQL;
|
||||
|
||||
use JKingWeb\Arsse\Arsse;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db\MySQL;
|
||||
|
||||
use JKingWeb\Arsse\Db\Exception;
|
||||
|
@ -27,7 +28,7 @@ trait ExceptionBuilder {
|
|||
public static function buildConnectionException($code, string $msg): array {
|
||||
switch ($code) {
|
||||
case 1045:
|
||||
// @codeCoverageIgnoreStart
|
||||
// @codeCoverageIgnoreStart
|
||||
case 1043:
|
||||
case 1044:
|
||||
case 1046:
|
||||
|
@ -48,7 +49,7 @@ trait ExceptionBuilder {
|
|||
case 2018:
|
||||
case 2026:
|
||||
case 2028:
|
||||
// @codeCoverageIgnoreEnd
|
||||
// @codeCoverageIgnoreEnd
|
||||
return [Exception::class, 'connectionFailure', ['engine' => "MySQL", 'message' => $msg]];
|
||||
default:
|
||||
return [Exception::class, 'engineErrorGeneral', $msg]; // @codeCoverageIgnore
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db\MySQL;
|
||||
|
||||
use JKingWeb\Arsse\Arsse;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db\MySQL;
|
||||
|
||||
class PDOStatement extends \JKingWeb\Arsse\Db\PDOStatement {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db\MySQL;
|
||||
|
||||
class Result extends \JKingWeb\Arsse\Db\AbstractResult {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db\MySQL;
|
||||
|
||||
class Statement extends \JKingWeb\Arsse\Db\AbstractStatement {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db;
|
||||
|
||||
trait PDODriver {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db;
|
||||
|
||||
trait PDOError {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db;
|
||||
|
||||
class PDOResult extends AbstractResult {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db;
|
||||
|
||||
abstract class PDOStatement extends AbstractStatement {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db\PostgreSQL;
|
||||
|
||||
trait Dispatch {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db\PostgreSQL;
|
||||
|
||||
use JKingWeb\Arsse\Arsse;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db\PostgreSQL;
|
||||
|
||||
use JKingWeb\Arsse\Arsse;
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db\PostgreSQL;
|
||||
|
||||
class PDOResult extends \JKingWeb\Arsse\Db\PDOResult {
|
||||
|
||||
// This method exists to transparent handle byte-array results
|
||||
// This method exists to transparently handle byte-array results
|
||||
|
||||
public function valid() {
|
||||
$this->cur = $this->set->fetch(\PDO::FETCH_ASSOC);
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db\PostgreSQL;
|
||||
|
||||
use JKingWeb\Arsse\Db\Result;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db\PostgreSQL;
|
||||
|
||||
class Result extends \JKingWeb\Arsse\Db\AbstractResult {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db\PostgreSQL;
|
||||
|
||||
class Statement extends \JKingWeb\Arsse\Db\AbstractStatement {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db;
|
||||
|
||||
interface Result extends \Iterator {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db;
|
||||
|
||||
class ResultAggregate extends AbstractResult {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db;
|
||||
|
||||
class ResultEmpty extends AbstractResult {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db;
|
||||
|
||||
trait SQLState {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db\SQLite3;
|
||||
|
||||
abstract class AbstractPDODriver extends Driver {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db\SQLite3;
|
||||
|
||||
use JKingWeb\Arsse\Arsse;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db\SQLite3;
|
||||
|
||||
use JKingWeb\Arsse\Db\Exception;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db\SQLite3;
|
||||
|
||||
use JKingWeb\Arsse\Arsse;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db\SQLite3;
|
||||
|
||||
class PDOStatement extends \JKingWeb\Arsse\Db\PDOStatement {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db\SQLite3;
|
||||
|
||||
class Result extends \JKingWeb\Arsse\Db\AbstractResult {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db\SQLite3;
|
||||
|
||||
class Statement extends \JKingWeb\Arsse\Db\AbstractStatement {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db;
|
||||
|
||||
interface Statement {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Db;
|
||||
|
||||
class Transaction {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse;
|
||||
|
||||
class Exception extends AbstractException {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse;
|
||||
|
||||
class ExceptionFatal extends AbstractException {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse;
|
||||
|
||||
class ExceptionType extends AbstractException {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse;
|
||||
|
||||
class Factory {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse;
|
||||
|
||||
use JKingWeb\Arsse\Feed\Item;
|
||||
|
@ -16,7 +17,7 @@ use PicoFeed\Reader\Reader;
|
|||
use PicoFeed\Reader\Favicon;
|
||||
use PicoFeed\Scraper\Scraper;
|
||||
|
||||
class Feed {
|
||||
class Feed {
|
||||
public $title;
|
||||
public $siteUrl;
|
||||
public $iconUrl;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Feed;
|
||||
|
||||
use GuzzleHttp\Exception\BadResponseException;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Feed;
|
||||
|
||||
class Item {
|
||||
|
@ -21,4 +22,4 @@ class Item {
|
|||
public $enclosureUrl;
|
||||
public $enclosureType;
|
||||
public $categories = [];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\ImportExport;
|
||||
|
||||
use JKingWeb\Arsse\Arsse;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\ImportExport;
|
||||
|
||||
class Exception extends \JKingWeb\Arsse\AbstractException {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\ImportExport;
|
||||
|
||||
use JKingWeb\Arsse\Arsse;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse;
|
||||
|
||||
class Lang {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Lang;
|
||||
|
||||
class Exception extends \JKingWeb\Arsse\AbstractException {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Misc;
|
||||
|
||||
abstract class Date {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Misc;
|
||||
|
||||
use Psr\Http\Message\MessageInterface;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Misc;
|
||||
|
||||
class Query extends QueryFilter {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Misc;
|
||||
|
||||
class QueryFilter {
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Misc;
|
||||
|
||||
/**
|
||||
* A collection of functions for manipulating URLs
|
||||
*/
|
||||
class URL {
|
||||
|
||||
/** Returns whether a URL is absolute i.e. has a scheme */
|
||||
/** Returns whether a URL is absolute i.e. whether it has a scheme */
|
||||
public static function absolute(string $url): bool {
|
||||
return (bool) strlen((string) parse_url($url, \PHP_URL_SCHEME));
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Misc;
|
||||
|
||||
use JKingWeb\Arsse\ExceptionType;
|
||||
|
@ -107,7 +108,7 @@ class ValueInfo {
|
|||
if ($strict && !$drop) {
|
||||
throw new ExceptionType("strictFailure", $type);
|
||||
}
|
||||
return (!$drop) ? (int) $value->getTimestamp(): null;
|
||||
return (!$drop) ? (int) $value->getTimestamp() : null;
|
||||
} elseif ($value instanceof \DateInterval) {
|
||||
if ($strict && !$drop) {
|
||||
throw new ExceptionType("strictFailure", $type);
|
||||
|
@ -159,7 +160,7 @@ class ValueInfo {
|
|||
if ($strict && !$drop) {
|
||||
throw new ExceptionType("strictFailure", $type);
|
||||
}
|
||||
return (!$drop) ? (float) $value->getTimestamp(): null;
|
||||
return (!$drop) ? (float) $value->getTimestamp() : null;
|
||||
} elseif ($value instanceof \DateInterval) {
|
||||
if ($drop) {
|
||||
return null;
|
||||
|
@ -203,13 +204,13 @@ class ValueInfo {
|
|||
if ($value->days) {
|
||||
$dateSpec = $value->days."D";
|
||||
} else {
|
||||
$dateSpec .= $value->y ? $value->y."Y": "";
|
||||
$dateSpec .= $value->m ? $value->m."M": "";
|
||||
$dateSpec .= $value->d ? $value->d."D": "";
|
||||
$dateSpec .= $value->y ? $value->y."Y" : "";
|
||||
$dateSpec .= $value->m ? $value->m."M" : "";
|
||||
$dateSpec .= $value->d ? $value->d."D" : "";
|
||||
}
|
||||
$timeSpec .= $value->h ? $value->h."H": "";
|
||||
$timeSpec .= $value->i ? $value->i."M": "";
|
||||
$timeSpec .= $value->s ? $value->s."S": "";
|
||||
$timeSpec .= $value->h ? $value->h."H" : "";
|
||||
$timeSpec .= $value->i ? $value->i."M" : "";
|
||||
$timeSpec .= $value->s ? $value->s."S" : "";
|
||||
$timeSpec = $timeSpec ? "T".$timeSpec : "";
|
||||
if (!$dateSpec && !$timeSpec) {
|
||||
return "PT0S";
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse;
|
||||
|
||||
use JKingWeb\Arsse\Misc\URL;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\REST;
|
||||
|
||||
use JKingWeb\Arsse\Arsse;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\REST;
|
||||
|
||||
class Exception extends \JKingWeb\Arsse\AbstractException {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\REST;
|
||||
|
||||
class Exception501 extends \Exception {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\REST\Fever;
|
||||
|
||||
use JKingWeb\Arsse\Arsse;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\REST\Fever;
|
||||
|
||||
use JKingWeb\Arsse\Arsse;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\REST;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\REST\Miniflux;
|
||||
|
||||
use JKingWeb\Arsse\Misc\HTTP;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\REST\Miniflux;
|
||||
|
||||
use JKingWeb\Arsse\Arsse;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\REST\Miniflux;
|
||||
|
||||
use JKingWeb\Arsse\Arsse;
|
||||
|
@ -212,7 +213,7 @@ class V1 extends \JKingWeb\Arsse\REST\AbstractHandler {
|
|||
|
||||
public function __construct() {
|
||||
}
|
||||
|
||||
|
||||
public static function respError($data, int $status = 400, array $headers = []): ResponseInterface {
|
||||
assert(isset(Arsse::$lang) && Arsse::$lang instanceof \JKingWeb\Arsse\Lang, new \Exception("Language database must be initialized before use"));
|
||||
$data = (array) $data;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\REST\NextcloudNews;
|
||||
|
||||
use JKingWeb\Arsse\Arsse;
|
||||
|
@ -293,7 +294,7 @@ class V1_2 extends \JKingWeb\Arsse\REST\AbstractHandler {
|
|||
switch ($e->getCode()) {
|
||||
// folder already exists
|
||||
case 10236: return HTTP::respEmpty(409);
|
||||
// folder name not acceptable
|
||||
// folder name not acceptable
|
||||
case 10231:
|
||||
case 10232: return HTTP::respEmpty(422);
|
||||
// other errors related to input
|
||||
|
@ -324,9 +325,9 @@ class V1_2 extends \JKingWeb\Arsse\REST\AbstractHandler {
|
|||
switch ($e->getCode()) {
|
||||
// folder does not exist
|
||||
case 10239: return HTTP::respEmpty(404);
|
||||
// folder already exists
|
||||
// folder already exists
|
||||
case 10236: return HTTP::respEmpty(409);
|
||||
// folder name not acceptable
|
||||
// folder name not acceptable
|
||||
case 10231:
|
||||
case 10232: return HTTP::respEmpty(422);
|
||||
// other errors related to input
|
||||
|
@ -458,7 +459,7 @@ class V1_2 extends \JKingWeb\Arsse\REST\AbstractHandler {
|
|||
switch ($e->getCode()) {
|
||||
// subscription does not exist
|
||||
case 10239: return HTTP::respEmpty(404);
|
||||
// name is invalid
|
||||
// name is invalid
|
||||
case 10231:
|
||||
case 10232: return HTTP::respEmpty(422);
|
||||
// other errors related to input
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\REST\NextcloudNews;
|
||||
|
||||
use JKingWeb\Arsse\Misc\HTTP;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\REST\TinyTinyRSS;
|
||||
|
||||
use JKingWeb\Arsse\Feed;
|
||||
|
@ -999,7 +1000,7 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
|
|||
switch ($e->getCode()) {
|
||||
case 10236: // label already exists
|
||||
// retrieve the ID of the existing label; duplicating a label silently returns the existing one
|
||||
return $this->labelOut(Arsse::$db->labelPropertiesGet(Arsse::$user->id, $in['name'], true)['id']);
|
||||
return $this->labelOut(Arsse::$db->labelPropertiesGet(Arsse::$user->id, $in['name'], true)['id']);
|
||||
default: // other errors related to input
|
||||
throw new Exception("INCORRECT_USAGE");
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\REST\TinyTinyRSS;
|
||||
|
||||
class Exception extends \Exception {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\REST\TinyTinyRSS;
|
||||
|
||||
use JKingWeb\Arsse\Arsse;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\REST\TinyTinyRSS;
|
||||
|
||||
use JKingWeb\Arsse\Context\Context;
|
||||
|
@ -319,7 +320,7 @@ class Search {
|
|||
$start = $day."T00:00:00 $tz";
|
||||
$end = $day."T23:59:59 $tz";
|
||||
$cc = $neg ? $c->not : $c;
|
||||
// NOTE: TTRSS treats multiple positive dates as contradictory; we instead treat them as complimentary instead, because it makes more sense
|
||||
// NOTE: TTRSS treats multiple positive dates as contradictory; we instead treat them as complimentary because this makes more sense
|
||||
return $cc->modifiedRanges(array_merge($cc->modifiedRanges, [[$start, $end]]));
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Rule;
|
||||
|
||||
class Exception extends \JKingWeb\Arsse\AbstractException {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Rule;
|
||||
|
||||
abstract class Rule {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse;
|
||||
|
||||
use JKingWeb\Arsse\Misc\Date;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Service;
|
||||
|
||||
use JKingWeb\Arsse\AbstractException;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Service;
|
||||
|
||||
interface Driver {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Service;
|
||||
|
||||
class Exception extends \JKingWeb\Arsse\AbstractException {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Service\Serial;
|
||||
|
||||
use JKingWeb\Arsse\Arsse;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\Service\Subprocess;
|
||||
|
||||
use JKingWeb\Arsse\Arsse;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse;
|
||||
|
||||
use JKingWeb\Arsse\Misc\ValueInfo as V;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\User;
|
||||
|
||||
interface Driver {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\User;
|
||||
|
||||
class Exception extends \JKingWeb\Arsse\AbstractException {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace JKingWeb\Arsse\User;
|
||||
|
||||
class ExceptionConflict extends Exception {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue