You are here

public function TwitterPostCollectorFactory::createInstance in Social Feed 8

Creates a pre-configured instance.

Parameters

string $consumerKey: The consumer key.

string $consumerSecret: The consumer secret.

string $accessToken: The access token.

string $accessTokenSecret: The access token secret.

Return value

\Drupal\socialfeed\Services\TwitterPostCollector A fully configured instance from TwitterPostCollector.

Throws

\Exception If the instance cannot be created, such as if the ID is invalid.

File

src/Services/TwitterPostCollectorFactory.php, line 74

Class

TwitterPostCollectorFactory
Class TwitterPostCollectorFactory.

Namespace

Drupal\socialfeed\Services

Code

public function createInstance(string $consumerKey, string $consumerSecret, string $accessToken, string $accessTokenSecret) {
  return new TwitterPostCollector($consumerKey ?: $this->defaultConsumerKey, $consumerSecret ?: $this->defaultConsumerSecret, $accessToken ?: $this->defaultAccessToken, $accessTokenSecret ?: $this->defaultAccessTokenSecret);
}