Skip to content

Commit

Permalink
Added some interesting getters
Browse files Browse the repository at this point in the history
- HTTP\Response
- Link
- Location
  • Loading branch information
mattjmattj committed Apr 9, 2015
1 parent adb648a commit fa9304c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Yo/HTTP/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ class Response
/** @var boolean */
private $success;

/** @var string */
private $error;

public function __construct($rawResponse)
{
$this->rawResponse = $rawResponse;
Expand All @@ -34,6 +37,11 @@ public function isSuccess()
return $this->success;
}

public function getError()
{
return $this->error;
}

public function parseYoResponse()
{
$response = json_decode($this->rawResponse, true);
Expand All @@ -42,5 +50,9 @@ public function parseYoResponse()
}

$this->success = isset($response['success']) && $response['success'];

if (isset($response['error'])) {
$this->error = $response['error'];
}
}
}
5 changes: 5 additions & 0 deletions src/Yo/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ public function __construct($url)
$this->url = $url;
}

public function getUrl()
{
return $this->url;
}

public function toHTTPParameters()
{
return ['link' => $this->url];
Expand Down
10 changes: 10 additions & 0 deletions src/Yo/Location.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ public function __construct($latitude, $longitude)
$this->longitude = $longitude;
}

public function getLatitude()
{
return $this->latitude;
}

public function getLongitude()
{
return $this->longitude;
}

public function toHTTPParameters()
{
return [
Expand Down

0 comments on commit fa9304c

Please sign in to comment.