예제 #1
0
 /**
  * @param $to_user 普通用户openid
  * @param $media_id 媒体ID
  */
 public function __construct($to_user, $media_id)
 {
     parent::__construct($to_user);
     $this->params['msgtype'] = 'image';
     $this->params['image'] = [];
     $this->params['image']['media_id'] = $media_id;
 }
예제 #2
0
 /**
  * Constructor.
  *
  * @param string $method        The HTTP verb
  * @param string $path          The resource path on the server
  * @param string $scheme        The protocole name (HTTP or HTTPS)
  * @param string $schemeVersion The scheme version (ie: 1.0, 1.1 or 2.0)
  * @param array  $headers       An associative array of headers
  * @param string $body          The request content
  */
 public function __construct($method, $path, $scheme, $schemeVersion, array $headers = array(), $body = '')
 {
     parent::__construct($scheme, $schemeVersion, $headers, $body);
     $this->setMethod($method);
     $this->path = $path;
     $this->attributes = [];
 }
예제 #3
0
 /**
  * @param $to_user 普通用户openid
  * @param $text 文本消息内容
  */
 public function __construct($to_user, $text)
 {
     parent::__construct($to_user);
     $this->params['msgtype'] = 'text';
     $this->params['text'] = [];
     $this->params['text']['content'] = $text;
 }
예제 #4
0
 /**
  * @param $to_user 普通用户openid
  * @param $media_id 发送的语音的媒体ID
  */
 public function __construct($to_user, $media_id)
 {
     parent::__construct($to_user);
     $this->params['msgtype'] = 'voice';
     $this->params['voice'] = [];
     $this->params['voice']['content'] = $media_id;
 }
예제 #5
0
 /**
  * @param int $code Status code.
  * @param \Icicle\Stream\ReadableStream|null $stream
  * @param string[][] $headers
  * @param string|null $reason Status code reason.
  * @param string $protocol
  *
  * @throws \Icicle\Http\Exception\MessageException If one of the arguments is invalid.
  */
 public function __construct(int $code = 200, array $headers = [], ReadableStream $stream = null, string $reason = null, string $protocol = '1.1')
 {
     parent::__construct($headers, $stream, $protocol);
     $this->status = $this->validateStatusCode($code);
     $this->reason = $this->filterReason($reason);
     if ($this->hasHeader('Set-Cookie')) {
         $this->setCookiesFromHeaders();
     }
 }
예제 #6
0
 /**
  * @param $to_user 普通用户openid
  * @param NewsMessageItem[] $news_items
  */
 public function __construct($to_user, $news_items)
 {
     parent::__construct($to_user);
     $this->params['msgtype'] = 'news';
     $this->params['news'] = [];
     $this->params['news']['articles'] = [];
     foreach ($news_items as $item) {
         $this->params['news']['articles'][] = $item->getParams();
     }
 }
예제 #7
0
 /**
  * @param $to_user 普通用户openid
  * @param $media_id 发送的视频的媒体ID
  * @param $thumb_media_id 缩略图的媒体ID
  * @param null $title 视频消息的标题
  * @param null $description 视频消息的描述
  */
 public function __construct($to_user, $media_id, $thumb_media_id, $title = null, $description = null)
 {
     parent::__construct($to_user);
     $this->params['msgtype'] = 'video';
     $this->params['video'] = [];
     $this->params['video']['media_id'] = $media_id;
     $this->params['video']['thumb_media_id'] = $thumb_media_id;
     $this->params['video']['title'] = $title;
     $this->params['video']['description'] = $description;
 }
예제 #8
0
 /**
  * Constructor.
  *
  * @param string $method        The HTTP verb
  * @param string $path          The resource path on the server
  * @param string $scheme        The protocole name (HTTP or HTTPS)
  * @param string $schemeVersion The scheme version (ie: 1.0, 1.1 or 2.0)
  * @param array  $headers       An associative array of headers
  * @param string $body          The request content
  */
 public function __construct($method, $path, $scheme, $schemeVersion, array $headers = [], $body = '')
 {
     parent::__construct($scheme, $schemeVersion, $headers, $body);
     $this->attributes = [];
     $this->setMethod($method);
     $this->path = $path;
     $this->requestParameters = [];
     $this->cookieParameters = [];
     $this->queryParameters = [];
 }
예제 #9
0
 /**
  * @param $to_user 普通用户openid
  * @param $music_url 音乐链接
  * @param $hq_music_url 高品质音乐链接,wifi环境优先使用该链接播放音乐
  * @param $thumb_media_id 缩略图的媒体ID
  * @param null $title 音乐标题
  * @param null $description 音乐描述
  */
 public function __construct($to_user, $music_url, $hq_music_url, $thumb_media_id, $title = null, $description = null)
 {
     parent::__construct($to_user);
     $this->params['msgtype'] = 'music';
     $this->params['music'] = [];
     $this->params['music']['title'] = $title;
     $this->params['music']['description'] = $description;
     $this->params['music']['musicurl'] = $music_url;
     $this->params['music']['hqmusicurl'] = $hq_music_url;
     $this->params['music']['thumb_media_id'] = $thumb_media_id;
 }
