id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
190,000 | garbetjie/wechat-php | src/Media/Service.php | Service.storeNews | private function storeNews ($endpoint, News $news)
{
$jsonBody = ['articles' => []];
foreach ($news->getItems() as $newsArticle) {
$jsonArticle = [
'title' => $newsArticle->getTitle(),
'content' => $newsArticle->getContent(),
... | php | private function storeNews ($endpoint, News $news)
{
$jsonBody = ['articles' => []];
foreach ($news->getItems() as $newsArticle) {
$jsonArticle = [
'title' => $newsArticle->getTitle(),
'content' => $newsArticle->getContent(),
... | [
"private",
"function",
"storeNews",
"(",
"$",
"endpoint",
",",
"News",
"$",
"news",
")",
"{",
"$",
"jsonBody",
"=",
"[",
"'articles'",
"=>",
"[",
"]",
"]",
";",
"foreach",
"(",
"$",
"news",
"->",
"getItems",
"(",
")",
"as",
"$",
"newsArticle",
")",
... | Handles the uploading of a news item to the WeChat servers.
@param string $endpoint
@param News $news
@return \stdClass | [
"Handles",
"the",
"uploading",
"of",
"a",
"news",
"item",
"to",
"the",
"WeChat",
"servers",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Media/Service.php#L637-L670 |
190,001 | garbetjie/wechat-php | src/Media/Service.php | Service.doUpload | private function doUpload ($endpoint, $type, $body)
{
return json_decode(
$this->client->send(
new Request(
'POST',
Uri::withQueryValue(new Uri($endpoint), 'type', $type),
[],
$body
)
... | php | private function doUpload ($endpoint, $type, $body)
{
return json_decode(
$this->client->send(
new Request(
'POST',
Uri::withQueryValue(new Uri($endpoint), 'type', $type),
[],
$body
)
... | [
"private",
"function",
"doUpload",
"(",
"$",
"endpoint",
",",
"$",
"type",
",",
"$",
"body",
")",
"{",
"return",
"json_decode",
"(",
"$",
"this",
"->",
"client",
"->",
"send",
"(",
"new",
"Request",
"(",
"'POST'",
",",
"Uri",
"::",
"withQueryValue",
"(... | Uploads a simple string body to the WeChat servers.
@param string $endpoint
@param string $type
@param string $body
@return \stdClass | [
"Uploads",
"a",
"simple",
"string",
"body",
"to",
"the",
"WeChat",
"servers",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Media/Service.php#L681-L693 |
190,002 | garbetjie/wechat-php | src/Media/Service.php | Service.doMultipartUpload | private function doMultipartUpload ($endpoint, $type, $stream, array $extra = [])
{
return json_decode(
$this->client->send(
new Request(
'POST',
Uri::withQueryValue(new Uri($endpoint), 'type', $type),
[],
... | php | private function doMultipartUpload ($endpoint, $type, $stream, array $extra = [])
{
return json_decode(
$this->client->send(
new Request(
'POST',
Uri::withQueryValue(new Uri($endpoint), 'type', $type),
[],
... | [
"private",
"function",
"doMultipartUpload",
"(",
"$",
"endpoint",
",",
"$",
"type",
",",
"$",
"stream",
",",
"array",
"$",
"extra",
"=",
"[",
"]",
")",
"{",
"return",
"json_decode",
"(",
"$",
"this",
"->",
"client",
"->",
"send",
"(",
"new",
"Request",... | Performs a multipart upload to the WeChat API. Additional multipart fields can be added in if required.
@param string $endpoint
@param string $type
@param resource $stream
@param array $extra
@return \stdClass | [
"Performs",
"a",
"multipart",
"upload",
"to",
"the",
"WeChat",
"API",
".",
"Additional",
"multipart",
"fields",
"can",
"be",
"added",
"in",
"if",
"required",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Media/Service.php#L705-L722 |
190,003 | garbetjie/wechat-php | src/Client.php | Client.withAccessToken | public function withAccessToken (AccessToken $token)
{
$config = $this->getConfig();
$this->configureHandlers($config['handler']);
$config['wechat.accessToken'] = $token;
$config['wechat.developerMode'] = $this->developerMode;
return new static($config);
... | php | public function withAccessToken (AccessToken $token)
{
$config = $this->getConfig();
$this->configureHandlers($config['handler']);
$config['wechat.accessToken'] = $token;
$config['wechat.developerMode'] = $this->developerMode;
return new static($config);
... | [
"public",
"function",
"withAccessToken",
"(",
"AccessToken",
"$",
"token",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"getConfig",
"(",
")",
";",
"$",
"this",
"->",
"configureHandlers",
"(",
"$",
"config",
"[",
"'handler'",
"]",
")",
";",
"$",
"c... | Sets the access token to be used, and returns the cloned client with the token being used.
@param AccessToken $token
@return Client | [
"Sets",
"the",
"access",
"token",
"to",
"be",
"used",
"and",
"returns",
"the",
"cloned",
"client",
"with",
"the",
"token",
"being",
"used",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Client.php#L165-L174 |
190,004 | ivkos/Pushbullet-for-PHP | src/Pushbullet/Pushable.php | Pushable.pushNote | public function pushNote($title, $body)
{
self::checkPushable();
$data = [];
$data[$this->recipientType] = $this->recipient;
$data['type'] = 'note';
$data['title'] = $title;
$data['body'] = $body;
return new Push(
Connection::sendCurlRequest(Conn... | php | public function pushNote($title, $body)
{
self::checkPushable();
$data = [];
$data[$this->recipientType] = $this->recipient;
$data['type'] = 'note';
$data['title'] = $title;
$data['body'] = $body;
return new Push(
Connection::sendCurlRequest(Conn... | [
"public",
"function",
"pushNote",
"(",
"$",
"title",
",",
"$",
"body",
")",
"{",
"self",
"::",
"checkPushable",
"(",
")",
";",
"$",
"data",
"=",
"[",
"]",
";",
"$",
"data",
"[",
"$",
"this",
"->",
"recipientType",
"]",
"=",
"$",
"this",
"->",
"re... | Push a note.
@param string $title The note's title.
@param string $body The note's body.
@return Push Push notification.
@throws Exceptions\ConnectionException
@throws Exceptions\NotPushableException | [
"Push",
"a",
"note",
"."
] | 3de4a1732d14e8303a836a0a86a44e280e9cbee2 | https://github.com/ivkos/Pushbullet-for-PHP/blob/3de4a1732d14e8303a836a0a86a44e280e9cbee2/src/Pushbullet/Pushable.php#L53-L67 |
190,005 | ivkos/Pushbullet-for-PHP | src/Pushbullet/Pushable.php | Pushable.pushFile | public function pushFile($filePath, $mimeType = null, $title = null, $body = null, $altFileName = null)
{
self::checkPushable();
$fullFilePath = realpath($filePath);
if (!is_readable($fullFilePath)) {
throw new Exceptions\NotFoundException('File does not exist or is unreadable.... | php | public function pushFile($filePath, $mimeType = null, $title = null, $body = null, $altFileName = null)
{
self::checkPushable();
$fullFilePath = realpath($filePath);
if (!is_readable($fullFilePath)) {
throw new Exceptions\NotFoundException('File does not exist or is unreadable.... | [
"public",
"function",
"pushFile",
"(",
"$",
"filePath",
",",
"$",
"mimeType",
"=",
"null",
",",
"$",
"title",
"=",
"null",
",",
"$",
"body",
"=",
"null",
",",
"$",
"altFileName",
"=",
"null",
")",
"{",
"self",
"::",
"checkPushable",
"(",
")",
";",
... | Push a file.
@param string $filePath The path of the file to push.
@param string $mimeType The MIME type of the file. If null, we'll try to guess it.
@param string $title The title of the push notification.
@param string $body The body of the push notification.
@param string $altFileName Alternative... | [
"Push",
"a",
"file",
"."
] | 3de4a1732d14e8303a836a0a86a44e280e9cbee2 | https://github.com/ivkos/Pushbullet-for-PHP/blob/3de4a1732d14e8303a836a0a86a44e280e9cbee2/src/Pushbullet/Pushable.php#L143-L186 |
190,006 | garbetjie/wechat-php | src/QR/Service.php | Service.createPermanentCode | public function createPermanentCode ($value)
{
$str = is_string($value);
$args = $this->createCode([
'action_name' => $str ? 'QR_LIMIT_STR_SCENE' : 'QR_LIMIT_SCENE',
'action_info' => [
'scene' => [
($str ? 'scene_str' : 'scene_id') => $val... | php | public function createPermanentCode ($value)
{
$str = is_string($value);
$args = $this->createCode([
'action_name' => $str ? 'QR_LIMIT_STR_SCENE' : 'QR_LIMIT_SCENE',
'action_info' => [
'scene' => [
($str ? 'scene_str' : 'scene_id') => $val... | [
"public",
"function",
"createPermanentCode",
"(",
"$",
"value",
")",
"{",
"$",
"str",
"=",
"is_string",
"(",
"$",
"value",
")",
";",
"$",
"args",
"=",
"$",
"this",
"->",
"createCode",
"(",
"[",
"'action_name'",
"=>",
"$",
"str",
"?",
"'QR_LIMIT_STR_SCENE... | Creates and returns an instance of a new permanent QR code. This code can be used to download the
code contents.
@param string|int $value
@return Code\Permanent
@throws Exception | [
"Creates",
"and",
"returns",
"an",
"instance",
"of",
"a",
"new",
"permanent",
"QR",
"code",
".",
"This",
"code",
"can",
"be",
"used",
"to",
"download",
"the",
"code",
"contents",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/QR/Service.php#L65-L79 |
190,007 | garbetjie/wechat-php | src/QR/Service.php | Service.createCode | private function createCode (array $body)
{
$json = json_decode(
$this->client->send(
new Request(
'POST',
'https://api.weixin.qq.com/cgi-bin/qrcode/create',
[],
json_encode($body)
)
... | php | private function createCode (array $body)
{
$json = json_decode(
$this->client->send(
new Request(
'POST',
'https://api.weixin.qq.com/cgi-bin/qrcode/create',
[],
json_encode($body)
)
... | [
"private",
"function",
"createCode",
"(",
"array",
"$",
"body",
")",
"{",
"$",
"json",
"=",
"json_decode",
"(",
"$",
"this",
"->",
"client",
"->",
"send",
"(",
"new",
"Request",
"(",
"'POST'",
",",
"'https://api.weixin.qq.com/cgi-bin/qrcode/create'",
",",
"[",... | Method responsible for the actual interaction with the WeChat API, and returns the arguments used for creating
a GroupService code.
@param array $body
@return array
@throws Exception | [
"Method",
"responsible",
"for",
"the",
"actual",
"interaction",
"with",
"the",
"WeChat",
"API",
"and",
"returns",
"the",
"arguments",
"used",
"for",
"creating",
"a",
"GroupService",
"code",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/QR/Service.php#L115-L143 |
190,008 | garbetjie/wechat-php | src/Media/Type/NewsItem.php | NewsItem.withURL | public function withURL ($url)
{
if (filter_var($url, FILTER_VALIDATE_URL) === false) {
throw new InvalidArgumentException("invalid url `{$url}` given for news item");
}
$new = clone $this;
$new->url = $url;
return $new;
} | php | public function withURL ($url)
{
if (filter_var($url, FILTER_VALIDATE_URL) === false) {
throw new InvalidArgumentException("invalid url `{$url}` given for news item");
}
$new = clone $this;
$new->url = $url;
return $new;
} | [
"public",
"function",
"withURL",
"(",
"$",
"url",
")",
"{",
"if",
"(",
"filter_var",
"(",
"$",
"url",
",",
"FILTER_VALIDATE_URL",
")",
"===",
"false",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"invalid url `{$url}` given for news item\"",
")",
... | Populates the URL to be used when clicking on "View more" in an article.
@param string $url
@return static
@throws InvalidArgumentException | [
"Populates",
"the",
"URL",
"to",
"be",
"used",
"when",
"clicking",
"on",
"View",
"more",
"in",
"an",
"article",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Media/Type/NewsItem.php#L81-L91 |
190,009 | garbetjie/wechat-php | src/URL/Service.php | Service.shortenAll | public function shortenAll (array $urls, callable $callback = null)
{
// Create output.
$urls = array_values($urls);
$shortened = [];
// Create request builder.
$requests = function ($urls) {
foreach ($urls as $url) {
yield new Request(
... | php | public function shortenAll (array $urls, callable $callback = null)
{
// Create output.
$urls = array_values($urls);
$shortened = [];
// Create request builder.
$requests = function ($urls) {
foreach ($urls as $url) {
yield new Request(
... | [
"public",
"function",
"shortenAll",
"(",
"array",
"$",
"urls",
",",
"callable",
"$",
"callback",
"=",
"null",
")",
"{",
"// Create output.",
"$",
"urls",
"=",
"array_values",
"(",
"$",
"urls",
")",
";",
"$",
"shortened",
"=",
"[",
"]",
";",
"// Create re... | Shortens all the given URLs.
If a callback is given, it needs to have the following signature:
`function (RequestException $error = null, $short = '', $long = '')`
If an error occurs attempting to shorten a URL, the $error parameter will be populated with an instance of
`GuzzleHttp\Exception\RequestException`.
If no... | [
"Shortens",
"all",
"the",
"given",
"URLs",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/URL/Service.php#L29-L79 |
190,010 | garbetjie/wechat-php | src/URL/Service.php | Service.shorten | public function shorten ($url)
{
$shortened = null;
$this->shortenAll([$url], function ($error, $short, $long) use (&$shortened) {
$shortened = $short;
});
return $shortened;
} | php | public function shorten ($url)
{
$shortened = null;
$this->shortenAll([$url], function ($error, $short, $long) use (&$shortened) {
$shortened = $short;
});
return $shortened;
} | [
"public",
"function",
"shorten",
"(",
"$",
"url",
")",
"{",
"$",
"shortened",
"=",
"null",
";",
"$",
"this",
"->",
"shortenAll",
"(",
"[",
"$",
"url",
"]",
",",
"function",
"(",
"$",
"error",
",",
"$",
"short",
",",
"$",
"long",
")",
"use",
"(",
... | Returns a shorter representation of the given URL. Similar to URL shortening services like bit.ly, etc.
@param string $url
@return string|null | [
"Returns",
"a",
"shorter",
"representation",
"of",
"the",
"given",
"URL",
".",
"Similar",
"to",
"URL",
"shortening",
"services",
"like",
"bit",
".",
"ly",
"etc",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/URL/Service.php#L88-L97 |
190,011 | garbetjie/wechat-php | src/URL/Service.php | Service.expandAll | public function expandAll (array $urls, callable $callback = null)
{
$urls = array_values($urls);
$expanded = [];
// Request builder.
$requests = function ($urls) {
foreach ($urls as $url) {
yield new Request('HEAD', $url);
}
};
... | php | public function expandAll (array $urls, callable $callback = null)
{
$urls = array_values($urls);
$expanded = [];
// Request builder.
$requests = function ($urls) {
foreach ($urls as $url) {
yield new Request('HEAD', $url);
}
};
... | [
"public",
"function",
"expandAll",
"(",
"array",
"$",
"urls",
",",
"callable",
"$",
"callback",
"=",
"null",
")",
"{",
"$",
"urls",
"=",
"array_values",
"(",
"$",
"urls",
")",
";",
"$",
"expanded",
"=",
"[",
"]",
";",
"// Request builder.",
"$",
"reque... | Expands the given URLs into their long version. This is done dirtily, by issuing a HEAD request to the given
short URL, and using the contents of the `Location` header.
If a callback is given, it needs to have the following signature:
`function ($long = '', $short = '')`
If a callback isn't specified, an array contai... | [
"Expands",
"the",
"given",
"URLs",
"into",
"their",
"long",
"version",
".",
"This",
"is",
"done",
"dirtily",
"by",
"issuing",
"a",
"HEAD",
"request",
"to",
"the",
"given",
"short",
"URL",
"and",
"using",
"the",
"contents",
"of",
"the",
"Location",
"header"... | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/URL/Service.php#L113-L154 |
190,012 | garbetjie/wechat-php | src/URL/Service.php | Service.expand | public function expand ($url)
{
$expanded = null;
$this->expandAll([$url], function ($error, $long) use (&$expanded) {
$expanded = $long;
});
return $expanded;
} | php | public function expand ($url)
{
$expanded = null;
$this->expandAll([$url], function ($error, $long) use (&$expanded) {
$expanded = $long;
});
return $expanded;
} | [
"public",
"function",
"expand",
"(",
"$",
"url",
")",
"{",
"$",
"expanded",
"=",
"null",
";",
"$",
"this",
"->",
"expandAll",
"(",
"[",
"$",
"url",
"]",
",",
"function",
"(",
"$",
"error",
",",
"$",
"long",
")",
"use",
"(",
"&",
"$",
"expanded",
... | Expands the given URL, and will return the long version of the provided shortened URL. This is done by issuing
a HEAD request on the given URL.
@param string $url
@return string|null | [
"Expands",
"the",
"given",
"URL",
"and",
"will",
"return",
"the",
"long",
"version",
"of",
"the",
"provided",
"shortened",
"URL",
".",
"This",
"is",
"done",
"by",
"issuing",
"a",
"HEAD",
"request",
"on",
"the",
"given",
"URL",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/URL/Service.php#L164-L173 |
190,013 | garbetjie/wechat-php | src/Groups/Service.php | Service.getAllGroups | public function getAllGroups ()
{
$request = new Request("GET", "https://api.weixin.qq.com/cgi-bin/groups/get");
$response = $this->client->send($request);
$json = json_decode($response->getBody());
$groups = [];
if (isset($json->groups)) {
foreach ($json->groups... | php | public function getAllGroups ()
{
$request = new Request("GET", "https://api.weixin.qq.com/cgi-bin/groups/get");
$response = $this->client->send($request);
$json = json_decode($response->getBody());
$groups = [];
if (isset($json->groups)) {
foreach ($json->groups... | [
"public",
"function",
"getAllGroups",
"(",
")",
"{",
"$",
"request",
"=",
"new",
"Request",
"(",
"\"GET\"",
",",
"\"https://api.weixin.qq.com/cgi-bin/groups/get\"",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"send",
"(",
"$",
"request",... | Retrieves a list of all the groups that have been created in this OA.
@return Group[]
@throws GuzzleException
@throws APIErrorException | [
"Retrieves",
"a",
"list",
"of",
"all",
"the",
"groups",
"that",
"have",
"been",
"created",
"in",
"this",
"OA",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Groups/Service.php#L48-L64 |
190,014 | garbetjie/wechat-php | src/Groups/Service.php | Service.getGroup | public function getGroup ($groupID)
{
$groups = $this->getAllGroups();
foreach ($groups as $group) {
if ($group->getID() == $groupID) {
return $group;
}
}
return null;
} | php | public function getGroup ($groupID)
{
$groups = $this->getAllGroups();
foreach ($groups as $group) {
if ($group->getID() == $groupID) {
return $group;
}
}
return null;
} | [
"public",
"function",
"getGroup",
"(",
"$",
"groupID",
")",
"{",
"$",
"groups",
"=",
"$",
"this",
"->",
"getAllGroups",
"(",
")",
";",
"foreach",
"(",
"$",
"groups",
"as",
"$",
"group",
")",
"{",
"if",
"(",
"$",
"group",
"->",
"getID",
"(",
")",
... | Returns the details for a single group. If no group with the given ID is found, null will be returned.
@param int $groupID
@return Group|null
@throws Exception | [
"Returns",
"the",
"details",
"for",
"a",
"single",
"group",
".",
"If",
"no",
"group",
"with",
"the",
"given",
"ID",
"is",
"found",
"null",
"will",
"be",
"returned",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Groups/Service.php#L74-L85 |
190,015 | garbetjie/wechat-php | src/Groups/Service.php | Service.updateGroup | public function updateGroup (Group $group)
{
$json = [
'group' => [
'id' => $group->getID(),
'name' => $group->getName(),
],
];
$request = new Request("POST", "https://api.weixin.qq.com/cgi-bin/groups/update", [], json_encode($json))... | php | public function updateGroup (Group $group)
{
$json = [
'group' => [
'id' => $group->getID(),
'name' => $group->getName(),
],
];
$request = new Request("POST", "https://api.weixin.qq.com/cgi-bin/groups/update", [], json_encode($json))... | [
"public",
"function",
"updateGroup",
"(",
"Group",
"$",
"group",
")",
"{",
"$",
"json",
"=",
"[",
"'group'",
"=>",
"[",
"'id'",
"=>",
"$",
"group",
"->",
"getID",
"(",
")",
",",
"'name'",
"=>",
"$",
"group",
"->",
"getName",
"(",
")",
",",
"]",
"... | Allows the updating of a group.
@param Group $group
@throws GuzzleException
@throws APIErrorException | [
"Allows",
"the",
"updating",
"of",
"a",
"group",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Groups/Service.php#L95-L106 |
190,016 | garbetjie/wechat-php | src/Users/Service.php | Service.changeGroup | public function changeGroup ($userOpenID, $groupID)
{
$failed = $this->changeAllGroups([$userOpenID], $groupID);
if (count($failed) <= 0) {
return true;
}
return false;
} | php | public function changeGroup ($userOpenID, $groupID)
{
$failed = $this->changeAllGroups([$userOpenID], $groupID);
if (count($failed) <= 0) {
return true;
}
return false;
} | [
"public",
"function",
"changeGroup",
"(",
"$",
"userOpenID",
",",
"$",
"groupID",
")",
"{",
"$",
"failed",
"=",
"$",
"this",
"->",
"changeAllGroups",
"(",
"[",
"$",
"userOpenID",
"]",
",",
"$",
"groupID",
")",
";",
"if",
"(",
"count",
"(",
"$",
"fail... | Changes the group for the specified user to the specified group's ID.
@param string $userOpenID - The user's WeChat ID.
@param int $groupID - The ID of the group to move the user to.
@return bool | [
"Changes",
"the",
"group",
"for",
"the",
"specified",
"user",
"to",
"the",
"specified",
"group",
"s",
"ID",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Users/Service.php#L25-L34 |
190,017 | garbetjie/wechat-php | src/Users/Service.php | Service.changeAllGroups | public function changeAllGroups (array $userOpenIDs, $groupID)
{
if (count($userOpenIDs) < 1) {
throw new InvalidArgumentException("At least one user is required.");
}
// Build requests.
$requests = function ($users) use ($groupID) {
foreach (array_chunk($use... | php | public function changeAllGroups (array $userOpenIDs, $groupID)
{
if (count($userOpenIDs) < 1) {
throw new InvalidArgumentException("At least one user is required.");
}
// Build requests.
$requests = function ($users) use ($groupID) {
foreach (array_chunk($use... | [
"public",
"function",
"changeAllGroups",
"(",
"array",
"$",
"userOpenIDs",
",",
"$",
"groupID",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"userOpenIDs",
")",
"<",
"1",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"At least one user is required.\"",... | Changes the group for all the specified users. Returns an array containing the OpenID's of the users that failed
to have their group changed.
@param array $userOpenIDs
@param int $groupID
@return array | [
"Changes",
"the",
"group",
"for",
"all",
"the",
"specified",
"users",
".",
"Returns",
"an",
"array",
"containing",
"the",
"OpenID",
"s",
"of",
"the",
"users",
"that",
"failed",
"to",
"have",
"their",
"group",
"changed",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Users/Service.php#L45-L83 |
190,018 | garbetjie/wechat-php | src/Users/Service.php | Service.getAllUsers | public function getAllUsers (array $userOpenIDs, callable $callback = null, $lang = 'en')
{
if (count($userOpenIDs) < 1) {
throw new InvalidArgumentException("At least one user is required.");
} else {
$userOpenIDs = array_unique(array_values($userOpenIDs));
}
... | php | public function getAllUsers (array $userOpenIDs, callable $callback = null, $lang = 'en')
{
if (count($userOpenIDs) < 1) {
throw new InvalidArgumentException("At least one user is required.");
} else {
$userOpenIDs = array_unique(array_values($userOpenIDs));
}
... | [
"public",
"function",
"getAllUsers",
"(",
"array",
"$",
"userOpenIDs",
",",
"callable",
"$",
"callback",
"=",
"null",
",",
"$",
"lang",
"=",
"'en'",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"userOpenIDs",
")",
"<",
"1",
")",
"{",
"throw",
"new",
"Inva... | Retrieves the profiles of all the specified WeChat user IDs.
If no callback is supplied, then an array containing the relevant user objects (if the profile request was
successful), or NULL values (if the profile request failed) indexed by the specified profile ID is returned.
<pre>
$returned[ 'user id' ] = new User()... | [
"Retrieves",
"the",
"profiles",
"of",
"all",
"the",
"specified",
"WeChat",
"user",
"IDs",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Users/Service.php#L131-L175 |
190,019 | garbetjie/wechat-php | src/Users/Service.php | Service.paginateUsers | public function paginateUsers ($nextOpenID = null)
{
$json = json_decode(
$this->client->send(
new Request(
'GET',
Uri::withQueryValue(new Uri('https://api.weixin.qq.com/cgi-bin/user/get'), 'next_openid',
$nextOpenID... | php | public function paginateUsers ($nextOpenID = null)
{
$json = json_decode(
$this->client->send(
new Request(
'GET',
Uri::withQueryValue(new Uri('https://api.weixin.qq.com/cgi-bin/user/get'), 'next_openid',
$nextOpenID... | [
"public",
"function",
"paginateUsers",
"(",
"$",
"nextOpenID",
"=",
"null",
")",
"{",
"$",
"json",
"=",
"json_decode",
"(",
"$",
"this",
"->",
"client",
"->",
"send",
"(",
"new",
"Request",
"(",
"'GET'",
",",
"Uri",
"::",
"withQueryValue",
"(",
"new",
... | Allows pagination through the entire list of followers.
@param string $nextOpenID - Optional ID of the next user to paginate from.
@return PaginatedResultSet
@throws Exception | [
"Allows",
"pagination",
"through",
"the",
"entire",
"list",
"of",
"followers",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Users/Service.php#L195-L214 |
190,020 | ivkos/Pushbullet-for-PHP | src/Pushbullet/PhonebookEntry.php | PhonebookEntry.sendSms | public function sendSms($message)
{
if (empty($this->phone)) {
throw new Exceptions\InvalidRecipientException("Phonebook entry doesn't have a phone number.");
}
return $this->deviceParent->sendSms($this->phone, $message);
} | php | public function sendSms($message)
{
if (empty($this->phone)) {
throw new Exceptions\InvalidRecipientException("Phonebook entry doesn't have a phone number.");
}
return $this->deviceParent->sendSms($this->phone, $message);
} | [
"public",
"function",
"sendSms",
"(",
"$",
"message",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"phone",
")",
")",
"{",
"throw",
"new",
"Exceptions",
"\\",
"InvalidRecipientException",
"(",
"\"Phonebook entry doesn't have a phone number.\"",
")",
";"... | Send an SMS message to the contact.
@param string $message Message.
@return Push
@throws Exceptions\ConnectionException
@throws Exceptions\InvalidRecipientException Thrown if the contact doesn't have a number.
@throws Exceptions\NoSmsException Thrown if the device cannot send SMS messages. | [
"Send",
"an",
"SMS",
"message",
"to",
"the",
"contact",
"."
] | 3de4a1732d14e8303a836a0a86a44e280e9cbee2 | https://github.com/ivkos/Pushbullet-for-PHP/blob/3de4a1732d14e8303a836a0a86a44e280e9cbee2/src/Pushbullet/PhonebookEntry.php#L33-L40 |
190,021 | garbetjie/wechat-php | src/Menu/MenuItem.php | MenuItem.withoutItem | public function withoutItem (MenuItem $item)
{
$cloned = clone $this;
foreach ($cloned->items as $storedIndex => $storedItem) {
if ($storedItem === $item) {
unset($cloned->items[$storedIndex]);
break;
}
}
retur... | php | public function withoutItem (MenuItem $item)
{
$cloned = clone $this;
foreach ($cloned->items as $storedIndex => $storedItem) {
if ($storedItem === $item) {
unset($cloned->items[$storedIndex]);
break;
}
}
retur... | [
"public",
"function",
"withoutItem",
"(",
"MenuItem",
"$",
"item",
")",
"{",
"$",
"cloned",
"=",
"clone",
"$",
"this",
";",
"foreach",
"(",
"$",
"cloned",
"->",
"items",
"as",
"$",
"storedIndex",
"=>",
"$",
"storedItem",
")",
"{",
"if",
"(",
"$",
"st... | Removes the specified item from the menu. Ensures the menu item remains immutable.
@param MenuItem $item
@return MenuItem | [
"Removes",
"the",
"specified",
"item",
"from",
"the",
"menu",
".",
"Ensures",
"the",
"menu",
"item",
"remains",
"immutable",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Menu/MenuItem.php#L158-L170 |
190,022 | garbetjie/wechat-php | src/Menu/MenuItem.php | MenuItem.handleTypeView | protected function handleTypeView ($url)
{
if (filter_var($url, FILTER_VALIDATE_URL) === false) {
throw new InvalidArgumentException("Invalid URL.");
}
$this->key = $url;
} | php | protected function handleTypeView ($url)
{
if (filter_var($url, FILTER_VALIDATE_URL) === false) {
throw new InvalidArgumentException("Invalid URL.");
}
$this->key = $url;
} | [
"protected",
"function",
"handleTypeView",
"(",
"$",
"url",
")",
"{",
"if",
"(",
"filter_var",
"(",
"$",
"url",
",",
"FILTER_VALIDATE_URL",
")",
"===",
"false",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"Invalid URL.\"",
")",
";",
"}",
"$"... | Validates the URL that will be visited when clicking the menu item.
@param string $url - The URL to visit when clicking the menu item. | [
"Validates",
"the",
"URL",
"that",
"will",
"be",
"visited",
"when",
"clicking",
"the",
"menu",
"item",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Menu/MenuItem.php#L195-L202 |
190,023 | garbetjie/wechat-php | src/Responder/Reply/Handler.php | Handler.buildMessage | protected function buildMessage (array $message)
{
$doc = new DOMDocument();
$root = $doc->createElement('xml');
$doc->appendChild($root);
$message = array_merge(
$message,
['FromUserName' => $this->sender, 'ToUserName' => $this->recipient, 'CreateTim... | php | protected function buildMessage (array $message)
{
$doc = new DOMDocument();
$root = $doc->createElement('xml');
$doc->appendChild($root);
$message = array_merge(
$message,
['FromUserName' => $this->sender, 'ToUserName' => $this->recipient, 'CreateTim... | [
"protected",
"function",
"buildMessage",
"(",
"array",
"$",
"message",
")",
"{",
"$",
"doc",
"=",
"new",
"DOMDocument",
"(",
")",
";",
"$",
"root",
"=",
"$",
"doc",
"->",
"createElement",
"(",
"'xml'",
")",
";",
"$",
"doc",
"->",
"appendChild",
"(",
... | Receives an array representation of the message, and converts it into its XML representation.
@param array $message
@return string | [
"Receives",
"an",
"array",
"representation",
"of",
"the",
"message",
"and",
"converts",
"it",
"into",
"its",
"XML",
"representation",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Responder/Reply/Handler.php#L73-L87 |
190,024 | garbetjie/wechat-php | src/Responder/Reply/Handler.php | Handler.sendReply | private function sendReply ($reply, array $headers = [])
{
if ($this->sent) {
throw new Exception\AlreadySentException();
}
$headers = array_merge(
[
'Connection: close',
'Content-Length: ' . strlen($reply),
],
... | php | private function sendReply ($reply, array $headers = [])
{
if ($this->sent) {
throw new Exception\AlreadySentException();
}
$headers = array_merge(
[
'Connection: close',
'Content-Length: ' . strlen($reply),
],
... | [
"private",
"function",
"sendReply",
"(",
"$",
"reply",
",",
"array",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"sent",
")",
"{",
"throw",
"new",
"Exception",
"\\",
"AlreadySentException",
"(",
")",
";",
"}",
"$",
"headers... | Handles the sending of the reply. Throws an exception if a reply has previously been sent.
@param string $reply
@param array $headers
@throws Exception\AlreadySentException | [
"Handles",
"the",
"sending",
"of",
"the",
"reply",
".",
"Throws",
"an",
"exception",
"if",
"a",
"reply",
"has",
"previously",
"been",
"sent",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Responder/Reply/Handler.php#L124-L152 |
190,025 | garbetjie/wechat-php | src/Responder/Reply/Handler.php | Handler.sendText | public function sendText (Type\Text $message)
{
$this->sendReply(
$this->buildMessage(
[
'MsgType' => $message->getType(),
'Content' => $message->getContent(),
]
)
);
} | php | public function sendText (Type\Text $message)
{
$this->sendReply(
$this->buildMessage(
[
'MsgType' => $message->getType(),
'Content' => $message->getContent(),
]
)
);
} | [
"public",
"function",
"sendText",
"(",
"Type",
"\\",
"Text",
"$",
"message",
")",
"{",
"$",
"this",
"->",
"sendReply",
"(",
"$",
"this",
"->",
"buildMessage",
"(",
"[",
"'MsgType'",
"=>",
"$",
"message",
"->",
"getType",
"(",
")",
",",
"'Content'",
"=>... | Sends a text reply.
@param Type\Text $message
@throws Exception\AlreadySentException | [
"Sends",
"a",
"text",
"reply",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Responder/Reply/Handler.php#L173-L183 |
190,026 | garbetjie/wechat-php | src/Responder/Reply/Handler.php | Handler.sendImage | public function sendImage (Type\Image $message)
{
$this->sendReply(
$this->buildMessage(
[
'MsgType' => $message->getType(),
ucfirst($message->getType()) => [
'MediaId' => $message->getMediaID(),
... | php | public function sendImage (Type\Image $message)
{
$this->sendReply(
$this->buildMessage(
[
'MsgType' => $message->getType(),
ucfirst($message->getType()) => [
'MediaId' => $message->getMediaID(),
... | [
"public",
"function",
"sendImage",
"(",
"Type",
"\\",
"Image",
"$",
"message",
")",
"{",
"$",
"this",
"->",
"sendReply",
"(",
"$",
"this",
"->",
"buildMessage",
"(",
"[",
"'MsgType'",
"=>",
"$",
"message",
"->",
"getType",
"(",
")",
",",
"ucfirst",
"("... | Sends an image reply.
@param Type\Image $message
@throws Exception\AlreadySentException | [
"Sends",
"an",
"image",
"reply",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Responder/Reply/Handler.php#L192-L204 |
190,027 | garbetjie/wechat-php | src/Responder/Reply/Handler.php | Handler.sendAudio | public function sendAudio (Type\Audio $audioMessage)
{
$this->sendReply(
$this->buildMessage(
[
'MsgType' => $audioMessage->getType(),
ucfirst($audioMessage->getType()) => [
'MediaId' => $audioMessage->getMediaID(),
... | php | public function sendAudio (Type\Audio $audioMessage)
{
$this->sendReply(
$this->buildMessage(
[
'MsgType' => $audioMessage->getType(),
ucfirst($audioMessage->getType()) => [
'MediaId' => $audioMessage->getMediaID(),
... | [
"public",
"function",
"sendAudio",
"(",
"Type",
"\\",
"Audio",
"$",
"audioMessage",
")",
"{",
"$",
"this",
"->",
"sendReply",
"(",
"$",
"this",
"->",
"buildMessage",
"(",
"[",
"'MsgType'",
"=>",
"$",
"audioMessage",
"->",
"getType",
"(",
")",
",",
"ucfir... | Sends an audio reply.
@param Type\Audio $audioMessage
@throws Exception\AlreadySentException | [
"Sends",
"an",
"audio",
"reply",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Responder/Reply/Handler.php#L213-L225 |
190,028 | garbetjie/wechat-php | src/Responder/Reply/Handler.php | Handler.sendVideo | public function sendVideo (Type\Video $videoMessage)
{
$this->sendReply(
$this->buildMessage(
[
'MsgType' => $videoMessage->getType(),
ucfirst($videoMessage->getType()) => [
'MediaId' => $videoMessage->getMediaID(),
... | php | public function sendVideo (Type\Video $videoMessage)
{
$this->sendReply(
$this->buildMessage(
[
'MsgType' => $videoMessage->getType(),
ucfirst($videoMessage->getType()) => [
'MediaId' => $videoMessage->getMediaID(),
... | [
"public",
"function",
"sendVideo",
"(",
"Type",
"\\",
"Video",
"$",
"videoMessage",
")",
"{",
"$",
"this",
"->",
"sendReply",
"(",
"$",
"this",
"->",
"buildMessage",
"(",
"[",
"'MsgType'",
"=>",
"$",
"videoMessage",
"->",
"getType",
"(",
")",
",",
"ucfir... | Sends a video reply.
@param Type\Video $videoMessage
@throws Exception\AlreadySentException | [
"Sends",
"a",
"video",
"reply",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Responder/Reply/Handler.php#L234-L247 |
190,029 | garbetjie/wechat-php | src/Responder/Reply/Handler.php | Handler.sendMusic | public function sendMusic (Type\Music $musicMessage)
{
$this->sendReply(
$this->buildMessage(
[
'MsgType' => $musicMessage->getType(),
ucfirst($musicMessage->getType()) => [
'Title' => $musicMessage->getTitle(),
... | php | public function sendMusic (Type\Music $musicMessage)
{
$this->sendReply(
$this->buildMessage(
[
'MsgType' => $musicMessage->getType(),
ucfirst($musicMessage->getType()) => [
'Title' => $musicMessage->getTitle(),
... | [
"public",
"function",
"sendMusic",
"(",
"Type",
"\\",
"Music",
"$",
"musicMessage",
")",
"{",
"$",
"this",
"->",
"sendReply",
"(",
"$",
"this",
"->",
"buildMessage",
"(",
"[",
"'MsgType'",
"=>",
"$",
"musicMessage",
"->",
"getType",
"(",
")",
",",
"ucfir... | Sends a music reply.
@param Type\Music $musicMessage
@throws Exception\AlreadySentException | [
"Sends",
"a",
"music",
"reply",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Responder/Reply/Handler.php#L256-L272 |
190,030 | garbetjie/wechat-php | src/Responder/Reply/Handler.php | Handler.sendNews | public function sendNews (Type\News $newsMessage)
{
// Build up items.
$items = [];
foreach ($newsMessage->getItems() as $newsItem) {
$items[] = [
'Title' => $newsItem->getTitle(),
'Description' => $newsItem->getDescription(),
'PicU... | php | public function sendNews (Type\News $newsMessage)
{
// Build up items.
$items = [];
foreach ($newsMessage->getItems() as $newsItem) {
$items[] = [
'Title' => $newsItem->getTitle(),
'Description' => $newsItem->getDescription(),
'PicU... | [
"public",
"function",
"sendNews",
"(",
"Type",
"\\",
"News",
"$",
"newsMessage",
")",
"{",
"// Build up items.",
"$",
"items",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"newsMessage",
"->",
"getItems",
"(",
")",
"as",
"$",
"newsItem",
")",
"{",
"$",
"it... | Sends a new message reply.
@param Type\News $newsMessage
@throws Exception\AlreadySentException | [
"Sends",
"a",
"new",
"message",
"reply",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Responder/Reply/Handler.php#L281-L305 |
190,031 | ivkos/Pushbullet-for-PHP | src/Pushbullet/Connection.php | Connection.sendCurlRequest | public static function sendCurlRequest($url, $method, $data = null, $sendAsJSON = true, $apiKey = null)
{
$curl = curl_init();
if ($method == 'GET' && !empty($data)) {
$url .= '?' . http_build_query($data);
}
curl_setopt($curl, CURLOPT_URL, $url);
if (!empty($a... | php | public static function sendCurlRequest($url, $method, $data = null, $sendAsJSON = true, $apiKey = null)
{
$curl = curl_init();
if ($method == 'GET' && !empty($data)) {
$url .= '?' . http_build_query($data);
}
curl_setopt($curl, CURLOPT_URL, $url);
if (!empty($a... | [
"public",
"static",
"function",
"sendCurlRequest",
"(",
"$",
"url",
",",
"$",
"method",
",",
"$",
"data",
"=",
"null",
",",
"$",
"sendAsJSON",
"=",
"true",
",",
"$",
"apiKey",
"=",
"null",
")",
"{",
"$",
"curl",
"=",
"curl_init",
"(",
")",
";",
"if... | Send a request to a remote server using cURL.
@param string $url URL to send the request to.
@param string $method HTTP method.
@param array $data Query data.
@param bool $sendAsJSON Send the request as JSON.
@param string $apiKey Use this API key to authenticate
@return object Response.
@thro... | [
"Send",
"a",
"request",
"to",
"a",
"remote",
"server",
"using",
"cURL",
"."
] | 3de4a1732d14e8303a836a0a86a44e280e9cbee2 | https://github.com/ivkos/Pushbullet-for-PHP/blob/3de4a1732d14e8303a836a0a86a44e280e9cbee2/src/Pushbullet/Connection.php#L49-L114 |
190,032 | garbetjie/wechat-php | src/Responder/Responder.php | Responder.on | public function on ($type, callable $listener)
{
$args = array_slice(func_get_args(), 2);
$this->emitter->addListener(
$type,
function (EventInterface $event, Input\Input $input, Reply\Handler $replyHandler) use ($args, $listener) {
call_user_func_arr... | php | public function on ($type, callable $listener)
{
$args = array_slice(func_get_args(), 2);
$this->emitter->addListener(
$type,
function (EventInterface $event, Input\Input $input, Reply\Handler $replyHandler) use ($args, $listener) {
call_user_func_arr... | [
"public",
"function",
"on",
"(",
"$",
"type",
",",
"callable",
"$",
"listener",
")",
"{",
"$",
"args",
"=",
"array_slice",
"(",
"func_get_args",
"(",
")",
",",
"2",
")",
";",
"$",
"this",
"->",
"emitter",
"->",
"addListener",
"(",
"$",
"type",
",",
... | Adds an event listener for the given input type.
@param $type
@param callable $listener | [
"Adds",
"an",
"event",
"listener",
"for",
"the",
"given",
"input",
"type",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Responder/Responder.php#L42-L52 |
190,033 | garbetjie/wechat-php | src/Messaging/Formatter.php | Formatter.formatMessageForPush | public function formatMessageForPush (TypeInterface $message, $openID)
{
$json = [];
$json['touser'] = $openID;
$json['msgtype'] = $message->getType();
$methodName = 'format' . ucfirst($message->getType()) . 'ForPush';
if (method_exists($this, $methodName)) {
$j... | php | public function formatMessageForPush (TypeInterface $message, $openID)
{
$json = [];
$json['touser'] = $openID;
$json['msgtype'] = $message->getType();
$methodName = 'format' . ucfirst($message->getType()) . 'ForPush';
if (method_exists($this, $methodName)) {
$j... | [
"public",
"function",
"formatMessageForPush",
"(",
"TypeInterface",
"$",
"message",
",",
"$",
"openID",
")",
"{",
"$",
"json",
"=",
"[",
"]",
";",
"$",
"json",
"[",
"'touser'",
"]",
"=",
"$",
"openID",
";",
"$",
"json",
"[",
"'msgtype'",
"]",
"=",
"$... | Formats the provided message for sending as a push message to the specified recipient.
@param TypeInterface $message The message to send.
@param string $openID The user id of the message recipient.
@return array | [
"Formats",
"the",
"provided",
"message",
"for",
"sending",
"as",
"a",
"push",
"message",
"to",
"the",
"specified",
"recipient",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Messaging/Formatter.php#L77-L92 |
190,034 | garbetjie/wechat-php | src/Messaging/Formatter.php | Formatter.formatTemplateMessage | public function formatTemplateMessage ($templateID, $openID, $url, array $data, array $options = [])
{
$json = [
'touser' => (string)$openID,
'template_id' => (string)$templateID,
'url' => (string)$url,
'data' => [],
];
if ... | php | public function formatTemplateMessage ($templateID, $openID, $url, array $data, array $options = [])
{
$json = [
'touser' => (string)$openID,
'template_id' => (string)$templateID,
'url' => (string)$url,
'data' => [],
];
if ... | [
"public",
"function",
"formatTemplateMessage",
"(",
"$",
"templateID",
",",
"$",
"openID",
",",
"$",
"url",
",",
"array",
"$",
"data",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"json",
"=",
"[",
"'touser'",
"=>",
"(",
"string",
")",... | Formats the given data to be used in a template message. Returns an array that can be sent to the API.
@param string $templateID
@param string $openID
@param string $url
@param array $data
@param array $options
@return array | [
"Formats",
"the",
"given",
"data",
"to",
"be",
"used",
"in",
"a",
"template",
"message",
".",
"Returns",
"an",
"array",
"that",
"can",
"be",
"sent",
"to",
"the",
"API",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Messaging/Formatter.php#L182-L210 |
190,035 | garbetjie/wechat-php | src/Authentication/Service.php | Service.authenticate | public function authenticate ($appId, $secretKey, StorageInterface $storage = null)
{
// Default to file storage.
if (! $storage) {
$storage = new File(sys_get_temp_dir());
}
$hash = $storage->hash($appId, $secretKey);
$cached = $storage->retrieve($hash);
... | php | public function authenticate ($appId, $secretKey, StorageInterface $storage = null)
{
// Default to file storage.
if (! $storage) {
$storage = new File(sys_get_temp_dir());
}
$hash = $storage->hash($appId, $secretKey);
$cached = $storage->retrieve($hash);
... | [
"public",
"function",
"authenticate",
"(",
"$",
"appId",
",",
"$",
"secretKey",
",",
"StorageInterface",
"$",
"storage",
"=",
"null",
")",
"{",
"// Default to file storage.",
"if",
"(",
"!",
"$",
"storage",
")",
"{",
"$",
"storage",
"=",
"new",
"File",
"("... | Authenticates against the WeChat API. If authentication is successful, a modified copy of the client is returned,
with the access token in use.
@param string $appId The application ID
@param string $secretKey The application's secret key.
@param StorageInterface|null $storage The o... | [
"Authenticates",
"against",
"the",
"WeChat",
"API",
".",
"If",
"authentication",
"is",
"successful",
"a",
"modified",
"copy",
"of",
"the",
"client",
"is",
"returned",
"with",
"the",
"access",
"token",
"in",
"use",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Authentication/Service.php#L28-L62 |
190,036 | ivkos/Pushbullet-for-PHP | src/Pushbullet/Contact.php | Contact.changeName | public function changeName($name)
{
return new Contact(
Connection::sendCurlRequest(Connection::URL_CONTACTS . '/' . $this->iden, 'POST', ['name' => $name], true,
$this->apiKey), $this->apiKey
);
} | php | public function changeName($name)
{
return new Contact(
Connection::sendCurlRequest(Connection::URL_CONTACTS . '/' . $this->iden, 'POST', ['name' => $name], true,
$this->apiKey), $this->apiKey
);
} | [
"public",
"function",
"changeName",
"(",
"$",
"name",
")",
"{",
"return",
"new",
"Contact",
"(",
"Connection",
"::",
"sendCurlRequest",
"(",
"Connection",
"::",
"URL_CONTACTS",
".",
"'/'",
".",
"$",
"this",
"->",
"iden",
",",
"'POST'",
",",
"[",
"'name'",
... | Change the contact's name.
@param string $name New name.
@return Contact The same contact with a different name.
@throws Exceptions\ConnectionException | [
"Change",
"the",
"contact",
"s",
"name",
"."
] | 3de4a1732d14e8303a836a0a86a44e280e9cbee2 | https://github.com/ivkos/Pushbullet-for-PHP/blob/3de4a1732d14e8303a836a0a86a44e280e9cbee2/src/Pushbullet/Contact.php#L38-L44 |
190,037 | garbetjie/wechat-php | src/Menu/Menu.php | Menu.withItem | public function withItem (MenuItem $item)
{
if (count($this->items) >= 3) {
throw new LengthException("Maximum of 3 items allowed in a menu.");
}
$cloned = clone $this;
$cloned->items[] = $item;
return $cloned;
} | php | public function withItem (MenuItem $item)
{
if (count($this->items) >= 3) {
throw new LengthException("Maximum of 3 items allowed in a menu.");
}
$cloned = clone $this;
$cloned->items[] = $item;
return $cloned;
} | [
"public",
"function",
"withItem",
"(",
"MenuItem",
"$",
"item",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"items",
")",
">=",
"3",
")",
"{",
"throw",
"new",
"LengthException",
"(",
"\"Maximum of 3 items allowed in a menu.\"",
")",
";",
"}",
"$"... | Adds a new item to the menu. Ensures the menu remains immutable.
@param MenuItem $item
@return Menu | [
"Adds",
"a",
"new",
"item",
"to",
"the",
"menu",
".",
"Ensures",
"the",
"menu",
"remains",
"immutable",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Menu/Menu.php#L30-L40 |
190,038 | garbetjie/wechat-php | src/Messaging/Service.php | Service.sendPushMessageToUser | public function sendPushMessageToUser(TypeInterface $message, $openID)
{
$this->client->send(
new Request(
"POST",
"https://api.weixin.qq.com/cgi-bin/message/custom/send",
[],
json_encode(
(new Formatter())->form... | php | public function sendPushMessageToUser(TypeInterface $message, $openID)
{
$this->client->send(
new Request(
"POST",
"https://api.weixin.qq.com/cgi-bin/message/custom/send",
[],
json_encode(
(new Formatter())->form... | [
"public",
"function",
"sendPushMessageToUser",
"(",
"TypeInterface",
"$",
"message",
",",
"$",
"openID",
")",
"{",
"$",
"this",
"->",
"client",
"->",
"send",
"(",
"new",
"Request",
"(",
"\"POST\"",
",",
"\"https://api.weixin.qq.com/cgi-bin/message/custom/send\"",
",... | Sends the given message to the specified user.
@param TypeInterface $message - The message to be sent.
@param string $openID - The user's Open ID to send the message to. | [
"Sends",
"the",
"given",
"message",
"to",
"the",
"specified",
"user",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Messaging/Service.php#L18-L30 |
190,039 | garbetjie/wechat-php | src/Messaging/Service.php | Service.sendBroadcastMessageToGroup | public function sendBroadcastMessageToGroup (TypeInterface $message, $groupID)
{
$json = (new Formatter())->formatMessageForBroadcast($message);
$json['filter']['group_id'] = (int)$groupID;
$json = json_decode(
$this->client->send(
new Request(
... | php | public function sendBroadcastMessageToGroup (TypeInterface $message, $groupID)
{
$json = (new Formatter())->formatMessageForBroadcast($message);
$json['filter']['group_id'] = (int)$groupID;
$json = json_decode(
$this->client->send(
new Request(
... | [
"public",
"function",
"sendBroadcastMessageToGroup",
"(",
"TypeInterface",
"$",
"message",
",",
"$",
"groupID",
")",
"{",
"$",
"json",
"=",
"(",
"new",
"Formatter",
"(",
")",
")",
"->",
"formatMessageForBroadcast",
"(",
"$",
"message",
")",
";",
"$",
"json",... | Sends the given messages as a broadcast to the specified group. Returns the ID of the broadcast message, in order
to query the status of the message at a later stage.
@param TypeInterface $message
@param int $groupID
@return int
@throws Exception | [
"Sends",
"the",
"given",
"messages",
"as",
"a",
"broadcast",
"to",
"the",
"specified",
"group",
".",
"Returns",
"the",
"ID",
"of",
"the",
"broadcast",
"message",
"in",
"order",
"to",
"query",
"the",
"status",
"of",
"the",
"message",
"at",
"a",
"later",
"... | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Messaging/Service.php#L42-L63 |
190,040 | garbetjie/wechat-php | src/Messaging/Service.php | Service.queryBroadcastMessageStatus | public function queryBroadcastMessageStatus ($broadcastMessageID)
{
$json = json_decode(
$this->client->send(
new Request(
"POST",
"https://api.weixin.qq.com/cgi-bin/message/mass/get",
[],
json_encode... | php | public function queryBroadcastMessageStatus ($broadcastMessageID)
{
$json = json_decode(
$this->client->send(
new Request(
"POST",
"https://api.weixin.qq.com/cgi-bin/message/mass/get",
[],
json_encode... | [
"public",
"function",
"queryBroadcastMessageStatus",
"(",
"$",
"broadcastMessageID",
")",
"{",
"$",
"json",
"=",
"json_decode",
"(",
"$",
"this",
"->",
"client",
"->",
"send",
"(",
"new",
"Request",
"(",
"\"POST\"",
",",
"\"https://api.weixin.qq.com/cgi-bin/message/... | Returns a string that contains the status of the specified broadcast message.
@param int $broadcastMessageID - The ID of the broadcast message to query.
@return string | [
"Returns",
"a",
"string",
"that",
"contains",
"the",
"status",
"of",
"the",
"specified",
"broadcast",
"message",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Messaging/Service.php#L104-L122 |
190,041 | garbetjie/wechat-php | src/Messaging/Service.php | Service.sendTemplateMessageToUser | public function sendTemplateMessageToUser ($templateID, $openID, $url, array $data, array $options = [])
{
if (! filter_var($url, FILTER_VALIDATE_URL)) {
throw new InvalidArgumentException('$url must be a valid URL.');
}
$json = json_decode(
$this->client->send(
... | php | public function sendTemplateMessageToUser ($templateID, $openID, $url, array $data, array $options = [])
{
if (! filter_var($url, FILTER_VALIDATE_URL)) {
throw new InvalidArgumentException('$url must be a valid URL.');
}
$json = json_decode(
$this->client->send(
... | [
"public",
"function",
"sendTemplateMessageToUser",
"(",
"$",
"templateID",
",",
"$",
"openID",
",",
"$",
"url",
",",
"array",
"$",
"data",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"filter_var",
"(",
"$",
"url",
",",
"FIL... | Sends the templated message with the given template id to to specified user.
Returns a message ID that can be used to query the send status of the message at a later stage.
@param string $templateID - The long template ID of the template message to send.
@param string $openID - The Open ID of the recipient.
@param st... | [
"Sends",
"the",
"templated",
"message",
"with",
"the",
"given",
"template",
"id",
"to",
"to",
"specified",
"user",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Messaging/Service.php#L173-L203 |
190,042 | ivkos/Pushbullet-for-PHP | src/Pushbullet/Pushbullet.php | Pushbullet.getPushes | public function getPushes($modifiedAfter = 0, $cursor = null, $limit = null)
{
$data = self::initData($modifiedAfter, $cursor, $limit);
$pushes = Connection::sendCurlRequest(Connection::URL_PUSHES, 'GET', $data, false, $this->apiKey)->pushes;
$objPushes = [];
foreach ($pushes as $... | php | public function getPushes($modifiedAfter = 0, $cursor = null, $limit = null)
{
$data = self::initData($modifiedAfter, $cursor, $limit);
$pushes = Connection::sendCurlRequest(Connection::URL_PUSHES, 'GET', $data, false, $this->apiKey)->pushes;
$objPushes = [];
foreach ($pushes as $... | [
"public",
"function",
"getPushes",
"(",
"$",
"modifiedAfter",
"=",
"0",
",",
"$",
"cursor",
"=",
"null",
",",
"$",
"limit",
"=",
"null",
")",
"{",
"$",
"data",
"=",
"self",
"::",
"initData",
"(",
"$",
"modifiedAfter",
",",
"$",
"cursor",
",",
"$",
... | Get push history.
@param int $modifiedAfter Request pushes modified after this UNIX timestamp.
@param string $cursor Request the next page via its cursor from a previous response. See the API
documentation (https://docs.pushbullet.com/http/) for a detailed description.
@param int $limit Maximum nu... | [
"Get",
"push",
"history",
"."
] | 3de4a1732d14e8303a836a0a86a44e280e9cbee2 | https://github.com/ivkos/Pushbullet-for-PHP/blob/3de4a1732d14e8303a836a0a86a44e280e9cbee2/src/Pushbullet/Pushbullet.php#L46-L61 |
190,043 | ivkos/Pushbullet-for-PHP | src/Pushbullet/Pushbullet.php | Pushbullet.push | public function push($iden)
{
$response = Connection::sendCurlRequest(Connection::URL_PUSHES . '/' . $iden, 'GET', null, false, $this->apiKey);
return new Push($response, $this->apiKey);
} | php | public function push($iden)
{
$response = Connection::sendCurlRequest(Connection::URL_PUSHES . '/' . $iden, 'GET', null, false, $this->apiKey);
return new Push($response, $this->apiKey);
} | [
"public",
"function",
"push",
"(",
"$",
"iden",
")",
"{",
"$",
"response",
"=",
"Connection",
"::",
"sendCurlRequest",
"(",
"Connection",
"::",
"URL_PUSHES",
".",
"'/'",
".",
"$",
"iden",
",",
"'GET'",
",",
"null",
",",
"false",
",",
"$",
"this",
"->",... | Returns a Push object with the specified iden.
@param string $iden Iden of push notification.
@return Push Push notification object.
@throws Exceptions\ConnectionException
@throws Exceptions\NotFoundException If there's no push notification with the specified iden | [
"Returns",
"a",
"Push",
"object",
"with",
"the",
"specified",
"iden",
"."
] | 3de4a1732d14e8303a836a0a86a44e280e9cbee2 | https://github.com/ivkos/Pushbullet-for-PHP/blob/3de4a1732d14e8303a836a0a86a44e280e9cbee2/src/Pushbullet/Pushbullet.php#L72-L77 |
190,044 | ivkos/Pushbullet-for-PHP | src/Pushbullet/Pushbullet.php | Pushbullet.getDevices | public function getDevices($modifiedAfter = 0, $cursor = null, $limit = null)
{
$data = self::initData($modifiedAfter, $cursor, $limit);
$devices = Connection::sendCurlRequest(Connection::URL_DEVICES, 'GET', $data, true, $this->apiKey)->devices;
$objDevices = [];
foreach ($devices... | php | public function getDevices($modifiedAfter = 0, $cursor = null, $limit = null)
{
$data = self::initData($modifiedAfter, $cursor, $limit);
$devices = Connection::sendCurlRequest(Connection::URL_DEVICES, 'GET', $data, true, $this->apiKey)->devices;
$objDevices = [];
foreach ($devices... | [
"public",
"function",
"getDevices",
"(",
"$",
"modifiedAfter",
"=",
"0",
",",
"$",
"cursor",
"=",
"null",
",",
"$",
"limit",
"=",
"null",
")",
"{",
"$",
"data",
"=",
"self",
"::",
"initData",
"(",
"$",
"modifiedAfter",
",",
"$",
"cursor",
",",
"$",
... | Get a list of available devices.
@param int $modifiedAfter Request devices modified after this UNIX timestamp.
@param string $cursor Request the next page via its cursor from a previous response. See the API
documentation (https://docs.pushbullet.com/http/) for a detailed description.
@param int $limit ... | [
"Get",
"a",
"list",
"of",
"available",
"devices",
"."
] | 3de4a1732d14e8303a836a0a86a44e280e9cbee2 | https://github.com/ivkos/Pushbullet-for-PHP/blob/3de4a1732d14e8303a836a0a86a44e280e9cbee2/src/Pushbullet/Pushbullet.php#L91-L108 |
190,045 | ivkos/Pushbullet-for-PHP | src/Pushbullet/Pushbullet.php | Pushbullet.device | public function device($idenOrNickname)
{
if ($this->devices === null) {
$this->getDevices();
}
foreach ($this->devices as $d) {
if ($d->iden == $idenOrNickname || $d->nickname == $idenOrNickname) {
return $d;
}
}
throw ne... | php | public function device($idenOrNickname)
{
if ($this->devices === null) {
$this->getDevices();
}
foreach ($this->devices as $d) {
if ($d->iden == $idenOrNickname || $d->nickname == $idenOrNickname) {
return $d;
}
}
throw ne... | [
"public",
"function",
"device",
"(",
"$",
"idenOrNickname",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"devices",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"getDevices",
"(",
")",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"devices",
"as",
"$",
"d... | Target a device by its iden or nickname.
@param string $idenOrNickname device_iden or nickname of the device.
@return Device The device.
@throws Exceptions\ConnectionException
@throws Exceptions\InvalidTokenException
@throws Exceptions\NotFoundException | [
"Target",
"a",
"device",
"by",
"its",
"iden",
"or",
"nickname",
"."
] | 3de4a1732d14e8303a836a0a86a44e280e9cbee2 | https://github.com/ivkos/Pushbullet-for-PHP/blob/3de4a1732d14e8303a836a0a86a44e280e9cbee2/src/Pushbullet/Pushbullet.php#L120-L133 |
190,046 | ivkos/Pushbullet-for-PHP | src/Pushbullet/Pushbullet.php | Pushbullet.createContact | public function createContact($name, $email)
{
if (filter_var($email, FILTER_VALIDATE_EMAIL) === false) {
throw new Exceptions\InvalidRecipientException('Invalid email address.');
}
$data = [
'name' => $name,
'email' => $email
];
return ... | php | public function createContact($name, $email)
{
if (filter_var($email, FILTER_VALIDATE_EMAIL) === false) {
throw new Exceptions\InvalidRecipientException('Invalid email address.');
}
$data = [
'name' => $name,
'email' => $email
];
return ... | [
"public",
"function",
"createContact",
"(",
"$",
"name",
",",
"$",
"email",
")",
"{",
"if",
"(",
"filter_var",
"(",
"$",
"email",
",",
"FILTER_VALIDATE_EMAIL",
")",
"===",
"false",
")",
"{",
"throw",
"new",
"Exceptions",
"\\",
"InvalidRecipientException",
"(... | Create a new contact.
@param string $name Name.
@param string $email Email address.
@return Contact The newly created contact.
@throws Exceptions\ConnectionException
@throws Exceptions\InvalidRecipientException Thrown if the email address is invalid.
@throws Exceptions\InvalidTokenException | [
"Create",
"a",
"new",
"contact",
"."
] | 3de4a1732d14e8303a836a0a86a44e280e9cbee2 | https://github.com/ivkos/Pushbullet-for-PHP/blob/3de4a1732d14e8303a836a0a86a44e280e9cbee2/src/Pushbullet/Pushbullet.php#L160-L175 |
190,047 | ivkos/Pushbullet-for-PHP | src/Pushbullet/Pushbullet.php | Pushbullet.getContacts | public function getContacts($modifiedAfter = 0, $cursor = null, $limit = null)
{
$data = self::initData($modifiedAfter, $cursor, $limit);
$contacts = Connection::sendCurlRequest(Connection::URL_CONTACTS, 'GET', $data, false, $this->apiKey)->contacts;
$objContacts = [];
foreach ($c... | php | public function getContacts($modifiedAfter = 0, $cursor = null, $limit = null)
{
$data = self::initData($modifiedAfter, $cursor, $limit);
$contacts = Connection::sendCurlRequest(Connection::URL_CONTACTS, 'GET', $data, false, $this->apiKey)->contacts;
$objContacts = [];
foreach ($c... | [
"public",
"function",
"getContacts",
"(",
"$",
"modifiedAfter",
"=",
"0",
",",
"$",
"cursor",
"=",
"null",
",",
"$",
"limit",
"=",
"null",
")",
"{",
"$",
"data",
"=",
"self",
"::",
"initData",
"(",
"$",
"modifiedAfter",
",",
"$",
"cursor",
",",
"$",
... | Get a list of contacts.
@param int $modifiedAfter Request contacts modified after this UNIX timestamp.
@param string $cursor Request the next page via its cursor from a previous response. See the API
documentation (https://docs.pushbullet.com/http/) for a detailed description.
@param int $limit Ma... | [
"Get",
"a",
"list",
"of",
"contacts",
"."
] | 3de4a1732d14e8303a836a0a86a44e280e9cbee2 | https://github.com/ivkos/Pushbullet-for-PHP/blob/3de4a1732d14e8303a836a0a86a44e280e9cbee2/src/Pushbullet/Pushbullet.php#L189-L206 |
190,048 | ivkos/Pushbullet-for-PHP | src/Pushbullet/Pushbullet.php | Pushbullet.contact | public function contact($nameOrEmail)
{
if ($this->contacts === null) {
$this->getContacts();
}
foreach ($this->contacts as $c) {
if ($c->name == $nameOrEmail || $c->email == $nameOrEmail) {
return $c;
}
}
throw new Except... | php | public function contact($nameOrEmail)
{
if ($this->contacts === null) {
$this->getContacts();
}
foreach ($this->contacts as $c) {
if ($c->name == $nameOrEmail || $c->email == $nameOrEmail) {
return $c;
}
}
throw new Except... | [
"public",
"function",
"contact",
"(",
"$",
"nameOrEmail",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"contacts",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"getContacts",
"(",
")",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"contacts",
"as",
"$",
"... | Target a contact by its name or email.
@param string $nameOrEmail Name or email of the contact.
@return Contact The contact.
@throws Exceptions\ConnectionException
@throws Exceptions\InvalidTokenException
@throws Exceptions\NotFoundException | [
"Target",
"a",
"contact",
"by",
"its",
"name",
"or",
"email",
"."
] | 3de4a1732d14e8303a836a0a86a44e280e9cbee2 | https://github.com/ivkos/Pushbullet-for-PHP/blob/3de4a1732d14e8303a836a0a86a44e280e9cbee2/src/Pushbullet/Pushbullet.php#L218-L231 |
190,049 | ivkos/Pushbullet-for-PHP | src/Pushbullet/Pushbullet.php | Pushbullet.updateUserPreferences | public function updateUserPreferences($preferences)
{
return Connection::sendCurlRequest(Connection::URL_USERS . '/me', 'POST', ['preferences' => $preferences], true,
$this->apiKey);
} | php | public function updateUserPreferences($preferences)
{
return Connection::sendCurlRequest(Connection::URL_USERS . '/me', 'POST', ['preferences' => $preferences], true,
$this->apiKey);
} | [
"public",
"function",
"updateUserPreferences",
"(",
"$",
"preferences",
")",
"{",
"return",
"Connection",
"::",
"sendCurlRequest",
"(",
"Connection",
"::",
"URL_USERS",
".",
"'/me'",
",",
"'POST'",
",",
"[",
"'preferences'",
"=>",
"$",
"preferences",
"]",
",",
... | Update preferences for the current user.
@param array $preferences Preferences.
@return object Response.
@throws Exceptions\ConnectionException
@throws Exceptions\InvalidTokenException | [
"Update",
"preferences",
"for",
"the",
"current",
"user",
"."
] | 3de4a1732d14e8303a836a0a86a44e280e9cbee2 | https://github.com/ivkos/Pushbullet-for-PHP/blob/3de4a1732d14e8303a836a0a86a44e280e9cbee2/src/Pushbullet/Pushbullet.php#L254-L258 |
190,050 | ivkos/Pushbullet-for-PHP | src/Pushbullet/Pushbullet.php | Pushbullet.channel | public function channel($tag)
{
if ($this->channels === null) {
$this->getChannelSubscriptions();
}
if ($this->myChannels === null) {
$this->getMyChannels();
}
foreach ($this->myChannels as $c) {
if ($tag == $c->tag) {
$c-... | php | public function channel($tag)
{
if ($this->channels === null) {
$this->getChannelSubscriptions();
}
if ($this->myChannels === null) {
$this->getMyChannels();
}
foreach ($this->myChannels as $c) {
if ($tag == $c->tag) {
$c-... | [
"public",
"function",
"channel",
"(",
"$",
"tag",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"channels",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"getChannelSubscriptions",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"myChannels",
"===",
"null"... | Target a channel to create, subscribe to, unsubscribe from, or get information.
@param string $tag Channel tag.
@return Channel Channel or a subscription to a channel.
If you need information about a channel, and not a subscription to one, it is
recommended to use the <code>getChannelInformation()</code> method and a... | [
"Target",
"a",
"channel",
"to",
"create",
"subscribe",
"to",
"unsubscribe",
"from",
"or",
"get",
"information",
"."
] | 3de4a1732d14e8303a836a0a86a44e280e9cbee2 | https://github.com/ivkos/Pushbullet-for-PHP/blob/3de4a1732d14e8303a836a0a86a44e280e9cbee2/src/Pushbullet/Pushbullet.php#L272-L297 |
190,051 | ivkos/Pushbullet-for-PHP | src/Pushbullet/Pushbullet.php | Pushbullet.getChannelSubscriptions | public function getChannelSubscriptions($modifiedAfter = 0, $cursor = null, $limit = null)
{
$data = self::initData($modifiedAfter, $cursor, $limit);
$subscriptions = Connection::sendCurlRequest(Connection::URL_SUBSCRIPTIONS, 'GET', $data, false,
$this->apiKey)->subscriptions;
... | php | public function getChannelSubscriptions($modifiedAfter = 0, $cursor = null, $limit = null)
{
$data = self::initData($modifiedAfter, $cursor, $limit);
$subscriptions = Connection::sendCurlRequest(Connection::URL_SUBSCRIPTIONS, 'GET', $data, false,
$this->apiKey)->subscriptions;
... | [
"public",
"function",
"getChannelSubscriptions",
"(",
"$",
"modifiedAfter",
"=",
"0",
",",
"$",
"cursor",
"=",
"null",
",",
"$",
"limit",
"=",
"null",
")",
"{",
"$",
"data",
"=",
"self",
"::",
"initData",
"(",
"$",
"modifiedAfter",
",",
"$",
"cursor",
... | Get a list of the channels the current user is subscribed to.
@param int $modifiedAfter Request contacts modified after this UNIX timestamp.
@param string $cursor Request the next page via its cursor from a previous response. See the API
documentation (https://docs.pushbullet.com/http/) for a detailed descri... | [
"Get",
"a",
"list",
"of",
"the",
"channels",
"the",
"current",
"user",
"is",
"subscribed",
"to",
"."
] | 3de4a1732d14e8303a836a0a86a44e280e9cbee2 | https://github.com/ivkos/Pushbullet-for-PHP/blob/3de4a1732d14e8303a836a0a86a44e280e9cbee2/src/Pushbullet/Pushbullet.php#L312-L330 |
190,052 | ivkos/Pushbullet-for-PHP | src/Pushbullet/Pushbullet.php | Pushbullet.getMyChannels | public function getMyChannels($modifiedAfter = 0, $cursor = null, $limit = null)
{
$data = self::initData($modifiedAfter, $cursor, $limit);
$myChannels = Connection::sendCurlRequest(Connection::URL_CHANNELS, 'GET', $data, false,
$this->apiKey)->channels;
$objChannels = [];
... | php | public function getMyChannels($modifiedAfter = 0, $cursor = null, $limit = null)
{
$data = self::initData($modifiedAfter, $cursor, $limit);
$myChannels = Connection::sendCurlRequest(Connection::URL_CHANNELS, 'GET', $data, false,
$this->apiKey)->channels;
$objChannels = [];
... | [
"public",
"function",
"getMyChannels",
"(",
"$",
"modifiedAfter",
"=",
"0",
",",
"$",
"cursor",
"=",
"null",
",",
"$",
"limit",
"=",
"null",
")",
"{",
"$",
"data",
"=",
"self",
"::",
"initData",
"(",
"$",
"modifiedAfter",
",",
"$",
"cursor",
",",
"$"... | Get a list of channels created by the current user.
@param int $modifiedAfter Request contacts modified after this UNIX timestamp.
@param string $cursor Request the next page via its cursor from a previous response. See the API
documentation (https://docs.pushbullet.com/http/) for a detailed description.
@pa... | [
"Get",
"a",
"list",
"of",
"channels",
"created",
"by",
"the",
"current",
"user",
"."
] | 3de4a1732d14e8303a836a0a86a44e280e9cbee2 | https://github.com/ivkos/Pushbullet-for-PHP/blob/3de4a1732d14e8303a836a0a86a44e280e9cbee2/src/Pushbullet/Pushbullet.php#L345-L364 |
190,053 | ivkos/Pushbullet-for-PHP | src/Pushbullet/Pushbullet.php | Pushbullet.initData | private static function initData($modifiedAfter, $cursor, $limit)
{
$data = [];
$data['modified_after'] = $modifiedAfter;
$data['cursor'] = $cursor;
$data['limit'] = $limit;
return $data;
} | php | private static function initData($modifiedAfter, $cursor, $limit)
{
$data = [];
$data['modified_after'] = $modifiedAfter;
$data['cursor'] = $cursor;
$data['limit'] = $limit;
return $data;
} | [
"private",
"static",
"function",
"initData",
"(",
"$",
"modifiedAfter",
",",
"$",
"cursor",
",",
"$",
"limit",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"$",
"data",
"[",
"'modified_after'",
"]",
"=",
"$",
"modifiedAfter",
";",
"$",
"data",
"[",
"'c... | Initialize data to be sent.
@param int $modifiedAfter Request contacts modified after this UNIX timestamp.
@param string $cursor Request the next page via its cursor from a previous response. See the API
documentation (https://docs.pushbullet.com/http/) for a detailed description.
@param int $limit ... | [
"Initialize",
"data",
"to",
"be",
"sent",
"."
] | 3de4a1732d14e8303a836a0a86a44e280e9cbee2 | https://github.com/ivkos/Pushbullet-for-PHP/blob/3de4a1732d14e8303a836a0a86a44e280e9cbee2/src/Pushbullet/Pushbullet.php#L376-L384 |
190,054 | ivkos/Pushbullet-for-PHP | src/Pushbullet/Push.php | Push.dismiss | public function dismiss()
{
return new Push(Connection::sendCurlRequest(Connection::URL_PUSHES . '/' . $this->iden, 'POST',
['dismissed' => true], true, $this->apiKey), $this->apiKey);
} | php | public function dismiss()
{
return new Push(Connection::sendCurlRequest(Connection::URL_PUSHES . '/' . $this->iden, 'POST',
['dismissed' => true], true, $this->apiKey), $this->apiKey);
} | [
"public",
"function",
"dismiss",
"(",
")",
"{",
"return",
"new",
"Push",
"(",
"Connection",
"::",
"sendCurlRequest",
"(",
"Connection",
"::",
"URL_PUSHES",
".",
"'/'",
".",
"$",
"this",
"->",
"iden",
",",
"'POST'",
",",
"[",
"'dismissed'",
"=>",
"true",
... | Dismiss the push notification.
@return Push The same push notification, now dismissed.
@throws Exceptions\ConnectionException | [
"Dismiss",
"the",
"push",
"notification",
"."
] | 3de4a1732d14e8303a836a0a86a44e280e9cbee2 | https://github.com/ivkos/Pushbullet-for-PHP/blob/3de4a1732d14e8303a836a0a86a44e280e9cbee2/src/Pushbullet/Push.php#L29-L33 |
190,055 | ivkos/Pushbullet-for-PHP | src/Pushbullet/Channel.php | Channel.subscribe | public function subscribe()
{
if ($this->type == "subscription") {
throw new Exceptions\ChannelException("Already subscribed to this channel.");
}
if (!empty($this->myChannel)) {
throw new Exceptions\ChannelException("Cannot subscribe to own channel.");
}
... | php | public function subscribe()
{
if ($this->type == "subscription") {
throw new Exceptions\ChannelException("Already subscribed to this channel.");
}
if (!empty($this->myChannel)) {
throw new Exceptions\ChannelException("Cannot subscribe to own channel.");
}
... | [
"public",
"function",
"subscribe",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"type",
"==",
"\"subscription\"",
")",
"{",
"throw",
"new",
"Exceptions",
"\\",
"ChannelException",
"(",
"\"Already subscribed to this channel.\"",
")",
";",
"}",
"if",
"(",
"!",
... | Subscribe to the channel.
@return Channel Subscription.
@throws Exceptions\ConnectionException
@throws Exceptions\NotFoundException
@throws Exceptions\ChannelException | [
"Subscribe",
"to",
"the",
"channel",
"."
] | 3de4a1732d14e8303a836a0a86a44e280e9cbee2 | https://github.com/ivkos/Pushbullet-for-PHP/blob/3de4a1732d14e8303a836a0a86a44e280e9cbee2/src/Pushbullet/Channel.php#L50-L72 |
190,056 | ivkos/Pushbullet-for-PHP | src/Pushbullet/Channel.php | Channel.unsubscribe | public function unsubscribe()
{
if ($this->type != "subscription") {
throw new Exceptions\ChannelException("The current user is not subscribed to this channel.");
}
Connection::sendCurlRequest(Connection::URL_SUBSCRIPTIONS . '/' . $this->iden, 'DELETE', null, false,
... | php | public function unsubscribe()
{
if ($this->type != "subscription") {
throw new Exceptions\ChannelException("The current user is not subscribed to this channel.");
}
Connection::sendCurlRequest(Connection::URL_SUBSCRIPTIONS . '/' . $this->iden, 'DELETE', null, false,
... | [
"public",
"function",
"unsubscribe",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"type",
"!=",
"\"subscription\"",
")",
"{",
"throw",
"new",
"Exceptions",
"\\",
"ChannelException",
"(",
"\"The current user is not subscribed to this channel.\"",
")",
";",
"}",
"Co... | Unsubscribe from the channel.
@throws Exceptions\ConnectionException
@throws Exceptions\ChannelException Thrown if the user is not subscribed to the channel. | [
"Unsubscribe",
"from",
"the",
"channel",
"."
] | 3de4a1732d14e8303a836a0a86a44e280e9cbee2 | https://github.com/ivkos/Pushbullet-for-PHP/blob/3de4a1732d14e8303a836a0a86a44e280e9cbee2/src/Pushbullet/Channel.php#L80-L88 |
190,057 | ivkos/Pushbullet-for-PHP | src/Pushbullet/Channel.php | Channel.getChannelInformation | public function getChannelInformation()
{
try {
return new Channel(
Connection::sendCurlRequest(Connection::URL_CHANNEL_INFO, 'GET', ['tag' => $this->channelTag], false,
$this->apiKey),
$this->apiKey
);
} catch (Exceptions\C... | php | public function getChannelInformation()
{
try {
return new Channel(
Connection::sendCurlRequest(Connection::URL_CHANNEL_INFO, 'GET', ['tag' => $this->channelTag], false,
$this->apiKey),
$this->apiKey
);
} catch (Exceptions\C... | [
"public",
"function",
"getChannelInformation",
"(",
")",
"{",
"try",
"{",
"return",
"new",
"Channel",
"(",
"Connection",
"::",
"sendCurlRequest",
"(",
"Connection",
"::",
"URL_CHANNEL_INFO",
",",
"'GET'",
",",
"[",
"'tag'",
"=>",
"$",
"this",
"->",
"channelTag... | Get information about the channel.
Guaranteed to always return channel information, whether or not the user is subscribed to it. It is
recommended to access the properties returned by this method, since they are consistent and always refer to
a channel, and not a subscription.
@return Channel Channel object with info... | [
"Get",
"information",
"about",
"the",
"channel",
"."
] | 3de4a1732d14e8303a836a0a86a44e280e9cbee2 | https://github.com/ivkos/Pushbullet-for-PHP/blob/3de4a1732d14e8303a836a0a86a44e280e9cbee2/src/Pushbullet/Channel.php#L101-L116 |
190,058 | garbetjie/wechat-php | src/Service.php | Service.createWritableStream | protected function createWritableStream ($filePath)
{
if (is_resource($filePath)) {
$stream = $filePath;
} elseif (is_string($filePath)) {
$stream = fopen($filePath, 'wb');
if (! $stream) {
throw new InvalidArgumentException("Can't open file `{$fil... | php | protected function createWritableStream ($filePath)
{
if (is_resource($filePath)) {
$stream = $filePath;
} elseif (is_string($filePath)) {
$stream = fopen($filePath, 'wb');
if (! $stream) {
throw new InvalidArgumentException("Can't open file `{$fil... | [
"protected",
"function",
"createWritableStream",
"(",
"$",
"filePath",
")",
"{",
"if",
"(",
"is_resource",
"(",
"$",
"filePath",
")",
")",
"{",
"$",
"stream",
"=",
"$",
"filePath",
";",
"}",
"elseif",
"(",
"is_string",
"(",
"$",
"filePath",
")",
")",
"... | Creates a writable stream that downloaded contents can be stored in.
@param string|null $filePath
@return resource | [
"Creates",
"a",
"writable",
"stream",
"that",
"downloaded",
"contents",
"can",
"be",
"stored",
"in",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Service.php#L31-L45 |
190,059 | ivkos/Pushbullet-for-PHP | src/Pushbullet/Device.php | Device.sendSms | public function sendSms($toNumber, $message)
{
if (empty($this->has_sms)) {
throw new Exceptions\NoSmsException("Device cannot send SMS messages.");
}
$data = [
'type' => 'push',
'push' => [
'type' => 'messaging_extension_rep... | php | public function sendSms($toNumber, $message)
{
if (empty($this->has_sms)) {
throw new Exceptions\NoSmsException("Device cannot send SMS messages.");
}
$data = [
'type' => 'push',
'push' => [
'type' => 'messaging_extension_rep... | [
"public",
"function",
"sendSms",
"(",
"$",
"toNumber",
",",
"$",
"message",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"has_sms",
")",
")",
"{",
"throw",
"new",
"Exceptions",
"\\",
"NoSmsException",
"(",
"\"Device cannot send SMS messages.\"",
")"... | Send an SMS message from the device.
@param string $toNumber Phone number of the recipient.
@param string $message Text of the message.
@return Push
@throws Exceptions\ConnectionException
@throws Exceptions\NoSmsException Thrown if the device cannot send SMS messages. | [
"Send",
"an",
"SMS",
"message",
"from",
"the",
"device",
"."
] | 3de4a1732d14e8303a836a0a86a44e280e9cbee2 | https://github.com/ivkos/Pushbullet-for-PHP/blob/3de4a1732d14e8303a836a0a86a44e280e9cbee2/src/Pushbullet/Device.php#L35-L57 |
190,060 | ivkos/Pushbullet-for-PHP | src/Pushbullet/Device.php | Device.getPhonebook | public function getPhonebook()
{
$entries = Connection::sendCurlRequest(Connection::URL_PHONEBOOK . '_' . $this->iden, 'GET', null, false,
$this->apiKey)->phonebook;
$objEntries = [];
foreach ($entries as $e) {
$objEntries[] = new PhonebookEntry($e, $this);
}... | php | public function getPhonebook()
{
$entries = Connection::sendCurlRequest(Connection::URL_PHONEBOOK . '_' . $this->iden, 'GET', null, false,
$this->apiKey)->phonebook;
$objEntries = [];
foreach ($entries as $e) {
$objEntries[] = new PhonebookEntry($e, $this);
}... | [
"public",
"function",
"getPhonebook",
"(",
")",
"{",
"$",
"entries",
"=",
"Connection",
"::",
"sendCurlRequest",
"(",
"Connection",
"::",
"URL_PHONEBOOK",
".",
"'_'",
".",
"$",
"this",
"->",
"iden",
",",
"'GET'",
",",
"null",
",",
"false",
",",
"$",
"thi... | Get the device's phonebook.
@return PhonebookEntry[] Phonebook entries.
@throws Exceptions\ConnectionException | [
"Get",
"the",
"device",
"s",
"phonebook",
"."
] | 3de4a1732d14e8303a836a0a86a44e280e9cbee2 | https://github.com/ivkos/Pushbullet-for-PHP/blob/3de4a1732d14e8303a836a0a86a44e280e9cbee2/src/Pushbullet/Device.php#L65-L76 |
190,061 | ivkos/Pushbullet-for-PHP | src/Pushbullet/Device.php | Device.delete | public function delete()
{
Connection::sendCurlRequest(Connection::URL_DEVICES . '/' . $this->iden, 'DELETE', null, false,
$this->apiKey);
} | php | public function delete()
{
Connection::sendCurlRequest(Connection::URL_DEVICES . '/' . $this->iden, 'DELETE', null, false,
$this->apiKey);
} | [
"public",
"function",
"delete",
"(",
")",
"{",
"Connection",
"::",
"sendCurlRequest",
"(",
"Connection",
"::",
"URL_DEVICES",
".",
"'/'",
".",
"$",
"this",
"->",
"iden",
",",
"'DELETE'",
",",
"null",
",",
"false",
",",
"$",
"this",
"->",
"apiKey",
")",
... | Delete the device.
@throws Exceptions\ConnectionException | [
"Delete",
"the",
"device",
"."
] | 3de4a1732d14e8303a836a0a86a44e280e9cbee2 | https://github.com/ivkos/Pushbullet-for-PHP/blob/3de4a1732d14e8303a836a0a86a44e280e9cbee2/src/Pushbullet/Device.php#L83-L87 |
190,062 | sanity-io/sanity-php | lib/Transaction.php | Transaction.patch | public function patch($selection, $operations = null)
{
$isPatch = $selection instanceof Patch;
$patch = $isPatch ? $selection : null;
if ($isPatch) {
$this->operations[] = ['patch' => $patch->serialize()];
return $this;
}
if (!is_array($operations))... | php | public function patch($selection, $operations = null)
{
$isPatch = $selection instanceof Patch;
$patch = $isPatch ? $selection : null;
if ($isPatch) {
$this->operations[] = ['patch' => $patch->serialize()];
return $this;
}
if (!is_array($operations))... | [
"public",
"function",
"patch",
"(",
"$",
"selection",
",",
"$",
"operations",
"=",
"null",
")",
"{",
"$",
"isPatch",
"=",
"$",
"selection",
"instanceof",
"Patch",
";",
"$",
"patch",
"=",
"$",
"isPatch",
"?",
"$",
"selection",
":",
"null",
";",
"if",
... | Patch the given document or selection
If a patch is passed as the first argument, it will be used directly.
@param string|array|Selection|Patch $selection Document ID, selection or a patch to apply
@param array $operations Optional array of initial patches
@return Sanity\Patch | [
"Patch",
"the",
"given",
"document",
"or",
"selection"
] | e44d66a1bcea50b28dd9614fbe543b711de89d8b | https://github.com/sanity-io/sanity-php/blob/e44d66a1bcea50b28dd9614fbe543b711de89d8b/lib/Transaction.php#L82-L101 |
190,063 | sanity-io/sanity-php | lib/Client.php | Client.fetch | public function fetch($query, $params = null, $options = [])
{
$unfilteredResponse = isset($options['filterResponse']) && $options['filterResponse'] === false;
$serializedParams = $params ? ParameterSerializer::serialize($params) : [];
$queryParams = array_merge(['query' => $query], $serial... | php | public function fetch($query, $params = null, $options = [])
{
$unfilteredResponse = isset($options['filterResponse']) && $options['filterResponse'] === false;
$serializedParams = $params ? ParameterSerializer::serialize($params) : [];
$queryParams = array_merge(['query' => $query], $serial... | [
"public",
"function",
"fetch",
"(",
"$",
"query",
",",
"$",
"params",
"=",
"null",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"unfilteredResponse",
"=",
"isset",
"(",
"$",
"options",
"[",
"'filterResponse'",
"]",
")",
"&&",
"$",
"options",
"[... | Query for documents
Given a GROQ-query and an optional set of parameters, run a query against the API
and return the decoded result.
@param string $query GROQ-query to send to the API
@param array $params Associative array of parameters to use for the query
@param array $options Optional array of options for the quer... | [
"Query",
"for",
"documents"
] | e44d66a1bcea50b28dd9614fbe543b711de89d8b | https://github.com/sanity-io/sanity-php/blob/e44d66a1bcea50b28dd9614fbe543b711de89d8b/lib/Client.php#L73-L87 |
190,064 | sanity-io/sanity-php | lib/Client.php | Client.getDocument | public function getDocument($id)
{
$body = $this->request([
'url' => '/data/doc/' . $this->clientConfig['dataset'] . '/' . $id,
'cdnAllowed' => true
]);
return $body['documents'][0];
} | php | public function getDocument($id)
{
$body = $this->request([
'url' => '/data/doc/' . $this->clientConfig['dataset'] . '/' . $id,
'cdnAllowed' => true
]);
return $body['documents'][0];
} | [
"public",
"function",
"getDocument",
"(",
"$",
"id",
")",
"{",
"$",
"body",
"=",
"$",
"this",
"->",
"request",
"(",
"[",
"'url'",
"=>",
"'/data/doc/'",
".",
"$",
"this",
"->",
"clientConfig",
"[",
"'dataset'",
"]",
".",
"'/'",
".",
"$",
"id",
",",
... | Fetch a single document by ID
@param string $id ID of the document to retrieve
@return array Returns an associative array | [
"Fetch",
"a",
"single",
"document",
"by",
"ID"
] | e44d66a1bcea50b28dd9614fbe543b711de89d8b | https://github.com/sanity-io/sanity-php/blob/e44d66a1bcea50b28dd9614fbe543b711de89d8b/lib/Client.php#L95-L102 |
190,065 | sanity-io/sanity-php | lib/Client.php | Client.create | public function create($document, $options = null)
{
$this->assertProperties($document, ['_type'], 'create');
return $this->createDocument($document, 'create', $options);
} | php | public function create($document, $options = null)
{
$this->assertProperties($document, ['_type'], 'create');
return $this->createDocument($document, 'create', $options);
} | [
"public",
"function",
"create",
"(",
"$",
"document",
",",
"$",
"options",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"assertProperties",
"(",
"$",
"document",
",",
"[",
"'_type'",
"]",
",",
"'create'",
")",
";",
"return",
"$",
"this",
"->",
"createDocu... | Create a new document in the configured dataset
@param array $document Document to create. Must include a `_type`
@param array $options Optional request options
@return array Returns the created document | [
"Create",
"a",
"new",
"document",
"in",
"the",
"configured",
"dataset"
] | e44d66a1bcea50b28dd9614fbe543b711de89d8b | https://github.com/sanity-io/sanity-php/blob/e44d66a1bcea50b28dd9614fbe543b711de89d8b/lib/Client.php#L111-L115 |
190,066 | sanity-io/sanity-php | lib/Client.php | Client.createIfNotExists | public function createIfNotExists($document, $options = null)
{
$this->assertProperties($document, ['_id', '_type'], 'createIfNotExists');
return $this->createDocument($document, 'createIfNotExists', $options);
} | php | public function createIfNotExists($document, $options = null)
{
$this->assertProperties($document, ['_id', '_type'], 'createIfNotExists');
return $this->createDocument($document, 'createIfNotExists', $options);
} | [
"public",
"function",
"createIfNotExists",
"(",
"$",
"document",
",",
"$",
"options",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"assertProperties",
"(",
"$",
"document",
",",
"[",
"'_id'",
",",
"'_type'",
"]",
",",
"'createIfNotExists'",
")",
";",
"return"... | Create a new document if the document ID does not already exist
@param array $document Document to create. Must include `_id` and `_type`
@param array $options Optional request options
@return array Returns the created document | [
"Create",
"a",
"new",
"document",
"if",
"the",
"document",
"ID",
"does",
"not",
"already",
"exist"
] | e44d66a1bcea50b28dd9614fbe543b711de89d8b | https://github.com/sanity-io/sanity-php/blob/e44d66a1bcea50b28dd9614fbe543b711de89d8b/lib/Client.php#L124-L128 |
190,067 | sanity-io/sanity-php | lib/Client.php | Client.createOrReplace | public function createOrReplace($document, $options = null)
{
$this->assertProperties($document, ['_id', '_type'], 'createOrReplace');
return $this->createDocument($document, 'createOrReplace', $options);
} | php | public function createOrReplace($document, $options = null)
{
$this->assertProperties($document, ['_id', '_type'], 'createOrReplace');
return $this->createDocument($document, 'createOrReplace', $options);
} | [
"public",
"function",
"createOrReplace",
"(",
"$",
"document",
",",
"$",
"options",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"assertProperties",
"(",
"$",
"document",
",",
"[",
"'_id'",
",",
"'_type'",
"]",
",",
"'createOrReplace'",
")",
";",
"return",
... | Create or replace a document with the given ID
@param array $document Document to create. Must include `_id` and `_type`
@param array $options Optional request options
@return array Returns the created document | [
"Create",
"or",
"replace",
"a",
"document",
"with",
"the",
"given",
"ID"
] | e44d66a1bcea50b28dd9614fbe543b711de89d8b | https://github.com/sanity-io/sanity-php/blob/e44d66a1bcea50b28dd9614fbe543b711de89d8b/lib/Client.php#L137-L141 |
190,068 | sanity-io/sanity-php | lib/Client.php | Client.mutate | public function mutate($mutations, $options = null)
{
$mut = $mutations;
if ($mut instanceof Patch) {
$mut = ['patch' => $mut->serialize()];
} elseif ($mut instanceof Transaction) {
$mut = $mut->serialize();
}
$body = ['mutations' => !isset($mut[0]) ?... | php | public function mutate($mutations, $options = null)
{
$mut = $mutations;
if ($mut instanceof Patch) {
$mut = ['patch' => $mut->serialize()];
} elseif ($mut instanceof Transaction) {
$mut = $mut->serialize();
}
$body = ['mutations' => !isset($mut[0]) ?... | [
"public",
"function",
"mutate",
"(",
"$",
"mutations",
",",
"$",
"options",
"=",
"null",
")",
"{",
"$",
"mut",
"=",
"$",
"mutations",
";",
"if",
"(",
"$",
"mut",
"instanceof",
"Patch",
")",
"{",
"$",
"mut",
"=",
"[",
"'patch'",
"=>",
"$",
"mut",
... | Send a set of mutations to the API for processing
@param array|Patch|Transaction $mutations Either an array of mutations, a patch or a transaction
@param array $options Optional array of options for the request
@return array Mutation result | [
"Send",
"a",
"set",
"of",
"mutations",
"to",
"the",
"API",
"for",
"processing"
] | e44d66a1bcea50b28dd9614fbe543b711de89d8b | https://github.com/sanity-io/sanity-php/blob/e44d66a1bcea50b28dd9614fbe543b711de89d8b/lib/Client.php#L187-L233 |
190,069 | sanity-io/sanity-php | lib/Client.php | Client.config | public function config($newConfig = null)
{
if ($newConfig === null) {
return $this->clientConfig;
}
$this->clientConfig = $this->initConfig($newConfig);
$this->httpClient = new HttpClient([
'base_uri' => $this->clientConfig['url'],
'timeout' => ... | php | public function config($newConfig = null)
{
if ($newConfig === null) {
return $this->clientConfig;
}
$this->clientConfig = $this->initConfig($newConfig);
$this->httpClient = new HttpClient([
'base_uri' => $this->clientConfig['url'],
'timeout' => ... | [
"public",
"function",
"config",
"(",
"$",
"newConfig",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"newConfig",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"clientConfig",
";",
"}",
"$",
"this",
"->",
"clientConfig",
"=",
"$",
"this",
"->",
"ini... | Sets or gets the client configuration.
If a new configuration is passed as the first argument, it will be merged
with the existing configuration. If no new configuration is given, the old
configuration is returned.
@param array|null $newConfig New configuration to use.
@return array|Client Returns the client instance... | [
"Sets",
"or",
"gets",
"the",
"client",
"configuration",
"."
] | e44d66a1bcea50b28dd9614fbe543b711de89d8b | https://github.com/sanity-io/sanity-php/blob/e44d66a1bcea50b28dd9614fbe543b711de89d8b/lib/Client.php#L245-L260 |
190,070 | sanity-io/sanity-php | lib/Client.php | Client.request | public function request($options)
{
$request = $this->getRequest($options);
$requestOptions = isset($options['query']) ? ['query' => $options['query']] : [];
// Try to perform request
try {
$response = $this->httpClient->send($request, $requestOptions);
} catch (... | php | public function request($options)
{
$request = $this->getRequest($options);
$requestOptions = isset($options['query']) ? ['query' => $options['query']] : [];
// Try to perform request
try {
$response = $this->httpClient->send($request, $requestOptions);
} catch (... | [
"public",
"function",
"request",
"(",
"$",
"options",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"getRequest",
"(",
"$",
"options",
")",
";",
"$",
"requestOptions",
"=",
"isset",
"(",
"$",
"options",
"[",
"'query'",
"]",
")",
"?",
"[",
"'query... | Performs a request against the Sanity API based on the passed options.
@param array $options Array of options for this request.
@return mixed Returns a decoded response, type varies with endpoint. | [
"Performs",
"a",
"request",
"against",
"the",
"Sanity",
"API",
"based",
"on",
"the",
"passed",
"options",
"."
] | e44d66a1bcea50b28dd9614fbe543b711de89d8b | https://github.com/sanity-io/sanity-php/blob/e44d66a1bcea50b28dd9614fbe543b711de89d8b/lib/Client.php#L268-L299 |
190,071 | sanity-io/sanity-php | lib/Client.php | Client.createDocument | private function createDocument($document, $operation, $options = [])
{
$mutation = [$operation => $document];
$opts = array_replace(['returnFirst' => true, 'returnDocuments' => true], $options ?: []);
return $this->mutate([$mutation], $opts);
} | php | private function createDocument($document, $operation, $options = [])
{
$mutation = [$operation => $document];
$opts = array_replace(['returnFirst' => true, 'returnDocuments' => true], $options ?: []);
return $this->mutate([$mutation], $opts);
} | [
"private",
"function",
"createDocument",
"(",
"$",
"document",
",",
"$",
"operation",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"mutation",
"=",
"[",
"$",
"operation",
"=>",
"$",
"document",
"]",
";",
"$",
"opts",
"=",
"array_replace",
"(",
... | Creates a document using the given operation type
@param array $document Document to create
@param string $operation Operation to use (create/createIfNotExists/createOrReplace)
@param array $options
@return array Returns the created document, or the mutation result if returnDocuments is false | [
"Creates",
"a",
"document",
"using",
"the",
"given",
"operation",
"type"
] | e44d66a1bcea50b28dd9614fbe543b711de89d8b | https://github.com/sanity-io/sanity-php/blob/e44d66a1bcea50b28dd9614fbe543b711de89d8b/lib/Client.php#L309-L314 |
190,072 | sanity-io/sanity-php | lib/Client.php | Client.getRequest | private function getRequest($options)
{
$headers = isset($options['headers']) ? $options['headers'] : [];
$headers['User-Agent'] = 'sanity-php ' . Version::VERSION;
if (!empty($this->clientConfig['token'])) {
$headers['Authorization'] = 'Bearer ' . $this->clientConfig['token'];
... | php | private function getRequest($options)
{
$headers = isset($options['headers']) ? $options['headers'] : [];
$headers['User-Agent'] = 'sanity-php ' . Version::VERSION;
if (!empty($this->clientConfig['token'])) {
$headers['Authorization'] = 'Bearer ' . $this->clientConfig['token'];
... | [
"private",
"function",
"getRequest",
"(",
"$",
"options",
")",
"{",
"$",
"headers",
"=",
"isset",
"(",
"$",
"options",
"[",
"'headers'",
"]",
")",
"?",
"$",
"options",
"[",
"'headers'",
"]",
":",
"[",
"]",
";",
"$",
"headers",
"[",
"'User-Agent'",
"]... | Returns an instance of Request based on the given options and client configuration.
@param array $options Array of options for this request.
@return GuzzleHttp\Psr7\Request Returns an initialized request. | [
"Returns",
"an",
"instance",
"of",
"Request",
"based",
"on",
"the",
"given",
"options",
"and",
"client",
"configuration",
"."
] | e44d66a1bcea50b28dd9614fbe543b711de89d8b | https://github.com/sanity-io/sanity-php/blob/e44d66a1bcea50b28dd9614fbe543b711de89d8b/lib/Client.php#L322-L346 |
190,073 | sanity-io/sanity-php | lib/Client.php | Client.initConfig | private function initConfig($config)
{
$specifiedConfig = array_replace_recursive($this->clientConfig, $config);
if (!isset($specifiedConfig['apiVersion'])) {
trigger_error(Client::NO_API_VERSION_WARNING, E_USER_DEPRECATED);
}
$newConfig = array_replace_recursive($this->... | php | private function initConfig($config)
{
$specifiedConfig = array_replace_recursive($this->clientConfig, $config);
if (!isset($specifiedConfig['apiVersion'])) {
trigger_error(Client::NO_API_VERSION_WARNING, E_USER_DEPRECATED);
}
$newConfig = array_replace_recursive($this->... | [
"private",
"function",
"initConfig",
"(",
"$",
"config",
")",
"{",
"$",
"specifiedConfig",
"=",
"array_replace_recursive",
"(",
"$",
"this",
"->",
"clientConfig",
",",
"$",
"config",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"specifiedConfig",
"[",
"'ap... | Initialize a new client configuration
Validate a configuration, merging default values and assigning the
correct hostname based on project ID.
@param array $config New configuration parameters to use.
@return array Returns the new configuration. | [
"Initialize",
"a",
"new",
"client",
"configuration"
] | e44d66a1bcea50b28dd9614fbe543b711de89d8b | https://github.com/sanity-io/sanity-php/blob/e44d66a1bcea50b28dd9614fbe543b711de89d8b/lib/Client.php#L357-L426 |
190,074 | sanity-io/sanity-php | lib/Client.php | Client.getMutationQueryParams | private function getMutationQueryParams($options = [])
{
$query = ['returnIds' => 'true'];
if (!isset($options['returnDocuments']) || $options['returnDocuments']) {
$query['returnDocuments'] = 'true';
}
if (isset($options['visibility']) && $options['visibility'] !== 'sy... | php | private function getMutationQueryParams($options = [])
{
$query = ['returnIds' => 'true'];
if (!isset($options['returnDocuments']) || $options['returnDocuments']) {
$query['returnDocuments'] = 'true';
}
if (isset($options['visibility']) && $options['visibility'] !== 'sy... | [
"private",
"function",
"getMutationQueryParams",
"(",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"query",
"=",
"[",
"'returnIds'",
"=>",
"'true'",
"]",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"options",
"[",
"'returnDocuments'",
"]",
")",
"||",
"$",... | Get a reduced and normalized set of query params for a mutation based on the given options
@param array $options Array of request options
@return array Array of normalized query params | [
"Get",
"a",
"reduced",
"and",
"normalized",
"set",
"of",
"query",
"params",
"for",
"a",
"mutation",
"based",
"on",
"the",
"given",
"options"
] | e44d66a1bcea50b28dd9614fbe543b711de89d8b | https://github.com/sanity-io/sanity-php/blob/e44d66a1bcea50b28dd9614fbe543b711de89d8b/lib/Client.php#L434-L447 |
190,075 | peterpetrus/passport-token | src/PassportToken.php | PassportToken.dirtyDecode | public static function dirtyDecode($access_token, $claims = [])
{
$now = time();
$expecting = false;
$incorrect = false;
$expired = false;
$error = false;
$errors = array();
$decodedToken = array();
$token_segments = explode('.', $access_token);
... | php | public static function dirtyDecode($access_token, $claims = [])
{
$now = time();
$expecting = false;
$incorrect = false;
$expired = false;
$error = false;
$errors = array();
$decodedToken = array();
$token_segments = explode('.', $access_token);
... | [
"public",
"static",
"function",
"dirtyDecode",
"(",
"$",
"access_token",
",",
"$",
"claims",
"=",
"[",
"]",
")",
"{",
"$",
"now",
"=",
"time",
"(",
")",
";",
"$",
"expecting",
"=",
"false",
";",
"$",
"incorrect",
"=",
"false",
";",
"$",
"expired",
... | Decode a Access Token
@param string $access_token Access Token
@return array | [
"Decode",
"a",
"Access",
"Token"
] | 356658576793991e2eb400edc049d7508fa9d33f | https://github.com/peterpetrus/passport-token/blob/356658576793991e2eb400edc049d7508fa9d33f/src/PassportToken.php#L93-L145 |
190,076 | evert/google-api-php-client | src/GoogleApi/Auth/OAuth2.php | OAuth2.sign | public function sign(HttpRequest $request) {
// add the developer key to the request before signing it
if ($this->developerKey) {
$requestUrl = $request->getUrl();
$requestUrl .= (strpos($request->getUrl(), '?') === false) ? '?' : '&';
$requestUrl .= 'key=' . urlencode($this->developerKey);
... | php | public function sign(HttpRequest $request) {
// add the developer key to the request before signing it
if ($this->developerKey) {
$requestUrl = $request->getUrl();
$requestUrl .= (strpos($request->getUrl(), '?') === false) ? '?' : '&';
$requestUrl .= 'key=' . urlencode($this->developerKey);
... | [
"public",
"function",
"sign",
"(",
"HttpRequest",
"$",
"request",
")",
"{",
"// add the developer key to the request before signing it",
"if",
"(",
"$",
"this",
"->",
"developerKey",
")",
"{",
"$",
"requestUrl",
"=",
"$",
"request",
"->",
"getUrl",
"(",
")",
";"... | Include an accessToken in a given HttpRequest.
@param HttpRequest $request
@return HttpRequest
@throws Exception | [
"Include",
"an",
"accessToken",
"in",
"a",
"given",
"HttpRequest",
"."
] | 6522ef6b9b089eddf66ef6081db639430da317dc | https://github.com/evert/google-api-php-client/blob/6522ef6b9b089eddf66ef6081db639430da317dc/src/GoogleApi/Auth/OAuth2.php#L187-L225 |
190,077 | sanity-io/sanity-php | lib/Selection.php | Selection.normalize | private function normalize($selection)
{
if (isset($selection['query'])) {
return ['query' => $selection['query']];
}
if (is_string($selection) || (is_array($selection) && isset($selection[0]))) {
return ['id' => $selection];
}
$selectionOpts = implo... | php | private function normalize($selection)
{
if (isset($selection['query'])) {
return ['query' => $selection['query']];
}
if (is_string($selection) || (is_array($selection) && isset($selection[0]))) {
return ['id' => $selection];
}
$selectionOpts = implo... | [
"private",
"function",
"normalize",
"(",
"$",
"selection",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"selection",
"[",
"'query'",
"]",
")",
")",
"{",
"return",
"[",
"'query'",
"=>",
"$",
"selection",
"[",
"'query'",
"]",
"]",
";",
"}",
"if",
"(",
"is... | Validates and normalizes a selection
@return array
@throws InvalidArgumentException | [
"Validates",
"and",
"normalizes",
"a",
"selection"
] | e44d66a1bcea50b28dd9614fbe543b711de89d8b | https://github.com/sanity-io/sanity-php/blob/e44d66a1bcea50b28dd9614fbe543b711de89d8b/lib/Selection.php#L57-L75 |
190,078 | demisang/yii2-cropper | Cropper.php | Cropper.registerClientScript | public function registerClientScript()
{
$view = $this->getView();
// Register jQuery image cropping js and css files
CropperAsset::register($view);
// Additional plugin options
$options = Json::encode($this->pluginOptions);
$selector = "#$this->id .crop-image-contai... | php | public function registerClientScript()
{
$view = $this->getView();
// Register jQuery image cropping js and css files
CropperAsset::register($view);
// Additional plugin options
$options = Json::encode($this->pluginOptions);
$selector = "#$this->id .crop-image-contai... | [
"public",
"function",
"registerClientScript",
"(",
")",
"{",
"$",
"view",
"=",
"$",
"this",
"->",
"getView",
"(",
")",
";",
"// Register jQuery image cropping js and css files",
"CropperAsset",
"::",
"register",
"(",
"$",
"view",
")",
";",
"// Additional plugin opti... | Registers required script for the plugin to work as jQuery image cropping | [
"Registers",
"required",
"script",
"for",
"the",
"plugin",
"to",
"work",
"as",
"jQuery",
"image",
"cropping"
] | 561ccc304f44d57f882c835949dd9cfce01af22e | https://github.com/demisang/yii2-cropper/blob/561ccc304f44d57f882c835949dd9cfce01af22e/Cropper.php#L140-L204 |
190,079 | sanity-io/sanity-php | lib/Patch.php | Patch.validateInsert | private function validateInsert($at, $selector, $items)
{
$insertLocations = ['before', 'after', 'replace'];
$signature = 'insert(at, selector, items)';
$index = array_search($at, $insertLocations);
if ($index === false) {
$valid = implode(', ', array_map(function ($loc)... | php | private function validateInsert($at, $selector, $items)
{
$insertLocations = ['before', 'after', 'replace'];
$signature = 'insert(at, selector, items)';
$index = array_search($at, $insertLocations);
if ($index === false) {
$valid = implode(', ', array_map(function ($loc)... | [
"private",
"function",
"validateInsert",
"(",
"$",
"at",
",",
"$",
"selector",
",",
"$",
"items",
")",
"{",
"$",
"insertLocations",
"=",
"[",
"'before'",
",",
"'after'",
",",
"'replace'",
"]",
";",
"$",
"signature",
"=",
"'insert(at, selector, items)'",
";",... | Validates parameters for an insert operation
@param string $at Location at which to insert
@param string $selector Selector to match at
@param array $items Array items to insert
@throws InvalidArgumentException | [
"Validates",
"parameters",
"for",
"an",
"insert",
"operation"
] | e44d66a1bcea50b28dd9614fbe543b711de89d8b | https://github.com/sanity-io/sanity-php/blob/e44d66a1bcea50b28dd9614fbe543b711de89d8b/lib/Patch.php#L156-L176 |
190,080 | sanity-io/sanity-php | lib/Util/DocumentPropertyAsserter.php | DocumentPropertyAsserter.assertProperties | private function assertProperties($doc, $required, $method)
{
$keys = array_keys($doc);
$diff = array_diff($required, $keys);
if (empty($diff)) {
return;
}
$err = $method . ': the following required properties are missing: ';
$err .= implode(', ', $diff)... | php | private function assertProperties($doc, $required, $method)
{
$keys = array_keys($doc);
$diff = array_diff($required, $keys);
if (empty($diff)) {
return;
}
$err = $method . ': the following required properties are missing: ';
$err .= implode(', ', $diff)... | [
"private",
"function",
"assertProperties",
"(",
"$",
"doc",
",",
"$",
"required",
",",
"$",
"method",
")",
"{",
"$",
"keys",
"=",
"array_keys",
"(",
"$",
"doc",
")",
";",
"$",
"diff",
"=",
"array_diff",
"(",
"$",
"required",
",",
"$",
"keys",
")",
... | Assert that the given document contains the required properties
@param array $doc Document to validate
@param array $required Array of properties to assert existence of
@param string $method Method which require the properties
@throws InvalidArgumentException | [
"Assert",
"that",
"the",
"given",
"document",
"contains",
"the",
"required",
"properties"
] | e44d66a1bcea50b28dd9614fbe543b711de89d8b | https://github.com/sanity-io/sanity-php/blob/e44d66a1bcea50b28dd9614fbe543b711de89d8b/lib/Util/DocumentPropertyAsserter.php#L16-L28 |
190,081 | evert/google-api-php-client | src/GoogleApi/Contrib/apiPredictionService.php | TrainedmodelsServiceResource.listModels | public function listModels($optParams = array()) {
$data = $this->__call('list', array($optParams));
if ($this->useObjects()) {
return new ListModel($data);
} else {
return $data;
}
} | php | public function listModels($optParams = array()) {
$data = $this->__call('list', array($optParams));
if ($this->useObjects()) {
return new ListModel($data);
} else {
return $data;
}
} | [
"public",
"function",
"listModels",
"(",
"$",
"optParams",
"=",
"array",
"(",
")",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"__call",
"(",
"'list'",
",",
"array",
"(",
"$",
"optParams",
")",
")",
";",
"if",
"(",
"$",
"this",
"->",
"useObjects... | Executes "list" api method. list is a php saved keyword and therefore it can't be used as method name
@param array $optParams | [
"Executes",
"list",
"api",
"method",
".",
"list",
"is",
"a",
"php",
"saved",
"keyword",
"and",
"therefore",
"it",
"can",
"t",
"be",
"used",
"as",
"method",
"name"
] | 6522ef6b9b089eddf66ef6081db639430da317dc | https://github.com/evert/google-api-php-client/blob/6522ef6b9b089eddf66ef6081db639430da317dc/src/GoogleApi/Contrib/apiPredictionService.php#L119-L127 |
190,082 | silverstripe/silverstripe-elemental-bannerblock | src/Form/BlockLinkField.php | BlockLinkField.getAttributes | public function getAttributes()
{
$attributes = parent::getAttributes();
$attributes['data-schema'] = json_encode($this->getSchemaData());
$attributes['data-state'] = json_encode($this->getSchemaState());
return $attributes;
} | php | public function getAttributes()
{
$attributes = parent::getAttributes();
$attributes['data-schema'] = json_encode($this->getSchemaData());
$attributes['data-state'] = json_encode($this->getSchemaState());
return $attributes;
} | [
"public",
"function",
"getAttributes",
"(",
")",
"{",
"$",
"attributes",
"=",
"parent",
"::",
"getAttributes",
"(",
")",
";",
"$",
"attributes",
"[",
"'data-schema'",
"]",
"=",
"json_encode",
"(",
"$",
"this",
"->",
"getSchemaData",
"(",
")",
")",
";",
"... | When not used in a React form factory context, this adds the schema and state data to SilverStripe
template rendered attributes lists
@return array | [
"When",
"not",
"used",
"in",
"a",
"React",
"form",
"factory",
"context",
"this",
"adds",
"the",
"schema",
"and",
"state",
"data",
"to",
"SilverStripe",
"template",
"rendered",
"attributes",
"lists"
] | 1f50b5caf08e5fe8d60a2e8e16b9c1936e3dd574 | https://github.com/silverstripe/silverstripe-elemental-bannerblock/blob/1f50b5caf08e5fe8d60a2e8e16b9c1936e3dd574/src/Form/BlockLinkField.php#L115-L123 |
190,083 | silverstripe/silverstripe-elemental-bannerblock | src/Form/BlockLinkField.php | BlockLinkField.getSchemaDataDefaults | public function getSchemaDataDefaults()
{
$schema = parent::getSchemaDataDefaults();
$schema['data'] = array_merge($schema['data'], [
'showLinkText' => $this->getShowLinkText(),
'linkedPage' => $this->getLinkPage() ? $this->getLinkPage()->toMap() : [],
'title' => ... | php | public function getSchemaDataDefaults()
{
$schema = parent::getSchemaDataDefaults();
$schema['data'] = array_merge($schema['data'], [
'showLinkText' => $this->getShowLinkText(),
'linkedPage' => $this->getLinkPage() ? $this->getLinkPage()->toMap() : [],
'title' => ... | [
"public",
"function",
"getSchemaDataDefaults",
"(",
")",
"{",
"$",
"schema",
"=",
"parent",
"::",
"getSchemaDataDefaults",
"(",
")",
";",
"$",
"schema",
"[",
"'data'",
"]",
"=",
"array_merge",
"(",
"$",
"schema",
"[",
"'data'",
"]",
",",
"[",
"'showLinkTex... | Add some extra props for the React component to work with
{@inheritDoc} | [
"Add",
"some",
"extra",
"props",
"for",
"the",
"React",
"component",
"to",
"work",
"with"
] | 1f50b5caf08e5fe8d60a2e8e16b9c1936e3dd574 | https://github.com/silverstripe/silverstripe-elemental-bannerblock/blob/1f50b5caf08e5fe8d60a2e8e16b9c1936e3dd574/src/Form/BlockLinkField.php#L130-L139 |
190,084 | bupy7/yii2-widget-cropbox | src/CropboxWidget.php | CropboxWidget.configuration | protected function configuration()
{
$this->options = array_merge(['accept' => 'image/*'], $this->options);
$croppedDataInput = $this->croppedDataAttribute;
if ($this->hasModel()) {
$croppedDataInput = Html::getInputName($this->model, $croppedDataInput);
} else {
... | php | protected function configuration()
{
$this->options = array_merge(['accept' => 'image/*'], $this->options);
$croppedDataInput = $this->croppedDataAttribute;
if ($this->hasModel()) {
$croppedDataInput = Html::getInputName($this->model, $croppedDataInput);
} else {
... | [
"protected",
"function",
"configuration",
"(",
")",
"{",
"$",
"this",
"->",
"options",
"=",
"array_merge",
"(",
"[",
"'accept'",
"=>",
"'image/*'",
"]",
",",
"$",
"this",
"->",
"options",
")",
";",
"$",
"croppedDataInput",
"=",
"$",
"this",
"->",
"croppe... | Configuration the widget. | [
"Configuration",
"the",
"widget",
"."
] | d17b7dbb9e4725a273da83f5c567fe27a8a090bc | https://github.com/bupy7/yii2-widget-cropbox/blob/d17b7dbb9e4725a273da83f5c567fe27a8a090bc/src/CropboxWidget.php#L115-L136 |
190,085 | alexandresalome/mailcatcher | Behat/MailCatcherContext.php | MailCatcherContext.findMail | protected function findMail($type, $value)
{
$criterias = array($type => $value);
$message = $this->getMailCatcherClient()->searchOne($criterias);
if (null === $message) {
throw new \InvalidArgumentException(sprintf('Unable to find a message with criterias "%s".', json_encode($... | php | protected function findMail($type, $value)
{
$criterias = array($type => $value);
$message = $this->getMailCatcherClient()->searchOne($criterias);
if (null === $message) {
throw new \InvalidArgumentException(sprintf('Unable to find a message with criterias "%s".', json_encode($... | [
"protected",
"function",
"findMail",
"(",
"$",
"type",
",",
"$",
"value",
")",
"{",
"$",
"criterias",
"=",
"array",
"(",
"$",
"type",
"=>",
"$",
"value",
")",
";",
"$",
"message",
"=",
"$",
"this",
"->",
"getMailCatcherClient",
"(",
")",
"->",
"searc... | This method is duplicated from MailCatcherTrait, for support in PHP 5.3
@return Message | [
"This",
"method",
"is",
"duplicated",
"from",
"MailCatcherTrait",
"for",
"support",
"in",
"PHP",
"5",
".",
"3"
] | 7c7a5a2ce14252a3e772ab637bbaca5e3367afb0 | https://github.com/alexandresalome/mailcatcher/blob/7c7a5a2ce14252a3e772ab637bbaca5e3367afb0/Behat/MailCatcherContext.php#L250-L261 |
190,086 | alexandresalome/mailcatcher | Client.php | Client.searchOne | public function searchOne(array $criterias = array())
{
$results = $this->search($criterias, 1);
if (count($results) !== 1) {
return null;
}
return $results[0];
} | php | public function searchOne(array $criterias = array())
{
$results = $this->search($criterias, 1);
if (count($results) !== 1) {
return null;
}
return $results[0];
} | [
"public",
"function",
"searchOne",
"(",
"array",
"$",
"criterias",
"=",
"array",
"(",
")",
")",
"{",
"$",
"results",
"=",
"$",
"this",
"->",
"search",
"(",
"$",
"criterias",
",",
"1",
")",
";",
"if",
"(",
"count",
"(",
"$",
"results",
")",
"!==",
... | Searches for one messages on the server.
See method `Message::match` method for more informations on criterias.
@param array $criterias
@return Message|null | [
"Searches",
"for",
"one",
"messages",
"on",
"the",
"server",
"."
] | 7c7a5a2ce14252a3e772ab637bbaca5e3367afb0 | https://github.com/alexandresalome/mailcatcher/blob/7c7a5a2ce14252a3e772ab637bbaca5e3367afb0/Client.php#L72-L81 |
190,087 | alexandresalome/mailcatcher | Client.php | Client.search | public function search(array $criterias = array(), $limit = null)
{
$messages = array();
foreach ($this->request('GET') as $message) {
if (isset($this->messages[$message['id']])) {
$messages[] = $this->messages[$message['id']];
} else {
$messa... | php | public function search(array $criterias = array(), $limit = null)
{
$messages = array();
foreach ($this->request('GET') as $message) {
if (isset($this->messages[$message['id']])) {
$messages[] = $this->messages[$message['id']];
} else {
$messa... | [
"public",
"function",
"search",
"(",
"array",
"$",
"criterias",
"=",
"array",
"(",
")",
",",
"$",
"limit",
"=",
"null",
")",
"{",
"$",
"messages",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"request",
"(",
"'GET'",
")",
"as",
... | Searches for messages on the server.
See method `Method::match` for more informations on criterias.
@param array $criterias an array of criterias
@param int $limit maximum number of elements to fetch. Null means no limit
@return array a list of messages | [
"Searches",
"for",
"messages",
"on",
"the",
"server",
"."
] | 7c7a5a2ce14252a3e772ab637bbaca5e3367afb0 | https://github.com/alexandresalome/mailcatcher/blob/7c7a5a2ce14252a3e772ab637bbaca5e3367afb0/Client.php#L93-L116 |
190,088 | alexandresalome/mailcatcher | Client.php | Client.request | public function request($method, $path = null, $parameters = array())
{
if (null === $path) {
$url = '/messages';
} else {
$url = '/messages/'.$path;
}
return json_decode($this->requestRaw($method, $url, $parameters), true);
} | php | public function request($method, $path = null, $parameters = array())
{
if (null === $path) {
$url = '/messages';
} else {
$url = '/messages/'.$path;
}
return json_decode($this->requestRaw($method, $url, $parameters), true);
} | [
"public",
"function",
"request",
"(",
"$",
"method",
",",
"$",
"path",
"=",
"null",
",",
"$",
"parameters",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"path",
")",
"{",
"$",
"url",
"=",
"'/messages'",
";",
"}",
"else",
"{",
... | Request the API of MailCatcher.
@param string $method HTTP method to use (POST, PUT, GET, DELETE)
@param string $path relative path from '/messages' (ex: null, '132.json')
@param array $parameters parameters to POST
@return string response body | [
"Request",
"the",
"API",
"of",
"MailCatcher",
"."
] | 7c7a5a2ce14252a3e772ab637bbaca5e3367afb0 | https://github.com/alexandresalome/mailcatcher/blob/7c7a5a2ce14252a3e772ab637bbaca5e3367afb0/Client.php#L127-L136 |
190,089 | alexandresalome/mailcatcher | Client.php | Client.requestRaw | public function requestRaw($method, $url, $parameters = array())
{
$url = $this->url.$url;
if (false === $curl = curl_init()) {
throw new \RuntimeException('Unable to create a new cURL handle');
}
$options = array(
CURLOPT_RETURNTRANSFER => true,
... | php | public function requestRaw($method, $url, $parameters = array())
{
$url = $this->url.$url;
if (false === $curl = curl_init()) {
throw new \RuntimeException('Unable to create a new cURL handle');
}
$options = array(
CURLOPT_RETURNTRANSFER => true,
... | [
"public",
"function",
"requestRaw",
"(",
"$",
"method",
",",
"$",
"url",
",",
"$",
"parameters",
"=",
"array",
"(",
")",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"url",
".",
"$",
"url",
";",
"if",
"(",
"false",
"===",
"$",
"curl",
"=",
"cu... | Raw method to request the API of MailCatcher.
@param string $method HTTP method
@param string $url absolute URL on server (`/messages/132.json`)
@param array $parameters parameters to POST
@return string response body
@throws \RuntimeException | [
"Raw",
"method",
"to",
"request",
"the",
"API",
"of",
"MailCatcher",
"."
] | 7c7a5a2ce14252a3e772ab637bbaca5e3367afb0 | https://github.com/alexandresalome/mailcatcher/blob/7c7a5a2ce14252a3e772ab637bbaca5e3367afb0/Client.php#L148-L202 |
190,090 | alexandresalome/mailcatcher | Attachment.php | Attachment.loadFromArray | public function loadFromArray(array $array)
{
if (isset($array['filename'])) {
$this->filename = $array['filename'];
}
if (isset($array['size'])) {
$this->size = $array['size'];
}
if (isset($array['type'])) {
$this->type = $array['type'];... | php | public function loadFromArray(array $array)
{
if (isset($array['filename'])) {
$this->filename = $array['filename'];
}
if (isset($array['size'])) {
$this->size = $array['size'];
}
if (isset($array['type'])) {
$this->type = $array['type'];... | [
"public",
"function",
"loadFromArray",
"(",
"array",
"$",
"array",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"array",
"[",
"'filename'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"filename",
"=",
"$",
"array",
"[",
"'filename'",
"]",
";",
"}",
"if",
"("... | Loads data into the Attachment from an array.
@param array $array
@return Attachment | [
"Loads",
"data",
"into",
"the",
"Attachment",
"from",
"an",
"array",
"."
] | 7c7a5a2ce14252a3e772ab637bbaca5e3367afb0 | https://github.com/alexandresalome/mailcatcher/blob/7c7a5a2ce14252a3e772ab637bbaca5e3367afb0/Attachment.php#L72-L95 |
190,091 | alexandresalome/mailcatcher | Attachment.php | Attachment.getContent | public function getContent()
{
if (null === $this->content) {
$this->content = $this->client->requestRaw('GET', $this->href);
}
return $this->content;
} | php | public function getContent()
{
if (null === $this->content) {
$this->content = $this->client->requestRaw('GET', $this->href);
}
return $this->content;
} | [
"public",
"function",
"getContent",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"content",
")",
"{",
"$",
"this",
"->",
"content",
"=",
"$",
"this",
"->",
"client",
"->",
"requestRaw",
"(",
"'GET'",
",",
"$",
"this",
"->",
"href",
"... | Returns content, raw format.
@return string | [
"Returns",
"content",
"raw",
"format",
"."
] | 7c7a5a2ce14252a3e772ab637bbaca5e3367afb0 | https://github.com/alexandresalome/mailcatcher/blob/7c7a5a2ce14252a3e772ab637bbaca5e3367afb0/Attachment.php#L152-L159 |
190,092 | alexandresalome/mailcatcher | Mime/Part.php | Part.loadSource | public function loadSource($source)
{
$parser = new Parser();
list($this->headers, $this->content) = $parser->parsePart($source);
} | php | public function loadSource($source)
{
$parser = new Parser();
list($this->headers, $this->content) = $parser->parsePart($source);
} | [
"public",
"function",
"loadSource",
"(",
"$",
"source",
")",
"{",
"$",
"parser",
"=",
"new",
"Parser",
"(",
")",
";",
"list",
"(",
"$",
"this",
"->",
"headers",
",",
"$",
"this",
"->",
"content",
")",
"=",
"$",
"parser",
"->",
"parsePart",
"(",
"$"... | Load source part.
@param $source | [
"Load",
"source",
"part",
"."
] | 7c7a5a2ce14252a3e772ab637bbaca5e3367afb0 | https://github.com/alexandresalome/mailcatcher/blob/7c7a5a2ce14252a3e772ab637bbaca5e3367afb0/Mime/Part.php#L24-L29 |
190,093 | muesli/huephp | src/Hue.php | Hue.register | public function register()
{
$pest = new Pest( "http://" . $this->bridge . "/api" );
$data = json_encode( array( 'devicetype' => 'phpHue' ) );
$result = $pest->post( '', $data );
return $result;
} | php | public function register()
{
$pest = new Pest( "http://" . $this->bridge . "/api" );
$data = json_encode( array( 'devicetype' => 'phpHue' ) );
$result = $pest->post( '', $data );
return $result;
} | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"pest",
"=",
"new",
"Pest",
"(",
"\"http://\"",
".",
"$",
"this",
"->",
"bridge",
".",
"\"/api\"",
")",
";",
"$",
"data",
"=",
"json_encode",
"(",
"array",
"(",
"'devicetype'",
"=>",
"'phpHue'",
")"... | Registers with a Hue hub | [
"Registers",
"with",
"a",
"Hue",
"hub"
] | 364e400eabb62777c10d42f5e53cf4c1f65a6728 | https://github.com/muesli/huephp/blob/364e400eabb62777c10d42f5e53cf4c1f65a6728/src/Hue.php#L51-L58 |
190,094 | muesli/huephp | src/Hue.php | Hue.lightIds | public function lightIds()
{
$result = json_decode( $this->pest()->get( 'lights' ), true );
$targets = array_keys( $result );
return $targets;
} | php | public function lightIds()
{
$result = json_decode( $this->pest()->get( 'lights' ), true );
$targets = array_keys( $result );
return $targets;
} | [
"public",
"function",
"lightIds",
"(",
")",
"{",
"$",
"result",
"=",
"json_decode",
"(",
"$",
"this",
"->",
"pest",
"(",
")",
"->",
"get",
"(",
"'lights'",
")",
",",
"true",
")",
";",
"$",
"targets",
"=",
"array_keys",
"(",
"$",
"result",
")",
";",... | Returns an array of the light numbers in the system | [
"Returns",
"an",
"array",
"of",
"the",
"light",
"numbers",
"in",
"the",
"system"
] | 364e400eabb62777c10d42f5e53cf4c1f65a6728 | https://github.com/muesli/huephp/blob/364e400eabb62777c10d42f5e53cf4c1f65a6728/src/Hue.php#L79-L85 |
190,095 | muesli/huephp | src/Hue.php | Hue.predefinedColors | public function predefinedColors( $colorname )
{
$command = array();
switch ($colorname) {
case "green":
$command['hue'] = 182 * 140;
$command['sat'] = 254;
$command['bri'] = 254;
break;
case "red":
... | php | public function predefinedColors( $colorname )
{
$command = array();
switch ($colorname) {
case "green":
$command['hue'] = 182 * 140;
$command['sat'] = 254;
$command['bri'] = 254;
break;
case "red":
... | [
"public",
"function",
"predefinedColors",
"(",
"$",
"colorname",
")",
"{",
"$",
"command",
"=",
"array",
"(",
")",
";",
"switch",
"(",
"$",
"colorname",
")",
"{",
"case",
"\"green\"",
":",
"$",
"command",
"[",
"'hue'",
"]",
"=",
"182",
"*",
"140",
";... | Build a few color commands based on color names | [
"Build",
"a",
"few",
"color",
"commands",
"based",
"on",
"color",
"names"
] | 364e400eabb62777c10d42f5e53cf4c1f65a6728 | https://github.com/muesli/huephp/blob/364e400eabb62777c10d42f5e53cf4c1f65a6728/src/Hue.php#L129-L187 |
190,096 | muesli/huephp | src/Light.php | Light.setAlert | public function setAlert( $type = 'select' )
{
$data = json_encode( array( "alert" => $type ) );
$this->parent->pest()->put( "lights/" . $this->id . "/state", $data );
$this->parent->update( $this->id );
} | php | public function setAlert( $type = 'select' )
{
$data = json_encode( array( "alert" => $type ) );
$this->parent->pest()->put( "lights/" . $this->id . "/state", $data );
$this->parent->update( $this->id );
} | [
"public",
"function",
"setAlert",
"(",
"$",
"type",
"=",
"'select'",
")",
"{",
"$",
"data",
"=",
"json_encode",
"(",
"array",
"(",
"\"alert\"",
"=>",
"$",
"type",
")",
")",
";",
"$",
"this",
"->",
"parent",
"->",
"pest",
"(",
")",
"->",
"put",
"(",... | Sets the alert state. 'select' blinks once, 'lselect' blinks repeatedly, 'none' turns off blinking | [
"Sets",
"the",
"alert",
"state",
".",
"select",
"blinks",
"once",
"lselect",
"blinks",
"repeatedly",
"none",
"turns",
"off",
"blinking"
] | 364e400eabb62777c10d42f5e53cf4c1f65a6728 | https://github.com/muesli/huephp/blob/364e400eabb62777c10d42f5e53cf4c1f65a6728/src/Light.php#L120-L126 |
190,097 | muesli/huephp | src/Light.php | Light.setLight | public function setLight( $input )
{
$data = json_encode( $input );
$this->parent->pest()->put( "lights/" . $this->id . "/state", $data );
$this->parent->update( $this->id );
} | php | public function setLight( $input )
{
$data = json_encode( $input );
$this->parent->pest()->put( "lights/" . $this->id . "/state", $data );
$this->parent->update( $this->id );
} | [
"public",
"function",
"setLight",
"(",
"$",
"input",
")",
"{",
"$",
"data",
"=",
"json_encode",
"(",
"$",
"input",
")",
";",
"$",
"this",
"->",
"parent",
"->",
"pest",
"(",
")",
"->",
"put",
"(",
"\"lights/\"",
".",
"$",
"this",
"->",
"id",
".",
... | Sets the state property | [
"Sets",
"the",
"state",
"property"
] | 364e400eabb62777c10d42f5e53cf4c1f65a6728 | https://github.com/muesli/huephp/blob/364e400eabb62777c10d42f5e53cf4c1f65a6728/src/Light.php#L130-L136 |
190,098 | antonraharja/tpl | src/Playsms/Tpl.php | Tpl._setString | private function _setString($key, $val) {
$this->_result = str_replace('{{' . $key . '}}', $val, $this->_result);
} | php | private function _setString($key, $val) {
$this->_result = str_replace('{{' . $key . '}}', $val, $this->_result);
} | [
"private",
"function",
"_setString",
"(",
"$",
"key",
",",
"$",
"val",
")",
"{",
"$",
"this",
"->",
"_result",
"=",
"str_replace",
"(",
"'{{'",
".",
"$",
"key",
".",
"'}}'",
",",
"$",
"val",
",",
"$",
"this",
"->",
"_result",
")",
";",
"}"
] | Template string manipulation
@param string $key Template key
@param string $val Template value | [
"Template",
"string",
"manipulation"
] | f4eb176d93abedeb90674c609868fee602e8aab6 | https://github.com/antonraharja/tpl/blob/f4eb176d93abedeb90674c609868fee602e8aab6/src/Playsms/Tpl.php#L86-L88 |
190,099 | antonraharja/tpl | src/Playsms/Tpl.php | Tpl._setArray | private function _setArray($key, $val) {
preg_match("/<loop\." . $key . ">(.*?)<\/loop\." . $key . ">/s", $this->_result, $l);
$loop_content = '';
$loop = $l[1];
foreach ($val as $v) {
$loop_replaced = $loop;
foreach ($v as $x => $y) {
$loop_replaced = str_replace('{{' . $key . '.' . $x . '}}', $y,... | php | private function _setArray($key, $val) {
preg_match("/<loop\." . $key . ">(.*?)<\/loop\." . $key . ">/s", $this->_result, $l);
$loop_content = '';
$loop = $l[1];
foreach ($val as $v) {
$loop_replaced = $loop;
foreach ($v as $x => $y) {
$loop_replaced = str_replace('{{' . $key . '.' . $x . '}}', $y,... | [
"private",
"function",
"_setArray",
"(",
"$",
"key",
",",
"$",
"val",
")",
"{",
"preg_match",
"(",
"\"/<loop\\.\"",
".",
"$",
"key",
".",
"\">(.*?)<\\/loop\\.\"",
".",
"$",
"key",
".",
"\">/s\"",
",",
"$",
"this",
"->",
"_result",
",",
"$",
"l",
")",
... | Template loop manipulation
@param string $key Template key
@param string $val Template value | [
"Template",
"loop",
"manipulation"
] | f4eb176d93abedeb90674c609868fee602e8aab6 | https://github.com/antonraharja/tpl/blob/f4eb176d93abedeb90674c609868fee602e8aab6/src/Playsms/Tpl.php#L95-L113 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.