Skip to content

Commit

Permalink
Added first() and eq() to result class
Browse files Browse the repository at this point in the history
  • Loading branch information
andersevenrud committed Jun 28, 2017
1 parent 61d7036 commit e607443
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ var_dump($client->searchPerson('ola bull'));;

## Changelog

* **0.5.5** - Added first() and eq() to result class
* **0.5.4** - Bugfixes
* **0.5.3** - Bugfixes
* **0.5.2** - Updated composer.json
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "andersevenrud/1881",
"description": "API Library for 1881",
"license": "MIT",
"version": "0.5.4",
"version": "0.5.5",
"authors": [
{
"name": "Anders Evenrud",
Expand Down
22 changes: 22 additions & 0 deletions src/DM1881/DM1881Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,26 @@ public function all()
return $this->results;
}

/**
* Gets the first result
*
* @since 0.5.5
* @return Object
*/
public function first()
{
return $this->numberOfHits ? $this->results[0] : null;
}

/**
* Gets a result by index result
*
* @since 0.5.5
* @return Object
*/
public function eq($index)
{
return isset($this->results[$index]) ? $this->results[$index] : null;
}

}

0 comments on commit e607443

Please sign in to comment.