<commit_before><?php
/**
 * INI entries:
 *
 * * `couchbase.log_level` (string), default: `"WARN"`
 *
 *   controls amount of information, the module will send to PHP error log. Accepts the following values in order of
 *   increasing verbosity: `"FATAL"`, `"ERROR"`, `"WARN"`, `"INFO"`, `"DEBUG"`, `"TRACE"`.
 *
 * * `couchbase.encoder.format` (string), default: `"json"`
 *
 *   selects serialization format for default encoder (\Couchbase\defaultEncoder). Accepts the following values:
 *   * `"json"` - encodes objects and arrays as JSON object (using `json_encode()`), primitives written in stringified form,
 *      which is allowed for most of the JSON parsers as valid values. For empty arrays JSON array preferred, if it is
 *      necessary, use `new stdClass()` to persist empty JSON object. Note, that only JSON format considered supported by
 *      all Couchbase SDKs, everything else is private implementation (i.e. `"php"` format won't be readable by .NET SDK).
 *   * `"php"` - uses PHP serialize() method to encode the document.
 *
 * * `couchbase.encoder.compression` (string), default: `"none"`
 *
 *   selects compression algorithm. Also see related compression options below. Accepts the following values:
 *   * `"fastlz"` - uses FastLZ algorithm. The module might be configured to use system fastlz library during build,
 *     othewise vendored version will be used. This algorithm is always available.
 *   * `"zlib"` - uses compression implemented by libz. Might not be available, if the system didn't have libz headers
 *     during build phase. In this case \Couchbase\HAVE_ZLIB will be false.
 *   * `"off"` or `"none"` - compression will be disabled, but the library will still read compressed values.
 *
 * * `couchbase.encoder.compression_threshold` (long), default: `0`
 *
 *   controls minimum size of the document value in bytes to use compression. For example, if threshold 100 bytes,
 *   and the document size is 50, compression will be disabled for this particular document.
 *
 * * `couchbase.encoder.compression_factor` (float), default: `0.0`
 *
 *   controls the minimum ratio of the result value and original document value to proceed with persisting compressed
 *   bytes. For example, the original document consists of 100 bytes. In this case factor 1.0 will require compressor
 *   to yield values not larger than 100 bytes (100/1.0), and 1.5 -- not larger than 66 bytes (100/1.5).
 *
 * * `couchbase.decoder.json_arrays` (boolean), default: `false`
 *
 *   controls the form of the documents, returned by the server if they were in JSON format. When true, it will generate
 *   arrays of arrays, otherwise instances of stdClass.
 *
 * * `couchbase.pool.max_idle_time_sec` (long), default: `60`
 *
 *   controls the maximum interval the underlying connection object could be idle, i.e. without any data/query
 *   operations. All connections which idle more than this interval will be closed automatically. Cleanup function
 *   executed after each request using RSHUTDOWN hook.
 *
 * @package Couchbase
 */

namespace Couchbase {

    use \JsonSerializable;
    use \Exception;
    use \Throwable;

    /**
     * An object which contains meta information of the document needed to enforce query consistency.
     */
    interface MutationToken
    {
        /**
         * Returns bucket name
         *
         * @return string
         */
        public function bucketName();

        /**
         * Returns partition number
         *
         * @return int
         */
        public function partitionId();

        /**
         * Returns UUID of the partition
         *
         * @return string
         */
        public function partitionUuid();

        /**
         * Returns the sequence number inside partition
         *
         * @return string
         */
        public function sequenceNumber();
    }


    interface QueryMetaData
    {
        public function status(): ?string;

        public function requestId(): ?string;

        public function clientContextId(): ?string;

        public function signature(): ?array;

        public function warnings(): ?array;

        public function errors(): ?array;

        public function metrics(): ?array;

        public function profile(): ?array;
    }

    interface SearchMetaData
    {
        public function successCount(): ?int;

        public function errorCount(): ?int;

        public function took(): ?int;

        public function totalHits(): ?int;

        public function maxScore(): ?float;

        public function metrics(): ?array;
    }

    interface ViewMetaData
    {
        public function totalRows(): ?int;

        public function debug(): ?array;
    }

    interface Result
    {
        public function cas(): ?string;
    }

    interface GetResult extends Result
    {
        public function content(): ?array;
    }

    interface GetReplicaResult extends Result
    {
        public function content(): ?array;

        public function isReplica(): bool;
    }

    interface ExistsResult extends Result
    {
        public function exists(): bool;
    }

    interface MutationResult extends Result
    {
        public function mutationToken(): ?MutationToken;
    }

    interface CounterResult extends MutationResult
    {
        public function content(): int;
    }

    interface LookupInResult extends Result
    {
        public function content(int $index): ?object;

        public function exists(int $index): bool;

        public function status(int $index): int;
    }

    interface MutateInResult extends MutationResult
    {
        public function content(int $index): ?array;
    }

    interface QueryResult
    {
        public function metaData(): ?QueryMetaData;

        public function rows(): ?array;
    }

    interface AnalyticsResult
    {
        public function metaData(): ?QueryMetaData;

        public function rows(): ?array;
    }

    interface SearchResult
    {
        public function metaData(): ?SearchMetaData;

        public function facets(): ?array;

        public function rows(): ?array;
    }

    interface ViewResult
    {
        public function metaData(): ?ViewMetaData;

        public function rows(): ?array;
    }

    class ViewRow
    {
        public function id(): ?string
        {
        }

        public function key()
        {
        }

        public function value()
        {
        }

        public function document()
        {
        }
    }

    class BaseException extends Exception implements Throwable
    {
        public function ref(): ?string
        {
        }

