Pantheon\Terminus\Models\SSHKey::getHex PHP Method

getHex() public method

Returns the hex for this SSH key
public getHex ( ) : string
return string
    public function getHex()
    {
        $hex = implode(':', str_split($this->id, 2));
        return $hex;
    }

Usage Example

Exemplo n.º 1
0
 public function testGetCommentHex()
 {
     $collection = $this->getMockBuilder(SSHKeys::class)->disableOriginalConstructor()->getMock();
     $collection->expects($this->once())->method('getUser')->willReturn((object) ['id' => '123']);
     $sshkey = new SSHKey((object) ['id' => '1234567890abcdef', 'key' => 'ssh-rsa AAAAB3xxx0uj+Q== [email protected]'], ['collection' => $collection]);
     $this->assertEquals('12:34:56:78:90:ab:cd:ef', $sshkey->getHex());
     $this->assertEquals('*****@*****.**', $sshkey->getComment());
 }