예제 #10
0
 /**
  * @param string $method
  * @param string|\Icicle\Http\Message\Uri $uri
  * @param \Icicle\Stream\ReadableStream|null $stream
  * @param string[][] $headers
  * @param string|\Icicle\Http\Message\Uri $target
  * @param string $protocol
  *
  * @throws \Icicle\Http\Exception\MessageException If one of the arguments is invalid.
  */
 public function __construct(string $method, $uri = '', array $headers = [], ReadableStream $stream = null, $target = null, string $protocol = '1.1')
 {
     parent::__construct($headers, $stream, $protocol);
     $this->method = $this->filterMethod($method);
     $this->uri = $uri instanceof Uri ? $uri : new BasicUri($uri);
     $this->target = $target instanceof Uri ? $target : $this->filterTarget($target);
     if (!$this->hasHeader('Host')) {
         $this->setHostFromUri();
     }
     if ($this->hasHeader('Cookie')) {
         $this->setCookiesFromHeaders();
     }
 }
예제 #11
0
 public function __construct($impl)
 {
     parent::__construct($impl);
 }
예제 #12
0
 /**
  * @param $method
  * @param $path
  * @param $scheme
  * @param $schemeVersion
  * @param array $headers
  * @param $body
  */
 public function __construct(string $method, string $path, string $scheme, string $schemeVersion, array $headers = [], string $body = '')
 {
     $this->path = $path;
     $this->setMethod($method);
     parent::__construct($scheme, $schemeVersion, $headers, $body);
 }
예제 #13
0
 /**
  * Constructor.
  *
  * @param string $protocolVersion The protocol version.
  * @param int $statusCode The status code.
  * @param string $reasonPhrase The reason phrase.
  * @param string[][] $headers The headers.
  * @param StreamInterface $body The body.
  */
 public function __construct($protocolVersion = self::DEFAULT_PROTOCOL_VERSION, $statusCode = StatusCode::OK, $reasonPhrase = '', array $headers = [], StreamInterface $body = null)
 {
     parent::__construct($protocolVersion, $headers, $body);
     $this->statusCode = $statusCode;
     $this->reasonPhrase = $reasonPhrase === '' ? StatusCode::$reasonPhrase[$statusCode] : $reasonPhrase;
 }
예제 #14
0
 public function __construct($statusCode, $scheme, $schemeVersion, array $headers, $body)
 {
     parent::__construct($scheme, $schemeVersion, $headers, $body);
     $this->setStatusCode($statusCode);
 }
예제 #15
0
 /**
  * Request constructor.
  * @param string $method        The HTTP verb
  * @param string $path          The resource path on the server
  * @param string $scheme        The protocole name (HTTP or HTTPS)
  * @param string $schemeVersion The scheme version (ie: 1.0, 1.1, or 2.0)
  * @param array $headers        An associative array of headers
  * @param string $body          The request content
  */
 public function __construct($method, $path, $scheme, $schemeVersion, array $headers = [], $body = '')
 {
     parent::__construct($scheme, $schemeVersion, $headers, $body);
     $this->setMethod($method);
     $this->setPath($path);
 }
예제 #16
0
 public function __construct($message, array $users = [])
 {
     parent::__construct($message);
     $this->facebookUsers = $users;
 }
예제 #17
0
 /**
  * Constructor.
  *
  * @param string $rawContent Original message as received from ami.
  *
  * @return void
  */
 public function __construct($rawContent)
 {
     parent::__construct();
     $this->channelVariables = array('default' => array());
     $this->rawContent = $rawContent;
     $lines = explode(Message::EOL, $rawContent);
     foreach ($lines as $line) {
         $content = explode(':', $line);
         $name = strtolower(trim($content[0]));
         unset($content[0]);
         $value = isset($content[1]) ? trim(implode(':', $content)) : '';
         if (!strncmp($name, 'chanvariable', 12)) {
             // https://github.com/marcelog/PAMI/issues/85
             $matches = preg_match("/\\(([^\\)]*)\\)/", $name, $captures);
             $chanName = 'default';
             if ($matches > 0) {
                 $chanName = $captures[1];
             }
             $content = explode('=', $value);
             $name = strtolower(trim($content[0]));
             unset($content[0]);
             $value = isset($content[1]) ? trim(implode(':', $content)) : '';
             $this->channelVariables[$chanName][$name] = $value;
         } else {
             $this->setKey($name, $value);
         }
     }
     // https://github.com/marcelog/PAMI/issues/85
     if (isset($this->keys['channel'])) {
         $channel = strtolower($this->keys['channel']);
         if (isset($this->channelVariables[$channel])) {
             $this->channelVariables[$channel] = array_merge($this->channelVariables[$channel], $this->channelVariables['default']);
         } else {
             $this->channelVariables[$channel] = $this->channelVariables['default'];
         }
         unset($this->channelVariables['default']);
     }
 }
예제 #18
0
파일: Raw.php 프로젝트: zerozh/wechat
 /**
  * Constructor.
  *
  * @param array $content
  */
 public function __construct($content)
 {
     parent::__construct(['content' => strval($content)]);
 }
예제 #19
0
 public function __construct($objectName = null)
 {
     parent::__construct('Message');
 }