        public function context(): ?object
        {
        }
    }

    class HttpException extends BaseException implements Throwable
    {
    }

    class QueryException extends HttpException implements Throwable
    {
    }

    class QueryErrorException extends QueryException implements Throwable
    {
    }

    class QueryServiceException extends QueryException implements Throwable
    {
    }

    class SearchException extends HttpException implements Throwable
    {
    }

    class AnalyticsException extends HttpException implements Throwable
    {
    }

    class ViewException extends HttpException implements Throwable
    {
    }

    class PartialViewException extends HttpException implements Throwable
    {
    }

    class BindingsException extends BaseException implements Throwable
    {
    }

    class InvalidStateException extends BaseException implements Throwable
    {
    }

    class KeyValueException extends BaseException implements Throwable
    {
    }

    class KeyNotFoundException extends KeyValueException implements Throwable
    {
    }

    class KeyExistsException extends KeyValueException implements Throwable
    {
    }

    class ValueTooBigException extends KeyValueException implements Throwable
    {
    }

    class KeyLockedException extends KeyValueException implements Throwable
    {
    }

    class TempFailException extends KeyValueException implements Throwable
    {
    }

    class PathNotFoundException extends KeyValueException implements Throwable
    {
    }

    class PathExistsException extends KeyValueException implements Throwable
    {
    }

    class InvalidRangeException extends KeyValueException implements Throwable
    {
    }

    class KeyDeletedException extends KeyValueException implements Throwable
    {
    }

    class CasMismatchException extends KeyValueException implements Throwable
    {
    }

    class InvalidConfigurationException extends BaseException implements Throwable
    {
    }

    class ServiceMissingException extends BaseException implements Throwable
    {
    }

    class NetworkException extends BaseException implements Throwable
    {
    }

    class TimeoutException extends BaseException implements Throwable
    {
    }

    class BucketMissingException extends BaseException implements Throwable
    {
    }

    class ScopeMissingException extends BaseException implements Throwable
    {
    }

    class CollectionMissingException extends BaseException implements Throwable
    {
    }

    class AuthenticationException extends BaseException implements Throwable
    {
    }

    class BadInputException extends BaseException implements Throwable
    {
    }

    class DurabilityException extends BaseException implements Throwable
    {
    }

    class SubdocumentException extends BaseException implements Throwable
    {
    }

    class QueryIndex
    {
        public function name(): string
        {
        }

        public function isPrimary(): bool
        {
        }

        public function type(): string
        {
        }

        public function state(): string
        {
        }

        public function keyspace(): string
        {
        }

        public function indexKey(): array
        {
        }

        public function condition(): ?string
        {
        }
    }

    class CreateQueryIndexOptions
    {
        public function condition(string $condition): CreateQueryIndexOptions
        {
        }

        public function ignoreIfExists(bool $shouldIgnore): CreateQueryIndexOptions
        {
        }

        public function numReplicas(int $number): CreateQueryIndexOptions
        {
        }

        public function deferred(bool $isDeferred): CreateQueryIndexOptions
        {
        }
    }

    class CreateQueryPrimaryIndexOptions
    {
        public function indexName(string $name): CreateQueryPrimaryIndexOptions
        {
        }

        public function ignoreIfExists(bool $shouldIgnore): CreateQueryPrimaryIndexOptions
        {
        }

        public function numReplicas(int $number): CreateQueryPrimaryIndexOptions
        {
        }

        public function deferred(bool $isDeferred): CreateQueryPrimaryIndexOptions
        {
        }
    }

    class DropQueryIndexOptions
    {
        public function ignoreIfNotExists(bool $shouldIgnore): DropQueryIndexOptions
        {
        }
    }

    class DropQueryPrimaryIndexOptions
    {
        public function indexName(string $name): DropQueryPrimaryIndexOptions
        {
        }

        public function ignoreIfNotExists(bool $shouldIgnore): DropQueryPrimaryIndexOptions
        {
        }
    }

    class WatchQueryIndexesOptions
    {
        public function watchPrimary(bool $shouldWatch): WatchQueryIndexesOptions
        {
        }
    }

    class QueryIndexManager
    {
        public function getAllIndexes(string $bucketName): array
        {
        }

        public function createIndex(string $bucketName, string $indexName, array $fields, CreateQueryIndexOptions $options = null)
        {
        }

        public function createPrimaryIndex(string $bucketName, CreateQueryPrimaryIndexOptions $options = null)
        {
        }

        public function dropIndex(string $bucketName, string $indexName, DropQueryIndexOptions $options = null)
        {
        }

        public function dropPrimaryIndex(string $bucketName, DropQueryPrimaryIndexOptions $options = null)
        {
        }

        public function watchIndexes(string $bucketName, array $indexNames, int $timeout, WatchQueryIndexesOptions $options = null)
        {
        }

        public function buildDeferredIndexes(string $bucketName)
        {
        }
    }

    class SearchIndex implements JsonSerializable
    {
        public function jsonSerialize() {}

        public function type(): string
        {
        }

        public function uuid(): string
        {
        }

        public function params(): array
        {
        }

        public function sourceType(): string
        {
        }

        public function sourceUuid(): string
        {
        }

        public function sourceName(): string
        {
        }

        public function sourceParams(): array
        {
        }

        public function setType(string $type): SearchIndex
        {
        }

        public function setUuid(string $uuid): SearchIndex
        {
        }

        public function setParams(string $params): SearchIndex
        {
        }

        public function setSourceType(string $type): SearchIndex
        {
        }

        public function setSourceUuid(string $uuid): SearchIndex
        {
        }

