Skip to content

Commit

Permalink
Merge branch 'release/0.13.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
OGKevin committed Mar 21, 2018
2 parents 9004668 + ab377d0 commit 652e650
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 4 deletions.
17 changes: 14 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
# Change Log

## [0.13.0](https://github.com/bunq/sdk_php/tree/0.13.0) (2018-03-20)
## [0.13.1](https://github.com/bunq/sdk_php/tree/0.13.1)

[Full Changelog](https://github.com/bunq/sdk_php/compare/0.13.0...0.13.1)

**Closed issues:**

- bunqContext should be renamed to BunqContext. [\#114](https://github.com/bunq/sdk_php/issues/114)

**Merged pull requests:**

- Renamed filename accordingly. [\#115](https://github.com/bunq/sdk_php/pull/115) ([OGKevin](https://github.com/OGKevin))

## [0.13.0](https://github.com/bunq/sdk_php/tree/0.13.0) (2018-03-20)
[Full Changelog](https://github.com/bunq/sdk_php/compare/0.12.4...0.13.0)

**Implemented enhancements:**
Expand All @@ -27,7 +38,6 @@

**Merged pull requests:**

- Bunq update 7 [\#113](https://github.com/bunq/sdk_php/pull/113) ([OGKevin](https://github.com/OGKevin))
- Regenerate code for release [\#111](https://github.com/bunq/sdk_php/pull/111) ([OGKevin](https://github.com/OGKevin))
- Removed unneeded doc block. \(bunq/sdk\_php\#80\) [\#110](https://github.com/bunq/sdk_php/pull/110) ([OGKevin](https://github.com/OGKevin))
- Token qr request ideal returns the wrong type. \(bunq/sdk\_php\#80\) [\#107](https://github.com/bunq/sdk_php/pull/107) ([OGKevin](https://github.com/OGKevin))
Expand All @@ -37,6 +47,7 @@
- Add response id to request error. \(bunq/sdk\_php\#88\) [\#93](https://github.com/bunq/sdk_php/pull/93) ([OGKevin](https://github.com/OGKevin))
- Configure Zappr [\#92](https://github.com/bunq/sdk_php/pull/92) ([OGKevin](https://github.com/OGKevin))
- Add more info to templates. \(bunq/sdk\_php\#89\) [\#90](https://github.com/bunq/sdk_php/pull/90) ([OGKevin](https://github.com/OGKevin))
- Bunq update 7 [\#113](https://github.com/bunq/sdk_php/pull/113) ([OGKevin](https://github.com/OGKevin))

## [0.12.4](https://github.com/bunq/sdk_php/tree/0.12.4) (2017-12-21)
[Full Changelog](https://github.com/bunq/sdk_php/compare/0.12.3...0.12.4)
Expand Down Expand Up @@ -199,4 +210,4 @@



\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
65 changes: 65 additions & 0 deletions src/Context/BunqContext.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php
namespace bunq\Context;

use bunq\Exception\BunqException;

class BunqContext
{
/**
* Error constants.
*/
const ERROR_API_CONTEXT_HAS_NOT_BEEN_LOADED = 'apiContext has not been loaded.';
const ERROR_USER_CONTEXT_NOT_LOADED = 'userContext has not been loaded, you can load this by loading apiContext.';

/**
* @var ApiContext
*/
protected static $apiContext;

/**
* @var UserContext
*/
protected static $userContext;

/**
*/
private function __construct()
{
}

/**
* @param ApiContext $apiContext
*/
public static function loadApiContext(ApiContext $apiContext)
{
static::$apiContext = $apiContext;
static::$userContext = new UserContext($apiContext->getSessionContext()->getUserId());
static::$userContext->initMainMonetaryAccount();
}

/**
* @return ApiContext
* @throws BunqException
*/
public static function getApiContext(): ApiContext
{
if (is_null(static::$apiContext)) {
throw new BunqException(self::ERROR_API_CONTEXT_HAS_NOT_BEEN_LOADED);
} else {
return static::$apiContext;
}
}

/**
* @return UserContext
* @throws BunqException
*/
public static function getUserContext(): UserContext
{
if (is_null(static::$userContext)) {
throw new BunqException(self::ERROR_USER_CONTEXT_NOT_LOADED);
} else {
return static::$userContext;
}
}
}
2 changes: 1 addition & 1 deletion src/Http/ApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class ApiClient
/**
* User agent constants.
*/
const HEADER_USER_AGENT_BUNQ_SDK_DEFAULT = 'bunq-sdk-php/0.13.0';
const HEADER_USER_AGENT_BUNQ_SDK_DEFAULT = 'bunq-sdk-php/0.13.1';

/**
* Binary request constants.
Expand Down

0 comments on commit 652e650

Please sign in to comment.