Update url & service name

Prefix ur with service namel: [service]_[route name]
Add comment in Interface
This commit is contained in:
Jeremy Benoist
2015-12-24 15:22:56 +01:00
parent 5a4bbcc9a7
commit 0aa344dc24
6 changed files with 56 additions and 13 deletions

View File

@ -4,9 +4,42 @@ namespace Wallabag\ImportBundle\Import;
interface ImportInterface
{
/**
* Name of the import.
*
* @return string
*/
public function getName();
/**
* Description of the import.
*
* @return string
*/
public function getDescription();
/**
* Return the oauth url to authenticate the client.
*
* @param string $redirectUri Redirect url in case of error
* @param string $callbackUri Url when the authentication is complete
*
* @return string
*/
public function oAuthRequest($redirectUri, $callbackUri);
/**
* Usually called by the previous callback to authorize the client.
* Then it return a token that can be used for next requests.
*
* @return string
*/
public function oAuthAuthorize();
/**
* Import content using the user token.
*
* @param string $accessToken User access token
*/
public function import($accessToken);
}

View File

@ -5,6 +5,7 @@ namespace Wallabag\ImportBundle\Import;
use Doctrine\ORM\EntityManager;
use GuzzleHttp\Client;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Wallabag\CoreBundle\Entity\Entry;
use Wallabag\CoreBundle\Entity\Tag;
use Wallabag\CoreBundle\Tools\Utils;
@ -18,7 +19,7 @@ class PocketImport implements ImportInterface
private $skippedEntries = 0;
private $importedEntries = 0;
public function __construct($tokenStorage, Session $session, EntityManager $em, $consumerKey)
public function __construct(TokenStorageInterface $tokenStorage, Session $session, EntityManager $em, $consumerKey)
{
$this->user = $tokenStorage->getToken()->getUser();
$this->session = $session;
@ -26,11 +27,17 @@ class PocketImport implements ImportInterface
$this->consumerKey = $consumerKey;
}
/**
* {@inheritdoc}
*/
public function getName()
{
return 'Pocket';
}
/**
* {@inheritdoc}
*/
public function getDescription()
{
return 'This importer will import all your <a href="https://getpocket.com">Pocket</a> data.';