        public function setSourcename(string $params): SearchIndex
        {
        }

        public function setSourceParams(string $params): SearchIndex
        {
        }
    }

    class SearchIndexManager
    {
        public function getIndex(string $name): SearchIndex
        {
        }

        public function getAllIndexes(): array
        {
        }

        public function upsertIndex(SearchIndex $indexDefinition)
        {
        }

        public function dropIndex(string $name)
        {
        }

        public function getIndexedDocumentsCount(string $indexName): int
        {
        }

        public function pauseIngest(string $indexName)
        {
        }

        public function resumeIngest(string $indexName)
        {
        }

        public function allowQuerying(string $indexName)
        {
        }

        public function disallowQuerying(string $indexName)
        {
        }

        public function freezePlan(string $indexName)
        {
        }

        public function unfreezePlan(string $indexName)
        {
        }

        public function analyzeDocument(string $indexName, $document)
        {
        }
    }

    class Cluster
    {
        public function __construct(string $connstr, ClusterOptions $options)
        {
        }

        public function bucket(string $name): Bucket
        {
        }

        public function query(string $statement, QueryOptions $options = null)
        {
        }

        public function analyticsQuery(string $statement, AnalyticsOptions $options = null)
        {
        }

        public function searchQuery(string $indexName, SearchQuery $query, SearchOptions $options = null)
        {
        }

        public function buckets(): BucketManager
        {
        }

        public function users(): UserManager
        {
        }

        public function queryIndexes(): QueryIndexManager
        {
        }

        public function searchIndexes(): SearchIndexManager
        {
        }
    }

    class BucketSettings
    {
        public function name(): string
        {
        }

        public function flushEnabled(): bool
        {
        }

        public function ramQuotaMb(): int
        {
        }

        public function numReplicas(): int
        {
        }

        public function replicaIndexes(): bool
        {
        }

        public function bucketType(): string
        {
        }

        public function ejectionMethod(): string
        {
        }

        public function maxTtl(): int
        {
        }

        public function compressionMode(): string
        {
        }

        public function setName(string $name): BucketSettings
        {
        }

        public function enableFlush(bool $enable): BucketSettings
        {
        }

        public function setRamQuotaMb(int $sizeInMb): BucketSettings
        {
        }

        public function setNumReplicas(int $numReplicas): BucketSettings
        {
        }

        public function enableReplicaIndexes(bool $enable): BucketSettings
        {
        }

        public function setBucketType(string $type): BucketSettings
        {
        }

        public function setEjectionMethod(string $method): BucketSettings
        {
        }

        public function setMaxTtl(int $ttlSeconds): BucketSettings
        {
        }

        public function setCompressionMode(string $mode): BucketSettings
        {
        }
    }

    class BucketManager
    {
        public function createBucket(BucketSettings $settings)
        {
        }

        public function removeBucket(string $name)
        {
        }

        public function getBucket(string $name): BucketSettings
        {
        }

        public function getAllBuckets(): array
        {
        }

        public function flush(string $name)
        {
        }
    }

    class Role
    {
        public function name(): string
        {
        }

        public function bucket(): ?string
        {
        }

        public function setName(string $name): Role
        {
        }

        public function setBucket(string $bucket): Role
        {
        }
    }

    class RoleAndDescription
    {
        public function role(): Role
        {
        }

        public function displayName(): string
        {
        }

        public function description(): string
        {
        }
    }

    class Origin
    {
        public function type(): string
        {
        }

        public function name(): string
        {
        }
    }

    class RoleAndOrigin
    {
        public function role(): Role
        {
        }

        public function origins(): array
        {
        }
    }

    class User
    {
        public function username(): string
        {
        }

        public function displayName(): string
        {
        }

        public function groups(): array
        {
        }

        public function roles(): array
        {
        }

        public function setUsername(string $username): User
        {
        }

        public function setPassword(string $password): User
        {
        }

        public function setDisplayName(string $name): User
        {
        }

        public function setGroups(array $groups): User
        {
        }

        public function setRoles(array $roles): User
        {
        }
    }

    class Group
    {
        public function name(): string
        {
        }

        public function description(): string
        {
        }

        public function roles(): array
        {
        }

        public function ldapGroupReference(): ?string
        {
        }

        public function setName(string $name): Group
        {
        }

        public function setDescription(string $description): Group
        {
        }

        public function setRoles(array $roles): Group
        {
        }
    }

    class UserAndMetadata
    {
        public function domain(): string
        {
        }

        public function user(): User
        {
        }

        public function effectiveRoles(): array
        {
        }

        public function passwordChanged(): string
        {
        }

        public function externalGroups(): array
        {
        }
    }

    class GetAllUsersOptions
    {
        public function domainName(string $name): GetAllUsersOptions
        {
        }
    }

    class GetUserOptions
    {
        public function domainName(string $name): GetUserOptions
        {
        }
    }

    class DropUserOptions
    {
        public function domainName(string $name): DropUserOptions
        {
        }
    }

    class UpsertUserOptions
    {
        public function domainName(string $name): DropUserOptions
        {
        }
    }

    class UserManager
    {
        public function getUser(string $name, GetUserOptions $options = null): UserAndMetadata
        {
        }

        public function getAllUsers(GetAllUsersOptions $options = null): array
        {
        }

        public function upsertUser(User $user)
        {
        }

        public function dropUser(string $name, DropUserOptions $options = null)
        {
        }

        public function getRoles(): array
        {
        }

        public function getGroup(string $name): Group
        {
        }

        public function getAllGroups(): array
        {
        }

        public function upsertGroup(Group $group)
        {
        }

