# Grafeas V1 Client - Class SourceContext (1.7.0)

1.7.0 (latest) 1.6.0 1.5.0 1.4.0 1.3.2 1.2.2 1.1.3 1.0.0 0.10.3 0.9.0 0.8.3 0.7.1 0.6.0 0.5.0 0.4.4 Reference documentation and code samples for the Grafeas V1 Client class SourceContext.

A SourceContext is a reference to a tree of files. A SourceContext together
with a path point to a unique revision of a single file or directory.

Generated from protobuf message `grafeas.v1.SourceContext`

## Namespace

Grafeas \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ cloud_repo` | `https://docs.cloud.google.com/php/docs/reference/grafeas/latest/V1.CloudRepoSourceContext` A SourceContext referring to a revision in a Google Cloud Source Repo. |
| `↳ gerrit` | `https://docs.cloud.google.com/php/docs/reference/grafeas/latest/V1.GerritSourceContext` A SourceContext referring to a Gerrit project. |
| `↳ git` | `https://docs.cloud.google.com/php/docs/reference/grafeas/latest/V1.GitSourceContext` A SourceContext referring to any third party Git repo (e.g., GitHub). |
| `↳ labels` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` Labels with user defined metadata. |

### getCloudRepo

A SourceContext referring to a revision in a Google Cloud Source Repo.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/grafeas/latest/V1.CloudRepoSourceContext|null` |   |

### hasCloudRepo

### setCloudRepo

A SourceContext referring to a revision in a Google Cloud Source Repo.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/grafeas/latest/V1.CloudRepoSourceContext` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getGerrit

A SourceContext referring to a Gerrit project.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/grafeas/latest/V1.GerritSourceContext|null` |   |

### hasGerrit

### setGerrit

A SourceContext referring to a Gerrit project.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/grafeas/latest/V1.GerritSourceContext` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getGit

A SourceContext referring to any third party Git repo (e.g., GitHub).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/grafeas/latest/V1.GitSourceContext|null` |   |

### hasGit

### setGit

A SourceContext referring to any third party Git repo (e.g., GitHub).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/grafeas/latest/V1.GitSourceContext` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getLabels

Labels with user defined metadata.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |   |

### setLabels

Labels with user defined metadata.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getContext

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |