mirror of
https://github.com/cubixle/trustpilot-api-wrapper.git
synced 2026-04-25 00:14:46 +01:00
Updates.
Updated the review transformer to collect the author and removed setters as they are pointless here. Added new methods to the reviews controller and some sensible logic, so the API is not hit more than it needs to be.
This commit is contained in:
@@ -29,6 +29,11 @@ class ReviewTransformer
|
||||
*/
|
||||
private $rating;
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
private $author;
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
@@ -37,14 +42,6 @@ class ReviewTransformer
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $review
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
@@ -53,14 +50,6 @@ class ReviewTransformer
|
||||
return $this->review;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $review
|
||||
*/
|
||||
public function setReview($review)
|
||||
{
|
||||
$this->review = $review;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
@@ -69,14 +58,6 @@ class ReviewTransformer
|
||||
return $this->companyReply;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $companyReply
|
||||
*/
|
||||
public function setCompanyReply($companyReply)
|
||||
{
|
||||
$this->companyReply = $companyReply;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
@@ -85,14 +66,6 @@ class ReviewTransformer
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $createdAt
|
||||
*/
|
||||
public function setCreatedAt($createdAt)
|
||||
{
|
||||
$this->createdAt = $createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
@@ -101,14 +74,6 @@ class ReviewTransformer
|
||||
return $this->reviewLink;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $reviewLink
|
||||
*/
|
||||
public function setReviewLink($reviewLink)
|
||||
{
|
||||
$this->reviewLink = $reviewLink;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
@@ -118,11 +83,11 @@ class ReviewTransformer
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $rating
|
||||
* @return mixed
|
||||
*/
|
||||
public function setRating($rating)
|
||||
public function getAuthor()
|
||||
{
|
||||
$this->rating = $rating;
|
||||
return $this->author;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -148,12 +113,13 @@ class ReviewTransformer
|
||||
*/
|
||||
public function transform($review)
|
||||
{
|
||||
$reviewObj = new self;
|
||||
$reviewObj->setTitle($review['title']);
|
||||
$reviewObj->setReview($review['text']);
|
||||
$reviewObj->setCompanyReply($review['companyReply']['text']);
|
||||
$reviewObj->setRating($review['stars']);
|
||||
$reviewObj->setCreatedAt($review['createdAt']);
|
||||
$reviewObj = new self;
|
||||
$reviewObj->title = $review['title'];
|
||||
$reviewObj->review = $review['text'];
|
||||
$reviewObj->companyReply = $review['companyReply']['text'];
|
||||
$reviewObj->rating = $review['stars'];
|
||||
$reviewObj->createdAt = $review['createdAt'];
|
||||
$reviewObj->author = trim($review['consumer']['displayName']);
|
||||
|
||||
return $reviewObj;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user