        public function dropGroup(string $name)
        {
        }
    }

    class BinaryCollection
    {
        public function name(): string
        {
        }

        public function append(string $id, string $value, AppendOptions $options = null): StoreResult
        {
        }

        public function prepend(string $id, string $value, PrependOptions $options = null): StoreResult
        {
        }

        public function increment(string $id, IncrementOptions $options = null): CounterResult
        {
        }

        public function decrement(string $id, DecrementOptions $options = null): CounterResult
        {
        }
    }

    class Collection
    {
        public function name(): string
        {
        }

        public function get(string $id, GetOptions $options = null): GetResult
        {
        }

        public function exists(string $id, ExistsOptions $options = null): ExistsResult
        {
        }

        public function getAndLock(string $id, int $lockTime, GetAndLockOptions $options = null): GetResult
        {
        }

        public function getAndTouch(string $id, int $expiry, GetAndTouchOptions $options = null): GetResult
        {
        }

        public function getAnyReplica(string $id, GetAnyReplicaOptions $options = null): GetReplicaResult
        {
        }

        public function getAllReplicas(string $id, GetAllReplicaOptions $options = null): array
        {
        }

        public function upsert(string $id, $value, UpsertOptions $options = null): StoreResult
        {
        }

        public function insert(string $id, $value, InsertOptions $options = null): StoreResult
        {
        }

        public function replace(string $id, $value, ReplaceOptions $options = null): StoreResult
        {
        }

        public function remove(string $id, RemoveOptions $options = null): MutationResult
        {
        }

        public function unlock(string $id, string $cas, UnlockOptions $options = null): Result
        {
        }

        public function touch(string $id, int $expiry, TouchOptions $options = null): MutationResult
        {
        }

        public function lookupIn(string $id, array $specs, LookupInOptions $options = null): LookupInResult
        {
        }

        public function mutateIn(string $id, array $specs, MutateInOptions $options = null): MutateInResult
        {
        }

        public function binary(): BinaryCollection
        {
        }
    }

    class Scope
    {
        public function __construct(Bucket $bucket, string $name)
        {
        }

        public function name(): string
        {
        }

        public function collection(string $name): Collection
        {
        }
    }

    class ScopeSpec
    {
        public function name(): string
        {
        }

        public function collections(): array
        {
        }
    }

    class CollectionSpec
    {
        public function name(): string
        {
        }

        public function scopeName(): string
        {
        }

        public function setName(string $name): CollectionSpec
        {
        }

        public function setScopeName(string $name): CollectionSpec
        {
        }
    }

    class CollectionManager
    {
        public function getScope(string $name): ScopeSpec
        {
        }

        public function getAllScopes(): array
        {
        }

        public function createScope(string $name)
        {
        }

        public function dropScope(string $name)
        {
        }

        public function createCollection(CollectionSpec $collection)
        {
        }

        public function dropCollection(CollectionSpec $collection)
        {
        }
    }

    class Bucket
    {
        public function defaultScope(): Collection
        {
        }

        public function defaultCollection(): Collection
        {
        }

        public function scope(string $name): Scope
        {
        }

        public function setTranscoder(callable $encoder, callable $decoder)
        {
        }

        public function name(): string
        {
        }

        public function viewQuery(string $designDoc, string $viewName, ViewOptions $options = null): ViewResult
        {
        }

        public function collections(): CollectionManager
        {
        }

        public function viewIndexes(): ViewIndexManager
        {
        }

        public function ping($services, $reportId)
        {
        }

        public function diagnostics($reportId)
        {
        }
    }

    class View
    {
        public function name(): string
        {
        }

        public function map(): string
        {
        }

        public function reduce(): string
        {
        }

        public function setName(string $name): View
        {<commit_msg>PCBC-671: Add API reference docs for cluster/bucket etc...<commit_after><?php
/**
 * INI entries:
 *
 * * `couchbase.log_level` (string), default: `"WARN"`
 *
 *   controls amount of information, the module will send to PHP error log. Accepts the following values in order of
 *   increasing verbosity: `"FATAL"`, `"ERROR"`, `"WARN"`, `"INFO"`, `"DEBUG"`, `"TRACE"`.
 *
 * * `couchbase.encoder.format` (string), default: `"json"`
 *
 *   selects serialization format for default encoder (\Couchbase\defaultEncoder). Accepts the following values:
 *   * `"json"` - encodes objects and arrays as JSON object (using `json_encode()`), primitives written in stringified form,
 *      which is allowed for most of the JSON parsers as valid values. For empty arrays JSON array preferred, if it is
 *      necessary, use `new stdClass()` to persist empty JSON object. Note, that only JSON format considered supported by
 *      all Couchbase SDKs, everything else is private implementation (i.e. `"php"` format won't be readable by .NET SDK).
 *   * `"php"` - uses PHP serialize() method to encode the document.
 *
 * * `couchbase.encoder.compression` (string), default: `"none"`
 *
 *   selects compression algorithm. Also see related compression options below. Accepts the following values:
 *   * `"fastlz"` - uses FastLZ algorithm. The module might be configured to use system fastlz library during build,
 *     othewise vendored version will be used. This algorithm is always available.
 *   * `"zlib"` - uses compression implemented by libz. Might not be available, if the system didn't have libz headers
 *     during build phase. In this case \Couchbase\HAVE_ZLIB will be false.
 *   * `"off"` or `"none"` - compression will be disabled, but the library will still read compressed values.
 *
 * * `couchbase.encoder.compression_threshold` (long), default: `0`
 *
 *   controls minimum size of the document value in bytes to use compression. For example, if threshold 100 bytes,
 *   and the document size is 50, compression will be disabled for this particular document.
 *
 * * `couchbase.encoder.compression_factor` (float), default: `0.0`
 *
 *   controls the minimum ratio of the result value and original document value to proceed with persisting compressed
 *   bytes. For example, the original document consists of 100 bytes. In this case factor 1.0 will require compressor
 *   to yield values not larger than 100 bytes (100/1.0), and 1.5 -- not larger than 66 bytes (100/1.5).
 *
 * * `couchbase.decoder.json_arrays` (boolean), default: `false`
 *
 *   controls the form of the documents, returned by the server if they were in JSON format. When true, it will generate
 *   arrays of arrays, otherwise instances of stdClass.
 *
 * * `couchbase.pool.max_idle_time_sec` (long), default: `60`
 *
 *   controls the maximum interval the underlying connection object could be idle, i.e. without any data/query
 *   operations. All connections which idle more than this interval will be closed automatically. Cleanup function
 *   executed after each request using RSHUTDOWN hook.
 *
 * @package Couchbase
 */

namespace Couchbase {

    use \JsonSerializable;
    use \Exception;
    use \Throwable;

    /**
     * An object which contains meta information of the document needed to enforce query consistency.
     */
    interface MutationToken
    {
        /**
         * Returns bucket name
         *
         * @return string
         */
        public function bucketName();

        /**
         * Returns partition number
         *
         * @return int
         */
        public function partitionId();

        /**
         * Returns UUID of the partition
         *
         * @return string
         */
        public function partitionUuid();

        /**
         * Returns the sequence number inside partition
         *
         * @return string
         */
        public function sequenceNumber();
    }


    interface QueryMetaData
    {
        public function status(): ?string;

        public function requestId(): ?string;

        public function clientContextId(): ?string;

        public function signature(): ?array;

        public function warnings(): ?array;

        public function errors(): ?array;

        public function metrics(): ?array;

        public function profile(): ?array;
    }

    interface SearchMetaData
    {
        public function successCount(): ?int;

        public function errorCount(): ?int;

        public function took(): ?int;

        public function totalHits(): ?int;

        public function maxScore(): ?float;

        public function metrics(): ?array;
    }

    interface ViewMetaData
    {
        public function totalRows(): ?int;

        public function debug(): ?array;
    }

    interface Result
    {
        public function cas(): ?string;
    }

    interface GetResult extends Result
    {
        public function content(): ?array;
    }

    interface GetReplicaResult extends Result
    {
        public function content(): ?array;

        public function isReplica(): bool;
    }

    interface ExistsResult extends Result
    {
        public function exists(): bool;
    }

    interface MutationResult extends Result
    {
        public function mutationToken(): ?MutationToken;
    }

    interface CounterResult extends MutationResult
    {
        public function content(): int;
    }

    interface LookupInResult extends Result
    {
        public function content(int $index): ?object;

        public function exists(int $index): bool;

        public function status(int $index): int;
    }

    interface MutateInResult extends MutationResult
    {
        public function content(int $index): ?array;
    }

    interface QueryResult
    {
        public function metaData(): ?QueryMetaData;

        public function rows(): ?array;
    }

    interface AnalyticsResult
    {
        public function metaData(): ?QueryMetaData;

        public function rows(): ?array;
    }

    interface SearchResult
    {
        public function metaData(): ?SearchMetaData;

        public function facets(): ?array;

        public function rows(): ?array;
    }

    interface ViewResult
    {
        public function metaData(): ?ViewMetaData;

        public function rows(): ?array;
    }

    class ViewRow
    {
        public function id(): ?string
        {
        }

        public function key()
        {
        }

        public function value()
        {
        }

        public function document()
        {
        }
    }

    class BaseException extends Exception implements Throwable
    {
        public function ref(): ?string
        {
        }

        public function context(): ?object
        {
        }
    }

    class HttpException extends BaseException implements Throwable
    {
    }

    class QueryException extends HttpException implements Throwable
    {
    }

    class QueryErrorException extends QueryException implements Throwable
    {
    }

    class QueryServiceException extends QueryException implements Throwable
    {
    }

    class SearchException extends HttpException implements Throwable
    {
    }

    class AnalyticsException extends HttpException implements Throwable
    {
    }

    class ViewException extends HttpException implements Throwable
    {
    }

    class PartialViewException extends HttpException implements Throwable
    {
    }

    class BindingsException extends BaseException implements Throwable
    {
    }

    class InvalidStateException extends BaseException implements Throwable
    {
    }

    class KeyValueException extends BaseException implements Throwable
    {
    }

    class KeyNotFoundException extends KeyValueException implements Throwable
    {
    }

    class KeyExistsException extends KeyValueException implements Throwable
    {
    }

    class ValueTooBigException extends KeyValueException implements Throwable
    {
    }

    class KeyLockedException extends KeyValueException implements Throwable
    {
    }

    class TempFailException extends KeyValueException implements Throwable
    {
    }

    class PathNotFoundException extends KeyValueException implements Throwable
    {
    }

    class PathExistsException extends KeyValueException implements Throwable
    {
    }

    class InvalidRangeException extends KeyValueException implements Throwable
    {
    }

    class KeyDeletedException extends KeyValueException implements Throwable
    {
    }

    class CasMismatchException extends KeyValueException implements Throwable
    {
    }

    class InvalidConfigurationException extends BaseException implements Throwable
    {
    }

    class ServiceMissingException extends BaseException implements Throwable
    {
    }

    class NetworkException extends BaseException implements Throwable
    {
    }

    class TimeoutException extends BaseException implements Throwable
    {
    }

    class BucketMissingException extends BaseException implements Throwable
    {
    }

    class ScopeMissingException extends BaseException implements Throwable
    {
    }

    class CollectionMissingException extends BaseException implements Throwable
    {
    }

    class AuthenticationException extends BaseException implements Throwable
    {
    }

    class BadInputException extends BaseException implements Throwable
    {
    }

    class DurabilityException extends BaseException implements Throwable
    {
    }

    class SubdocumentException extends BaseException implements Throwable
    {
    }

    class QueryIndex
    {
        public function name(): string
        {
        }

        public function isPrimary(): bool
        {
        }

        public function type(): string
        {
        }

        public function state(): string
        {
        }

        public function keyspace(): string
        {
        }

        public function indexKey(): array
        {
        }

        public function condition(): ?string
        {
        }
    }

    class CreateQueryIndexOptions
    {
        public function condition(string $condition): CreateQueryIndexOptions
        {
        }

        public function ignoreIfExists(bool $shouldIgnore): CreateQueryIndexOptions
        {
        }

        public function numReplicas(int $number): CreateQueryIndexOptions
        {
        }

        public function deferred(bool $isDeferred): CreateQueryIndexOptions
        {
        }
    }

    class CreateQueryPrimaryIndexOptions
    {
        public function indexName(string $name): CreateQueryPrimaryIndexOptions
        {
        }

        public function ignoreIfExists(bool $shouldIgnore): CreateQueryPrimaryIndexOptions
        {
        }

        public function numReplicas(int $number): CreateQueryPrimaryIndexOptions
        {
        }

        public function deferred(bool $isDeferred): CreateQueryPrimaryIndexOptions
        {
        }
    }

    class DropQueryIndexOptions
    {
        public function ignoreIfNotExists(bool $shouldIgnore): DropQueryIndexOptions
        {
        }
    }

    class DropQueryPrimaryIndexOptions
    {
        public function indexName(string $name): DropQueryPrimaryIndexOptions
        {
        }

        public function ignoreIfNotExists(bool $shouldIgnore): DropQueryPrimaryIndexOptions
        {
        }
    }

    class WatchQueryIndexesOptions
    {
        public function watchPrimary(bool $shouldWatch): WatchQueryIndexesOptions
        {
        }
    }

    class QueryIndexManager
    {
        public function getAllIndexes(string $bucketName): array
        {
        }

        public function createIndex(string $bucketName, string $indexName, array $fields, CreateQueryIndexOptions $options = null)
        {
        }

        public function createPrimaryIndex(string $bucketName, CreateQueryPrimaryIndexOptions $options = null)
        {
        }

        public function dropIndex(string $bucketName, string $indexName, DropQueryIndexOptions $options = null)
        {
        }

        public function dropPrimaryIndex(string $bucketName, DropQueryPrimaryIndexOptions $options = null)
        {
        }

        public function watchIndexes(string $bucketName, array $indexNames, int $timeout, WatchQueryIndexesOptions $options = null)
        {
        }

        public function buildDeferredIndexes(string $bucketName)
        {
        }
    }

    class SearchIndex implements JsonSerializable
    {
        public function jsonSerialize() {}

        public function type(): string
        {
        }

        public function uuid(): string
        {
        }

        public function params(): array
        {
        }

        public function sourceType(): string
        {
        }

        public function sourceUuid(): string
        {
        }

        public function sourceName(): string
        {
        }

        public function sourceParams(): array
        {
        }

        public function setType(string $type): SearchIndex
        {
        }

        public function setUuid(string $uuid): SearchIndex
        {
        }

        public function setParams(string $params): SearchIndex
        {
        }

        public function setSourceType(string $type): SearchIndex
        {
        }

        public function setSourceUuid(string $uuid): SearchIndex
        {
        }

        public function setSourcename(string $params): SearchIndex
        {
        }

        public function setSourceParams(string $params): SearchIndex
        {
        }
    }

    class SearchIndexManager
    {
        public function getIndex(string $name): SearchIndex
        {
        }

        public function getAllIndexes(): array
        {
        }

        public function upsertIndex(SearchIndex $indexDefinition)
        {
        }

        public function dropIndex(string $name)
        {
        }

        public function getIndexedDocumentsCount(string $indexName): int
        {
        }

        public function pauseIngest(string $indexName)
        {
        }

        public function resumeIngest(string $indexName)
        {
        }

        public function allowQuerying(string $indexName)
        {
        }

        public function disallowQuerying(string $indexName)
        {
        }

        public function freezePlan(string $indexName)
        {
        }

        public function unfreezePlan(string $indexName)
        {
        }

        public function analyzeDocument(string $indexName, $document)
        {
        }
    }

    /**
     * Cluster is an object containing functionality for performing cluster level operations
     * against a cluster and for access to buckets.
     */
    class Cluster
    {
        public function __construct(string $connstr, ClusterOptions $options)
        {
        }

        /**
         * Returns a new bucket object.
         *
         * @param string $name the name of the bucket
         * @return Bucket
         */
        public function bucket(string $name): Bucket
        {
        }

        /**
         * Executes a N1QL query against the cluster.
         * Note: On Couchbase Server versions < 6.5 a bucket must be opened before using query.
         *
         * @param string $statement the N1QL query statement to execute
         * @param QueryOptions $options the options to use when executing the query
         * @return QueryResult
         */
        public function query(string $statement, QueryOptions $options = null): QueryResult
        {
        }

        /**
         * Executes an analytics query against the cluster.
         * Note: On Couchbase Server versions < 6.5 a bucket must be opened before using analyticsQuery.
         *
         * @param string $statement the analytics query statement to execute
         * @param AnalyticsOptions $options the options to use when executing the query
         * @return AnalyticsResult
         */
        public function analyticsQuery(string $statement, AnalyticsOptions $options = null): AnalyticsResult
        {
        }

        /**
         * Executes a full text search query against the cluster.
         * Note: On Couchbase Server versions < 6.5 a bucket must be opened before using searchQuery.
         *
         * @param string $indexName the fts index to use for the query
         * @param SearchQuery $query the search query to execute
         * @param SearchOptions $options the options to use when executing the query
         * @return SearchResult
         */
        public function searchQuery(string $indexName, SearchQuery $query, SearchOptions $options = null): SearchResult
        {
        }

        /**
         * Creates a new bucket manager object for managing buckets.
         *
         * @return BucketManager
         */
        public function buckets(): BucketManager
        {
        }

        /**
         * Creates a new user manager object for managing users and groups.
         *
         * @return UserManager
         */
        public function users(): UserManager
        {
        }

        /**
         * Creates a new query index manager object for managing N1QL query indexes.
         *
         * @return QueryIndexManager
         */
        public function queryIndexes(): QueryIndexManager
        {
        }

        /**
         * Creates a new search index manager object for managing search query indexes.
         *
         * @return SearchIndexManager
         */
        public function searchIndexes(): SearchIndexManager
        {
        }
    }

    class BucketSettings
    {
        public function name(): string
        {
        }

        public function flushEnabled(): bool
        {
        }

        public function ramQuotaMb(): int
        {
        }

        public function numReplicas(): int
        {
        }

        public function replicaIndexes(): bool
        {
        }

        public function bucketType(): string
        {
        }

        public function ejectionMethod(): string
        {
        }

        public function maxTtl(): int
        {
        }

        public function compressionMode(): string
        {
        }

        public function setName(string $name): BucketSettings
        {
        }

        public function enableFlush(bool $enable): BucketSettings
        {
        }

        public function setRamQuotaMb(int $sizeInMb): BucketSettings
        {
        }

        public function setNumReplicas(int $numReplicas): BucketSettings
        {
        }

        public function enableReplicaIndexes(bool $enable): BucketSettings
        {
        }

        public function setBucketType(string $type): BucketSettings
        {
        }

        public function setEjectionMethod(string $method): BucketSettings
        {
        }

        public function setMaxTtl(int $ttlSeconds): BucketSettings
        {
        }

        public function setCompressionMode(string $mode): BucketSettings
        {
        }
    }

    class BucketManager
    {
        public function createBucket(BucketSettings $settings)
        {
        }

        public function removeBucket(string $name)
        {
        }

        public function getBucket(string $name): BucketSettings
        {
        }

        public function getAllBuckets(): array
        {
        }

        public function flush(string $name)
        {
        }
    }

    class Role
    {
        public function name(): string
        {
        }

        public function bucket(): ?string
        {
        }

        public function setName(string $name): Role
        {
        }

        public function setBucket(string $bucket): Role
        {
        }
    }

    class RoleAndDescription
    {
        public function role(): Role
        {
        }

        public function displayName(): string
        {
        }

        public function description(): string
        {
        }
    }

    class Origin
    {
        public function type(): string
        {
        }

        public function name(): string
        {
        }
    }

    class RoleAndOrigin
    {
        public function role(): Role
        {
        }

        public function origins(): array
        {
        }
    }

    class User
    {
        public function username(): string
        {
        }

        public function displayName(): string
        {
        }

        public function groups(): array
        {
        }

        public function roles(): array
        {
        }

        public function setUsername(string $username): User
        {
        }

        public function setPassword(string $password): User
        {
        }

        public function setDisplayName(string $name): User
        {
        }

        public function setGroups(array $groups): User
        {
        }

        public function setRoles(array $roles): User
        {
        }
    }

    class Group
    {
        public function name(): string
        {
        }

        public function description(): string
        {
        }

        public function roles(): array
        {
        }

        public function ldapGroupReference(): ?string
        {
        }

        public function setName(string $name): Group
        {
        }

        public function setDescription(string $description): Group
        {
        }

        public function setRoles(array $roles): Group
        {
        }
    }

    class UserAndMetadata
    {
        public function domain(): string
        {
        }

        public function user(): User
        {
        }

        public function effectiveRoles(): array
        {
        }

        public function passwordChanged(): string
        {
        }

        public function externalGroups(): array
        {
        }
    }

    class GetAllUsersOptions
    {
        public function domainName(string $name): GetAllUsersOptions
        {
        }
    }

    class GetUserOptions
    {
        public function domainName(string $name): GetUserOptions
        {
        }
    }

    class DropUserOptions
    {
        public function domainName(string $name): DropUserOptions
        {
        }
    }

    class UpsertUserOptions
    {
        public function domainName(string $name): DropUserOptions
        {
        }
    }

    class UserManager
    {
        public function getUser(string $name, GetUserOptions $options = null): UserAndMetadata
        {
        }

        public function getAllUsers(GetAllUsersOptions $options = null): array
        {
        }

        public function upsertUser(User $user)
        {
        }

        public function dropUser(string $name, DropUserOptions $options = null)
        {
        }

        public function getRoles(): array
        {
        }

        public function getGroup(string $name): Group
        {
        }

        public function getAllGroups(): array
        {
        }

        public function upsertGroup(Group $group)
        {
        }

        public function dropGroup(string $name)
        {
        }
    }

    class BinaryCollection
    {
        public function name(): string
        {
        }

        public function append(string $id, string $value, AppendOptions $options = null): StoreResult
        {
        }

        public function prepend(string $id, string $value, PrependOptions $options = null): StoreResult
        {
        }

        public function increment(string $id, IncrementOptions $options = null): CounterResult
        {
        }

        public function decrement(string $id, DecrementOptions $options = null): CounterResult
        {
        }
    }

    class Collection
    {
        public function name(): string
        {
        }

        public function get(string $id, GetOptions $options = null): GetResult
        {
        }

        public function exists(string $id, ExistsOptions $options = null): ExistsResult
        {
        }

        public function getAndLock(string $id, int $lockTime, GetAndLockOptions $options = null): GetResult
        {
        }

        public function getAndTouch(string $id, int $expiry, GetAndTouchOptions $options = null): GetResult
        {
        }

        public function getAnyReplica(string $id, GetAnyReplicaOptions $options = null): GetReplicaResult
        {
        }

        public function getAllReplicas(string $id, GetAllReplicaOptions $options = null): array
        {
        }

        public function upsert(string $id, $value, UpsertOptions $options = null): StoreResult
        {
        }

        public function insert(string $id, $value, InsertOptions $options = null): StoreResult
        {
        }

        public function replace(string $id, $value, ReplaceOptions $options = null): StoreResult
        {
        }

        public function remove(string $id, RemoveOptions $options = null): MutationResult
        {
        }

        public function unlock(string $id, string $cas, UnlockOptions $options = null): Result
        {
        }

        public function touch(string $id, int $expiry, TouchOptions $options = null): MutationResult
        {
        }

        public function lookupIn(string $id, array $specs, LookupInOptions $options = null): LookupInResult
        {
        }

        public function mutateIn(string $id, array $specs, MutateInOptions $options = null): MutateInResult
        {
        }

        public function binary(): BinaryCollection
        {
        }
    }

    /**
     * Scope is an object for providing access to collections.
     */
    class Scope
    {
        public function __construct(Bucket $bucket, string $name)
        {
        }

        /**
         * Returns the name of the scope.
         *
         * @return string
         */
        public function name(): string
        {
        }

        /**
         * Returns a new Collection object representing the collection specified.
         *
         * @param string $name the name of the collection
         * @return Collection
         */
        public function collection(string $name): Collection
        {
        }
    }

    class ScopeSpec
    {
        public function name(): string
        {
        }

        public function collections(): array
        {
        }
    }

    class CollectionSpec
    {
        public function name(): string
        {
        }

        public function scopeName(): string
        {
        }

        public function setName(string $name): CollectionSpec
        {
        }

        public function setScopeName(string $name): CollectionSpec
        {
        }
    }

    class CollectionManager
    {
        public function getScope(string $name): ScopeSpec
        {
        }

        public function getAllScopes(): array
        {
        }

        public function createScope(string $name)
        {
        }

        public function dropScope(string $name)
        {
        }

        public function createCollection(CollectionSpec $collection)
        {
        }

        public function dropCollection(CollectionSpec $collection)
        {
        }
    }

    /**
     * Bucket is an object containing functionality for performing bucket level operations
     * against a cluster and for access to scopes and collections.
     */
    class Bucket
    {
        /**
         * Returns a new Scope object representing the default scope.
         *
         * @return Scope
         */
        public function defaultScope(): Scope
        {
        }

        /**
         * Returns a new Collection object representing the default collectiom.
         *
         * @return Collection
         */
        public function defaultCollection(): Collection
        {
        }

        /**
         * Returns a new Scope object representing the given scope.
         *
         * @param string $name the name of the scope
         * @return Scope
         */
        public function scope(string $name): Scope
        {
        }

        /**
         * Sets the default transcoder to be used when fetching or sending data.
         *
         * @param callable $encode the encoder to use to encode data when sending data to the server
         * @param callable $decoder the decoder to use to decode data when retrieving data from the server
         */
        public function setTranscoder(callable $encoder, callable $decoder)
        {
        }

        /**
         * Returns the name of the Bucket.
         *
         * @return string
         */
        public function name(): string
        {
        }

        /**
         * Executes a view query against the cluster.
         *
         * @param string $designDoc the design document to use for the query
         * @param string $viewName the view to use for the query
         * @param ViewOptions $options the options to use when executing the query
         * @return ViewResult
         */
        public function viewQuery(string $designDoc, string $viewName, ViewOptions $options = null): ViewResult
        {
        }

        /**
         * Creates a new CollectionManager object for managing collections and scopes.
         *
         * @return CollectionManager
         */
        public function collections(): CollectionManager
        {
        }

        /**
         * Creates a new ViewIndexManager object for managing views and design documents.
         *
         * @return ViewIndexManager
         */
        public function viewIndexes(): ViewIndexManager
        {
        }

        /**
         * Executes a ping for each service against each node in the cluster. This can be used for determining
         * the current health of the cluster.
         *
         * @param $services the services to ping against
         * @param $reportId a name which will be included within the ping result
         */
        public function ping($services, $reportId)
        {
        }

        /**
         * Returns diagnostics information about connections that the SDK has to the cluster. This does not perform
         * any operations.
         *
         * @param $reportId a name which will be included within the ping result
         */
        public function diagnostics($reportId)
        {
        }
    }

    class View
    {
        public function name(): string
        {
        }

        public function map(): string
        {
        }

        public function reduce(): string
        {
        }

        public function setName(string $name): View
        {
{'fraction_non_alphanumeric': 0.07090342679127726, 'fraction_numerical': 0.0013529149977748109, 'mean_word_length': 1.8615964545871326, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3576584', 'n_tokens_mistral': 13912, 'n_tokens_neox': 13279, 'n_words': 4210}