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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
28,600 | BabDev/Transifex-API | src/Connector/Languages.php | Languages.updateLanguage | public function updateLanguage(
string $slug,
string $langCode,
array $coordinators,
array $options = []
): ResponseInterface {
// Make sure the $coordinators array is not empty
if (!\count($coordinators)) {
throw new \InvalidArgumentException('The coordin... | php | public function updateLanguage(
string $slug,
string $langCode,
array $coordinators,
array $options = []
): ResponseInterface {
// Make sure the $coordinators array is not empty
if (!\count($coordinators)) {
throw new \InvalidArgumentException('The coordin... | [
"public",
"function",
"updateLanguage",
"(",
"string",
"$",
"slug",
",",
"string",
"$",
"langCode",
",",
"array",
"$",
"coordinators",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
":",
"ResponseInterface",
"{",
"// Make sure the $coordinators array is not emp... | Update a language within a project.
@param string $slug The slug for the project
@param string $langCode The language code for the new language
@param string[] $coordinators An array of coordinators for the language
@param array $options Optional additional params to send with the request
@ret... | [
"Update",
"a",
"language",
"within",
"a",
"project",
"."
] | 9e0ccd7980127db88f7c55a36afbd2a49d9e8436 | https://github.com/BabDev/Transifex-API/blob/9e0ccd7980127db88f7c55a36afbd2a49d9e8436/src/Connector/Languages.php#L183-L212 |
28,601 | BabDev/Transifex-API | src/Connector/Languages.php | Languages.updateReviewers | public function updateReviewers(string $project, string $langCode, array $reviewers, bool $skipInvalidUsername = false): ResponseInterface
{
return $this->updateTeam($project, $langCode, $reviewers, $skipInvalidUsername, 'reviewers');
} | php | public function updateReviewers(string $project, string $langCode, array $reviewers, bool $skipInvalidUsername = false): ResponseInterface
{
return $this->updateTeam($project, $langCode, $reviewers, $skipInvalidUsername, 'reviewers');
} | [
"public",
"function",
"updateReviewers",
"(",
"string",
"$",
"project",
",",
"string",
"$",
"langCode",
",",
"array",
"$",
"reviewers",
",",
"bool",
"$",
"skipInvalidUsername",
"=",
"false",
")",
":",
"ResponseInterface",
"{",
"return",
"$",
"this",
"->",
"u... | Update the reviewers for a language team in a project.
@param string $project The project to retrieve details for
@param string $langCode The language code to retrieve details for
@param string[] $reviewers An array of reviewers for the language
@param bool $skipInvalidUsername... | [
"Update",
"the",
"reviewers",
"for",
"a",
"language",
"team",
"in",
"a",
"project",
"."
] | 9e0ccd7980127db88f7c55a36afbd2a49d9e8436 | https://github.com/BabDev/Transifex-API/blob/9e0ccd7980127db88f7c55a36afbd2a49d9e8436/src/Connector/Languages.php#L224-L227 |
28,602 | BabDev/Transifex-API | src/Connector/Languages.php | Languages.updateTeam | protected function updateTeam(
string $project,
string $langCode,
array $members,
bool $skipInvalidUsername,
string $team
): ResponseInterface {
// Make sure the $members array is not empty
if (!\count($members)) {
throw new \InvalidArgumentExcepti... | php | protected function updateTeam(
string $project,
string $langCode,
array $members,
bool $skipInvalidUsername,
string $team
): ResponseInterface {
// Make sure the $members array is not empty
if (!\count($members)) {
throw new \InvalidArgumentExcepti... | [
"protected",
"function",
"updateTeam",
"(",
"string",
"$",
"project",
",",
"string",
"$",
"langCode",
",",
"array",
"$",
"members",
",",
"bool",
"$",
"skipInvalidUsername",
",",
"string",
"$",
"team",
")",
":",
"ResponseInterface",
"{",
"// Make sure the $member... | Base method to update a given language team in a project.
@param string $project The project to retrieve details for
@param string $langCode The language code to retrieve details for
@param string[] $members An array of the team members for the language
@param bool $skipInval... | [
"Base",
"method",
"to",
"update",
"a",
"given",
"language",
"team",
"in",
"a",
"project",
"."
] | 9e0ccd7980127db88f7c55a36afbd2a49d9e8436 | https://github.com/BabDev/Transifex-API/blob/9e0ccd7980127db88f7c55a36afbd2a49d9e8436/src/Connector/Languages.php#L242-L265 |
28,603 | BabDev/Transifex-API | src/Connector/Languages.php | Languages.updateTranslators | public function updateTranslators(
string $project,
string $langCode,
array $translators,
bool $skipInvalidUsername = false
): ResponseInterface {
return $this->updateTeam($project, $langCode, $translators, $skipInvalidUsername, 'translators');
} | php | public function updateTranslators(
string $project,
string $langCode,
array $translators,
bool $skipInvalidUsername = false
): ResponseInterface {
return $this->updateTeam($project, $langCode, $translators, $skipInvalidUsername, 'translators');
} | [
"public",
"function",
"updateTranslators",
"(",
"string",
"$",
"project",
",",
"string",
"$",
"langCode",
",",
"array",
"$",
"translators",
",",
"bool",
"$",
"skipInvalidUsername",
"=",
"false",
")",
":",
"ResponseInterface",
"{",
"return",
"$",
"this",
"->",
... | Update the translators for a language team in a project.
@param string $project The project to retrieve details for
@param string $langCode The language code to retrieve details for
@param string[] $translators An array of translators for the language
@param bool $skipInvalidUser... | [
"Update",
"the",
"translators",
"for",
"a",
"language",
"team",
"in",
"a",
"project",
"."
] | 9e0ccd7980127db88f7c55a36afbd2a49d9e8436 | https://github.com/BabDev/Transifex-API/blob/9e0ccd7980127db88f7c55a36afbd2a49d9e8436/src/Connector/Languages.php#L277-L284 |
28,604 | BabDev/Transifex-API | src/Connector/Statistics.php | Statistics.getStatistics | public function getStatistics(string $project, string $resource, string $lang = ''): ResponseInterface
{
return $this->client->sendRequest($this->createRequest('GET', $this->createUri("/api/2/project/$project/resource/$resource/stats/$lang")));
} | php | public function getStatistics(string $project, string $resource, string $lang = ''): ResponseInterface
{
return $this->client->sendRequest($this->createRequest('GET', $this->createUri("/api/2/project/$project/resource/$resource/stats/$lang")));
} | [
"public",
"function",
"getStatistics",
"(",
"string",
"$",
"project",
",",
"string",
"$",
"resource",
",",
"string",
"$",
"lang",
"=",
"''",
")",
":",
"ResponseInterface",
"{",
"return",
"$",
"this",
"->",
"client",
"->",
"sendRequest",
"(",
"$",
"this",
... | Get statistics on a specified resource.
@param string $project The slug for the project to pull from
@param string $resource The slug for the resource to pull from
@param string $lang An optional language code to return data only for a specified language
@return ResponseInterface | [
"Get",
"statistics",
"on",
"a",
"specified",
"resource",
"."
] | 9e0ccd7980127db88f7c55a36afbd2a49d9e8436 | https://github.com/BabDev/Transifex-API/blob/9e0ccd7980127db88f7c55a36afbd2a49d9e8436/src/Connector/Statistics.php#L24-L27 |
28,605 | TYPO3-CMS/redirects | Classes/Controller/ManagementController.php | ManagementController.handleRequest | public function handleRequest(ServerRequestInterface $request): ResponseInterface
{
$this->request = $request;
$action = $request->getQueryParams()['action'] ?? $request->getParsedBody()['action'] ?? 'overview';
$this->initializeView($action);
$result = call_user_func_array([$this, ... | php | public function handleRequest(ServerRequestInterface $request): ResponseInterface
{
$this->request = $request;
$action = $request->getQueryParams()['action'] ?? $request->getParsedBody()['action'] ?? 'overview';
$this->initializeView($action);
$result = call_user_func_array([$this, ... | [
"public",
"function",
"handleRequest",
"(",
"ServerRequestInterface",
"$",
"request",
")",
":",
"ResponseInterface",
"{",
"$",
"this",
"->",
"request",
"=",
"$",
"request",
";",
"$",
"action",
"=",
"$",
"request",
"->",
"getQueryParams",
"(",
")",
"[",
"'act... | Injects the request object for the current request, and renders the overview of all redirects
@param ServerRequestInterface $request the current request
@return ResponseInterface the response with the content | [
"Injects",
"the",
"request",
"object",
"for",
"the",
"current",
"request",
"and",
"renders",
"the",
"overview",
"of",
"all",
"redirects"
] | c617ec21dac92873bf9890fa0bfc1576afc86b5a | https://github.com/TYPO3-CMS/redirects/blob/c617ec21dac92873bf9890fa0bfc1576afc86b5a/Classes/Controller/ManagementController.php#L81-L93 |
28,606 | TYPO3-CMS/redirects | Classes/Controller/ManagementController.php | ManagementController.overviewAction | protected function overviewAction(ServerRequestInterface $request)
{
$this->getButtons();
$demand = Demand::createFromRequest($request);
$redirectRepository = GeneralUtility::makeInstance(RedirectRepository::class, $demand);
$count = $redirectRepository->countRedirectsByByDemand();
... | php | protected function overviewAction(ServerRequestInterface $request)
{
$this->getButtons();
$demand = Demand::createFromRequest($request);
$redirectRepository = GeneralUtility::makeInstance(RedirectRepository::class, $demand);
$count = $redirectRepository->countRedirectsByByDemand();
... | [
"protected",
"function",
"overviewAction",
"(",
"ServerRequestInterface",
"$",
"request",
")",
"{",
"$",
"this",
"->",
"getButtons",
"(",
")",
";",
"$",
"demand",
"=",
"Demand",
"::",
"createFromRequest",
"(",
"$",
"request",
")",
";",
"$",
"redirectRepository... | Show all redirects, and add a button to create a new redirect
@param ServerRequestInterface $request | [
"Show",
"all",
"redirects",
"and",
"add",
"a",
"button",
"to",
"create",
"a",
"new",
"redirect"
] | c617ec21dac92873bf9890fa0bfc1576afc86b5a | https://github.com/TYPO3-CMS/redirects/blob/c617ec21dac92873bf9890fa0bfc1576afc86b5a/Classes/Controller/ManagementController.php#L99-L115 |
28,607 | TYPO3-CMS/redirects | Classes/Controller/ManagementController.php | ManagementController.preparePagination | protected function preparePagination(Demand $demand, int $count): array
{
$numberOfPages = ceil($count / $demand->getLimit());
$endRecord = $demand->getOffset() + $demand->getLimit();
if ($endRecord > $count) {
$endRecord = $count;
}
$pagination = [
'... | php | protected function preparePagination(Demand $demand, int $count): array
{
$numberOfPages = ceil($count / $demand->getLimit());
$endRecord = $demand->getOffset() + $demand->getLimit();
if ($endRecord > $count) {
$endRecord = $count;
}
$pagination = [
'... | [
"protected",
"function",
"preparePagination",
"(",
"Demand",
"$",
"demand",
",",
"int",
"$",
"count",
")",
":",
"array",
"{",
"$",
"numberOfPages",
"=",
"ceil",
"(",
"$",
"count",
"/",
"$",
"demand",
"->",
"getLimit",
"(",
")",
")",
";",
"$",
"endRecor... | Prepares information for the pagination of the module
@param Demand $demand
@param int $count
@return array | [
"Prepares",
"information",
"for",
"the",
"pagination",
"of",
"the",
"module"
] | c617ec21dac92873bf9890fa0bfc1576afc86b5a | https://github.com/TYPO3-CMS/redirects/blob/c617ec21dac92873bf9890fa0bfc1576afc86b5a/Classes/Controller/ManagementController.php#L124-L147 |
28,608 | TYPO3-CMS/redirects | Classes/Controller/ManagementController.php | ManagementController.getButtons | protected function getButtons()
{
/** @var UriBuilder $uriBuilder */
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
// Create new
$newRecordButton = $buttonBar->makeLinkButton()
... | php | protected function getButtons()
{
/** @var UriBuilder $uriBuilder */
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
// Create new
$newRecordButton = $buttonBar->makeLinkButton()
... | [
"protected",
"function",
"getButtons",
"(",
")",
"{",
"/** @var UriBuilder $uriBuilder */",
"$",
"uriBuilder",
"=",
"GeneralUtility",
"::",
"makeInstance",
"(",
"UriBuilder",
"::",
"class",
")",
";",
"$",
"buttonBar",
"=",
"$",
"this",
"->",
"moduleTemplate",
"->"... | Create document header buttons | [
"Create",
"document",
"header",
"buttons"
] | c617ec21dac92873bf9890fa0bfc1576afc86b5a | https://github.com/TYPO3-CMS/redirects/blob/c617ec21dac92873bf9890fa0bfc1576afc86b5a/Classes/Controller/ManagementController.php#L164-L202 |
28,609 | rinvex/cortex-pages | src/Http/Controllers/Managerarea/PagesController.php | PagesController.import | public function import(Page $page, ImportRecordsDataTable $importRecordsDataTable)
{
return $importRecordsDataTable->with([
'resource' => $page,
'tabs' => 'managerarea.pages.tabs',
'url' => route('managerarea.pages.stash'),
'id' => "managerarea-pages-{$page->g... | php | public function import(Page $page, ImportRecordsDataTable $importRecordsDataTable)
{
return $importRecordsDataTable->with([
'resource' => $page,
'tabs' => 'managerarea.pages.tabs',
'url' => route('managerarea.pages.stash'),
'id' => "managerarea-pages-{$page->g... | [
"public",
"function",
"import",
"(",
"Page",
"$",
"page",
",",
"ImportRecordsDataTable",
"$",
"importRecordsDataTable",
")",
"{",
"return",
"$",
"importRecordsDataTable",
"->",
"with",
"(",
"[",
"'resource'",
"=>",
"$",
"page",
",",
"'tabs'",
"=>",
"'managerarea... | Import pages.
@param \Cortex\Pages\Models\Page $page
@param \Cortex\Foundation\DataTables\ImportRecordsDataTable $importRecordsDataTable
@return \Illuminate\View\View | [
"Import",
"pages",
"."
] | 7229fedb34d352fda0e721f950c55074f0fb0dce | https://github.com/rinvex/cortex-pages/blob/7229fedb34d352fda0e721f950c55074f0fb0dce/src/Http/Controllers/Managerarea/PagesController.php#L65-L73 |
28,610 | rinvex/cortex-pages | src/Http/Controllers/Managerarea/PagesController.php | PagesController.destroy | public function destroy(Page $page)
{
$page->delete();
return intend([
'url' => route('managerarea.pages.index'),
'with' => ['warning' => trans('cortex/foundation::messages.resource_deleted', ['resource' => trans('cortex/pages::common.page'), 'identifier' => $page->name])],
... | php | public function destroy(Page $page)
{
$page->delete();
return intend([
'url' => route('managerarea.pages.index'),
'with' => ['warning' => trans('cortex/foundation::messages.resource_deleted', ['resource' => trans('cortex/pages::common.page'), 'identifier' => $page->name])],
... | [
"public",
"function",
"destroy",
"(",
"Page",
"$",
"page",
")",
"{",
"$",
"page",
"->",
"delete",
"(",
")",
";",
"return",
"intend",
"(",
"[",
"'url'",
"=>",
"route",
"(",
"'managerarea.pages.index'",
")",
",",
"'with'",
"=>",
"[",
"'warning'",
"=>",
"... | Destroy given page.
@param \Cortex\Pages\Models\Page $page
@throws \Exception
@return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse | [
"Destroy",
"given",
"page",
"."
] | 7229fedb34d352fda0e721f950c55074f0fb0dce | https://github.com/rinvex/cortex-pages/blob/7229fedb34d352fda0e721f950c55074f0fb0dce/src/Http/Controllers/Managerarea/PagesController.php#L217-L225 |
28,611 | mmoreram/ControllerExtraBundle | Resolver/EntityAnnotationResolver.php | EntityAnnotationResolver.evaluateMapping | private function evaluateMapping(
LoadEntity $annotation,
string $entityNamespace
) {
if (!empty($annotation->getMapping())) {
$mapping = $annotation->getMapping();
$mappingFallback = !is_null($annotation->getMappingFallback())
? $annotation->getMappin... | php | private function evaluateMapping(
LoadEntity $annotation,
string $entityNamespace
) {
if (!empty($annotation->getMapping())) {
$mapping = $annotation->getMapping();
$mappingFallback = !is_null($annotation->getMappingFallback())
? $annotation->getMappin... | [
"private",
"function",
"evaluateMapping",
"(",
"LoadEntity",
"$",
"annotation",
",",
"string",
"$",
"entityNamespace",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"annotation",
"->",
"getMapping",
"(",
")",
")",
")",
"{",
"$",
"mapping",
"=",
"$",
"anno... | Resolve doctrine mapping and return entity given or mapped instance.
@param LoadEntity $annotation
@param string $entityNamespace
@return null|object
@throws EntityNotFoundException | [
"Resolve",
"doctrine",
"mapping",
"and",
"return",
"entity",
"given",
"or",
"mapped",
"instance",
"."
] | b5841b6ca8f0022a2d88fdfbf743f0b76c4644e3 | https://github.com/mmoreram/ControllerExtraBundle/blob/b5841b6ca8f0022a2d88fdfbf743f0b76c4644e3/Resolver/EntityAnnotationResolver.php#L189-L241 |
28,612 | mmoreram/ControllerExtraBundle | Resolver/EntityAnnotationResolver.php | EntityAnnotationResolver.evaluateSetters | private function evaluateSetters(
ParameterBag $attributes,
$entity,
array $setters
) {
foreach ($setters as $method => $value) {
$entity->$method($attributes->get($value));
}
} | php | private function evaluateSetters(
ParameterBag $attributes,
$entity,
array $setters
) {
foreach ($setters as $method => $value) {
$entity->$method($attributes->get($value));
}
} | [
"private",
"function",
"evaluateSetters",
"(",
"ParameterBag",
"$",
"attributes",
",",
"$",
"entity",
",",
"array",
"$",
"setters",
")",
"{",
"foreach",
"(",
"$",
"setters",
"as",
"$",
"method",
"=>",
"$",
"value",
")",
"{",
"$",
"entity",
"->",
"$",
"... | Evaluate setters.
@param ParameterBag $attributes
@param object $entity
@param array $setters | [
"Evaluate",
"setters",
"."
] | b5841b6ca8f0022a2d88fdfbf743f0b76c4644e3 | https://github.com/mmoreram/ControllerExtraBundle/blob/b5841b6ca8f0022a2d88fdfbf743f0b76c4644e3/Resolver/EntityAnnotationResolver.php#L250-L258 |
28,613 | mmoreram/ControllerExtraBundle | Resolver/EntityAnnotationResolver.php | EntityAnnotationResolver.resolveRepositoryLookup | private function resolveRepositoryLookup(
LoadEntity $annotation,
string $entityClass,
array $mapping
) {
$annotationRepository = $annotation->getRepository();
$annotationHasRepository = !is_null($annotationRepository) && is_array($annotationRepository);
if ($annotati... | php | private function resolveRepositoryLookup(
LoadEntity $annotation,
string $entityClass,
array $mapping
) {
$annotationRepository = $annotation->getRepository();
$annotationHasRepository = !is_null($annotationRepository) && is_array($annotationRepository);
if ($annotati... | [
"private",
"function",
"resolveRepositoryLookup",
"(",
"LoadEntity",
"$",
"annotation",
",",
"string",
"$",
"entityClass",
",",
"array",
"$",
"mapping",
")",
"{",
"$",
"annotationRepository",
"=",
"$",
"annotation",
"->",
"getRepository",
"(",
")",
";",
"$",
"... | Resolve repository lookup.
@param LoadEntity $annotation
@param string $entityClass
@param array $mapping
@return object|null | [
"Resolve",
"repository",
"lookup",
"."
] | b5841b6ca8f0022a2d88fdfbf743f0b76c4644e3 | https://github.com/mmoreram/ControllerExtraBundle/blob/b5841b6ca8f0022a2d88fdfbf743f0b76c4644e3/Resolver/EntityAnnotationResolver.php#L269-L297 |
28,614 | mmoreram/ControllerExtraBundle | Resolver/EntityAnnotationResolver.php | EntityAnnotationResolver.resolvePersist | private function resolvePersist(LoadEntity $annotation, $entity)
{
/**
* Persist block.
*
* This block defines if entity must be persisted using desired
* manager.
*
* Given the entity we can find which manager manages it
*
* Same logic... | php | private function resolvePersist(LoadEntity $annotation, $entity)
{
/**
* Persist block.
*
* This block defines if entity must be persisted using desired
* manager.
*
* Given the entity we can find which manager manages it
*
* Same logic... | [
"private",
"function",
"resolvePersist",
"(",
"LoadEntity",
"$",
"annotation",
",",
"$",
"entity",
")",
"{",
"/**\n * Persist block.\n *\n * This block defines if entity must be persisted using desired\n * manager.\n *\n * Given the entity we c... | Persist block.
This block defines if entity must be persisted using desired
manager.
This manager is defined as default in bundle parameters, but can
be overwritten in each annotation
Same logic in perisist option. This variable is defined in bundle
parameters and can be overwritten there. Can also be defined in
eve... | [
"Persist",
"block",
"."
] | b5841b6ca8f0022a2d88fdfbf743f0b76c4644e3 | https://github.com/mmoreram/ControllerExtraBundle/blob/b5841b6ca8f0022a2d88fdfbf743f0b76c4644e3/Resolver/EntityAnnotationResolver.php#L315-L348 |
28,615 | QoboLtd/cakephp-search | src/Utility/Export.php | Export.execute | public function execute(int $page, int $limit): void
{
$page = $page <= 1 ? 1 : $page;
$rows = $this->getRows($page, $limit);
$headers = [];
$mode = 'a';
if (1 === $page) {
$headers = $this->getHeaders();
$mode = 'w';
}
// Prepend col... | php | public function execute(int $page, int $limit): void
{
$page = $page <= 1 ? 1 : $page;
$rows = $this->getRows($page, $limit);
$headers = [];
$mode = 'a';
if (1 === $page) {
$headers = $this->getHeaders();
$mode = 'w';
}
// Prepend col... | [
"public",
"function",
"execute",
"(",
"int",
"$",
"page",
",",
"int",
"$",
"limit",
")",
":",
"void",
"{",
"$",
"page",
"=",
"$",
"page",
"<=",
"1",
"?",
"1",
":",
"$",
"page",
";",
"$",
"rows",
"=",
"$",
"this",
"->",
"getRows",
"(",
"$",
"p... | Execute export.
@param int $page Pagination page
@param int $limit Pagination limit
@return void | [
"Execute",
"export",
"."
] | 095a0e822781ac11eade0c03c7729b693daa1ba8 | https://github.com/QoboLtd/cakephp-search/blob/095a0e822781ac11eade0c03c7729b693daa1ba8/src/Utility/Export.php#L123-L141 |
28,616 | QoboLtd/cakephp-search | src/Utility/Export.php | Export.getRows | protected function getRows(int $page, int $limit): array
{
$displayColumns = $this->getDisplayColumns();
if (empty($displayColumns)) {
return [];
}
$query = $this->query->page($page, $limit);
$entities = $query->all();
if ($entities->isEmpty()) {
... | php | protected function getRows(int $page, int $limit): array
{
$displayColumns = $this->getDisplayColumns();
if (empty($displayColumns)) {
return [];
}
$query = $this->query->page($page, $limit);
$entities = $query->all();
if ($entities->isEmpty()) {
... | [
"protected",
"function",
"getRows",
"(",
"int",
"$",
"page",
",",
"int",
"$",
"limit",
")",
":",
"array",
"{",
"$",
"displayColumns",
"=",
"$",
"this",
"->",
"getDisplayColumns",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"displayColumns",
")",
")",
... | Get export rows.
@param int $page Pagination page
@param int $limit Pagination limit
@return mixed[] | [
"Get",
"export",
"rows",
"."
] | 095a0e822781ac11eade0c03c7729b693daa1ba8 | https://github.com/QoboLtd/cakephp-search/blob/095a0e822781ac11eade0c03c7729b693daa1ba8/src/Utility/Export.php#L160-L201 |
28,617 | QoboLtd/cakephp-search | src/Utility/Export.php | Export.getHeaders | protected function getHeaders(): array
{
$displayColumns = $this->getDisplayColumns();
if (empty($displayColumns)) {
return [];
}
$table = TableRegistry::get($this->search->get('model'));
$associationLabels = Utility::instance()->getAssociationLabels($table);
... | php | protected function getHeaders(): array
{
$displayColumns = $this->getDisplayColumns();
if (empty($displayColumns)) {
return [];
}
$table = TableRegistry::get($this->search->get('model'));
$associationLabels = Utility::instance()->getAssociationLabels($table);
... | [
"protected",
"function",
"getHeaders",
"(",
")",
":",
"array",
"{",
"$",
"displayColumns",
"=",
"$",
"this",
"->",
"getDisplayColumns",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"displayColumns",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",
"... | Get export headers.
@return mixed[] | [
"Get",
"export",
"headers",
"."
] | 095a0e822781ac11eade0c03c7729b693daa1ba8 | https://github.com/QoboLtd/cakephp-search/blob/095a0e822781ac11eade0c03c7729b693daa1ba8/src/Utility/Export.php#L208-L237 |
28,618 | QoboLtd/cakephp-search | src/Utility/Export.php | Export.create | protected function create(array $data, string $mode = 'a'): void
{
// create file path
$file = new File($this->path, true);
// skip if file is not writable
if (! $file->writable()) {
$this->log(sprintf('Export file is not writable: %s', $file->pwd()), LogLevel::ERROR);
... | php | protected function create(array $data, string $mode = 'a'): void
{
// create file path
$file = new File($this->path, true);
// skip if file is not writable
if (! $file->writable()) {
$this->log(sprintf('Export file is not writable: %s', $file->pwd()), LogLevel::ERROR);
... | [
"protected",
"function",
"create",
"(",
"array",
"$",
"data",
",",
"string",
"$",
"mode",
"=",
"'a'",
")",
":",
"void",
"{",
"// create file path",
"$",
"file",
"=",
"new",
"File",
"(",
"$",
"this",
"->",
"path",
",",
"true",
")",
";",
"// skip if file... | Create export file.
@param mixed[] $data CSV data
@param string $mode File mode
@return void | [
"Create",
"export",
"file",
"."
] | 095a0e822781ac11eade0c03c7729b693daa1ba8 | https://github.com/QoboLtd/cakephp-search/blob/095a0e822781ac11eade0c03c7729b693daa1ba8/src/Utility/Export.php#L271-L300 |
28,619 | mmoreram/ControllerExtraBundle | Provider/EntityProvider.php | EntityProvider.create | public function create(AnnotationWithEntityReference $annotation)
{
return null !== $annotation->getFactory()
? $this->evaluateEntityInstanceFactory($annotation->getFactory())
: $this->evaluateEntityInstanceNamespace($annotation->getNamespace());
} | php | public function create(AnnotationWithEntityReference $annotation)
{
return null !== $annotation->getFactory()
? $this->evaluateEntityInstanceFactory($annotation->getFactory())
: $this->evaluateEntityInstanceNamespace($annotation->getNamespace());
} | [
"public",
"function",
"create",
"(",
"AnnotationWithEntityReference",
"$",
"annotation",
")",
"{",
"return",
"null",
"!==",
"$",
"annotation",
"->",
"getFactory",
"(",
")",
"?",
"$",
"this",
"->",
"evaluateEntityInstanceFactory",
"(",
"$",
"annotation",
"->",
"g... | Class provider, given several formats.
Accepted formats:
class = "my.class.parameter",
class = "\My\Class\Namespace",
class = "MmoreramCustomBundle:User",
factory = {
"factory": "Mmoreram\ControllerExtraBundle\Factory\EntityFactory",
"factory": "my_factory_service",
"method": "create",
"static": true
}
@param Annota... | [
"Class",
"provider",
"given",
"several",
"formats",
"."
] | b5841b6ca8f0022a2d88fdfbf743f0b76c4644e3 | https://github.com/mmoreram/ControllerExtraBundle/blob/b5841b6ca8f0022a2d88fdfbf743f0b76c4644e3/Provider/EntityProvider.php#L101-L106 |
28,620 | mmoreram/ControllerExtraBundle | Provider/EntityProvider.php | EntityProvider.evaluateEntityInstanceFactory | public function evaluateEntityInstanceFactory(array $factory)
{
if (!isset($factory['class'])) {
throw new InvalidArgumentException();
}
$factoryReference = $factory['class'];
$factoryMethod = isset($factory['method'])
? $factory['method']
: $thi... | php | public function evaluateEntityInstanceFactory(array $factory)
{
if (!isset($factory['class'])) {
throw new InvalidArgumentException();
}
$factoryReference = $factory['class'];
$factoryMethod = isset($factory['method'])
? $factory['method']
: $thi... | [
"public",
"function",
"evaluateEntityInstanceFactory",
"(",
"array",
"$",
"factory",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"factory",
"[",
"'class'",
"]",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
")",
";",
"}",
"$",
"factoryRe... | Evaluates entity instance using a factory.
@param array $factory
@return object Entity instance
@throws InvalidArgumentException if the service is not defined
@throws ServiceCircularReferenceException When a circular reference is detected
@throws ServiceNotFoundException When the service is not fou... | [
"Evaluates",
"entity",
"instance",
"using",
"a",
"factory",
"."
] | b5841b6ca8f0022a2d88fdfbf743f0b76c4644e3 | https://github.com/mmoreram/ControllerExtraBundle/blob/b5841b6ca8f0022a2d88fdfbf743f0b76c4644e3/Provider/EntityProvider.php#L119-L148 |
28,621 | mmoreram/ControllerExtraBundle | Provider/EntityProvider.php | EntityProvider.evaluateEntityNamespace | public function evaluateEntityNamespace(string $namespace)
{
/**
* Trying to generate new entity given that the class is the entity
* namespace.
*/
if (class_exists($namespace)) {
return $namespace;
}
/**
* Trying to generate new entit... | php | public function evaluateEntityNamespace(string $namespace)
{
/**
* Trying to generate new entity given that the class is the entity
* namespace.
*/
if (class_exists($namespace)) {
return $namespace;
}
/**
* Trying to generate new entit... | [
"public",
"function",
"evaluateEntityNamespace",
"(",
"string",
"$",
"namespace",
")",
"{",
"/**\n * Trying to generate new entity given that the class is the entity\n * namespace.\n */",
"if",
"(",
"class_exists",
"(",
"$",
"namespace",
")",
")",
"{",
"... | Evaluates entity instance using the namespace.
@param string $namespace
@return string
@throws ClassNotFoundException if class is not found | [
"Evaluates",
"entity",
"instance",
"using",
"the",
"namespace",
"."
] | b5841b6ca8f0022a2d88fdfbf743f0b76c4644e3 | https://github.com/mmoreram/ControllerExtraBundle/blob/b5841b6ca8f0022a2d88fdfbf743f0b76c4644e3/Provider/EntityProvider.php#L175-L248 |
28,622 | hiqdev/hipanel-module-finance | src/cart/AbstractPurchase.php | AbstractPurchase.execute | public function execute()
{
if ($this->validate()) {
$this->_result = static::perform(static::operation(), $this->getAttributes());
return true;
}
return false;
} | php | public function execute()
{
if ($this->validate()) {
$this->_result = static::perform(static::operation(), $this->getAttributes());
return true;
}
return false;
} | [
"public",
"function",
"execute",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"validate",
"(",
")",
")",
"{",
"$",
"this",
"->",
"_result",
"=",
"static",
"::",
"perform",
"(",
"static",
"::",
"operation",
"(",
")",
",",
"$",
"this",
"->",
"getAttr... | Executes the purchase.
Calls proper API commands to purchase the product.
@throws ErrorPurchaseException in case of failed purchase
@return true if the item was purchased successfully | [
"Executes",
"the",
"purchase",
".",
"Calls",
"proper",
"API",
"commands",
"to",
"purchase",
"the",
"product",
"."
] | fa027420ddc1d6de22a6d830e14dde587c837220 | https://github.com/hiqdev/hipanel-module-finance/blob/fa027420ddc1d6de22a6d830e14dde587c837220/src/cart/AbstractPurchase.php#L76-L85 |
28,623 | TYPO3-CMS/redirects | Classes/Evaluation/SourceHost.php | SourceHost.evaluateFieldValue | public function evaluateFieldValue(string $value): string
{
// 1) Special case: * means any domain
if ($value === '*') {
return $value;
}
// 2) Check if value contains a protocol like http:// https:// etc...
if (strpos($value, '://') !== false) {
$tmp... | php | public function evaluateFieldValue(string $value): string
{
// 1) Special case: * means any domain
if ($value === '*') {
return $value;
}
// 2) Check if value contains a protocol like http:// https:// etc...
if (strpos($value, '://') !== false) {
$tmp... | [
"public",
"function",
"evaluateFieldValue",
"(",
"string",
"$",
"value",
")",
":",
"string",
"{",
"// 1) Special case: * means any domain",
"if",
"(",
"$",
"value",
"===",
"'*'",
")",
"{",
"return",
"$",
"value",
";",
"}",
"// 2) Check if value contains a protocol l... | Server-side removing of protocol on save
@param string $value The field value to be evaluated
@return string Evaluated field value | [
"Server",
"-",
"side",
"removing",
"of",
"protocol",
"on",
"save"
] | c617ec21dac92873bf9890fa0bfc1576afc86b5a | https://github.com/TYPO3-CMS/redirects/blob/c617ec21dac92873bf9890fa0bfc1576afc86b5a/Classes/Evaluation/SourceHost.php#L47-L82 |
28,624 | mmoreram/ControllerExtraBundle | Resolver/JsonResponseAnnotationResolver.php | JsonResponseAnnotationResolver.createJsonResponseIfNeeded | private function createJsonResponseIfNeeded(
GetResponseEvent $event,
$result
) {
/**
* Only flushes if exists AnnotationFlush as a controller annotations.
*/
if ($this->returnJson) {
if ($result instanceof Exception) {
$this->status = $r... | php | private function createJsonResponseIfNeeded(
GetResponseEvent $event,
$result
) {
/**
* Only flushes if exists AnnotationFlush as a controller annotations.
*/
if ($this->returnJson) {
if ($result instanceof Exception) {
$this->status = $r... | [
"private",
"function",
"createJsonResponseIfNeeded",
"(",
"GetResponseEvent",
"$",
"event",
",",
"$",
"result",
")",
"{",
"/**\n * Only flushes if exists AnnotationFlush as a controller annotations.\n */",
"if",
"(",
"$",
"this",
"->",
"returnJson",
")",
"{",
... | Create new Json Response if needed.
@param GetResponseEvent $event
@param mixed $result | [
"Create",
"new",
"Json",
"Response",
"if",
"needed",
"."
] | b5841b6ca8f0022a2d88fdfbf743f0b76c4644e3 | https://github.com/mmoreram/ControllerExtraBundle/blob/b5841b6ca8f0022a2d88fdfbf743f0b76c4644e3/Resolver/JsonResponseAnnotationResolver.php#L154-L182 |
28,625 | MetaModels/filter_perimetersearch | src/EventListener/DcGeneral/Table/FilterSetting/Base.php | Base.isAllowedProperty | protected function isAllowedProperty($event, $dataDefinitionName, $properties)
{
if ($event->getEnvironment()->getDataDefinition()->getName() !== $dataDefinitionName) {
return false;
}
if (!\in_array($event->getPropertyName(), $properties)) {
return false;
}
... | php | protected function isAllowedProperty($event, $dataDefinitionName, $properties)
{
if ($event->getEnvironment()->getDataDefinition()->getName() !== $dataDefinitionName) {
return false;
}
if (!\in_array($event->getPropertyName(), $properties)) {
return false;
}
... | [
"protected",
"function",
"isAllowedProperty",
"(",
"$",
"event",
",",
"$",
"dataDefinitionName",
",",
"$",
"properties",
")",
"{",
"if",
"(",
"$",
"event",
"->",
"getEnvironment",
"(",
")",
"->",
"getDataDefinition",
"(",
")",
"->",
"getName",
"(",
")",
"!... | Check if the current context is valid.
@param GetPropertyOptionsEvent|GetOptionsEvent $event The event.
@param string $dataDefinitionName The allowed name of the data definition.
@param array $properties A list of allowed propertie... | [
"Check",
"if",
"the",
"current",
"context",
"is",
"valid",
"."
] | 953d55881a1855972c5f47a7552863986702163c | https://github.com/MetaModels/filter_perimetersearch/blob/953d55881a1855972c5f47a7552863986702163c/src/EventListener/DcGeneral/Table/FilterSetting/Base.php#L59-L70 |
28,626 | QoboLtd/cakephp-search | src/Utility/Options.php | Options.getDefaults | public static function getDefaults(RepositoryInterface $table): array
{
$result['display_columns'] = static::getListingFields($table);
$result['sort_by_field'] = current($result['display_columns']);
$result['sort_by_order'] = static::DEFAULT_SORT_BY_ORDER;
$result['aggregator'] = sta... | php | public static function getDefaults(RepositoryInterface $table): array
{
$result['display_columns'] = static::getListingFields($table);
$result['sort_by_field'] = current($result['display_columns']);
$result['sort_by_order'] = static::DEFAULT_SORT_BY_ORDER;
$result['aggregator'] = sta... | [
"public",
"static",
"function",
"getDefaults",
"(",
"RepositoryInterface",
"$",
"table",
")",
":",
"array",
"{",
"$",
"result",
"[",
"'display_columns'",
"]",
"=",
"static",
"::",
"getListingFields",
"(",
"$",
"table",
")",
";",
"$",
"result",
"[",
"'sort_by... | Default search options.
@param \Cake\Datasource\RepositoryInterface $table Table instance
@return mixed[] | [
"Default",
"search",
"options",
"."
] | 095a0e822781ac11eade0c03c7729b693daa1ba8 | https://github.com/QoboLtd/cakephp-search/blob/095a0e822781ac11eade0c03c7729b693daa1ba8/src/Utility/Options.php#L146-L154 |
28,627 | QoboLtd/cakephp-search | src/Utility/Options.php | Options.getListingFields | public static function getListingFields(RepositoryInterface $table): array
{
// broadcast event to fetch display fields
$event = new Event((string)EventName::MODEL_SEARCH_DISPLAY_FIELDS(), null, [
'table' => $table
]);
EventManager::instance()->dispatch($event);
... | php | public static function getListingFields(RepositoryInterface $table): array
{
// broadcast event to fetch display fields
$event = new Event((string)EventName::MODEL_SEARCH_DISPLAY_FIELDS(), null, [
'table' => $table
]);
EventManager::instance()->dispatch($event);
... | [
"public",
"static",
"function",
"getListingFields",
"(",
"RepositoryInterface",
"$",
"table",
")",
":",
"array",
"{",
"// broadcast event to fetch display fields",
"$",
"event",
"=",
"new",
"Event",
"(",
"(",
"string",
")",
"EventName",
"::",
"MODEL_SEARCH_DISPLAY_FIE... | Current table display fields getter.
@param \Cake\Datasource\RepositoryInterface $table Table instance
@return mixed[] | [
"Current",
"table",
"display",
"fields",
"getter",
"."
] | 095a0e822781ac11eade0c03c7729b693daa1ba8 | https://github.com/QoboLtd/cakephp-search/blob/095a0e822781ac11eade0c03c7729b693daa1ba8/src/Utility/Options.php#L162-L180 |
28,628 | QoboLtd/cakephp-search | src/Utility/Options.php | Options.getDefaultDisplayFields | protected static function getDefaultDisplayFields(RepositoryInterface $table): array
{
/** @var \Cake\ORM\Table */
$table = $table;
$result = (array)$table->getPrimaryKey();
array_push($result, $table->getDisplayField());
$result = array_merge($result, static::$defaultDispl... | php | protected static function getDefaultDisplayFields(RepositoryInterface $table): array
{
/** @var \Cake\ORM\Table */
$table = $table;
$result = (array)$table->getPrimaryKey();
array_push($result, $table->getDisplayField());
$result = array_merge($result, static::$defaultDispl... | [
"protected",
"static",
"function",
"getDefaultDisplayFields",
"(",
"RepositoryInterface",
"$",
"table",
")",
":",
"array",
"{",
"/** @var \\Cake\\ORM\\Table */",
"$",
"table",
"=",
"$",
"table",
";",
"$",
"result",
"=",
"(",
"array",
")",
"$",
"table",
"->",
"... | Default display fields getter.
@param \Cake\Datasource\RepositoryInterface $table Table instance
@return mixed[] | [
"Default",
"display",
"fields",
"getter",
"."
] | 095a0e822781ac11eade0c03c7729b693daa1ba8 | https://github.com/QoboLtd/cakephp-search/blob/095a0e822781ac11eade0c03c7729b693daa1ba8/src/Utility/Options.php#L188-L211 |
28,629 | dereuromark/media-embed | src/Object/MediaObject.php | MediaObject.icon | public function icon() {
$url = $this->_stub['website'];
if (!$url) {
return null;
}
$pieces = parse_url($url);
$url = $pieces['host'];
$icon = 'http://www.google.com/s2/favicons?domain=';
$icon .= $url;
$context = stream_context_create(
['http' => ['header' => 'Connection: close']]);
// E.g.... | php | public function icon() {
$url = $this->_stub['website'];
if (!$url) {
return null;
}
$pieces = parse_url($url);
$url = $pieces['host'];
$icon = 'http://www.google.com/s2/favicons?domain=';
$icon .= $url;
$context = stream_context_create(
['http' => ['header' => 'Connection: close']]);
// E.g.... | [
"public",
"function",
"icon",
"(",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"_stub",
"[",
"'website'",
"]",
";",
"if",
"(",
"!",
"$",
"url",
")",
"{",
"return",
"null",
";",
"}",
"$",
"pieces",
"=",
"parse_url",
"(",
"$",
"url",
")",
";",
... | Returns a png img
@return string|null Resource content or null if not available | [
"Returns",
"a",
"png",
"img"
] | bd940aafbaf4577a5dd61879e0601f278593f523 | https://github.com/dereuromark/media-embed/blob/bd940aafbaf4577a5dd61879e0601f278593f523/src/Object/MediaObject.php#L187-L208 |
28,630 | dereuromark/media-embed | src/Object/MediaObject.php | MediaObject.setParam | public function setParam($param, $value = null) {
if (!empty($this->_stub['iframe-player']) && $this->config['prefer'] === 'iframe') {
if (is_array($param)) {
foreach ($param as $p => $v) {
$this->_iframeParams[$p] = $v;
}
} else {
$this->_iframeParams[$param] = $value;
}
} else {
if (... | php | public function setParam($param, $value = null) {
if (!empty($this->_stub['iframe-player']) && $this->config['prefer'] === 'iframe') {
if (is_array($param)) {
foreach ($param as $p => $v) {
$this->_iframeParams[$p] = $v;
}
} else {
$this->_iframeParams[$param] = $value;
}
} else {
if (... | [
"public",
"function",
"setParam",
"(",
"$",
"param",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"_stub",
"[",
"'iframe-player'",
"]",
")",
"&&",
"$",
"this",
"->",
"config",
"[",
"'prefer'",
"]",
"===... | Override a default object param value
@param mixed $param The name of the param to be set
or an array of multiple params to set
@param string|null $value (optional) the value to set the param to
if only one param is being set
@return $this | [
"Override",
"a",
"default",
"object",
"param",
"value"
] | bd940aafbaf4577a5dd61879e0601f278593f523 | https://github.com/dereuromark/media-embed/blob/bd940aafbaf4577a5dd61879e0601f278593f523/src/Object/MediaObject.php#L243-L264 |
28,631 | dereuromark/media-embed | src/Object/MediaObject.php | MediaObject.setAttribute | public function setAttribute($param, $value = null) {
if (!empty($this->_stub['iframe-player']) && $this->config['prefer'] === 'iframe') {
if (is_array($param)) {
foreach ($param as $p => $v) {
$this->_iframeAttributes[$p] = $v;
}
} else {
$this->_iframeAttributes[$param] = $value;
}
} el... | php | public function setAttribute($param, $value = null) {
if (!empty($this->_stub['iframe-player']) && $this->config['prefer'] === 'iframe') {
if (is_array($param)) {
foreach ($param as $p => $v) {
$this->_iframeAttributes[$p] = $v;
}
} else {
$this->_iframeAttributes[$param] = $value;
}
} el... | [
"public",
"function",
"setAttribute",
"(",
"$",
"param",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"_stub",
"[",
"'iframe-player'",
"]",
")",
"&&",
"$",
"this",
"->",
"config",
"[",
"'prefer'",
"]",
... | Override a default object attribute value
@param mixed $param The name of the attribute to be set
or an array of multiple attribs to be set
@param string|int|null $value (optional) the value to set the param to
if only one param is being set
@return $this | [
"Override",
"a",
"default",
"object",
"attribute",
"value"
] | bd940aafbaf4577a5dd61879e0601f278593f523 | https://github.com/dereuromark/media-embed/blob/bd940aafbaf4577a5dd61879e0601f278593f523/src/Object/MediaObject.php#L275-L296 |
28,632 | dereuromark/media-embed | src/Object/MediaObject.php | MediaObject.setHeight | public function setHeight($height, $adjustWidth = false) {
if ($adjustWidth && is_numeric($height)) {
$this->_adjustDimensions('width', 'height', $height);
}
return $this->setAttribute('height', $height);
} | php | public function setHeight($height, $adjustWidth = false) {
if ($adjustWidth && is_numeric($height)) {
$this->_adjustDimensions('width', 'height', $height);
}
return $this->setAttribute('height', $height);
} | [
"public",
"function",
"setHeight",
"(",
"$",
"height",
",",
"$",
"adjustWidth",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"adjustWidth",
"&&",
"is_numeric",
"(",
"$",
"height",
")",
")",
"{",
"$",
"this",
"->",
"_adjustDimensions",
"(",
"'width'",
",",
"... | Set the height of the object
@param mixed $height Height to set the object to
@param bool $adjustWidth
@return $this | [
"Set",
"the",
"height",
"of",
"the",
"object"
] | bd940aafbaf4577a5dd61879e0601f278593f523 | https://github.com/dereuromark/media-embed/blob/bd940aafbaf4577a5dd61879e0601f278593f523/src/Object/MediaObject.php#L305-L310 |
28,633 | dereuromark/media-embed | src/Object/MediaObject.php | MediaObject.setWidth | public function setWidth($width, $adjustHeight = false) {
if ($adjustHeight && is_numeric($width)) {
$this->_adjustDimensions('height', 'width', $width);
}
return $this->setAttribute('width', $width);
} | php | public function setWidth($width, $adjustHeight = false) {
if ($adjustHeight && is_numeric($width)) {
$this->_adjustDimensions('height', 'width', $width);
}
return $this->setAttribute('width', $width);
} | [
"public",
"function",
"setWidth",
"(",
"$",
"width",
",",
"$",
"adjustHeight",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"adjustHeight",
"&&",
"is_numeric",
"(",
"$",
"width",
")",
")",
"{",
"$",
"this",
"->",
"_adjustDimensions",
"(",
"'height'",
",",
"... | Set the width of the object
@param mixed $width Width to set the object to
@param bool $adjustHeight
@return $this | [
"Set",
"the",
"width",
"of",
"the",
"object"
] | bd940aafbaf4577a5dd61879e0601f278593f523 | https://github.com/dereuromark/media-embed/blob/bd940aafbaf4577a5dd61879e0601f278593f523/src/Object/MediaObject.php#L319-L324 |
28,634 | dereuromark/media-embed | src/Object/MediaObject.php | MediaObject._adjustDimensions | protected function _adjustDimensions($type, $fromType, $fromLength) {
$currentLength = $this->getAttributes($type);
$currentFromLength = $this->getAttributes($fromType);
$ratio = $fromLength / $currentFromLength;
$newLength = $currentLength * $ratio;
$this->setAttribute($type, (int)$newLength);
} | php | protected function _adjustDimensions($type, $fromType, $fromLength) {
$currentLength = $this->getAttributes($type);
$currentFromLength = $this->getAttributes($fromType);
$ratio = $fromLength / $currentFromLength;
$newLength = $currentLength * $ratio;
$this->setAttribute($type, (int)$newLength);
} | [
"protected",
"function",
"_adjustDimensions",
"(",
"$",
"type",
",",
"$",
"fromType",
",",
"$",
"fromLength",
")",
"{",
"$",
"currentLength",
"=",
"$",
"this",
"->",
"getAttributes",
"(",
"$",
"type",
")",
";",
"$",
"currentFromLength",
"=",
"$",
"this",
... | Auto-adjusts one dimension from the other to keep the current ratio.
@param string $type
@param string $fromType
@param int $fromLength
@return void | [
"Auto",
"-",
"adjusts",
"one",
"dimension",
"from",
"the",
"other",
"to",
"keep",
"the",
"current",
"ratio",
"."
] | bd940aafbaf4577a5dd61879e0601f278593f523 | https://github.com/dereuromark/media-embed/blob/bd940aafbaf4577a5dd61879e0601f278593f523/src/Object/MediaObject.php#L334-L342 |
28,635 | dereuromark/media-embed | src/Object/MediaObject.php | MediaObject.getParams | public function getParams($key = null) {
if (!empty($this->_stub['iframe-player']) && $this->config['prefer'] === 'iframe') {
if ($key === null) {
return $this->_iframeParams;
}
if (!isset($this->_iframeParams[$key])) {
return null;
}
return $this->_iframeParams[$key];
}
if ($key === null)... | php | public function getParams($key = null) {
if (!empty($this->_stub['iframe-player']) && $this->config['prefer'] === 'iframe') {
if ($key === null) {
return $this->_iframeParams;
}
if (!isset($this->_iframeParams[$key])) {
return null;
}
return $this->_iframeParams[$key];
}
if ($key === null)... | [
"public",
"function",
"getParams",
"(",
"$",
"key",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"_stub",
"[",
"'iframe-player'",
"]",
")",
"&&",
"$",
"this",
"->",
"config",
"[",
"'prefer'",
"]",
"===",
"'iframe'",
")",
... | Return object params about the video metadata
@param string|null $key
@return array|string|null Object params | [
"Return",
"object",
"params",
"about",
"the",
"video",
"metadata"
] | bd940aafbaf4577a5dd61879e0601f278593f523 | https://github.com/dereuromark/media-embed/blob/bd940aafbaf4577a5dd61879e0601f278593f523/src/Object/MediaObject.php#L350-L368 |
28,636 | dereuromark/media-embed | src/Object/MediaObject.php | MediaObject.getAttributes | public function getAttributes($key = null) {
if (!empty($this->_stub['iframe-player']) && $this->config['prefer'] === 'iframe') {
if ($key === null) {
return $this->_iframeAttributes;
}
if (!isset($this->_iframeAttributes[$key])) {
return null;
}
return $this->_iframeAttributes[$key];
}
if... | php | public function getAttributes($key = null) {
if (!empty($this->_stub['iframe-player']) && $this->config['prefer'] === 'iframe') {
if ($key === null) {
return $this->_iframeAttributes;
}
if (!isset($this->_iframeAttributes[$key])) {
return null;
}
return $this->_iframeAttributes[$key];
}
if... | [
"public",
"function",
"getAttributes",
"(",
"$",
"key",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"_stub",
"[",
"'iframe-player'",
"]",
")",
"&&",
"$",
"this",
"->",
"config",
"[",
"'prefer'",
"]",
"===",
"'iframe'",
")"... | Return object attribute
@param string|null $key
@return mixed Object attribute | [
"Return",
"object",
"attribute"
] | bd940aafbaf4577a5dd61879e0601f278593f523 | https://github.com/dereuromark/media-embed/blob/bd940aafbaf4577a5dd61879e0601f278593f523/src/Object/MediaObject.php#L376-L394 |
28,637 | dereuromark/media-embed | src/Object/MediaObject.php | MediaObject.getEmbedCode | public function getEmbedCode() {
if (!empty($this->_stub['iframe-player']) && $this->config['prefer'] === 'iframe') {
return $this->_buildIframe();
}
return $this->_buildObject();
} | php | public function getEmbedCode() {
if (!empty($this->_stub['iframe-player']) && $this->config['prefer'] === 'iframe') {
return $this->_buildIframe();
}
return $this->_buildObject();
} | [
"public",
"function",
"getEmbedCode",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"_stub",
"[",
"'iframe-player'",
"]",
")",
"&&",
"$",
"this",
"->",
"config",
"[",
"'prefer'",
"]",
"===",
"'iframe'",
")",
"{",
"return",
"$",
"thi... | Convert the url to an embeddable tag
@return string The embed HTML | [
"Convert",
"the",
"url",
"to",
"an",
"embeddable",
"tag"
] | bd940aafbaf4577a5dd61879e0601f278593f523 | https://github.com/dereuromark/media-embed/blob/bd940aafbaf4577a5dd61879e0601f278593f523/src/Object/MediaObject.php#L401-L406 |
28,638 | dereuromark/media-embed | src/Object/MediaObject.php | MediaObject._getObjectSrc | protected function _getObjectSrc($type = 'embed-src') {
if (empty($this->_stub['id']) || empty($this->_stub['slug'])) {
return null;
}
$stubSrc = $this->_stub[$type];
if (strpos($stubSrc, '$r2') !== false) {
$src = str_replace('$r2', $this->_stub['id'], $stubSrc);
} else {
$src = str_replace('$2', $... | php | protected function _getObjectSrc($type = 'embed-src') {
if (empty($this->_stub['id']) || empty($this->_stub['slug'])) {
return null;
}
$stubSrc = $this->_stub[$type];
if (strpos($stubSrc, '$r2') !== false) {
$src = str_replace('$r2', $this->_stub['id'], $stubSrc);
} else {
$src = str_replace('$2', $... | [
"protected",
"function",
"_getObjectSrc",
"(",
"$",
"type",
"=",
"'embed-src'",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_stub",
"[",
"'id'",
"]",
")",
"||",
"empty",
"(",
"$",
"this",
"->",
"_stub",
"[",
"'slug'",
"]",
")",
")",
"{",... | Get final src
@param string $type
@return string|null | [
"Get",
"final",
"src"
] | bd940aafbaf4577a5dd61879e0601f278593f523 | https://github.com/dereuromark/media-embed/blob/bd940aafbaf4577a5dd61879e0601f278593f523/src/Object/MediaObject.php#L432-L449 |
28,639 | dereuromark/media-embed | src/Object/MediaObject.php | MediaObject.image | public function image() {
if (empty($this->_stub['image-src'])) {
return '';
}
$thumb = $this->_stub['image-src'];
$count = count($this->_match);
for ($i = 1; $i <= $count; $i++) {
$thumb = str_ireplace('$' . $i, $this->_match[$i - 1], $thumb);
}
return $thumb;
} | php | public function image() {
if (empty($this->_stub['image-src'])) {
return '';
}
$thumb = $this->_stub['image-src'];
$count = count($this->_match);
for ($i = 1; $i <= $count; $i++) {
$thumb = str_ireplace('$' . $i, $this->_match[$i - 1], $thumb);
}
return $thumb;
} | [
"public",
"function",
"image",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_stub",
"[",
"'image-src'",
"]",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"thumb",
"=",
"$",
"this",
"->",
"_stub",
"[",
"'image-src'",
"]",
";",
"$",... | Return a thumbnail for the embeded video
@return string - the thumbnail href | [
"Return",
"a",
"thumbnail",
"for",
"the",
"embeded",
"video"
] | bd940aafbaf4577a5dd61879e0601f278593f523 | https://github.com/dereuromark/media-embed/blob/bd940aafbaf4577a5dd61879e0601f278593f523/src/Object/MediaObject.php#L477-L489 |
28,640 | dereuromark/media-embed | src/Object/MediaObject.php | MediaObject._buildObject | protected function _buildObject() {
$objectAttributes = $objectParams = '';
foreach ($this->_objectAttributes as $param => $value) {
$objectAttributes .= ' ' . $param . '="' . $value . '"';
}
foreach ($this->_objectParams as $param => $value) {
$objectParams .= '<param name="' . $param . '" value="' . $... | php | protected function _buildObject() {
$objectAttributes = $objectParams = '';
foreach ($this->_objectAttributes as $param => $value) {
$objectAttributes .= ' ' . $param . '="' . $value . '"';
}
foreach ($this->_objectParams as $param => $value) {
$objectParams .= '<param name="' . $param . '" value="' . $... | [
"protected",
"function",
"_buildObject",
"(",
")",
"{",
"$",
"objectAttributes",
"=",
"$",
"objectParams",
"=",
"''",
";",
"foreach",
"(",
"$",
"this",
"->",
"_objectAttributes",
"as",
"$",
"param",
"=>",
"$",
"value",
")",
"{",
"$",
"objectAttributes",
".... | Build a generic object skeleton
@return string | [
"Build",
"a",
"generic",
"object",
"skeleton"
] | bd940aafbaf4577a5dd61879e0601f278593f523 | https://github.com/dereuromark/media-embed/blob/bd940aafbaf4577a5dd61879e0601f278593f523/src/Object/MediaObject.php#L505-L520 |
28,641 | dereuromark/media-embed | src/Object/MediaObject.php | MediaObject._buildIframe | protected function _buildIframe() {
$source = $this->_stub['iframe-player'];
$count = count($this->_match);
for ($i = 1; $i <= $count; $i++) {
$source = str_ireplace('$' . $i, $this->_match[$i - 1], $source);
}
//add custom params
if ($this->_iframeParams) {
$c = '?';
if (strpos($source, '?') !==... | php | protected function _buildIframe() {
$source = $this->_stub['iframe-player'];
$count = count($this->_match);
for ($i = 1; $i <= $count; $i++) {
$source = str_ireplace('$' . $i, $this->_match[$i - 1], $source);
}
//add custom params
if ($this->_iframeParams) {
$c = '?';
if (strpos($source, '?') !==... | [
"protected",
"function",
"_buildIframe",
"(",
")",
"{",
"$",
"source",
"=",
"$",
"this",
"->",
"_stub",
"[",
"'iframe-player'",
"]",
";",
"$",
"count",
"=",
"count",
"(",
"$",
"this",
"->",
"_match",
")",
";",
"for",
"(",
"$",
"i",
"=",
"1",
";",
... | Build an iFrame player
@return string | [
"Build",
"an",
"iFrame",
"player"
] | bd940aafbaf4577a5dd61879e0601f278593f523 | https://github.com/dereuromark/media-embed/blob/bd940aafbaf4577a5dd61879e0601f278593f523/src/Object/MediaObject.php#L527-L556 |
28,642 | dereuromark/media-embed | src/Object/MediaObject.php | MediaObject._setDefaultParams | protected function _setDefaultParams($stub) {
$source = $stub['embed-src'];
$flashvars = (isset($stub['flashvars'])) ? $stub['flashvars'] : null;
$count = count($this->_match);
for ($i = 1; $i <= $count; $i++) {
$source = str_ireplace('$' . $i, $this->_match[$i - 1], $source);
$flashvars = str_ireplace('... | php | protected function _setDefaultParams($stub) {
$source = $stub['embed-src'];
$flashvars = (isset($stub['flashvars'])) ? $stub['flashvars'] : null;
$count = count($this->_match);
for ($i = 1; $i <= $count; $i++) {
$source = str_ireplace('$' . $i, $this->_match[$i - 1], $source);
$flashvars = str_ireplace('... | [
"protected",
"function",
"_setDefaultParams",
"(",
"$",
"stub",
")",
"{",
"$",
"source",
"=",
"$",
"stub",
"[",
"'embed-src'",
"]",
";",
"$",
"flashvars",
"=",
"(",
"isset",
"(",
"$",
"stub",
"[",
"'flashvars'",
"]",
")",
")",
"?",
"$",
"stub",
"[",
... | Set the default params for the type of
stub we are working with
@param array $stub
@return void | [
"Set",
"the",
"default",
"params",
"for",
"the",
"type",
"of",
"stub",
"we",
"are",
"working",
"with"
] | bd940aafbaf4577a5dd61879e0601f278593f523 | https://github.com/dereuromark/media-embed/blob/bd940aafbaf4577a5dd61879e0601f278593f523/src/Object/MediaObject.php#L565-L607 |
28,643 | dereuromark/media-embed | src/MediaEmbed.php | MediaEmbed.parseId | public function parseId($id, $host, $config = []) {
if (empty($id) || empty($host)) {
return null;
}
// local files?
if ($host === 'local') {
$res = $this->embedLocal($id);
if (!$res) {
$stub = [];
$Object = $this->object($stub, $config);
return $Object;
}
//TODO
return null;
}
... | php | public function parseId($id, $host, $config = []) {
if (empty($id) || empty($host)) {
return null;
}
// local files?
if ($host === 'local') {
$res = $this->embedLocal($id);
if (!$res) {
$stub = [];
$Object = $this->object($stub, $config);
return $Object;
}
//TODO
return null;
}
... | [
"public",
"function",
"parseId",
"(",
"$",
"id",
",",
"$",
"host",
",",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"id",
")",
"||",
"empty",
"(",
"$",
"host",
")",
")",
"{",
"return",
"null",
";",
"}",
"// local files... | Prepare embed video from different video hosts.
@param string $id
@param string $host
@param array $config
@return \MediaEmbed\Object\MediaObject|null | [
"Prepare",
"embed",
"video",
"from",
"different",
"video",
"hosts",
"."
] | bd940aafbaf4577a5dd61879e0601f278593f523 | https://github.com/dereuromark/media-embed/blob/bd940aafbaf4577a5dd61879e0601f278593f523/src/MediaEmbed.php#L57-L87 |
28,644 | dereuromark/media-embed | src/MediaEmbed.php | MediaEmbed.parseUrl | public function parseUrl($url, $config = []) {
foreach ($this->_hosts as $stub) {
$match = $this->_matchUrl($url, (array)$stub['url-match']);
if (!$match) {
continue;
}
$this->_match = $match;
if (!empty($stub['fetch-match'])) {
if (!$this->_parseLink($url, $stub['fetch-match'])) {
retur... | php | public function parseUrl($url, $config = []) {
foreach ($this->_hosts as $stub) {
$match = $this->_matchUrl($url, (array)$stub['url-match']);
if (!$match) {
continue;
}
$this->_match = $match;
if (!empty($stub['fetch-match'])) {
if (!$this->_parseLink($url, $stub['fetch-match'])) {
retur... | [
"public",
"function",
"parseUrl",
"(",
"$",
"url",
",",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_hosts",
"as",
"$",
"stub",
")",
"{",
"$",
"match",
"=",
"$",
"this",
"->",
"_matchUrl",
"(",
"$",
"url",
",",
"... | Parse given URL.
It will return an object if the url contains valid/supported video.
@param string $url Href to check for embedded video
@param array $config
@return \MediaEmbed\Object\MediaObject|null | [
"Parse",
"given",
"URL",
"."
] | bd940aafbaf4577a5dd61879e0601f278593f523 | https://github.com/dereuromark/media-embed/blob/bd940aafbaf4577a5dd61879e0601f278593f523/src/MediaEmbed.php#L98-L117 |
28,645 | dereuromark/media-embed | src/MediaEmbed.php | MediaEmbed._parseLink | protected function _parseLink($url, $regex) {
$context = stream_context_create(
['http' => ['header' => 'Connection: close']]);
$content = file_get_contents($url, false, $context);
if (!$content) {
return false;
}
$source = preg_replace('/[^(\x20-\x7F)]*/', '', $content);
if (preg_match('~' . $regex... | php | protected function _parseLink($url, $regex) {
$context = stream_context_create(
['http' => ['header' => 'Connection: close']]);
$content = file_get_contents($url, false, $context);
if (!$content) {
return false;
}
$source = preg_replace('/[^(\x20-\x7F)]*/', '', $content);
if (preg_match('~' . $regex... | [
"protected",
"function",
"_parseLink",
"(",
"$",
"url",
",",
"$",
"regex",
")",
"{",
"$",
"context",
"=",
"stream_context_create",
"(",
"[",
"'http'",
"=>",
"[",
"'header'",
"=>",
"'Connection: close'",
"]",
"]",
")",
";",
"$",
"content",
"=",
"file_get_co... | Attempt to parse the embed id from a given URL
@param string $url
@param string $regex
@return bool | [
"Attempt",
"to",
"parse",
"the",
"embed",
"id",
"from",
"a",
"given",
"URL"
] | bd940aafbaf4577a5dd61879e0601f278593f523 | https://github.com/dereuromark/media-embed/blob/bd940aafbaf4577a5dd61879e0601f278593f523/src/MediaEmbed.php#L142-L158 |
28,646 | dereuromark/media-embed | src/MediaEmbed.php | MediaEmbed.setHosts | public function setHosts(array $stubs, $reset = false) {
if ($reset) {
$this->_hosts = [];
}
foreach ($stubs as $stub) {
$slug = $this->_slug($stub['name']);
$this->_hosts[$slug] = $stub;
}
return $this;
} | php | public function setHosts(array $stubs, $reset = false) {
if ($reset) {
$this->_hosts = [];
}
foreach ($stubs as $stub) {
$slug = $this->_slug($stub['name']);
$this->_hosts[$slug] = $stub;
}
return $this;
} | [
"public",
"function",
"setHosts",
"(",
"array",
"$",
"stubs",
",",
"$",
"reset",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"reset",
")",
"{",
"$",
"this",
"->",
"_hosts",
"=",
"[",
"]",
";",
"}",
"foreach",
"(",
"$",
"stubs",
"as",
"$",
"stub",
"... | Set custom stubs overwriting the default ones.
@param array $stubs Same format as in the stubs.php file.
@param bool $reset If default ones should be resetted/removed.
@return $this | [
"Set",
"custom",
"stubs",
"overwriting",
"the",
"default",
"ones",
"."
] | bd940aafbaf4577a5dd61879e0601f278593f523 | https://github.com/dereuromark/media-embed/blob/bd940aafbaf4577a5dd61879e0601f278593f523/src/MediaEmbed.php#L167-L176 |
28,647 | Benestar/asparagus | src/QueryBuilder.php | QueryBuilder.select | public function select( $expressions /* expressions ... */ ) {
$expressions = is_array( $expressions ) ? $expressions : func_get_args();
$this->setQueryForm( 'SELECT' );
$this->addExpressions( $expressions );
return $this;
} | php | public function select( $expressions /* expressions ... */ ) {
$expressions = is_array( $expressions ) ? $expressions : func_get_args();
$this->setQueryForm( 'SELECT' );
$this->addExpressions( $expressions );
return $this;
} | [
"public",
"function",
"select",
"(",
"$",
"expressions",
"/* expressions ... */",
")",
"{",
"$",
"expressions",
"=",
"is_array",
"(",
"$",
"expressions",
")",
"?",
"$",
"expressions",
":",
"func_get_args",
"(",
")",
";",
"$",
"this",
"->",
"setQueryForm",
"(... | Specifies the expressions to select.
@param string|string[] $expressions
@return self
@throws InvalidArgumentException
@throws RuntimeException | [
"Specifies",
"the",
"expressions",
"to",
"select",
"."
] | 6299517dc28ace1e5934a0b09a2ac6d8a2910032 | https://github.com/Benestar/asparagus/blob/6299517dc28ace1e5934a0b09a2ac6d8a2910032/src/QueryBuilder.php#L91-L98 |
28,648 | Benestar/asparagus | src/QueryBuilder.php | QueryBuilder.selectDistinct | public function selectDistinct( $expressions /* expressions ... */ ) {
$expressions = is_array( $expressions ) ? $expressions : func_get_args();
$this->setQueryForm( 'SELECT' );
$this->uniqueness = 'DISTINCT ';
$this->addExpressions( $expressions );
return $this;
} | php | public function selectDistinct( $expressions /* expressions ... */ ) {
$expressions = is_array( $expressions ) ? $expressions : func_get_args();
$this->setQueryForm( 'SELECT' );
$this->uniqueness = 'DISTINCT ';
$this->addExpressions( $expressions );
return $this;
} | [
"public",
"function",
"selectDistinct",
"(",
"$",
"expressions",
"/* expressions ... */",
")",
"{",
"$",
"expressions",
"=",
"is_array",
"(",
"$",
"expressions",
")",
"?",
"$",
"expressions",
":",
"func_get_args",
"(",
")",
";",
"$",
"this",
"->",
"setQueryFor... | Specifies the expressions to select. Duplicate results are eliminated.
@since 0.3
@param string|string[] $expressions
@return self
@throws InvalidArgumentException
@throws RuntimeException | [
"Specifies",
"the",
"expressions",
"to",
"select",
".",
"Duplicate",
"results",
"are",
"eliminated",
"."
] | 6299517dc28ace1e5934a0b09a2ac6d8a2910032 | https://github.com/Benestar/asparagus/blob/6299517dc28ace1e5934a0b09a2ac6d8a2910032/src/QueryBuilder.php#L110-L118 |
28,649 | Benestar/asparagus | src/QueryBuilder.php | QueryBuilder.selectReduced | public function selectReduced( $expressions /* expressions ... */ ) {
$expressions = is_array( $expressions ) ? $expressions : func_get_args();
$this->setQueryForm( 'SELECT' );
$this->uniqueness = 'REDUCED ';
$this->addExpressions( $expressions );
return $this;
} | php | public function selectReduced( $expressions /* expressions ... */ ) {
$expressions = is_array( $expressions ) ? $expressions : func_get_args();
$this->setQueryForm( 'SELECT' );
$this->uniqueness = 'REDUCED ';
$this->addExpressions( $expressions );
return $this;
} | [
"public",
"function",
"selectReduced",
"(",
"$",
"expressions",
"/* expressions ... */",
")",
"{",
"$",
"expressions",
"=",
"is_array",
"(",
"$",
"expressions",
")",
"?",
"$",
"expressions",
":",
"func_get_args",
"(",
")",
";",
"$",
"this",
"->",
"setQueryForm... | Specifies the expressions to select. Duplicate results may be eliminated.
@since 0.3
@param string|string[] $expressions
@return self
@throws InvalidArgumentException
@throws RuntimeException | [
"Specifies",
"the",
"expressions",
"to",
"select",
".",
"Duplicate",
"results",
"may",
"be",
"eliminated",
"."
] | 6299517dc28ace1e5934a0b09a2ac6d8a2910032 | https://github.com/Benestar/asparagus/blob/6299517dc28ace1e5934a0b09a2ac6d8a2910032/src/QueryBuilder.php#L130-L138 |
28,650 | Benestar/asparagus | src/QueryBuilder.php | QueryBuilder.describe | public function describe( $expressions /* expressions ... */ ) {
$expressions = is_array( $expressions ) ? $expressions : func_get_args();
$this->setQueryForm( 'DESCRIBE' );
$this->addExpressions(
$expressions,
ExpressionValidator::VALIDATE_VARIABLE | ExpressionValidator::VALIDATE_FUNCTION_AS
| Express... | php | public function describe( $expressions /* expressions ... */ ) {
$expressions = is_array( $expressions ) ? $expressions : func_get_args();
$this->setQueryForm( 'DESCRIBE' );
$this->addExpressions(
$expressions,
ExpressionValidator::VALIDATE_VARIABLE | ExpressionValidator::VALIDATE_FUNCTION_AS
| Express... | [
"public",
"function",
"describe",
"(",
"$",
"expressions",
"/* expressions ... */",
")",
"{",
"$",
"expressions",
"=",
"is_array",
"(",
"$",
"expressions",
")",
"?",
"$",
"expressions",
":",
"func_get_args",
"(",
")",
";",
"$",
"this",
"->",
"setQueryForm",
... | Specifies the expressions to describe.
@since 0.4
@param string|string[] $expressions
@return self
@throws InvalidArgumentException
@throws RuntimeException | [
"Specifies",
"the",
"expressions",
"to",
"describe",
"."
] | 6299517dc28ace1e5934a0b09a2ac6d8a2910032 | https://github.com/Benestar/asparagus/blob/6299517dc28ace1e5934a0b09a2ac6d8a2910032/src/QueryBuilder.php#L150-L161 |
28,651 | Benestar/asparagus | src/QueryBuilder.php | QueryBuilder.filterNotExists | public function filterNotExists( $subject, $predicate = null, $object = null ) {
$this->graphBuilder->filterNotExists( $subject, $predicate, $object );
return $this;
} | php | public function filterNotExists( $subject, $predicate = null, $object = null ) {
$this->graphBuilder->filterNotExists( $subject, $predicate, $object );
return $this;
} | [
"public",
"function",
"filterNotExists",
"(",
"$",
"subject",
",",
"$",
"predicate",
"=",
"null",
",",
"$",
"object",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"graphBuilder",
"->",
"filterNotExists",
"(",
"$",
"subject",
",",
"$",
"predicate",
",",
"$",... | Adds a filter that the given graph or triple does not exist.
@since 0.3
@param string|GraphBuilder $subject
@param string|null $predicate
@param string|null $object
@return self
@throws InvalidArgumentException | [
"Adds",
"a",
"filter",
"that",
"the",
"given",
"graph",
"or",
"triple",
"does",
"not",
"exist",
"."
] | 6299517dc28ace1e5934a0b09a2ac6d8a2910032 | https://github.com/Benestar/asparagus/blob/6299517dc28ace1e5934a0b09a2ac6d8a2910032/src/QueryBuilder.php#L276-L279 |
28,652 | Benestar/asparagus | src/QueryBuilder.php | QueryBuilder.groupBy | public function groupBy( $expressions /* expressions ... */ ) {
$expressions = is_array( $expressions ) ? $expressions : func_get_args();
$this->modifierBuilder->groupBy( $expressions );
return $this;
} | php | public function groupBy( $expressions /* expressions ... */ ) {
$expressions = is_array( $expressions ) ? $expressions : func_get_args();
$this->modifierBuilder->groupBy( $expressions );
return $this;
} | [
"public",
"function",
"groupBy",
"(",
"$",
"expressions",
"/* expressions ... */",
")",
"{",
"$",
"expressions",
"=",
"is_array",
"(",
"$",
"expressions",
")",
"?",
"$",
"expressions",
":",
"func_get_args",
"(",
")",
";",
"$",
"this",
"->",
"modifierBuilder",
... | Sets the GROUP BY modifier.
@param string|string[] $expressions
@return self
@throws InvalidArgumentException | [
"Sets",
"the",
"GROUP",
"BY",
"modifier",
"."
] | 6299517dc28ace1e5934a0b09a2ac6d8a2910032 | https://github.com/Benestar/asparagus/blob/6299517dc28ace1e5934a0b09a2ac6d8a2910032/src/QueryBuilder.php#L334-L339 |
28,653 | Benestar/asparagus | src/QueryBuilder.php | QueryBuilder.getSPARQL | public function getSPARQL( $includePrefixes = true ) {
if ( !is_bool( $includePrefixes ) ) {
throw new InvalidArgumentException( '$includePrefixes has to be a bool' );
}
$this->usageValidator->validate();
$sparql = $includePrefixes ? $this->prefixBuilder->getSPARQL() : '';
// @todo throw an exception ins... | php | public function getSPARQL( $includePrefixes = true ) {
if ( !is_bool( $includePrefixes ) ) {
throw new InvalidArgumentException( '$includePrefixes has to be a bool' );
}
$this->usageValidator->validate();
$sparql = $includePrefixes ? $this->prefixBuilder->getSPARQL() : '';
// @todo throw an exception ins... | [
"public",
"function",
"getSPARQL",
"(",
"$",
"includePrefixes",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"is_bool",
"(",
"$",
"includePrefixes",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'$includePrefixes has to be a bool'",
")",
";",
"}",
... | Returns the plain SPARQL string of this query.
@param bool $includePrefixes
@return string
@throws InvalidArgumentException
@throws RangeException | [
"Returns",
"the",
"plain",
"SPARQL",
"string",
"of",
"this",
"query",
"."
] | 6299517dc28ace1e5934a0b09a2ac6d8a2910032 | https://github.com/Benestar/asparagus/blob/6299517dc28ace1e5934a0b09a2ac6d8a2910032/src/QueryBuilder.php#L398-L413 |
28,654 | Benestar/asparagus | src/GraphBuilder.php | GraphBuilder.filter | public function filter( $expression ) {
$this->expressionValidator->validate( $expression, ExpressionValidator::VALIDATE_FUNCTION );
$this->usageValidator->trackUsedPrefixes( $expression );
$this->usageValidator->trackUsedVariables( $expression );
$this->filters[] = '(' . $expression . ')';
return $this;
... | php | public function filter( $expression ) {
$this->expressionValidator->validate( $expression, ExpressionValidator::VALIDATE_FUNCTION );
$this->usageValidator->trackUsedPrefixes( $expression );
$this->usageValidator->trackUsedVariables( $expression );
$this->filters[] = '(' . $expression . ')';
return $this;
... | [
"public",
"function",
"filter",
"(",
"$",
"expression",
")",
"{",
"$",
"this",
"->",
"expressionValidator",
"->",
"validate",
"(",
"$",
"expression",
",",
"ExpressionValidator",
"::",
"VALIDATE_FUNCTION",
")",
";",
"$",
"this",
"->",
"usageValidator",
"->",
"t... | Adds the given expression as a filter to this query.
@param string $expression
@return self
@throws InvalidArgumentException | [
"Adds",
"the",
"given",
"expression",
"as",
"a",
"filter",
"to",
"this",
"query",
"."
] | 6299517dc28ace1e5934a0b09a2ac6d8a2910032 | https://github.com/Benestar/asparagus/blob/6299517dc28ace1e5934a0b09a2ac6d8a2910032/src/GraphBuilder.php#L134-L143 |
28,655 | Benestar/asparagus | src/GraphBuilder.php | GraphBuilder.union | public function union( $graphs /* graphs ... */ ) {
$graphs = is_array( $graphs ) ? $graphs : func_get_args();
$this->unions[] = implode( ' UNION', array_map( function( GraphBuilder $graph ) {
return ' {' . $graph->getSPARQL() . ' }';
}, $graphs ) );
return $this;
} | php | public function union( $graphs /* graphs ... */ ) {
$graphs = is_array( $graphs ) ? $graphs : func_get_args();
$this->unions[] = implode( ' UNION', array_map( function( GraphBuilder $graph ) {
return ' {' . $graph->getSPARQL() . ' }';
}, $graphs ) );
return $this;
} | [
"public",
"function",
"union",
"(",
"$",
"graphs",
"/* graphs ... */",
")",
"{",
"$",
"graphs",
"=",
"is_array",
"(",
"$",
"graphs",
")",
"?",
"$",
"graphs",
":",
"func_get_args",
"(",
")",
";",
"$",
"this",
"->",
"unions",
"[",
"]",
"=",
"implode",
... | Adds the given graphs as alternative conditions.
@param GraphBuilder|GraphBuilder[] $graphs
@return self
@throws InvalidArgumentException | [
"Adds",
"the",
"given",
"graphs",
"as",
"alternative",
"conditions",
"."
] | 6299517dc28ace1e5934a0b09a2ac6d8a2910032 | https://github.com/Benestar/asparagus/blob/6299517dc28ace1e5934a0b09a2ac6d8a2910032/src/GraphBuilder.php#L208-L216 |
28,656 | Benestar/asparagus | src/GraphBuilder.php | GraphBuilder.subquery | public function subquery( QueryBuilder $queryBuilder ) {
$this->subqueries[] = $queryBuilder->getSPARQL( false );
$this->usageValidator->trackDefinedVariables( implode( ' ', $queryBuilder->getSelects() ) );
// @todo temp hack to add AS definitions to defined variables
$regexHelper = new RegexHelper();
$match... | php | public function subquery( QueryBuilder $queryBuilder ) {
$this->subqueries[] = $queryBuilder->getSPARQL( false );
$this->usageValidator->trackDefinedVariables( implode( ' ', $queryBuilder->getSelects() ) );
// @todo temp hack to add AS definitions to defined variables
$regexHelper = new RegexHelper();
$match... | [
"public",
"function",
"subquery",
"(",
"QueryBuilder",
"$",
"queryBuilder",
")",
"{",
"$",
"this",
"->",
"subqueries",
"[",
"]",
"=",
"$",
"queryBuilder",
"->",
"getSPARQL",
"(",
"false",
")",
";",
"$",
"this",
"->",
"usageValidator",
"->",
"trackDefinedVari... | Adds the given subquery.
@param QueryBuilder $queryBuilder
@return self
@throws InvalidArgumentException | [
"Adds",
"the",
"given",
"subquery",
"."
] | 6299517dc28ace1e5934a0b09a2ac6d8a2910032 | https://github.com/Benestar/asparagus/blob/6299517dc28ace1e5934a0b09a2ac6d8a2910032/src/GraphBuilder.php#L225-L235 |
28,657 | Benestar/asparagus | src/GraphBuilder.php | GraphBuilder.getSPARQL | public function getSPARQL() {
// add subqueries to the beginning because they are logically evaluated first
$sparql = $this->formatSubqueries();
foreach ( $this->conditions as $subject => $predicates ) {
$sparql .= ' ' . $subject;
$sparql .= $this->formatPredicates( $predicates ) . ' .';
}
$sparql .= ... | php | public function getSPARQL() {
// add subqueries to the beginning because they are logically evaluated first
$sparql = $this->formatSubqueries();
foreach ( $this->conditions as $subject => $predicates ) {
$sparql .= ' ' . $subject;
$sparql .= $this->formatPredicates( $predicates ) . ' .';
}
$sparql .= ... | [
"public",
"function",
"getSPARQL",
"(",
")",
"{",
"// add subqueries to the beginning because they are logically evaluated first",
"$",
"sparql",
"=",
"$",
"this",
"->",
"formatSubqueries",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"conditions",
"as",
"$",
"... | Returns the plain SPARQL string of these conditions.
Surrounding brackets are not included.
@return string | [
"Returns",
"the",
"plain",
"SPARQL",
"string",
"of",
"these",
"conditions",
".",
"Surrounding",
"brackets",
"are",
"not",
"included",
"."
] | 6299517dc28ace1e5934a0b09a2ac6d8a2910032 | https://github.com/Benestar/asparagus/blob/6299517dc28ace1e5934a0b09a2ac6d8a2910032/src/GraphBuilder.php#L243-L257 |
28,658 | Benestar/asparagus | src/RegexHelper.php | RegexHelper.getMatches | public function getMatches( $regex, $expression, $group = 1 ) {
if ( preg_match_all(
'/' . $this->resolveMagic( $regex ) . '/',
$this->escapeSequences( $expression ),
$matches
) ) {
return $matches[$group];
}
return array();
} | php | public function getMatches( $regex, $expression, $group = 1 ) {
if ( preg_match_all(
'/' . $this->resolveMagic( $regex ) . '/',
$this->escapeSequences( $expression ),
$matches
) ) {
return $matches[$group];
}
return array();
} | [
"public",
"function",
"getMatches",
"(",
"$",
"regex",
",",
"$",
"expression",
",",
"$",
"group",
"=",
"1",
")",
"{",
"if",
"(",
"preg_match_all",
"(",
"'/'",
".",
"$",
"this",
"->",
"resolveMagic",
"(",
"$",
"regex",
")",
".",
"'/'",
",",
"$",
"th... | Returns all matching groups for the given regex.
String and IRI equences are automatically escaped.
@param string $regex
@param string $expression
@param int $group
@return string[] | [
"Returns",
"all",
"matching",
"groups",
"for",
"the",
"given",
"regex",
".",
"String",
"and",
"IRI",
"equences",
"are",
"automatically",
"escaped",
"."
] | 6299517dc28ace1e5934a0b09a2ac6d8a2910032 | https://github.com/Benestar/asparagus/blob/6299517dc28ace1e5934a0b09a2ac6d8a2910032/src/RegexHelper.php#L83-L93 |
28,659 | crazy-max/CwsDump | lib/Cws/CwsDump.php | CwsDump.dump | public function dump($var, $or = true)
{
$result = '';
if ($var === null) {
$result .= $this->dumpNull($or);
} elseif (is_bool($var)) {
$result .= $this->dumpBool($var, $or);
} elseif (is_string($var)) {
$result .= $this->dumpString($var, $or);
... | php | public function dump($var, $or = true)
{
$result = '';
if ($var === null) {
$result .= $this->dumpNull($or);
} elseif (is_bool($var)) {
$result .= $this->dumpBool($var, $or);
} elseif (is_string($var)) {
$result .= $this->dumpString($var, $or);
... | [
"public",
"function",
"dump",
"(",
"$",
"var",
",",
"$",
"or",
"=",
"true",
")",
"{",
"$",
"result",
"=",
"''",
";",
"if",
"(",
"$",
"var",
"===",
"null",
")",
"{",
"$",
"result",
".=",
"$",
"this",
"->",
"dumpNull",
"(",
"$",
"or",
")",
";",... | Dump variable into formatted XHTML string.
@param mixed $var
@param bool $or
@return string - Formatted XHTML | [
"Dump",
"variable",
"into",
"formatted",
"XHTML",
"string",
"."
] | 9d979a2a07a373fb265d72ec0cb7553cd00309cb | https://github.com/crazy-max/CwsDump/blob/9d979a2a07a373fb265d72ec0cb7553cd00309cb/lib/Cws/CwsDump.php#L110-L149 |
28,660 | Benestar/asparagus | src/QueryPrefixBuilder.php | QueryPrefixBuilder.setPrefixes | private function setPrefixes( array $prefixes ) {
foreach ( $prefixes as $prefix => $iri ) {
$this->expressionValidator->validate( $prefix, ExpressionValidator::VALIDATE_PREFIX );
$this->expressionValidator->validate( $iri, ExpressionValidator::VALIDATE_IRI );
$this->prefixes[$prefix] = $iri;
}
$this->... | php | private function setPrefixes( array $prefixes ) {
foreach ( $prefixes as $prefix => $iri ) {
$this->expressionValidator->validate( $prefix, ExpressionValidator::VALIDATE_PREFIX );
$this->expressionValidator->validate( $iri, ExpressionValidator::VALIDATE_IRI );
$this->prefixes[$prefix] = $iri;
}
$this->... | [
"private",
"function",
"setPrefixes",
"(",
"array",
"$",
"prefixes",
")",
"{",
"foreach",
"(",
"$",
"prefixes",
"as",
"$",
"prefix",
"=>",
"$",
"iri",
")",
"{",
"$",
"this",
"->",
"expressionValidator",
"->",
"validate",
"(",
"$",
"prefix",
",",
"Express... | Sets the prefixes for the given IRIs.
@param string[] $prefixes
@throws InvalidArgumentException | [
"Sets",
"the",
"prefixes",
"for",
"the",
"given",
"IRIs",
"."
] | 6299517dc28ace1e5934a0b09a2ac6d8a2910032 | https://github.com/Benestar/asparagus/blob/6299517dc28ace1e5934a0b09a2ac6d8a2910032/src/QueryPrefixBuilder.php#L45-L54 |
28,661 | Benestar/asparagus | src/QueryPrefixBuilder.php | QueryPrefixBuilder.getSPARQL | public function getSPARQL() {
return implode( array_map( function( $prefix, $iri ) {
return 'PREFIX ' . $prefix . ': <' . $iri . '> ';
}, array_keys( $this->prefixes ), $this->prefixes ) );
} | php | public function getSPARQL() {
return implode( array_map( function( $prefix, $iri ) {
return 'PREFIX ' . $prefix . ': <' . $iri . '> ';
}, array_keys( $this->prefixes ), $this->prefixes ) );
} | [
"public",
"function",
"getSPARQL",
"(",
")",
"{",
"return",
"implode",
"(",
"array_map",
"(",
"function",
"(",
"$",
"prefix",
",",
"$",
"iri",
")",
"{",
"return",
"'PREFIX '",
".",
"$",
"prefix",
".",
"': <'",
".",
"$",
"iri",
".",
"'> '",
";",
"}",
... | Returns the plain SPARQL string of these prefixes.
@return string | [
"Returns",
"the",
"plain",
"SPARQL",
"string",
"of",
"these",
"prefixes",
"."
] | 6299517dc28ace1e5934a0b09a2ac6d8a2910032 | https://github.com/Benestar/asparagus/blob/6299517dc28ace1e5934a0b09a2ac6d8a2910032/src/QueryPrefixBuilder.php#L68-L72 |
28,662 | Benestar/asparagus | src/QueryFormatter.php | QueryFormatter.format | public function format( $sparql ) {
$this->formattedParts = array();
$this->indentationLevel = 0;
$this->replacements = array();
$regexHelper = new RegexHelper();
$sparql = $regexHelper->escapeSequences( $sparql, $this->replacements );
foreach ( $this->split( $sparql ) as $part ) {
if ( !empty( $this->... | php | public function format( $sparql ) {
$this->formattedParts = array();
$this->indentationLevel = 0;
$this->replacements = array();
$regexHelper = new RegexHelper();
$sparql = $regexHelper->escapeSequences( $sparql, $this->replacements );
foreach ( $this->split( $sparql ) as $part ) {
if ( !empty( $this->... | [
"public",
"function",
"format",
"(",
"$",
"sparql",
")",
"{",
"$",
"this",
"->",
"formattedParts",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"indentationLevel",
"=",
"0",
";",
"$",
"this",
"->",
"replacements",
"=",
"array",
"(",
")",
";",
"$",... | Formats the given SPARQL string.
Note that there have to be spaces before and after brackets and dots.
@param string $sparql
@return string | [
"Formats",
"the",
"given",
"SPARQL",
"string",
".",
"Note",
"that",
"there",
"have",
"to",
"be",
"spaces",
"before",
"and",
"after",
"brackets",
"and",
"dots",
"."
] | 6299517dc28ace1e5934a0b09a2ac6d8a2910032 | https://github.com/Benestar/asparagus/blob/6299517dc28ace1e5934a0b09a2ac6d8a2910032/src/QueryFormatter.php#L37-L59 |
28,663 | Benestar/asparagus | src/QueryModifierBuilder.php | QueryModifierBuilder.groupBy | public function groupBy( array $expressions ) {
foreach ( $expressions as $expression ) {
$this->expressionValidator->validate( $expression,
ExpressionValidator::VALIDATE_VARIABLE | ExpressionValidator::VALIDATE_FUNCTION_AS
);
}
$expression = implode( ' ', $expressions );
$this->usageValidator->trac... | php | public function groupBy( array $expressions ) {
foreach ( $expressions as $expression ) {
$this->expressionValidator->validate( $expression,
ExpressionValidator::VALIDATE_VARIABLE | ExpressionValidator::VALIDATE_FUNCTION_AS
);
}
$expression = implode( ' ', $expressions );
$this->usageValidator->trac... | [
"public",
"function",
"groupBy",
"(",
"array",
"$",
"expressions",
")",
"{",
"foreach",
"(",
"$",
"expressions",
"as",
"$",
"expression",
")",
"{",
"$",
"this",
"->",
"expressionValidator",
"->",
"validate",
"(",
"$",
"expression",
",",
"ExpressionValidator",
... | Sets the GROUP BY modifiers.
@param string[] $expressions | [
"Sets",
"the",
"GROUP",
"BY",
"modifiers",
"."
] | 6299517dc28ace1e5934a0b09a2ac6d8a2910032 | https://github.com/Benestar/asparagus/blob/6299517dc28ace1e5934a0b09a2ac6d8a2910032/src/QueryModifierBuilder.php#L40-L51 |
28,664 | Benestar/asparagus | src/QueryModifierBuilder.php | QueryModifierBuilder.having | public function having( $expression ) {
$this->expressionValidator->validate( $expression, ExpressionValidator::VALIDATE_FUNCTION );
$this->usageValidator->trackUsedPrefixes( $expression );
$this->usageValidator->trackUsedVariables( $expression );
$this->modifiers['HAVING'] = '(' . $expression . ')';
} | php | public function having( $expression ) {
$this->expressionValidator->validate( $expression, ExpressionValidator::VALIDATE_FUNCTION );
$this->usageValidator->trackUsedPrefixes( $expression );
$this->usageValidator->trackUsedVariables( $expression );
$this->modifiers['HAVING'] = '(' . $expression . ')';
} | [
"public",
"function",
"having",
"(",
"$",
"expression",
")",
"{",
"$",
"this",
"->",
"expressionValidator",
"->",
"validate",
"(",
"$",
"expression",
",",
"ExpressionValidator",
"::",
"VALIDATE_FUNCTION",
")",
";",
"$",
"this",
"->",
"usageValidator",
"->",
"t... | Sets the HAVING modifier.
@param string $expression | [
"Sets",
"the",
"HAVING",
"modifier",
"."
] | 6299517dc28ace1e5934a0b09a2ac6d8a2910032 | https://github.com/Benestar/asparagus/blob/6299517dc28ace1e5934a0b09a2ac6d8a2910032/src/QueryModifierBuilder.php#L58-L64 |
28,665 | Benestar/asparagus | src/QueryModifierBuilder.php | QueryModifierBuilder.orderBy | public function orderBy( $expression, $direction = 'ASC' ) {
$direction = strtoupper( $direction );
if ( !in_array( $direction, array( 'ASC', 'DESC' ) ) ) {
throw new InvalidArgumentException( '$direction has to be either ASC or DESC' );
}
$this->expressionValidator->validate( $expression,
ExpressionVali... | php | public function orderBy( $expression, $direction = 'ASC' ) {
$direction = strtoupper( $direction );
if ( !in_array( $direction, array( 'ASC', 'DESC' ) ) ) {
throw new InvalidArgumentException( '$direction has to be either ASC or DESC' );
}
$this->expressionValidator->validate( $expression,
ExpressionVali... | [
"public",
"function",
"orderBy",
"(",
"$",
"expression",
",",
"$",
"direction",
"=",
"'ASC'",
")",
"{",
"$",
"direction",
"=",
"strtoupper",
"(",
"$",
"direction",
")",
";",
"if",
"(",
"!",
"in_array",
"(",
"$",
"direction",
",",
"array",
"(",
"'ASC'",... | Sets the ORDER BY modifier.
@param string $expression
@param string $direction one of ASC or DESC
@throws InvalidArgumentException | [
"Sets",
"the",
"ORDER",
"BY",
"modifier",
"."
] | 6299517dc28ace1e5934a0b09a2ac6d8a2910032 | https://github.com/Benestar/asparagus/blob/6299517dc28ace1e5934a0b09a2ac6d8a2910032/src/QueryModifierBuilder.php#L73-L86 |
28,666 | Benestar/asparagus | src/QueryModifierBuilder.php | QueryModifierBuilder.getSPARQL | public function getSPARQL() {
$modifiers = $this->modifiers;
return implode( array_map( function( $key ) use ( $modifiers ) {
if ( isset( $modifiers[$key] ) ) {
return ' ' . $key . ' ' . $modifiers[$key];
}
}, array( 'GROUP BY', 'HAVING', 'ORDER BY', 'LIMIT', 'OFFSET' ) ) );
} | php | public function getSPARQL() {
$modifiers = $this->modifiers;
return implode( array_map( function( $key ) use ( $modifiers ) {
if ( isset( $modifiers[$key] ) ) {
return ' ' . $key . ' ' . $modifiers[$key];
}
}, array( 'GROUP BY', 'HAVING', 'ORDER BY', 'LIMIT', 'OFFSET' ) ) );
} | [
"public",
"function",
"getSPARQL",
"(",
")",
"{",
"$",
"modifiers",
"=",
"$",
"this",
"->",
"modifiers",
";",
"return",
"implode",
"(",
"array_map",
"(",
"function",
"(",
"$",
"key",
")",
"use",
"(",
"$",
"modifiers",
")",
"{",
"if",
"(",
"isset",
"(... | Returns the plain SPARQL string of these modifiers.
@return string | [
"Returns",
"the",
"plain",
"SPARQL",
"string",
"of",
"these",
"modifiers",
"."
] | 6299517dc28ace1e5934a0b09a2ac6d8a2910032 | https://github.com/Benestar/asparagus/blob/6299517dc28ace1e5934a0b09a2ac6d8a2910032/src/QueryModifierBuilder.php#L121-L128 |
28,667 | Benestar/asparagus | src/ExpressionValidator.php | ExpressionValidator.validate | public function validate( $expression, $options ) {
if ( !is_string( $expression ) ) {
throw new InvalidArgumentException( '$expression has to be a string.' );
}
if ( !$this->matches( $expression, $options ) ) {
throw new InvalidArgumentException( '$expression has to be a ' .
implode( ' or a ', $this->... | php | public function validate( $expression, $options ) {
if ( !is_string( $expression ) ) {
throw new InvalidArgumentException( '$expression has to be a string.' );
}
if ( !$this->matches( $expression, $options ) ) {
throw new InvalidArgumentException( '$expression has to be a ' .
implode( ' or a ', $this->... | [
"public",
"function",
"validate",
"(",
"$",
"expression",
",",
"$",
"options",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"expression",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'$expression has to be a string.'",
")",
";",
"}",
... | Validates the given expression and tracks it.
VALIDATE_PREFIX won't track prefixes.
@param string $expression
@param int $options
@throws InvalidArgumentException | [
"Validates",
"the",
"given",
"expression",
"and",
"tracks",
"it",
".",
"VALIDATE_PREFIX",
"won",
"t",
"track",
"prefixes",
"."
] | 6299517dc28ace1e5934a0b09a2ac6d8a2910032 | https://github.com/Benestar/asparagus/blob/6299517dc28ace1e5934a0b09a2ac6d8a2910032/src/ExpressionValidator.php#L77-L87 |
28,668 | Benestar/asparagus | src/UsageValidator.php | UsageValidator.trackUsedVariables | public function trackUsedVariables( $variables ) {
if ( !is_array( $variables ) ) {
$variables = $this->matchVariables( $variables );
}
$this->usedVariables = array_unique( array_merge( $this->usedVariables, $variables ) );
} | php | public function trackUsedVariables( $variables ) {
if ( !is_array( $variables ) ) {
$variables = $this->matchVariables( $variables );
}
$this->usedVariables = array_unique( array_merge( $this->usedVariables, $variables ) );
} | [
"public",
"function",
"trackUsedVariables",
"(",
"$",
"variables",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"variables",
")",
")",
"{",
"$",
"variables",
"=",
"$",
"this",
"->",
"matchVariables",
"(",
"$",
"variables",
")",
";",
"}",
"$",
"this"... | Trackes the list of variables as used.
@param string[]|string $variables list of variables without prefixes | [
"Trackes",
"the",
"list",
"of",
"variables",
"as",
"used",
"."
] | 6299517dc28ace1e5934a0b09a2ac6d8a2910032 | https://github.com/Benestar/asparagus/blob/6299517dc28ace1e5934a0b09a2ac6d8a2910032/src/UsageValidator.php#L49-L55 |
28,669 | Benestar/asparagus | src/UsageValidator.php | UsageValidator.trackDefinedVariables | public function trackDefinedVariables( $variables ) {
if ( !is_array( $variables ) ) {
$variables = $this->matchVariables( $variables );
}
$this->definedVariables = array_unique( array_merge( $this->definedVariables, $variables ) );
} | php | public function trackDefinedVariables( $variables ) {
if ( !is_array( $variables ) ) {
$variables = $this->matchVariables( $variables );
}
$this->definedVariables = array_unique( array_merge( $this->definedVariables, $variables ) );
} | [
"public",
"function",
"trackDefinedVariables",
"(",
"$",
"variables",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"variables",
")",
")",
"{",
"$",
"variables",
"=",
"$",
"this",
"->",
"matchVariables",
"(",
"$",
"variables",
")",
";",
"}",
"$",
"th... | Trackes the list of variables as defined.
@param string[]|string $variables list of variables without prefixes | [
"Trackes",
"the",
"list",
"of",
"variables",
"as",
"defined",
"."
] | 6299517dc28ace1e5934a0b09a2ac6d8a2910032 | https://github.com/Benestar/asparagus/blob/6299517dc28ace1e5934a0b09a2ac6d8a2910032/src/UsageValidator.php#L62-L68 |
28,670 | Benestar/asparagus | src/UsageValidator.php | UsageValidator.trackUsedPrefixes | public function trackUsedPrefixes( $prefixes ) {
if ( !is_array( $prefixes ) ) {
$prefixes = $this->matchPrefixes( $prefixes );
}
$this->usedPrefixes = array_merge( $this->usedPrefixes, $prefixes );
} | php | public function trackUsedPrefixes( $prefixes ) {
if ( !is_array( $prefixes ) ) {
$prefixes = $this->matchPrefixes( $prefixes );
}
$this->usedPrefixes = array_merge( $this->usedPrefixes, $prefixes );
} | [
"public",
"function",
"trackUsedPrefixes",
"(",
"$",
"prefixes",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"prefixes",
")",
")",
"{",
"$",
"prefixes",
"=",
"$",
"this",
"->",
"matchPrefixes",
"(",
"$",
"prefixes",
")",
";",
"}",
"$",
"this",
"-... | Trackes the list of prefixes as used.
@param string[]|string $prefixes list of prefixes | [
"Trackes",
"the",
"list",
"of",
"prefixes",
"as",
"used",
"."
] | 6299517dc28ace1e5934a0b09a2ac6d8a2910032 | https://github.com/Benestar/asparagus/blob/6299517dc28ace1e5934a0b09a2ac6d8a2910032/src/UsageValidator.php#L75-L81 |
28,671 | Benestar/asparagus | src/UsageValidator.php | UsageValidator.trackDefinedPrefixes | public function trackDefinedPrefixes( $prefixes ) {
if ( !is_array( $prefixes ) ) {
$prefixes = $this->matchPrefixes( $prefixes );
}
$this->definedPrefixes = array_merge( $this->definedPrefixes, $prefixes );
} | php | public function trackDefinedPrefixes( $prefixes ) {
if ( !is_array( $prefixes ) ) {
$prefixes = $this->matchPrefixes( $prefixes );
}
$this->definedPrefixes = array_merge( $this->definedPrefixes, $prefixes );
} | [
"public",
"function",
"trackDefinedPrefixes",
"(",
"$",
"prefixes",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"prefixes",
")",
")",
"{",
"$",
"prefixes",
"=",
"$",
"this",
"->",
"matchPrefixes",
"(",
"$",
"prefixes",
")",
";",
"}",
"$",
"this",
... | Trackes the list of prefixes as defined.
@param string[]|string $prefixes list of prefixes | [
"Trackes",
"the",
"list",
"of",
"prefixes",
"as",
"defined",
"."
] | 6299517dc28ace1e5934a0b09a2ac6d8a2910032 | https://github.com/Benestar/asparagus/blob/6299517dc28ace1e5934a0b09a2ac6d8a2910032/src/UsageValidator.php#L88-L94 |
28,672 | Benestar/asparagus | src/QueryExecuter.php | QueryExecuter.execute | public function execute( $query ) {
if ( $query instanceof QueryBuilder ) {
$query = $query->getSPARQL();
}
if ( !is_string( $query ) ) {
throw new InvalidArgumentException( '$query has to be a string or an instance of QueryBuilder' );
}
$result = $this->getResult( $query );
// TODO also support ... | php | public function execute( $query ) {
if ( $query instanceof QueryBuilder ) {
$query = $query->getSPARQL();
}
if ( !is_string( $query ) ) {
throw new InvalidArgumentException( '$query has to be a string or an instance of QueryBuilder' );
}
$result = $this->getResult( $query );
// TODO also support ... | [
"public",
"function",
"execute",
"(",
"$",
"query",
")",
"{",
"if",
"(",
"$",
"query",
"instanceof",
"QueryBuilder",
")",
"{",
"$",
"query",
"=",
"$",
"query",
"->",
"getSPARQL",
"(",
")",
";",
"}",
"if",
"(",
"!",
"is_string",
"(",
"$",
"query",
"... | Executes the given SPARQL query.
@param string|QueryBuilder $query
@return array
@throws InvalidArgumentException
@throws RangeException
@throws RuntimeException | [
"Executes",
"the",
"given",
"SPARQL",
"query",
"."
] | 6299517dc28ace1e5934a0b09a2ac6d8a2910032 | https://github.com/Benestar/asparagus/blob/6299517dc28ace1e5934a0b09a2ac6d8a2910032/src/QueryExecuter.php#L58-L72 |
28,673 | flash-global/logger-client | src/Builder/SearchBuilder.php | SearchBuilder.contextCondition | public function contextCondition($type = 'AND')
{
$type = strtoupper($type);
if (!in_array($type, ['AND', 'OR'])) {
throw new LoggerException('Type has to be either "AND" or "OR"!');
}
$params = $this->getParams();
$params['context_condition'] = $type;
... | php | public function contextCondition($type = 'AND')
{
$type = strtoupper($type);
if (!in_array($type, ['AND', 'OR'])) {
throw new LoggerException('Type has to be either "AND" or "OR"!');
}
$params = $this->getParams();
$params['context_condition'] = $type;
... | [
"public",
"function",
"contextCondition",
"(",
"$",
"type",
"=",
"'AND'",
")",
"{",
"$",
"type",
"=",
"strtoupper",
"(",
"$",
"type",
")",
";",
"if",
"(",
"!",
"in_array",
"(",
"$",
"type",
",",
"[",
"'AND'",
",",
"'OR'",
"]",
")",
")",
"{",
"thr... | Set the condition type for the contexts
@param string $type
@return $this | [
"Set",
"the",
"condition",
"type",
"for",
"the",
"contexts"
] | f17f913a4adc04fa8648e474105e6c43e0d6384d | https://github.com/flash-global/logger-client/blob/f17f913a4adc04fa8648e474105e6c43e0d6384d/src/Builder/SearchBuilder.php#L106-L120 |
28,674 | flash-global/logger-client | src/Logger.php | Logger.registerErrorHandler | protected function registerErrorHandler()
{
$instance = $this;
$this->previousErrorHandler = set_error_handler(
function ($errno, $errstr, $errfile, $errline) use ($instance) {
$message = sprintf('%d: %s - File: %s - Line: %d', $errno, $errstr, $errfile, $errline);
... | php | protected function registerErrorHandler()
{
$instance = $this;
$this->previousErrorHandler = set_error_handler(
function ($errno, $errstr, $errfile, $errline) use ($instance) {
$message = sprintf('%d: %s - File: %s - Line: %d', $errno, $errstr, $errfile, $errline);
... | [
"protected",
"function",
"registerErrorHandler",
"(",
")",
"{",
"$",
"instance",
"=",
"$",
"this",
";",
"$",
"this",
"->",
"previousErrorHandler",
"=",
"set_error_handler",
"(",
"function",
"(",
"$",
"errno",
",",
"$",
"errstr",
",",
"$",
"errfile",
",",
"... | Add a error handler | [
"Add",
"a",
"error",
"handler"
] | f17f913a4adc04fa8648e474105e6c43e0d6384d | https://github.com/flash-global/logger-client/blob/f17f913a4adc04fa8648e474105e6c43e0d6384d/src/Logger.php#L201-L210 |
28,675 | flash-global/logger-client | src/Logger.php | Logger.writeToExceptionLogFile | protected function writeToExceptionLogFile($message)
{
if (is_writable($this->exceptionLogFile) || is_writable(dirname($this->exceptionLogFile))) {
$message = sprintf('[%s] %s' . PHP_EOL, (new \DateTime())->format(\DateTime::ISO8601), $message);
@file_put_contents($this->exceptionLog... | php | protected function writeToExceptionLogFile($message)
{
if (is_writable($this->exceptionLogFile) || is_writable(dirname($this->exceptionLogFile))) {
$message = sprintf('[%s] %s' . PHP_EOL, (new \DateTime())->format(\DateTime::ISO8601), $message);
@file_put_contents($this->exceptionLog... | [
"protected",
"function",
"writeToExceptionLogFile",
"(",
"$",
"message",
")",
"{",
"if",
"(",
"is_writable",
"(",
"$",
"this",
"->",
"exceptionLogFile",
")",
"||",
"is_writable",
"(",
"dirname",
"(",
"$",
"this",
"->",
"exceptionLogFile",
")",
")",
")",
"{",... | Write to exception log file
@param string $message | [
"Write",
"to",
"exception",
"log",
"file"
] | f17f913a4adc04fa8648e474105e6c43e0d6384d | https://github.com/flash-global/logger-client/blob/f17f913a4adc04fa8648e474105e6c43e0d6384d/src/Logger.php#L282-L288 |
28,676 | vend/php-resque | src/Failure/RedisBackend.php | RedisBackend.getBacktrace | protected function getBacktrace(\Exception $exception)
{
$backtrace = array();
$backtrace[] = '---';
$backtrace[] = $this->getErrorMessage($exception);
$backtrace[] = '---';
// Allow marshalling of the trace: PHP marks getTraceAsString as final :-(
if (method_exists... | php | protected function getBacktrace(\Exception $exception)
{
$backtrace = array();
$backtrace[] = '---';
$backtrace[] = $this->getErrorMessage($exception);
$backtrace[] = '---';
// Allow marshalling of the trace: PHP marks getTraceAsString as final :-(
if (method_exists... | [
"protected",
"function",
"getBacktrace",
"(",
"\\",
"Exception",
"$",
"exception",
")",
"{",
"$",
"backtrace",
"=",
"array",
"(",
")",
";",
"$",
"backtrace",
"[",
"]",
"=",
"'---'",
";",
"$",
"backtrace",
"[",
"]",
"=",
"$",
"this",
"->",
"getErrorMess... | Gets the backtrace for the exception
The backtrace area is the only part of the failure that's shown on
multiple lines by resque-web. So, we'll also use it to mention the
wrapping exceptions.
@param \Exception $exception
@return array | [
"Gets",
"the",
"backtrace",
"for",
"the",
"exception"
] | 91ed2b96e426b32680c15fd099a4688d2f75c163 | https://github.com/vend/php-resque/blob/91ed2b96e426b32680c15fd099a4688d2f75c163/src/Failure/RedisBackend.php#L51-L71 |
28,677 | vend/php-resque | src/Failure/RedisBackend.php | RedisBackend.getDistalCause | protected function getDistalCause(\Exception $exception)
{
if (($previous = $exception->getPrevious())) {
return $this->getDistalCause($previous);
}
return $exception;
} | php | protected function getDistalCause(\Exception $exception)
{
if (($previous = $exception->getPrevious())) {
return $this->getDistalCause($previous);
}
return $exception;
} | [
"protected",
"function",
"getDistalCause",
"(",
"\\",
"Exception",
"$",
"exception",
")",
"{",
"if",
"(",
"(",
"$",
"previous",
"=",
"$",
"exception",
"->",
"getPrevious",
"(",
")",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getDistalCause",
"(",
"$",
... | Find the ultimate cause exception, by following previous members right back
@param Exception $exception
@return Exception | [
"Find",
"the",
"ultimate",
"cause",
"exception",
"by",
"following",
"previous",
"members",
"right",
"back"
] | 91ed2b96e426b32680c15fd099a4688d2f75c163 | https://github.com/vend/php-resque/blob/91ed2b96e426b32680c15fd099a4688d2f75c163/src/Failure/RedisBackend.php#L79-L85 |
28,678 | vend/php-resque | src/Failure/RedisBackend.php | RedisBackend.getClass | protected function getClass(\Exception $exception)
{
$message = '';
if (($previous = $exception->getPrevious())) {
$message = $this->getClass($previous) . ' < '; // Recurse
}
// Let the exception lie about its class: to support marshalling exceptions
if (method_... | php | protected function getClass(\Exception $exception)
{
$message = '';
if (($previous = $exception->getPrevious())) {
$message = $this->getClass($previous) . ' < '; // Recurse
}
// Let the exception lie about its class: to support marshalling exceptions
if (method_... | [
"protected",
"function",
"getClass",
"(",
"\\",
"Exception",
"$",
"exception",
")",
"{",
"$",
"message",
"=",
"''",
";",
"if",
"(",
"(",
"$",
"previous",
"=",
"$",
"exception",
"->",
"getPrevious",
"(",
")",
")",
")",
"{",
"$",
"message",
"=",
"$",
... | Find the class names of the exceptions
@param Exception $exception
@return string | [
"Find",
"the",
"class",
"names",
"of",
"the",
"exceptions"
] | 91ed2b96e426b32680c15fd099a4688d2f75c163 | https://github.com/vend/php-resque/blob/91ed2b96e426b32680c15fd099a4688d2f75c163/src/Failure/RedisBackend.php#L93-L109 |
28,679 | vend/php-resque | src/Job/Status.php | Status.setAttributes | public function setAttributes(array $attributes)
{
$this->attributes = array_merge($this->attributes, $attributes);
$set = array();
foreach ($attributes as $name => $value) {
if ($name == 'status') {
$this->update($value);
continue;
}
... | php | public function setAttributes(array $attributes)
{
$this->attributes = array_merge($this->attributes, $attributes);
$set = array();
foreach ($attributes as $name => $value) {
if ($name == 'status') {
$this->update($value);
continue;
}
... | [
"public",
"function",
"setAttributes",
"(",
"array",
"$",
"attributes",
")",
"{",
"$",
"this",
"->",
"attributes",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"attributes",
",",
"$",
"attributes",
")",
";",
"$",
"set",
"=",
"array",
"(",
")",
";",
"for... | Sets all the given attributes
@param array<string,mixed> $attributes
@return mixed | [
"Sets",
"all",
"the",
"given",
"attributes"
] | 91ed2b96e426b32680c15fd099a4688d2f75c163 | https://github.com/vend/php-resque/blob/91ed2b96e426b32680c15fd099a4688d2f75c163/src/Job/Status.php#L142-L156 |
28,680 | vend/php-resque | src/Job/Status.php | Status.incrementAttribute | public function incrementAttribute($name, $by = 1)
{
$pipeline = $this->client->pipeline();
$pipeline->hincrby($this->getHashKey(), $name, $by);
$pipeline->hset($this->getHashKey(), 'updated', time());
$result = $pipeline->execute();
return $this->attributes[$name] = $result... | php | public function incrementAttribute($name, $by = 1)
{
$pipeline = $this->client->pipeline();
$pipeline->hincrby($this->getHashKey(), $name, $by);
$pipeline->hset($this->getHashKey(), 'updated', time());
$result = $pipeline->execute();
return $this->attributes[$name] = $result... | [
"public",
"function",
"incrementAttribute",
"(",
"$",
"name",
",",
"$",
"by",
"=",
"1",
")",
"{",
"$",
"pipeline",
"=",
"$",
"this",
"->",
"client",
"->",
"pipeline",
"(",
")",
";",
"$",
"pipeline",
"->",
"hincrby",
"(",
"$",
"this",
"->",
"getHashKe... | Increments an attribute
The attribute should be an integer field
@param string $name
@param integer $by
@return integer The value after incrementing (see hincrby) | [
"Increments",
"an",
"attribute"
] | 91ed2b96e426b32680c15fd099a4688d2f75c163 | https://github.com/vend/php-resque/blob/91ed2b96e426b32680c15fd099a4688d2f75c163/src/Job/Status.php#L186-L194 |
28,681 | vend/php-resque | src/Job/Status.php | Status.load | public function load()
{
if ($this->loaded) {
throw new \LogicException('The status is already loaded. Use another instance.');
}
$this->attributes = array_merge($this->attributes, $this->client->hgetall($this->getHashKey()));
$this->loaded = true;
} | php | public function load()
{
if ($this->loaded) {
throw new \LogicException('The status is already loaded. Use another instance.');
}
$this->attributes = array_merge($this->attributes, $this->client->hgetall($this->getHashKey()));
$this->loaded = true;
} | [
"public",
"function",
"load",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"loaded",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"'The status is already loaded. Use another instance.'",
")",
";",
"}",
"$",
"this",
"->",
"attributes",
"=",
"array_mer... | Loads all status attributes
@throws LogicException | [
"Loads",
"all",
"status",
"attributes"
] | 91ed2b96e426b32680c15fd099a4688d2f75c163 | https://github.com/vend/php-resque/blob/91ed2b96e426b32680c15fd099a4688d2f75c163/src/Job/Status.php#L256-L264 |
28,682 | vend/php-resque | src/Job/Status.php | Status.getAttribute | public function getAttribute($name, $default = null)
{
if ($this->loaded) {
return isset($this->attributes[$name]) ? $this->attributes[$name] : $default;
}
// Could be just hget, but Credis will return false?!
$attributes = $this->client->hGetAll($this->getHashKey());
... | php | public function getAttribute($name, $default = null)
{
if ($this->loaded) {
return isset($this->attributes[$name]) ? $this->attributes[$name] : $default;
}
// Could be just hget, but Credis will return false?!
$attributes = $this->client->hGetAll($this->getHashKey());
... | [
"public",
"function",
"getAttribute",
"(",
"$",
"name",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"loaded",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"attributes",
"[",
"$",
"name",
"]",
")",
"?",
"$",
"... | Gets a single attribute value
@param string $name
@param mixed $default
@return mixed | [
"Gets",
"a",
"single",
"attribute",
"value"
] | 91ed2b96e426b32680c15fd099a4688d2f75c163 | https://github.com/vend/php-resque/blob/91ed2b96e426b32680c15fd099a4688d2f75c163/src/Job/Status.php#L328-L337 |
28,683 | vend/php-resque | src/Console/ConsoleRunner.php | ConsoleRunner.createHelperSet | public static function createHelperSet($client, LoggerInterface $logger = null)
{
$helper = new HelperSet();
$helper->set(new RedisHelper($client));
if ($logger) {
$helper->set(new LoggerHelper($logger));
}
return $helper;
} | php | public static function createHelperSet($client, LoggerInterface $logger = null)
{
$helper = new HelperSet();
$helper->set(new RedisHelper($client));
if ($logger) {
$helper->set(new LoggerHelper($logger));
}
return $helper;
} | [
"public",
"static",
"function",
"createHelperSet",
"(",
"$",
"client",
",",
"LoggerInterface",
"$",
"logger",
"=",
"null",
")",
"{",
"$",
"helper",
"=",
"new",
"HelperSet",
"(",
")",
";",
"$",
"helper",
"->",
"set",
"(",
"new",
"RedisHelper",
"(",
"$",
... | Creates a helper set for the console component
A convenience method (you could always define your own HelperSet separately). Useful for writing cli-config.php.
@param ClientInterface $client Redis connection
@param \Psr\Log\LoggerInterface $logger Optional logger
@return HelperSet | [
"Creates",
"a",
"helper",
"set",
"for",
"the",
"console",
"component"
] | 91ed2b96e426b32680c15fd099a4688d2f75c163 | https://github.com/vend/php-resque/blob/91ed2b96e426b32680c15fd099a4688d2f75c163/src/Console/ConsoleRunner.php#L24-L34 |
28,684 | vend/php-resque | src/Console/ConsoleRunner.php | ConsoleRunner.run | public static function run(HelperSet $helperSet)
{
$application = new Application('Resque Console Tool', Version::VERSION);
$application->setCatchExceptions(true);
$application->setHelperSet($helperSet);
$application->add(new QueueListCommand());
$application->add(new QueueC... | php | public static function run(HelperSet $helperSet)
{
$application = new Application('Resque Console Tool', Version::VERSION);
$application->setCatchExceptions(true);
$application->setHelperSet($helperSet);
$application->add(new QueueListCommand());
$application->add(new QueueC... | [
"public",
"static",
"function",
"run",
"(",
"HelperSet",
"$",
"helperSet",
")",
"{",
"$",
"application",
"=",
"new",
"Application",
"(",
"'Resque Console Tool'",
",",
"Version",
"::",
"VERSION",
")",
";",
"$",
"application",
"->",
"setCatchExceptions",
"(",
"t... | Runs the application using the given HelperSet
This method is responsible for creating the console application, adding
relevant commands, and running it. Other code is responsible for producing
the HelperSet itself (your cli-config.php or bootstrap code), and for
calling this method (the actual bin command file).
@pa... | [
"Runs",
"the",
"application",
"using",
"the",
"given",
"HelperSet"
] | 91ed2b96e426b32680c15fd099a4688d2f75c163 | https://github.com/vend/php-resque/blob/91ed2b96e426b32680c15fd099a4688d2f75c163/src/Console/ConsoleRunner.php#L47-L59 |
28,685 | vend/php-resque | src/Resque.php | Resque.reconnect | public function reconnect()
{
if ($this->client->isConnected()) {
$this->client->disconnect();
}
$this->client->connect();
} | php | public function reconnect()
{
if ($this->client->isConnected()) {
$this->client->disconnect();
}
$this->client->connect();
} | [
"public",
"function",
"reconnect",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"client",
"->",
"isConnected",
"(",
")",
")",
"{",
"$",
"this",
"->",
"client",
"->",
"disconnect",
"(",
")",
";",
"}",
"$",
"this",
"->",
"client",
"->",
"connect",
"(... | Causes the client to reconnect to the Redis server
@return void | [
"Causes",
"the",
"client",
"to",
"reconnect",
"to",
"the",
"Redis",
"server"
] | 91ed2b96e426b32680c15fd099a4688d2f75c163 | https://github.com/vend/php-resque/blob/91ed2b96e426b32680c15fd099a4688d2f75c163/src/Resque.php#L145-L151 |
28,686 | vend/php-resque | src/Resque.php | Resque.clearQueue | public function clearQueue($queue)
{
$this->getClient()->del($this->getKey(self::QUEUE_KEY . $queue));
} | php | public function clearQueue($queue)
{
$this->getClient()->del($this->getKey(self::QUEUE_KEY . $queue));
} | [
"public",
"function",
"clearQueue",
"(",
"$",
"queue",
")",
"{",
"$",
"this",
"->",
"getClient",
"(",
")",
"->",
"del",
"(",
"$",
"this",
"->",
"getKey",
"(",
"self",
"::",
"QUEUE_KEY",
".",
"$",
"queue",
")",
")",
";",
"}"
] | Clears the whole of a queue
@param string $queue | [
"Clears",
"the",
"whole",
"of",
"a",
"queue"
] | 91ed2b96e426b32680c15fd099a4688d2f75c163 | https://github.com/vend/php-resque/blob/91ed2b96e426b32680c15fd099a4688d2f75c163/src/Resque.php#L231-L234 |
28,687 | vend/php-resque | src/Worker.php | Worker.configure | protected function configure(array $options)
{
$this->options = array_merge(array(
'server_name' => null,
'pid' => null,
'ps' => '/bin/ps',
'ps_args' => array('-o', 'pid,state', '-p'),
'id_format' => ... | php | protected function configure(array $options)
{
$this->options = array_merge(array(
'server_name' => null,
'pid' => null,
'ps' => '/bin/ps',
'ps_args' => array('-o', 'pid,state', '-p'),
'id_format' => ... | [
"protected",
"function",
"configure",
"(",
"array",
"$",
"options",
")",
"{",
"$",
"this",
"->",
"options",
"=",
"array_merge",
"(",
"array",
"(",
"'server_name'",
"=>",
"null",
",",
"'pid'",
"=>",
"null",
",",
"'ps'",
"=>",
"'/bin/ps'",
",",
"'ps_args'",
... | Configures options for the worker
@param array<string,mixed> $options
Including
Worker identification
- server_name => string, default is FQDN hostname
- pid => int, default is current PID
- id_format => string, suitable for sprintf
- id_location_preg => string, Perl compat regex, gets hostnam... | [
"Configures",
"options",
"for",
"the",
"worker"
] | 91ed2b96e426b32680c15fd099a4688d2f75c163 | https://github.com/vend/php-resque/blob/91ed2b96e426b32680c15fd099a4688d2f75c163/src/Worker.php#L122-L142 |
28,688 | vend/php-resque | src/Worker.php | Worker.configureId | protected function configureId()
{
$this->id = sprintf(
$this->options['id_format'],
$this->options['server_name'],
$this->options['pid'],
implode(',', $this->queues)
);
} | php | protected function configureId()
{
$this->id = sprintf(
$this->options['id_format'],
$this->options['server_name'],
$this->options['pid'],
implode(',', $this->queues)
);
} | [
"protected",
"function",
"configureId",
"(",
")",
"{",
"$",
"this",
"->",
"id",
"=",
"sprintf",
"(",
"$",
"this",
"->",
"options",
"[",
"'id_format'",
"]",
",",
"$",
"this",
"->",
"options",
"[",
"'server_name'",
"]",
",",
"$",
"this",
"->",
"options",... | Configures the ID of this worker | [
"Configures",
"the",
"ID",
"of",
"this",
"worker"
] | 91ed2b96e426b32680c15fd099a4688d2f75c163 | https://github.com/vend/php-resque/blob/91ed2b96e426b32680c15fd099a4688d2f75c163/src/Worker.php#L147-L155 |
28,689 | vend/php-resque | src/Worker.php | Worker.getLocation | protected function getLocation()
{
$matches = array();
if (!preg_match($this->options['id_location_preg'], $this->getId(), $matches)) {
throw new Exception('Incompatible ID format: unable to determine worker location');
}
if (!isset($matches[1]) || !$matches[1]) {
... | php | protected function getLocation()
{
$matches = array();
if (!preg_match($this->options['id_location_preg'], $this->getId(), $matches)) {
throw new Exception('Incompatible ID format: unable to determine worker location');
}
if (!isset($matches[1]) || !$matches[1]) {
... | [
"protected",
"function",
"getLocation",
"(",
")",
"{",
"$",
"matches",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"preg_match",
"(",
"$",
"this",
"->",
"options",
"[",
"'id_location_preg'",
"]",
",",
"$",
"this",
"->",
"getId",
"(",
")",
",",
"$",
... | Parses a hostname and PID out of a string worker ID
If you change the format of the ID, you should also change the definition
of this method.
This method *always* parses the ID of the worker, rather than figuring out
the current processes' PID/hostname. This means you can use setId() to
interrogate the properties of ... | [
"Parses",
"a",
"hostname",
"and",
"PID",
"out",
"of",
"a",
"string",
"worker",
"ID"
] | 91ed2b96e426b32680c15fd099a4688d2f75c163 | https://github.com/vend/php-resque/blob/91ed2b96e426b32680c15fd099a4688d2f75c163/src/Worker.php#L206-L223 |
28,690 | vend/php-resque | src/Worker.php | Worker.failJob | protected function failJob($job, Exception $exception)
{
if ($job instanceof JobInterface) {
$payload = $job->getPayload();
$queue = $job->getQueue();
} else {
$payload = $job;
$queue = isset($job['queue']) ? $job['queue'] : null;
}
... | php | protected function failJob($job, Exception $exception)
{
if ($job instanceof JobInterface) {
$payload = $job->getPayload();
$queue = $job->getQueue();
} else {
$payload = $job;
$queue = isset($job['queue']) ? $job['queue'] : null;
}
... | [
"protected",
"function",
"failJob",
"(",
"$",
"job",
",",
"Exception",
"$",
"exception",
")",
"{",
"if",
"(",
"$",
"job",
"instanceof",
"JobInterface",
")",
"{",
"$",
"payload",
"=",
"$",
"job",
"->",
"getPayload",
"(",
")",
";",
"$",
"queue",
"=",
"... | Marks the given job as failed
This happens whenever the job's perform() method emits an exception
@param JobInterface|array $job
@param Exception $exception | [
"Marks",
"the",
"given",
"job",
"as",
"failed"
] | 91ed2b96e426b32680c15fd099a4688d2f75c163 | https://github.com/vend/php-resque/blob/91ed2b96e426b32680c15fd099a4688d2f75c163/src/Worker.php#L378-L408 |
28,691 | vend/php-resque | src/Worker.php | Worker.refreshQueues | protected function refreshQueues()
{
if ($this->refreshQueues) {
$this->queues = $this->resque->queues();
}
if (!$this->queues) {
if ($this->refreshQueues) {
$this->logger->info('Refreshing queues dynamically, but there are no queues yet');
... | php | protected function refreshQueues()
{
if ($this->refreshQueues) {
$this->queues = $this->resque->queues();
}
if (!$this->queues) {
if ($this->refreshQueues) {
$this->logger->info('Refreshing queues dynamically, but there are no queues yet');
... | [
"protected",
"function",
"refreshQueues",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"refreshQueues",
")",
"{",
"$",
"this",
"->",
"queues",
"=",
"$",
"this",
"->",
"resque",
"->",
"queues",
"(",
")",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
... | Prepares the list of queues for a job to reserved
Updates/sorts/shuffles the array ahead of the call to reserve a job from one of them
@return void | [
"Prepares",
"the",
"list",
"of",
"queues",
"for",
"a",
"job",
"to",
"reserved"
] | 91ed2b96e426b32680c15fd099a4688d2f75c163 | https://github.com/vend/php-resque/blob/91ed2b96e426b32680c15fd099a4688d2f75c163/src/Worker.php#L417-L438 |
28,692 | slashtrace/slashtrace | src/Level.php | Level.severityToLevel | public static function severityToLevel($severity)
{
switch ($severity) {
case E_USER_NOTICE:
case E_NOTICE:
case E_STRICT:
return self::INFO;
case E_WARNING:
case E_CORE_WARNING:
case E_COMPILE_WARNING:
case... | php | public static function severityToLevel($severity)
{
switch ($severity) {
case E_USER_NOTICE:
case E_NOTICE:
case E_STRICT:
return self::INFO;
case E_WARNING:
case E_CORE_WARNING:
case E_COMPILE_WARNING:
case... | [
"public",
"static",
"function",
"severityToLevel",
"(",
"$",
"severity",
")",
"{",
"switch",
"(",
"$",
"severity",
")",
"{",
"case",
"E_USER_NOTICE",
":",
"case",
"E_NOTICE",
":",
"case",
"E_STRICT",
":",
"return",
"self",
"::",
"INFO",
";",
"case",
"E_WAR... | Converts PHP error constants to custom log level
@param $severity
@return string | [
"Converts",
"PHP",
"error",
"constants",
"to",
"custom",
"log",
"level"
] | bc0501703546a2e62e79d02725dd173c45c49ff5 | https://github.com/slashtrace/slashtrace/blob/bc0501703546a2e62e79d02725dd173c45c49ff5/src/Level.php#L34-L59 |
28,693 | slashtrace/slashtrace | src/Http/Request.php | Request.getUrl | public function getUrl()
{
$https = $this->isHTTPS();
$protocol = strtolower($_SERVER["SERVER_PROTOCOL"]);
$protocol = substr($protocol, 0, strpos($protocol, "/")) . ($https ? "s" : "");
$port = $_SERVER["SERVER_PORT"];
$port = ($port == 80 && !$https) || ($port == 443 && $... | php | public function getUrl()
{
$https = $this->isHTTPS();
$protocol = strtolower($_SERVER["SERVER_PROTOCOL"]);
$protocol = substr($protocol, 0, strpos($protocol, "/")) . ($https ? "s" : "");
$port = $_SERVER["SERVER_PORT"];
$port = ($port == 80 && !$https) || ($port == 443 && $... | [
"public",
"function",
"getUrl",
"(",
")",
"{",
"$",
"https",
"=",
"$",
"this",
"->",
"isHTTPS",
"(",
")",
";",
"$",
"protocol",
"=",
"strtolower",
"(",
"$",
"_SERVER",
"[",
"\"SERVER_PROTOCOL\"",
"]",
")",
";",
"$",
"protocol",
"=",
"substr",
"(",
"$... | Returns the full URL being requested
@return string | [
"Returns",
"the",
"full",
"URL",
"being",
"requested"
] | bc0501703546a2e62e79d02725dd173c45c49ff5 | https://github.com/slashtrace/slashtrace/blob/bc0501703546a2e62e79d02725dd173c45c49ff5/src/Http/Request.php#L101-L115 |
28,694 | slashtrace/slashtrace | src/SlashTrace.php | SlashTrace.checkUniqueHandler | private function checkUniqueHandler(EventHandler $input)
{
foreach ($this->handlers as $handler) {
if ($handler === $input) {
throw new RuntimeException();
}
}
} | php | private function checkUniqueHandler(EventHandler $input)
{
foreach ($this->handlers as $handler) {
if ($handler === $input) {
throw new RuntimeException();
}
}
} | [
"private",
"function",
"checkUniqueHandler",
"(",
"EventHandler",
"$",
"input",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"handlers",
"as",
"$",
"handler",
")",
"{",
"if",
"(",
"$",
"handler",
"===",
"$",
"input",
")",
"{",
"throw",
"new",
"RuntimeExc... | Checks that a particular handler hasn't already been registered
@param EventHandler $input
@throws RuntimeException | [
"Checks",
"that",
"a",
"particular",
"handler",
"hasn",
"t",
"already",
"been",
"registered"
] | bc0501703546a2e62e79d02725dd173c45c49ff5 | https://github.com/slashtrace/slashtrace/blob/bc0501703546a2e62e79d02725dd173c45c49ff5/src/SlashTrace.php#L80-L87 |
28,695 | php-deal/framework | src/Aspect/PreconditionCheckerAspect.php | PreconditionCheckerAspect.preConditionContract | public function preConditionContract(MethodInvocation $invocation): void
{
$object = $invocation->getThis();
$args = $this->fetchMethodArguments($invocation);
$scope = $invocation->getMethod()->getDeclaringClass()->name;
$allContracts = $this->fetchAllContracts($invocation);
... | php | public function preConditionContract(MethodInvocation $invocation): void
{
$object = $invocation->getThis();
$args = $this->fetchMethodArguments($invocation);
$scope = $invocation->getMethod()->getDeclaringClass()->name;
$allContracts = $this->fetchAllContracts($invocation);
... | [
"public",
"function",
"preConditionContract",
"(",
"MethodInvocation",
"$",
"invocation",
")",
":",
"void",
"{",
"$",
"object",
"=",
"$",
"invocation",
"->",
"getThis",
"(",
")",
";",
"$",
"args",
"=",
"$",
"this",
"->",
"fetchMethodArguments",
"(",
"$",
"... | Verifies pre-condition contract for the method
@param MethodInvocation $invocation
@Before("@execution(PhpDeal\Annotation\Verify)")
@throws ContractViolation
@throws ReflectionException | [
"Verifies",
"pre",
"-",
"condition",
"contract",
"for",
"the",
"method"
] | 31ff0b8fe6c76e4df8cc60b4a0da68a0177b7d43 | https://github.com/php-deal/framework/blob/31ff0b8fe6c76e4df8cc60b4a0da68a0177b7d43/src/Aspect/PreconditionCheckerAspect.php#L48-L56 |
28,696 | php-deal/framework | src/Aspect/AbstractContractAspect.php | AbstractContractAspect.fetchMethodArguments | protected function fetchMethodArguments(MethodInvocation $invocation): array
{
$result = [];
$parameters = $invocation->getMethod()->getParameters();
$argumentValues = $invocation->getArguments();
// Number of arguments can be less than number of parameters because of de... | php | protected function fetchMethodArguments(MethodInvocation $invocation): array
{
$result = [];
$parameters = $invocation->getMethod()->getParameters();
$argumentValues = $invocation->getArguments();
// Number of arguments can be less than number of parameters because of de... | [
"protected",
"function",
"fetchMethodArguments",
"(",
"MethodInvocation",
"$",
"invocation",
")",
":",
"array",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"parameters",
"=",
"$",
"invocation",
"->",
"getMethod",
"(",
")",
"->",
"getParameters",
"(",
")",
... | Returns an associative list of arguments for the method invocation
@param MethodInvocation $invocation
@return array
@throws \ReflectionException | [
"Returns",
"an",
"associative",
"list",
"of",
"arguments",
"for",
"the",
"method",
"invocation"
] | 31ff0b8fe6c76e4df8cc60b4a0da68a0177b7d43 | https://github.com/php-deal/framework/blob/31ff0b8fe6c76e4df8cc60b4a0da68a0177b7d43/src/Aspect/AbstractContractAspect.php#L43-L60 |
28,697 | php-deal/framework | src/Aspect/AbstractContractAspect.php | AbstractContractAspect.ensureContracts | protected function ensureContracts(
MethodInvocation $invocation,
array $contracts,
$instance,
string $scope,
array $args
): void {
static $invoker = null;
if (!$invoker) {
$invoker = function () {
$args = \func_get_arg(0);
... | php | protected function ensureContracts(
MethodInvocation $invocation,
array $contracts,
$instance,
string $scope,
array $args
): void {
static $invoker = null;
if (!$invoker) {
$invoker = function () {
$args = \func_get_arg(0);
... | [
"protected",
"function",
"ensureContracts",
"(",
"MethodInvocation",
"$",
"invocation",
",",
"array",
"$",
"contracts",
",",
"$",
"instance",
",",
"string",
"$",
"scope",
",",
"array",
"$",
"args",
")",
":",
"void",
"{",
"static",
"$",
"invoker",
"=",
"nul... | Performs verification of contracts for given invocation
@param MethodInvocation $invocation Current invocation
@param array|Annotation[] $contracts Contract annotation
@param object|string $instance Invocation instance or string for static class
@param string $scope Scope of method
@param array $args List of arguments... | [
"Performs",
"verification",
"of",
"contracts",
"for",
"given",
"invocation"
] | 31ff0b8fe6c76e4df8cc60b4a0da68a0177b7d43 | https://github.com/php-deal/framework/blob/31ff0b8fe6c76e4df8cc60b4a0da68a0177b7d43/src/Aspect/AbstractContractAspect.php#L74-L117 |
28,698 | php-deal/framework | src/ContractApplication.php | ContractApplication.configureAop | protected function configureAop(AspectContainer $container): void
{
/** @var AnnotationReader $reader */
$reader = $container->get('aspect.annotation.reader');
$container->registerAspect(new InvariantCheckerAspect($reader));
$container->registerAspect(new PostconditionCheckerAspect(... | php | protected function configureAop(AspectContainer $container): void
{
/** @var AnnotationReader $reader */
$reader = $container->get('aspect.annotation.reader');
$container->registerAspect(new InvariantCheckerAspect($reader));
$container->registerAspect(new PostconditionCheckerAspect(... | [
"protected",
"function",
"configureAop",
"(",
"AspectContainer",
"$",
"container",
")",
":",
"void",
"{",
"/** @var AnnotationReader $reader */",
"$",
"reader",
"=",
"$",
"container",
"->",
"get",
"(",
"'aspect.annotation.reader'",
")",
";",
"$",
"container",
"->",
... | Configures an AspectContainer with advisors, aspects and pointcuts
@param AspectContainer&GoAspectContainer $container
@return void | [
"Configures",
"an",
"AspectContainer",
"with",
"advisors",
"aspects",
"and",
"pointcuts"
] | 31ff0b8fe6c76e4df8cc60b4a0da68a0177b7d43 | https://github.com/php-deal/framework/blob/31ff0b8fe6c76e4df8cc60b4a0da68a0177b7d43/src/ContractApplication.php#L36-L45 |
28,699 | php-deal/framework | src/Contract/Fetcher/Parent/InvariantFetcher.php | InvariantFetcher.getConditions | public function getConditions(ReflectionClass $class): array
{
$annotations = [];
$parents = [];
$this->getParentClasses($class, $parents);
$this->getInterfaces($class, $parents);
foreach ($parents as $parent) {
$annotations[] = $this->annotationReader->getCla... | php | public function getConditions(ReflectionClass $class): array
{
$annotations = [];
$parents = [];
$this->getParentClasses($class, $parents);
$this->getInterfaces($class, $parents);
foreach ($parents as $parent) {
$annotations[] = $this->annotationReader->getCla... | [
"public",
"function",
"getConditions",
"(",
"ReflectionClass",
"$",
"class",
")",
":",
"array",
"{",
"$",
"annotations",
"=",
"[",
"]",
";",
"$",
"parents",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"getParentClasses",
"(",
"$",
"class",
",",
"$",
"parent... | Fetches conditions from all parent classes recursively
@param ReflectionClass $class
@return array | [
"Fetches",
"conditions",
"from",
"all",
"parent",
"classes",
"recursively"
] | 31ff0b8fe6c76e4df8cc60b4a0da68a0177b7d43 | https://github.com/php-deal/framework/blob/31ff0b8fe6c76e4df8cc60b4a0da68a0177b7d43/src/Contract/Fetcher/Parent/InvariantFetcher.php#L26-L43 |
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.