diff --git a/lib/Context/AbstractContext.php b/lib/Context/AbstractContext.php index f6065f8e..d86ef390 100644 --- a/lib/Context/AbstractContext.php +++ b/lib/Context/AbstractContext.php @@ -10,25 +10,6 @@ abstract class AbstractContext { protected $props = []; protected $parent = null; - public function __construct(self $c = null) { - $this->parent = $c; - } - - public function __clone() { - // if the context was cloned because its parent was cloned, change the parent to the clone - if ($this->parent) { - $t = debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS | \DEBUG_BACKTRACE_PROVIDE_OBJECT, 2)[1]; - if (($t['object'] ?? null) instanceof self && $t['function'] === "__clone") { - $this->parent = $t['object']; - } - } - } - - /** @codeCoverageIgnore */ - public function __destruct() { - unset($this->parent); - } - protected function act(string $prop, int $set, $value) { if ($set) { if (is_null($value)) { diff --git a/lib/Context/BooleanMethods.php b/lib/Context/BooleanMembers.php similarity index 82% rename from lib/Context/BooleanMethods.php rename to lib/Context/BooleanMembers.php index e28101e6..e13be6f2 100644 --- a/lib/Context/BooleanMethods.php +++ b/lib/Context/BooleanMembers.php @@ -6,7 +6,13 @@ declare(strict_types=1); namespace JKingWeb\Arsse\Context; -trait BooleanMethods { +trait BooleanMembers { + public $unread = null; + public $starred = null; + public $hidden = null; + public $labelled = null; + public $annotated = null; + public function unread(bool $spec = null) { return $this->act(__FUNCTION__, func_num_args(), $spec); } diff --git a/lib/Context/BooleanProperties.php b/lib/Context/BooleanProperties.php deleted file mode 100644 index a6f69015..00000000 --- a/lib/Context/BooleanProperties.php +++ /dev/null @@ -1,15 +0,0 @@ -parent = $parent; + } + + public function __clone() { + // if the context was cloned because its parent was cloned, change the parent to the clone + if ($this->parent) { + $t = debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS | \DEBUG_BACKTRACE_PROVIDE_OBJECT, 2)[1]; + if (($t['object'] ?? null) instanceof Context && $t['function'] === "__clone") { + $this->parent = $t['object']; + } + } + } + + /** @codeCoverageIgnore */ + public function __destruct() { + unset($this->parent); + } } diff --git a/lib/Context/ExclusionMethods.php b/lib/Context/ExclusionMembers.php similarity index 88% rename from lib/Context/ExclusionMethods.php rename to lib/Context/ExclusionMembers.php index 917326ed..d9d82c77 100644 --- a/lib/Context/ExclusionMethods.php +++ b/lib/Context/ExclusionMembers.php @@ -9,7 +9,34 @@ namespace JKingWeb\Arsse\Context; use JKingWeb\Arsse\Misc\ValueInfo; use JKingWeb\Arsse\Misc\Date; -trait ExclusionMethods { +trait ExclusionMembers { + public $folder = null; + public $folders = null; + public $folderShallow = null; + public $foldersShallow = null; + public $tag = null; + public $tags = null; + public $tagName = null; + public $tagNames = null; + public $subscription = null; + public $subscriptions = null; + public $edition = null; + public $editions = null; + public $article = null; + public $articles = null; + public $label = null; + public $labels = null; + public $labelName = null; + public $labelNames = null; + public $annotationTerms = null; + public $searchTerms = null; + public $titleTerms = null; + public $authorTerms = null; + public $articleRange = [null, null]; + public $editionRange = [null, null]; + public $modifiedRange = [null, null]; + public $markedRange = [null, null]; + protected function cleanIdArray(array $spec, bool $allowZero = false): array { $spec = array_values($spec); for ($a = 0; $a < sizeof($spec); $a++) { diff --git a/lib/Context/ExclusionProperties.php b/lib/Context/ExclusionProperties.php deleted file mode 100644 index 8b0b63b8..00000000 --- a/lib/Context/ExclusionProperties.php +++ /dev/null @@ -1,36 +0,0 @@ -