original_string: public function socketAuth($channel, $socketId, $customData = null)
      {
          if (preg_match('/^[-a-z0-9_=@,.;]+$/i', $channel) !== 1) {
              throw new BroadcastException('Invalid channel name ' .$channel);
          }
  
          if (preg_match('/^(?:\/[a-z0-9]+#)?[a-z0-9]+$/i', $socketId) !== 1) {
              throw new BroadcastException('Invalid socket ID ' .$socketId);
          }
  
          if (! is_null($customData)) {
              $signature = hash_hmac('sha256', $socketId .':' .$channel .':' .$customData, $this->secretKey, false);
          } else {
              $signature = hash_hmac('sha256', $socketId .':' .$channel, $this->secretKey, false);
          }
  
          $signature = array('auth' => $signature);
  
          // Add the custom data if it has been supplied.
          if (! is_null($customData)) {
              $signature['payload'] = $customData;
          }
  
          return json_encode($signature);
      }
code: public function socketAuth($channel, $socketId, $customData = null)
      {
          if (preg_match('/^[-a-z0-9_=@,.;]+$/i', $channel) !== 1) {
              throw new BroadcastException('Invalid channel name ' .$channel);
          }
  
          if (preg_match('/^(?:\/[a-z0-9]+#)?[a-z0-9]+$/i', $socketId) !== 1) {
              throw new BroadcastException('Invalid socket ID ' .$socketId);
          }
  
          if (! is_null($customData)) {
              $signature = hash_hmac('sha256', $socketId .':' .$channel .':' .$customData, $this->secretKey, false);
          } else {
              $signature = hash_hmac('sha256', $socketId .':' .$channel, $this->secretKey, false);
          }
  
          $signature = array('auth' => $signature);
  
          // Add the custom data if it has been supplied.
          if (! is_null($customData)) {
              $signature['payload'] = $customData;
          }
  
          return json_encode($signature);
      }
code_tokens: public function socketAuth ( $ channel , $ socketId , $ customData = null ) { if ( preg_match ( '/^[-a-z0-9_=@,.;]+$/i' , $ channel ) !== 1 ) { throw new BroadcastException ( 'Invalid channel name ' . $ channel ) ; } if ( preg_match ( '/^(?:\/[a-z0-9]+#)?[a-z0-9]+$/i' , $ socketId ) !== 1 ) { throw new BroadcastException ( 'Invalid socket ID ' . $ socketId ) ; } if ( ! is_null ( $ customData ) ) { $ signature = hash_hmac ( 'sha256' , $ socketId . ':' . $ channel . ':' . $ customData , $ this -> secretKey , false ) ; } else { $ signature = hash_hmac ( 'sha256' , $ socketId . ':' . $ channel , $ this -> secretKey , false ) ; } $ signature = array ( 'auth' => $ signature ) ; // Add the custom data if it has been supplied. if ( ! is_null ( $ customData ) ) { $ signature [ 'payload' ] = $ customData ; } return json_encode ( $ signature ) ; }
docstring: Creates a socket signature.
  
  @param string $socketId
  @param string $customData
  
  @return string
docstring_tokens: Creates a socket signature .