/**
* @throws InvalidConfigException
*/
public function init()
{
if ($this->apiKey === null) {
throw new InvalidConfigException('The apiKey property must be set.');
}
if ($this->appId === null) {
throw new InvalidConfigException('The appId property must be set.');
}
Pingpp::setApiKey($this->apiKey);
if (!empty($this->privateKeyPath)) {
$privateKeyFullPath = Yii::getAlias($this->privateKeyPath);
if (!file_exists($privateKeyFullPath)) {
throw new InvalidConfigException('The private key file not exists.');
}
Pingpp::setPrivateKeyPath($privateKeyFullPath);
} elseif (!empty($this->privateKey)) {
Pingpp::setPrivateKey($this->privateKey);
}
}