Pingpp\Pingpp::setPrivateKey PHP Method

setPrivateKey() public static method

public static setPrivateKey ( string $key )
$key string
    public static function setPrivateKey($key)
    {
        self::$privateKey = $key;
    }

Usage Example

Example #1
0
 /**
  * @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);
     }
 }