Rs\Json\Patch\Operations\Remove::remove PHP Метод

remove() приватный Метод

private remove ( array | stdClass &$json, array $pointerParts )
$json array | stdClass The json_decode'd Json structure.
$pointerParts array The parts of the fed pointer.
    private function remove(&$json, array $pointerParts)
    {
        $pointerPart = array_shift($pointerParts);
        if (is_array($json) && isset($json[$pointerPart])) {
            if (count($pointerParts) === 0) {
                unset($json[$pointerPart]);
                if (ctype_digit($pointerPart)) {
                    $json = array_values($json);
                }
            } else {
                $this->remove($json[$pointerPart], $pointerParts);
            }
        } elseif (is_object($json) && isset($json->{$pointerPart})) {
            if (count($pointerParts) === 0) {
                unset($json->{$pointerPart});
            } else {
                $this->remove($json->{$pointerPart}, $pointerParts);
            }
        } elseif ($pointerPart === Pointer::LAST_ARRAY_ELEMENT_CHAR && is_array($json)) {
            unset($json[count($json) - 1]);
        } else {
            if (null === $pointerPart) {
                $json = new \stdClass();
            } elseif (is_object($json)) {
                unset($json->{$pointerPart});
            } else {
                unset($json[$pointerPart]);
            }
        }
    }