Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Oauth2ClientInterface for service decorating #137

Merged
merged 5 commits into from
Nov 5, 2018
Merged

Conversation

sadikoff
Copy link
Member

Example:

namespace App\Client;

class CacheableClient implements OAuth2ClientInterface
{
    private $client;
    private $cache;

    public function __construct(OAuth2ClientInterface $client, Cache $cache)
    {
        // ...
    }

    // override all public functions, call the method on the internal $this->client object
    // but add caching wherever you need it
}
services:
    app.azure_client:
        class: App\Client\CacheableClient
        decorates: knpu.oauth2.client.azure

closes #134

@FlintCIBot
Copy link

Lint errors were found. A patch is also available.

Please see the report: https://flintci.io/repositories/4653/analyses/12046

This comment was posted by FlintCI. It can be disabled in the repository settings.

@weaverryan
Copy link
Member

@sadikoff This looks perfect! Could you also add a small section in the README file, maybe call it "Extending/Decorating Client Classes"?

@sadikoff
Copy link
Member Author

sadikoff commented Nov 1, 2018

@weaverryan added, but it needs your review.

@weaverryan weaverryan merged commit 3388376 into master Nov 5, 2018
@weaverryan weaverryan deleted the issue_134 branch November 5, 2018 21:23
@weaverryan
Copy link
Member

Nice work!

@aeimer
Copy link
Contributor

aeimer commented Nov 5, 2018

Pretty cool! Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add the possibility to retrieve services via DI
4 participants