/** * @param \stdClass $obj * @param array $context * @return TwitterSymbol */ public function unserialize($obj, array $context = []) { Assertion::true($this->canUnserialize($obj), 'object is not unserializable'); return TwitterSymbol::create($obj->text, $this->entityIndicesSerializer->unserialize($obj->indices)); }
/** * @test */ public function itShouldBuildTheObject() { $symbol = TwitterSymbol::create($this->text, $this->indices); $this->assertEquals($this->text, $symbol->getText()); $this->assertEquals($this->indices, $symbol->getIndices()); }