Skip to content

Commit

Permalink
Merge pull request #31 from joldnl/development
Browse files Browse the repository at this point in the history
[FEATURE] Added referenceCode (wc order number) property to reviews
  • Loading branch information
JKetelaar authored Jun 7, 2022
2 parents b6e7816 + 4fcb8ec commit 3c3d8cb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/JKetelaar/Kiyoh/Factory/ReviewFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,11 @@ public static function createReview(SimpleXMLElement $element): Review
$comment = (isset($element->reviewComments) ? $element->reviewComments : '');
$dateSince = $element->dateSince;
$updatedSince = $element->updatedSince;
$referenceCode = $element->referenceCode;

$content = self::createReviewContent($element->reviewContent->reviewContent);

$review = new Review($id, $author, $city, (float) $rating, $comment, $dateSince, $updatedSince);
$review = new Review($id, $author, $city, (float) $rating, $comment, $dateSince, $updatedSince, $referenceCode);
$review->setContent($content);

return $review;
Expand Down
25 changes: 24 additions & 1 deletion src/JKetelaar/Kiyoh/Model/Review.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class Review
* @param string $comment
* @param string $dateSince
* @param string $updatedSince
* @param string $referenceCode
*/
public function __construct(
string $id,
Expand All @@ -68,13 +69,15 @@ public function __construct(
float $rating,
string $comment,
string $dateSince,
string $updatedSince
string $updatedSince,
string $referenceCode
) {
$this->id = $id;
$this->author = $author;
$this->city = $city;
$this->rating = $rating;
$this->comment = $comment;
$this->referenceCode = $referenceCode;

try {
$this->dateSince = new DateTime($dateSince);
Expand Down Expand Up @@ -284,4 +287,24 @@ public function setUpdatedSince(DateTime $updatedSince): self

return $this;
}

/**
* Retrieves the referenceCode from the review.
* @return string
*/
public function getReferenceCode(): string {
return $this->referenceCode;
}

/**
* @param string $referenceCode
*
* @return Review
*/
public function setReferenceCode(string $referenceCode): self
{
$this->referenceCode = $referenceCode;

return $this;
}
}

0 comments on commit 3c3d8cb

Please sign in to comment.