Ejemplo n.º 1
0
 protected static function _initStaticProperties()
 {
     parent::_initStaticProperties();
     \PFXUtils::validateSettings(self::$_SETTINGS, self::$_SETTING_TESTS);
     if (PFX_CA_BUNDLE) {
         self::_registerSSLCertificate(PFX_CA_BUNDLE);
     }
     if (self::$_dbConn) {
         self::_prepareDBStatements();
     }
     self::$_apiMutex = new \Mutex(__CLASS__);
     self::$_staticPropsReady = true;
 }
Ejemplo n.º 2
0
 public function __construct()
 {
     try {
         if (!self::$_staticPropsReady) {
             self::_initStaticProperties();
         }
         parent::__construct();
         $this->_EXCEPTION_TYPE = __NAMESPACE__ . '\\RuntimeException';
     } catch (\Exception $e) {
         if ($e instanceof Exception) {
             throw $e;
         }
         throw new RuntimeException('Encountered error during initialization.', null, $e);
     }
 }
Ejemplo n.º 3
0
 /**
  * Handles logging and intercepts dry run calls where applicable.
  *
  * @param Google\MyBusiness\APIRequest $request
  * return mixed
  */
 protected function _makeRequest(APIRequest $request = null)
 {
     $verb = $request ? $request->getVerb() : null;
     if ($verb && $verb != 'GET') {
         if (GOOGLE_MYBUSINESS_API_LOG_VERBOSE) {
             $payload = $request->getPayload();
             $message = sprintf('Preparing %s%s request to %s%s', GOOGLE_MYBUSINESS_API_DRY_RUN ? 'dry run ' : '', $request->getVerb(), $request->getURL(), strlen($payload) ? ' with payload "' . $payload . '"' : '');
             $this->_logger->log($message, false);
         }
         if (GOOGLE_MYBUSINESS_API_DRY_RUN) {
             return;
         }
     }
     return parent::_makeRequest($request);
 }