original_string: public static function initServices($refresh = false)
      {
          // Define full definition file path
          $path = sprintf('%s%sxac-services-v%d.conf'
              , ! empty(self::$logPath) ? self::$logPath : sys_get_temp_dir()
              , DIRECTORY_SEPARATOR
              , self::$apiVersion
              );
          
          if ($refresh === true || ! file_exists($path)) {
              self::log(sprintf("Refresh services definition on-demand for v%d API", self::$apiVersion));
              $res = self::getInstance()->call('endpoints');
              $res['_timestamp'] = time();
              file_put_contents($path, serialize($res));
              chmod($path, 0777);
              self::$services = $res;
          } else {
              self::$services = unserialize(file_get_contents($path));
              // Check that content is not expired
              if (time() - self::$services['_timestamp'] > self::$ttl) {
                  self::log(sprintf("Refresh outdated services definition for v%d API", self::$apiVersion));
                  self::initServices(true);
              }
          }
      }
code: public static function initServices($refresh = false)
      {
          // Define full definition file path
          $path = sprintf('%s%sxac-services-v%d.conf'
              , ! empty(self::$logPath) ? self::$logPath : sys_get_temp_dir()
              , DIRECTORY_SEPARATOR
              , self::$apiVersion
              );
          
          if ($refresh === true || ! file_exists($path)) {
              self::log(sprintf("Refresh services definition on-demand for v%d API", self::$apiVersion));
              $res = self::getInstance()->call('endpoints');
              $res['_timestamp'] = time();
              file_put_contents($path, serialize($res));
              chmod($path, 0777);
              self::$services = $res;
          } else {
              self::$services = unserialize(file_get_contents($path));
              // Check that content is not expired
              if (time() - self::$services['_timestamp'] > self::$ttl) {
                  self::log(sprintf("Refresh outdated services definition for v%d API", self::$apiVersion));
                  self::initServices(true);
              }
          }
      }
code_tokens: public static function initServices ( $ refresh = false ) { // Define full definition file path $ path = sprintf ( '%s%sxac-services-v%d.conf' , ! empty ( self :: $ logPath ) ? self :: $ logPath : sys_get_temp_dir ( ) , DIRECTORY_SEPARATOR , self :: $ apiVersion ) ; if ( $ refresh === true || ! file_exists ( $ path ) ) { self :: log ( sprintf ( "Refresh services definition on-demand for v%d API" , self :: $ apiVersion ) ) ; $ res = self :: getInstance ( ) -> call ( 'endpoints' ) ; $ res [ '_timestamp' ] = time ( ) ; file_put_contents ( $ path , serialize ( $ res ) ) ; chmod ( $ path , 0777 ) ; self :: $ services = $ res ; } else { self :: $ services = unserialize ( file_get_contents ( $ path ) ) ; // Check that content is not expired if ( time ( ) - self :: $ services [ '_timestamp' ] > self :: $ ttl ) { self :: log ( sprintf ( "Refresh outdated services definition for v%d API" , self :: $ apiVersion ) ) ; self :: initServices ( true ) ; } } }
docstring: Retrieve definition of available API services
  @param boolean $refresh
docstring_tokens: Retrieve definition of available API services