Datastore/src/Key.php
public function setLastElementIdentifier($value, $type = Key::TYPE_ID)
    {
        $end = $this->pathEnd();
        $end[$type] = (string) $value;

        $elements = array_keys($this->path);
        $lastElement = end($elements);

        $this->path[$lastElement] = $end;
    }
public function setLastElementIdentifier($value, $type = Key::TYPE_ID)
    {
        $end = $this->pathEnd();
        $end[$type] = (string) $value;

        $elements = array_keys($this->path);
        $lastElement = end($elements);

        $this->path[$lastElement] = $end;
    }
public function setLastElementIdentifier ( $ value , $ type = Key :: TYPE_ID ) { $ end = $ this -> pathEnd ( ) ; $ end [ $ type ] = ( string ) $ value ; $ elements = array_keys ( $ this -> path ) ; $ lastElement = end ( $ elements ) ; $ this -> path [ $ lastElement ] = $ end ; }
Set the value of the last path element in a Key

This method is used internally when IDs are allocated to existing instances
of a Key. It should not generally be used externally.

Example:
```
$key = $datastore->key('Person');
$key->setLastElementIdentifier('Bob', Key::TYPE_NAME);
```

@param string $value The value of the ID or Name.
@param string $type [optional] 'id' or 'name'. **Defaults to** `"id"`.
@return void
@access private
Set the value of the last path element in a Key