class InstagramPostCollectorFactory in Social Feed 8
Class InstagramPostCollectorFactory.
@package Drupal\socialfeed
Hierarchy
- class \Drupal\socialfeed\Services\InstagramPostCollectorFactory
Expanded class hierarchy of InstagramPostCollectorFactory
1 file declares its use of InstagramPostCollectorFactory
- InstagramPostBlock.php in src/
Plugin/ Block/ InstagramPostBlock.php
1 string reference to 'InstagramPostCollectorFactory'
1 service uses InstagramPostCollectorFactory
File
- src/
Services/ InstagramPostCollectorFactory.php, line 12
Namespace
Drupal\socialfeed\ServicesView source
class InstagramPostCollectorFactory {
/**
* Default Instagram application api key.
*
* @var string
*/
protected $defaultApiKey;
/**
* Default Instagram application api secret.
*
* @var string
*/
protected $defaultApiSecret;
/**
* Default Instagram redirect URI.
*
* @var string
*/
protected $defaultRedirectUri;
/**
* Default Instagram application access token.
*
* @var string
*/
protected $defaultAccessToken;
/**
* InstagramPostCollectorFactory constructor.
*
* @param \Drupal\Core\Config\ConfigFactoryInterface $configFactory
* Config factory.
*/
public function __construct(ConfigFactoryInterface $configFactory) {
$config = $configFactory
->get('socialfeed.instagramsettings');
$this->defaultApiKey = $config
->get('client_id');
$this->defaultApiSecret = $config
->get('api_secret');
$this->defaultRedirectUri = $config
->get('redirect_uri');
$this->defaultAccessToken = $config
->get('access_token');
}
/**
* Creates a pre-configured instance.
*
* @param string $apiKey
* The API Key.
* @param string $apiSecret
* The API Secret.
* @param string $redirectUri
* The Redirect URI.
* @param string $accessToken
* The access token.
*
* @return \Drupal\socialfeed\Services\InstagramPostCollector
* A fully configured instance from InstagramPostCollector.
*
* @throws \Exception
* If the instance cannot be created, such as if the ID is invalid.
*/
public function createInstance(string $apiKey, string $apiSecret, string $redirectUri, string $accessToken) {
return new InstagramPostCollector($apiKey ?: $this->defaultApiKey, $apiSecret ?: $this->defaultApiSecret, $redirectUri ?: $this->defaultRedirectUri, $accessToken ?: $this->defaultAccessToken);
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
InstagramPostCollectorFactory:: |
protected | property | Default Instagram application access token. | |
InstagramPostCollectorFactory:: |
protected | property | Default Instagram application api key. | |
InstagramPostCollectorFactory:: |
protected | property | Default Instagram application api secret. | |
InstagramPostCollectorFactory:: |
protected | property | Default Instagram redirect URI. | |
InstagramPostCollectorFactory:: |
public | function | Creates a pre-configured instance. | |
InstagramPostCollectorFactory:: |
public | function | InstagramPostCollectorFactory constructor. |