NOTE: For Version 3 of the AWS SDK for PHP, please see the V3 User Guide and V3 API Reference.

# Class Grantee

Amazon S3 Grantee model

  Aws\S3\Model\Grantee implements Guzzle\Common\ToArrayInterface

Namespace: Aws\S3\Model
Located at Aws/S3/Model/Grantee.php

## Methods summary

- `public` `__construct ( string $id, string $displayName = null, string $expectedType = null )`

  Constructs a Grantee

- `public` `setId ( string $id, string $expectedType = null )`

  Sets the account ID, email, or URL identifying the grantee

- `public` `getId ( )`

  Gets the grantee identifier

- `public` `getEmailAddress ( )`

  Gets the grantee email address (if it is set)

- `public` `getGroupUri ( )`

  Gets the grantee URI (if it is set)

- `public` `setDisplayName ( string $displayName )`

  Sets the display name of the grantee

- `public` `getDisplayName ( )`

  Gets the grantee display name

- `public` `getType ( )`

  Gets the grantee type (determined by ID)

- `public` `isCanonicalUser ( )`

  Returns true if this grantee object represents a canonical user by ID

- `public` `isAmazonCustomerByEmail ( )`

  Returns true if this grantee object represents a customer by email

- `public` `isGroup ( )`

  Returns true if this grantee object represents a group by URL

- `public` `getHeaderValue ( )`

  Returns the value used in headers to specify this grantee

- `public` `toArray ( )`

  Get the array representation of an object

## Methods detail

# `public`
`__construct( string $id, string $displayName = null, string $expectedType = null )`

Constructs a Grantee

#### Parameters

$id
  `string`
  $id Grantee identifier
$displayName
  `string`
  $displayName Grantee display name
$expectedType
  `string`
  $expectedType The expected type of the grantee

# `public `Aws\S3\Model\Grantee``
`setId( string $id, string $expectedType = null )`

Sets the account ID, email, or URL identifying the grantee

#### Parameters

$id
  `string`
  $id Grantee identifier
$expectedType
  `string`
  $expectedType The expected type of the grantee

#### Returns

``Aws\S3\Model\Grantee``

#### Throws

``Aws\Common\Exception\UnexpectedValueException``
if $expectedType is set and the grantee is not of that type after instantiation
``Aws\Common\Exception\InvalidArgumentException``
when the ID provided is not a string
# `public string`
`getId( )`

Gets the grantee identifier

#### Returns

`string`
# `public null|string`
`getEmailAddress( )`

Gets the grantee email address (if it is set)

#### Returns

`null|string`
# `public null|string`
`getGroupUri( )`

Gets the grantee URI (if it is set)

#### Returns

`null|string`
# `public `Aws\S3\Model\Grantee``
`setDisplayName( string $displayName )`

Sets the display name of the grantee

#### Parameters

$displayName
  `string`
  $displayName Grantee name

#### Returns

``Aws\S3\Model\Grantee``

#### Throws

``Aws\Common\Exception\LogicException``
when the grantee type not CanonicalUser
# `public string`
`getDisplayName( )`

Gets the grantee display name

#### Returns

`string`
# `public string`
`getType( )`

Gets the grantee type (determined by ID)

#### Returns

`string`
# `public boolean`
`isCanonicalUser( )`

Returns true if this grantee object represents a canonical user by ID

#### Returns

`boolean`
# `public boolean`
`isAmazonCustomerByEmail( )`

Returns true if this grantee object represents a customer by email

#### Returns

`boolean`
# `public boolean`
`isGroup( )`

Returns true if this grantee object represents a group by URL

#### Returns

`boolean`
# `public string`
`getHeaderValue( )`

Returns the value used in headers to specify this grantee

#### Returns

`string`
# `public array`
`toArray( )`

Get the array representation of an object

#### Returns

`array`

#### Implementation of

`Guzzle\Common\ToArrayInterface::toArray()`

### Magic methods summary

## Properties summary

`protected static array` | $headerMap | # A map of grantee types to grant header value prefixes
`protected string` | $id | # The account ID, email, or URL identifying the grantee
`protected string` | $displayName | # The display name of the grantee
`protected string` | $type | # The type of the grantee (CanonicalUser or Group)