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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
189,900 | kalfheim/critical-css | src/Console/CriticalCssMake.php | CriticalCssMake.clearViews | protected function clearViews()
{
$this->info('Clearing compiled views');
try {
Artisan::call('view:clear');
} catch (InvalidArgumentException $e) {
$views = $this->laravel['files']->glob(
$this->laravel['config']['view.compiled'].'/*'
);
... | php | protected function clearViews()
{
$this->info('Clearing compiled views');
try {
Artisan::call('view:clear');
} catch (InvalidArgumentException $e) {
$views = $this->laravel['files']->glob(
$this->laravel['config']['view.compiled'].'/*'
);
... | [
"protected",
"function",
"clearViews",
"(",
")",
"{",
"$",
"this",
"->",
"info",
"(",
"'Clearing compiled views'",
")",
";",
"try",
"{",
"Artisan",
"::",
"call",
"(",
"'view:clear'",
")",
";",
"}",
"catch",
"(",
"InvalidArgumentException",
"$",
"e",
")",
"... | Clear compiled views.
@return void | [
"Clear",
"compiled",
"views",
"."
] | a9e9e065fc3611e9c723735e879fa0f6b1ad4d5c | https://github.com/kalfheim/critical-css/blob/a9e9e065fc3611e9c723735e879fa0f6b1ad4d5c/src/Console/CriticalCssMake.php#L86-L101 |
189,901 | kalfheim/critical-css | src/BladeUtils.php | BladeUtils.parseUriFromBladeExpression | public static function parseUriFromBladeExpression($expr)
{
if (is_null($expr)) {
// Return the current route if no argument is given.
return app('router')->current()->getUri();
}
$expr = trim($expr, '()\'" ');
if ($expr !== '/') {
// Remove lead... | php | public static function parseUriFromBladeExpression($expr)
{
if (is_null($expr)) {
// Return the current route if no argument is given.
return app('router')->current()->getUri();
}
$expr = trim($expr, '()\'" ');
if ($expr !== '/') {
// Remove lead... | [
"public",
"static",
"function",
"parseUriFromBladeExpression",
"(",
"$",
"expr",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"expr",
")",
")",
"{",
"// Return the current route if no argument is given.",
"return",
"app",
"(",
"'router'",
")",
"->",
"current",
"(",
... | Parse the URI from the Blade directive expression.
@param string $expr
@return string | [
"Parse",
"the",
"URI",
"from",
"the",
"Blade",
"directive",
"expression",
"."
] | a9e9e065fc3611e9c723735e879fa0f6b1ad4d5c | https://github.com/kalfheim/critical-css/blob/a9e9e065fc3611e9c723735e879fa0f6b1ad4d5c/src/BladeUtils.php#L45-L60 |
189,902 | kalfheim/critical-css | src/Storage/LaravelStorage.php | LaravelStorage.validateStoragePath | public function validateStoragePath()
{
if (!$this->files->exists($this->storage)) {
return $this->files->makeDirectory($this->storage);
}
return true;
} | php | public function validateStoragePath()
{
if (!$this->files->exists($this->storage)) {
return $this->files->makeDirectory($this->storage);
}
return true;
} | [
"public",
"function",
"validateStoragePath",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"files",
"->",
"exists",
"(",
"$",
"this",
"->",
"storage",
")",
")",
"{",
"return",
"$",
"this",
"->",
"files",
"->",
"makeDirectory",
"(",
"$",
"this",
"... | Validate that the storage directory exists. If it does not, create it.
@return bool | [
"Validate",
"that",
"the",
"storage",
"directory",
"exists",
".",
"If",
"it",
"does",
"not",
"create",
"it",
"."
] | a9e9e065fc3611e9c723735e879fa0f6b1ad4d5c | https://github.com/kalfheim/critical-css/blob/a9e9e065fc3611e9c723735e879fa0f6b1ad4d5c/src/Storage/LaravelStorage.php#L42-L49 |
189,903 | kalfheim/critical-css | src/HtmlFetchers/LaravelHtmlFetcher.php | LaravelHtmlFetcher.call | protected function call($uri)
{
$request = Request::create($uri, 'GET');
$kernel = $this->app->make(HttpKernel::class);
$response = $kernel->handle($request);
$kernel->terminate($request, $response);
return $response;
} | php | protected function call($uri)
{
$request = Request::create($uri, 'GET');
$kernel = $this->app->make(HttpKernel::class);
$response = $kernel->handle($request);
$kernel->terminate($request, $response);
return $response;
} | [
"protected",
"function",
"call",
"(",
"$",
"uri",
")",
"{",
"$",
"request",
"=",
"Request",
"::",
"create",
"(",
"$",
"uri",
",",
"'GET'",
")",
";",
"$",
"kernel",
"=",
"$",
"this",
"->",
"app",
"->",
"make",
"(",
"HttpKernel",
"::",
"class",
")",
... | Call the given URI and return a Response.
@param string $uri
@return \Illuminate\Http\Response | [
"Call",
"the",
"given",
"URI",
"and",
"return",
"a",
"Response",
"."
] | a9e9e065fc3611e9c723735e879fa0f6b1ad4d5c | https://github.com/kalfheim/critical-css/blob/a9e9e065fc3611e9c723735e879fa0f6b1ad4d5c/src/HtmlFetchers/LaravelHtmlFetcher.php#L68-L79 |
189,904 | jwage/php-apns | src/JWage/APNS/Client.php | Client.sendPayload | public function sendPayload($deviceToken, Payload $payload)
{
return $this->socketClient->write(
$this->createApnMessage($deviceToken, $payload)->getBinaryMessage()
);
} | php | public function sendPayload($deviceToken, Payload $payload)
{
return $this->socketClient->write(
$this->createApnMessage($deviceToken, $payload)->getBinaryMessage()
);
} | [
"public",
"function",
"sendPayload",
"(",
"$",
"deviceToken",
",",
"Payload",
"$",
"payload",
")",
"{",
"return",
"$",
"this",
"->",
"socketClient",
"->",
"write",
"(",
"$",
"this",
"->",
"createApnMessage",
"(",
"$",
"deviceToken",
",",
"$",
"payload",
")... | Send Payload instance to a given device token.
@param string $deviceToken The device token to send payload to.
@param \JWage\APNS\Payload $payload The payload to send to device token. | [
"Send",
"Payload",
"instance",
"to",
"a",
"given",
"device",
"token",
"."
] | 75d8b0f4722cf4342a42d0fc4e0619c32550b955 | https://github.com/jwage/php-apns/blob/75d8b0f4722cf4342a42d0fc4e0619c32550b955/src/JWage/APNS/Client.php#L28-L33 |
189,905 | jwage/php-apns | src/JWage/APNS/Sender.php | Sender.send | public function send($deviceToken, $title, $body, $deepLink = null)
{
return $this->client->sendPayload(
$deviceToken, $this->createPayload($title, $body, $deepLink)
);
} | php | public function send($deviceToken, $title, $body, $deepLink = null)
{
return $this->client->sendPayload(
$deviceToken, $this->createPayload($title, $body, $deepLink)
);
} | [
"public",
"function",
"send",
"(",
"$",
"deviceToken",
",",
"$",
"title",
",",
"$",
"body",
",",
"$",
"deepLink",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"client",
"->",
"sendPayload",
"(",
"$",
"deviceToken",
",",
"$",
"this",
"->",
"cre... | Sends a safari website push notification to the given deviceToken.
@param string $deviceToken
@param string $title
@param string $body
@param string $deepLink | [
"Sends",
"a",
"safari",
"website",
"push",
"notification",
"to",
"the",
"given",
"deviceToken",
"."
] | 75d8b0f4722cf4342a42d0fc4e0619c32550b955 | https://github.com/jwage/php-apns/blob/75d8b0f4722cf4342a42d0fc4e0619c32550b955/src/JWage/APNS/Sender.php#L30-L35 |
189,906 | jwage/php-apns | src/JWage/APNS/Safari/PackageGenerator.php | PackageGenerator.createPushPackageForUser | public function createPushPackageForUser($userId)
{
$packageDir = sprintf('/%s/pushPackage%s.%s', sys_get_temp_dir(), time(), $userId);
$package = $this->createPackage($packageDir, $userId);
$this->generatePackage($package);
return $package;
} | php | public function createPushPackageForUser($userId)
{
$packageDir = sprintf('/%s/pushPackage%s.%s', sys_get_temp_dir(), time(), $userId);
$package = $this->createPackage($packageDir, $userId);
$this->generatePackage($package);
return $package;
} | [
"public",
"function",
"createPushPackageForUser",
"(",
"$",
"userId",
")",
"{",
"$",
"packageDir",
"=",
"sprintf",
"(",
"'/%s/pushPackage%s.%s'",
",",
"sys_get_temp_dir",
"(",
")",
",",
"time",
"(",
")",
",",
"$",
"userId",
")",
";",
"$",
"package",
"=",
"... | Create a safari website push notification package for the given User.
@param string $userId User id to create package for.
@return \JWage\APNS\Safari\Package $package Package instance. | [
"Create",
"a",
"safari",
"website",
"push",
"notification",
"package",
"for",
"the",
"given",
"User",
"."
] | 75d8b0f4722cf4342a42d0fc4e0619c32550b955 | https://github.com/jwage/php-apns/blob/75d8b0f4722cf4342a42d0fc4e0619c32550b955/src/JWage/APNS/Safari/PackageGenerator.php#L65-L73 |
189,907 | benplummer/calendarful | src/Calendar/Calendar.php | Calendar.populate | public function populate(EventRegistryInterface $eventsRegistry, \DateTime $fromDate, \DateTime $toDate, $limit = null, array $extraFilters = array())
{
if ($fromDate > $toDate) {
throw new \RangeException("'From' date should be before the 'to' date.");
}
$filters = array_merge(
array(
'fromDate' => $... | php | public function populate(EventRegistryInterface $eventsRegistry, \DateTime $fromDate, \DateTime $toDate, $limit = null, array $extraFilters = array())
{
if ($fromDate > $toDate) {
throw new \RangeException("'From' date should be before the 'to' date.");
}
$filters = array_merge(
array(
'fromDate' => $... | [
"public",
"function",
"populate",
"(",
"EventRegistryInterface",
"$",
"eventsRegistry",
",",
"\\",
"DateTime",
"$",
"fromDate",
",",
"\\",
"DateTime",
"$",
"toDate",
",",
"$",
"limit",
"=",
"null",
",",
"array",
"$",
"extraFilters",
"=",
"array",
"(",
")",
... | Populates the calendar with events using an event registry and filters the results based
on other parameters.
Occurrences of recurring events are also generated at this stage.
@param EventRegistryInterface $eventsRegistry
@param \DateTime $fromDate
@param \DateTime $toDate
@param int $limit
@param mix... | [
"Populates",
"the",
"calendar",
"with",
"events",
"using",
"an",
"event",
"registry",
"and",
"filters",
"the",
"results",
"based",
"on",
"other",
"parameters",
"."
] | dc97da802685cd9e197ac55ff8f8aa78ea990ba6 | https://github.com/benplummer/calendarful/blob/dc97da802685cd9e197ac55ff8f8aa78ea990ba6/src/Calendar/Calendar.php#L91-L118 |
189,908 | benplummer/calendarful | src/Calendar/Calendar.php | Calendar.sort | public function sort()
{
usort($this->allEvents, function ($event1, $event2) {
if ($event1->getStartDate() == $event2->getStartDate()) {
return $event1->getId() < $event2->getId() ? -1 : 1;
}
return $event1->getStartDate() < $event2->getStartDate() ? -1 : 1;
});
return $this;
} | php | public function sort()
{
usort($this->allEvents, function ($event1, $event2) {
if ($event1->getStartDate() == $event2->getStartDate()) {
return $event1->getId() < $event2->getId() ? -1 : 1;
}
return $event1->getStartDate() < $event2->getStartDate() ? -1 : 1;
});
return $this;
} | [
"public",
"function",
"sort",
"(",
")",
"{",
"usort",
"(",
"$",
"this",
"->",
"allEvents",
",",
"function",
"(",
"$",
"event1",
",",
"$",
"event2",
")",
"{",
"if",
"(",
"$",
"event1",
"->",
"getStartDate",
"(",
")",
"==",
"$",
"event2",
"->",
"getS... | Sorts the events into ascending order based on their start dates.
@return static | [
"Sorts",
"the",
"events",
"into",
"ascending",
"order",
"based",
"on",
"their",
"start",
"dates",
"."
] | dc97da802685cd9e197ac55ff8f8aa78ea990ba6 | https://github.com/benplummer/calendarful/blob/dc97da802685cd9e197ac55ff8f8aa78ea990ba6/src/Calendar/Calendar.php#L125-L136 |
189,909 | benplummer/calendarful | src/Calendar/Calendar.php | Calendar.processRecurringEvents | protected function processRecurringEvents(\DateTime $fromDate, \DateTime $toDate, $limit = null)
{
if ($this->recurrenceFactory) {
foreach ($this->recurrenceFactory->getRecurrenceTypes() as $recurrence) {
$recurrenceType = new $recurrence();
$occurrences = $recurrenceType->generateOccurrences($this->recu... | php | protected function processRecurringEvents(\DateTime $fromDate, \DateTime $toDate, $limit = null)
{
if ($this->recurrenceFactory) {
foreach ($this->recurrenceFactory->getRecurrenceTypes() as $recurrence) {
$recurrenceType = new $recurrence();
$occurrences = $recurrenceType->generateOccurrences($this->recu... | [
"protected",
"function",
"processRecurringEvents",
"(",
"\\",
"DateTime",
"$",
"fromDate",
",",
"\\",
"DateTime",
"$",
"toDate",
",",
"$",
"limit",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"recurrenceFactory",
")",
"{",
"foreach",
"(",
"$",
"... | Generates the occurrences for recurring events if a recurrence factory is present.
@param \DateTime $fromDate
@param \DateTime $toDate
@param int $limit | [
"Generates",
"the",
"occurrences",
"for",
"recurring",
"events",
"if",
"a",
"recurrence",
"factory",
"is",
"present",
"."
] | dc97da802685cd9e197ac55ff8f8aa78ea990ba6 | https://github.com/benplummer/calendarful/blob/dc97da802685cd9e197ac55ff8f8aa78ea990ba6/src/Calendar/Calendar.php#L155-L180 |
189,910 | benplummer/calendarful | src/Calendar/Calendar.php | Calendar.removeOveriddenEvents | protected function removeOveriddenEvents()
{
// Events need to be sorted by date and id (both ascending) in order for overridden occurrences not to show
$this->sort();
$events = array();
// New events array is created with the occurrence overrides replacing the relevant occurrences
array_walk($this->allEve... | php | protected function removeOveriddenEvents()
{
// Events need to be sorted by date and id (both ascending) in order for overridden occurrences not to show
$this->sort();
$events = array();
// New events array is created with the occurrence overrides replacing the relevant occurrences
array_walk($this->allEve... | [
"protected",
"function",
"removeOveriddenEvents",
"(",
")",
"{",
"// Events need to be sorted by date and id (both ascending) in order for overridden occurrences not to show",
"$",
"this",
"->",
"sort",
"(",
")",
";",
"$",
"events",
"=",
"array",
"(",
")",
";",
"// New even... | Removes the occurrences of recurring events that have been overridden. | [
"Removes",
"the",
"occurrences",
"of",
"recurring",
"events",
"that",
"have",
"been",
"overridden",
"."
] | dc97da802685cd9e197ac55ff8f8aa78ea990ba6 | https://github.com/benplummer/calendarful/blob/dc97da802685cd9e197ac55ff8f8aa78ea990ba6/src/Calendar/Calendar.php#L185-L202 |
189,911 | benplummer/calendarful | src/Calendar/Calendar.php | Calendar.removeOutOfRangeEvents | protected function removeOutOfRangeEvents(\DateTime $fromDate, \DateTime $toDate)
{
// Remove events that do not occur within the date range
$this->allEvents = array_filter($this->allEvents, function ($event) use ($fromDate, $toDate) {
if ($event->getStartDate() <= $toDate && $event->getEndDate() >= $fromDate)... | php | protected function removeOutOfRangeEvents(\DateTime $fromDate, \DateTime $toDate)
{
// Remove events that do not occur within the date range
$this->allEvents = array_filter($this->allEvents, function ($event) use ($fromDate, $toDate) {
if ($event->getStartDate() <= $toDate && $event->getEndDate() >= $fromDate)... | [
"protected",
"function",
"removeOutOfRangeEvents",
"(",
"\\",
"DateTime",
"$",
"fromDate",
",",
"\\",
"DateTime",
"$",
"toDate",
")",
"{",
"// Remove events that do not occur within the date range",
"$",
"this",
"->",
"allEvents",
"=",
"array_filter",
"(",
"$",
"this"... | Remove any events, particularly occurrences of recurring events, that are out of the date
range provided.
@param \DateTime $fromDate
@param \DateTime $toDate | [
"Remove",
"any",
"events",
"particularly",
"occurrences",
"of",
"recurring",
"events",
"that",
"are",
"out",
"of",
"the",
"date",
"range",
"provided",
"."
] | dc97da802685cd9e197ac55ff8f8aa78ea990ba6 | https://github.com/benplummer/calendarful/blob/dc97da802685cd9e197ac55ff8f8aa78ea990ba6/src/Calendar/Calendar.php#L211-L222 |
189,912 | yii2mod/yii2-array-query | ArrayQuery.php | ArrayQuery.populate | public function populate($rows): array
{
$result = [];
if ($this->indexBy === null) {
return array_values($rows); // reset storage internal keys
}
foreach ($rows as $row) {
if (is_string($this->indexBy)) {
$key = $row[$this->indexBy];
... | php | public function populate($rows): array
{
$result = [];
if ($this->indexBy === null) {
return array_values($rows); // reset storage internal keys
}
foreach ($rows as $row) {
if (is_string($this->indexBy)) {
$key = $row[$this->indexBy];
... | [
"public",
"function",
"populate",
"(",
"$",
"rows",
")",
":",
"array",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"indexBy",
"===",
"null",
")",
"{",
"return",
"array_values",
"(",
"$",
"rows",
")",
";",
"// reset storage i... | Converts the raw query results into the format as specified by this query.
@param $rows
@return array | [
"Converts",
"the",
"raw",
"query",
"results",
"into",
"the",
"format",
"as",
"specified",
"by",
"this",
"query",
"."
] | 0a82e9a1eebc0a4001d1f9c6f67958a88ce9191e | https://github.com/yii2mod/yii2-array-query/blob/0a82e9a1eebc0a4001d1f9c6f67958a88ce9191e/ArrayQuery.php#L127-L145 |
189,913 | islamic-network/alquran-tools | src/AlQuranCloud/Tools/Parser/Tajweed.php | Tajweed.parse | public function parse($text, $fixWebkit = false)
{
if ($fixWebkit) {
return
$this->webkitFix(
$this->closeParsing(
$this->parseTajweed($text)
)
);
}
return
$th... | php | public function parse($text, $fixWebkit = false)
{
if ($fixWebkit) {
return
$this->webkitFix(
$this->closeParsing(
$this->parseTajweed($text)
)
);
}
return
$th... | [
"public",
"function",
"parse",
"(",
"$",
"text",
",",
"$",
"fixWebkit",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"fixWebkit",
")",
"{",
"return",
"$",
"this",
"->",
"webkitFix",
"(",
"$",
"this",
"->",
"closeParsing",
"(",
"$",
"this",
"->",
"parseTaj... | Parses tajweed from the GlobalQuran and AlQuran APIs to return markup
@param string $text Verse text
@param boolean $fixWebkit Tries to fix for Chrome and Safari. This is experimental and has known problems.
@return string Parsed text that can be used to display tajweed | [
"Parses",
"tajweed",
"from",
"the",
"GlobalQuran",
"and",
"AlQuran",
"APIs",
"to",
"return",
"markup"
] | df80ba6a3fe9770c6cd354f583d766eecf8653d8 | https://github.com/islamic-network/alquran-tools/blob/df80ba6a3fe9770c6cd354f583d766eecf8653d8/src/AlQuranCloud/Tools/Parser/Tajweed.php#L166-L181 |
189,914 | jwage/php-apns | src/JWage/APNS/Safari/PackageManifester.php | PackageManifester.createManifest | public function createManifest(Package $package)
{
$manifestData = array();
foreach (Package::$packageFiles as $rawFile) {
$filePath = sprintf('%s/%s', $package->getPackageDir(), $rawFile);
$manifestData[$rawFile] = sha1(file_get_contents($filePath));
}
$mani... | php | public function createManifest(Package $package)
{
$manifestData = array();
foreach (Package::$packageFiles as $rawFile) {
$filePath = sprintf('%s/%s', $package->getPackageDir(), $rawFile);
$manifestData[$rawFile] = sha1(file_get_contents($filePath));
}
$mani... | [
"public",
"function",
"createManifest",
"(",
"Package",
"$",
"package",
")",
"{",
"$",
"manifestData",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"Package",
"::",
"$",
"packageFiles",
"as",
"$",
"rawFile",
")",
"{",
"$",
"filePath",
"=",
"sprintf",
"("... | Generates a manifest JSON file and returns the path.
@param \JWage\APNS\Safari\Package $package
@return string $manifestJsonPath | [
"Generates",
"a",
"manifest",
"JSON",
"file",
"and",
"returns",
"the",
"path",
"."
] | 75d8b0f4722cf4342a42d0fc4e0619c32550b955 | https://github.com/jwage/php-apns/blob/75d8b0f4722cf4342a42d0fc4e0619c32550b955/src/JWage/APNS/Safari/PackageManifester.php#L13-L27 |
189,915 | benplummer/calendarful | src/Recurrence/Type/MonthlyDate.php | MonthlyDate.generateOccurrences | public function generateOccurrences(Array $events, \DateTime $fromDate, \DateTime $toDate, $limit = null)
{
$return = array();
$object = $this;
$monthlyEvents = array_filter($events, function ($event) use ($object) {
return $event->getRecurrenceType() === $object->getLabel();
});
foreach ($monthlyEvents... | php | public function generateOccurrences(Array $events, \DateTime $fromDate, \DateTime $toDate, $limit = null)
{
$return = array();
$object = $this;
$monthlyEvents = array_filter($events, function ($event) use ($object) {
return $event->getRecurrenceType() === $object->getLabel();
});
foreach ($monthlyEvents... | [
"public",
"function",
"generateOccurrences",
"(",
"Array",
"$",
"events",
",",
"\\",
"DateTime",
"$",
"fromDate",
",",
"\\",
"DateTime",
"$",
"toDate",
",",
"$",
"limit",
"=",
"null",
")",
"{",
"$",
"return",
"=",
"array",
"(",
")",
";",
"$",
"object",... | Generate the occurrences for each monthly recurring event.
@param EventInterface[] $events
@param \DateTime $fromDate
@param \DateTime $toDate
@param int|null $limit
@return EventInterface[] | [
"Generate",
"the",
"occurrences",
"for",
"each",
"monthly",
"recurring",
"event",
"."
] | dc97da802685cd9e197ac55ff8f8aa78ea990ba6 | https://github.com/benplummer/calendarful/blob/dc97da802685cd9e197ac55ff8f8aa78ea990ba6/src/Recurrence/Type/MonthlyDate.php#L56-L129 |
189,916 | benplummer/calendarful | src/Recurrence/RecurrenceFactory.php | RecurrenceFactory.addRecurrenceType | public function addRecurrenceType($type, $recurrenceType)
{
if (is_string($recurrenceType) and !class_exists($recurrenceType)) {
throw new \InvalidArgumentException("Class {$recurrenceType} does not exist.");
} elseif (!in_array('Plummer\Calendarful\Recurrence\RecurrenceInterface', class_implements($recurrenceT... | php | public function addRecurrenceType($type, $recurrenceType)
{
if (is_string($recurrenceType) and !class_exists($recurrenceType)) {
throw new \InvalidArgumentException("Class {$recurrenceType} does not exist.");
} elseif (!in_array('Plummer\Calendarful\Recurrence\RecurrenceInterface', class_implements($recurrenceT... | [
"public",
"function",
"addRecurrenceType",
"(",
"$",
"type",
",",
"$",
"recurrenceType",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"recurrenceType",
")",
"and",
"!",
"class_exists",
"(",
"$",
"recurrenceType",
")",
")",
"{",
"throw",
"new",
"\\",
"Invali... | Stores recurrence type class paths when provided with a key and an instance or
class path of an implementation.
@param string $type
@param string|RecurrenceInterface $recurrenceType | [
"Stores",
"recurrence",
"type",
"class",
"paths",
"when",
"provided",
"with",
"a",
"key",
"and",
"an",
"instance",
"or",
"class",
"path",
"of",
"an",
"implementation",
"."
] | dc97da802685cd9e197ac55ff8f8aa78ea990ba6 | https://github.com/benplummer/calendarful/blob/dc97da802685cd9e197ac55ff8f8aa78ea990ba6/src/Recurrence/RecurrenceFactory.php#L30-L41 |
189,917 | benplummer/calendarful | src/Recurrence/RecurrenceFactory.php | RecurrenceFactory.createRecurrenceType | public function createRecurrenceType($type)
{
if (!isset($this->recurrenceTypes[$type])) {
throw new \OutOfBoundsException("A recurrence type called {$type} does not exist within the factory.");
}
$recurrenceType = new $this->recurrenceTypes[$type]();
return $recurrenceType;
} | php | public function createRecurrenceType($type)
{
if (!isset($this->recurrenceTypes[$type])) {
throw new \OutOfBoundsException("A recurrence type called {$type} does not exist within the factory.");
}
$recurrenceType = new $this->recurrenceTypes[$type]();
return $recurrenceType;
} | [
"public",
"function",
"createRecurrenceType",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"recurrenceTypes",
"[",
"$",
"type",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"OutOfBoundsException",
"(",
"\"A recurrence type called... | Creates and returns an instance of a stored recurrence type.
@param string $type
@return RecurrenceInterface
@throws OutOfBoundsException | [
"Creates",
"and",
"returns",
"an",
"instance",
"of",
"a",
"stored",
"recurrence",
"type",
"."
] | dc97da802685cd9e197ac55ff8f8aa78ea990ba6 | https://github.com/benplummer/calendarful/blob/dc97da802685cd9e197ac55ff8f8aa78ea990ba6/src/Recurrence/RecurrenceFactory.php#L60-L69 |
189,918 | jwage/php-apns | src/JWage/APNS/Safari/PackageSigner.php | PackageSigner.createPackageSignature | public function createPackageSignature(Certificate $certificate, Package $package)
{
$pkcs12 = $certificate->getCertificateString();
$certPassword = $certificate->getPassword();
$certs = array();
if (!openssl_pkcs12_read($pkcs12, $certs, $certPassword)) {
throw new Runt... | php | public function createPackageSignature(Certificate $certificate, Package $package)
{
$pkcs12 = $certificate->getCertificateString();
$certPassword = $certificate->getPassword();
$certs = array();
if (!openssl_pkcs12_read($pkcs12, $certs, $certPassword)) {
throw new Runt... | [
"public",
"function",
"createPackageSignature",
"(",
"Certificate",
"$",
"certificate",
",",
"Package",
"$",
"package",
")",
"{",
"$",
"pkcs12",
"=",
"$",
"certificate",
"->",
"getCertificateString",
"(",
")",
";",
"$",
"certPassword",
"=",
"$",
"certificate",
... | Creates a package signature using the given certificate and package directory.
@param \JWage\APNS\Certificate $certificate
@param \JWage\APNS\Safari\Package $package
@return string Path of signature | [
"Creates",
"a",
"package",
"signature",
"using",
"the",
"given",
"certificate",
"and",
"package",
"directory",
"."
] | 75d8b0f4722cf4342a42d0fc4e0619c32550b955 | https://github.com/jwage/php-apns/blob/75d8b0f4722cf4342a42d0fc4e0619c32550b955/src/JWage/APNS/Safari/PackageSigner.php#L19-L50 |
189,919 | benplummer/calendarful | src/Recurrence/Type/Daily.php | Daily.generateOccurrences | public function generateOccurrences(Array $events, \DateTime $fromDate, \DateTime $toDate, $limit = null)
{
$return = array();
$object = $this;
$dailyEvents = array_filter($events, function ($event) use ($object) {
return $event->getRecurrenceType() === $object->getLabel();
});
foreach ($dailyEvents as ... | php | public function generateOccurrences(Array $events, \DateTime $fromDate, \DateTime $toDate, $limit = null)
{
$return = array();
$object = $this;
$dailyEvents = array_filter($events, function ($event) use ($object) {
return $event->getRecurrenceType() === $object->getLabel();
});
foreach ($dailyEvents as ... | [
"public",
"function",
"generateOccurrences",
"(",
"Array",
"$",
"events",
",",
"\\",
"DateTime",
"$",
"fromDate",
",",
"\\",
"DateTime",
"$",
"toDate",
",",
"$",
"limit",
"=",
"null",
")",
"{",
"$",
"return",
"=",
"array",
"(",
")",
";",
"$",
"object",... | Generate the occurrences for each daily recurring event.
@param EventInterface[] $events
@param \DateTime $fromDate
@param \DateTime $toDate
@param int|null $limit
@return EventInterface[] | [
"Generate",
"the",
"occurrences",
"for",
"each",
"daily",
"recurring",
"event",
"."
] | dc97da802685cd9e197ac55ff8f8aa78ea990ba6 | https://github.com/benplummer/calendarful/blob/dc97da802685cd9e197ac55ff8f8aa78ea990ba6/src/Recurrence/Type/Daily.php#L55-L117 |
189,920 | benplummer/calendarful | src/Recurrence/Type/Weekly.php | Weekly.generateOccurrences | public function generateOccurrences(Array $events, \DateTime $fromDate, \DateTime $toDate, $limit = null)
{
$return = array();
$object = $this;
$weeklyEvents = array_filter($events, function ($event) use ($object) {
return $event->getRecurrenceType() === $object->getLabel();
});
foreach ($weeklyEvents a... | php | public function generateOccurrences(Array $events, \DateTime $fromDate, \DateTime $toDate, $limit = null)
{
$return = array();
$object = $this;
$weeklyEvents = array_filter($events, function ($event) use ($object) {
return $event->getRecurrenceType() === $object->getLabel();
});
foreach ($weeklyEvents a... | [
"public",
"function",
"generateOccurrences",
"(",
"Array",
"$",
"events",
",",
"\\",
"DateTime",
"$",
"fromDate",
",",
"\\",
"DateTime",
"$",
"toDate",
",",
"$",
"limit",
"=",
"null",
")",
"{",
"$",
"return",
"=",
"array",
"(",
")",
";",
"$",
"object",... | Generate the occurrences for each weekly recurring event.
@param EventInterface[] $events
@param \DateTime $fromDate
@param \DateTime $toDate
@param int|null $limit
@return EventInterface[] | [
"Generate",
"the",
"occurrences",
"for",
"each",
"weekly",
"recurring",
"event",
"."
] | dc97da802685cd9e197ac55ff8f8aa78ea990ba6 | https://github.com/benplummer/calendarful/blob/dc97da802685cd9e197ac55ff8f8aa78ea990ba6/src/Recurrence/Type/Weekly.php#L55-L124 |
189,921 | jwage/php-apns | src/JWage/APNS/APNSMessage.php | APNSMessage.getBinaryMessage | public function getBinaryMessage()
{
$encodedPayload = $this->jsonEncode($this->payload->getPayload());
return chr(0).
chr(0).
chr(32).
pack('H*', $this->deviceToken).
chr(0).chr(strlen($encodedPayload)).
$encodedPayload;
... | php | public function getBinaryMessage()
{
$encodedPayload = $this->jsonEncode($this->payload->getPayload());
return chr(0).
chr(0).
chr(32).
pack('H*', $this->deviceToken).
chr(0).chr(strlen($encodedPayload)).
$encodedPayload;
... | [
"public",
"function",
"getBinaryMessage",
"(",
")",
"{",
"$",
"encodedPayload",
"=",
"$",
"this",
"->",
"jsonEncode",
"(",
"$",
"this",
"->",
"payload",
"->",
"getPayload",
"(",
")",
")",
";",
"return",
"chr",
"(",
"0",
")",
".",
"chr",
"(",
"0",
")"... | Returns a binary message that the Apple Push Notification Service understands.
@return string $binaryMessage | [
"Returns",
"a",
"binary",
"message",
"that",
"the",
"Apple",
"Push",
"Notification",
"Service",
"understands",
"."
] | 75d8b0f4722cf4342a42d0fc4e0619c32550b955 | https://github.com/jwage/php-apns/blob/75d8b0f4722cf4342a42d0fc4e0619c32550b955/src/JWage/APNS/APNSMessage.php#L38-L48 |
189,922 | benplummer/calendarful | src/Calendar/CalendarFactory.php | CalendarFactory.addCalendarType | public function addCalendarType($type, $calendarType)
{
if (is_string($calendarType) and !class_exists($calendarType)) {
throw new \InvalidArgumentException("Class {$calendarType} does not exist.");
} elseif (!in_array('Plummer\Calendarful\Calendar\CalendarInterface', class_implements($calendarType, false))) {
... | php | public function addCalendarType($type, $calendarType)
{
if (is_string($calendarType) and !class_exists($calendarType)) {
throw new \InvalidArgumentException("Class {$calendarType} does not exist.");
} elseif (!in_array('Plummer\Calendarful\Calendar\CalendarInterface', class_implements($calendarType, false))) {
... | [
"public",
"function",
"addCalendarType",
"(",
"$",
"type",
",",
"$",
"calendarType",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"calendarType",
")",
"and",
"!",
"class_exists",
"(",
"$",
"calendarType",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumen... | Stores calendar type class paths when provided with a key and an instance or
class path of an implementation.
@param string $type
@param string|CalendarInterface $calendarType | [
"Stores",
"calendar",
"type",
"class",
"paths",
"when",
"provided",
"with",
"a",
"key",
"and",
"an",
"instance",
"or",
"class",
"path",
"of",
"an",
"implementation",
"."
] | dc97da802685cd9e197ac55ff8f8aa78ea990ba6 | https://github.com/benplummer/calendarful/blob/dc97da802685cd9e197ac55ff8f8aa78ea990ba6/src/Calendar/CalendarFactory.php#L28-L39 |
189,923 | benplummer/calendarful | src/Calendar/CalendarFactory.php | CalendarFactory.createCalendar | public function createCalendar($type)
{
if (!isset($this->calendarTypes[$type])) {
throw new \OutOfBoundsException("A calendar type called {$type} does not exist within the factory.");
}
$calendar = new $this->calendarTypes[$type]();
return $calendar;
} | php | public function createCalendar($type)
{
if (!isset($this->calendarTypes[$type])) {
throw new \OutOfBoundsException("A calendar type called {$type} does not exist within the factory.");
}
$calendar = new $this->calendarTypes[$type]();
return $calendar;
} | [
"public",
"function",
"createCalendar",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"calendarTypes",
"[",
"$",
"type",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"OutOfBoundsException",
"(",
"\"A calendar type called {$type} d... | Creates and returns an instance of a stored calendar type.
@param string $type
@return CalendarInterface
@throws OutOfBoundsException | [
"Creates",
"and",
"returns",
"an",
"instance",
"of",
"a",
"stored",
"calendar",
"type",
"."
] | dc97da802685cd9e197ac55ff8f8aa78ea990ba6 | https://github.com/benplummer/calendarful/blob/dc97da802685cd9e197ac55ff8f8aa78ea990ba6/src/Calendar/CalendarFactory.php#L58-L67 |
189,924 | ikkez/f3-schema-builder | lib/db/sql/schema.php | DB_Utils.findQuery | public function findQuery($cmd) {
foreach ($cmd as $backend => $val)
if (preg_match('/'.$backend.'/', $this->db->driver()))
return $val;
trigger_error(sprintf('DB Engine `%s` is not supported for this action.', $this->db->driver()),E_USER_ERROR);
} | php | public function findQuery($cmd) {
foreach ($cmd as $backend => $val)
if (preg_match('/'.$backend.'/', $this->db->driver()))
return $val;
trigger_error(sprintf('DB Engine `%s` is not supported for this action.', $this->db->driver()),E_USER_ERROR);
} | [
"public",
"function",
"findQuery",
"(",
"$",
"cmd",
")",
"{",
"foreach",
"(",
"$",
"cmd",
"as",
"$",
"backend",
"=>",
"$",
"val",
")",
"if",
"(",
"preg_match",
"(",
"'/'",
".",
"$",
"backend",
".",
"'/'",
",",
"$",
"this",
"->",
"db",
"->",
"driv... | parse command array and return backend specific query
@param $cmd
@param $cmd array
@return bool|string | [
"parse",
"command",
"array",
"and",
"return",
"backend",
"specific",
"query"
] | 42d8f3f0a117dce29ab3fe30ef46fafb419224e3 | https://github.com/ikkez/f3-schema-builder/blob/42d8f3f0a117dce29ab3fe30ef46fafb419224e3/lib/db/sql/schema.php#L1314-L1319 |
189,925 | ikkez/f3-schema-builder | lib/db/sql/schema.php | Schema.getDatabases | public function getDatabases()
{
$cmd = array(
'mysql' => 'SHOW DATABASES',
'pgsql' => 'SELECT datname FROM pg_catalog.pg_database',
'mssql|sybase|dblib|sqlsrv|odbc' => 'EXEC SP_HELPDB',
);
$query = $this->findQuery($cmd);
if (!$query) return false... | php | public function getDatabases()
{
$cmd = array(
'mysql' => 'SHOW DATABASES',
'pgsql' => 'SELECT datname FROM pg_catalog.pg_database',
'mssql|sybase|dblib|sqlsrv|odbc' => 'EXEC SP_HELPDB',
);
$query = $this->findQuery($cmd);
if (!$query) return false... | [
"public",
"function",
"getDatabases",
"(",
")",
"{",
"$",
"cmd",
"=",
"array",
"(",
"'mysql'",
"=>",
"'SHOW DATABASES'",
",",
"'pgsql'",
"=>",
"'SELECT datname FROM pg_catalog.pg_database'",
",",
"'mssql|sybase|dblib|sqlsrv|odbc'",
"=>",
"'EXEC SP_HELPDB'",
",",
")",
... | get a list of all databases
@return array|bool | [
"get",
"a",
"list",
"of",
"all",
"databases"
] | 42d8f3f0a117dce29ab3fe30ef46fafb419224e3 | https://github.com/ikkez/f3-schema-builder/blob/42d8f3f0a117dce29ab3fe30ef46fafb419224e3/lib/db/sql/schema.php#L154-L168 |
189,926 | ikkez/f3-schema-builder | lib/db/sql/schema.php | Schema.getTables | public function getTables()
{
$cmd = array(
'mysql' => array(
"show tables"),
'sqlite2?' => array(
"SELECT name FROM sqlite_master WHERE type='table' AND name!='sqlite_sequence'"),
'pgsql|sybase|dblib' => array(
"select tabl... | php | public function getTables()
{
$cmd = array(
'mysql' => array(
"show tables"),
'sqlite2?' => array(
"SELECT name FROM sqlite_master WHERE type='table' AND name!='sqlite_sequence'"),
'pgsql|sybase|dblib' => array(
"select tabl... | [
"public",
"function",
"getTables",
"(",
")",
"{",
"$",
"cmd",
"=",
"array",
"(",
"'mysql'",
"=>",
"array",
"(",
"\"show tables\"",
")",
",",
"'sqlite2?'",
"=>",
"array",
"(",
"\"SELECT name FROM sqlite_master WHERE type='table' AND name!='sqlite_sequence'\"",
")",
","... | get all tables of current DB
@return bool|array list of tables, or false | [
"get",
"all",
"tables",
"of",
"current",
"DB"
] | 42d8f3f0a117dce29ab3fe30ef46fafb419224e3 | https://github.com/ikkez/f3-schema-builder/blob/42d8f3f0a117dce29ab3fe30ef46fafb419224e3/lib/db/sql/schema.php#L174-L194 |
189,927 | ikkez/f3-schema-builder | lib/db/sql/schema.php | Schema.renameTable | public function renameTable($name, $new_name, $exec = true)
{
$name = $this->db->quotekey($name);
$new_name = $this->db->quotekey($new_name);
if (preg_match('/odbc/', $this->db->driver())) {
$queries = array();
$queries[] = "SELECT * INTO $new_name FROM $name;";
... | php | public function renameTable($name, $new_name, $exec = true)
{
$name = $this->db->quotekey($name);
$new_name = $this->db->quotekey($new_name);
if (preg_match('/odbc/', $this->db->driver())) {
$queries = array();
$queries[] = "SELECT * INTO $new_name FROM $name;";
... | [
"public",
"function",
"renameTable",
"(",
"$",
"name",
",",
"$",
"new_name",
",",
"$",
"exec",
"=",
"true",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"db",
"->",
"quotekey",
"(",
"$",
"name",
")",
";",
"$",
"new_name",
"=",
"$",
"this",
"->"... | rename a table
@param string $name
@param string $new_name
@param bool $exec
@return bool | [
"rename",
"a",
"table"
] | 42d8f3f0a117dce29ab3fe30ef46fafb419224e3 | https://github.com/ikkez/f3-schema-builder/blob/42d8f3f0a117dce29ab3fe30ef46fafb419224e3/lib/db/sql/schema.php#L223-L246 |
189,928 | ikkez/f3-schema-builder | lib/db/sql/schema.php | Schema.truncateTable | public function truncateTable($name, $exec = true) {
if (is_object($name) && $name instanceof TableBuilder)
$name = $name->name;
$cmd = array(
'mysql|ibm|pgsql|sybase|dblib|mssql|sqlsrv|odbc' =>
'TRUNCATE TABLE '.$this->db->quotekey($name).';',
'sqlite... | php | public function truncateTable($name, $exec = true) {
if (is_object($name) && $name instanceof TableBuilder)
$name = $name->name;
$cmd = array(
'mysql|ibm|pgsql|sybase|dblib|mssql|sqlsrv|odbc' =>
'TRUNCATE TABLE '.$this->db->quotekey($name).';',
'sqlite... | [
"public",
"function",
"truncateTable",
"(",
"$",
"name",
",",
"$",
"exec",
"=",
"true",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"name",
")",
"&&",
"$",
"name",
"instanceof",
"TableBuilder",
")",
"$",
"name",
"=",
"$",
"name",
"->",
"name",
";",
... | clear a table
@param $name
@param bool $exec
@return array|bool|FALSE|int|string | [
"clear",
"a",
"table"
] | 42d8f3f0a117dce29ab3fe30ef46fafb419224e3 | https://github.com/ikkez/f3-schema-builder/blob/42d8f3f0a117dce29ab3fe30ef46fafb419224e3/lib/db/sql/schema.php#L274-L287 |
189,929 | ikkez/f3-schema-builder | lib/db/sql/schema.php | Schema.isCompatible | public function isCompatible($colType,$colDef) {
$raw_type=$this->findQuery($this->dataTypes[strtoupper($colType)]);
preg_match_all('/(?P<type>\w+)($|\((?P<length>(\d+|(.*)))\))/', $raw_type, $match);
return (bool) preg_match_all('/'.preg_quote($match['type'][0]).'($|\('.
preg_quote(... | php | public function isCompatible($colType,$colDef) {
$raw_type=$this->findQuery($this->dataTypes[strtoupper($colType)]);
preg_match_all('/(?P<type>\w+)($|\((?P<length>(\d+|(.*)))\))/', $raw_type, $match);
return (bool) preg_match_all('/'.preg_quote($match['type'][0]).'($|\('.
preg_quote(... | [
"public",
"function",
"isCompatible",
"(",
"$",
"colType",
",",
"$",
"colDef",
")",
"{",
"$",
"raw_type",
"=",
"$",
"this",
"->",
"findQuery",
"(",
"$",
"this",
"->",
"dataTypes",
"[",
"strtoupper",
"(",
"$",
"colType",
")",
"]",
")",
";",
"preg_match_... | check if a data type is compatible with a given column definition
@param string $colType (i.e: BOOLEAN)
@param string $colDef (i.e: tinyint(1))
@return int | [
"check",
"if",
"a",
"data",
"type",
"is",
"compatible",
"with",
"a",
"given",
"column",
"definition"
] | 42d8f3f0a117dce29ab3fe30ef46fafb419224e3 | https://github.com/ikkez/f3-schema-builder/blob/42d8f3f0a117dce29ab3fe30ef46fafb419224e3/lib/db/sql/schema.php#L295-L300 |
189,930 | ikkez/f3-schema-builder | lib/db/sql/schema.php | TableBuilder.addColumn | public function addColumn($key,$args = null)
{
if ($key instanceof Column) {
$args = $key->getColumnArray();
$key = $key->name;
}
if (array_key_exists($key,$this->columns))
trigger_error(sprintf(self::TEXT_ColumnExists,$key),E_USER_ERROR);
$column ... | php | public function addColumn($key,$args = null)
{
if ($key instanceof Column) {
$args = $key->getColumnArray();
$key = $key->name;
}
if (array_key_exists($key,$this->columns))
trigger_error(sprintf(self::TEXT_ColumnExists,$key),E_USER_ERROR);
$column ... | [
"public",
"function",
"addColumn",
"(",
"$",
"key",
",",
"$",
"args",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"key",
"instanceof",
"Column",
")",
"{",
"$",
"args",
"=",
"$",
"key",
"->",
"getColumnArray",
"(",
")",
";",
"$",
"key",
"=",
"$",
"key"... | add a new column to this table
@param string|Column $key column name or object
@param null|array $args optional config array
@return \DB\SQL\Column | [
"add",
"a",
"new",
"column",
"to",
"this",
"table"
] | 42d8f3f0a117dce29ab3fe30ef46fafb419224e3 | https://github.com/ikkez/f3-schema-builder/blob/42d8f3f0a117dce29ab3fe30ef46fafb419224e3/lib/db/sql/schema.php#L343-L359 |
189,931 | ikkez/f3-schema-builder | lib/db/sql/schema.php | TableBuilder.assembleIndexKey | protected function assembleIndexKey($index_cols,$table_name) {
if (!is_array($index_cols))
$index_cols = array($index_cols);
$name = $table_name.'___'.implode('__', $index_cols);
if (strlen($name)>64)
$name=$table_name.'___'.\Base::instance()->hash(implode('__', $index_cols));
if (strlen($name)>64)
$na... | php | protected function assembleIndexKey($index_cols,$table_name) {
if (!is_array($index_cols))
$index_cols = array($index_cols);
$name = $table_name.'___'.implode('__', $index_cols);
if (strlen($name)>64)
$name=$table_name.'___'.\Base::instance()->hash(implode('__', $index_cols));
if (strlen($name)>64)
$na... | [
"protected",
"function",
"assembleIndexKey",
"(",
"$",
"index_cols",
",",
"$",
"table_name",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"index_cols",
")",
")",
"$",
"index_cols",
"=",
"array",
"(",
"$",
"index_cols",
")",
";",
"$",
"name",
"=",
"$... | create index name from one or more given column names, max. 64 char lengths
@param string|array $index_cols
@return string | [
"create",
"index",
"name",
"from",
"one",
"or",
"more",
"given",
"column",
"names",
"max",
".",
"64",
"char",
"lengths"
] | 42d8f3f0a117dce29ab3fe30ef46fafb419224e3 | https://github.com/ikkez/f3-schema-builder/blob/42d8f3f0a117dce29ab3fe30ef46fafb419224e3/lib/db/sql/schema.php#L397-L406 |
189,932 | ikkez/f3-schema-builder | lib/db/sql/schema.php | TableModifier._sqlite_increment_trigger | public function _sqlite_increment_trigger($pkey) {
$table = $this->db->quotekey($this->name);
$pkey = $this->db->quotekey($pkey);
$triggerName = $this->db->quotekey($this->name.'_insert');
$queries[] = "DROP TRIGGER IF EXISTS $triggerName;";
$queries[] = 'CREATE TRIGGER '.$trigge... | php | public function _sqlite_increment_trigger($pkey) {
$table = $this->db->quotekey($this->name);
$pkey = $this->db->quotekey($pkey);
$triggerName = $this->db->quotekey($this->name.'_insert');
$queries[] = "DROP TRIGGER IF EXISTS $triggerName;";
$queries[] = 'CREATE TRIGGER '.$trigge... | [
"public",
"function",
"_sqlite_increment_trigger",
"(",
"$",
"pkey",
")",
"{",
"$",
"table",
"=",
"$",
"this",
"->",
"db",
"->",
"quotekey",
"(",
"$",
"this",
"->",
"name",
")",
";",
"$",
"pkey",
"=",
"$",
"this",
"->",
"db",
"->",
"quotekey",
"(",
... | create an insert trigger to work-a-round auto-incrementation in composite primary keys
@param $pkey
@return array | [
"create",
"an",
"insert",
"trigger",
"to",
"work",
"-",
"a",
"-",
"round",
"auto",
"-",
"incrementation",
"in",
"composite",
"primary",
"keys"
] | 42d8f3f0a117dce29ab3fe30ef46fafb419224e3 | https://github.com/ikkez/f3-schema-builder/blob/42d8f3f0a117dce29ab3fe30ef46fafb419224e3/lib/db/sql/schema.php#L751-L763 |
189,933 | ikkez/f3-schema-builder | lib/db/sql/schema.php | TableModifier.getCols | public function getCols($types = false)
{
$schema = $this->db->schema($this->name, null, 0);
if (!$types)
return array_keys($schema);
else
foreach ($schema as $name => &$cols) {
$default = ($cols['default'] === '') ? null : $cols['default'];
... | php | public function getCols($types = false)
{
$schema = $this->db->schema($this->name, null, 0);
if (!$types)
return array_keys($schema);
else
foreach ($schema as $name => &$cols) {
$default = ($cols['default'] === '') ? null : $cols['default'];
... | [
"public",
"function",
"getCols",
"(",
"$",
"types",
"=",
"false",
")",
"{",
"$",
"schema",
"=",
"$",
"this",
"->",
"db",
"->",
"schema",
"(",
"$",
"this",
"->",
"name",
",",
"null",
",",
"0",
")",
";",
"if",
"(",
"!",
"$",
"types",
")",
"return... | get columns of a table
@param bool $types
@return array | [
"get",
"columns",
"of",
"a",
"table"
] | 42d8f3f0a117dce29ab3fe30ef46fafb419224e3 | https://github.com/ikkez/f3-schema-builder/blob/42d8f3f0a117dce29ab3fe30ef46fafb419224e3/lib/db/sql/schema.php#L770-L801 |
189,934 | ikkez/f3-schema-builder | lib/db/sql/schema.php | TableModifier.isCompatible | public function isCompatible($colType,$column) {
$cols = $this->getCols(true);
return $this->schema->isCompatible($colType,$cols[$column]['type']);
} | php | public function isCompatible($colType,$column) {
$cols = $this->getCols(true);
return $this->schema->isCompatible($colType,$cols[$column]['type']);
} | [
"public",
"function",
"isCompatible",
"(",
"$",
"colType",
",",
"$",
"column",
")",
"{",
"$",
"cols",
"=",
"$",
"this",
"->",
"getCols",
"(",
"true",
")",
";",
"return",
"$",
"this",
"->",
"schema",
"->",
"isCompatible",
"(",
"$",
"colType",
",",
"$"... | check if a data type is compatible with an existing column type
@param string $colType (i.e: BOOLEAN)
@param string $column (i.e: active)
@return bool | [
"check",
"if",
"a",
"data",
"type",
"is",
"compatible",
"with",
"an",
"existing",
"column",
"type"
] | 42d8f3f0a117dce29ab3fe30ef46fafb419224e3 | https://github.com/ikkez/f3-schema-builder/blob/42d8f3f0a117dce29ab3fe30ef46fafb419224e3/lib/db/sql/schema.php#L809-L812 |
189,935 | ikkez/f3-schema-builder | lib/db/sql/schema.php | TableModifier.dropColumn | public function dropColumn($name)
{
$colTypes = $this->getCols(true);
// check if column exists
if (!in_array($name, array_keys($colTypes))) return true;
if (preg_match('/sqlite2?/', $this->db->driver())) {
// SQlite does not support drop column directly
$this... | php | public function dropColumn($name)
{
$colTypes = $this->getCols(true);
// check if column exists
if (!in_array($name, array_keys($colTypes))) return true;
if (preg_match('/sqlite2?/', $this->db->driver())) {
// SQlite does not support drop column directly
$this... | [
"public",
"function",
"dropColumn",
"(",
"$",
"name",
")",
"{",
"$",
"colTypes",
"=",
"$",
"this",
"->",
"getCols",
"(",
"true",
")",
";",
"// check if column exists",
"if",
"(",
"!",
"in_array",
"(",
"$",
"name",
",",
"array_keys",
"(",
"$",
"colTypes",... | removes a column from a table
@param string $name
@return bool | [
"removes",
"a",
"column",
"from",
"a",
"table"
] | 42d8f3f0a117dce29ab3fe30ef46fafb419224e3 | https://github.com/ikkez/f3-schema-builder/blob/42d8f3f0a117dce29ab3fe30ef46fafb419224e3/lib/db/sql/schema.php#L819-L840 |
189,936 | ikkez/f3-schema-builder | lib/db/sql/schema.php | TableModifier.renameColumn | public function renameColumn($name, $new_name)
{
$existing_columns = $this->getCols(true);
// check if column is already existing
if (!in_array($name, array_keys($existing_columns)))
trigger_error('cannot rename column. it does not exist.',E_USER_ERROR);
if (in_array($new... | php | public function renameColumn($name, $new_name)
{
$existing_columns = $this->getCols(true);
// check if column is already existing
if (!in_array($name, array_keys($existing_columns)))
trigger_error('cannot rename column. it does not exist.',E_USER_ERROR);
if (in_array($new... | [
"public",
"function",
"renameColumn",
"(",
"$",
"name",
",",
"$",
"new_name",
")",
"{",
"$",
"existing_columns",
"=",
"$",
"this",
"->",
"getCols",
"(",
"true",
")",
";",
"// check if column is already existing",
"if",
"(",
"!",
"in_array",
"(",
"$",
"name",... | rename a column
@param $name
@param $new_name
@return void | [
"rename",
"a",
"column"
] | 42d8f3f0a117dce29ab3fe30ef46fafb419224e3 | https://github.com/ikkez/f3-schema-builder/blob/42d8f3f0a117dce29ab3fe30ef46fafb419224e3/lib/db/sql/schema.php#L848-L882 |
189,937 | ikkez/f3-schema-builder | lib/db/sql/schema.php | TableModifier.updateColumn | public function updateColumn($name, $datatype, $force = false)
{
if ($datatype instanceof Column) {
$col = $datatype;
$datatype = $col->type;
$force = $col->passThrough;
}
if(!$force)
$datatype = $this->findQuery($this->schema->dataTypes[strtou... | php | public function updateColumn($name, $datatype, $force = false)
{
if ($datatype instanceof Column) {
$col = $datatype;
$datatype = $col->type;
$force = $col->passThrough;
}
if(!$force)
$datatype = $this->findQuery($this->schema->dataTypes[strtou... | [
"public",
"function",
"updateColumn",
"(",
"$",
"name",
",",
"$",
"datatype",
",",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"datatype",
"instanceof",
"Column",
")",
"{",
"$",
"col",
"=",
"$",
"datatype",
";",
"$",
"datatype",
"=",
"$",
... | modifies column datatype
@param string $name
@param string|Column $datatype
@param bool $force | [
"modifies",
"column",
"datatype"
] | 42d8f3f0a117dce29ab3fe30ef46fafb419224e3 | https://github.com/ikkez/f3-schema-builder/blob/42d8f3f0a117dce29ab3fe30ef46fafb419224e3/lib/db/sql/schema.php#L890-L936 |
189,938 | ikkez/f3-schema-builder | lib/db/sql/schema.php | TableModifier.dropIndex | public function dropIndex($name)
{
if (is_array($name))
$name = $this->name.'___'.implode('__', $name);
elseif(!is_int(strpos($name,'___')))
$name = $this->name.'___'.$name;
$name = $this->db->quotekey($name);
$table = $this->db->quotekey($this->name);
... | php | public function dropIndex($name)
{
if (is_array($name))
$name = $this->name.'___'.implode('__', $name);
elseif(!is_int(strpos($name,'___')))
$name = $this->name.'___'.$name;
$name = $this->db->quotekey($name);
$table = $this->db->quotekey($this->name);
... | [
"public",
"function",
"dropIndex",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"name",
")",
")",
"$",
"name",
"=",
"$",
"this",
"->",
"name",
".",
"'___'",
".",
"implode",
"(",
"'__'",
",",
"$",
"name",
")",
";",
"elseif",
"(",
... | drop a column index
@param string|array $name | [
"drop",
"a",
"column",
"index"
] | 42d8f3f0a117dce29ab3fe30ef46fafb419224e3 | https://github.com/ikkez/f3-schema-builder/blob/42d8f3f0a117dce29ab3fe30ef46fafb419224e3/lib/db/sql/schema.php#L959-L977 |
189,939 | ikkez/f3-schema-builder | lib/db/sql/schema.php | TableModifier.listIndex | public function listIndex()
{
$table = $this->db->quotekey($this->name);
$cmd = array(
'sqlite2?' =>
"PRAGMA index_list($table);",
'mysql' =>
"SHOW INDEX FROM $table;",
'mssql|sybase|dblib|sqlsrv' =>
"select * from s... | php | public function listIndex()
{
$table = $this->db->quotekey($this->name);
$cmd = array(
'sqlite2?' =>
"PRAGMA index_list($table);",
'mysql' =>
"SHOW INDEX FROM $table;",
'mssql|sybase|dblib|sqlsrv' =>
"select * from s... | [
"public",
"function",
"listIndex",
"(",
")",
"{",
"$",
"table",
"=",
"$",
"this",
"->",
"db",
"->",
"quotekey",
"(",
"$",
"this",
"->",
"name",
")",
";",
"$",
"cmd",
"=",
"array",
"(",
"'sqlite2?'",
"=>",
"\"PRAGMA index_list($table);\"",
",",
"'mysql'",... | returns table indexes as assoc array
@return array | [
"returns",
"table",
"indexes",
"as",
"assoc",
"array"
] | 42d8f3f0a117dce29ab3fe30ef46fafb419224e3 | https://github.com/ikkez/f3-schema-builder/blob/42d8f3f0a117dce29ab3fe30ef46fafb419224e3/lib/db/sql/schema.php#L983-L1015 |
189,940 | ikkez/f3-schema-builder | lib/db/sql/schema.php | TableModifier.rename | public function rename($new_name, $exec = true) {
$query = $this->schema->renameTable($this->name, $new_name, $exec);
$this->name = $new_name;
return ($exec) ? $this : $query;
} | php | public function rename($new_name, $exec = true) {
$query = $this->schema->renameTable($this->name, $new_name, $exec);
$this->name = $new_name;
return ($exec) ? $this : $query;
} | [
"public",
"function",
"rename",
"(",
"$",
"new_name",
",",
"$",
"exec",
"=",
"true",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"schema",
"->",
"renameTable",
"(",
"$",
"this",
"->",
"name",
",",
"$",
"new_name",
",",
"$",
"exec",
")",
";",
... | rename this table
@param string $new_name
@param bool $exec
@return $this|bool | [
"rename",
"this",
"table"
] | 42d8f3f0a117dce29ab3fe30ef46fafb419224e3 | https://github.com/ikkez/f3-schema-builder/blob/42d8f3f0a117dce29ab3fe30ef46fafb419224e3/lib/db/sql/schema.php#L1023-L1027 |
189,941 | ikkez/f3-schema-builder | lib/db/sql/schema.php | Column.copyfrom | public function copyfrom($args) {
if (($args || \Base::instance()->exists($args,$args))
&& is_array($args))
foreach ($args as $arg => $val)
$this->{$arg} = $val;
} | php | public function copyfrom($args) {
if (($args || \Base::instance()->exists($args,$args))
&& is_array($args))
foreach ($args as $arg => $val)
$this->{$arg} = $val;
} | [
"public",
"function",
"copyfrom",
"(",
"$",
"args",
")",
"{",
"if",
"(",
"(",
"$",
"args",
"||",
"\\",
"Base",
"::",
"instance",
"(",
")",
"->",
"exists",
"(",
"$",
"args",
",",
"$",
"args",
")",
")",
"&&",
"is_array",
"(",
"$",
"args",
")",
")... | feed column from array or hive key
@param string|array $args | [
"feed",
"column",
"from",
"array",
"or",
"hive",
"key"
] | 42d8f3f0a117dce29ab3fe30ef46fafb419224e3 | https://github.com/ikkez/f3-schema-builder/blob/42d8f3f0a117dce29ab3fe30ef46fafb419224e3/lib/db/sql/schema.php#L1189-L1194 |
189,942 | ikkez/f3-schema-builder | lib/db/sql/schema.php | Column.getColumnArray | public function getColumnArray() {
$fields = array('name','type','passThrough','default','nullable',
'index','unique','after','pkey');
$fields = array_flip($fields);
foreach($fields as $key => &$val)
$val = $this->{$key};
unset($val);
return $f... | php | public function getColumnArray() {
$fields = array('name','type','passThrough','default','nullable',
'index','unique','after','pkey');
$fields = array_flip($fields);
foreach($fields as $key => &$val)
$val = $this->{$key};
unset($val);
return $f... | [
"public",
"function",
"getColumnArray",
"(",
")",
"{",
"$",
"fields",
"=",
"array",
"(",
"'name'",
",",
"'type'",
",",
"'passThrough'",
",",
"'default'",
",",
"'nullable'",
",",
"'index'",
",",
"'unique'",
",",
"'after'",
",",
"'pkey'",
")",
";",
"$",
"f... | returns an array of this column configuration
@return array | [
"returns",
"an",
"array",
"of",
"this",
"column",
"configuration"
] | 42d8f3f0a117dce29ab3fe30ef46fafb419224e3 | https://github.com/ikkez/f3-schema-builder/blob/42d8f3f0a117dce29ab3fe30ef46fafb419224e3/lib/db/sql/schema.php#L1200-L1208 |
189,943 | ikkez/f3-schema-builder | lib/db/sql/schema.php | Column.getTypeVal | public function getTypeVal() {
if (!$this->type)
trigger_error(sprintf('Cannot build a column query for `%s`: no column type set',$this->name),E_USER_ERROR);
if ($this->passThrough)
$this->type_val = $this->type;
else {
$this->type_val = $this->findQuery($this... | php | public function getTypeVal() {
if (!$this->type)
trigger_error(sprintf('Cannot build a column query for `%s`: no column type set',$this->name),E_USER_ERROR);
if ($this->passThrough)
$this->type_val = $this->type;
else {
$this->type_val = $this->findQuery($this... | [
"public",
"function",
"getTypeVal",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"type",
")",
"trigger_error",
"(",
"sprintf",
"(",
"'Cannot build a column query for `%s`: no column type set'",
",",
"$",
"this",
"->",
"name",
")",
",",
"E_USER_ERROR",
")",
... | return resolved column datatype
@return bool|string | [
"return",
"resolved",
"column",
"datatype"
] | 42d8f3f0a117dce29ab3fe30ef46fafb419224e3 | https://github.com/ikkez/f3-schema-builder/blob/42d8f3f0a117dce29ab3fe30ef46fafb419224e3/lib/db/sql/schema.php#L1214-L1233 |
189,944 | ikkez/f3-schema-builder | lib/db/sql/schema.php | Column.getColumnQuery | public function getColumnQuery() {
// prepare column types
$type_val = $this->getTypeVal();
// build query
$query = $this->db->quotekey($this->name).' '.$type_val.' '.
$this->getNullable();
// unify default for booleans
if (preg_match('/bool/i', $type_val) && ... | php | public function getColumnQuery() {
// prepare column types
$type_val = $this->getTypeVal();
// build query
$query = $this->db->quotekey($this->name).' '.$type_val.' '.
$this->getNullable();
// unify default for booleans
if (preg_match('/bool/i', $type_val) && ... | [
"public",
"function",
"getColumnQuery",
"(",
")",
"{",
"// prepare column types",
"$",
"type_val",
"=",
"$",
"this",
"->",
"getTypeVal",
"(",
")",
";",
"// build query",
"$",
"query",
"=",
"$",
"this",
"->",
"db",
"->",
"quotekey",
"(",
"$",
"this",
"->",
... | generate SQL column definition query
@return bool|string | [
"generate",
"SQL",
"column",
"definition",
"query"
] | 42d8f3f0a117dce29ab3fe30ef46fafb419224e3 | https://github.com/ikkez/f3-schema-builder/blob/42d8f3f0a117dce29ab3fe30ef46fafb419224e3/lib/db/sql/schema.php#L1239-L1266 |
189,945 | ikkez/f3-schema-builder | lib/db/sql/schema.php | Column.getDefault | public function getDefault() {
// timestamp default
if ($this->default === Schema::DF_CURRENT_TIMESTAMP) {
// check for right datatpye
$stamp_type = $this->findQuery($this->schema->dataTypes['TIMESTAMP']);
if ($this->type != 'TIMESTAMP' &&
($this->pass... | php | public function getDefault() {
// timestamp default
if ($this->default === Schema::DF_CURRENT_TIMESTAMP) {
// check for right datatpye
$stamp_type = $this->findQuery($this->schema->dataTypes['TIMESTAMP']);
if ($this->type != 'TIMESTAMP' &&
($this->pass... | [
"public",
"function",
"getDefault",
"(",
")",
"{",
"// timestamp default",
"if",
"(",
"$",
"this",
"->",
"default",
"===",
"Schema",
"::",
"DF_CURRENT_TIMESTAMP",
")",
"{",
"// check for right datatpye",
"$",
"stamp_type",
"=",
"$",
"this",
"->",
"findQuery",
"(... | return query part for default value
@return string | [
"return",
"query",
"part",
"for",
"default",
"value"
] | 42d8f3f0a117dce29ab3fe30ef46fafb419224e3 | https://github.com/ikkez/f3-schema-builder/blob/42d8f3f0a117dce29ab3fe30ef46fafb419224e3/lib/db/sql/schema.php#L1280-L1299 |
189,946 | jwage/php-apns | src/JWage/APNS/SocketClient.php | SocketClient.write | public function write($binaryMessage)
{
if (strlen($binaryMessage) > self::PAYLOAD_MAX_BYTES) {
throw new \InvalidArgumentException(
sprintf('The maximum size allowed for a notification payload is %s bytes; Apple Push Notification Service refuses any notification that exceeds thi... | php | public function write($binaryMessage)
{
if (strlen($binaryMessage) > self::PAYLOAD_MAX_BYTES) {
throw new \InvalidArgumentException(
sprintf('The maximum size allowed for a notification payload is %s bytes; Apple Push Notification Service refuses any notification that exceeds thi... | [
"public",
"function",
"write",
"(",
"$",
"binaryMessage",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"binaryMessage",
")",
">",
"self",
"::",
"PAYLOAD_MAX_BYTES",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'The maximum size... | Writes a binary message to apns.
@param string $binaryMessage
@return integer Returns the number of bytes written, or FALSE on error. | [
"Writes",
"a",
"binary",
"message",
"to",
"apns",
"."
] | 75d8b0f4722cf4342a42d0fc4e0619c32550b955 | https://github.com/jwage/php-apns/blob/75d8b0f4722cf4342a42d0fc4e0619c32550b955/src/JWage/APNS/SocketClient.php#L68-L77 |
189,947 | yii2mod/yii2-array-query | QueryProcessor.php | QueryProcessor.applyOrderBy | protected function applyOrderBy(array $data, $orderBy)
{
if (!empty($orderBy)) {
ArrayHelper::multisort($data, array_keys($orderBy), array_values($orderBy));
}
return $data;
} | php | protected function applyOrderBy(array $data, $orderBy)
{
if (!empty($orderBy)) {
ArrayHelper::multisort($data, array_keys($orderBy), array_values($orderBy));
}
return $data;
} | [
"protected",
"function",
"applyOrderBy",
"(",
"array",
"$",
"data",
",",
"$",
"orderBy",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"orderBy",
")",
")",
"{",
"ArrayHelper",
"::",
"multisort",
"(",
"$",
"data",
",",
"array_keys",
"(",
"$",
"orderBy",
... | Applies sort for given data.
@param array $data raw data
@param array|null $orderBy order by
@return array sorted data | [
"Applies",
"sort",
"for",
"given",
"data",
"."
] | 0a82e9a1eebc0a4001d1f9c6f67958a88ce9191e | https://github.com/yii2mod/yii2-array-query/blob/0a82e9a1eebc0a4001d1f9c6f67958a88ce9191e/QueryProcessor.php#L76-L83 |
189,948 | yii2mod/yii2-array-query | QueryProcessor.php | QueryProcessor.applyLimit | protected function applyLimit(array $data, $limit, $offset)
{
if (empty($limit) && empty($offset)) {
return $data;
}
if (!ctype_digit((string) $limit)) {
$limit = null;
}
if (!ctype_digit((string) $offset)) {
$offset = 0;
}
... | php | protected function applyLimit(array $data, $limit, $offset)
{
if (empty($limit) && empty($offset)) {
return $data;
}
if (!ctype_digit((string) $limit)) {
$limit = null;
}
if (!ctype_digit((string) $offset)) {
$offset = 0;
}
... | [
"protected",
"function",
"applyLimit",
"(",
"array",
"$",
"data",
",",
"$",
"limit",
",",
"$",
"offset",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"limit",
")",
"&&",
"empty",
"(",
"$",
"offset",
")",
")",
"{",
"return",
"$",
"data",
";",
"}",
"if"... | Applies limit and offset for given data.
@param array $data raw data
@param int|null $limit limit value
@param int|null $offset offset value
@return array data | [
"Applies",
"limit",
"and",
"offset",
"for",
"given",
"data",
"."
] | 0a82e9a1eebc0a4001d1f9c6f67958a88ce9191e | https://github.com/yii2mod/yii2-array-query/blob/0a82e9a1eebc0a4001d1f9c6f67958a88ce9191e/QueryProcessor.php#L94-L109 |
189,949 | yii2mod/yii2-array-query | QueryProcessor.php | QueryProcessor.filterCondition | public function filterCondition(array $data, $condition)
{
if (empty($condition)) {
return $data;
}
if (!is_array($condition)) {
throw new InvalidParamException('Condition must be an array');
}
if (isset($condition[0])) { // operator format: operator... | php | public function filterCondition(array $data, $condition)
{
if (empty($condition)) {
return $data;
}
if (!is_array($condition)) {
throw new InvalidParamException('Condition must be an array');
}
if (isset($condition[0])) { // operator format: operator... | [
"public",
"function",
"filterCondition",
"(",
"array",
"$",
"data",
",",
"$",
"condition",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"condition",
")",
")",
"{",
"return",
"$",
"data",
";",
"}",
"if",
"(",
"!",
"is_array",
"(",
"$",
"condition",
")",
... | Applies filter conditions.
@param array $data data to be filtered
@param array $condition filter condition
@return array filtered data
@throws InvalidParamException | [
"Applies",
"filter",
"conditions",
"."
] | 0a82e9a1eebc0a4001d1f9c6f67958a88ce9191e | https://github.com/yii2mod/yii2-array-query/blob/0a82e9a1eebc0a4001d1f9c6f67958a88ce9191e/QueryProcessor.php#L134-L158 |
189,950 | yii2mod/yii2-array-query | QueryProcessor.php | QueryProcessor.filterHashCondition | public function filterHashCondition(array $data, $condition)
{
foreach ($condition as $column => $value) {
if (is_array($value)) {
// IN condition
$data = $this->filterInCondition($data, 'IN', [$column, $value]);
} else {
$data = array_... | php | public function filterHashCondition(array $data, $condition)
{
foreach ($condition as $column => $value) {
if (is_array($value)) {
// IN condition
$data = $this->filterInCondition($data, 'IN', [$column, $value]);
} else {
$data = array_... | [
"public",
"function",
"filterHashCondition",
"(",
"array",
"$",
"data",
",",
"$",
"condition",
")",
"{",
"foreach",
"(",
"$",
"condition",
"as",
"$",
"column",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"//... | Applies a condition based on column-value pairs.
@param array $data data to be filtered
@param array $condition the condition specification
@return array filtered data | [
"Applies",
"a",
"condition",
"based",
"on",
"column",
"-",
"value",
"pairs",
"."
] | 0a82e9a1eebc0a4001d1f9c6f67958a88ce9191e | https://github.com/yii2mod/yii2-array-query/blob/0a82e9a1eebc0a4001d1f9c6f67958a88ce9191e/QueryProcessor.php#L168-L186 |
189,951 | yii2mod/yii2-array-query | QueryProcessor.php | QueryProcessor.filterAndCondition | protected function filterAndCondition(array $data, $operator, $operands)
{
foreach ($operands as $operand) {
if (is_array($operand)) {
$data = $this->filterCondition($data, $operand);
}
}
return $data;
} | php | protected function filterAndCondition(array $data, $operator, $operands)
{
foreach ($operands as $operand) {
if (is_array($operand)) {
$data = $this->filterCondition($data, $operand);
}
}
return $data;
} | [
"protected",
"function",
"filterAndCondition",
"(",
"array",
"$",
"data",
",",
"$",
"operator",
",",
"$",
"operands",
")",
"{",
"foreach",
"(",
"$",
"operands",
"as",
"$",
"operand",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"operand",
")",
")",
"{",
... | Applies 2 or more conditions using 'AND' logic.
@param array $data data to be filtered
@param string $operator operator
@param array $operands conditions to be united
@return array filtered data | [
"Applies",
"2",
"or",
"more",
"conditions",
"using",
"AND",
"logic",
"."
] | 0a82e9a1eebc0a4001d1f9c6f67958a88ce9191e | https://github.com/yii2mod/yii2-array-query/blob/0a82e9a1eebc0a4001d1f9c6f67958a88ce9191e/QueryProcessor.php#L197-L206 |
189,952 | yii2mod/yii2-array-query | QueryProcessor.php | QueryProcessor.filterOrCondition | protected function filterOrCondition(array $data, $operator, $operands)
{
$parts = [];
foreach ($operands as $operand) {
if (is_array($operand)) {
$parts[] = $this->filterCondition($data, $operand);
}
}
if (empty($parts)) {
return ... | php | protected function filterOrCondition(array $data, $operator, $operands)
{
$parts = [];
foreach ($operands as $operand) {
if (is_array($operand)) {
$parts[] = $this->filterCondition($data, $operand);
}
}
if (empty($parts)) {
return ... | [
"protected",
"function",
"filterOrCondition",
"(",
"array",
"$",
"data",
",",
"$",
"operator",
",",
"$",
"operands",
")",
"{",
"$",
"parts",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"operands",
"as",
"$",
"operand",
")",
"{",
"if",
"(",
"is_array",
"... | Applies 2 or more conditions using 'OR' logic.
@param array $data data to be filtered
@param string $operator operator
@param array $operands conditions to be united
@return array filtered data | [
"Applies",
"2",
"or",
"more",
"conditions",
"using",
"OR",
"logic",
"."
] | 0a82e9a1eebc0a4001d1f9c6f67958a88ce9191e | https://github.com/yii2mod/yii2-array-query/blob/0a82e9a1eebc0a4001d1f9c6f67958a88ce9191e/QueryProcessor.php#L217-L239 |
189,953 | yii2mod/yii2-array-query | QueryProcessor.php | QueryProcessor.filterNotCondition | protected function filterNotCondition(array $data, $operator, $operands)
{
if (count($operands) != 1) {
throw new InvalidParamException("Operator '$operator' requires exactly one operand.");
}
$operand = reset($operands);
$filteredData = $this->filterCondition($data, $op... | php | protected function filterNotCondition(array $data, $operator, $operands)
{
if (count($operands) != 1) {
throw new InvalidParamException("Operator '$operator' requires exactly one operand.");
}
$operand = reset($operands);
$filteredData = $this->filterCondition($data, $op... | [
"protected",
"function",
"filterNotCondition",
"(",
"array",
"$",
"data",
",",
"$",
"operator",
",",
"$",
"operands",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"operands",
")",
"!=",
"1",
")",
"{",
"throw",
"new",
"InvalidParamException",
"(",
"\"Operator '$... | Inverts a filter condition.
@param array $data data to be filtered
@param string $operator operator
@param array $operands operands to be inverted
@return array filtered data
@throws InvalidParamException if wrong number of operands have been given | [
"Inverts",
"a",
"filter",
"condition",
"."
] | 0a82e9a1eebc0a4001d1f9c6f67958a88ce9191e | https://github.com/yii2mod/yii2-array-query/blob/0a82e9a1eebc0a4001d1f9c6f67958a88ce9191e/QueryProcessor.php#L252-L276 |
189,954 | yii2mod/yii2-array-query | QueryProcessor.php | QueryProcessor.filterBetweenCondition | protected function filterBetweenCondition(array $data, $operator, $operands)
{
if (!isset($operands[0], $operands[1], $operands[2])) {
throw new InvalidParamException("Operator '$operator' requires three operands.");
}
list($column, $value1, $value2) = $operands;
if (st... | php | protected function filterBetweenCondition(array $data, $operator, $operands)
{
if (!isset($operands[0], $operands[1], $operands[2])) {
throw new InvalidParamException("Operator '$operator' requires three operands.");
}
list($column, $value1, $value2) = $operands;
if (st... | [
"protected",
"function",
"filterBetweenCondition",
"(",
"array",
"$",
"data",
",",
"$",
"operator",
",",
"$",
"operands",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"operands",
"[",
"0",
"]",
",",
"$",
"operands",
"[",
"1",
"]",
",",
"$",
"operands... | Applies `BETWEEN` condition.
@param array $data data to be filtered
@param string $operator operator
@param array $operands the first operand is the column name. The second and third operands
describe the interval that column value should be in
@return array filtered data
@throws InvalidParamException if wrong numbe... | [
"Applies",
"BETWEEN",
"condition",
"."
] | 0a82e9a1eebc0a4001d1f9c6f67958a88ce9191e | https://github.com/yii2mod/yii2-array-query/blob/0a82e9a1eebc0a4001d1f9c6f67958a88ce9191e/QueryProcessor.php#L290-L307 |
189,955 | yii2mod/yii2-array-query | QueryProcessor.php | QueryProcessor.filterInCondition | protected function filterInCondition(array $data, $operator, $operands)
{
if (!isset($operands[0], $operands[1])) {
throw new InvalidParamException("Operator '$operator' requires two operands.");
}
list($column, $values) = $operands;
if ($values === [] || $column === []... | php | protected function filterInCondition(array $data, $operator, $operands)
{
if (!isset($operands[0], $operands[1])) {
throw new InvalidParamException("Operator '$operator' requires two operands.");
}
list($column, $values) = $operands;
if ($values === [] || $column === []... | [
"protected",
"function",
"filterInCondition",
"(",
"array",
"$",
"data",
",",
"$",
"operator",
",",
"$",
"operands",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"operands",
"[",
"0",
"]",
",",
"$",
"operands",
"[",
"1",
"]",
")",
")",
"{",
"throw"... | Applies 'IN' condition.
@param array $data data to be filtered
@param string $operator operator
@param array $operands the first operand is the column name.
The second operand is an array of values that column value should be among
@return array filtered data
@throws InvalidParamException if wrong number of operands... | [
"Applies",
"IN",
"condition",
"."
] | 0a82e9a1eebc0a4001d1f9c6f67958a88ce9191e | https://github.com/yii2mod/yii2-array-query/blob/0a82e9a1eebc0a4001d1f9c6f67958a88ce9191e/QueryProcessor.php#L321-L358 |
189,956 | yii2mod/yii2-array-query | QueryProcessor.php | QueryProcessor.filterLikeCondition | protected function filterLikeCondition(array $data, $operator, $operands)
{
if (!isset($operands[0], $operands[1])) {
throw new InvalidParamException("Operator '$operator' requires two operands.");
}
list($column, $values) = $operands;
if (!is_array($values)) {
... | php | protected function filterLikeCondition(array $data, $operator, $operands)
{
if (!isset($operands[0], $operands[1])) {
throw new InvalidParamException("Operator '$operator' requires two operands.");
}
list($column, $values) = $operands;
if (!is_array($values)) {
... | [
"protected",
"function",
"filterLikeCondition",
"(",
"array",
"$",
"data",
",",
"$",
"operator",
",",
"$",
"operands",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"operands",
"[",
"0",
"]",
",",
"$",
"operands",
"[",
"1",
"]",
")",
")",
"{",
"thro... | Applies 'LIKE' condition.
@param array $data data to be filtered
@param string $operator operator
@param array $operands the first operand is the column name. The second operand is a single value
or an array of values that column value should be compared with
@return array filtered data
@throws InvalidParamException... | [
"Applies",
"LIKE",
"condition",
"."
] | 0a82e9a1eebc0a4001d1f9c6f67958a88ce9191e | https://github.com/yii2mod/yii2-array-query/blob/0a82e9a1eebc0a4001d1f9c6f67958a88ce9191e/QueryProcessor.php#L372-L440 |
189,957 | yii2mod/yii2-array-query | QueryProcessor.php | QueryProcessor.filterCallbackCondition | public function filterCallbackCondition(array $data, $operator, $operands)
{
if (count($operands) != 1) {
throw new InvalidParamException("Operator '$operator' requires exactly one operand.");
}
$callback = reset($operands);
return array_filter($data, $callback);
} | php | public function filterCallbackCondition(array $data, $operator, $operands)
{
if (count($operands) != 1) {
throw new InvalidParamException("Operator '$operator' requires exactly one operand.");
}
$callback = reset($operands);
return array_filter($data, $callback);
} | [
"public",
"function",
"filterCallbackCondition",
"(",
"array",
"$",
"data",
",",
"$",
"operator",
",",
"$",
"operands",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"operands",
")",
"!=",
"1",
")",
"{",
"throw",
"new",
"InvalidParamException",
"(",
"\"Operator ... | Applies 'CALLBACK' condition.
@param array $data data to be filtered
@param string $operator operator
@param array $operands the only one operand is the PHP callback, which should be compatible with
`array_filter()` PHP function, e.g.:
```php
function ($row) {
//return bool whether row matches condition or not
}
```
... | [
"Applies",
"CALLBACK",
"condition",
"."
] | 0a82e9a1eebc0a4001d1f9c6f67958a88ce9191e | https://github.com/yii2mod/yii2-array-query/blob/0a82e9a1eebc0a4001d1f9c6f67958a88ce9191e/QueryProcessor.php#L462-L471 |
189,958 | Stolz/laravel-html-tidy | src/Tidy.php | Tidy.parse | public function parse($input)
{
// Parse input
$tidy = new PhpTidy;
$tidy->parseString($input, $this->tidy_options, $this->encoding);
$tidy->cleanRepair();
// Set doctype
$output = $this->doctype . "\n" . preg_replace('_ xmlns="http://www.w3.org/1999/xhtml"_', null, $tidy, 1);
// Append errors
if ($t... | php | public function parse($input)
{
// Parse input
$tidy = new PhpTidy;
$tidy->parseString($input, $this->tidy_options, $this->encoding);
$tidy->cleanRepair();
// Set doctype
$output = $this->doctype . "\n" . preg_replace('_ xmlns="http://www.w3.org/1999/xhtml"_', null, $tidy, 1);
// Append errors
if ($t... | [
"public",
"function",
"parse",
"(",
"$",
"input",
")",
"{",
"// Parse input",
"$",
"tidy",
"=",
"new",
"PhpTidy",
";",
"$",
"tidy",
"->",
"parseString",
"(",
"$",
"input",
",",
"$",
"this",
"->",
"tidy_options",
",",
"$",
"this",
"->",
"encoding",
")",... | Parse response with PHP's HTML Tidy extension
@param string
@return string | [
"Parse",
"response",
"with",
"PHP",
"s",
"HTML",
"Tidy",
"extension"
] | e559ce9a3cbd8f690d27c0eabc6385bb50882cc1 | https://github.com/Stolz/laravel-html-tidy/blob/e559ce9a3cbd8f690d27c0eabc6385bb50882cc1/src/Tidy.php#L111-L138 |
189,959 | ZF-Commons/ZfcAdmin | src/Module.php | Module.selectLayoutBasedOnRoute | public function selectLayoutBasedOnRoute(MvcEvent $e)
{
/** @var \Zend\Mvc\Application $app */
$app = $e->getParam('application');
$sm = $app->getServiceManager();
$config = $sm->get('config');
if (false === $config['zfcadmin']['use_admin_layout']) {
retur... | php | public function selectLayoutBasedOnRoute(MvcEvent $e)
{
/** @var \Zend\Mvc\Application $app */
$app = $e->getParam('application');
$sm = $app->getServiceManager();
$config = $sm->get('config');
if (false === $config['zfcadmin']['use_admin_layout']) {
retur... | [
"public",
"function",
"selectLayoutBasedOnRoute",
"(",
"MvcEvent",
"$",
"e",
")",
"{",
"/** @var \\Zend\\Mvc\\Application $app */",
"$",
"app",
"=",
"$",
"e",
"->",
"getParam",
"(",
"'application'",
")",
";",
"$",
"sm",
"=",
"$",
"app",
"->",
"getServiceManager"... | Select the admin layout based on route name
@param MvcEvent $e
@return void | [
"Select",
"the",
"admin",
"layout",
"based",
"on",
"route",
"name"
] | 84c737426d7e4333de35081225aff675ef1ea488 | https://github.com/ZF-Commons/ZfcAdmin/blob/84c737426d7e4333de35081225aff675ef1ea488/src/Module.php#L127-L149 |
189,960 | adamnicholson/flatbase | src/Query/Query.php | Query.addCondition | public function addCondition($recordField, $operator, $value)
{
$this->conditions[] = [
$recordField,
$operator,
$value
];
return $this;
} | php | public function addCondition($recordField, $operator, $value)
{
$this->conditions[] = [
$recordField,
$operator,
$value
];
return $this;
} | [
"public",
"function",
"addCondition",
"(",
"$",
"recordField",
",",
"$",
"operator",
",",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"conditions",
"[",
"]",
"=",
"[",
"$",
"recordField",
",",
"$",
"operator",
",",
"$",
"value",
"]",
";",
"return",
"$... | Add a condition to this query
@param $recordField
@param $operator
@param $value
@return $this | [
"Add",
"a",
"condition",
"to",
"this",
"query"
] | 8bfb373429d3359b064b39e226015e48f1c1243f | https://github.com/adamnicholson/flatbase/blob/8bfb373429d3359b064b39e226015e48f1c1243f/src/Query/Query.php#L53-L61 |
189,961 | adamnicholson/flatbase | src/Handler/QueryHandler.php | QueryHandler.assertCondition | protected function assertCondition($record, $condition)
{
$left = $condition[0];
$op = $condition[1];
$right = $condition[2];
switch ($op) {
case '=':
$value = $this->getRecordField($record, $left);
return $value == $right;
ca... | php | protected function assertCondition($record, $condition)
{
$left = $condition[0];
$op = $condition[1];
$right = $condition[2];
switch ($op) {
case '=':
$value = $this->getRecordField($record, $left);
return $value == $right;
ca... | [
"protected",
"function",
"assertCondition",
"(",
"$",
"record",
",",
"$",
"condition",
")",
"{",
"$",
"left",
"=",
"$",
"condition",
"[",
"0",
"]",
";",
"$",
"op",
"=",
"$",
"condition",
"[",
"1",
"]",
";",
"$",
"right",
"=",
"$",
"condition",
"[",... | Check if a single record should be matched for a single Query condition
@param $record
@param $condition
@return bool
@throws \Exception | [
"Check",
"if",
"a",
"single",
"record",
"should",
"be",
"matched",
"for",
"a",
"single",
"Query",
"condition"
] | 8bfb373429d3359b064b39e226015e48f1c1243f | https://github.com/adamnicholson/flatbase/blob/8bfb373429d3359b064b39e226015e48f1c1243f/src/Handler/QueryHandler.php#L51-L85 |
189,962 | adamnicholson/flatbase | src/Storage/Filesystem.php | Filesystem.getFilename | protected function getFilename($collection)
{
$file = rtrim($this->storageDir, '/').'/'.$collection;
if (!file_exists($file)) {
file_put_contents($file, serialize([]));
chmod($file, 0777);
}
return $file;
} | php | protected function getFilename($collection)
{
$file = rtrim($this->storageDir, '/').'/'.$collection;
if (!file_exists($file)) {
file_put_contents($file, serialize([]));
chmod($file, 0777);
}
return $file;
} | [
"protected",
"function",
"getFilename",
"(",
"$",
"collection",
")",
"{",
"$",
"file",
"=",
"rtrim",
"(",
"$",
"this",
"->",
"storageDir",
",",
"'/'",
")",
".",
"'/'",
".",
"$",
"collection",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"file",
")",... | Get the corresponding file path for a given collection
@param $collection
@return string | [
"Get",
"the",
"corresponding",
"file",
"path",
"for",
"a",
"given",
"collection"
] | 8bfb373429d3359b064b39e226015e48f1c1243f | https://github.com/adamnicholson/flatbase/blob/8bfb373429d3359b064b39e226015e48f1c1243f/src/Storage/Filesystem.php#L34-L44 |
189,963 | adamnicholson/flatbase | src/Handler/ReadQueryHandler.php | ReadQueryHandler.handle | public function handle(ReadQuery $query)
{
$this->validateQuery($query);
// Get all the records matching the given query conditions
$records = $this->getAllRecordsMatchingQueryConditions($query);
// Sort them
$this->sortRecords($records, $query);
// Limit t... | php | public function handle(ReadQuery $query)
{
$this->validateQuery($query);
// Get all the records matching the given query conditions
$records = $this->getAllRecordsMatchingQueryConditions($query);
// Sort them
$this->sortRecords($records, $query);
// Limit t... | [
"public",
"function",
"handle",
"(",
"ReadQuery",
"$",
"query",
")",
"{",
"$",
"this",
"->",
"validateQuery",
"(",
"$",
"query",
")",
";",
"// Get all the records matching the given query conditions",
"$",
"records",
"=",
"$",
"this",
"->",
"getAllRecordsMatchingQue... | Handle a ReadQuery and return the records in a \Flatbase\Collection
@param ReadQuery $query
@return Collection
@throws \Exception | [
"Handle",
"a",
"ReadQuery",
"and",
"return",
"the",
"records",
"in",
"a",
"\\",
"Flatbase",
"\\",
"Collection"
] | 8bfb373429d3359b064b39e226015e48f1c1243f | https://github.com/adamnicholson/flatbase/blob/8bfb373429d3359b064b39e226015e48f1c1243f/src/Handler/ReadQueryHandler.php#L17-L32 |
189,964 | adamnicholson/flatbase | src/Handler/ReadQueryHandler.php | ReadQueryHandler.getAllRecordsMatchingQueryConditions | protected function getAllRecordsMatchingQueryConditions(ReadQuery $query)
{
$records = [];
foreach ($this->getIterator($query->getCollection()) as $record) {
$records[] = $record;
}
if (!$query->getConditions()) {
return $records;
}
foreach (... | php | protected function getAllRecordsMatchingQueryConditions(ReadQuery $query)
{
$records = [];
foreach ($this->getIterator($query->getCollection()) as $record) {
$records[] = $record;
}
if (!$query->getConditions()) {
return $records;
}
foreach (... | [
"protected",
"function",
"getAllRecordsMatchingQueryConditions",
"(",
"ReadQuery",
"$",
"query",
")",
"{",
"$",
"records",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getIterator",
"(",
"$",
"query",
"->",
"getCollection",
"(",
")",
")",
"as",
... | Get all the records in a collection matching the Query conditions
@param ReadQuery $query
@return array | [
"Get",
"all",
"the",
"records",
"in",
"a",
"collection",
"matching",
"the",
"Query",
"conditions"
] | 8bfb373429d3359b064b39e226015e48f1c1243f | https://github.com/adamnicholson/flatbase/blob/8bfb373429d3359b064b39e226015e48f1c1243f/src/Handler/ReadQueryHandler.php#L40-L58 |
189,965 | adamnicholson/flatbase | src/Console/Commands/AbstractCommand.php | AbstractCommand.getConfig | protected function getConfig()
{
$configPath = $this->input->getOption('config') ?: (getcwd().'/flatbase.json');
$defaults = new \stdClass();
$defaults->path = null;
if (file_exists($configPath)) {
foreach (json_decode(file_get_contents($configPath)) as $property => $va... | php | protected function getConfig()
{
$configPath = $this->input->getOption('config') ?: (getcwd().'/flatbase.json');
$defaults = new \stdClass();
$defaults->path = null;
if (file_exists($configPath)) {
foreach (json_decode(file_get_contents($configPath)) as $property => $va... | [
"protected",
"function",
"getConfig",
"(",
")",
"{",
"$",
"configPath",
"=",
"$",
"this",
"->",
"input",
"->",
"getOption",
"(",
"'config'",
")",
"?",
":",
"(",
"getcwd",
"(",
")",
".",
"'/flatbase.json'",
")",
";",
"$",
"defaults",
"=",
"new",
"\\",
... | Get the config data
@return \stdClass | [
"Get",
"the",
"config",
"data"
] | 8bfb373429d3359b064b39e226015e48f1c1243f | https://github.com/adamnicholson/flatbase/blob/8bfb373429d3359b064b39e226015e48f1c1243f/src/Console/Commands/AbstractCommand.php#L70-L84 |
189,966 | adamnicholson/flatbase | src/Console/Commands/AbstractCommand.php | AbstractCommand.getFlatbase | protected function getFlatbase($storagePath)
{
$factory = $this->factory;
return $factory ? $factory($storagePath) : new Flatbase(new Filesystem($storagePath));
} | php | protected function getFlatbase($storagePath)
{
$factory = $this->factory;
return $factory ? $factory($storagePath) : new Flatbase(new Filesystem($storagePath));
} | [
"protected",
"function",
"getFlatbase",
"(",
"$",
"storagePath",
")",
"{",
"$",
"factory",
"=",
"$",
"this",
"->",
"factory",
";",
"return",
"$",
"factory",
"?",
"$",
"factory",
"(",
"$",
"storagePath",
")",
":",
"new",
"Flatbase",
"(",
"new",
"Filesyste... | Get a Flatbase object for a given storage path.
@return Flatbase | [
"Get",
"a",
"Flatbase",
"object",
"for",
"a",
"given",
"storage",
"path",
"."
] | 8bfb373429d3359b064b39e226015e48f1c1243f | https://github.com/adamnicholson/flatbase/blob/8bfb373429d3359b064b39e226015e48f1c1243f/src/Console/Commands/AbstractCommand.php#L91-L96 |
189,967 | adamnicholson/flatbase | src/Flatbase.php | Flatbase.resolveHandler | protected function resolveHandler(Query $query)
{
if ($query instanceof ReadQuery) {
return new ReadQueryHandler($this);
}
if ($query instanceof InsertQuery) {
return new InsertQueryHandler($this);
}
if ($query instanceof DeleteQuery) {
r... | php | protected function resolveHandler(Query $query)
{
if ($query instanceof ReadQuery) {
return new ReadQueryHandler($this);
}
if ($query instanceof InsertQuery) {
return new InsertQueryHandler($this);
}
if ($query instanceof DeleteQuery) {
r... | [
"protected",
"function",
"resolveHandler",
"(",
"Query",
"$",
"query",
")",
"{",
"if",
"(",
"$",
"query",
"instanceof",
"ReadQuery",
")",
"{",
"return",
"new",
"ReadQueryHandler",
"(",
"$",
"this",
")",
";",
"}",
"if",
"(",
"$",
"query",
"instanceof",
"I... | Find the appropriate handler for a given Query
@param Query $query
@return DeleteQueryHandler|InsertQueryHandler|ReadQueryHandler
@throws \Exception | [
"Find",
"the",
"appropriate",
"handler",
"for",
"a",
"given",
"Query"
] | 8bfb373429d3359b064b39e226015e48f1c1243f | https://github.com/adamnicholson/flatbase/blob/8bfb373429d3359b064b39e226015e48f1c1243f/src/Flatbase.php#L90-L109 |
189,968 | garbetjie/wechat-php | src/Menu/Service.php | Service.storeMenu | public function storeMenu (Menu $menu)
{
$this->client->send(
new Request(
'POST',
"https://api.weixin.qq.com/cgi-bin/menu/create",
[],
json_encode($this->reduceMenu($menu))
)
);
} | php | public function storeMenu (Menu $menu)
{
$this->client->send(
new Request(
'POST',
"https://api.weixin.qq.com/cgi-bin/menu/create",
[],
json_encode($this->reduceMenu($menu))
)
);
} | [
"public",
"function",
"storeMenu",
"(",
"Menu",
"$",
"menu",
")",
"{",
"$",
"this",
"->",
"client",
"->",
"send",
"(",
"new",
"Request",
"(",
"'POST'",
",",
"\"https://api.weixin.qq.com/cgi-bin/menu/create\"",
",",
"[",
"]",
",",
"json_encode",
"(",
"$",
"th... | Creates a menu for the OA.
@param Menu $menu | [
"Creates",
"a",
"menu",
"for",
"the",
"OA",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Menu/Service.php#L15-L25 |
189,969 | garbetjie/wechat-php | src/Menu/Service.php | Service.fetchCurrentMenu | public function fetchCurrentMenu ()
{
$request = new Request("GET", "https://api.weixin.qq.com/cgi-bin/menu/get");
$response = $this->client->send($request);
$json = json_decode((string)$response->getBody());
if (! isset($json->menu->button)) {
throw new Exception('Unexp... | php | public function fetchCurrentMenu ()
{
$request = new Request("GET", "https://api.weixin.qq.com/cgi-bin/menu/get");
$response = $this->client->send($request);
$json = json_decode((string)$response->getBody());
if (! isset($json->menu->button)) {
throw new Exception('Unexp... | [
"public",
"function",
"fetchCurrentMenu",
"(",
")",
"{",
"$",
"request",
"=",
"new",
"Request",
"(",
"\"GET\"",
",",
"\"https://api.weixin.qq.com/cgi-bin/menu/get\"",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"send",
"(",
"$",
"request... | Retrieve the current menu for the OA, and return it as an instance of `Garbetjie\WeChatClient\Menu\Menu`.
@return Menu
@throws Exception | [
"Retrieve",
"the",
"current",
"menu",
"for",
"the",
"OA",
"and",
"return",
"it",
"as",
"an",
"instance",
"of",
"Garbetjie",
"\\",
"WeChatClient",
"\\",
"Menu",
"\\",
"Menu",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Menu/Service.php#L44-L61 |
189,970 | garbetjie/wechat-php | src/Menu/Service.php | Service.validateItem | protected function validateItem (MenuItem $item)
{
// MenuItem has children.
if (count($item->getChildren()) > 0) {
foreach ($item->getChildren() as $childItem) {
if (! $this->validateItem($childItem)) {
return false;
}
}
... | php | protected function validateItem (MenuItem $item)
{
// MenuItem has children.
if (count($item->getChildren()) > 0) {
foreach ($item->getChildren() as $childItem) {
if (! $this->validateItem($childItem)) {
return false;
}
}
... | [
"protected",
"function",
"validateItem",
"(",
"MenuItem",
"$",
"item",
")",
"{",
"// MenuItem has children.",
"if",
"(",
"count",
"(",
"$",
"item",
"->",
"getChildren",
"(",
")",
")",
">",
"0",
")",
"{",
"foreach",
"(",
"$",
"item",
"->",
"getChildren",
... | Validates whether the supplied item qualifies as a valid menu item.
@param MenuItem $item
@return bool | [
"Validates",
"whether",
"the",
"supplied",
"item",
"qualifies",
"as",
"a",
"valid",
"menu",
"item",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Menu/Service.php#L89-L122 |
189,971 | garbetjie/wechat-php | src/Menu/Service.php | Service.reduceMenu | protected function reduceMenu (Menu $menu)
{
$reduced = ['button' => []];
foreach ($menu->getItems() as $menuItem) {
$reduced['button'][] = $this->reduceItem($menuItem);
}
return $reduced;
} | php | protected function reduceMenu (Menu $menu)
{
$reduced = ['button' => []];
foreach ($menu->getItems() as $menuItem) {
$reduced['button'][] = $this->reduceItem($menuItem);
}
return $reduced;
} | [
"protected",
"function",
"reduceMenu",
"(",
"Menu",
"$",
"menu",
")",
"{",
"$",
"reduced",
"=",
"[",
"'button'",
"=>",
"[",
"]",
"]",
";",
"foreach",
"(",
"$",
"menu",
"->",
"getItems",
"(",
")",
"as",
"$",
"menuItem",
")",
"{",
"$",
"reduced",
"["... | Reduces the supplied menu into its array equivalent, ready for sending to the WeChat API.
@param Menu $menu
@return array | [
"Reduces",
"the",
"supplied",
"menu",
"into",
"its",
"array",
"equivalent",
"ready",
"for",
"sending",
"to",
"the",
"WeChat",
"API",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Menu/Service.php#L131-L140 |
189,972 | garbetjie/wechat-php | src/Menu/Service.php | Service.reduceItem | protected function reduceItem (MenuItem $item)
{
$reduced = ['name' => $item->getTitle()];
// Has children.
if (count($item->getChildren()) > 0) {
$reduced['sub_button'] = [];
foreach ($item->getChildren() as $childItem) {
$reduced['sub_button'][] = $... | php | protected function reduceItem (MenuItem $item)
{
$reduced = ['name' => $item->getTitle()];
// Has children.
if (count($item->getChildren()) > 0) {
$reduced['sub_button'] = [];
foreach ($item->getChildren() as $childItem) {
$reduced['sub_button'][] = $... | [
"protected",
"function",
"reduceItem",
"(",
"MenuItem",
"$",
"item",
")",
"{",
"$",
"reduced",
"=",
"[",
"'name'",
"=>",
"$",
"item",
"->",
"getTitle",
"(",
")",
"]",
";",
"// Has children.",
"if",
"(",
"count",
"(",
"$",
"item",
"->",
"getChildren",
"... | Reduces a menu item, and returns it as an array that can be used in a request to the WeChat API.
@param MenuItem $item
@return array | [
"Reduces",
"a",
"menu",
"item",
"and",
"returns",
"it",
"as",
"an",
"array",
"that",
"can",
"be",
"used",
"in",
"a",
"request",
"to",
"the",
"WeChat",
"API",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Menu/Service.php#L149-L166 |
189,973 | garbetjie/wechat-php | src/Menu/Service.php | Service.inflateItem | protected function inflateItem ($item)
{
if (isset($item->sub_button) & count($item->sub_button) > 0) {
$object = new MenuItem($item->name, MenuItem::KEYWORD);
foreach ($item->sub_button as $subItem) {
$object = $object->withItem($this->inflateItem($subItem));
... | php | protected function inflateItem ($item)
{
if (isset($item->sub_button) & count($item->sub_button) > 0) {
$object = new MenuItem($item->name, MenuItem::KEYWORD);
foreach ($item->sub_button as $subItem) {
$object = $object->withItem($this->inflateItem($subItem));
... | [
"protected",
"function",
"inflateItem",
"(",
"$",
"item",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"item",
"->",
"sub_button",
")",
"&",
"count",
"(",
"$",
"item",
"->",
"sub_button",
")",
">",
"0",
")",
"{",
"$",
"object",
"=",
"new",
"MenuItem",
"... | Inflate the given array representation of an item, and return it as an instance of `Garbetjie\WeChatClient\Menu\MenuItem`.
@param \stdClass $item
@return MenuItem | [
"Inflate",
"the",
"given",
"array",
"representation",
"of",
"an",
"item",
"and",
"return",
"it",
"as",
"an",
"instance",
"of",
"Garbetjie",
"\\",
"WeChatClient",
"\\",
"Menu",
"\\",
"MenuItem",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Menu/Service.php#L175-L193 |
189,974 | garbetjie/wechat-php | src/Media/Service.php | Service.fetchTemporaryImage | public function fetchTemporaryImage ($mediaID, $into = null)
{
return new Downloaded\Image($mediaID, $this->doTemporaryFetchToStream($mediaID, $into));
} | php | public function fetchTemporaryImage ($mediaID, $into = null)
{
return new Downloaded\Image($mediaID, $this->doTemporaryFetchToStream($mediaID, $into));
} | [
"public",
"function",
"fetchTemporaryImage",
"(",
"$",
"mediaID",
",",
"$",
"into",
"=",
"null",
")",
"{",
"return",
"new",
"Downloaded",
"\\",
"Image",
"(",
"$",
"mediaID",
",",
"$",
"this",
"->",
"doTemporaryFetchToStream",
"(",
"$",
"mediaID",
",",
"$",... | Downloads a temporary image.
@param string $mediaID
@param null|string|resource $into
@return Downloaded\Image | [
"Downloads",
"a",
"temporary",
"image",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Media/Service.php#L29-L32 |
189,975 | garbetjie/wechat-php | src/Media/Service.php | Service.fetchPermanentImage | public function fetchPermanentImage ($mediaID, $into = null)
{
return new Downloaded\Image($mediaID, $this->doPermanentFetchToStream($mediaID, $into));
} | php | public function fetchPermanentImage ($mediaID, $into = null)
{
return new Downloaded\Image($mediaID, $this->doPermanentFetchToStream($mediaID, $into));
} | [
"public",
"function",
"fetchPermanentImage",
"(",
"$",
"mediaID",
",",
"$",
"into",
"=",
"null",
")",
"{",
"return",
"new",
"Downloaded",
"\\",
"Image",
"(",
"$",
"mediaID",
",",
"$",
"this",
"->",
"doPermanentFetchToStream",
"(",
"$",
"mediaID",
",",
"$",... | Downloads a permanent image.
@param string $mediaID
@param null|string|resource $into
@return Downloaded\Image | [
"Downloads",
"a",
"permanent",
"image",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Media/Service.php#L42-L45 |
189,976 | garbetjie/wechat-php | src/Media/Service.php | Service.fetchTemporaryAudio | public function fetchTemporaryAudio ($mediaID, $into = null)
{
return new Downloaded\Audio($mediaID, $this->doTemporaryFetchToStream($mediaID, $into));
} | php | public function fetchTemporaryAudio ($mediaID, $into = null)
{
return new Downloaded\Audio($mediaID, $this->doTemporaryFetchToStream($mediaID, $into));
} | [
"public",
"function",
"fetchTemporaryAudio",
"(",
"$",
"mediaID",
",",
"$",
"into",
"=",
"null",
")",
"{",
"return",
"new",
"Downloaded",
"\\",
"Audio",
"(",
"$",
"mediaID",
",",
"$",
"this",
"->",
"doTemporaryFetchToStream",
"(",
"$",
"mediaID",
",",
"$",... | Downloads a temporary audio item.
@param string $mediaID
@param null|string|resource $into
@return Downloaded\Audio | [
"Downloads",
"a",
"temporary",
"audio",
"item",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Media/Service.php#L55-L58 |
189,977 | garbetjie/wechat-php | src/Media/Service.php | Service.fetchPermanentAudio | public function fetchPermanentAudio ($mediaID, $into = null)
{
return new Downloaded\Audio($mediaID, $this->doPermanentFetchToStream($mediaID, $into));
} | php | public function fetchPermanentAudio ($mediaID, $into = null)
{
return new Downloaded\Audio($mediaID, $this->doPermanentFetchToStream($mediaID, $into));
} | [
"public",
"function",
"fetchPermanentAudio",
"(",
"$",
"mediaID",
",",
"$",
"into",
"=",
"null",
")",
"{",
"return",
"new",
"Downloaded",
"\\",
"Audio",
"(",
"$",
"mediaID",
",",
"$",
"this",
"->",
"doPermanentFetchToStream",
"(",
"$",
"mediaID",
",",
"$",... | Downloads a permanent audio item.
@param string $mediaID
@param null|string|resource $into
@return Downloaded\Audio | [
"Downloads",
"a",
"permanent",
"audio",
"item",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Media/Service.php#L68-L71 |
189,978 | garbetjie/wechat-php | src/Media/Service.php | Service.fetchTemporaryThumbnail | public function fetchTemporaryThumbnail ($mediaID, $into = null)
{
return new Downloaded\Thumbnail($mediaID, $this->doTemporaryFetchToStream($mediaID, $into));
} | php | public function fetchTemporaryThumbnail ($mediaID, $into = null)
{
return new Downloaded\Thumbnail($mediaID, $this->doTemporaryFetchToStream($mediaID, $into));
} | [
"public",
"function",
"fetchTemporaryThumbnail",
"(",
"$",
"mediaID",
",",
"$",
"into",
"=",
"null",
")",
"{",
"return",
"new",
"Downloaded",
"\\",
"Thumbnail",
"(",
"$",
"mediaID",
",",
"$",
"this",
"->",
"doTemporaryFetchToStream",
"(",
"$",
"mediaID",
","... | Downloads a temporary thumbnail item.
@param string $mediaID
@param null|string|resource $into
@return Downloaded\Thumbnail | [
"Downloads",
"a",
"temporary",
"thumbnail",
"item",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Media/Service.php#L81-L84 |
189,979 | garbetjie/wechat-php | src/Media/Service.php | Service.fetchPermanentThumbnail | public function fetchPermanentThumbnail ($mediaID, $into = null)
{
return new Downloaded\Thumbnail($mediaID, $this->doPermanentFetchToStream($mediaID, $into));
} | php | public function fetchPermanentThumbnail ($mediaID, $into = null)
{
return new Downloaded\Thumbnail($mediaID, $this->doPermanentFetchToStream($mediaID, $into));
} | [
"public",
"function",
"fetchPermanentThumbnail",
"(",
"$",
"mediaID",
",",
"$",
"into",
"=",
"null",
")",
"{",
"return",
"new",
"Downloaded",
"\\",
"Thumbnail",
"(",
"$",
"mediaID",
",",
"$",
"this",
"->",
"doPermanentFetchToStream",
"(",
"$",
"mediaID",
","... | Downloads a permanent thumbnail item.
@param string $mediaID
@param null|string|resource $into
@return Downloaded\Thumbnail | [
"Downloads",
"a",
"permanent",
"thumbnail",
"item",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Media/Service.php#L94-L97 |
189,980 | garbetjie/wechat-php | src/Media/Service.php | Service.fetchPermanentNews | public function fetchPermanentNews ($mediaID)
{
$stream = $this->doPermanentFetchToStream($mediaID, null);
$json = json_decode(stream_get_contents($stream));
return $this->expandNews($json->news_item, new Downloaded\News($mediaID, $json->update_time));
} | php | public function fetchPermanentNews ($mediaID)
{
$stream = $this->doPermanentFetchToStream($mediaID, null);
$json = json_decode(stream_get_contents($stream));
return $this->expandNews($json->news_item, new Downloaded\News($mediaID, $json->update_time));
} | [
"public",
"function",
"fetchPermanentNews",
"(",
"$",
"mediaID",
")",
"{",
"$",
"stream",
"=",
"$",
"this",
"->",
"doPermanentFetchToStream",
"(",
"$",
"mediaID",
",",
"null",
")",
";",
"$",
"json",
"=",
"json_decode",
"(",
"stream_get_contents",
"(",
"$",
... | Downloads the specified permanent news item, and returns an object representation of it.
@param string $mediaID
@return Downloaded\News | [
"Downloads",
"the",
"specified",
"permanent",
"news",
"item",
"and",
"returns",
"an",
"object",
"representation",
"of",
"it",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Media/Service.php#L123-L129 |
189,981 | garbetjie/wechat-php | src/Media/Service.php | Service.fetchTemporaryVideo | public function fetchTemporaryVideo ($mediaID, $into = null)
{
return new Downloaded\Video($mediaID, $this->doTemporaryFetchToStream($mediaID, $into));
} | php | public function fetchTemporaryVideo ($mediaID, $into = null)
{
return new Downloaded\Video($mediaID, $this->doTemporaryFetchToStream($mediaID, $into));
} | [
"public",
"function",
"fetchTemporaryVideo",
"(",
"$",
"mediaID",
",",
"$",
"into",
"=",
"null",
")",
"{",
"return",
"new",
"Downloaded",
"\\",
"Video",
"(",
"$",
"mediaID",
",",
"$",
"this",
"->",
"doTemporaryFetchToStream",
"(",
"$",
"mediaID",
",",
"$",... | Downloads a temporary video.
@param string $mediaID
@param null|string|resource $into
@return Downloaded\Video | [
"Downloads",
"a",
"temporary",
"video",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Media/Service.php#L139-L142 |
189,982 | garbetjie/wechat-php | src/Media/Service.php | Service.fetchPermanentVideo | public function fetchPermanentVideo ($mediaID, $into = null)
{
$stream = $this->doPermanentFetchToStream($mediaID, null);
$json = json_decode(stream_get_contents($stream));
$body = $this->client->send(
new Request(
'GET',
$json->down_url
... | php | public function fetchPermanentVideo ($mediaID, $into = null)
{
$stream = $this->doPermanentFetchToStream($mediaID, null);
$json = json_decode(stream_get_contents($stream));
$body = $this->client->send(
new Request(
'GET',
$json->down_url
... | [
"public",
"function",
"fetchPermanentVideo",
"(",
"$",
"mediaID",
",",
"$",
"into",
"=",
"null",
")",
"{",
"$",
"stream",
"=",
"$",
"this",
"->",
"doPermanentFetchToStream",
"(",
"$",
"mediaID",
",",
"null",
")",
";",
"$",
"json",
"=",
"json_decode",
"("... | Downloads the given video into the specified file.
@param string $mediaID
@param null|string|resource $into
@return Downloaded\Video | [
"Downloads",
"the",
"given",
"video",
"into",
"the",
"specified",
"file",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Media/Service.php#L152-L173 |
189,983 | garbetjie/wechat-php | src/Media/Service.php | Service.storePermanentNews | public function storePermanentNews (News $news)
{
$json = $this->storeNews('https://api.weixin.qq.com/cgi-bin/material/add_news', $news);
return new Uploaded\News($json->media_id);
} | php | public function storePermanentNews (News $news)
{
$json = $this->storeNews('https://api.weixin.qq.com/cgi-bin/material/add_news', $news);
return new Uploaded\News($json->media_id);
} | [
"public",
"function",
"storePermanentNews",
"(",
"News",
"$",
"news",
")",
"{",
"$",
"json",
"=",
"$",
"this",
"->",
"storeNews",
"(",
"'https://api.weixin.qq.com/cgi-bin/material/add_news'",
",",
"$",
"news",
")",
";",
"return",
"new",
"Uploaded",
"\\",
"News",... | Upload a news item for permanent storage.
@param News $news
@return Uploaded\News | [
"Upload",
"a",
"news",
"item",
"for",
"permanent",
"storage",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Media/Service.php#L182-L187 |
189,984 | garbetjie/wechat-php | src/Media/Service.php | Service.storeTemporaryNews | public function storeTemporaryNews (News $news)
{
$json = $this->storeNews('https://api.weixin.qq.com/cgi-bin/media/uploadnews', $news);
return (new Uploaded\News($json->media_id))->withExpiresDate($this->createExpiryDate($json->created_at));
} | php | public function storeTemporaryNews (News $news)
{
$json = $this->storeNews('https://api.weixin.qq.com/cgi-bin/media/uploadnews', $news);
return (new Uploaded\News($json->media_id))->withExpiresDate($this->createExpiryDate($json->created_at));
} | [
"public",
"function",
"storeTemporaryNews",
"(",
"News",
"$",
"news",
")",
"{",
"$",
"json",
"=",
"$",
"this",
"->",
"storeNews",
"(",
"'https://api.weixin.qq.com/cgi-bin/media/uploadnews'",
",",
"$",
"news",
")",
";",
"return",
"(",
"new",
"Uploaded",
"\\",
"... | Upload a news item for temporary storage. It will expire after 3 days, but we'll set the expiry to 2 days, to be
safe when it comes to time zones.
@param News $news
@return Uploaded\News | [
"Upload",
"a",
"news",
"item",
"for",
"temporary",
"storage",
".",
"It",
"will",
"expire",
"after",
"3",
"days",
"but",
"we",
"ll",
"set",
"the",
"expiry",
"to",
"2",
"days",
"to",
"be",
"safe",
"when",
"it",
"comes",
"to",
"time",
"zones",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Media/Service.php#L197-L202 |
189,985 | garbetjie/wechat-php | src/Media/Service.php | Service.storePermanentVideo | public function storePermanentVideo (Video $video)
{
if ($video->getTitle() === null || $video->getDescription() === null) {
throw new InvalidArgumentException("permanent videos must have a title and description");
}
return $this->storeVideo(true, $video);
} | php | public function storePermanentVideo (Video $video)
{
if ($video->getTitle() === null || $video->getDescription() === null) {
throw new InvalidArgumentException("permanent videos must have a title and description");
}
return $this->storeVideo(true, $video);
} | [
"public",
"function",
"storePermanentVideo",
"(",
"Video",
"$",
"video",
")",
"{",
"if",
"(",
"$",
"video",
"->",
"getTitle",
"(",
")",
"===",
"null",
"||",
"$",
"video",
"->",
"getDescription",
"(",
")",
"===",
"null",
")",
"{",
"throw",
"new",
"Inval... | Uploads a video for permanent storage to the WeChat servers. The video supplied must have had the title and
description populated.
@param Video $video
@return Uploaded\Video
@throws InvalidArgumentException | [
"Uploads",
"a",
"video",
"for",
"permanent",
"storage",
"to",
"the",
"WeChat",
"servers",
".",
"The",
"video",
"supplied",
"must",
"have",
"had",
"the",
"title",
"and",
"description",
"populated",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Media/Service.php#L213-L220 |
189,986 | garbetjie/wechat-php | src/Media/Service.php | Service.storeTemporaryVideo | public function storeTemporaryVideo (Video $video)
{
return $this
->storeVideo(false, $video)
->withExpiresDate(new \DateTime('@' . (time() + 172800))); // @todo: change to use the JSON's created_at property.
} | php | public function storeTemporaryVideo (Video $video)
{
return $this
->storeVideo(false, $video)
->withExpiresDate(new \DateTime('@' . (time() + 172800))); // @todo: change to use the JSON's created_at property.
} | [
"public",
"function",
"storeTemporaryVideo",
"(",
"Video",
"$",
"video",
")",
"{",
"return",
"$",
"this",
"->",
"storeVideo",
"(",
"false",
",",
"$",
"video",
")",
"->",
"withExpiresDate",
"(",
"new",
"\\",
"DateTime",
"(",
"'@'",
".",
"(",
"time",
"(",
... | Uploads a video item for temporary storage on the WeChat servers.
@param Video $video
@return Uploaded\Video | [
"Uploads",
"a",
"video",
"item",
"for",
"temporary",
"storage",
"on",
"the",
"WeChat",
"servers",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Media/Service.php#L229-L234 |
189,987 | garbetjie/wechat-php | src/Media/Service.php | Service.storePermanentImage | public function storePermanentImage (Image $image)
{
$json = $this->storeGenericMedia(MediaType::IMAGE, true, $image);
return (new Uploaded\Image($json->media_id))->withURL($json->url);
} | php | public function storePermanentImage (Image $image)
{
$json = $this->storeGenericMedia(MediaType::IMAGE, true, $image);
return (new Uploaded\Image($json->media_id))->withURL($json->url);
} | [
"public",
"function",
"storePermanentImage",
"(",
"Image",
"$",
"image",
")",
"{",
"$",
"json",
"=",
"$",
"this",
"->",
"storeGenericMedia",
"(",
"MediaType",
"::",
"IMAGE",
",",
"true",
",",
"$",
"image",
")",
";",
"return",
"(",
"new",
"Uploaded",
"\\"... | Uploads an image for permanent storage on the WeChat servers.
@param Image $image
@return Uploaded\Image | [
"Uploads",
"an",
"image",
"for",
"permanent",
"storage",
"on",
"the",
"WeChat",
"servers",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Media/Service.php#L243-L248 |
189,988 | garbetjie/wechat-php | src/Media/Service.php | Service.storeTemporaryImage | public function storeTemporaryImage (Image $image)
{
$json = $this->storeGenericMedia(MediaType::IMAGE, false, $image);
return (new Uploaded\Image($json->media_id))
->withExpiresDate($this->createExpiryDate($json->created_at));
} | php | public function storeTemporaryImage (Image $image)
{
$json = $this->storeGenericMedia(MediaType::IMAGE, false, $image);
return (new Uploaded\Image($json->media_id))
->withExpiresDate($this->createExpiryDate($json->created_at));
} | [
"public",
"function",
"storeTemporaryImage",
"(",
"Image",
"$",
"image",
")",
"{",
"$",
"json",
"=",
"$",
"this",
"->",
"storeGenericMedia",
"(",
"MediaType",
"::",
"IMAGE",
",",
"false",
",",
"$",
"image",
")",
";",
"return",
"(",
"new",
"Uploaded",
"\\... | Uploads an image for temporary storage on the WeChat servers.
@param Image $image
@return Uploaded\Image | [
"Uploads",
"an",
"image",
"for",
"temporary",
"storage",
"on",
"the",
"WeChat",
"servers",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Media/Service.php#L257-L263 |
189,989 | garbetjie/wechat-php | src/Media/Service.php | Service.storePermanentThumbnail | public function storePermanentThumbnail (Thumbnail $thumbnail)
{
$json = $this->storeGenericMedia(MediaType::THUMBNAIL, true, $thumbnail);
return new Uploaded\Thumbnail($json->media_id);
} | php | public function storePermanentThumbnail (Thumbnail $thumbnail)
{
$json = $this->storeGenericMedia(MediaType::THUMBNAIL, true, $thumbnail);
return new Uploaded\Thumbnail($json->media_id);
} | [
"public",
"function",
"storePermanentThumbnail",
"(",
"Thumbnail",
"$",
"thumbnail",
")",
"{",
"$",
"json",
"=",
"$",
"this",
"->",
"storeGenericMedia",
"(",
"MediaType",
"::",
"THUMBNAIL",
",",
"true",
",",
"$",
"thumbnail",
")",
";",
"return",
"new",
"Uplo... | Uploads a thumbnail for permanent storage on the WeChat servers.
@param Thumbnail $thumbnail
@return Uploaded\Thumbnail | [
"Uploads",
"a",
"thumbnail",
"for",
"permanent",
"storage",
"on",
"the",
"WeChat",
"servers",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Media/Service.php#L272-L277 |
189,990 | garbetjie/wechat-php | src/Media/Service.php | Service.storeTemporaryThumbnail | public function storeTemporaryThumbnail (Thumbnail $thumbnail)
{
$json = $this->storeGenericMedia(MediaType::THUMBNAIL, false, $thumbnail);
return (new Uploaded\Thumbnail($json->thumb_media_id))
->withExpiresDate($this->createExpiryDate($json->created_at));
} | php | public function storeTemporaryThumbnail (Thumbnail $thumbnail)
{
$json = $this->storeGenericMedia(MediaType::THUMBNAIL, false, $thumbnail);
return (new Uploaded\Thumbnail($json->thumb_media_id))
->withExpiresDate($this->createExpiryDate($json->created_at));
} | [
"public",
"function",
"storeTemporaryThumbnail",
"(",
"Thumbnail",
"$",
"thumbnail",
")",
"{",
"$",
"json",
"=",
"$",
"this",
"->",
"storeGenericMedia",
"(",
"MediaType",
"::",
"THUMBNAIL",
",",
"false",
",",
"$",
"thumbnail",
")",
";",
"return",
"(",
"new",... | Uploads a thumbnail for temporary storage on the WeChat servers.
@param Thumbnail $thumbnail
@return Uploaded\Thumbnail | [
"Uploads",
"a",
"thumbnail",
"for",
"temporary",
"storage",
"on",
"the",
"WeChat",
"servers",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Media/Service.php#L286-L292 |
189,991 | garbetjie/wechat-php | src/Media/Service.php | Service.storePermanentAudio | public function storePermanentAudio (Audio $audio)
{
$json = $this->storeGenericMedia(MediaType::AUDIO, true, $audio);
return new Uploaded\Audio($json->media_id);
} | php | public function storePermanentAudio (Audio $audio)
{
$json = $this->storeGenericMedia(MediaType::AUDIO, true, $audio);
return new Uploaded\Audio($json->media_id);
} | [
"public",
"function",
"storePermanentAudio",
"(",
"Audio",
"$",
"audio",
")",
"{",
"$",
"json",
"=",
"$",
"this",
"->",
"storeGenericMedia",
"(",
"MediaType",
"::",
"AUDIO",
",",
"true",
",",
"$",
"audio",
")",
";",
"return",
"new",
"Uploaded",
"\\",
"Au... | Uploads an audio item for permanent storage on the WeChat servers.
@param Audio $audio
@return Uploaded\Audio | [
"Uploads",
"an",
"audio",
"item",
"for",
"permanent",
"storage",
"on",
"the",
"WeChat",
"servers",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Media/Service.php#L301-L306 |
189,992 | garbetjie/wechat-php | src/Media/Service.php | Service.storeTemporaryAudio | public function storeTemporaryAudio (Audio $audio)
{
$json = $this->storeGenericMedia(MediaType::AUDIO, false, $audio);
return (new Uploaded\Audio($json->media_id))
->withExpiresDate($this->createExpiryDate($json->created_at));
} | php | public function storeTemporaryAudio (Audio $audio)
{
$json = $this->storeGenericMedia(MediaType::AUDIO, false, $audio);
return (new Uploaded\Audio($json->media_id))
->withExpiresDate($this->createExpiryDate($json->created_at));
} | [
"public",
"function",
"storeTemporaryAudio",
"(",
"Audio",
"$",
"audio",
")",
"{",
"$",
"json",
"=",
"$",
"this",
"->",
"storeGenericMedia",
"(",
"MediaType",
"::",
"AUDIO",
",",
"false",
",",
"$",
"audio",
")",
";",
"return",
"(",
"new",
"Uploaded",
"\\... | Uploads an audio item for temporary storage on the WeChat servers.
@param Audio $audio
@return Uploaded\Audio | [
"Uploads",
"an",
"audio",
"item",
"for",
"temporary",
"storage",
"on",
"the",
"WeChat",
"servers",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Media/Service.php#L315-L321 |
189,993 | garbetjie/wechat-php | src/Media/Service.php | Service.expandNews | private function expandNews (array $rawNewsItems, Paginated\News $news)
{
foreach ($rawNewsItems as $rawNewsItem) {
$newsItem = new Downloaded\NewsItem(
$rawNewsItem->title,
$rawNewsItem->content,
$rawNewsItem->thumb_media_id
);
... | php | private function expandNews (array $rawNewsItems, Paginated\News $news)
{
foreach ($rawNewsItems as $rawNewsItem) {
$newsItem = new Downloaded\NewsItem(
$rawNewsItem->title,
$rawNewsItem->content,
$rawNewsItem->thumb_media_id
);
... | [
"private",
"function",
"expandNews",
"(",
"array",
"$",
"rawNewsItems",
",",
"Paginated",
"\\",
"News",
"$",
"news",
")",
"{",
"foreach",
"(",
"$",
"rawNewsItems",
"as",
"$",
"rawNewsItem",
")",
"{",
"$",
"newsItem",
"=",
"new",
"Downloaded",
"\\",
"NewsIt... | Expands the given news media, with its items into an object.
@param array $rawNewsItems
@param Paginated\News $news
@return Paginated\News | [
"Expands",
"the",
"given",
"news",
"media",
"with",
"its",
"items",
"into",
"an",
"object",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Media/Service.php#L331-L368 |
189,994 | garbetjie/wechat-php | src/Media/Service.php | Service.paginateImages | public function paginateImages ($offset = 0, $count = 20)
{
$json = $this->paginate(MediaType::IMAGE, $offset, $count);
$resultSet = [];
foreach ($json->item as $item) {
$image = new Paginated\Image($item->media_id, $item->name, $item->update_time);
... | php | public function paginateImages ($offset = 0, $count = 20)
{
$json = $this->paginate(MediaType::IMAGE, $offset, $count);
$resultSet = [];
foreach ($json->item as $item) {
$image = new Paginated\Image($item->media_id, $item->name, $item->update_time);
... | [
"public",
"function",
"paginateImages",
"(",
"$",
"offset",
"=",
"0",
",",
"$",
"count",
"=",
"20",
")",
"{",
"$",
"json",
"=",
"$",
"this",
"->",
"paginate",
"(",
"MediaType",
"::",
"IMAGE",
",",
"$",
"offset",
",",
"$",
"count",
")",
";",
"$",
... | Paginates through images stored on the WeChat servers.
@param int $offset - The offset from which to start showing items.
@param int $count - The number of items to show.
@return Paginated\ImageResultSet
@throws Exception | [
"Paginates",
"through",
"images",
"stored",
"on",
"the",
"WeChat",
"servers",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Media/Service.php#L379-L395 |
189,995 | garbetjie/wechat-php | src/Media/Service.php | Service.paginateVideos | public function paginateVideos ($offset = 0, $count = 20)
{
$json = $this->paginate(MediaType::VIDEO, $offset, $count);
$resultSet = [];
foreach ($json->item as $item) {
$resultSet[] = new Paginated\Video($item->media_id, $item->update_time);
}
return ne... | php | public function paginateVideos ($offset = 0, $count = 20)
{
$json = $this->paginate(MediaType::VIDEO, $offset, $count);
$resultSet = [];
foreach ($json->item as $item) {
$resultSet[] = new Paginated\Video($item->media_id, $item->update_time);
}
return ne... | [
"public",
"function",
"paginateVideos",
"(",
"$",
"offset",
"=",
"0",
",",
"$",
"count",
"=",
"20",
")",
"{",
"$",
"json",
"=",
"$",
"this",
"->",
"paginate",
"(",
"MediaType",
"::",
"VIDEO",
",",
"$",
"offset",
",",
"$",
"count",
")",
";",
"$",
... | Paginates through videos stored on the WeChat servers.
@param int $offset - The offset from which to start showing items.
@param int $count - The number of items to show.
@return Paginated\VideoResultSet
@throws Exception | [
"Paginates",
"through",
"videos",
"stored",
"on",
"the",
"WeChat",
"servers",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Media/Service.php#L406-L416 |
189,996 | garbetjie/wechat-php | src/Media/Service.php | Service.paginateAudio | public function paginateAudio ($offset = 0, $count = 20)
{
$json = $this->paginate(MediaType::AUDIO, $offset, $count);
$resultSet = [];
foreach ($json->item as $item) {
$resultSet = new Paginated\Audio($item->media_id, $item->update_time);
}
return new P... | php | public function paginateAudio ($offset = 0, $count = 20)
{
$json = $this->paginate(MediaType::AUDIO, $offset, $count);
$resultSet = [];
foreach ($json->item as $item) {
$resultSet = new Paginated\Audio($item->media_id, $item->update_time);
}
return new P... | [
"public",
"function",
"paginateAudio",
"(",
"$",
"offset",
"=",
"0",
",",
"$",
"count",
"=",
"20",
")",
"{",
"$",
"json",
"=",
"$",
"this",
"->",
"paginate",
"(",
"MediaType",
"::",
"AUDIO",
",",
"$",
"offset",
",",
"$",
"count",
")",
";",
"$",
"... | Paginates through audio items stored on the WeChat servers.
@param int $offset - The offset from which to start showing items.
@param int $count - The number of items to show.
@return Paginated\AudioResultSet
@throws Exception | [
"Paginates",
"through",
"audio",
"items",
"stored",
"on",
"the",
"WeChat",
"servers",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Media/Service.php#L427-L437 |
189,997 | garbetjie/wechat-php | src/Media/Service.php | Service.paginateNews | public function paginateNews ($offset = 0, $count = 20)
{
$json = $this->paginate(MediaType::ARTICLE, $offset, $count);
$resultSet = [];
foreach ($json->item as $item) {
$resultSet[] = $this->expandNews(
$item->content->news_item,
new Pagi... | php | public function paginateNews ($offset = 0, $count = 20)
{
$json = $this->paginate(MediaType::ARTICLE, $offset, $count);
$resultSet = [];
foreach ($json->item as $item) {
$resultSet[] = $this->expandNews(
$item->content->news_item,
new Pagi... | [
"public",
"function",
"paginateNews",
"(",
"$",
"offset",
"=",
"0",
",",
"$",
"count",
"=",
"20",
")",
"{",
"$",
"json",
"=",
"$",
"this",
"->",
"paginate",
"(",
"MediaType",
"::",
"ARTICLE",
",",
"$",
"offset",
",",
"$",
"count",
")",
";",
"$",
... | Paginates through news items stored on the WeChat servers.
@param int $offset - The offset from which to start showing items.
@param int $count - The number of items to show.
@return Paginated\NewsResultSet
@throws Exception | [
"Paginates",
"through",
"news",
"items",
"stored",
"on",
"the",
"WeChat",
"servers",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Media/Service.php#L448-L461 |
189,998 | garbetjie/wechat-php | src/Media/Service.php | Service.paginate | private function paginate ($type, $offset, $limit)
{
// Ensure the limit is within range.
if ($limit < 1) {
$limit = 1;
} elseif ($limit > 20) {
$limit = 20;
}
// Send query.
$json = json_decode(
$this->client->send(
... | php | private function paginate ($type, $offset, $limit)
{
// Ensure the limit is within range.
if ($limit < 1) {
$limit = 1;
} elseif ($limit > 20) {
$limit = 20;
}
// Send query.
$json = json_decode(
$this->client->send(
... | [
"private",
"function",
"paginate",
"(",
"$",
"type",
",",
"$",
"offset",
",",
"$",
"limit",
")",
"{",
"// Ensure the limit is within range.",
"if",
"(",
"$",
"limit",
"<",
"1",
")",
"{",
"$",
"limit",
"=",
"1",
";",
"}",
"elseif",
"(",
"$",
"limit",
... | Performs the actual pagination request for the given item type.
@param string $type - The type of media item to paginate.
@param int $offset - The offset from which to start showing items.
@param int $limit - The number of items to show.
@return \stdClass
@throws Exception | [
"Performs",
"the",
"actual",
"pagination",
"request",
"for",
"the",
"given",
"item",
"type",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Media/Service.php#L473-L504 |
189,999 | garbetjie/wechat-php | src/Media/Service.php | Service.doPermanentFetchToStream | private function doPermanentFetchToStream ($mediaID, $into)
{
$body = $this->client->send(
new Request(
'POST',
'https://api.weixin.qq.com/cgi-bin/material/get_material',
[],
json_encode([
'media_id' => $mediaID,... | php | private function doPermanentFetchToStream ($mediaID, $into)
{
$body = $this->client->send(
new Request(
'POST',
'https://api.weixin.qq.com/cgi-bin/material/get_material',
[],
json_encode([
'media_id' => $mediaID,... | [
"private",
"function",
"doPermanentFetchToStream",
"(",
"$",
"mediaID",
",",
"$",
"into",
")",
"{",
"$",
"body",
"=",
"$",
"this",
"->",
"client",
"->",
"send",
"(",
"new",
"Request",
"(",
"'POST'",
",",
"'https://api.weixin.qq.com/cgi-bin/material/get_material'",... | Downloads the generic permanent media item into the given destination.
@param string $mediaID
@param string|null|resource $into
@return resource | [
"Downloads",
"the",
"generic",
"permanent",
"media",
"item",
"into",
"the",
"given",
"destination",
"."
] | 453027a447b401412421582198670689661f643a | https://github.com/garbetjie/wechat-php/blob/453027a447b401412421582198670689661f643a/src/Media/Service.php#L541-L562 |
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.