Renamed ViewpointRestorationPoint to ViewpointSnapshot

This commit is contained in:
Vassyli
2017-03-31 08:55:00 +02:00
parent a739aed94a
commit 5668c08f45
3 changed files with 20 additions and 20 deletions
+12 -12
View File
@@ -73,11 +73,11 @@ class Viewpoint implements CreateableInterface
/**
* Returns a restoration point that can be used to reconstruct the current viewpoint.
* @return ViewpointRestorationPoint
* @return ViewpointSnapshot
*/
public function getRestorationPoint(): ViewpointRestorationPoint
public function getSnapshot(): ViewpointSnapshot
{
$restoration = new ViewpointRestorationPoint(
$snapshot = new ViewpointSnapshot(
$this->getTitle(),
$this->getDescription(),
$this->getTemplate(),
@@ -86,21 +86,21 @@ class Viewpoint implements CreateableInterface
$this->getData()
);
return $restoration;
return $snapshot;
}
/**
* Changes the current viewpoint to the state saved in the given restoration point.
* @param ViewpointRestorationPoint $restoration
* @param ViewpointSnapshot $snapshot
*/
public function changeFromRestorationPoint(ViewpointRestorationPoint $restoration)
public function changeFromSnapshot(ViewpointSnapshot $snapshot)
{
$this->setTitle($restoration->getTitle());
$this->setDescription($restoration->getDescription());
$this->setTemplate($restoration->getTemplate());
$this->setActionGroups($restoration->getActionGroups());
$this->setAttachments($restoration->getAttachments());
$this->setData($restoration->getData());
$this->setTitle($snapshot->getTitle());
$this->setDescription($snapshot->getDescription());
$this->setTemplate($snapshot->getTemplate());
$this->setActionGroups($snapshot->getActionGroups());
$this->setAttachments($snapshot->getAttachments());
$this->setData($snapshot->getData());
}
/**
@@ -7,13 +7,13 @@ namespace LotGD\Core\Models;
* Represents a complete set of viewpoint data used to restore a saved viewpoint.
* @package LotGD\Core\Models
*/
class ViewpointRestorationPoint
class ViewpointSnapshot
{
private $title;
private $description;
private $template;
private $actionGroups;
private $attachements;
private $attachments;
private $data;
/**
@@ -22,7 +22,7 @@ class ViewpointRestorationPoint
* @param string $description
* @param string $template
* @param array $actionGroups
* @param array $attachements
* @param array $attachments
* @param array $data
*/
public function __construct(
@@ -30,7 +30,7 @@ class ViewpointRestorationPoint
string $description,
string $template,
array $actionGroups,
array $attachements,
array $attachments,
array $data
)
{
@@ -38,7 +38,7 @@ class ViewpointRestorationPoint
$this->description = $description;
$this->template = $template;
$this->actionGroups = $actionGroups;
$this->attachements = $attachements;
$this->attachments = $attachments;
$this->data = $data;
}
@@ -84,7 +84,7 @@ class ViewpointRestorationPoint
*/
public function getAttachments(): array
{
return $this->attachements;
return $this->attachments;
}
/**
+2 -2
View File
@@ -59,12 +59,12 @@ class ViewpointRestorationTest extends CoreModelTestCase
public function testIfViewpointAfterUnserializationIsEqualToBeforeItsSerialization()
{
$viewpoint = $this->getViewpoint();
$viewpointRestoration = $this->getViewpoint()->getRestorationPoint();
$viewpointRestoration = $this->getViewpoint()->getSnapshot();
$serialized = serialize($viewpointRestoration);
$viewpointRestored = unserialize($serialized);
$newViewpoint = $this->getAlternativeViewpoint();
$newViewpoint->changeFromRestorationPoint($viewpointRestored);
$newViewpoint->changeFromSnapshot($viewpointRestored);
$this->assertSame($viewpoint->getTitle(), $newViewpoint->getTitle());
$this->assertSame($viewpoint->getDescription(), $newViewpoint->getDescription());