2017-06-18 14:23:37 +00:00
|
|
|
<?php
|
2017-11-17 01:23:18 +00:00
|
|
|
/** @license MIT
|
|
|
|
* Copyright 2017 J. King, Dustin Wilson et al.
|
|
|
|
* See LICENSE and AUTHORS files for details */
|
|
|
|
|
2017-06-18 14:23:37 +00:00
|
|
|
declare(strict_types=1);
|
2021-04-14 15:17:01 +00:00
|
|
|
|
2019-02-26 03:41:12 +00:00
|
|
|
namespace JKingWeb\Arsse\Context;
|
2017-08-29 14:50:31 +00:00
|
|
|
|
2022-04-19 02:04:48 +00:00
|
|
|
class ExclusionContext extends AbstractContext {
|
2022-04-20 03:20:20 +00:00
|
|
|
use ExclusionMembers;
|
|
|
|
|
2024-12-15 21:31:57 +00:00
|
|
|
public function __construct(?Context $parent = null) {
|
2022-04-20 03:20:20 +00:00
|
|
|
$this->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);
|
|
|
|
}
|
2017-08-29 14:50:31 +00:00
|
|
|
}
|