BaiduUtils::errorLog PHP Method

errorLog() public static method

Prints to the error log if you aren't in command line mode.
public static errorLog ( $msg )
    public static function errorLog($msg)
    {
        // disable error log if we are running in a CLI environment
        if (php_sapi_name() != 'cli') {
            error_log($msg);
        }
        // Set the debug mode if you want to see the errors on the page
        if (self::$isDebug) {
            echo 'error_log: ' . $msg . "\n";
        }
    }

Usage Example

Example #1
0
 /**
  * Get the authorization code from the query parameters, if it exists,
  * otherwise return false to signal no authorization code was discoverable.
  *
  * @return mixed Returns the authorization code, or false if the authorization
  * code could not be determined.
  */
 protected function getCode()
 {
     if (isset($_GET['code'])) {
         if ($this->state && $this->state === $_GET['state']) {
             // CSRF state has done its job, so clear it
             $this->state = null;
             $this->store->remove('state');
             return $_GET['code'];
         } else {
             BaiduUtils::errorLog('CSRF state token does not match one provided.');
             return false;
         }
     }
     return false;
 }