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,900 | IconoCoders/otp-simple-sdk | Source/SimpleTransaction.php | SimpleTransaction.setDefaults | protected function setDefaults($sets = array())
{
foreach ($sets as $set) {
foreach ($set as $field => $fieldParams) {
if ($fieldParams['type'] == 'single' && isset($fieldParams['default'])) {
$this->fieldData[$field] = $fieldParams['default'];
... | php | protected function setDefaults($sets = array())
{
foreach ($sets as $set) {
foreach ($set as $field => $fieldParams) {
if ($fieldParams['type'] == 'single' && isset($fieldParams['default'])) {
$this->fieldData[$field] = $fieldParams['default'];
... | [
"protected",
"function",
"setDefaults",
"(",
"$",
"sets",
"=",
"array",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"sets",
"as",
"$",
"set",
")",
"{",
"foreach",
"(",
"$",
"set",
"as",
"$",
"field",
"=>",
"$",
"fieldParams",
")",
"{",
"if",
"(",
"$... | Sets default value for a field
@param array $sets Array of fields and its parameters
@return void | [
"Sets",
"default",
"value",
"for",
"a",
"field"
] | d2808bf52e8d34be69414b444a00f1a9c8564930 | https://github.com/IconoCoders/otp-simple-sdk/blob/d2808bf52e8d34be69414b444a00f1a9c8564930/Source/SimpleTransaction.php#L204-L213 |
28,901 | IconoCoders/otp-simple-sdk | Source/SimpleTransaction.php | SimpleTransaction.checkRequired | protected function checkRequired()
{
$missing = array();
foreach ($this->validFields as $field => $params) {
if (isset($params['required']) && $params['required']) {
if ($params['type'] == "single") {
if (!isset($this->formData[$field])) {
... | php | protected function checkRequired()
{
$missing = array();
foreach ($this->validFields as $field => $params) {
if (isset($params['required']) && $params['required']) {
if ($params['type'] == "single") {
if (!isset($this->formData[$field])) {
... | [
"protected",
"function",
"checkRequired",
"(",
")",
"{",
"$",
"missing",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"validFields",
"as",
"$",
"field",
"=>",
"$",
"params",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"params",
"[",
... | Checks if all required fields are set.
Returns true or the array of missing fields list
@return boolean | [
"Checks",
"if",
"all",
"required",
"fields",
"are",
"set",
".",
"Returns",
"true",
"or",
"the",
"array",
"of",
"missing",
"fields",
"list"
] | d2808bf52e8d34be69414b444a00f1a9c8564930 | https://github.com/IconoCoders/otp-simple-sdk/blob/d2808bf52e8d34be69414b444a00f1a9c8564930/Source/SimpleTransaction.php#L222-L245 |
28,902 | IconoCoders/otp-simple-sdk | Source/SimpleTransaction.php | SimpleTransaction.getField | public function getField($fieldName = '')
{
if (isset($this->fieldData[$fieldName])) {
return $this->fieldData[$fieldName];
}
$this->debugMessage[] = 'GET FIELD: Missing field name in getField: ' . $fieldName;
return false;
} | php | public function getField($fieldName = '')
{
if (isset($this->fieldData[$fieldName])) {
return $this->fieldData[$fieldName];
}
$this->debugMessage[] = 'GET FIELD: Missing field name in getField: ' . $fieldName;
return false;
} | [
"public",
"function",
"getField",
"(",
"$",
"fieldName",
"=",
"''",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"fieldData",
"[",
"$",
"fieldName",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"fieldData",
"[",
"$",
"fieldName",
"]",
... | Getter method for fields
@param string $fieldName Name of the field
@return array Data of field | [
"Getter",
"method",
"for",
"fields"
] | d2808bf52e8d34be69414b444a00f1a9c8564930 | https://github.com/IconoCoders/otp-simple-sdk/blob/d2808bf52e8d34be69414b444a00f1a9c8564930/Source/SimpleTransaction.php#L255-L262 |
28,903 | IconoCoders/otp-simple-sdk | Source/SimpleTransaction.php | SimpleTransaction.setField | public function setField($fieldName = '', $fieldValue = '')
{
if (in_array($fieldName, array_keys($this->validFields))) {
$this->fieldData[$fieldName] = $this->cleanString($fieldValue);
if ($fieldName == 'LU_ENABLE_TOKEN') {
if ($fieldValue) {
$thi... | php | public function setField($fieldName = '', $fieldValue = '')
{
if (in_array($fieldName, array_keys($this->validFields))) {
$this->fieldData[$fieldName] = $this->cleanString($fieldValue);
if ($fieldName == 'LU_ENABLE_TOKEN') {
if ($fieldValue) {
$thi... | [
"public",
"function",
"setField",
"(",
"$",
"fieldName",
"=",
"''",
",",
"$",
"fieldValue",
"=",
"''",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"fieldName",
",",
"array_keys",
"(",
"$",
"this",
"->",
"validFields",
")",
")",
")",
"{",
"$",
"this",
... | Setter method for fields
@param string $fieldName Name of the field to be set
@param imxed $fieldValue Value of the field to be set
@return boolean | [
"Setter",
"method",
"for",
"fields"
] | d2808bf52e8d34be69414b444a00f1a9c8564930 | https://github.com/IconoCoders/otp-simple-sdk/blob/d2808bf52e8d34be69414b444a00f1a9c8564930/Source/SimpleTransaction.php#L273-L286 |
28,904 | IconoCoders/otp-simple-sdk | Source/SimpleTransaction.php | SimpleTransaction.prepareFields | protected function prepareFields($hashName = '')
{
if (!is_string($hashName)) {
$this->errorMessage[] = 'PREPARE: Hash name is not string!';
return false;
}
$this->setHashData();
$this->setFormData();
if ($this->hashData) {
$this->formData[... | php | protected function prepareFields($hashName = '')
{
if (!is_string($hashName)) {
$this->errorMessage[] = 'PREPARE: Hash name is not string!';
return false;
}
$this->setHashData();
$this->setFormData();
if ($this->hashData) {
$this->formData[... | [
"protected",
"function",
"prepareFields",
"(",
"$",
"hashName",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"hashName",
")",
")",
"{",
"$",
"this",
"->",
"errorMessage",
"[",
"]",
"=",
"'PREPARE: Hash name is not string!'",
";",
"return",
"... | Finalizes and prepares fields for sending
@param string $hashName Name of the field containing HMAC HASH code
@return boolean | [
"Finalizes",
"and",
"prepares",
"fields",
"for",
"sending"
] | d2808bf52e8d34be69414b444a00f1a9c8564930 | https://github.com/IconoCoders/otp-simple-sdk/blob/d2808bf52e8d34be69414b444a00f1a9c8564930/Source/SimpleTransaction.php#L321-L339 |
28,905 | IconoCoders/otp-simple-sdk | Source/SimpleTransaction.php | SimpleTransaction.setHashData | protected function setHashData()
{
foreach ($this->hashFields as $field) {
$params = $this->validFields[$field];
if ($params['type'] == "single") {
if (isset($this->fieldData[$field])) {
$this->hashData[] = $this->fieldData[$field];
... | php | protected function setHashData()
{
foreach ($this->hashFields as $field) {
$params = $this->validFields[$field];
if ($params['type'] == "single") {
if (isset($this->fieldData[$field])) {
$this->hashData[] = $this->fieldData[$field];
... | [
"protected",
"function",
"setHashData",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"hashFields",
"as",
"$",
"field",
")",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"validFields",
"[",
"$",
"field",
"]",
";",
"if",
"(",
"$",
"params",
"[",
... | Set hash data by hashFields
@return void | [
"Set",
"hash",
"data",
"by",
"hashFields"
] | d2808bf52e8d34be69414b444a00f1a9c8564930 | https://github.com/IconoCoders/otp-simple-sdk/blob/d2808bf52e8d34be69414b444a00f1a9c8564930/Source/SimpleTransaction.php#L347-L363 |
28,906 | IconoCoders/otp-simple-sdk | Source/SimpleTransaction.php | SimpleTransaction.setFormData | protected function setFormData()
{
foreach ($this->validFields as $field => $params) {
if (isset($params["rename"])) {
$field = $params["rename"];
}
if ($params['type'] == "single") {
if (isset($this->fieldData[$field])) {
... | php | protected function setFormData()
{
foreach ($this->validFields as $field => $params) {
if (isset($params["rename"])) {
$field = $params["rename"];
}
if ($params['type'] == "single") {
if (isset($this->fieldData[$field])) {
... | [
"protected",
"function",
"setFormData",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"validFields",
"as",
"$",
"field",
"=>",
"$",
"params",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"params",
"[",
"\"rename\"",
"]",
")",
")",
"{",
"$",
"field",
... | Set form data by validFields
@return void | [
"Set",
"form",
"data",
"by",
"validFields"
] | d2808bf52e8d34be69414b444a00f1a9c8564930 | https://github.com/IconoCoders/otp-simple-sdk/blob/d2808bf52e8d34be69414b444a00f1a9c8564930/Source/SimpleTransaction.php#L371-L392 |
28,907 | IconoCoders/otp-simple-sdk | Source/SimpleTransaction.php | SimpleTransaction.processResponse | public function processResponse($resp = '')
{
preg_match_all("/<EPAYMENT>(.*?)<\/EPAYMENT>/", $resp, $matches);
$data = explode("|", $matches[1][0]);
if (is_array($data)) {
if (count($data) > 0) {
$counter = 1;
foreach ($data as $dataValue) {
... | php | public function processResponse($resp = '')
{
preg_match_all("/<EPAYMENT>(.*?)<\/EPAYMENT>/", $resp, $matches);
$data = explode("|", $matches[1][0]);
if (is_array($data)) {
if (count($data) > 0) {
$counter = 1;
foreach ($data as $dataValue) {
... | [
"public",
"function",
"processResponse",
"(",
"$",
"resp",
"=",
"''",
")",
"{",
"preg_match_all",
"(",
"\"/<EPAYMENT>(.*?)<\\/EPAYMENT>/\"",
",",
"$",
"resp",
",",
"$",
"matches",
")",
";",
"$",
"data",
"=",
"explode",
"(",
"\"|\"",
",",
"$",
"matches",
"[... | Finds and processes validation response from HTTP response
@param string $resp HTTP response
@return array Data | [
"Finds",
"and",
"processes",
"validation",
"response",
"from",
"HTTP",
"response"
] | d2808bf52e8d34be69414b444a00f1a9c8564930 | https://github.com/IconoCoders/otp-simple-sdk/blob/d2808bf52e8d34be69414b444a00f1a9c8564930/Source/SimpleTransaction.php#L402-L416 |
28,908 | IconoCoders/otp-simple-sdk | Source/SimpleTransaction.php | SimpleTransaction.checkResponseHash | public function checkResponseHash($resp = array())
{
$hash = 'N/A';
if (isset($resp['ORDER_HASH'])) {
$hash = $resp['ORDER_HASH'];
}
elseif (isset($resp['hash'])) {
$hash = $resp['hash'];
}
array_pop($resp);
$calculated = $this->create... | php | public function checkResponseHash($resp = array())
{
$hash = 'N/A';
if (isset($resp['ORDER_HASH'])) {
$hash = $resp['ORDER_HASH'];
}
elseif (isset($resp['hash'])) {
$hash = $resp['hash'];
}
array_pop($resp);
$calculated = $this->create... | [
"public",
"function",
"checkResponseHash",
"(",
"$",
"resp",
"=",
"array",
"(",
")",
")",
"{",
"$",
"hash",
"=",
"'N/A'",
";",
"if",
"(",
"isset",
"(",
"$",
"resp",
"[",
"'ORDER_HASH'",
"]",
")",
")",
"{",
"$",
"hash",
"=",
"$",
"resp",
"[",
"'OR... | Validates HASH code of the response
@param array $resp Array with the response data
@return boolean | [
"Validates",
"HASH",
"code",
"of",
"the",
"response"
] | d2808bf52e8d34be69414b444a00f1a9c8564930 | https://github.com/IconoCoders/otp-simple-sdk/blob/d2808bf52e8d34be69414b444a00f1a9c8564930/Source/SimpleTransaction.php#L426-L449 |
28,909 | netgen/site-bundle | bundle/DependencyInjection/Compiler/XmlTextFieldTypePass.php | XmlTextFieldTypePass.process | public function process(ContainerBuilder $container): void
{
if ($container->has('ezpublish.fieldType.ezxmltext.converter.embedToHtml5')) {
$container
->findDefinition('ezpublish.fieldType.ezxmltext.converter.embedToHtml5')
->setClass(EmbedToHtml5::class)
... | php | public function process(ContainerBuilder $container): void
{
if ($container->has('ezpublish.fieldType.ezxmltext.converter.embedToHtml5')) {
$container
->findDefinition('ezpublish.fieldType.ezxmltext.converter.embedToHtml5')
->setClass(EmbedToHtml5::class)
... | [
"public",
"function",
"process",
"(",
"ContainerBuilder",
"$",
"container",
")",
":",
"void",
"{",
"if",
"(",
"$",
"container",
"->",
"has",
"(",
"'ezpublish.fieldType.ezxmltext.converter.embedToHtml5'",
")",
")",
"{",
"$",
"container",
"->",
"findDefinition",
"("... | Overrides EmbedToHtml5 ezxmltext converter with own implementation. | [
"Overrides",
"EmbedToHtml5",
"ezxmltext",
"converter",
"with",
"own",
"implementation",
"."
] | 4198c8412ffdb6692b80d35e05c8ba331365b746 | https://github.com/netgen/site-bundle/blob/4198c8412ffdb6692b80d35e05c8ba331365b746/bundle/DependencyInjection/Compiler/XmlTextFieldTypePass.php#L17-L25 |
28,910 | netgen/site-bundle | bundle/Pagerfanta/View/SiteView.php | SiteView.calculateEndPageForStartPageUnderflow | protected function calculateEndPageForStartPageUnderflow(int $startPage, int $endPage, int $nbPages): int
{
return min($endPage + (1 - $startPage), $nbPages);
} | php | protected function calculateEndPageForStartPageUnderflow(int $startPage, int $endPage, int $nbPages): int
{
return min($endPage + (1 - $startPage), $nbPages);
} | [
"protected",
"function",
"calculateEndPageForStartPageUnderflow",
"(",
"int",
"$",
"startPage",
",",
"int",
"$",
"endPage",
",",
"int",
"$",
"nbPages",
")",
":",
"int",
"{",
"return",
"min",
"(",
"$",
"endPage",
"+",
"(",
"1",
"-",
"$",
"startPage",
")",
... | Calculates the end page when start page is underflowed. | [
"Calculates",
"the",
"end",
"page",
"when",
"start",
"page",
"is",
"underflowed",
"."
] | 4198c8412ffdb6692b80d35e05c8ba331365b746 | https://github.com/netgen/site-bundle/blob/4198c8412ffdb6692b80d35e05c8ba331365b746/bundle/Pagerfanta/View/SiteView.php#L139-L142 |
28,911 | netgen/site-bundle | bundle/Pagerfanta/View/SiteView.php | SiteView.calculateStartPageForEndPageOverflow | protected function calculateStartPageForEndPageOverflow(int $startPage, int $endPage, int $nbPages): int
{
return max($startPage - ($endPage - $nbPages), 1);
} | php | protected function calculateStartPageForEndPageOverflow(int $startPage, int $endPage, int $nbPages): int
{
return max($startPage - ($endPage - $nbPages), 1);
} | [
"protected",
"function",
"calculateStartPageForEndPageOverflow",
"(",
"int",
"$",
"startPage",
",",
"int",
"$",
"endPage",
",",
"int",
"$",
"nbPages",
")",
":",
"int",
"{",
"return",
"max",
"(",
"$",
"startPage",
"-",
"(",
"$",
"endPage",
"-",
"$",
"nbPage... | Calculates the start page when end page is overflowed. | [
"Calculates",
"the",
"start",
"page",
"when",
"end",
"page",
"is",
"overflowed",
"."
] | 4198c8412ffdb6692b80d35e05c8ba331365b746 | https://github.com/netgen/site-bundle/blob/4198c8412ffdb6692b80d35e05c8ba331365b746/bundle/Pagerfanta/View/SiteView.php#L147-L150 |
28,912 | netgen/site-bundle | bundle/Pagerfanta/View/SiteView.php | SiteView.getPages | protected function getPages(): array
{
$pages = [];
$pages['previous_page'] = $this->pagerfanta->hasPreviousPage() ?
$this->generateUrl($this->pagerfanta->getPreviousPage()) :
false;
$pages['first_page'] = $this->startPage > 1 ? $this->generateUrl(1) : false;
... | php | protected function getPages(): array
{
$pages = [];
$pages['previous_page'] = $this->pagerfanta->hasPreviousPage() ?
$this->generateUrl($this->pagerfanta->getPreviousPage()) :
false;
$pages['first_page'] = $this->startPage > 1 ? $this->generateUrl(1) : false;
... | [
"protected",
"function",
"getPages",
"(",
")",
":",
"array",
"{",
"$",
"pages",
"=",
"[",
"]",
";",
"$",
"pages",
"[",
"'previous_page'",
"]",
"=",
"$",
"this",
"->",
"pagerfanta",
"->",
"hasPreviousPage",
"(",
")",
"?",
"$",
"this",
"->",
"generateUrl... | Returns the list of all pages that need to be displayed. | [
"Returns",
"the",
"list",
"of",
"all",
"pages",
"that",
"need",
"to",
"be",
"displayed",
"."
] | 4198c8412ffdb6692b80d35e05c8ba331365b746 | https://github.com/netgen/site-bundle/blob/4198c8412ffdb6692b80d35e05c8ba331365b746/bundle/Pagerfanta/View/SiteView.php#L155-L196 |
28,913 | netgen/site-bundle | bundle/Pagerfanta/View/SiteView.php | SiteView.generateUrl | protected function generateUrl(int $page): string
{
$routeGenerator = $this->routeGenerator;
// We use trim here because Pagerfanta (or Symfony?) adds an extra '?'
// at the end of page when there are no other query params
return trim($routeGenerator($page), '?');
} | php | protected function generateUrl(int $page): string
{
$routeGenerator = $this->routeGenerator;
// We use trim here because Pagerfanta (or Symfony?) adds an extra '?'
// at the end of page when there are no other query params
return trim($routeGenerator($page), '?');
} | [
"protected",
"function",
"generateUrl",
"(",
"int",
"$",
"page",
")",
":",
"string",
"{",
"$",
"routeGenerator",
"=",
"$",
"this",
"->",
"routeGenerator",
";",
"// We use trim here because Pagerfanta (or Symfony?) adds an extra '?'",
"// at the end of page when there are no o... | Generates the URL based on provided page. | [
"Generates",
"the",
"URL",
"based",
"on",
"provided",
"page",
"."
] | 4198c8412ffdb6692b80d35e05c8ba331365b746 | https://github.com/netgen/site-bundle/blob/4198c8412ffdb6692b80d35e05c8ba331365b746/bundle/Pagerfanta/View/SiteView.php#L201-L208 |
28,914 | netgen/site-bundle | bundle/Controller/DownloadController.php | DownloadController.downloadFile | public function downloadFile(Request $request, $contentId, $fieldId, $isInline = false): BinaryStreamResponse
{
$content = $this->getSite()->getLoadService()->loadContent(
$contentId,
$request->query->get('version'),
$request->query->get('inLanguage')
);
... | php | public function downloadFile(Request $request, $contentId, $fieldId, $isInline = false): BinaryStreamResponse
{
$content = $this->getSite()->getLoadService()->loadContent(
$contentId,
$request->query->get('version'),
$request->query->get('inLanguage')
);
... | [
"public",
"function",
"downloadFile",
"(",
"Request",
"$",
"request",
",",
"$",
"contentId",
",",
"$",
"fieldId",
",",
"$",
"isInline",
"=",
"false",
")",
":",
"BinaryStreamResponse",
"{",
"$",
"content",
"=",
"$",
"this",
"->",
"getSite",
"(",
")",
"->"... | Downloads the binary file specified by content ID and field ID.
Assumes that the file is locally stored
Dispatch \Netgen\Bundle\SiteBundle\Event\SiteEvents::CONTENT_DOWNLOAD only once
@param \Symfony\Component\HttpFoundation\Request $request
@param mixed $contentId
@param mixed $fieldId
@param bool $isInline
@throw... | [
"Downloads",
"the",
"binary",
"file",
"specified",
"by",
"content",
"ID",
"and",
"field",
"ID",
"."
] | 4198c8412ffdb6692b80d35e05c8ba331365b746 | https://github.com/netgen/site-bundle/blob/4198c8412ffdb6692b80d35e05c8ba331365b746/bundle/Controller/DownloadController.php#L69-L117 |
28,915 | smartboxgroup/integration-framework-bundle | Components/WebService/Soap/AbstractSoapConfigurableProducer.php | AbstractSoapConfigurableProducer.throwRecoverableSoapFaultException | protected function throwRecoverableSoapFaultException($message, $code = 0, $previousException = null)
{
/* @var \SoapClient $soapClient */
$exception = new RecoverableSoapException(
$message,
null,
null,
null,
null,
$code,
... | php | protected function throwRecoverableSoapFaultException($message, $code = 0, $previousException = null)
{
/* @var \SoapClient $soapClient */
$exception = new RecoverableSoapException(
$message,
null,
null,
null,
null,
$code,
... | [
"protected",
"function",
"throwRecoverableSoapFaultException",
"(",
"$",
"message",
",",
"$",
"code",
"=",
"0",
",",
"$",
"previousException",
"=",
"null",
")",
"{",
"/* @var \\SoapClient $soapClient */",
"$",
"exception",
"=",
"new",
"RecoverableSoapException",
"(",
... | Throw a RecoverableSoapFault when SoapClient construct failed.
@param \SoapClient $soapClient
@param int $code
@param null $previousException
@throws \Smartbox\Integration\FrameworkBundle\Components\WebService\Soap\Exceptions\RecoverableSoapException | [
"Throw",
"a",
"RecoverableSoapFault",
"when",
"SoapClient",
"construct",
"failed",
"."
] | 5f0bf8ff86337a51f6d208bd38df39017643b905 | https://github.com/smartboxgroup/integration-framework-bundle/blob/5f0bf8ff86337a51f6d208bd38df39017643b905/Components/WebService/Soap/AbstractSoapConfigurableProducer.php#L230-L246 |
28,916 | netgen/site-bundle | bundle/Controller/SearchController.php | SearchController.search | public function search(Request $request): Response
{
$configResolver = $this->getConfigResolver();
$queryType = $this->getQueryTypeRegistry()->getQueryType('NetgenSite:Search');
$searchText = trim($request->query->get('searchText', ''));
if (empty($searchText)) {
return... | php | public function search(Request $request): Response
{
$configResolver = $this->getConfigResolver();
$queryType = $this->getQueryTypeRegistry()->getQueryType('NetgenSite:Search');
$searchText = trim($request->query->get('searchText', ''));
if (empty($searchText)) {
return... | [
"public",
"function",
"search",
"(",
"Request",
"$",
"request",
")",
":",
"Response",
"{",
"$",
"configResolver",
"=",
"$",
"this",
"->",
"getConfigResolver",
"(",
")",
";",
"$",
"queryType",
"=",
"$",
"this",
"->",
"getQueryTypeRegistry",
"(",
")",
"->",
... | Action for displaying the results of full text search. | [
"Action",
"for",
"displaying",
"the",
"results",
"of",
"full",
"text",
"search",
"."
] | 4198c8412ffdb6692b80d35e05c8ba331365b746 | https://github.com/netgen/site-bundle/blob/4198c8412ffdb6692b80d35e05c8ba331365b746/bundle/Controller/SearchController.php#L17-L54 |
28,917 | nilportugues/php-api-transformer | src/Transformer/Transformer.php | Transformer.recursiveSetKeysToUnderScore | protected function recursiveSetKeysToUnderScore(array &$array)
{
$newArray = [];
foreach ($array as $key => &$value) {
$underscoreKey = RecursiveFormatterHelper::camelCaseToUnderscore($key);
$newArray[$underscoreKey] = $value;
if (\is_array($value)) {
... | php | protected function recursiveSetKeysToUnderScore(array &$array)
{
$newArray = [];
foreach ($array as $key => &$value) {
$underscoreKey = RecursiveFormatterHelper::camelCaseToUnderscore($key);
$newArray[$underscoreKey] = $value;
if (\is_array($value)) {
... | [
"protected",
"function",
"recursiveSetKeysToUnderScore",
"(",
"array",
"&",
"$",
"array",
")",
"{",
"$",
"newArray",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"array",
"as",
"$",
"key",
"=>",
"&",
"$",
"value",
")",
"{",
"$",
"underscoreKey",
"=",
"Recu... | Changes all array keys to under_score format using recursion.
@param array $array | [
"Changes",
"all",
"array",
"keys",
"to",
"under_score",
"format",
"using",
"recursion",
"."
] | a9f20fbe1580d98e3d462a0ebe13fb7595cbd683 | https://github.com/nilportugues/php-api-transformer/blob/a9f20fbe1580d98e3d462a0ebe13fb7595cbd683/src/Transformer/Transformer.php#L125-L137 |
28,918 | smartboxgroup/integration-framework-bundle | Core/Processors/Routing/ContentRouter.php | ContentRouter.doProcess | protected function doProcess(Exchange $exchange, SerializableArray $processingContext)
{
$evaluator = $this->getEvaluator();
foreach ($this->clauses as $clause) {
if ($evaluator->evaluateWithExchange($clause->getCondition(), $exchange)) {
$exchange->getItinerary()->prepe... | php | protected function doProcess(Exchange $exchange, SerializableArray $processingContext)
{
$evaluator = $this->getEvaluator();
foreach ($this->clauses as $clause) {
if ($evaluator->evaluateWithExchange($clause->getCondition(), $exchange)) {
$exchange->getItinerary()->prepe... | [
"protected",
"function",
"doProcess",
"(",
"Exchange",
"$",
"exchange",
",",
"SerializableArray",
"$",
"processingContext",
")",
"{",
"$",
"evaluator",
"=",
"$",
"this",
"->",
"getEvaluator",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"clauses",
"as",... | The content router will evaluate the list of when clauses for the given exchange until one of them returns true,
then the itinerary of the exchange will be updated with the one specified for the when clause.
In case that no when clause matches, if there is a fallbackItinerary defined, the exchange will be updated with... | [
"The",
"content",
"router",
"will",
"evaluate",
"the",
"list",
"of",
"when",
"clauses",
"for",
"the",
"given",
"exchange",
"until",
"one",
"of",
"them",
"returns",
"true",
"then",
"the",
"itinerary",
"of",
"the",
"exchange",
"will",
"be",
"updated",
"with",
... | 5f0bf8ff86337a51f6d208bd38df39017643b905 | https://github.com/smartboxgroup/integration-framework-bundle/blob/5f0bf8ff86337a51f6d208bd38df39017643b905/Core/Processors/Routing/ContentRouter.php#L63-L84 |
28,919 | Atnic/laravel-generator | app/Filters/BaseFilter.php | BaseFilter.getFilters | protected function getFilters()
{
$filters = array_diff(get_class_methods($this), [
'__construct', '__call', 'apply', 'getFilters', 'getSearchables', 'getSortables', 'buildSearch', 'buildSql'
]);
$filters = array_merge($filters, array_map(function ($searchable, $key) {
... | php | protected function getFilters()
{
$filters = array_diff(get_class_methods($this), [
'__construct', '__call', 'apply', 'getFilters', 'getSearchables', 'getSortables', 'buildSearch', 'buildSql'
]);
$filters = array_merge($filters, array_map(function ($searchable, $key) {
... | [
"protected",
"function",
"getFilters",
"(",
")",
"{",
"$",
"filters",
"=",
"array_diff",
"(",
"get_class_methods",
"(",
"$",
"this",
")",
",",
"[",
"'__construct'",
",",
"'__call'",
",",
"'apply'",
",",
"'getFilters'",
",",
"'getSearchables'",
",",
"'getSortab... | Fetch all relevant filters from the request.
@return array | [
"Fetch",
"all",
"relevant",
"filters",
"from",
"the",
"request",
"."
] | 7bf53837a61af566b389255784dbbf1789020018 | https://github.com/Atnic/laravel-generator/blob/7bf53837a61af566b389255784dbbf1789020018/app/Filters/BaseFilter.php#L63-L73 |
28,920 | Atnic/laravel-generator | app/Filters/BaseFilter.php | BaseFilter.buildSearch | protected function buildSearch($query, $searchables, $value)
{
foreach ($searchables as $key => $searchable) {
if (is_array($searchable)) {
$query->orWhereHas($key, function (Builder $query) use($searchable, $value) {
$query->where(function (Builder $query) us... | php | protected function buildSearch($query, $searchables, $value)
{
foreach ($searchables as $key => $searchable) {
if (is_array($searchable)) {
$query->orWhereHas($key, function (Builder $query) use($searchable, $value) {
$query->where(function (Builder $query) us... | [
"protected",
"function",
"buildSearch",
"(",
"$",
"query",
",",
"$",
"searchables",
",",
"$",
"value",
")",
"{",
"foreach",
"(",
"$",
"searchables",
"as",
"$",
"key",
"=>",
"$",
"searchable",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"searchable",
")"... | Recursive Build Search
@param \Illuminate\Database\Eloquent\Builder $query
@param array|string $searchables
@param string $value | [
"Recursive",
"Build",
"Search"
] | 7bf53837a61af566b389255784dbbf1789020018 | https://github.com/Atnic/laravel-generator/blob/7bf53837a61af566b389255784dbbf1789020018/app/Filters/BaseFilter.php#L112-L128 |
28,921 | Atnic/laravel-generator | app/Filters/BaseFilter.php | BaseFilter.per_page | public function per_page($value)
{
$validator = validator([ 'value' => $value ], [ 'value' => 'numeric|min:1|max:1000' ]);
return $this->builder->when(!$validator->fails(), function (Builder $query) use($value) {
$model = $query->getModel();
$model->setPerPage($value);
... | php | public function per_page($value)
{
$validator = validator([ 'value' => $value ], [ 'value' => 'numeric|min:1|max:1000' ]);
return $this->builder->when(!$validator->fails(), function (Builder $query) use($value) {
$model = $query->getModel();
$model->setPerPage($value);
... | [
"public",
"function",
"per_page",
"(",
"$",
"value",
")",
"{",
"$",
"validator",
"=",
"validator",
"(",
"[",
"'value'",
"=>",
"$",
"value",
"]",
",",
"[",
"'value'",
"=>",
"'numeric|min:1|max:1000'",
"]",
")",
";",
"return",
"$",
"this",
"->",
"builder",... | Total per page on pagination
@param int $value
@return \Illuminate\Database\Eloquent\Builder | [
"Total",
"per",
"page",
"on",
"pagination"
] | 7bf53837a61af566b389255784dbbf1789020018 | https://github.com/Atnic/laravel-generator/blob/7bf53837a61af566b389255784dbbf1789020018/app/Filters/BaseFilter.php#L212-L220 |
28,922 | Atnic/laravel-generator | app/Filters/BaseFilter.php | BaseFilter.keys | public function keys($values)
{
$keys = explode(',', $values);
$model = $this->builder->getModel();
$validator = validator([ 'values' => $keys ], [ 'values.*' => 'exists:'.$model->getTable().','.$model->getKeyName() ]);
return $this->builder->when(!$validator->fails(), function (Buil... | php | public function keys($values)
{
$keys = explode(',', $values);
$model = $this->builder->getModel();
$validator = validator([ 'values' => $keys ], [ 'values.*' => 'exists:'.$model->getTable().','.$model->getKeyName() ]);
return $this->builder->when(!$validator->fails(), function (Buil... | [
"public",
"function",
"keys",
"(",
"$",
"values",
")",
"{",
"$",
"keys",
"=",
"explode",
"(",
"','",
",",
"$",
"values",
")",
";",
"$",
"model",
"=",
"$",
"this",
"->",
"builder",
"->",
"getModel",
"(",
")",
";",
"$",
"validator",
"=",
"validator",... | Get collection of resources by keys
@param string $values
@return \Illuminate\Database\Eloquent\Builder | [
"Get",
"collection",
"of",
"resources",
"by",
"keys"
] | 7bf53837a61af566b389255784dbbf1789020018 | https://github.com/Atnic/laravel-generator/blob/7bf53837a61af566b389255784dbbf1789020018/app/Filters/BaseFilter.php#L227-L235 |
28,923 | Atnic/laravel-generator | app/Filters/BaseFilter.php | BaseFilter.has | public function has($values)
{
$hases = explode(',', $values);
$model = $this->builder->getModel();
$hases = collect($hases)->filter(function ($has) use($model) {
if (str_contains($has, '.')) return ($model->{explode('.', $has)[0]}() instanceof Relation);
return ($mod... | php | public function has($values)
{
$hases = explode(',', $values);
$model = $this->builder->getModel();
$hases = collect($hases)->filter(function ($has) use($model) {
if (str_contains($has, '.')) return ($model->{explode('.', $has)[0]}() instanceof Relation);
return ($mod... | [
"public",
"function",
"has",
"(",
"$",
"values",
")",
"{",
"$",
"hases",
"=",
"explode",
"(",
"','",
",",
"$",
"values",
")",
";",
"$",
"model",
"=",
"$",
"this",
"->",
"builder",
"->",
"getModel",
"(",
")",
";",
"$",
"hases",
"=",
"collect",
"("... | Get collection of resources by has relation
@param string $values
@return \Illuminate\Database\Eloquent\Builder | [
"Get",
"collection",
"of",
"resources",
"by",
"has",
"relation"
] | 7bf53837a61af566b389255784dbbf1789020018 | https://github.com/Atnic/laravel-generator/blob/7bf53837a61af566b389255784dbbf1789020018/app/Filters/BaseFilter.php#L314-L328 |
28,924 | Atnic/laravel-generator | app/Filters/BaseFilter.php | BaseFilter.doesnt_have | public function doesnt_have($values)
{
$doesnt_haves = explode(',', $values);
$model = $this->builder->getModel();
$doesnt_haves = collect($doesnt_haves)->filter(function ($doesnt_have) use($model) {
if (str_contains($doesnt_have, '.')) return ($model->{explode('.', $doesnt_have)... | php | public function doesnt_have($values)
{
$doesnt_haves = explode(',', $values);
$model = $this->builder->getModel();
$doesnt_haves = collect($doesnt_haves)->filter(function ($doesnt_have) use($model) {
if (str_contains($doesnt_have, '.')) return ($model->{explode('.', $doesnt_have)... | [
"public",
"function",
"doesnt_have",
"(",
"$",
"values",
")",
"{",
"$",
"doesnt_haves",
"=",
"explode",
"(",
"','",
",",
"$",
"values",
")",
";",
"$",
"model",
"=",
"$",
"this",
"->",
"builder",
"->",
"getModel",
"(",
")",
";",
"$",
"doesnt_haves",
"... | Get collection of resources by doesnt_have relation
@param string $values
@return \Illuminate\Database\Eloquent\Builder | [
"Get",
"collection",
"of",
"resources",
"by",
"doesnt_have",
"relation"
] | 7bf53837a61af566b389255784dbbf1789020018 | https://github.com/Atnic/laravel-generator/blob/7bf53837a61af566b389255784dbbf1789020018/app/Filters/BaseFilter.php#L336-L350 |
28,925 | Islandora-CLAW/chullo | src/FedoraApi.php | FedoraApi.getResource | public function getResource(
$uri = "",
$headers = []
) {
// Set headers
$options = ['http_errors' => false, 'headers' => $headers];
// Send the request.
return $this->client->request(
'GET',
$uri,
$options
);
} | php | public function getResource(
$uri = "",
$headers = []
) {
// Set headers
$options = ['http_errors' => false, 'headers' => $headers];
// Send the request.
return $this->client->request(
'GET',
$uri,
$options
);
} | [
"public",
"function",
"getResource",
"(",
"$",
"uri",
"=",
"\"\"",
",",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"// Set headers",
"$",
"options",
"=",
"[",
"'http_errors'",
"=>",
"false",
",",
"'headers'",
"=>",
"$",
"headers",
"]",
";",
"// Send the re... | Gets a Fedora resource.
@param string $uri Resource URI
@param array $headers HTTP Headers
@return ResponseInterface | [
"Gets",
"a",
"Fedora",
"resource",
"."
] | fc60e9c271c4f83290b3a98ad46825a7e418d51e | https://github.com/Islandora-CLAW/chullo/blob/fc60e9c271c4f83290b3a98ad46825a7e418d51e/src/FedoraApi.php#L70-L83 |
28,926 | Islandora-CLAW/chullo | src/FedoraApi.php | FedoraApi.createResource | public function createResource(
$uri = "",
$content = null,
$headers = []
) {
$options = ['http_errors' => false];
// Set content.
$options['body'] = $content;
// Set headers.
$options['headers'] = $headers;
return $this->client->request(
... | php | public function createResource(
$uri = "",
$content = null,
$headers = []
) {
$options = ['http_errors' => false];
// Set content.
$options['body'] = $content;
// Set headers.
$options['headers'] = $headers;
return $this->client->request(
... | [
"public",
"function",
"createResource",
"(",
"$",
"uri",
"=",
"\"\"",
",",
"$",
"content",
"=",
"null",
",",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"=",
"[",
"'http_errors'",
"=>",
"false",
"]",
";",
"// Set content.",
"$",
"options",... | Creates a new resource in Fedora.
@param string $uri Resource URI
@param string $content String or binary content
@param array $headers HTTP Headers
@return ResponseInterface | [
"Creates",
"a",
"new",
"resource",
"in",
"Fedora",
"."
] | fc60e9c271c4f83290b3a98ad46825a7e418d51e | https://github.com/Islandora-CLAW/chullo/blob/fc60e9c271c4f83290b3a98ad46825a7e418d51e/src/FedoraApi.php#L134-L152 |
28,927 | Islandora-CLAW/chullo | src/FedoraApi.php | FedoraApi.modifyResource | public function modifyResource(
$uri,
$sparql = "",
$headers = []
) {
$options = ['http_errors' => false];
// Set content.
$options['body'] = $sparql;
// Set headers.
$options['headers'] = $headers;
$options['headers']['content-type'] = 'appl... | php | public function modifyResource(
$uri,
$sparql = "",
$headers = []
) {
$options = ['http_errors' => false];
// Set content.
$options['body'] = $sparql;
// Set headers.
$options['headers'] = $headers;
$options['headers']['content-type'] = 'appl... | [
"public",
"function",
"modifyResource",
"(",
"$",
"uri",
",",
"$",
"sparql",
"=",
"\"\"",
",",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"=",
"[",
"'http_errors'",
"=>",
"false",
"]",
";",
"// Set content.",
"$",
"options",
"[",
"'body'"... | Modifies a resource using a SPARQL Update query.
@param string $uri Resource URI
@param string $sparql SPARQL Update query
@param array $headers HTTP Headers
@return ResponseInterface | [
"Modifies",
"a",
"resource",
"using",
"a",
"SPARQL",
"Update",
"query",
"."
] | fc60e9c271c4f83290b3a98ad46825a7e418d51e | https://github.com/Islandora-CLAW/chullo/blob/fc60e9c271c4f83290b3a98ad46825a7e418d51e/src/FedoraApi.php#L192-L211 |
28,928 | Islandora-CLAW/chullo | src/FedoraApi.php | FedoraApi.deleteResource | public function deleteResource(
$uri = '',
$headers = []
) {
$options = ['http_errors' => false, 'headers' => $headers];
return $this->client->request(
'DELETE',
$uri,
$options
);
} | php | public function deleteResource(
$uri = '',
$headers = []
) {
$options = ['http_errors' => false, 'headers' => $headers];
return $this->client->request(
'DELETE',
$uri,
$options
);
} | [
"public",
"function",
"deleteResource",
"(",
"$",
"uri",
"=",
"''",
",",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"=",
"[",
"'http_errors'",
"=>",
"false",
",",
"'headers'",
"=>",
"$",
"headers",
"]",
";",
"return",
"$",
"this",
"->",... | Issues a DELETE request to Fedora.
@param string $uri Resource URI
@param array $headers HTTP Headers
@return ResponseInterface | [
"Issues",
"a",
"DELETE",
"request",
"to",
"Fedora",
"."
] | fc60e9c271c4f83290b3a98ad46825a7e418d51e | https://github.com/Islandora-CLAW/chullo/blob/fc60e9c271c4f83290b3a98ad46825a7e418d51e/src/FedoraApi.php#L221-L232 |
28,929 | Islandora-CLAW/chullo | src/FedoraApi.php | FedoraApi.saveGraph | public function saveGraph(
\EasyRdf_Graph $graph,
$uri = '',
$headers = []
) {
// Serialze the rdf.
$turtle = $graph->serialise('turtle');
// Checksum it.
$checksum_value = sha1($turtle);
// Set headers.
$headers['Content-Type'] = 'text/turtl... | php | public function saveGraph(
\EasyRdf_Graph $graph,
$uri = '',
$headers = []
) {
// Serialze the rdf.
$turtle = $graph->serialise('turtle');
// Checksum it.
$checksum_value = sha1($turtle);
// Set headers.
$headers['Content-Type'] = 'text/turtl... | [
"public",
"function",
"saveGraph",
"(",
"\\",
"EasyRdf_Graph",
"$",
"graph",
",",
"$",
"uri",
"=",
"''",
",",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"// Serialze the rdf.",
"$",
"turtle",
"=",
"$",
"graph",
"->",
"serialise",
"(",
"'turtle'",
")",
";... | Saves RDF in Fedora.
@param EasyRdf_Resource $graph Graph to save
@param string $uri Resource URI
@param array $headers HTTP Headers
@return ResponseInterface | [
"Saves",
"RDF",
"in",
"Fedora",
"."
] | fc60e9c271c4f83290b3a98ad46825a7e418d51e | https://github.com/Islandora-CLAW/chullo/blob/fc60e9c271c4f83290b3a98ad46825a7e418d51e/src/FedoraApi.php#L243-L260 |
28,930 | Islandora-CLAW/chullo | src/FedoraApi.php | FedoraApi.createGraph | public function createGraph(
\EasyRdf_Graph $graph,
$uri = '',
$headers = []
) {
// Serialze the rdf.
$turtle = $graph->serialise('turtle');
// Checksum it.
$checksum_value = sha1($turtle);
// Set headers.
$headers['Content-Type'] = 'text/tur... | php | public function createGraph(
\EasyRdf_Graph $graph,
$uri = '',
$headers = []
) {
// Serialze the rdf.
$turtle = $graph->serialise('turtle');
// Checksum it.
$checksum_value = sha1($turtle);
// Set headers.
$headers['Content-Type'] = 'text/tur... | [
"public",
"function",
"createGraph",
"(",
"\\",
"EasyRdf_Graph",
"$",
"graph",
",",
"$",
"uri",
"=",
"''",
",",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"// Serialze the rdf.",
"$",
"turtle",
"=",
"$",
"graph",
"->",
"serialise",
"(",
"'turtle'",
")",
... | Creates RDF in Fedora.
@param EasyRdf_Resource $graph Graph to save
@param string $uri Resource URI
@param array $headers HTTP Headers
@return ResponseInterface | [
"Creates",
"RDF",
"in",
"Fedora",
"."
] | fc60e9c271c4f83290b3a98ad46825a7e418d51e | https://github.com/Islandora-CLAW/chullo/blob/fc60e9c271c4f83290b3a98ad46825a7e418d51e/src/FedoraApi.php#L271-L288 |
28,931 | Islandora-CLAW/chullo | src/FedoraApi.php | FedoraApi.getGraph | public function getGraph(ResponseInterface $response)
{
// Extract rdf as response body and return Easy_RDF Graph object.
$rdf = $response->getBody()->getContents();
$graph = new \EasyRdf_Graph();
if (!empty($rdf)) {
$graph->parse($rdf, 'jsonld');
}
return... | php | public function getGraph(ResponseInterface $response)
{
// Extract rdf as response body and return Easy_RDF Graph object.
$rdf = $response->getBody()->getContents();
$graph = new \EasyRdf_Graph();
if (!empty($rdf)) {
$graph->parse($rdf, 'jsonld');
}
return... | [
"public",
"function",
"getGraph",
"(",
"ResponseInterface",
"$",
"response",
")",
"{",
"// Extract rdf as response body and return Easy_RDF Graph object.",
"$",
"rdf",
"=",
"$",
"response",
"->",
"getBody",
"(",
")",
"->",
"getContents",
"(",
")",
";",
"$",
"graph",... | Gets RDF in Fedora.
@param ResponseInterface $request Response received
@return \EasyRdf_Graph | [
"Gets",
"RDF",
"in",
"Fedora",
"."
] | fc60e9c271c4f83290b3a98ad46825a7e418d51e | https://github.com/Islandora-CLAW/chullo/blob/fc60e9c271c4f83290b3a98ad46825a7e418d51e/src/FedoraApi.php#L298-L307 |
28,932 | netgen/site-bundle | bundle/Composer/ScriptHandler.php | ScriptHandler.installProjectSymlinks | public static function installProjectSymlinks(Event $event): void
{
$options = self::getOptions($event);
$consoleDir = static::getConsoleDir($event, 'install project symlinks');
static::executeCommand($event, $consoleDir, 'ngsite:symlink:project', $options['process-timeout']);
} | php | public static function installProjectSymlinks(Event $event): void
{
$options = self::getOptions($event);
$consoleDir = static::getConsoleDir($event, 'install project symlinks');
static::executeCommand($event, $consoleDir, 'ngsite:symlink:project', $options['process-timeout']);
} | [
"public",
"static",
"function",
"installProjectSymlinks",
"(",
"Event",
"$",
"event",
")",
":",
"void",
"{",
"$",
"options",
"=",
"self",
"::",
"getOptions",
"(",
"$",
"event",
")",
";",
"$",
"consoleDir",
"=",
"static",
"::",
"getConsoleDir",
"(",
"$",
... | Symlinks various project files and folders to their proper locations. | [
"Symlinks",
"various",
"project",
"files",
"and",
"folders",
"to",
"their",
"proper",
"locations",
"."
] | 4198c8412ffdb6692b80d35e05c8ba331365b746 | https://github.com/netgen/site-bundle/blob/4198c8412ffdb6692b80d35e05c8ba331365b746/bundle/Composer/ScriptHandler.php#L15-L21 |
28,933 | smartboxgroup/integration-framework-bundle | Tools/Evaluator/ApcuParserCache.php | ApcuParserCache.fetch | public function fetch($key)
{
if(extension_loaded('apcu') && function_exists('apcu_fetch')) {
$cached = apcu_fetch($key);
if (!$cached) {
return null;
}
return $cached;
}else{
return null;
}
} | php | public function fetch($key)
{
if(extension_loaded('apcu') && function_exists('apcu_fetch')) {
$cached = apcu_fetch($key);
if (!$cached) {
return null;
}
return $cached;
}else{
return null;
}
} | [
"public",
"function",
"fetch",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"extension_loaded",
"(",
"'apcu'",
")",
"&&",
"function_exists",
"(",
"'apcu_fetch'",
")",
")",
"{",
"$",
"cached",
"=",
"apcu_fetch",
"(",
"$",
"key",
")",
";",
"if",
"(",
"!",
"$"... | Fetches an expression from the cache.
@param string $key The cache key
@return ParsedExpression|null | [
"Fetches",
"an",
"expression",
"from",
"the",
"cache",
"."
] | 5f0bf8ff86337a51f6d208bd38df39017643b905 | https://github.com/smartboxgroup/integration-framework-bundle/blob/5f0bf8ff86337a51f6d208bd38df39017643b905/Tools/Evaluator/ApcuParserCache.php#L31-L44 |
28,934 | spiral/tokenizer | src/Tokenizer.php | Tokenizer.getTokens | public static function getTokens(string $filename): array
{
$tokens = token_get_all(file_get_contents($filename));
$line = 0;
foreach ($tokens as &$token) {
if (isset($token[self::LINE])) {
$line = $token[self::LINE];
}
if (!is_array($tok... | php | public static function getTokens(string $filename): array
{
$tokens = token_get_all(file_get_contents($filename));
$line = 0;
foreach ($tokens as &$token) {
if (isset($token[self::LINE])) {
$line = $token[self::LINE];
}
if (!is_array($tok... | [
"public",
"static",
"function",
"getTokens",
"(",
"string",
"$",
"filename",
")",
":",
"array",
"{",
"$",
"tokens",
"=",
"token_get_all",
"(",
"file_get_contents",
"(",
"$",
"filename",
")",
")",
";",
"$",
"line",
"=",
"0",
";",
"foreach",
"(",
"$",
"t... | Get all tokes for specific file.
@param string $filename
@return array | [
"Get",
"all",
"tokes",
"for",
"specific",
"file",
"."
] | aca11410e183d4c4a6c0f858ba87bf072c4eb925 | https://github.com/spiral/tokenizer/blob/aca11410e183d4c4a6c0f858ba87bf072c4eb925/src/Tokenizer.php#L92-L110 |
28,935 | spiral/tokenizer | src/Reflection/ReflectionFile.php | ReflectionFile.importSchema | protected function importSchema(array $cache)
{
list($this->hasIncludes, $this->declarations, $this->functions, $this->namespaces) = $cache;
} | php | protected function importSchema(array $cache)
{
list($this->hasIncludes, $this->declarations, $this->functions, $this->namespaces) = $cache;
} | [
"protected",
"function",
"importSchema",
"(",
"array",
"$",
"cache",
")",
"{",
"list",
"(",
"$",
"this",
"->",
"hasIncludes",
",",
"$",
"this",
"->",
"declarations",
",",
"$",
"this",
"->",
"functions",
",",
"$",
"this",
"->",
"namespaces",
")",
"=",
"... | Import cached reflection schema.
@param array $cache | [
"Import",
"cached",
"reflection",
"schema",
"."
] | aca11410e183d4c4a6c0f858ba87bf072c4eb925 | https://github.com/spiral/tokenizer/blob/aca11410e183d4c4a6c0f858ba87bf072c4eb925/src/Reflection/ReflectionFile.php#L254-L257 |
28,936 | spiral/tokenizer | src/Reflection/ReflectionFile.php | ReflectionFile.locateDeclarations | protected function locateDeclarations()
{
foreach ($this->getTokens() as $tokenID => $token) {
if (!in_array($token[self::TOKEN_TYPE], self::$processTokens)) {
continue;
}
switch ($token[self::TOKEN_TYPE]) {
case T_NAMESPACE:
... | php | protected function locateDeclarations()
{
foreach ($this->getTokens() as $tokenID => $token) {
if (!in_array($token[self::TOKEN_TYPE], self::$processTokens)) {
continue;
}
switch ($token[self::TOKEN_TYPE]) {
case T_NAMESPACE:
... | [
"protected",
"function",
"locateDeclarations",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getTokens",
"(",
")",
"as",
"$",
"tokenID",
"=>",
"$",
"token",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"token",
"[",
"self",
"::",
"TOKEN_TYPE",
... | Locate every class, interface, trait or function definition. | [
"Locate",
"every",
"class",
"interface",
"trait",
"or",
"function",
"definition",
"."
] | aca11410e183d4c4a6c0f858ba87bf072c4eb925 | https://github.com/spiral/tokenizer/blob/aca11410e183d4c4a6c0f858ba87bf072c4eb925/src/Reflection/ReflectionFile.php#L262-L306 |
28,937 | spiral/tokenizer | src/Reflection/ReflectionFile.php | ReflectionFile.registerNamespace | private function registerNamespace(int $tokenID)
{
$namespace = '';
$localID = $tokenID + 1;
do {
$token = $this->tokens[$localID++];
if ($token[self::TOKEN_CODE] == '{') {
break;
}
$namespace .= $token[self::TOKEN_CODE];
... | php | private function registerNamespace(int $tokenID)
{
$namespace = '';
$localID = $tokenID + 1;
do {
$token = $this->tokens[$localID++];
if ($token[self::TOKEN_CODE] == '{') {
break;
}
$namespace .= $token[self::TOKEN_CODE];
... | [
"private",
"function",
"registerNamespace",
"(",
"int",
"$",
"tokenID",
")",
"{",
"$",
"namespace",
"=",
"''",
";",
"$",
"localID",
"=",
"$",
"tokenID",
"+",
"1",
";",
"do",
"{",
"$",
"token",
"=",
"$",
"this",
"->",
"tokens",
"[",
"$",
"localID",
... | Handle namespace declaration.
@param int $tokenID | [
"Handle",
"namespace",
"declaration",
"."
] | aca11410e183d4c4a6c0f858ba87bf072c4eb925 | https://github.com/spiral/tokenizer/blob/aca11410e183d4c4a6c0f858ba87bf072c4eb925/src/Reflection/ReflectionFile.php#L313-L350 |
28,938 | spiral/tokenizer | src/Reflection/ReflectionFile.php | ReflectionFile.registerDeclaration | private function registerDeclaration(int $tokenID, int $tokenType)
{
$localID = $tokenID + 1;
while ($this->tokens[$localID][self::TOKEN_TYPE] != T_STRING) {
++$localID;
}
$name = $this->tokens[$localID][self::TOKEN_CODE];
if (!empty($namespace = $this->activeNam... | php | private function registerDeclaration(int $tokenID, int $tokenType)
{
$localID = $tokenID + 1;
while ($this->tokens[$localID][self::TOKEN_TYPE] != T_STRING) {
++$localID;
}
$name = $this->tokens[$localID][self::TOKEN_CODE];
if (!empty($namespace = $this->activeNam... | [
"private",
"function",
"registerDeclaration",
"(",
"int",
"$",
"tokenID",
",",
"int",
"$",
"tokenType",
")",
"{",
"$",
"localID",
"=",
"$",
"tokenID",
"+",
"1",
";",
"while",
"(",
"$",
"this",
"->",
"tokens",
"[",
"$",
"localID",
"]",
"[",
"self",
":... | Handle declaration of class, trait of interface. Declaration will be stored under it's token
type in declarations array.
@param int $tokenID
@param int $tokenType | [
"Handle",
"declaration",
"of",
"class",
"trait",
"of",
"interface",
".",
"Declaration",
"will",
"be",
"stored",
"under",
"it",
"s",
"token",
"type",
"in",
"declarations",
"array",
"."
] | aca11410e183d4c4a6c0f858ba87bf072c4eb925 | https://github.com/spiral/tokenizer/blob/aca11410e183d4c4a6c0f858ba87bf072c4eb925/src/Reflection/ReflectionFile.php#L424-L440 |
28,939 | spiral/tokenizer | src/Reflection/ReflectionFile.php | ReflectionFile.registerInvocation | private function registerInvocation(
int $invocationID,
int $argumentsID,
int $endID,
array $arguments,
int $invocationLevel
) {
//Nested invocations
$this->locateInvocations($arguments, $invocationLevel + 1);
list($class, $operator, $name) = $this->f... | php | private function registerInvocation(
int $invocationID,
int $argumentsID,
int $endID,
array $arguments,
int $invocationLevel
) {
//Nested invocations
$this->locateInvocations($arguments, $invocationLevel + 1);
list($class, $operator, $name) = $this->f... | [
"private",
"function",
"registerInvocation",
"(",
"int",
"$",
"invocationID",
",",
"int",
"$",
"argumentsID",
",",
"int",
"$",
"endID",
",",
"array",
"$",
"arguments",
",",
"int",
"$",
"invocationLevel",
")",
"{",
"//Nested invocations",
"$",
"this",
"->",
"... | Registering invocation.
@param int $invocationID
@param int $argumentsID
@param int $endID
@param array $arguments
@param int $invocationLevel | [
"Registering",
"invocation",
"."
] | aca11410e183d4c4a6c0f858ba87bf072c4eb925 | https://github.com/spiral/tokenizer/blob/aca11410e183d4c4a6c0f858ba87bf072c4eb925/src/Reflection/ReflectionFile.php#L591-L618 |
28,940 | spiral/tokenizer | src/Reflection/ReflectionFile.php | ReflectionFile.fetchContext | private function fetchContext(int $invocationTID, int $argumentsTID): array
{
$class = $operator = '';
$name = trim($this->getSource($invocationTID, $argumentsTID), '( ');
//Let's try to fetch all information we need
if (strpos($name, '->') !== false) {
$operator = '->';... | php | private function fetchContext(int $invocationTID, int $argumentsTID): array
{
$class = $operator = '';
$name = trim($this->getSource($invocationTID, $argumentsTID), '( ');
//Let's try to fetch all information we need
if (strpos($name, '->') !== false) {
$operator = '->';... | [
"private",
"function",
"fetchContext",
"(",
"int",
"$",
"invocationTID",
",",
"int",
"$",
"argumentsTID",
")",
":",
"array",
"{",
"$",
"class",
"=",
"$",
"operator",
"=",
"''",
";",
"$",
"name",
"=",
"trim",
"(",
"$",
"this",
"->",
"getSource",
"(",
... | Fetching invocation context.
@param int $invocationTID
@param int $argumentsTID
@return array | [
"Fetching",
"invocation",
"context",
"."
] | aca11410e183d4c4a6c0f858ba87bf072c4eb925 | https://github.com/spiral/tokenizer/blob/aca11410e183d4c4a6c0f858ba87bf072c4eb925/src/Reflection/ReflectionFile.php#L628-L650 |
28,941 | spiral/tokenizer | src/Reflection/ReflectionFile.php | ReflectionFile.activeDeclaration | private function activeDeclaration(int $tokenID): string
{
foreach ($this->declarations as $declarations) {
foreach ($declarations as $name => $position) {
if ($tokenID >= $position[self::O_TOKEN] && $tokenID <= $position[self::C_TOKEN]) {
return $name;
... | php | private function activeDeclaration(int $tokenID): string
{
foreach ($this->declarations as $declarations) {
foreach ($declarations as $name => $position) {
if ($tokenID >= $position[self::O_TOKEN] && $tokenID <= $position[self::C_TOKEN]) {
return $name;
... | [
"private",
"function",
"activeDeclaration",
"(",
"int",
"$",
"tokenID",
")",
":",
"string",
"{",
"foreach",
"(",
"$",
"this",
"->",
"declarations",
"as",
"$",
"declarations",
")",
"{",
"foreach",
"(",
"$",
"declarations",
"as",
"$",
"name",
"=>",
"$",
"p... | Get declaration which is active in given token position.
@param int $tokenID
@return string|null | [
"Get",
"declaration",
"which",
"is",
"active",
"in",
"given",
"token",
"position",
"."
] | aca11410e183d4c4a6c0f858ba87bf072c4eb925 | https://github.com/spiral/tokenizer/blob/aca11410e183d4c4a6c0f858ba87bf072c4eb925/src/Reflection/ReflectionFile.php#L659-L671 |
28,942 | spiral/tokenizer | src/Reflection/ReflectionFile.php | ReflectionFile.activeNamespace | private function activeNamespace(int $tokenID): string
{
foreach ($this->namespaces as $namespace => $position) {
if ($tokenID >= $position[self::O_TOKEN] && $tokenID <= $position[self::C_TOKEN]) {
return $namespace;
}
}
//Seems like no namespace decl... | php | private function activeNamespace(int $tokenID): string
{
foreach ($this->namespaces as $namespace => $position) {
if ($tokenID >= $position[self::O_TOKEN] && $tokenID <= $position[self::C_TOKEN]) {
return $namespace;
}
}
//Seems like no namespace decl... | [
"private",
"function",
"activeNamespace",
"(",
"int",
"$",
"tokenID",
")",
":",
"string",
"{",
"foreach",
"(",
"$",
"this",
"->",
"namespaces",
"as",
"$",
"namespace",
"=>",
"$",
"position",
")",
"{",
"if",
"(",
"$",
"tokenID",
">=",
"$",
"position",
"... | Get namespace name active at specified token position.
@param int $tokenID
@return string | [
"Get",
"namespace",
"name",
"active",
"at",
"specified",
"token",
"position",
"."
] | aca11410e183d4c4a6c0f858ba87bf072c4eb925 | https://github.com/spiral/tokenizer/blob/aca11410e183d4c4a6c0f858ba87bf072c4eb925/src/Reflection/ReflectionFile.php#L680-L696 |
28,943 | spiral/tokenizer | src/Reflection/ReflectionFile.php | ReflectionFile.endingToken | private function endingToken(int $tokenID): int
{
$level = null;
for ($localID = $tokenID; $localID < $this->countTokens; ++$localID) {
$token = $this->tokens[$localID];
if ($token[self::TOKEN_CODE] == '{') {
++$level;
continue;
}
... | php | private function endingToken(int $tokenID): int
{
$level = null;
for ($localID = $tokenID; $localID < $this->countTokens; ++$localID) {
$token = $this->tokens[$localID];
if ($token[self::TOKEN_CODE] == '{') {
++$level;
continue;
}
... | [
"private",
"function",
"endingToken",
"(",
"int",
"$",
"tokenID",
")",
":",
"int",
"{",
"$",
"level",
"=",
"null",
";",
"for",
"(",
"$",
"localID",
"=",
"$",
"tokenID",
";",
"$",
"localID",
"<",
"$",
"this",
"->",
"countTokens",
";",
"++",
"$",
"lo... | Find token ID of ending brace.
@param int $tokenID
@return int | [
"Find",
"token",
"ID",
"of",
"ending",
"brace",
"."
] | aca11410e183d4c4a6c0f858ba87bf072c4eb925 | https://github.com/spiral/tokenizer/blob/aca11410e183d4c4a6c0f858ba87bf072c4eb925/src/Reflection/ReflectionFile.php#L705-L725 |
28,944 | spiral/tokenizer | src/Reflection/ReflectionFile.php | ReflectionFile.lineNumber | private function lineNumber(int $tokenID): int
{
while (empty($this->tokens[$tokenID][self::TOKEN_LINE])) {
--$tokenID;
}
return $this->tokens[$tokenID][self::TOKEN_LINE];
} | php | private function lineNumber(int $tokenID): int
{
while (empty($this->tokens[$tokenID][self::TOKEN_LINE])) {
--$tokenID;
}
return $this->tokens[$tokenID][self::TOKEN_LINE];
} | [
"private",
"function",
"lineNumber",
"(",
"int",
"$",
"tokenID",
")",
":",
"int",
"{",
"while",
"(",
"empty",
"(",
"$",
"this",
"->",
"tokens",
"[",
"$",
"tokenID",
"]",
"[",
"self",
"::",
"TOKEN_LINE",
"]",
")",
")",
"{",
"--",
"$",
"tokenID",
";"... | Get line number associated with token.
@param int $tokenID
@return int | [
"Get",
"line",
"number",
"associated",
"with",
"token",
"."
] | aca11410e183d4c4a6c0f858ba87bf072c4eb925 | https://github.com/spiral/tokenizer/blob/aca11410e183d4c4a6c0f858ba87bf072c4eb925/src/Reflection/ReflectionFile.php#L734-L741 |
28,945 | spiral/tokenizer | src/Reflection/ReflectionFile.php | ReflectionFile.getSource | private function getSource(int $startID, int $endID): string
{
$result = '';
for ($tokenID = $startID; $tokenID <= $endID; ++$tokenID) {
//Collecting function usage src
$result .= $this->tokens[$tokenID][self::TOKEN_CODE];
}
return $result;
} | php | private function getSource(int $startID, int $endID): string
{
$result = '';
for ($tokenID = $startID; $tokenID <= $endID; ++$tokenID) {
//Collecting function usage src
$result .= $this->tokens[$tokenID][self::TOKEN_CODE];
}
return $result;
} | [
"private",
"function",
"getSource",
"(",
"int",
"$",
"startID",
",",
"int",
"$",
"endID",
")",
":",
"string",
"{",
"$",
"result",
"=",
"''",
";",
"for",
"(",
"$",
"tokenID",
"=",
"$",
"startID",
";",
"$",
"tokenID",
"<=",
"$",
"endID",
";",
"++",
... | Get src located between two tokens.
@param int $startID
@param int $endID
@return string | [
"Get",
"src",
"located",
"between",
"two",
"tokens",
"."
] | aca11410e183d4c4a6c0f858ba87bf072c4eb925 | https://github.com/spiral/tokenizer/blob/aca11410e183d4c4a6c0f858ba87bf072c4eb925/src/Reflection/ReflectionFile.php#L751-L760 |
28,946 | spiral/tokenizer | src/Reflection/ReflectionArgument.php | ReflectionArgument.createArgument | private static function createArgument(array $definition): ReflectionArgument
{
$result = new static(self::EXPRESSION, $definition['value']);
if (count($definition['tokens']) == 1) {
//If argument represent by one token we can try to resolve it's type more precisely
switch (... | php | private static function createArgument(array $definition): ReflectionArgument
{
$result = new static(self::EXPRESSION, $definition['value']);
if (count($definition['tokens']) == 1) {
//If argument represent by one token we can try to resolve it's type more precisely
switch (... | [
"private",
"static",
"function",
"createArgument",
"(",
"array",
"$",
"definition",
")",
":",
"ReflectionArgument",
"{",
"$",
"result",
"=",
"new",
"static",
"(",
"self",
"::",
"EXPRESSION",
",",
"$",
"definition",
"[",
"'value'",
"]",
")",
";",
"if",
"(",... | Create Argument reflection using token definition. Internal method.
@see locateArguments
@param array $definition
@return self | [
"Create",
"Argument",
"reflection",
"using",
"token",
"definition",
".",
"Internal",
"method",
"."
] | aca11410e183d4c4a6c0f858ba87bf072c4eb925 | https://github.com/spiral/tokenizer/blob/aca11410e183d4c4a6c0f858ba87bf072c4eb925/src/Reflection/ReflectionArgument.php#L152-L173 |
28,947 | spiral/tokenizer | src/AbstractLocator.php | AbstractLocator.availableReflections | protected function availableReflections(): \Generator
{
/**
* @var SplFileInfo
*/
foreach ($this->finder->getIterator() as $file) {
$reflection = new ReflectionFile((string)$file);
if ($reflection->hasIncludes()) {
//We are not analyzing fil... | php | protected function availableReflections(): \Generator
{
/**
* @var SplFileInfo
*/
foreach ($this->finder->getIterator() as $file) {
$reflection = new ReflectionFile((string)$file);
if ($reflection->hasIncludes()) {
//We are not analyzing fil... | [
"protected",
"function",
"availableReflections",
"(",
")",
":",
"\\",
"Generator",
"{",
"/**\n * @var SplFileInfo\n */",
"foreach",
"(",
"$",
"this",
"->",
"finder",
"->",
"getIterator",
"(",
")",
"as",
"$",
"file",
")",
"{",
"$",
"reflection",
"... | Available file reflections. Generator.
@return ReflectionFile[]|\Generator | [
"Available",
"file",
"reflections",
".",
"Generator",
"."
] | aca11410e183d4c4a6c0f858ba87bf072c4eb925 | https://github.com/spiral/tokenizer/blob/aca11410e183d4c4a6c0f858ba87bf072c4eb925/src/AbstractLocator.php#L44-L67 |
28,948 | spiral/tokenizer | src/AbstractLocator.php | AbstractLocator.classReflection | protected function classReflection(string $class): \ReflectionClass
{
$loader = function ($class) {
if ($class == LocatorException::class) {
return;
}
throw new LocatorException("Class '{$class}' can not be loaded");
};
//To suspend class... | php | protected function classReflection(string $class): \ReflectionClass
{
$loader = function ($class) {
if ($class == LocatorException::class) {
return;
}
throw new LocatorException("Class '{$class}' can not be loaded");
};
//To suspend class... | [
"protected",
"function",
"classReflection",
"(",
"string",
"$",
"class",
")",
":",
"\\",
"ReflectionClass",
"{",
"$",
"loader",
"=",
"function",
"(",
"$",
"class",
")",
"{",
"if",
"(",
"$",
"class",
"==",
"LocatorException",
"::",
"class",
")",
"{",
"ret... | Safely get class reflection, class loading errors will be blocked and reflection will be
excluded from analysis.
@param string $class
@return \ReflectionClass | [
"Safely",
"get",
"class",
"reflection",
"class",
"loading",
"errors",
"will",
"be",
"blocked",
"and",
"reflection",
"will",
"be",
"excluded",
"from",
"analysis",
"."
] | aca11410e183d4c4a6c0f858ba87bf072c4eb925 | https://github.com/spiral/tokenizer/blob/aca11410e183d4c4a6c0f858ba87bf072c4eb925/src/AbstractLocator.php#L77-L114 |
28,949 | spiral/tokenizer | src/InvocationLocator.php | InvocationLocator.availableInvocations | protected function availableInvocations(string $signature = ''): \Generator
{
$signature = strtolower(trim($signature, '\\'));
foreach ($this->availableReflections() as $reflection) {
foreach ($reflection->getInvocations() as $invocation) {
if (
!empty... | php | protected function availableInvocations(string $signature = ''): \Generator
{
$signature = strtolower(trim($signature, '\\'));
foreach ($this->availableReflections() as $reflection) {
foreach ($reflection->getInvocations() as $invocation) {
if (
!empty... | [
"protected",
"function",
"availableInvocations",
"(",
"string",
"$",
"signature",
"=",
"''",
")",
":",
"\\",
"Generator",
"{",
"$",
"signature",
"=",
"strtolower",
"(",
"trim",
"(",
"$",
"signature",
",",
"'\\\\'",
")",
")",
";",
"foreach",
"(",
"$",
"th... | Invocations available in finder scope.
@param string $signature Method or function signature (name), for pre-filtering.
@return ReflectionInvocation[]|\Generator | [
"Invocations",
"available",
"in",
"finder",
"scope",
"."
] | aca11410e183d4c4a6c0f858ba87bf072c4eb925 | https://github.com/spiral/tokenizer/blob/aca11410e183d4c4a6c0f858ba87bf072c4eb925/src/InvocationLocator.php#L43-L58 |
28,950 | spiral/tokenizer | src/ClassLocator.php | ClassLocator.availableClasses | protected function availableClasses(): array
{
$classes = [];
foreach ($this->availableReflections() as $reflection) {
$classes = array_merge($classes, $reflection->getClasses());
}
return $classes;
} | php | protected function availableClasses(): array
{
$classes = [];
foreach ($this->availableReflections() as $reflection) {
$classes = array_merge($classes, $reflection->getClasses());
}
return $classes;
} | [
"protected",
"function",
"availableClasses",
"(",
")",
":",
"array",
"{",
"$",
"classes",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"availableReflections",
"(",
")",
"as",
"$",
"reflection",
")",
"{",
"$",
"classes",
"=",
"array_merge",
"(",... | Classes available in finder scope.
@return array | [
"Classes",
"available",
"in",
"finder",
"scope",
"."
] | aca11410e183d4c4a6c0f858ba87bf072c4eb925 | https://github.com/spiral/tokenizer/blob/aca11410e183d4c4a6c0f858ba87bf072c4eb925/src/ClassLocator.php#L51-L60 |
28,951 | spiral/tokenizer | src/ClassLocator.php | ClassLocator.isTargeted | protected function isTargeted(\ReflectionClass $class, \ReflectionClass $target = null): bool
{
if (empty($target)) {
return true;
}
if (!$target->isTrait()) {
//Target is interface or class
return $class->isSubclassOf($target) || $class->getName() == $ta... | php | protected function isTargeted(\ReflectionClass $class, \ReflectionClass $target = null): bool
{
if (empty($target)) {
return true;
}
if (!$target->isTrait()) {
//Target is interface or class
return $class->isSubclassOf($target) || $class->getName() == $ta... | [
"protected",
"function",
"isTargeted",
"(",
"\\",
"ReflectionClass",
"$",
"class",
",",
"\\",
"ReflectionClass",
"$",
"target",
"=",
"null",
")",
":",
"bool",
"{",
"if",
"(",
"empty",
"(",
"$",
"target",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",... | Check if given class targeted by locator.
@param \ReflectionClass $class
@param \ReflectionClass|null $target
@return bool | [
"Check",
"if",
"given",
"class",
"targeted",
"by",
"locator",
"."
] | aca11410e183d4c4a6c0f858ba87bf072c4eb925 | https://github.com/spiral/tokenizer/blob/aca11410e183d4c4a6c0f858ba87bf072c4eb925/src/ClassLocator.php#L69-L82 |
28,952 | spiral/tokenizer | src/Isolator.php | Isolator.isolatePHP | public function isolatePHP(string $source): string
{
$phpBlock = false;
$isolated = '';
foreach (token_get_all($source) as $token) {
if ($this->isOpenTag($token)) {
$phpBlock = $token[1];
continue;
}
if ($this->isCloseTag... | php | public function isolatePHP(string $source): string
{
$phpBlock = false;
$isolated = '';
foreach (token_get_all($source) as $token) {
if ($this->isOpenTag($token)) {
$phpBlock = $token[1];
continue;
}
if ($this->isCloseTag... | [
"public",
"function",
"isolatePHP",
"(",
"string",
"$",
"source",
")",
":",
"string",
"{",
"$",
"phpBlock",
"=",
"false",
";",
"$",
"isolated",
"=",
"''",
";",
"foreach",
"(",
"token_get_all",
"(",
"$",
"source",
")",
"as",
"$",
"token",
")",
"{",
"i... | Isolates all returned PHP blocks with a defined pattern. Method uses
token_get_all function. Resulted src have all php blocks replaced
with non executable placeholder.
@param string $source
@return string | [
"Isolates",
"all",
"returned",
"PHP",
"blocks",
"with",
"a",
"defined",
"pattern",
".",
"Method",
"uses",
"token_get_all",
"function",
".",
"Resulted",
"src",
"have",
"all",
"php",
"blocks",
"replaced",
"with",
"non",
"executable",
"placeholder",
"."
] | aca11410e183d4c4a6c0f858ba87bf072c4eb925 | https://github.com/spiral/tokenizer/blob/aca11410e183d4c4a6c0f858ba87bf072c4eb925/src/Isolator.php#L64-L97 |
28,953 | spiral/tokenizer | src/Isolator.php | Isolator.setBlock | public function setBlock(string $blockID, string $source): Isolator
{
if (!isset($this->phpBlocks[$blockID])) {
throw new IsolatorException("Undefined block {$blockID}");
}
$this->phpBlocks[$blockID] = $source;
return $this;
} | php | public function setBlock(string $blockID, string $source): Isolator
{
if (!isset($this->phpBlocks[$blockID])) {
throw new IsolatorException("Undefined block {$blockID}");
}
$this->phpBlocks[$blockID] = $source;
return $this;
} | [
"public",
"function",
"setBlock",
"(",
"string",
"$",
"blockID",
",",
"string",
"$",
"source",
")",
":",
"Isolator",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"phpBlocks",
"[",
"$",
"blockID",
"]",
")",
")",
"{",
"throw",
"new",
"Isolator... | Set block content by id.
@param string $blockID
@param string $source
@return self
@throws IsolatorException | [
"Set",
"block",
"content",
"by",
"id",
"."
] | aca11410e183d4c4a6c0f858ba87bf072c4eb925 | https://github.com/spiral/tokenizer/blob/aca11410e183d4c4a6c0f858ba87bf072c4eb925/src/Isolator.php#L109-L118 |
28,954 | spiral/tokenizer | src/Reflection/ReflectionInvocation.php | ReflectionInvocation.getArgument | public function getArgument(int $index): ReflectionArgument
{
if (!isset($this->arguments[$index])) {
throw new ReflectionException("No such argument with index '{$index}'");
}
return $this->arguments[$index];
} | php | public function getArgument(int $index): ReflectionArgument
{
if (!isset($this->arguments[$index])) {
throw new ReflectionException("No such argument with index '{$index}'");
}
return $this->arguments[$index];
} | [
"public",
"function",
"getArgument",
"(",
"int",
"$",
"index",
")",
":",
"ReflectionArgument",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"arguments",
"[",
"$",
"index",
"]",
")",
")",
"{",
"throw",
"new",
"ReflectionException",
"(",
"\"No suc... | Get call argument by it's position.
@param int $index
@return ReflectionArgument|null | [
"Get",
"call",
"argument",
"by",
"it",
"s",
"position",
"."
] | aca11410e183d4c4a6c0f858ba87bf072c4eb925 | https://github.com/spiral/tokenizer/blob/aca11410e183d4c4a6c0f858ba87bf072c4eb925/src/Reflection/ReflectionInvocation.php#L178-L185 |
28,955 | prologuephp/alerts | src/AlertsMessageBag.php | AlertsMessageBag.flush | public function flush($withSession = true)
{
$this->messages = [];
if($withSession) {
$this->session->forget($this->getSessionKey());
}
return $this;
} | php | public function flush($withSession = true)
{
$this->messages = [];
if($withSession) {
$this->session->forget($this->getSessionKey());
}
return $this;
} | [
"public",
"function",
"flush",
"(",
"$",
"withSession",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"messages",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"withSession",
")",
"{",
"$",
"this",
"->",
"session",
"->",
"forget",
"(",
"$",
"this",
"->",
"getSes... | Deletes all messages.
@param bool $withSession
@return \Prologue\Alerts\AlertsMessageBag | [
"Deletes",
"all",
"messages",
"."
] | d88244729b0109308136cbafe45f11095c7ee0b0 | https://github.com/prologuephp/alerts/blob/d88244729b0109308136cbafe45f11095c7ee0b0/src/AlertsMessageBag.php#L95-L104 |
28,956 | timble/kodekit | code/controller/behavior/persistable.php | ControllerBehaviorPersistable._getStateKey | protected function _getStateKey(ControllerContext $context)
{
$view = $this->getView()->getIdentifier();
$layout = $this->getView()->getLayout();
$model = $this->getModel()->getIdentifier();
return $view.'.'.$layout.'.'.$model.'.'.$context->action;
} | php | protected function _getStateKey(ControllerContext $context)
{
$view = $this->getView()->getIdentifier();
$layout = $this->getView()->getLayout();
$model = $this->getModel()->getIdentifier();
return $view.'.'.$layout.'.'.$model.'.'.$context->action;
} | [
"protected",
"function",
"_getStateKey",
"(",
"ControllerContext",
"$",
"context",
")",
"{",
"$",
"view",
"=",
"$",
"this",
"->",
"getView",
"(",
")",
"->",
"getIdentifier",
"(",
")",
";",
"$",
"layout",
"=",
"$",
"this",
"->",
"getView",
"(",
")",
"->... | Returns a key based on the context to persist state values
@param ControllerContext $context The active controller context
@return string | [
"Returns",
"a",
"key",
"based",
"on",
"the",
"context",
"to",
"persist",
"state",
"values"
] | 4c376f8873f8d10c55e3d290616ff622605cd246 | https://github.com/timble/kodekit/blob/4c376f8873f8d10c55e3d290616ff622605cd246/code/controller/behavior/persistable.php#L46-L53 |
28,957 | timble/kodekit | code/controller/behavior/persistable.php | ControllerBehaviorPersistable._beforeBrowse | protected function _beforeBrowse(ControllerContextModel $context)
{
$query = $context->getRequest()->query;
$query->add((array) $context->user->get($this->_getStateKey($context)));
$this->getModel()->getState()->setValues($query->toArray());
} | php | protected function _beforeBrowse(ControllerContextModel $context)
{
$query = $context->getRequest()->query;
$query->add((array) $context->user->get($this->_getStateKey($context)));
$this->getModel()->getState()->setValues($query->toArray());
} | [
"protected",
"function",
"_beforeBrowse",
"(",
"ControllerContextModel",
"$",
"context",
")",
"{",
"$",
"query",
"=",
"$",
"context",
"->",
"getRequest",
"(",
")",
"->",
"query",
";",
"$",
"query",
"->",
"add",
"(",
"(",
"array",
")",
"$",
"context",
"->... | Load the model state from the request
This functions merges the request information with any model state information that was saved in the session and
returns the result.
@param ControllerContextModel $context The active controller context
@return void | [
"Load",
"the",
"model",
"state",
"from",
"the",
"request"
] | 4c376f8873f8d10c55e3d290616ff622605cd246 | https://github.com/timble/kodekit/blob/4c376f8873f8d10c55e3d290616ff622605cd246/code/controller/behavior/persistable.php#L64-L71 |
28,958 | timble/kodekit | code/class/registry/registry.php | ClassRegistry.getLocator | public function getLocator($class)
{
$result = false;
if(!false == $pos = strrpos($class, '\\'))
{
$namespace = substr($class, 0, $pos);
if(isset($this->_namespaces[$namespace])) {
$result = $this->_namespaces[$namespace];
}
}
... | php | public function getLocator($class)
{
$result = false;
if(!false == $pos = strrpos($class, '\\'))
{
$namespace = substr($class, 0, $pos);
if(isset($this->_namespaces[$namespace])) {
$result = $this->_namespaces[$namespace];
}
}
... | [
"public",
"function",
"getLocator",
"(",
"$",
"class",
")",
"{",
"$",
"result",
"=",
"false",
";",
"if",
"(",
"!",
"false",
"==",
"$",
"pos",
"=",
"strrpos",
"(",
"$",
"class",
",",
"'\\\\'",
")",
")",
"{",
"$",
"namespace",
"=",
"substr",
"(",
"... | Get a specific locator from the class namespace
@return string|false The name of the locator or FALSE if no locator could be found | [
"Get",
"a",
"specific",
"locator",
"from",
"the",
"class",
"namespace"
] | 4c376f8873f8d10c55e3d290616ff622605cd246 | https://github.com/timble/kodekit/blob/4c376f8873f8d10c55e3d290616ff622605cd246/code/class/registry/registry.php#L143-L157 |
28,959 | timble/kodekit | code/class/registry/registry.php | ClassRegistry.setLocator | public function setLocator($class, $locator)
{
if(!false == $pos = strrpos($class, '\\'))
{
$namespace = substr($class, 0, $pos);
$this->_namespaces[$namespace] = $locator;
}
return $this;
} | php | public function setLocator($class, $locator)
{
if(!false == $pos = strrpos($class, '\\'))
{
$namespace = substr($class, 0, $pos);
$this->_namespaces[$namespace] = $locator;
}
return $this;
} | [
"public",
"function",
"setLocator",
"(",
"$",
"class",
",",
"$",
"locator",
")",
"{",
"if",
"(",
"!",
"false",
"==",
"$",
"pos",
"=",
"strrpos",
"(",
"$",
"class",
",",
"'\\\\'",
")",
")",
"{",
"$",
"namespace",
"=",
"substr",
"(",
"$",
"class",
... | Set a specific locator based on a class namespace
@return ClassRegistry | [
"Set",
"a",
"specific",
"locator",
"based",
"on",
"a",
"class",
"namespace"
] | 4c376f8873f8d10c55e3d290616ff622605cd246 | https://github.com/timble/kodekit/blob/4c376f8873f8d10c55e3d290616ff622605cd246/code/class/registry/registry.php#L164-L173 |
28,960 | timble/kodekit | code/filesystem/stream/iterator/chunked.php | FilesystemStreamIteratorChunked.seek | public function seek($position)
{
if ($position > $this->count()) {
throw new \OutOfBoundsException('Invalid seek position ('.$position.')');
}
$chunk_size = $this->getChunkSize();
$position = $chunk_size * $position;
$this->getInnerIterator()->seek($position)... | php | public function seek($position)
{
if ($position > $this->count()) {
throw new \OutOfBoundsException('Invalid seek position ('.$position.')');
}
$chunk_size = $this->getChunkSize();
$position = $chunk_size * $position;
$this->getInnerIterator()->seek($position)... | [
"public",
"function",
"seek",
"(",
"$",
"position",
")",
"{",
"if",
"(",
"$",
"position",
">",
"$",
"this",
"->",
"count",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"OutOfBoundsException",
"(",
"'Invalid seek position ('",
".",
"$",
"position",
".",
"')'... | Seeks to a given chunk position in the stream
@param int $position
@throws \OutOfBoundsException If the position is not seekable.
@return void | [
"Seeks",
"to",
"a",
"given",
"chunk",
"position",
"in",
"the",
"stream"
] | 4c376f8873f8d10c55e3d290616ff622605cd246 | https://github.com/timble/kodekit/blob/4c376f8873f8d10c55e3d290616ff622605cd246/code/filesystem/stream/iterator/chunked.php#L46-L56 |
28,961 | timble/kodekit | code/template/helper/grid.php | TemplateHelperGrid.checkbox | public function checkbox($config = array())
{
$config = new ObjectConfigJson($config);
$config->append(array(
'entity' => null,
'attribs' => array()
))->append(array(
'column' => $config->entity->getIdentityKey()
));
if($config->entity->i... | php | public function checkbox($config = array())
{
$config = new ObjectConfigJson($config);
$config->append(array(
'entity' => null,
'attribs' => array()
))->append(array(
'column' => $config->entity->getIdentityKey()
));
if($config->entity->i... | [
"public",
"function",
"checkbox",
"(",
"$",
"config",
"=",
"array",
"(",
")",
")",
"{",
"$",
"config",
"=",
"new",
"ObjectConfigJson",
"(",
"$",
"config",
")",
";",
"$",
"config",
"->",
"append",
"(",
"array",
"(",
"'entity'",
"=>",
"null",
",",
"'at... | Render a checkbox field
@param array $config An optional array with configuration options
@return string Html | [
"Render",
"a",
"checkbox",
"field"
] | 4c376f8873f8d10c55e3d290616ff622605cd246 | https://github.com/timble/kodekit/blob/4c376f8873f8d10c55e3d290616ff622605cd246/code/template/helper/grid.php#L61-L91 |
28,962 | timble/kodekit | code/template/helper/grid.php | TemplateHelperGrid.enable | public function enable($config = array())
{
$translator = $this->getObject('translator');
$config = new ObjectConfigJson($config);
$config->append(array(
'entity' => null,
'field' => 'enabled',
'clickable' => true
))->append(array(
... | php | public function enable($config = array())
{
$translator = $this->getObject('translator');
$config = new ObjectConfigJson($config);
$config->append(array(
'entity' => null,
'field' => 'enabled',
'clickable' => true
))->append(array(
... | [
"public",
"function",
"enable",
"(",
"$",
"config",
"=",
"array",
"(",
")",
")",
"{",
"$",
"translator",
"=",
"$",
"this",
"->",
"getObject",
"(",
"'translator'",
")",
";",
"$",
"config",
"=",
"new",
"ObjectConfigJson",
"(",
"$",
"config",
")",
";",
... | Render an enable field
@param array $config An optional array with configuration options
@return string Html | [
"Render",
"an",
"enable",
"field"
] | 4c376f8873f8d10c55e3d290616ff622605cd246 | https://github.com/timble/kodekit/blob/4c376f8873f8d10c55e3d290616ff622605cd246/code/template/helper/grid.php#L265-L302 |
28,963 | timble/kodekit | code/template/helper/grid.php | TemplateHelperGrid.lock_message | public function lock_message($config = array())
{
$config = new ObjectConfigJson($config);
$config->append(array(
'entity' => null
));
if (!($config->entity instanceof ModelEntityInterface)) {
throw new \UnexpectedValueException('$config->entity should be a M... | php | public function lock_message($config = array())
{
$config = new ObjectConfigJson($config);
$config->append(array(
'entity' => null
));
if (!($config->entity instanceof ModelEntityInterface)) {
throw new \UnexpectedValueException('$config->entity should be a M... | [
"public",
"function",
"lock_message",
"(",
"$",
"config",
"=",
"array",
"(",
")",
")",
"{",
"$",
"config",
"=",
"new",
"ObjectConfigJson",
"(",
"$",
"config",
")",
";",
"$",
"config",
"->",
"append",
"(",
"array",
"(",
"'entity'",
"=>",
"null",
")",
... | Get the locked information
@param array|ObjectConfig $config An optional configuration array.
@throws \UnexpectedValueException
@return string The locked by "name" "date" message | [
"Get",
"the",
"locked",
"information"
] | 4c376f8873f8d10c55e3d290616ff622605cd246 | https://github.com/timble/kodekit/blob/4c376f8873f8d10c55e3d290616ff622605cd246/code/template/helper/grid.php#L338-L363 |
28,964 | nicebooks-com/isbn | src/IsbnTools.php | IsbnTools.isValidIsbn | public function isValidIsbn(string $isbn) : bool
{
return $this->isValidIsbn10($isbn) || $this->isValidIsbn13($isbn);
} | php | public function isValidIsbn(string $isbn) : bool
{
return $this->isValidIsbn10($isbn) || $this->isValidIsbn13($isbn);
} | [
"public",
"function",
"isValidIsbn",
"(",
"string",
"$",
"isbn",
")",
":",
"bool",
"{",
"return",
"$",
"this",
"->",
"isValidIsbn10",
"(",
"$",
"isbn",
")",
"||",
"$",
"this",
"->",
"isValidIsbn13",
"(",
"$",
"isbn",
")",
";",
"}"
] | Returns whether the given ISBN is a valid ISBN-10 or ISBN-13.
@param string $isbn The unformatted ISBN.
@return bool | [
"Returns",
"whether",
"the",
"given",
"ISBN",
"is",
"a",
"valid",
"ISBN",
"-",
"10",
"or",
"ISBN",
"-",
"13",
"."
] | f5ceb662e517b21e30c9dfa53c4d74823849232d | https://github.com/nicebooks-com/isbn/blob/f5ceb662e517b21e30c9dfa53c4d74823849232d/src/IsbnTools.php#L39-L42 |
28,965 | nicebooks-com/isbn | src/IsbnTools.php | IsbnTools.isValidIsbn10 | public function isValidIsbn10(string $isbn) : bool
{
if ($this->cleanupBeforeValidate) {
if (preg_match(Internal\Regexp::ASCII, $isbn) === 0) {
return false;
}
$isbn = preg_replace(Internal\Regexp::NON_ALNUM, '', $isbn);
}
$isbn = strtoup... | php | public function isValidIsbn10(string $isbn) : bool
{
if ($this->cleanupBeforeValidate) {
if (preg_match(Internal\Regexp::ASCII, $isbn) === 0) {
return false;
}
$isbn = preg_replace(Internal\Regexp::NON_ALNUM, '', $isbn);
}
$isbn = strtoup... | [
"public",
"function",
"isValidIsbn10",
"(",
"string",
"$",
"isbn",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"this",
"->",
"cleanupBeforeValidate",
")",
"{",
"if",
"(",
"preg_match",
"(",
"Internal",
"\\",
"Regexp",
"::",
"ASCII",
",",
"$",
"isbn",
")",
"... | Returns whether the given ISBN is a valid ISBN-10.
@param string $isbn The unformatted ISBN.
@return bool | [
"Returns",
"whether",
"the",
"given",
"ISBN",
"is",
"a",
"valid",
"ISBN",
"-",
"10",
"."
] | f5ceb662e517b21e30c9dfa53c4d74823849232d | https://github.com/nicebooks-com/isbn/blob/f5ceb662e517b21e30c9dfa53c4d74823849232d/src/IsbnTools.php#L51-L74 |
28,966 | nicebooks-com/isbn | src/IsbnTools.php | IsbnTools.isValidIsbn13 | public function isValidIsbn13(string $isbn) : bool
{
if ($this->cleanupBeforeValidate) {
if (preg_match(Internal\Regexp::ASCII, $isbn) === 0) {
return false;
}
$isbn = preg_replace(Internal\Regexp::NON_ALNUM, '', $isbn);
}
if (preg_match(... | php | public function isValidIsbn13(string $isbn) : bool
{
if ($this->cleanupBeforeValidate) {
if (preg_match(Internal\Regexp::ASCII, $isbn) === 0) {
return false;
}
$isbn = preg_replace(Internal\Regexp::NON_ALNUM, '', $isbn);
}
if (preg_match(... | [
"public",
"function",
"isValidIsbn13",
"(",
"string",
"$",
"isbn",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"this",
"->",
"cleanupBeforeValidate",
")",
"{",
"if",
"(",
"preg_match",
"(",
"Internal",
"\\",
"Regexp",
"::",
"ASCII",
",",
"$",
"isbn",
")",
"... | Returns whether the given ISBN is a valid ISBN-13.
@param string $isbn The unformatted ISBN.
@return bool | [
"Returns",
"whether",
"the",
"given",
"ISBN",
"is",
"a",
"valid",
"ISBN",
"-",
"13",
"."
] | f5ceb662e517b21e30c9dfa53c4d74823849232d | https://github.com/nicebooks-com/isbn/blob/f5ceb662e517b21e30c9dfa53c4d74823849232d/src/IsbnTools.php#L83-L104 |
28,967 | nicebooks-com/isbn | src/IsbnTools.php | IsbnTools.convertIsbn10to13 | public function convertIsbn10to13(string $isbn) : string
{
if ($this->cleanupBeforeValidate) {
if (preg_match(Internal\Regexp::ASCII, $isbn) === 0) {
throw Exception\InvalidIsbnException::forIsbn($isbn);
}
$isbn = preg_replace(Internal\Regexp::NON_ALNUM, ... | php | public function convertIsbn10to13(string $isbn) : string
{
if ($this->cleanupBeforeValidate) {
if (preg_match(Internal\Regexp::ASCII, $isbn) === 0) {
throw Exception\InvalidIsbnException::forIsbn($isbn);
}
$isbn = preg_replace(Internal\Regexp::NON_ALNUM, ... | [
"public",
"function",
"convertIsbn10to13",
"(",
"string",
"$",
"isbn",
")",
":",
"string",
"{",
"if",
"(",
"$",
"this",
"->",
"cleanupBeforeValidate",
")",
"{",
"if",
"(",
"preg_match",
"(",
"Internal",
"\\",
"Regexp",
"::",
"ASCII",
",",
"$",
"isbn",
")... | Converts an ISBN-10 to an ISBN-13.
@param string $isbn The ISBN-10 to convert.
@return string The converted, unformatted ISBN-13.
@throws Exception\InvalidIsbnException If the ISBN is not a valid ISBN-10. | [
"Converts",
"an",
"ISBN",
"-",
"10",
"to",
"an",
"ISBN",
"-",
"13",
"."
] | f5ceb662e517b21e30c9dfa53c4d74823849232d | https://github.com/nicebooks-com/isbn/blob/f5ceb662e517b21e30c9dfa53c4d74823849232d/src/IsbnTools.php#L115-L138 |
28,968 | nicebooks-com/isbn | src/IsbnTools.php | IsbnTools.convertIsbn13to10 | public function convertIsbn13to10(string $isbn) : string
{
if ($this->cleanupBeforeValidate) {
if (preg_match(Internal\Regexp::ASCII, $isbn) === 0) {
throw Exception\InvalidIsbnException::forIsbn($isbn);
}
$isbn = preg_replace(Internal\Regexp::NON_ALNUM, ... | php | public function convertIsbn13to10(string $isbn) : string
{
if ($this->cleanupBeforeValidate) {
if (preg_match(Internal\Regexp::ASCII, $isbn) === 0) {
throw Exception\InvalidIsbnException::forIsbn($isbn);
}
$isbn = preg_replace(Internal\Regexp::NON_ALNUM, ... | [
"public",
"function",
"convertIsbn13to10",
"(",
"string",
"$",
"isbn",
")",
":",
"string",
"{",
"if",
"(",
"$",
"this",
"->",
"cleanupBeforeValidate",
")",
"{",
"if",
"(",
"preg_match",
"(",
"Internal",
"\\",
"Regexp",
"::",
"ASCII",
",",
"$",
"isbn",
")... | Converts an ISBN-13 to an ISBN-10.
Only ISBN-13 numbers starting with 978 can be converted to an ISBN-10.
If the input ISBN is a valid ISBN-13 but does not start with 978, an exception is thrown.
@param string $isbn The ISBN-13 to convert.
@return string The converted, unformatted ISBN-10.
@throws Exception\Invalid... | [
"Converts",
"an",
"ISBN",
"-",
"13",
"to",
"an",
"ISBN",
"-",
"10",
"."
] | f5ceb662e517b21e30c9dfa53c4d74823849232d | https://github.com/nicebooks-com/isbn/blob/f5ceb662e517b21e30c9dfa53c4d74823849232d/src/IsbnTools.php#L153-L174 |
28,969 | nicebooks-com/isbn | src/IsbnTools.php | IsbnTools.format | public function format(string $isbn) : string
{
if ($this->cleanupBeforeValidate) {
if (preg_match(Internal\Regexp::ASCII, $isbn) === 0) {
throw Exception\InvalidIsbnException::forIsbn($isbn);
}
$isbn = preg_replace(Internal\Regexp::NON_ALNUM, '', $isbn);... | php | public function format(string $isbn) : string
{
if ($this->cleanupBeforeValidate) {
if (preg_match(Internal\Regexp::ASCII, $isbn) === 0) {
throw Exception\InvalidIsbnException::forIsbn($isbn);
}
$isbn = preg_replace(Internal\Regexp::NON_ALNUM, '', $isbn);... | [
"public",
"function",
"format",
"(",
"string",
"$",
"isbn",
")",
":",
"string",
"{",
"if",
"(",
"$",
"this",
"->",
"cleanupBeforeValidate",
")",
"{",
"if",
"(",
"preg_match",
"(",
"Internal",
"\\",
"Regexp",
"::",
"ASCII",
",",
"$",
"isbn",
")",
"===",... | Formats an ISBN number.
@param string $isbn The ISBN-10 or ISBN-13 number.
@return string The formatted ISBN number.
@throws Exception\InvalidIsbnException If the ISBN is not valid. | [
"Formats",
"an",
"ISBN",
"number",
"."
] | f5ceb662e517b21e30c9dfa53c4d74823849232d | https://github.com/nicebooks-com/isbn/blob/f5ceb662e517b21e30c9dfa53c4d74823849232d/src/IsbnTools.php#L185-L218 |
28,970 | timble/kodekit | code/model/behavior/paginatable.php | ModelBehaviorPaginatable.getPaginator | public function getPaginator()
{
$paginator = new ModelPaginator(array(
'offset' => (int)$this->getState()->offset,
'limit' => (int)$this->getState()->limit,
'total' => (int)$this->count(),
));
return $paginator;
} | php | public function getPaginator()
{
$paginator = new ModelPaginator(array(
'offset' => (int)$this->getState()->offset,
'limit' => (int)$this->getState()->limit,
'total' => (int)$this->count(),
));
return $paginator;
} | [
"public",
"function",
"getPaginator",
"(",
")",
"{",
"$",
"paginator",
"=",
"new",
"ModelPaginator",
"(",
"array",
"(",
"'offset'",
"=>",
"(",
"int",
")",
"$",
"this",
"->",
"getState",
"(",
")",
"->",
"offset",
",",
"'limit'",
"=>",
"(",
"int",
")",
... | Get the model paginator object
@return ModelPaginator The model paginator object | [
"Get",
"the",
"model",
"paginator",
"object"
] | 4c376f8873f8d10c55e3d290616ff622605cd246 | https://github.com/timble/kodekit/blob/4c376f8873f8d10c55e3d290616ff622605cd246/code/model/behavior/paginatable.php#L39-L48 |
28,971 | timble/kodekit | code/filter/factory.php | FilterFactory.createFilter | public function createFilter($filter, $config = array())
{
if(is_string($filter) && strpos($filter, '.') === false )
{
$identifier = $this->getIdentifier()->toArray();
$identifier['name'] = $filter;
}
else $identifier = $filter;
$filter = $this->getOb... | php | public function createFilter($filter, $config = array())
{
if(is_string($filter) && strpos($filter, '.') === false )
{
$identifier = $this->getIdentifier()->toArray();
$identifier['name'] = $filter;
}
else $identifier = $filter;
$filter = $this->getOb... | [
"public",
"function",
"createFilter",
"(",
"$",
"filter",
",",
"$",
"config",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"filter",
")",
"&&",
"strpos",
"(",
"$",
"filter",
",",
"'.'",
")",
"===",
"false",
")",
"{",
"$",
"... | Factory method for Filter classes.
If the filter is not an identifier this function will create it directly instead of going through the Object
identification process.
@param string $filter Filter identifier
@param object|array $config An optional ObjectConfig object with configuration options
@throws \Unexp... | [
"Factory",
"method",
"for",
"Filter",
"classes",
"."
] | 4c376f8873f8d10c55e3d290616ff622605cd246 | https://github.com/timble/kodekit/blob/4c376f8873f8d10c55e3d290616ff622605cd246/code/filter/factory.php#L56-L73 |
28,972 | rosasurfer/ministruts | src/monitor/ChainedDependency.php | ChainedDependency.isValid | public function isValid() {
if ($this->type == 'AND') {
foreach ($this->dependencies as $dependency) {
if (!$dependency->isValid())
return false;
}
return true;
}
if ($this->type == 'OR' ) {
foreach ($this->depe... | php | public function isValid() {
if ($this->type == 'AND') {
foreach ($this->dependencies as $dependency) {
if (!$dependency->isValid())
return false;
}
return true;
}
if ($this->type == 'OR' ) {
foreach ($this->depe... | [
"public",
"function",
"isValid",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"type",
"==",
"'AND'",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"dependencies",
"as",
"$",
"dependency",
")",
"{",
"if",
"(",
"!",
"$",
"dependency",
"->",
"isValid",
... | Ob das zu ueberwachende Ereignis oder der Zustandswechsel eingetreten sind oder nicht.
@return bool - TRUE, wenn die Abhaengigkeit weiterhin erfuellt ist.
FALSE, wenn der Zustandswechsel eingetreten ist und die Abhaengigkeit nicht mehr erfuellt ist. | [
"Ob",
"das",
"zu",
"ueberwachende",
"Ereignis",
"oder",
"der",
"Zustandswechsel",
"eingetreten",
"sind",
"oder",
"nicht",
"."
] | 9d27f93dd53d2d626c75c92cfde9d004bab34d30 | https://github.com/rosasurfer/ministruts/blob/9d27f93dd53d2d626c75c92cfde9d004bab34d30/src/monitor/ChainedDependency.php#L93-L111 |
28,973 | timble/kodekit | code/filesystem/locator/factory.php | FilesystemLocatorFactory.createLocator | public function createLocator($path, array $config = array())
{
$scheme = parse_url($path, PHP_URL_SCHEME);
//If no scheme is specified fall back to file:// locator
$name = !empty($scheme) ? $scheme : 'file';
//If a windows drive letter is passed use file:// locator
if(strt... | php | public function createLocator($path, array $config = array())
{
$scheme = parse_url($path, PHP_URL_SCHEME);
//If no scheme is specified fall back to file:// locator
$name = !empty($scheme) ? $scheme : 'file';
//If a windows drive letter is passed use file:// locator
if(strt... | [
"public",
"function",
"createLocator",
"(",
"$",
"path",
",",
"array",
"$",
"config",
"=",
"array",
"(",
")",
")",
"{",
"$",
"scheme",
"=",
"parse_url",
"(",
"$",
"path",
",",
"PHP_URL_SCHEME",
")",
";",
"//If no scheme is specified fall back to file:// locator"... | Create a locator
Note that only URLs delimited by "://"" and ":" are supported, ":/" while technically valid URLs, are not.
If no locator is registered for the specific scheme a exception will be thrown.
@param string $path The locator path
@param array $config An optional associative array of configuration op... | [
"Create",
"a",
"locator"
] | 4c376f8873f8d10c55e3d290616ff622605cd246 | https://github.com/timble/kodekit/blob/4c376f8873f8d10c55e3d290616ff622605cd246/code/filesystem/locator/factory.php#L74-L109 |
28,974 | timble/kodekit | code/object/abstract.php | ObjectAbstract.inherits | public function inherits($class)
{
if ($this instanceof $class) {
return true;
}
$objects = array_values($this->__mixed_methods);
foreach($objects as $object)
{
if($object instanceof $class) {
return true;
}
}
... | php | public function inherits($class)
{
if ($this instanceof $class) {
return true;
}
$objects = array_values($this->__mixed_methods);
foreach($objects as $object)
{
if($object instanceof $class) {
return true;
}
}
... | [
"public",
"function",
"inherits",
"(",
"$",
"class",
")",
"{",
"if",
"(",
"$",
"this",
"instanceof",
"$",
"class",
")",
"{",
"return",
"true",
";",
"}",
"$",
"objects",
"=",
"array_values",
"(",
"$",
"this",
"->",
"__mixed_methods",
")",
";",
"foreach"... | Checks if the object or one of its mixins inherits from a class.
@param string|object The class to check
@return boolean Returns TRUE if the object inherits from the class | [
"Checks",
"if",
"the",
"object",
"or",
"one",
"of",
"its",
"mixins",
"inherits",
"from",
"a",
"class",
"."
] | 4c376f8873f8d10c55e3d290616ff622605cd246 | https://github.com/timble/kodekit/blob/4c376f8873f8d10c55e3d290616ff622605cd246/code/object/abstract.php#L234-L250 |
28,975 | timble/kodekit | code/controller/toolbar/iterator/recursive.php | ControllerToolbarIteratorRecursive._createInnerIterator | protected static function _createInnerIterator(ControllerToolbarInterface $toolbar)
{
$iterator = new \RecursiveArrayIterator($toolbar->getIterator());
$iterator = new \RecursiveCachingIterator($iterator, \CachingIterator::TOSTRING_USE_KEY);
return $iterator;
} | php | protected static function _createInnerIterator(ControllerToolbarInterface $toolbar)
{
$iterator = new \RecursiveArrayIterator($toolbar->getIterator());
$iterator = new \RecursiveCachingIterator($iterator, \CachingIterator::TOSTRING_USE_KEY);
return $iterator;
} | [
"protected",
"static",
"function",
"_createInnerIterator",
"(",
"ControllerToolbarInterface",
"$",
"toolbar",
")",
"{",
"$",
"iterator",
"=",
"new",
"\\",
"RecursiveArrayIterator",
"(",
"$",
"toolbar",
"->",
"getIterator",
"(",
")",
")",
";",
"$",
"iterator",
"=... | Create a recursive iterator from a toolbar
@param ControllerToolbarInterface $toolbar
@return \RecursiveIterator | [
"Create",
"a",
"recursive",
"iterator",
"from",
"a",
"toolbar"
] | 4c376f8873f8d10c55e3d290616ff622605cd246 | https://github.com/timble/kodekit/blob/4c376f8873f8d10c55e3d290616ff622605cd246/code/controller/toolbar/iterator/recursive.php#L86-L92 |
28,976 | rosasurfer/ministruts | src/db/orm/DAO.php | DAO.getImplementation | final public static function getImplementation($class) {
if (!is_a($class, __CLASS__, $allowString=true)) {
if (!is_class($class)) throw new ClassNotFoundException('Class not found: '.$class );
throw new InvalidArgumentException('Not a '.__CLASS__.' subclass: '.$class);
}
... | php | final public static function getImplementation($class) {
if (!is_a($class, __CLASS__, $allowString=true)) {
if (!is_class($class)) throw new ClassNotFoundException('Class not found: '.$class );
throw new InvalidArgumentException('Not a '.__CLASS__.' subclass: '.$class);
}
... | [
"final",
"public",
"static",
"function",
"getImplementation",
"(",
"$",
"class",
")",
"{",
"if",
"(",
"!",
"is_a",
"(",
"$",
"class",
",",
"__CLASS__",
",",
"$",
"allowString",
"=",
"true",
")",
")",
"{",
"if",
"(",
"!",
"is_class",
"(",
"$",
"class"... | Get the specified DAO implementation.
@param string $class - DAO class name
@return self | [
"Get",
"the",
"specified",
"DAO",
"implementation",
"."
] | 9d27f93dd53d2d626c75c92cfde9d004bab34d30 | https://github.com/rosasurfer/ministruts/blob/9d27f93dd53d2d626c75c92cfde9d004bab34d30/src/db/orm/DAO.php#L44-L52 |
28,977 | rosasurfer/ministruts | src/db/orm/DAO.php | DAO.findAll | public function findAll($query = null) {
if ($query === null) {
$mapping = $this->getMapping();
$table = $this->escapeIdentifier($mapping['table']);
$query = 'select * from '.$table;
}
return $this->getWorker()->findAll($query);
} | php | public function findAll($query = null) {
if ($query === null) {
$mapping = $this->getMapping();
$table = $this->escapeIdentifier($mapping['table']);
$query = 'select * from '.$table;
}
return $this->getWorker()->findAll($query);
} | [
"public",
"function",
"findAll",
"(",
"$",
"query",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"query",
"===",
"null",
")",
"{",
"$",
"mapping",
"=",
"$",
"this",
"->",
"getMapping",
"(",
")",
";",
"$",
"table",
"=",
"$",
"this",
"->",
"escapeIdentifie... | Find all matching records and convert them to instances of the entity class.
@param string $query [optional] - SQL query with optional ORM syntax; without a query all instances are returned
@return PersistableObject[] | [
"Find",
"all",
"matching",
"records",
"and",
"convert",
"them",
"to",
"instances",
"of",
"the",
"entity",
"class",
"."
] | 9d27f93dd53d2d626c75c92cfde9d004bab34d30 | https://github.com/rosasurfer/ministruts/blob/9d27f93dd53d2d626c75c92cfde9d004bab34d30/src/db/orm/DAO.php#L88-L95 |
28,978 | rosasurfer/ministruts | src/db/orm/DAO.php | DAO.get | public function get($query, $allowMany = false) {
$result = $this->find($query, $allowMany);
if (!$result)
throw new NoSuchRecordException($query);
return $result;
} | php | public function get($query, $allowMany = false) {
$result = $this->find($query, $allowMany);
if (!$result)
throw new NoSuchRecordException($query);
return $result;
} | [
"public",
"function",
"get",
"(",
"$",
"query",
",",
"$",
"allowMany",
"=",
"false",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"find",
"(",
"$",
"query",
",",
"$",
"allowMany",
")",
";",
"if",
"(",
"!",
"$",
"result",
")",
"throw",
"new",
... | Get a single matching record and convert it to an instance of the entity class.
@param string $query - SQL query with optional ORM syntax
@param bool $allowMany [optional] - whether the query is allowed to return a multi-row result (default: no)
@return PersistableObject
@throws NoSuchRecordExcept... | [
"Get",
"a",
"single",
"matching",
"record",
"and",
"convert",
"it",
"to",
"an",
"instance",
"of",
"the",
"entity",
"class",
"."
] | 9d27f93dd53d2d626c75c92cfde9d004bab34d30 | https://github.com/rosasurfer/ministruts/blob/9d27f93dd53d2d626c75c92cfde9d004bab34d30/src/db/orm/DAO.php#L109-L114 |
28,979 | rosasurfer/ministruts | src/db/orm/DAO.php | DAO.transaction | public function transaction(\Closure $task) {
try {
$this->db()->begin();
$result = $task();
$this->db()->commit();
return $result;
}
catch (\Exception $ex) {
$this->db()->rollback();
throw $ex;
}
} | php | public function transaction(\Closure $task) {
try {
$this->db()->begin();
$result = $task();
$this->db()->commit();
return $result;
}
catch (\Exception $ex) {
$this->db()->rollback();
throw $ex;
}
} | [
"public",
"function",
"transaction",
"(",
"\\",
"Closure",
"$",
"task",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"db",
"(",
")",
"->",
"begin",
"(",
")",
";",
"$",
"result",
"=",
"$",
"task",
"(",
")",
";",
"$",
"this",
"->",
"db",
"(",
")",
... | Execute a task in a transactional way. The transaction is automatically committed or rolled back.
A nested transaction is executed in the context of the nesting transaction.
@param \Closure $task - task to execute (an anonymous function is implicitly casted)
@return mixed - the task's return value (if any) | [
"Execute",
"a",
"task",
"in",
"a",
"transactional",
"way",
".",
"The",
"transaction",
"is",
"automatically",
"committed",
"or",
"rolled",
"back",
".",
"A",
"nested",
"transaction",
"is",
"executed",
"in",
"the",
"context",
"of",
"the",
"nesting",
"transaction"... | 9d27f93dd53d2d626c75c92cfde9d004bab34d30 | https://github.com/rosasurfer/ministruts/blob/9d27f93dd53d2d626c75c92cfde9d004bab34d30/src/db/orm/DAO.php#L168-L179 |
28,980 | rosasurfer/ministruts | src/db/orm/DAO.php | DAO.getEntityMapping | public function getEntityMapping() {
if (!$this->entityMapping) {
$this->entityMapping = new EntityMapping($this->getMapping());
}
return $this->entityMapping;
} | php | public function getEntityMapping() {
if (!$this->entityMapping) {
$this->entityMapping = new EntityMapping($this->getMapping());
}
return $this->entityMapping;
} | [
"public",
"function",
"getEntityMapping",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"entityMapping",
")",
"{",
"$",
"this",
"->",
"entityMapping",
"=",
"new",
"EntityMapping",
"(",
"$",
"this",
"->",
"getMapping",
"(",
")",
")",
";",
"}",
"retu... | Return the object-oriented data mapping of the DAO's entity.
@return EntityMapping | [
"Return",
"the",
"object",
"-",
"oriented",
"data",
"mapping",
"of",
"the",
"DAO",
"s",
"entity",
"."
] | 9d27f93dd53d2d626c75c92cfde9d004bab34d30 | https://github.com/rosasurfer/ministruts/blob/9d27f93dd53d2d626c75c92cfde9d004bab34d30/src/db/orm/DAO.php#L286-L291 |
28,981 | rosasurfer/ministruts | src/db/orm/DAO.php | DAO.db | final public function db() {
if (!$this->connector) {
$this->connector = $this->getWorker()->getConnector();
}
return $this->connector;
} | php | final public function db() {
if (!$this->connector) {
$this->connector = $this->getWorker()->getConnector();
}
return $this->connector;
} | [
"final",
"public",
"function",
"db",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"connector",
")",
"{",
"$",
"this",
"->",
"connector",
"=",
"$",
"this",
"->",
"getWorker",
"(",
")",
"->",
"getConnector",
"(",
")",
";",
"}",
"return",
"$",
... | Return the database adapter used for the DAO's entity.
@return IConnector | [
"Return",
"the",
"database",
"adapter",
"used",
"for",
"the",
"DAO",
"s",
"entity",
"."
] | 9d27f93dd53d2d626c75c92cfde9d004bab34d30 | https://github.com/rosasurfer/ministruts/blob/9d27f93dd53d2d626c75c92cfde9d004bab34d30/src/db/orm/DAO.php#L309-L314 |
28,982 | hakito/PHP-Stuzza-EPS-BankTransfer | src/TransferInitiatorDetails.php | TransferInitiatorDetails.SetExpirationMinutes | public function SetExpirationMinutes($minutes)
{
if ($minutes < 5 || $minutes > 60)
throw new \InvalidArgumentException('Expiration minutes value of "' . $minutes . '" is not between 5 and 60.');
$expires = new \DateTime();
$expires->add(new \DateInterval('PT' . $minutes . 'M'))... | php | public function SetExpirationMinutes($minutes)
{
if ($minutes < 5 || $minutes > 60)
throw new \InvalidArgumentException('Expiration minutes value of "' . $minutes . '" is not between 5 and 60.');
$expires = new \DateTime();
$expires->add(new \DateInterval('PT' . $minutes . 'M'))... | [
"public",
"function",
"SetExpirationMinutes",
"(",
"$",
"minutes",
")",
"{",
"if",
"(",
"$",
"minutes",
"<",
"5",
"||",
"$",
"minutes",
">",
"60",
")",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Expiration minutes value of \"'",
".",
"$",
"minute... | Sets ExpirationTime by adding given amount of minutes to the current
timestamp.
@param int $minutes Must be between 5 and 60
@throws \InvalidArgumentException if minutes not between 5 and 60 | [
"Sets",
"ExpirationTime",
"by",
"adding",
"given",
"amount",
"of",
"minutes",
"to",
"the",
"current",
"timestamp",
"."
] | c2af496ecf4b9f095447a7b9f5c02d20924252bd | https://github.com/hakito/PHP-Stuzza-EPS-BankTransfer/blob/c2af496ecf4b9f095447a7b9f5c02d20924252bd/src/TransferInitiatorDetails.php#L135-L143 |
28,983 | timble/kodekit | code/dispatcher/behavior/decoratable.php | DispatcherBehaviorDecoratable.addDecorator | public function addDecorator($identifier, $prepend = false)
{
if($prepend) {
array_unshift($this->__decorators, $identifier);
} else {
array_push($this->__decorators, $identifier);
}
return $this;
} | php | public function addDecorator($identifier, $prepend = false)
{
if($prepend) {
array_unshift($this->__decorators, $identifier);
} else {
array_push($this->__decorators, $identifier);
}
return $this;
} | [
"public",
"function",
"addDecorator",
"(",
"$",
"identifier",
",",
"$",
"prepend",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"prepend",
")",
"{",
"array_unshift",
"(",
"$",
"this",
"->",
"__decorators",
",",
"$",
"identifier",
")",
";",
"}",
"else",
"{",... | Add a decorator
@param string $identifier The decorator identifier
@param bool $prepend If true, the decorator will be prepended instead of appended.
@return DispatcherBehaviorDecoratable | [
"Add",
"a",
"decorator"
] | 4c376f8873f8d10c55e3d290616ff622605cd246 | https://github.com/timble/kodekit/blob/4c376f8873f8d10c55e3d290616ff622605cd246/code/dispatcher/behavior/decoratable.php#L89-L98 |
28,984 | timble/kodekit | code/dispatcher/behavior/decoratable.php | DispatcherBehaviorDecoratable._beforeSend | protected function _beforeSend(DispatcherContext $context)
{
$response = $context->getResponse();
if(!$response->isDownloadable())
{
foreach ($this->getDecorators() as $decorator)
{
//Get the decorator
$config = array('response' =>... | php | protected function _beforeSend(DispatcherContext $context)
{
$response = $context->getResponse();
if(!$response->isDownloadable())
{
foreach ($this->getDecorators() as $decorator)
{
//Get the decorator
$config = array('response' =>... | [
"protected",
"function",
"_beforeSend",
"(",
"DispatcherContext",
"$",
"context",
")",
"{",
"$",
"response",
"=",
"$",
"context",
"->",
"getResponse",
"(",
")",
";",
"if",
"(",
"!",
"$",
"response",
"->",
"isDownloadable",
"(",
")",
")",
"{",
"foreach",
... | Render the decorators
This method will also add the 'decorator' filter to the view and add following default parameters
- component: The name of the component being dispatched
- language: The language of the response
- status: The status code of the response
@param DispatcherContext $context The active command con... | [
"Render",
"the",
"decorators"
] | 4c376f8873f8d10c55e3d290616ff622605cd246 | https://github.com/timble/kodekit/blob/4c376f8873f8d10c55e3d290616ff622605cd246/code/dispatcher/behavior/decoratable.php#L122-L160 |
28,985 | timble/kodekit | code/filesystem/locator/component.php | FilesystemLocatorComponent.getPathTemplates | public function getPathTemplates($url)
{
$templates = parent::getPathTemplates($url);
foreach($templates as $key => $template)
{
//Qualify relative path
if(substr($template, 0, 1) !== '/')
{
$bootstrapper = $this->getObject('object.bootstr... | php | public function getPathTemplates($url)
{
$templates = parent::getPathTemplates($url);
foreach($templates as $key => $template)
{
//Qualify relative path
if(substr($template, 0, 1) !== '/')
{
$bootstrapper = $this->getObject('object.bootstr... | [
"public",
"function",
"getPathTemplates",
"(",
"$",
"url",
")",
"{",
"$",
"templates",
"=",
"parent",
"::",
"getPathTemplates",
"(",
"$",
"url",
")",
";",
"foreach",
"(",
"$",
"templates",
"as",
"$",
"key",
"=>",
"$",
"template",
")",
"{",
"//Qualify rel... | Get the list of path templates
This method will qualify relative url's (url not starting with '/') by prepending the component base
path to the url. If the component has additional paths a template path for each will be inserted in
FIFO order.
@param string $url The language url
@return array The path templates | [
"Get",
"the",
"list",
"of",
"path",
"templates"
] | 4c376f8873f8d10c55e3d290616ff622605cd246 | https://github.com/timble/kodekit/blob/4c376f8873f8d10c55e3d290616ff622605cd246/code/filesystem/locator/component.php#L74-L101 |
28,986 | rosasurfer/ministruts | src/monitor/Dependency.php | Dependency.setMinValidity | public function setMinValidity($time) {
if (!is_int($time)) throw new IllegalTypeException('Illegal type of parameter $time: '.gettype($time));
if ($time < 0) throw new InvalidArgumentException('Invalid argument $time: '.$time);
$this->minValidity = $time;
return $this;
} | php | public function setMinValidity($time) {
if (!is_int($time)) throw new IllegalTypeException('Illegal type of parameter $time: '.gettype($time));
if ($time < 0) throw new InvalidArgumentException('Invalid argument $time: '.$time);
$this->minValidity = $time;
return $this;
} | [
"public",
"function",
"setMinValidity",
"(",
"$",
"time",
")",
"{",
"if",
"(",
"!",
"is_int",
"(",
"$",
"time",
")",
")",
"throw",
"new",
"IllegalTypeException",
"(",
"'Illegal type of parameter $time: '",
".",
"gettype",
"(",
"$",
"time",
")",
")",
";",
"... | Setzt die Mindestgueltigkeit dieser Abhaengigkeit.
@param int $time - Mindestgueltigkeit in Sekunden
@return Dependency | [
"Setzt",
"die",
"Mindestgueltigkeit",
"dieser",
"Abhaengigkeit",
"."
] | 9d27f93dd53d2d626c75c92cfde9d004bab34d30 | https://github.com/rosasurfer/ministruts/blob/9d27f93dd53d2d626c75c92cfde9d004bab34d30/src/monitor/Dependency.php#L103-L110 |
28,987 | timble/kodekit | code/command/callback/abstract.php | CommandCallbackAbstract.removeCommandCallback | public function removeCommandCallback($command, $method)
{
$command = strtolower($command);
if (isset($this->__command_callbacks[$command]) )
{
if($method instanceof \Closure) {
$index = spl_object_hash($method);
} else {
$index = $met... | php | public function removeCommandCallback($command, $method)
{
$command = strtolower($command);
if (isset($this->__command_callbacks[$command]) )
{
if($method instanceof \Closure) {
$index = spl_object_hash($method);
} else {
$index = $met... | [
"public",
"function",
"removeCommandCallback",
"(",
"$",
"command",
",",
"$",
"method",
")",
"{",
"$",
"command",
"=",
"strtolower",
"(",
"$",
"command",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"__command_callbacks",
"[",
"$",
"command",
"]... | Remove a callback
@param string $command The command to unregister the handler from
@param string|\Closure $method The name of the method or a Closure object to unregister
@return CommandCallbackAbstract | [
"Remove",
"a",
"callback"
] | 4c376f8873f8d10c55e3d290616ff622605cd246 | https://github.com/timble/kodekit/blob/4c376f8873f8d10c55e3d290616ff622605cd246/code/command/callback/abstract.php#L167-L183 |
28,988 | locomotivemtl/charcoal-core | src/Charcoal/Model/DescribableTrait.php | DescribableTrait.loadMetadata | public function loadMetadata($metadataIdent = null)
{
if ($metadataIdent === null) {
$metadataIdent = $this->metadataIdent();
}
$metadata = $this->metadataLoader()->load($metadataIdent, $this->metadataClass());
$this->setMetadata($metadata);
return $metadata;
... | php | public function loadMetadata($metadataIdent = null)
{
if ($metadataIdent === null) {
$metadataIdent = $this->metadataIdent();
}
$metadata = $this->metadataLoader()->load($metadataIdent, $this->metadataClass());
$this->setMetadata($metadata);
return $metadata;
... | [
"public",
"function",
"loadMetadata",
"(",
"$",
"metadataIdent",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"metadataIdent",
"===",
"null",
")",
"{",
"$",
"metadataIdent",
"=",
"$",
"this",
"->",
"metadataIdent",
"(",
")",
";",
"}",
"$",
"metadata",
"=",
"... | Load a metadata file and store it as a static var.
Use a `MetadataLoader` object and the object's metadataIdent
to load the metadata content (typically from the filesystem, as json).
@param string $metadataIdent Optional ident. If none is provided then it will use the auto-genereated one.
@return MetadataInterface | [
"Load",
"a",
"metadata",
"file",
"and",
"store",
"it",
"as",
"a",
"static",
"var",
"."
] | db3a7af547ccf96efe2d9be028b252bc8646f5d5 | https://github.com/locomotivemtl/charcoal-core/blob/db3a7af547ccf96efe2d9be028b252bc8646f5d5/src/Charcoal/Model/DescribableTrait.php#L85-L95 |
28,989 | locomotivemtl/charcoal-core | src/Charcoal/Model/DescribableTrait.php | DescribableTrait.metadataIdent | public function metadataIdent()
{
if ($this->metadataIdent === null) {
$this->metadataIdent = $this->generateMetadataIdent();
}
return $this->metadataIdent;
} | php | public function metadataIdent()
{
if ($this->metadataIdent === null) {
$this->metadataIdent = $this->generateMetadataIdent();
}
return $this->metadataIdent;
} | [
"public",
"function",
"metadataIdent",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"metadataIdent",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"metadataIdent",
"=",
"$",
"this",
"->",
"generateMetadataIdent",
"(",
")",
";",
"}",
"return",
"$",
"this",
... | Get the metadata ident, or generate it from class name if it was not set explicitly.
@return string | [
"Get",
"the",
"metadata",
"ident",
"or",
"generate",
"it",
"from",
"class",
"name",
"if",
"it",
"was",
"not",
"set",
"explicitly",
"."
] | db3a7af547ccf96efe2d9be028b252bc8646f5d5 | https://github.com/locomotivemtl/charcoal-core/blob/db3a7af547ccf96efe2d9be028b252bc8646f5d5/src/Charcoal/Model/DescribableTrait.php#L112-L118 |
28,990 | rosasurfer/ministruts | src/net/NetTools.php | NetTools.getHostByAddress | public static function getHostByAddress($ipAddress) {
if (!is_string($ipAddress)) throw new IllegalTypeException('Illegal type of parameter $ipAddress: '.gettype($ipAddress));
if ($ipAddress == '') throw new InvalidArgumentException('Invalid argument $ipAddress: "'.$ipAddress.'"');
$resul... | php | public static function getHostByAddress($ipAddress) {
if (!is_string($ipAddress)) throw new IllegalTypeException('Illegal type of parameter $ipAddress: '.gettype($ipAddress));
if ($ipAddress == '') throw new InvalidArgumentException('Invalid argument $ipAddress: "'.$ipAddress.'"');
$resul... | [
"public",
"static",
"function",
"getHostByAddress",
"(",
"$",
"ipAddress",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"ipAddress",
")",
")",
"throw",
"new",
"IllegalTypeException",
"(",
"'Illegal type of parameter $ipAddress: '",
".",
"gettype",
"(",
"$",
... | Return the host name of the Internet host specified by a given IP address. Additionally checks the result returned
by the built-in PHP function for plausibility.
@param string $ipAddress - the host IP address
@return string|bool - the host name on success, the unmodified IP address on failure, or FALSE on malformed ... | [
"Return",
"the",
"host",
"name",
"of",
"the",
"Internet",
"host",
"specified",
"by",
"a",
"given",
"IP",
"address",
".",
"Additionally",
"checks",
"the",
"result",
"returned",
"by",
"the",
"built",
"-",
"in",
"PHP",
"function",
"for",
"plausibility",
"."
] | 9d27f93dd53d2d626c75c92cfde9d004bab34d30 | https://github.com/rosasurfer/ministruts/blob/9d27f93dd53d2d626c75c92cfde9d004bab34d30/src/net/NetTools.php#L27-L37 |
28,991 | rosasurfer/ministruts | src/net/NetTools.php | NetTools.getHostByName | public static function getHostByName($name) {
if (!is_string($name)) throw new IllegalTypeException('Illegal type of parameter $name: '.gettype($name));
if ($name == '') throw new InvalidArgumentException('Invalid argument $name: "'.$name.'"');
return \gethostbyname($name);
} | php | public static function getHostByName($name) {
if (!is_string($name)) throw new IllegalTypeException('Illegal type of parameter $name: '.gettype($name));
if ($name == '') throw new InvalidArgumentException('Invalid argument $name: "'.$name.'"');
return \gethostbyname($name);
} | [
"public",
"static",
"function",
"getHostByName",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"name",
")",
")",
"throw",
"new",
"IllegalTypeException",
"(",
"'Illegal type of parameter $name: '",
".",
"gettype",
"(",
"$",
"name",
")",
"... | Gibt die IP-Adresse eines Hostnamens zurueck.
@param string $name - Hostname
@return string - IP-Adresse oder der originale Hostname, wenn dieser nicht aufgeloest werden kann | [
"Gibt",
"die",
"IP",
"-",
"Adresse",
"eines",
"Hostnamens",
"zurueck",
"."
] | 9d27f93dd53d2d626c75c92cfde9d004bab34d30 | https://github.com/rosasurfer/ministruts/blob/9d27f93dd53d2d626c75c92cfde9d004bab34d30/src/net/NetTools.php#L47-L52 |
28,992 | rosasurfer/ministruts | etc/phpstan/DynamicReturnType.php | DynamicReturnType.isMethodSupported | public function isMethodSupported(MethodReflection $methodReflection) : bool {
if (!static::$methodNames) throw new RuntimeException('The class property '.static::class.'::$methodNames must be defined.');
return in_array($methodReflection->getName(), static::$methodNames);
} | php | public function isMethodSupported(MethodReflection $methodReflection) : bool {
if (!static::$methodNames) throw new RuntimeException('The class property '.static::class.'::$methodNames must be defined.');
return in_array($methodReflection->getName(), static::$methodNames);
} | [
"public",
"function",
"isMethodSupported",
"(",
"MethodReflection",
"$",
"methodReflection",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"static",
"::",
"$",
"methodNames",
")",
"throw",
"new",
"RuntimeException",
"(",
"'The class property '",
".",
"static",
"::",
"c... | Whether the named instance method returns dynamic types.
@return bool | [
"Whether",
"the",
"named",
"instance",
"method",
"returns",
"dynamic",
"types",
"."
] | 9d27f93dd53d2d626c75c92cfde9d004bab34d30 | https://github.com/rosasurfer/ministruts/blob/9d27f93dd53d2d626c75c92cfde9d004bab34d30/etc/phpstan/DynamicReturnType.php#L45-L48 |
28,993 | rosasurfer/ministruts | etc/phpstan/DynamicReturnType.php | DynamicReturnType.isStaticMethodSupported | public function isStaticMethodSupported(MethodReflection $methodReflection) : bool {
if (!static::$methodNames) throw new RuntimeException('The class constant '.static::class.'::$methodNames must be defined.');
return in_array($methodReflection->getName(), static::$methodNames);
} | php | public function isStaticMethodSupported(MethodReflection $methodReflection) : bool {
if (!static::$methodNames) throw new RuntimeException('The class constant '.static::class.'::$methodNames must be defined.');
return in_array($methodReflection->getName(), static::$methodNames);
} | [
"public",
"function",
"isStaticMethodSupported",
"(",
"MethodReflection",
"$",
"methodReflection",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"static",
"::",
"$",
"methodNames",
")",
"throw",
"new",
"RuntimeException",
"(",
"'The class constant '",
".",
"static",
"::"... | Whether the named static method returns dynamic types.
@return bool | [
"Whether",
"the",
"named",
"static",
"method",
"returns",
"dynamic",
"types",
"."
] | 9d27f93dd53d2d626c75c92cfde9d004bab34d30 | https://github.com/rosasurfer/ministruts/blob/9d27f93dd53d2d626c75c92cfde9d004bab34d30/etc/phpstan/DynamicReturnType.php#L56-L59 |
28,994 | rosasurfer/ministruts | etc/phpstan/DynamicReturnType.php | DynamicReturnType.getScopeDescription | protected function getScopeDescription(Scope $scope) : string {
if ($scope->isInClass()) {
$description = $scope->getClassReflection()->getName();
if ($scope->getFunctionName()) $description .= '::'.$scope->getFunctionName().'()';
if ($scope->isInAnonymousFunction()) $d... | php | protected function getScopeDescription(Scope $scope) : string {
if ($scope->isInClass()) {
$description = $scope->getClassReflection()->getName();
if ($scope->getFunctionName()) $description .= '::'.$scope->getFunctionName().'()';
if ($scope->isInAnonymousFunction()) $d... | [
"protected",
"function",
"getScopeDescription",
"(",
"Scope",
"$",
"scope",
")",
":",
"string",
"{",
"if",
"(",
"$",
"scope",
"->",
"isInClass",
"(",
")",
")",
"{",
"$",
"description",
"=",
"$",
"scope",
"->",
"getClassReflection",
"(",
")",
"->",
"getNa... | Return a description of the passed scope.
@param Scope $scope
@return string - scope description | [
"Return",
"a",
"description",
"of",
"the",
"passed",
"scope",
"."
] | 9d27f93dd53d2d626c75c92cfde9d004bab34d30 | https://github.com/rosasurfer/ministruts/blob/9d27f93dd53d2d626c75c92cfde9d004bab34d30/etc/phpstan/DynamicReturnType.php#L69-L86 |
28,995 | rosasurfer/ministruts | src/ministruts/FrontController.php | FrontController.me | public static function me() {
if (CLI) throw new IllegalStateException('Can not use '.static::class.' in this context.');
$cache = Cache::me();
// cache hit?
$controller = $cache->get(static::class);
if (!$controller) {
// synchronize parsing of the struts-config.xm... | php | public static function me() {
if (CLI) throw new IllegalStateException('Can not use '.static::class.' in this context.');
$cache = Cache::me();
// cache hit?
$controller = $cache->get(static::class);
if (!$controller) {
// synchronize parsing of the struts-config.xm... | [
"public",
"static",
"function",
"me",
"(",
")",
"{",
"if",
"(",
"CLI",
")",
"throw",
"new",
"IllegalStateException",
"(",
"'Can not use '",
".",
"static",
"::",
"class",
".",
"' in this context.'",
")",
";",
"$",
"cache",
"=",
"Cache",
"::",
"me",
"(",
"... | Return the singleton instance of this class. The instance might be loaded from a cache.
@return static | [
"Return",
"the",
"singleton",
"instance",
"of",
"this",
"class",
".",
"The",
"instance",
"might",
"be",
"loaded",
"from",
"a",
"cache",
"."
] | 9d27f93dd53d2d626c75c92cfde9d004bab34d30 | https://github.com/rosasurfer/ministruts/blob/9d27f93dd53d2d626c75c92cfde9d004bab34d30/src/ministruts/FrontController.php#L41-L69 |
28,996 | rosasurfer/ministruts | src/ministruts/FrontController.php | FrontController.processRequest | public static function processRequest(array $options = []) {
$controller = self::me();
$request = Request::me();
$response = Response::me();
// select Module
$prefix = $controller->getModulePrefix($request);
$module = $controller->modules[$prefix];
$request-... | php | public static function processRequest(array $options = []) {
$controller = self::me();
$request = Request::me();
$response = Response::me();
// select Module
$prefix = $controller->getModulePrefix($request);
$module = $controller->modules[$prefix];
$request-... | [
"public",
"static",
"function",
"processRequest",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"controller",
"=",
"self",
"::",
"me",
"(",
")",
";",
"$",
"request",
"=",
"Request",
"::",
"me",
"(",
")",
";",
"$",
"response",
"=",
"Re... | Process the current HTTP request.
@param array $options [optional] - runtime options (default: none)
@return Response - respone wrapper | [
"Process",
"the",
"current",
"HTTP",
"request",
"."
] | 9d27f93dd53d2d626c75c92cfde9d004bab34d30 | https://github.com/rosasurfer/ministruts/blob/9d27f93dd53d2d626c75c92cfde9d004bab34d30/src/ministruts/FrontController.php#L124-L141 |
28,997 | deArcane/framework | src/Debugger/Blueprints/File/File.php | File.offsetGet | public function offsetGet($i){
$j = $i - 1; // becouse we counting lines form 0 not 1.
if( !isIndex($this->lines,$j) ){
(new Report('Blueprints/File/CantFindLine'))->stop();
}
// Add mark and sort all marks.
$this->marks[] = $j;
sort($this->marks);
return $this->lines[$j];
} | php | public function offsetGet($i){
$j = $i - 1; // becouse we counting lines form 0 not 1.
if( !isIndex($this->lines,$j) ){
(new Report('Blueprints/File/CantFindLine'))->stop();
}
// Add mark and sort all marks.
$this->marks[] = $j;
sort($this->marks);
return $this->lines[$j];
} | [
"public",
"function",
"offsetGet",
"(",
"$",
"i",
")",
"{",
"$",
"j",
"=",
"$",
"i",
"-",
"1",
";",
"// becouse we counting lines form 0 not 1.",
"if",
"(",
"!",
"isIndex",
"(",
"$",
"this",
"->",
"lines",
",",
"$",
"j",
")",
")",
"{",
"(",
"new",
... | ArrayAccess interface. | [
"ArrayAccess",
"interface",
"."
] | 468da43678119f8c9e3f67183b5bec727c436404 | https://github.com/deArcane/framework/blob/468da43678119f8c9e3f67183b5bec727c436404/src/Debugger/Blueprints/File/File.php#L143-L152 |
28,998 | rosasurfer/ministruts | src/Application.php | Application.configurePhp | protected function configurePhp() {
$memoryWarnLimit = php_byte_value(self::$defaultConfig->get('log.warn.memory_limit', 0));
if ($memoryWarnLimit > 0) {
register_shutdown_function(function() use ($memoryWarnLimit) {
$usedBytes = memory_get_peak_usage($real=true);
... | php | protected function configurePhp() {
$memoryWarnLimit = php_byte_value(self::$defaultConfig->get('log.warn.memory_limit', 0));
if ($memoryWarnLimit > 0) {
register_shutdown_function(function() use ($memoryWarnLimit) {
$usedBytes = memory_get_peak_usage($real=true);
... | [
"protected",
"function",
"configurePhp",
"(",
")",
"{",
"$",
"memoryWarnLimit",
"=",
"php_byte_value",
"(",
"self",
"::",
"$",
"defaultConfig",
"->",
"get",
"(",
"'log.warn.memory_limit'",
",",
"0",
")",
")",
";",
"if",
"(",
"$",
"memoryWarnLimit",
">",
"0",... | Update the PHP configuration with user defined settings. | [
"Update",
"the",
"PHP",
"configuration",
"with",
"user",
"defined",
"settings",
"."
] | 9d27f93dd53d2d626c75c92cfde9d004bab34d30 | https://github.com/rosasurfer/ministruts/blob/9d27f93dd53d2d626c75c92cfde9d004bab34d30/src/Application.php#L216-L246 |
28,999 | rosasurfer/ministruts | src/Application.php | Application.setupErrorHandling | protected function setupErrorHandling($value) {
$mode = ErrorHandler::THROW_EXCEPTIONS; // default
if (is_string($value)) {
$value = strtolower($value);
if ($value == 'weak' ) $mode = ErrorHandler::LOG_ERRORS;
else if ($value == 'ignore'... | php | protected function setupErrorHandling($value) {
$mode = ErrorHandler::THROW_EXCEPTIONS; // default
if (is_string($value)) {
$value = strtolower($value);
if ($value == 'weak' ) $mode = ErrorHandler::LOG_ERRORS;
else if ($value == 'ignore'... | [
"protected",
"function",
"setupErrorHandling",
"(",
"$",
"value",
")",
"{",
"$",
"mode",
"=",
"ErrorHandler",
"::",
"THROW_EXCEPTIONS",
";",
"// default",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"strtolower",
"(",
"$",
... | Setup the application's error handling.
@param string $value - configuration value as passed to the framework loader | [
"Setup",
"the",
"application",
"s",
"error",
"handling",
"."
] | 9d27f93dd53d2d626c75c92cfde9d004bab34d30 | https://github.com/rosasurfer/ministruts/blob/9d27f93dd53d2d626c75c92cfde9d004bab34d30/src/Application.php#L331-L340 |
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.