Skip to content

Commit

Permalink
Added toArray to TwitchUser
Browse files Browse the repository at this point in the history
  • Loading branch information
tpavlek committed Feb 2, 2015
1 parent 09f6e35 commit 2eb960f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/Entity/TwitchUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class TwitchUser
/** @var bool */
protected $partnered;

public function __construct(array $attributes = array()) {
public function __construct(array $attributes = array())
{
$this->id = $attributes['_id'];
$this->display_name = $attributes['display_name'];
$this->type = $attributes['type'];
Expand All @@ -27,6 +28,16 @@ public function __construct(array $attributes = array()) {
$this->partnered = $attributes['partnered'];
}

/**
* Get the contents of the user as a key-value array.
*
* @return array
*/
public function toArray()
{
return get_object_vars($this);
}

/**
* @return string
*/
Expand Down

0 comments on commit 2eb960f

Please sign in to comment.