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