mirror of
https://github.com/retailcrm/Fetch.git
synced 2024-11-29 05:56:02 +03:00
fixed behavior on setFlag()
This commit is contained in:
parent
5403184e5b
commit
5e62f87077
@ -179,21 +179,27 @@ class Server
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (isset(self::$exclusiveFlags[$flag])) {
|
if (isset(self::$exclusiveFlags[$flag])) {
|
||||||
$kill = $flag;
|
$kill = self::$exclusiveFlags[$flag];
|
||||||
} elseif ($index = array_search($flag, self::$exclusiveFlags)) {
|
} elseif ($index = array_search($flag, self::$exclusiveFlags)) {
|
||||||
$kill = $index;
|
$kill = $index;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($kill) && isset($this->flags[$kill]))
|
if (isset($kill) && false !== $index = array_search($kill, $this->flags))
|
||||||
unset($this->flags[$kill]);
|
unset($this->flags[$index]);
|
||||||
|
|
||||||
|
$index = array_search($flag, $this->flags);
|
||||||
if (isset($value) && $value !== true) {
|
if (isset($value) && $value !== true) {
|
||||||
if ($value == false) {
|
if ($value == false && $index !== false) {
|
||||||
unset($this->flags[$flag]);
|
unset($this->flags[$index]);
|
||||||
} else {
|
} elseif ($value != false) {
|
||||||
$this->flags[] = $flag . '=' . $value;
|
$match = preg_grep('/' . $flag . '/', $this->flags);
|
||||||
|
if (reset($match)) {
|
||||||
|
$this->flags[key($match)] = $flag . '=' . $value;
|
||||||
|
} else {
|
||||||
|
$this->flags[] = $flag . '=' . $value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} elseif ($index === false) {
|
||||||
$this->flags[] = $flag;
|
$this->flags[] = $flag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user