Methods summary
public
|
#
__construct( $apiKey = 'v2' )
PunkApi constructor.
Parameters
|
public static
billythekid\PunkApi
|
#
create( $apiKey )
Static constructor, not really needed since PHP 5.4 but it's nice to have, right?
Static constructor, not really needed since PHP 5.4 but it's nice to have, right?
Parameters
Returns
|
public
string
|
#
getEndpoint( )
Returns the URL that would be hit at the current state of this object.
Returns the URL that would be hit at the current state of this object.
Returns
string
|
public
array
|
#
getBeers( )
Queries the PunkAPI with the current parameters of this object.
Queries the PunkAPI with the current parameters of this object.
Returns
array of beer \StdClass objects
Throws
InvalidArgumentException (via GuzzleHttp\json_decode()
|
public
|
#
clearParams( )
Empties the parameters of this object.
Empties the parameters of this object.
Returns
$this
|
public
|
#
addParams( array $params )
Adds parameter options to this object.
Adds parameter options to this object.
Parameters
Returns
$this
|
public
|
#
removeParams( array $badParams )
Removes given parameters from this object.
Removes given parameters from this object.
Parameters
Returns
$this
|
public
StdClass
|
#
getRandomBeer( )
Get a random beer from the API
Get a random beer from the API
Returns
StdClass beer object
|
public
StdClass
|
#
getBeerById( $beerId )
Get a beer from the API by it's ID number
Get a beer from the API by it's ID number
Returns
StdClass beer object
|
public
|
#
page( $pageNumber )
Set the parameters to return the given page of results
Set the parameters to return the given page of results
Parameters
Returns
$this
|
public
|
#
perPage( $number )
Set the number of beers to return per page
Set the number of beers to return per page
Parameters
Returns
$this
|
public
|
#
abvAbove( $number )
Sets the abv_gt parameter to the given number.
Sets the abv_gt parameter to the given number.
Parameters
Returns
$this
|
public
|
#
abvBelow( $number )
Sets the abv_lt parameter to the given number.
Sets the abv_lt parameter to the given number.
Parameters
Returns
$this
|
public
|
#
ibuAbove( $number )
Sets the ibu_gt parameter to the given number.
Sets the ibu_gt parameter to the given number.
Parameters
Returns
$this
|
public
|
#
ibuBelow( $number )
Sets the ibu_lt parameter to the given number.
Sets the ibu_lt parameter to the given number.
Parameters
Returns
$this
|
public
|
#
ebcAbove( $number )
Sets the ebc_gt parameter to the given number.
Sets the ebc_gt parameter to the given number.
Parameters
Returns
$this
|
public
|
#
ebcBelow( $number )
Sets the ebc_lt parameter to the given number.
Sets the ebc_lt parameter to the given number.
Parameters
Returns
$this
|
public
|
#
named( $beerName )
Sets the beer_name parameter to the given beer name.
Sets the beer_name parameter to the given beer name.
Parameters
Returns
$this
|
public
|
#
yeast( $yeastName )
Sets the yeast parameter to the given yeast name
Sets the yeast parameter to the given yeast name
Parameters
Returns
$this
|
public
|
#
hops( $hopsName )
Sets the hops parameter to the given hops name
Sets the hops parameter to the given hops name
Parameters
Returns
$this
|
public
|
#
malt( $maltName )
Sets the malt parameter to the given malt name
Sets the malt parameter to the given malt name
Parameters
Returns
$this
|
public
|
#
brewedBefore( $date )
Sets the brewed_before parameter to the given date
Sets the brewed_before parameter to the given date
Parameters
Returns
$this
|
public
|
#
brewedAfter( $date )
Sets the brewed_after parameter to the given date
Sets the brewed_after parameter to the given date
Parameters
Returns
$this
|
public
|
#
food( $foodName )
Sets the food parameter to the given food name
Sets the food parameter to the given food name
Parameters
Returns
$this
|
public
|
#
ids( mixed $ids )
Sets the ids paramater to the given ids
Sets the ids paramater to the given ids
Parameters
- $ids
- (array of ID numbers or piped string)
Returns
$this
|