public function testMultipleBuildWithReset() { $this->pointBuilder->setPrefixJavascriptVariable('foo')->setX(1)->setY(2); $point1 = $this->pointBuilder->build(); $this->pointBuilder->reset(); $point2 = $this->pointBuilder->build(); $this->assertSame('foo', substr($point1->getJavascriptVariable(), 0, 3)); $this->assertSame(1, $point1->getX()); $this->assertSame(2, $point1->getY()); $this->assertSame('point_', substr($point2->getJavascriptVariable(), 0, 6)); $this->assertSame(0, $point2->getX()); $this->assertSame(0, $point2->getY()); }
/** * {@inheritdoc} * * @return \Ivory\GoogleMap\Overlays\MarkerImage The marker image. */ public function build() { $markerImage = new $this->class(); if ($this->prefixJavascriptVariable !== null) { $markerImage->setPrefixJavascriptVariable($this->prefixJavascriptVariable); } if ($this->url !== null) { $markerImage->setUrl($this->url); } if (!empty($this->anchor)) { $anchor = $this->pointBuilder->reset()->setX($this->anchor[0])->setY($this->anchor[1])->build(); $markerImage->setAnchor($anchor); } if (!empty($this->origin)) { $origin = $this->pointBuilder->reset()->setX($this->origin[0])->setY($this->origin[1])->build(); $markerImage->setOrigin($origin); } if (!empty($this->scaledSize)) { $scaledSize = $this->sizeBuilder->reset()->setWidth($this->scaledSize[0])->setHeight($this->scaledSize[1])->setWidthUnit($this->scaledSize[2])->setHeightUnit($this->scaledSize[3])->build(); $markerImage->setScaledSize($scaledSize); } if (!empty($this->size)) { $size = $this->sizeBuilder->reset()->setWidth($this->size[0])->setHeight($this->size[1])->setWidthUnit($this->size[2])->setHeightUnit($this->size[3])->build(); $markerImage->setSize($size); } return $markerImage; }