eZ\Publish\Core\MVC\Symfony\Security\User\Identity::replaceInformation PHP Метод

replaceInformation() публичный Метод

Replaces the information already registered in the identity.
public replaceInformation ( array $information )
$information array Hash where key is the information type and value is a scalar.
    public function replaceInformation(array $information)
    {
        $this->identityInfo = $information;
        $this->resetHash();
    }

Usage Example

Пример #1
0
 /**
  * @covers eZ\Publish\Core\MVC\Symfony\Security\User\Identity::__construct
  * @covers eZ\Publish\Core\MVC\Symfony\Security\User\Identity::setInformation
  * @covers eZ\Publish\Core\MVC\Symfony\Security\User\Identity::getHash
  */
 public function testGetHash()
 {
     $identity = new Identity();
     $identity->setInformation('foo', 'bar');
     $hash1 = $identity->getHash();
     $this->assertInternalType('string', $hash1);
     $identity->setInformation('truc', 'muche');
     $hash2 = $identity->getHash();
     $this->assertInternalType('string', $hash2);
     $this->assertTrue($hash1 !== $hash2);
     $identity->setInformation('number', 123);
     $hash3 = $identity->getHash();
     $this->assertInternalType('string', $hash3);
     $this->assertTrue($hash3 !== $hash1);
     $this->assertTrue($hash3 !== $hash2);
     $identity->replaceInformation(array('foo' => 'bar'));
     $this->assertSame($hash1, $identity->getHash());
 }