public function toJson($options = 0, $depth = 512)
    {
        $params = [
            $this->elements,
            $options,
        ];

        if (version_compare(PHP_VERSION, '5.5.0', '>=')) {
            $params[] = $depth;
        }

        // use call_user_func_array() here to fully cover this method in test
        return call_user_func_array('json_encode', $params);
    }