public function testCopy() { $value = 'test'; $string = new Str($value); $string2 = $string->copy(); $string3 = clone $string; $this->assertNotSame($string, $string2); $this->assertNotSame($string, $string3); $this->assertTrue($string2->sameValueAs($string)); $this->assertTrue($string3->sameValueAs($string)); }
public function __construct($value) { parent::__construct($value); try { Assertion::notEmpty($value); } catch (AssertionInvalidArgumentException $e) { throw new StrNotEmptyException($value); } $this->value = $value; }
/** * @inheritdoc. * * @param static $valueObject */ public function sameValueAs(ValueObjectInterface $valueObject) { return $this->iso31661Alpha2Code->sameValueAs($valueObject->iso31661Alpha2Code()) && $this->iso31661Alpha3Code->sameValueAs($valueObject->iso31661Alpha3Code()) && $this->iso31661NumericCode->sameValueAs($valueObject->iso31661NumericCode()) && $this->englishName->sameValueAs($valueObject->englishName()) && $this->phonePrefix->sameValueAs($valueObject->phonePrefix()); }