You are here

class PuSHEnvironment in Feeds 7

Same name and namespace in other branches
  1. 6 plugins/FeedsHTTPFetcher.inc \PuSHEnvironment
  2. 7.2 plugins/FeedsHTTPFetcher.inc \PuSHEnvironment

Provide environmental functions to the PuSHSubscriber library.

Hierarchy

Expanded class hierarchy of PuSHEnvironment

File

plugins/FeedsHTTPFetcher.inc, line 270

View source
class PuSHEnvironment implements PuSHSubscriberEnvironmentInterface {

  /**
   * Singleton.
   */
  public static function instance() {
    static $env;
    if (empty($env)) {
      $env = new PuSHEnvironment();
    }
    return $env;
  }

  /**
   * Implements PuSHSubscriberEnvironmentInterface::msg().
   */
  public function msg($msg, $level = 'status') {
    drupal_set_message($msg, $level);
  }

  /**
   * Implements PuSHSubscriberEnvironmentInterface::log().
   */
  public function log($msg, $level = 'status') {
    switch ($level) {
      case 'error':
        $severity = WATCHDOG_ERROR;
        break;
      case 'warning':
        $severity = WATCHDOG_WARNING;
        break;
      default:
        $severity = WATCHDOG_NOTICE;
        break;
    }
    feeds_dbg($msg);
    watchdog('FeedsHTTPFetcher', $msg, array(), $severity);
  }

}

Members