This repository has been archived by the owner on Feb 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from mediapart/v2.0
V2.0
- Loading branch information
Showing
28 changed files
with
600 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/coverage/ | ||
/vendor/ | ||
/composer.lock | ||
/phpunit.xml | ||
/tests/Functional/App/cache | ||
/tests/Functional/App/logs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the Mediapart LaPresseLibre Bundle. | ||
* | ||
* CC BY-NC-SA <https://github.com/mediapart/lapresselibre-bundle> | ||
* | ||
* For the full license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Mediapart\Bundle\LaPresseLibreBundle\Account; | ||
|
||
use Mediapart\LaPresseLibre\Account\Account; | ||
|
||
interface AccountProvider | ||
{ | ||
/** | ||
* @return Account | ||
*/ | ||
public function __invoke(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the Mediapart LaPresseLibre Bundle. | ||
* | ||
* CC BY-NC-SA <https://github.com/mediapart/lapresselibre-bundle> | ||
* | ||
* For the full license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Mediapart\Bundle\LaPresseLibreBundle\Controller; | ||
|
||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Component\HttpFoundation\Response; | ||
use Symfony\Component\HttpFoundation\RedirectResponse; | ||
use Symfony\Component\HttpKernel\Exception\HttpException; | ||
use Mediapart\Bundle\LaPresseLibreBundle\Factory\RedirectionFactory; | ||
|
||
/** | ||
* Use to link an account | ||
*/ | ||
class LinkAccountController | ||
{ | ||
/** | ||
* @var RedirectionFactory | ||
*/ | ||
private $redirectionFactory; | ||
|
||
/** | ||
* @param RedirectionFactory $redirectionFactory | ||
*/ | ||
public function __construct(RedirectionFactory $redirectionFactory) | ||
{ | ||
$this->redirectionFactory = $redirectionFactory; | ||
} | ||
|
||
/** | ||
* @param Request $request | ||
* | ||
* @return Response | ||
* | ||
* @throws HttpException | ||
*/ | ||
public function __invoke(Request $request) | ||
{ | ||
try { | ||
$redirection = $this | ||
->redirectionFactory | ||
->generate($request) | ||
; | ||
$response = new RedirectResponse($redirection); | ||
} catch (\Exception $exception) { | ||
throw new HttpException( | ||
Response::HTTP_INTERNAL_SERVER_ERROR, | ||
'Internal Error', | ||
$exception | ||
); | ||
} | ||
|
||
return $response; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.