This does an error_log for now Potential frameworks to use are PEAR logger, log4php from Apache
Beispiel #1
0
 /**
  * Generates a new access token
  *
  * @param $config
  *
  * @return null
  */
 private function _generateAccessToken($config)
 {
     $base64ClientID = base64_encode($this->clientId . ":" . $this->clientSecret);
     $headers = array("User-Agent" => PPUserAgent::getValue(RestHandler::$sdkName, RestHandler::$sdkVersion), "Authorization" => "Basic " . $base64ClientID, "Accept" => "*/*");
     $httpConfiguration = $this->getOAuthHttpConfiguration($config);
     $httpConfiguration->setHeaders($headers);
     $connection = PPConnectionManager::getInstance()->getConnection($httpConfiguration, $config);
     $res = $connection->execute("grant_type=client_credentials");
     $jsonResponse = json_decode($res, true);
     if ($jsonResponse == null || !isset($jsonResponse["access_token"]) || !isset($jsonResponse["expires_in"])) {
         $this->accessToken = null;
         $this->tokenExpiresIn = null;
         $this->logger->warning("Could not generate new Access token. Invalid response from server: " . $jsonResponse);
     } else {
         $this->accessToken = $jsonResponse["access_token"];
         $this->tokenExpiresIn = $jsonResponse["expires_in"];
     }
     $this->tokenCreateTime = time();
     return $this->accessToken;
 }
 /**
  * @test
  */
 public function testFine()
 {
     $this->object->fine('Test fine Message');
 }