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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
3,300 | itephp/twig-bridge | src/TwigPresenter.php | TwigPresenter.displaySuccess | private function displaySuccess(Request $request,Response $response){
$data=$response->getContent();
if($data==null){
$data=array();
}
$controllerName=str_replace('\\', '/', $request->getConfig()->getValue('class'));
$methodName=$request->getConfig()->getValue('method... | php | private function displaySuccess(Request $request,Response $response){
$data=$response->getContent();
if($data==null){
$data=array();
}
$controllerName=str_replace('\\', '/', $request->getConfig()->getValue('class'));
$methodName=$request->getConfig()->getValue('method... | [
"private",
"function",
"displaySuccess",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
")",
"{",
"$",
"data",
"=",
"$",
"response",
"->",
"getContent",
"(",
")",
";",
"if",
"(",
"$",
"data",
"==",
"null",
")",
"{",
"$",
"data",
"=... | Support status code 2XX.
@param Request $request
@param Response $response | [
"Support",
"status",
"code",
"2XX",
"."
] | 0a0193baa9689977a97c48eee7750a8982692475 | https://github.com/itephp/twig-bridge/blob/0a0193baa9689977a97c48eee7750a8982692475/src/TwigPresenter.php#L95-L103 |
3,301 | itephp/twig-bridge | src/TwigPresenter.php | TwigPresenter.displayError | private function displayError(Request $request,Response $response){
$exception=$response->getContent();
$data=array(
'statusCode'=>$response->getStatusCode()
,'message'=>$exception->getMessage()
,'exception'=>get_class($exception)
,'file'=>$exception->getFile()
... | php | private function displayError(Request $request,Response $response){
$exception=$response->getContent();
$data=array(
'statusCode'=>$response->getStatusCode()
,'message'=>$exception->getMessage()
,'exception'=>get_class($exception)
,'file'=>$exception->getFile()
... | [
"private",
"function",
"displayError",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
")",
"{",
"$",
"exception",
"=",
"$",
"response",
"->",
"getContent",
"(",
")",
";",
"$",
"data",
"=",
"array",
"(",
"'statusCode'",
"=>",
"$",
"resp... | Support status code 4XX-5XX.
@param Request $request
@param Response $response | [
"Support",
"status",
"code",
"4XX",
"-",
"5XX",
"."
] | 0a0193baa9689977a97c48eee7750a8982692475 | https://github.com/itephp/twig-bridge/blob/0a0193baa9689977a97c48eee7750a8982692475/src/TwigPresenter.php#L111-L128 |
3,302 | ricardoh/wurfl-php-api | WURFL/Handlers/CatchAllHandler.php | WURFL_Handlers_CatchAllHandler.applyConclusiveMatch | public function applyConclusiveMatch($userAgent) {
$deviceId = WURFL_Constants::GENERIC;
if (WURFL_Handlers_Utils::checkIfStartsWith($userAgent, 'Mozilla')) {
$deviceId = $this->applyMozillaConclusiveMatch($userAgent);
} else {
$tolerance = WURFL_Handlers_Utils::firstSlash($userAgent);
$deviceId = $this-... | php | public function applyConclusiveMatch($userAgent) {
$deviceId = WURFL_Constants::GENERIC;
if (WURFL_Handlers_Utils::checkIfStartsWith($userAgent, 'Mozilla')) {
$deviceId = $this->applyMozillaConclusiveMatch($userAgent);
} else {
$tolerance = WURFL_Handlers_Utils::firstSlash($userAgent);
$deviceId = $this-... | [
"public",
"function",
"applyConclusiveMatch",
"(",
"$",
"userAgent",
")",
"{",
"$",
"deviceId",
"=",
"WURFL_Constants",
"::",
"GENERIC",
";",
"if",
"(",
"WURFL_Handlers_Utils",
"::",
"checkIfStartsWith",
"(",
"$",
"userAgent",
",",
"'Mozilla'",
")",
")",
"{",
... | If UA starts with Mozilla, apply LD with tollerance 5.
If UA does not start with Mozilla, apply RIS on FS
@param string $userAgent
@return string | [
"If",
"UA",
"starts",
"with",
"Mozilla",
"apply",
"LD",
"with",
"tollerance",
"5",
".",
"If",
"UA",
"does",
"not",
"start",
"with",
"Mozilla",
"apply",
"RIS",
"on",
"FS"
] | 1aa6c8af5b4c34ce3b37407c5eeb6fb41e5f3546 | https://github.com/ricardoh/wurfl-php-api/blob/1aa6c8af5b4c34ce3b37407c5eeb6fb41e5f3546/WURFL/Handlers/CatchAllHandler.php#L59-L69 |
3,303 | codebobbly/dvoconnector | Classes/Service/PluginConfigurationService.php | PluginConfigurationService.user_templateLayout | public function user_templateLayout(array &$config)
{
$pageId = 0;
$currentColPos = $config['flexParentDatabaseRow']['colPos'];
$pageId = $this->getPageId($config['flexParentDatabaseRow']['pid']);
if ($pageId > 0) {
$templateLayouts = $this->templateLayoutsUtility->getAva... | php | public function user_templateLayout(array &$config)
{
$pageId = 0;
$currentColPos = $config['flexParentDatabaseRow']['colPos'];
$pageId = $this->getPageId($config['flexParentDatabaseRow']['pid']);
if ($pageId > 0) {
$templateLayouts = $this->templateLayoutsUtility->getAva... | [
"public",
"function",
"user_templateLayout",
"(",
"array",
"&",
"$",
"config",
")",
"{",
"$",
"pageId",
"=",
"0",
";",
"$",
"currentColPos",
"=",
"$",
"config",
"[",
"'flexParentDatabaseRow'",
"]",
"[",
"'colPos'",
"]",
";",
"$",
"pageId",
"=",
"$",
"thi... | Itemsproc function to extend the selection of templateLayouts in the plugin
@param array &$config configuration array | [
"Itemsproc",
"function",
"to",
"extend",
"the",
"selection",
"of",
"templateLayouts",
"in",
"the",
"plugin"
] | 9b63790d2fc9fd21bf415b4a5757678895b73bbc | https://github.com/codebobbly/dvoconnector/blob/9b63790d2fc9fd21bf415b4a5757678895b73bbc/Classes/Service/PluginConfigurationService.php#L145-L161 |
3,304 | codebobbly/dvoconnector | Classes/Service/PluginConfigurationService.php | PluginConfigurationService.reduceTemplateLayouts | protected function reduceTemplateLayouts($templateLayouts, $currentColPos)
{
$currentColPos = (int)$currentColPos;
$restrictions = [];
$allLayouts = [];
foreach ($templateLayouts as $key => $layout) {
if (is_array($layout[0])) {
if (isset($layout[0]['allow... | php | protected function reduceTemplateLayouts($templateLayouts, $currentColPos)
{
$currentColPos = (int)$currentColPos;
$restrictions = [];
$allLayouts = [];
foreach ($templateLayouts as $key => $layout) {
if (is_array($layout[0])) {
if (isset($layout[0]['allow... | [
"protected",
"function",
"reduceTemplateLayouts",
"(",
"$",
"templateLayouts",
",",
"$",
"currentColPos",
")",
"{",
"$",
"currentColPos",
"=",
"(",
"int",
")",
"$",
"currentColPos",
";",
"$",
"restrictions",
"=",
"[",
"]",
";",
"$",
"allLayouts",
"=",
"[",
... | Reduce the template layouts by the ones that are not allowed in given colPos
@param array $templateLayouts
@param int $currentColPos
@return array | [
"Reduce",
"the",
"template",
"layouts",
"by",
"the",
"ones",
"that",
"are",
"not",
"allowed",
"in",
"given",
"colPos"
] | 9b63790d2fc9fd21bf415b4a5757678895b73bbc | https://github.com/codebobbly/dvoconnector/blob/9b63790d2fc9fd21bf415b4a5757678895b73bbc/Classes/Service/PluginConfigurationService.php#L170-L193 |
3,305 | codebobbly/dvoconnector | Classes/Service/PluginConfigurationService.php | PluginConfigurationService.getPageId | protected function getPageId($pid)
{
$pid = (int)$pid;
if ($pid > 0) {
return $pid;
}
$row = BackendUtilityCore::getRecord('tt_content', abs($pid), 'uid,pid');
return $row['pid'];
} | php | protected function getPageId($pid)
{
$pid = (int)$pid;
if ($pid > 0) {
return $pid;
}
$row = BackendUtilityCore::getRecord('tt_content', abs($pid), 'uid,pid');
return $row['pid'];
} | [
"protected",
"function",
"getPageId",
"(",
"$",
"pid",
")",
"{",
"$",
"pid",
"=",
"(",
"int",
")",
"$",
"pid",
";",
"if",
"(",
"$",
"pid",
">",
"0",
")",
"{",
"return",
"$",
"pid",
";",
"}",
"$",
"row",
"=",
"BackendUtilityCore",
"::",
"getRecord... | Get page id, if negative, then it is a "after record"
@param int $pid
@return int | [
"Get",
"page",
"id",
"if",
"negative",
"then",
"it",
"is",
"a",
"after",
"record"
] | 9b63790d2fc9fd21bf415b4a5757678895b73bbc | https://github.com/codebobbly/dvoconnector/blob/9b63790d2fc9fd21bf415b4a5757678895b73bbc/Classes/Service/PluginConfigurationService.php#L201-L209 |
3,306 | routegroup/file-factory | src/Image.php | Image.resolution | public function resolution($width = null, $height = null)
{
return [
'width' => $width ?: $this->widths[array_rand($this->widths)],
'height' => $height ?: $this->heights[array_rand($this->heights)]
];
} | php | public function resolution($width = null, $height = null)
{
return [
'width' => $width ?: $this->widths[array_rand($this->widths)],
'height' => $height ?: $this->heights[array_rand($this->heights)]
];
} | [
"public",
"function",
"resolution",
"(",
"$",
"width",
"=",
"null",
",",
"$",
"height",
"=",
"null",
")",
"{",
"return",
"[",
"'width'",
"=>",
"$",
"width",
"?",
":",
"$",
"this",
"->",
"widths",
"[",
"array_rand",
"(",
"$",
"this",
"->",
"widths",
... | Resolve resolution.
@param integer|null $width
@param integer|null $height
@return array | [
"Resolve",
"resolution",
"."
] | 09c7e45b6f070a7e9492b7a6185caa7aef20b5e3 | https://github.com/routegroup/file-factory/blob/09c7e45b6f070a7e9492b7a6185caa7aef20b5e3/src/Image.php#L77-L83 |
3,307 | themichaelhall/bluemvc-core | src/Response.php | Response.output | public function output(): void
{
header('HTTP/1.1 ' . $this->getStatusCode());
// Output headers.
foreach ($this->getHeaders() as $headerName => $headerValue) {
header($headerName . ': ' . $headerValue);
}
// Set cookies.
foreach ($this->getCookies() as ... | php | public function output(): void
{
header('HTTP/1.1 ' . $this->getStatusCode());
// Output headers.
foreach ($this->getHeaders() as $headerName => $headerValue) {
header($headerName . ': ' . $headerValue);
}
// Set cookies.
foreach ($this->getCookies() as ... | [
"public",
"function",
"output",
"(",
")",
":",
"void",
"{",
"header",
"(",
"'HTTP/1.1 '",
".",
"$",
"this",
"->",
"getStatusCode",
"(",
")",
")",
";",
"// Output headers.",
"foreach",
"(",
"$",
"this",
"->",
"getHeaders",
"(",
")",
"as",
"$",
"headerName... | Outputs the content.
@since 1.0.0 | [
"Outputs",
"the",
"content",
"."
] | cbc8ccf8ed4f15ec6105837b29c2bd3db3f93680 | https://github.com/themichaelhall/bluemvc-core/blob/cbc8ccf8ed4f15ec6105837b29c2bd3db3f93680/src/Response.php#L36-L61 |
3,308 | cundd/test-flight | src/Definition/AbstractCodeDefinition.php | AbstractCodeDefinition.getPreProcessedCode | public function getPreProcessedCode(): string
{
$code = $this->getCode();
$filePath = $this->getFilePath();
$code = str_replace(
'__FILE__',
"'" . $filePath . "'",
$code
);
$code = str_replace(
'__DIR__',
"'" . dirn... | php | public function getPreProcessedCode(): string
{
$code = $this->getCode();
$filePath = $this->getFilePath();
$code = str_replace(
'__FILE__',
"'" . $filePath . "'",
$code
);
$code = str_replace(
'__DIR__',
"'" . dirn... | [
"public",
"function",
"getPreProcessedCode",
"(",
")",
":",
"string",
"{",
"$",
"code",
"=",
"$",
"this",
"->",
"getCode",
"(",
")",
";",
"$",
"filePath",
"=",
"$",
"this",
"->",
"getFilePath",
"(",
")",
";",
"$",
"code",
"=",
"str_replace",
"(",
"'_... | Returns the pre-processed code
@return string | [
"Returns",
"the",
"pre",
"-",
"processed",
"code"
] | 9d8424dfb586f823f9dad2dcb81ff3986e255d56 | https://github.com/cundd/test-flight/blob/9d8424dfb586f823f9dad2dcb81ff3986e255d56/src/Definition/AbstractCodeDefinition.php#L54-L91 |
3,309 | PublisherHub/Publisher | src/Publisher/Helper/Validator.php | Validator.checkRequiredParametersAreSet | static function checkRequiredParametersAreSet(array $given, array $required)
{
foreach ($required as $key) {
if (empty($given[$key])) {
throw new MissingRequiredParameterException(
"Missing required parameter '$key'"
);
}... | php | static function checkRequiredParametersAreSet(array $given, array $required)
{
foreach ($required as $key) {
if (empty($given[$key])) {
throw new MissingRequiredParameterException(
"Missing required parameter '$key'"
);
}... | [
"static",
"function",
"checkRequiredParametersAreSet",
"(",
"array",
"$",
"given",
",",
"array",
"$",
"required",
")",
"{",
"foreach",
"(",
"$",
"required",
"as",
"$",
"key",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"given",
"[",
"$",
"key",
"]",
")",
... | Validates if all required parameters are set.
@param array $given
@param array $required contains required keys | [
"Validates",
"if",
"all",
"required",
"parameters",
"are",
"set",
"."
] | 954e05118be9956e0c8631e44958af4ba42606b3 | https://github.com/PublisherHub/Publisher/blob/954e05118be9956e0c8631e44958af4ba42606b3/src/Publisher/Helper/Validator.php#L38-L47 |
3,310 | PublisherHub/Publisher | src/Publisher/Helper/Validator.php | Validator.checkAnyRequiredParameter | static function checkAnyRequiredParameter(array $given, array $required)
{
try {
foreach ($required as $key) {
if (!empty($given[$key])) {
throw new RequiredParameterFound();
}
}
$para... | php | static function checkAnyRequiredParameter(array $given, array $required)
{
try {
foreach ($required as $key) {
if (!empty($given[$key])) {
throw new RequiredParameterFound();
}
}
$para... | [
"static",
"function",
"checkAnyRequiredParameter",
"(",
"array",
"$",
"given",
",",
"array",
"$",
"required",
")",
"{",
"try",
"{",
"foreach",
"(",
"$",
"required",
"as",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"given",
"[",
"$",
"ke... | Validates if any required parameters are set and not empty.
@param array $given
@param array $required contains required keys | [
"Validates",
"if",
"any",
"required",
"parameters",
"are",
"set",
"and",
"not",
"empty",
"."
] | 954e05118be9956e0c8631e44958af4ba42606b3 | https://github.com/PublisherHub/Publisher/blob/954e05118be9956e0c8631e44958af4ba42606b3/src/Publisher/Helper/Validator.php#L55-L73 |
3,311 | PublisherHub/Publisher | src/Publisher/Helper/Validator.php | Validator.checkRequiredParameters | static function checkRequiredParameters(array $given, array $required)
{
foreach ($required as $key) {
if (!array_key_exists($key, $given)) {
throw new MissingRequiredParameterException(
"Missing required parameter '$key'"
);
... | php | static function checkRequiredParameters(array $given, array $required)
{
foreach ($required as $key) {
if (!array_key_exists($key, $given)) {
throw new MissingRequiredParameterException(
"Missing required parameter '$key'"
);
... | [
"static",
"function",
"checkRequiredParameters",
"(",
"array",
"$",
"given",
",",
"array",
"$",
"required",
")",
"{",
"foreach",
"(",
"$",
"required",
"as",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"given",
"... | Validates if all required parameters are present.
@param array $given
@param array $required contains required keys
@throws MissingRequiredParameterException
@return void | [
"Validates",
"if",
"all",
"required",
"parameters",
"are",
"present",
"."
] | 954e05118be9956e0c8631e44958af4ba42606b3 | https://github.com/PublisherHub/Publisher/blob/954e05118be9956e0c8631e44958af4ba42606b3/src/Publisher/Helper/Validator.php#L85-L94 |
3,312 | freialib/fenrir.tools | src/Dispatcher/Http.php | HttpDispatcher.get | function get($route, callable $controller) {
if ($this->request->requestMethod() == 'get') {
$this->any($route, $controller);
}
} | php | function get($route, callable $controller) {
if ($this->request->requestMethod() == 'get') {
$this->any($route, $controller);
}
} | [
"function",
"get",
"(",
"$",
"route",
",",
"callable",
"$",
"controller",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"request",
"->",
"requestMethod",
"(",
")",
"==",
"'get'",
")",
"{",
"$",
"this",
"->",
"any",
"(",
"$",
"route",
",",
"$",
"controlle... | HTTP 1.1 GET method | [
"HTTP",
"1",
".",
"1",
"GET",
"method"
] | 3e6359103a640bd2fcb9708d6874fb0aeebbf7c5 | https://github.com/freialib/fenrir.tools/blob/3e6359103a640bd2fcb9708d6874fb0aeebbf7c5/src/Dispatcher/Http.php#L77-L81 |
3,313 | freialib/fenrir.tools | src/Dispatcher/Http.php | HttpDispatcher.post | function post($route, callable $controller) {
if ($this->request->requestMethod() == 'post') {
$this->any($route, $controller);
}
} | php | function post($route, callable $controller) {
if ($this->request->requestMethod() == 'post') {
$this->any($route, $controller);
}
} | [
"function",
"post",
"(",
"$",
"route",
",",
"callable",
"$",
"controller",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"request",
"->",
"requestMethod",
"(",
")",
"==",
"'post'",
")",
"{",
"$",
"this",
"->",
"any",
"(",
"$",
"route",
",",
"$",
"control... | HTTP 1.1 POST method | [
"HTTP",
"1",
".",
"1",
"POST",
"method"
] | 3e6359103a640bd2fcb9708d6874fb0aeebbf7c5 | https://github.com/freialib/fenrir.tools/blob/3e6359103a640bd2fcb9708d6874fb0aeebbf7c5/src/Dispatcher/Http.php#L86-L90 |
3,314 | oal/babble | src/Models/Record.php | Record.save | public function save(array $data)
{
if (!$this->getModel()->isSingle()) {
$id = $data['id'] ?? $this->id;
$this->id = $id;
}
$columns = $this->data;
foreach ($columns as $key => $column) {
if (array_key_exists($key, $data)) {
$colu... | php | public function save(array $data)
{
if (!$this->getModel()->isSingle()) {
$id = $data['id'] ?? $this->id;
$this->id = $id;
}
$columns = $this->data;
foreach ($columns as $key => $column) {
if (array_key_exists($key, $data)) {
$colu... | [
"public",
"function",
"save",
"(",
"array",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getModel",
"(",
")",
"->",
"isSingle",
"(",
")",
")",
"{",
"$",
"id",
"=",
"$",
"data",
"[",
"'id'",
"]",
"??",
"$",
"this",
"->",
"id",
";... | Validates and saves record to disk.
@param array $data | [
"Validates",
"and",
"saves",
"record",
"to",
"disk",
"."
] | 5a352d12ead6341294747831b0dfce097a0215e7 | https://github.com/oal/babble/blob/5a352d12ead6341294747831b0dfce097a0215e7/src/Models/Record.php#L39-L59 |
3,315 | oal/babble | src/Models/Record.php | Record.getValue | public function getValue(string $column)
{
if ($column === 'id') return $this->id;
return $this->data[$column]->getValue();
} | php | public function getValue(string $column)
{
if ($column === 'id') return $this->id;
return $this->data[$column]->getValue();
} | [
"public",
"function",
"getValue",
"(",
"string",
"$",
"column",
")",
"{",
"if",
"(",
"$",
"column",
"===",
"'id'",
")",
"return",
"$",
"this",
"->",
"id",
";",
"return",
"$",
"this",
"->",
"data",
"[",
"$",
"column",
"]",
"->",
"getValue",
"(",
")"... | Returns the value of a column.
@param string $column
@return mixed | [
"Returns",
"the",
"value",
"of",
"a",
"column",
"."
] | 5a352d12ead6341294747831b0dfce097a0215e7 | https://github.com/oal/babble/blob/5a352d12ead6341294747831b0dfce097a0215e7/src/Models/Record.php#L88-L92 |
3,316 | YiMAproject/yima-base | src/yimaBase/Mvc/Listener/DispatchListener.php | DispatchListener.complete | protected function complete($return, MvcEvent $event)
{
if (!is_object($return)) {
if (ArrayUtils::hasStringKeys($return)) {
$return = new ArrayObject($return, ArrayObject::ARRAY_AS_PROPS);
}
}
$event->setResult($return);
return $return;
} | php | protected function complete($return, MvcEvent $event)
{
if (!is_object($return)) {
if (ArrayUtils::hasStringKeys($return)) {
$return = new ArrayObject($return, ArrayObject::ARRAY_AS_PROPS);
}
}
$event->setResult($return);
return $return;
} | [
"protected",
"function",
"complete",
"(",
"$",
"return",
",",
"MvcEvent",
"$",
"event",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"return",
")",
")",
"{",
"if",
"(",
"ArrayUtils",
"::",
"hasStringKeys",
"(",
"$",
"return",
")",
")",
"{",
"$",
... | Complete the dispatch
@param mixed $return
@param MvcEvent $event
@return mixed | [
"Complete",
"the",
"dispatch"
] | 1dc91a3b5f0794e586f43808f52ae8d8cfa2633f | https://github.com/YiMAproject/yima-base/blob/1dc91a3b5f0794e586f43808f52ae8d8cfa2633f/src/yimaBase/Mvc/Listener/DispatchListener.php#L110-L120 |
3,317 | CodeCollab/I18n | src/FileTranslator.php | FileTranslator.translate | public function translate(string $key, array $data = []): string
{
if (!array_key_exists($key, $this->texts)) {
return '{{' . $key . '}}';
}
if (empty($data)) {
return $this->texts[$key];
}
return call_user_func_array('sprintf', array_merge([$this->t... | php | public function translate(string $key, array $data = []): string
{
if (!array_key_exists($key, $this->texts)) {
return '{{' . $key . '}}';
}
if (empty($data)) {
return $this->texts[$key];
}
return call_user_func_array('sprintf', array_merge([$this->t... | [
"public",
"function",
"translate",
"(",
"string",
"$",
"key",
",",
"array",
"$",
"data",
"=",
"[",
"]",
")",
":",
"string",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"texts",
")",
")",
"{",
"return",
"'{{'",
... | Gets the translation by key if any or a placeholder otherwise
@param string $key The translation key for which to find the translation
@param array $data Extra data to use in the translated string as variables
@return string The translation or a placeholder when no translation is available | [
"Gets",
"the",
"translation",
"by",
"key",
"if",
"any",
"or",
"a",
"placeholder",
"otherwise"
] | 04bd46bab83f42fadab53ff0d043365cc6c80301 | https://github.com/CodeCollab/I18n/blob/04bd46bab83f42fadab53ff0d043365cc6c80301/src/FileTranslator.php#L68-L79 |
3,318 | crisu83/yii-caviar | src/components/File.php | File.save | public function save()
{
$dir = dirname($this->path);
if (!is_dir($dir)) {
$mask = @umask(0);
$result = @mkdir($dir, $this->dirMode, true);
@umask($mask);
if (!$result) {
throw new Exception("Unable to create the directory '$dir'.");
... | php | public function save()
{
$dir = dirname($this->path);
if (!is_dir($dir)) {
$mask = @umask(0);
$result = @mkdir($dir, $this->dirMode, true);
@umask($mask);
if (!$result) {
throw new Exception("Unable to create the directory '$dir'.");
... | [
"public",
"function",
"save",
"(",
")",
"{",
"$",
"dir",
"=",
"dirname",
"(",
"$",
"this",
"->",
"path",
")",
";",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"dir",
")",
")",
"{",
"$",
"mask",
"=",
"@",
"umask",
"(",
"0",
")",
";",
"$",
"result",
... | Saves this file.
@return boolean whether the file was saved successfully.
@throws \crisu83\yii_caviar\Exception if the file or the directory cannot be created. | [
"Saves",
"this",
"file",
"."
] | c85286b88e68558224e7f2ea7fff8f6975e46283 | https://github.com/crisu83/yii-caviar/blob/c85286b88e68558224e7f2ea7fff8f6975e46283/src/components/File.php#L59-L82 |
3,319 | crisu83/yii-caviar | src/components/File.php | File.resolveExtension | public function resolveExtension()
{
if (($pos = strrpos($this->path, '.')) !== false) {
return substr($this->path, $pos + 1);
}
return '';
} | php | public function resolveExtension()
{
if (($pos = strrpos($this->path, '.')) !== false) {
return substr($this->path, $pos + 1);
}
return '';
} | [
"public",
"function",
"resolveExtension",
"(",
")",
"{",
"if",
"(",
"(",
"$",
"pos",
"=",
"strrpos",
"(",
"$",
"this",
"->",
"path",
",",
"'.'",
")",
")",
"!==",
"false",
")",
"{",
"return",
"substr",
"(",
"$",
"this",
"->",
"path",
",",
"$",
"po... | Returns the extension for this file.
@return string extension. | [
"Returns",
"the",
"extension",
"for",
"this",
"file",
"."
] | c85286b88e68558224e7f2ea7fff8f6975e46283 | https://github.com/crisu83/yii-caviar/blob/c85286b88e68558224e7f2ea7fff8f6975e46283/src/components/File.php#L89-L96 |
3,320 | twister-php/twister | src/DatePeriod.php | DatePeriod.setStartTimezone | public function setStartTimezone($timezone = 'UTC')
{
$this->start->setTimezone(is_string($timezone) ? new \DateTimeZone($timezone) : $timezone);
return $this;
} | php | public function setStartTimezone($timezone = 'UTC')
{
$this->start->setTimezone(is_string($timezone) ? new \DateTimeZone($timezone) : $timezone);
return $this;
} | [
"public",
"function",
"setStartTimezone",
"(",
"$",
"timezone",
"=",
"'UTC'",
")",
"{",
"$",
"this",
"->",
"start",
"->",
"setTimezone",
"(",
"is_string",
"(",
"$",
"timezone",
")",
"?",
"new",
"\\",
"DateTimeZone",
"(",
"$",
"timezone",
")",
":",
"$",
... | Sets the start date timezone
@link http://php.net/manual/en/datetime.settimezone.php
@param string|DateTimeZone $timezone
@return $this | [
"Sets",
"the",
"start",
"date",
"timezone"
] | c06ea2650331faf11590c017c850dc5f0bbc5c13 | https://github.com/twister-php/twister/blob/c06ea2650331faf11590c017c850dc5f0bbc5c13/src/DatePeriod.php#L836-L840 |
3,321 | twister-php/twister | src/DatePeriod.php | DatePeriod.setEndTimezone | public function setEndTimezone($timezone = 'UTC')
{
$this->end->setTimezone(is_string($timezone) ? new \DateTimeZone($timezone) : $timezone);
return $this;
} | php | public function setEndTimezone($timezone = 'UTC')
{
$this->end->setTimezone(is_string($timezone) ? new \DateTimeZone($timezone) : $timezone);
return $this;
} | [
"public",
"function",
"setEndTimezone",
"(",
"$",
"timezone",
"=",
"'UTC'",
")",
"{",
"$",
"this",
"->",
"end",
"->",
"setTimezone",
"(",
"is_string",
"(",
"$",
"timezone",
")",
"?",
"new",
"\\",
"DateTimeZone",
"(",
"$",
"timezone",
")",
":",
"$",
"ti... | Sets the end date timezone
@link http://php.net/manual/en/datetime.settimezone.php
@param string|DateTimeZone $timezone
@return $this | [
"Sets",
"the",
"end",
"date",
"timezone"
] | c06ea2650331faf11590c017c850dc5f0bbc5c13 | https://github.com/twister-php/twister/blob/c06ea2650331faf11590c017c850dc5f0bbc5c13/src/DatePeriod.php#L850-L854 |
3,322 | zepi/turbo-base | Zepi/Core/AccessControl/src/Manager/EventAccessManager.php | EventAccessManager.loadItems | protected function loadItems()
{
$items = $this->eventAccessObjectBackend->loadObject();
if (!is_array($items)) {
$items = array();
}
$this->items = $items;
} | php | protected function loadItems()
{
$items = $this->eventAccessObjectBackend->loadObject();
if (!is_array($items)) {
$items = array();
}
$this->items = $items;
} | [
"protected",
"function",
"loadItems",
"(",
")",
"{",
"$",
"items",
"=",
"$",
"this",
"->",
"eventAccessObjectBackend",
"->",
"loadObject",
"(",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"items",
")",
")",
"{",
"$",
"items",
"=",
"array",
"(",
"... | Loads the items from the object backend
@access public | [
"Loads",
"the",
"items",
"from",
"the",
"object",
"backend"
] | 9a36d8c7649317f55f91b2adf386bd1f04ec02a3 | https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Core/AccessControl/src/Manager/EventAccessManager.php#L85-L93 |
3,323 | zepi/turbo-base | Zepi/Core/AccessControl/src/Manager/EventAccessManager.php | EventAccessManager.addItem | public function addItem($eventName, $accessLevel)
{
if (!isset($this->items[$eventName])) {
$this->items[$eventName] = array();
}
if (in_array($accessLevel, $this->items[$eventName])) {
return;
}
// Add the definition
$this->i... | php | public function addItem($eventName, $accessLevel)
{
if (!isset($this->items[$eventName])) {
$this->items[$eventName] = array();
}
if (in_array($accessLevel, $this->items[$eventName])) {
return;
}
// Add the definition
$this->i... | [
"public",
"function",
"addItem",
"(",
"$",
"eventName",
",",
"$",
"accessLevel",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"items",
"[",
"$",
"eventName",
"]",
")",
")",
"{",
"$",
"this",
"->",
"items",
"[",
"$",
"eventName",
"]",
... | Adds the access levels for the event name
@access public
@param string $eventName
@param string $accessLevel | [
"Adds",
"the",
"access",
"levels",
"for",
"the",
"event",
"name"
] | 9a36d8c7649317f55f91b2adf386bd1f04ec02a3 | https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Core/AccessControl/src/Manager/EventAccessManager.php#L112-L127 |
3,324 | zepi/turbo-base | Zepi/Core/AccessControl/src/Manager/EventAccessManager.php | EventAccessManager.removeItems | public function removeItems($eventName)
{
if (!isset($this->items[$eventName])) {
return false;
}
// Remove the event
unset($this->items[$eventName]);
// Save the items
$this->saveItems();
} | php | public function removeItems($eventName)
{
if (!isset($this->items[$eventName])) {
return false;
}
// Remove the event
unset($this->items[$eventName]);
// Save the items
$this->saveItems();
} | [
"public",
"function",
"removeItems",
"(",
"$",
"eventName",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"items",
"[",
"$",
"eventName",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"// Remove the event",
"unset",
"(",
"$",
"this",
... | Removes all access levels for the given event name.
@access public
@param string $eventName
@return false|void | [
"Removes",
"all",
"access",
"levels",
"for",
"the",
"given",
"event",
"name",
"."
] | 9a36d8c7649317f55f91b2adf386bd1f04ec02a3 | https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Core/AccessControl/src/Manager/EventAccessManager.php#L136-L147 |
3,325 | zepi/turbo-base | Zepi/Core/AccessControl/src/Manager/EventAccessManager.php | EventAccessManager.getAccessLevelsForEvent | public function getAccessLevelsForEvent($eventName)
{
if (!isset($this->items[$eventName])) {
return false;
}
return $this->items[$eventName];
} | php | public function getAccessLevelsForEvent($eventName)
{
if (!isset($this->items[$eventName])) {
return false;
}
return $this->items[$eventName];
} | [
"public",
"function",
"getAccessLevelsForEvent",
"(",
"$",
"eventName",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"items",
"[",
"$",
"eventName",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->",
"items",
... | Returns the access levels for the given event name
or false if the event name is not set.
@param string $eventName
@return false|array | [
"Returns",
"the",
"access",
"levels",
"for",
"the",
"given",
"event",
"name",
"or",
"false",
"if",
"the",
"event",
"name",
"is",
"not",
"set",
"."
] | 9a36d8c7649317f55f91b2adf386bd1f04ec02a3 | https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Core/AccessControl/src/Manager/EventAccessManager.php#L167-L174 |
3,326 | RodinVasily/core | src/Core/Collection/AbstractNamedCollection.php | AbstractNamedCollection.getByName | public function getByName($name, $throwException = true)
{
foreach ($this as $element) {
if (!$element instanceof Element\NamedElement) {
throw new Exception\CollectionException();
}
if ($element->getName() === $name) {
return $element;
... | php | public function getByName($name, $throwException = true)
{
foreach ($this as $element) {
if (!$element instanceof Element\NamedElement) {
throw new Exception\CollectionException();
}
if ($element->getName() === $name) {
return $element;
... | [
"public",
"function",
"getByName",
"(",
"$",
"name",
",",
"$",
"throwException",
"=",
"true",
")",
"{",
"foreach",
"(",
"$",
"this",
"as",
"$",
"element",
")",
"{",
"if",
"(",
"!",
"$",
"element",
"instanceof",
"Element",
"\\",
"NamedElement",
")",
"{"... | Get element by name
@param string $name
@param bool $throwException
@throws Exception\CollectionException
@throws Exception\NotFoundException
@return Element\NamedElement|null | [
"Get",
"element",
"by",
"name"
] | 1c0d5d7a55a1076409035df1d3b0c8bb11b137db | https://github.com/RodinVasily/core/blob/1c0d5d7a55a1076409035df1d3b0c8bb11b137db/src/Core/Collection/AbstractNamedCollection.php#L45-L63 |
3,327 | marando/phpSOFA | src/Marando/IAU/iauApio13.php | iauApio13.Apio13 | public static function Apio13($utc1, $utc2, $dut1, $elong, $phi, $hm, $xp,
$yp, $phpa, $tc, $rh, $wl, iauASTROM &$astrom) {
$j;
$tai1;
$tai2;
$tt1;
$tt2;
$ut11;
$ut12;
$sp;
$theta;
$refa;
$refb;
/* UTC to other time scales. */
$j = IAU::Utctai($utc1, $utc2... | php | public static function Apio13($utc1, $utc2, $dut1, $elong, $phi, $hm, $xp,
$yp, $phpa, $tc, $rh, $wl, iauASTROM &$astrom) {
$j;
$tai1;
$tai2;
$tt1;
$tt2;
$ut11;
$ut12;
$sp;
$theta;
$refa;
$refb;
/* UTC to other time scales. */
$j = IAU::Utctai($utc1, $utc2... | [
"public",
"static",
"function",
"Apio13",
"(",
"$",
"utc1",
",",
"$",
"utc2",
",",
"$",
"dut1",
",",
"$",
"elong",
",",
"$",
"phi",
",",
"$",
"hm",
",",
"$",
"xp",
",",
"$",
"yp",
",",
"$",
"phpa",
",",
"$",
"tc",
",",
"$",
"rh",
",",
"$",
... | - - - - - - - - - -
i a u A p i o 1 3
- - - - - - - - - -
For a terrestrial observer, prepare star-independent astrometry
parameters for transformations between CIRS and observed
coordinates. The caller supplies UTC, site coordinates, ambient air
conditions and observing wavelength.
This function is part of the Inte... | [
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"i",
"a",
"u",
"A",
"p",
"i",
"o",
"1",
"3",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-"
] | 757fa49fe335ae1210eaa7735473fd4388b13f07 | https://github.com/marando/phpSOFA/blob/757fa49fe335ae1210eaa7735473fd4388b13f07/src/Marando/IAU/iauApio13.php#L176-L216 |
3,328 | indigophp-archive/fuel-core | lib/Fuel/Orm/Observer/UpdatedBy.php | UpdatedBy.before_update | public function before_update(Orm\Model $obj)
{
// If there are any relations loop through and check if any of them have been changed
$relation_changed = false;
foreach ($this->_relations as $relation)
{
if ($this->relation_changed($obj, $relation))
{
$relation_changed = true;
break;
}
}
... | php | public function before_update(Orm\Model $obj)
{
// If there are any relations loop through and check if any of them have been changed
$relation_changed = false;
foreach ($this->_relations as $relation)
{
if ($this->relation_changed($obj, $relation))
{
$relation_changed = true;
break;
}
}
... | [
"public",
"function",
"before_update",
"(",
"Orm",
"\\",
"Model",
"$",
"obj",
")",
"{",
"// If there are any relations loop through and check if any of them have been changed",
"$",
"relation_changed",
"=",
"false",
";",
"foreach",
"(",
"$",
"this",
"->",
"_relations",
... | Sets the UpdatedBy property to the current user id
@param Model Model object subject of this observer method | [
"Sets",
"the",
"UpdatedBy",
"property",
"to",
"the",
"current",
"user",
"id"
] | 275462154fb7937f8e1c2c541b31d8e7c5760e39 | https://github.com/indigophp-archive/fuel-core/blob/275462154fb7937f8e1c2c541b31d8e7c5760e39/lib/Fuel/Orm/Observer/UpdatedBy.php#L75-L93 |
3,329 | JumpGateio/ViewResolution | src/JumpGate/ViewResolution/Traits/AutoResolvesViews.php | AutoResolvesViews.view | public function view($view = null, $layout = null)
{
$layoutOptions = $this->getLayoutOptions($layout);
// Set up the default view resolution
viewResolver()->setUp($layoutOptions, $view);
$this->setupLayout();
} | php | public function view($view = null, $layout = null)
{
$layoutOptions = $this->getLayoutOptions($layout);
// Set up the default view resolution
viewResolver()->setUp($layoutOptions, $view);
$this->setupLayout();
} | [
"public",
"function",
"view",
"(",
"$",
"view",
"=",
"null",
",",
"$",
"layout",
"=",
"null",
")",
"{",
"$",
"layoutOptions",
"=",
"$",
"this",
"->",
"getLayoutOptions",
"(",
"$",
"layout",
")",
";",
"// Set up the default view resolution",
"viewResolver",
"... | Find the view for the called method.
@param null|string $view
@param null|string $layout
@return $this | [
"Find",
"the",
"view",
"for",
"the",
"called",
"method",
"."
] | 49339e160db55876ca2a8fbe15bb3e26148b33f2 | https://github.com/JumpGateio/ViewResolution/blob/49339e160db55876ca2a8fbe15bb3e26148b33f2/src/JumpGate/ViewResolution/Traits/AutoResolvesViews.php#L20-L27 |
3,330 | JumpGateio/ViewResolution | src/JumpGate/ViewResolution/Traits/AutoResolvesViews.php | AutoResolvesViews.getLayoutOptions | protected function getLayoutOptions($layout)
{
// If passed a layout, use that for any request.
if (! is_null($layout)) {
return [
'default' => $layout,
'ajax' => $layout,
];
}
// If a set of layout options is defined, use t... | php | protected function getLayoutOptions($layout)
{
// If passed a layout, use that for any request.
if (! is_null($layout)) {
return [
'default' => $layout,
'ajax' => $layout,
];
}
// If a set of layout options is defined, use t... | [
"protected",
"function",
"getLayoutOptions",
"(",
"$",
"layout",
")",
"{",
"// If passed a layout, use that for any request.",
"if",
"(",
"!",
"is_null",
"(",
"$",
"layout",
")",
")",
"{",
"return",
"[",
"'default'",
"=>",
"$",
"layout",
",",
"'ajax'",
"=>",
"... | Get an array of layout options if available.
@param null|string $layout
@return array|null | [
"Get",
"an",
"array",
"of",
"layout",
"options",
"if",
"available",
"."
] | 49339e160db55876ca2a8fbe15bb3e26148b33f2 | https://github.com/JumpGateio/ViewResolution/blob/49339e160db55876ca2a8fbe15bb3e26148b33f2/src/JumpGate/ViewResolution/Traits/AutoResolvesViews.php#L36-L53 |
3,331 | AnonymPHP/Anonym-Library | src/Anonym/Console/Application.php | Application.getProviders | public function getProviders()
{
$providers = Arr::get($this->getGeneral(), 'providers', []);
$routeId = array_search(RouteProvider::class, $providers);
unset($providers[$routeId]);
return array_merge($this->constructors, $providers);
} | php | public function getProviders()
{
$providers = Arr::get($this->getGeneral(), 'providers', []);
$routeId = array_search(RouteProvider::class, $providers);
unset($providers[$routeId]);
return array_merge($this->constructors, $providers);
} | [
"public",
"function",
"getProviders",
"(",
")",
"{",
"$",
"providers",
"=",
"Arr",
"::",
"get",
"(",
"$",
"this",
"->",
"getGeneral",
"(",
")",
",",
"'providers'",
",",
"[",
"]",
")",
";",
"$",
"routeId",
"=",
"array_search",
"(",
"RouteProvider",
"::"... | Return the providers without routing
@return array | [
"Return",
"the",
"providers",
"without",
"routing"
] | c967ad804f84e8fb204593a0959cda2fed5ae075 | https://github.com/AnonymPHP/Anonym-Library/blob/c967ad804f84e8fb204593a0959cda2fed5ae075/src/Anonym/Console/Application.php#L38-L45 |
3,332 | webforge-labs/webforge-utils | src/php/Webforge/Common/DateTime/Time.php | Time.formatSpan | public static function formatSpan($timespan, $format = '%Y years %M Months %D days %I Minutes %S seconds %H hours %n milliseconds') {
$dv = Time::getDateInterval($timespan);
return $dv->format($format);
} | php | public static function formatSpan($timespan, $format = '%Y years %M Months %D days %I Minutes %S seconds %H hours %n milliseconds') {
$dv = Time::getDateInterval($timespan);
return $dv->format($format);
} | [
"public",
"static",
"function",
"formatSpan",
"(",
"$",
"timespan",
",",
"$",
"format",
"=",
"'%Y years %M Months %D days %I Minutes %S seconds %H hours %n milliseconds'",
")",
"{",
"$",
"dv",
"=",
"Time",
"::",
"getDateInterval",
"(",
"$",
"timespan",
")",
";",
"re... | Formatiert eine Zeitspanne in Sekunden in einen String
@param float $timespan in Sekunden
@param string $format http://de2.php.net/manual/de/dateinterval.format.php
@return string | [
"Formatiert",
"eine",
"Zeitspanne",
"in",
"Sekunden",
"in",
"einen",
"String"
] | a476eeec046c22ad91794b0ab9fe15a1d3f92bfc | https://github.com/webforge-labs/webforge-utils/blob/a476eeec046c22ad91794b0ab9fe15a1d3f92bfc/src/php/Webforge/Common/DateTime/Time.php#L14-L18 |
3,333 | ekyna/Characteristics | Doctrine/Listener/AbstractMapsSubscriber.php | AbstractMapsSubscriber.loadClassMetadata | public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)
{
$metadata = $eventArgs->getClassMetadata();
if ($metadata->getName() === self::ROOT_CHARACTERISTICS_CLASS) {
$metadata->setDiscriminatorMap($this->characteristicsClassesMap);
}
} | php | public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)
{
$metadata = $eventArgs->getClassMetadata();
if ($metadata->getName() === self::ROOT_CHARACTERISTICS_CLASS) {
$metadata->setDiscriminatorMap($this->characteristicsClassesMap);
}
} | [
"public",
"function",
"loadClassMetadata",
"(",
"LoadClassMetadataEventArgs",
"$",
"eventArgs",
")",
"{",
"$",
"metadata",
"=",
"$",
"eventArgs",
"->",
"getClassMetadata",
"(",
")",
";",
"if",
"(",
"$",
"metadata",
"->",
"getName",
"(",
")",
"===",
"self",
"... | Sets the discriminator maps on AbstractCharacteristics entity mappings.
@param LoadClassMetadataEventArgs $eventArgs | [
"Sets",
"the",
"discriminator",
"maps",
"on",
"AbstractCharacteristics",
"entity",
"mappings",
"."
] | 118a349fd98a7c28721d3cbaba67ce79d1cffada | https://github.com/ekyna/Characteristics/blob/118a349fd98a7c28721d3cbaba67ce79d1cffada/Doctrine/Listener/AbstractMapsSubscriber.php#L39-L46 |
3,334 | silverstripe-modular-project/silverstripe-links | code/models/Link.php | Link.getLinkType | public function getLinkType()
{
$types = $this->config()->get('types');
return isset($types[$this->Type]) ? _t('Links.TYPE'.strtoupper($this->Type), $types[$this->Type]) : null;
} | php | public function getLinkType()
{
$types = $this->config()->get('types');
return isset($types[$this->Type]) ? _t('Links.TYPE'.strtoupper($this->Type), $types[$this->Type]) : null;
} | [
"public",
"function",
"getLinkType",
"(",
")",
"{",
"$",
"types",
"=",
"$",
"this",
"->",
"config",
"(",
")",
"->",
"get",
"(",
"'types'",
")",
";",
"return",
"isset",
"(",
"$",
"types",
"[",
"$",
"this",
"->",
"Type",
"]",
")",
"?",
"_t",
"(",
... | Gets the description label of this links type
@return string | [
"Gets",
"the",
"description",
"label",
"of",
"this",
"links",
"type"
] | a52c9768197cc5dce68a402badaa05cc96aff691 | https://github.com/silverstripe-modular-project/silverstripe-links/blob/a52c9768197cc5dce68a402badaa05cc96aff691/code/models/Link.php#L412-L416 |
3,335 | diatem-net/jin-filesystem | src/FileSystem/IniFile.php | IniFile.get | public function get($cle, $errorIfNotExists = false)
{
if (is_null($this->values)) {
return null;
} else if (array_key_exists($cle, $this->values)) {
return $this->values[$cle];
} else {
if ($errorIfNotExists){
throw new \Exception('La clé '.$cle.' n\'existe pas dans le f... | php | public function get($cle, $errorIfNotExists = false)
{
if (is_null($this->values)) {
return null;
} else if (array_key_exists($cle, $this->values)) {
return $this->values[$cle];
} else {
if ($errorIfNotExists){
throw new \Exception('La clé '.$cle.' n\'existe pas dans le f... | [
"public",
"function",
"get",
"(",
"$",
"cle",
",",
"$",
"errorIfNotExists",
"=",
"false",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"values",
")",
")",
"{",
"return",
"null",
";",
"}",
"else",
"if",
"(",
"array_key_exists",
"(",
"$",
... | Lit une valeur
@param string $cle Clé
@param boolean $errorIfNotExists (optional) Génère une exception si la clé n'existe pas
@return null | [
"Lit",
"une",
"valeur"
] | 0a97844284ca48cb47e28ef2834f20b8a42ef798 | https://github.com/diatem-net/jin-filesystem/blob/0a97844284ca48cb47e28ef2834f20b8a42ef798/src/FileSystem/IniFile.php#L67-L80 |
3,336 | nattreid/security | src/User.php | User.setNamespace | public function setNamespace(string $namespace): void
{
$storage = $this->getStorage();
if ($storage instanceof UserStorage) {
$storage->setNamespace($namespace);
}
$this->initIdentity();
} | php | public function setNamespace(string $namespace): void
{
$storage = $this->getStorage();
if ($storage instanceof UserStorage) {
$storage->setNamespace($namespace);
}
$this->initIdentity();
} | [
"public",
"function",
"setNamespace",
"(",
"string",
"$",
"namespace",
")",
":",
"void",
"{",
"$",
"storage",
"=",
"$",
"this",
"->",
"getStorage",
"(",
")",
";",
"if",
"(",
"$",
"storage",
"instanceof",
"UserStorage",
")",
"{",
"$",
"storage",
"->",
"... | Nastavi namespace pro autentizaci
@param string $namespace | [
"Nastavi",
"namespace",
"pro",
"autentizaci"
] | ed649e5bdf453cea2d5352e643dbf201193de01d | https://github.com/nattreid/security/blob/ed649e5bdf453cea2d5352e643dbf201193de01d/src/User.php#L111-L118 |
3,337 | nattreid/security | src/User.php | User.isMobile | public function isMobile(bool $tablet = true): bool
{
$session = $this->session->getSection('user');
if ($tablet) {
return $session->isMobile;
} else {
return $session->isMobile && !$session->isTablet;
}
} | php | public function isMobile(bool $tablet = true): bool
{
$session = $this->session->getSection('user');
if ($tablet) {
return $session->isMobile;
} else {
return $session->isMobile && !$session->isTablet;
}
} | [
"public",
"function",
"isMobile",
"(",
"bool",
"$",
"tablet",
"=",
"true",
")",
":",
"bool",
"{",
"$",
"session",
"=",
"$",
"this",
"->",
"session",
"->",
"getSection",
"(",
"'user'",
")",
";",
"if",
"(",
"$",
"tablet",
")",
"{",
"return",
"$",
"se... | Je klientsky prohlizec mobilni verze?
@param bool $tablet patri do skupiny i tablety
@return bool | [
"Je",
"klientsky",
"prohlizec",
"mobilni",
"verze?"
] | ed649e5bdf453cea2d5352e643dbf201193de01d | https://github.com/nattreid/security/blob/ed649e5bdf453cea2d5352e643dbf201193de01d/src/User.php#L169-L178 |
3,338 | nattreid/security | src/User.php | User.getUid | public function getUid(): string
{
$uid = $this->request->getCookie(self::TRACKING_COOKIE);
if (empty($uid)) {
$charList = 'a-f0-9';
$uid = Random::generate(8, $charList);
$uid .= "-" . Random::generate(4, $charList);
$uid .= "-5" . Random::generate(3, $charList);
$uid .= "-" . Random::generate(4, $... | php | public function getUid(): string
{
$uid = $this->request->getCookie(self::TRACKING_COOKIE);
if (empty($uid)) {
$charList = 'a-f0-9';
$uid = Random::generate(8, $charList);
$uid .= "-" . Random::generate(4, $charList);
$uid .= "-5" . Random::generate(3, $charList);
$uid .= "-" . Random::generate(4, $... | [
"public",
"function",
"getUid",
"(",
")",
":",
"string",
"{",
"$",
"uid",
"=",
"$",
"this",
"->",
"request",
"->",
"getCookie",
"(",
"self",
"::",
"TRACKING_COOKIE",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"uid",
")",
")",
"{",
"$",
"charList",
"="... | Vrati uzivatelske uid
@return string | [
"Vrati",
"uzivatelske",
"uid"
] | ed649e5bdf453cea2d5352e643dbf201193de01d | https://github.com/nattreid/security/blob/ed649e5bdf453cea2d5352e643dbf201193de01d/src/User.php#L184-L198 |
3,339 | Hexmedia/Content-Bundle | Entity/Gallery.php | Gallery.addMedia | public function addMedia(Media $media)
{
$this->media[] = $media;
$media->addGallery($this);
return $this;
} | php | public function addMedia(Media $media)
{
$this->media[] = $media;
$media->addGallery($this);
return $this;
} | [
"public",
"function",
"addMedia",
"(",
"Media",
"$",
"media",
")",
"{",
"$",
"this",
"->",
"media",
"[",
"]",
"=",
"$",
"media",
";",
"$",
"media",
"->",
"addGallery",
"(",
"$",
"this",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Add media to gallery
@param Media $media
@return Gallery | [
"Add",
"media",
"to",
"gallery"
] | 04d2d61bec0051e8553b4abc7299d9f7e10aae82 | https://github.com/Hexmedia/Content-Bundle/blob/04d2d61bec0051e8553b4abc7299d9f7e10aae82/Entity/Gallery.php#L201-L207 |
3,340 | puli/asset-plugin | src/Api/Installer/InstallerDescriptor.php | InstallerDescriptor.match | public function match(Expression $expr)
{
return $expr->evaluate(array(
self::NAME => $this->name,
self::CLASS_NAME => $this->className,
self::DESCRIPTION => $this->description,
));
} | php | public function match(Expression $expr)
{
return $expr->evaluate(array(
self::NAME => $this->name,
self::CLASS_NAME => $this->className,
self::DESCRIPTION => $this->description,
));
} | [
"public",
"function",
"match",
"(",
"Expression",
"$",
"expr",
")",
"{",
"return",
"$",
"expr",
"->",
"evaluate",
"(",
"array",
"(",
"self",
"::",
"NAME",
"=>",
"$",
"this",
"->",
"name",
",",
"self",
"::",
"CLASS_NAME",
"=>",
"$",
"this",
"->",
"cla... | Returns whether the installer matches the given expression.
@param Expression $expr The search criteria. You can use the fields
{@link NAME}, {@link CLASS_NAME} and
{@link DESCRIPTION} in the expression.
@return bool Returns `true` if the installer matches the expression and
`false` otherwise. | [
"Returns",
"whether",
"the",
"installer",
"matches",
"the",
"given",
"expression",
"."
] | f36c4a403a2173aced54376690a399884cde2627 | https://github.com/puli/asset-plugin/blob/f36c4a403a2173aced54376690a399884cde2627/src/Api/Installer/InstallerDescriptor.php#L271-L278 |
3,341 | flavorzyb/simple | src/Database/Db.php | Db.createPdo | protected function createPdo(array $config)
{
$dsn = $this->getHostDsn($config);
$userName = (isset($config['username']) ? $config['username'] : null);
$password = (isset($config['password']) ? $config['password'] : null);
$options = $this->getPdoOptions($config);
... | php | protected function createPdo(array $config)
{
$dsn = $this->getHostDsn($config);
$userName = (isset($config['username']) ? $config['username'] : null);
$password = (isset($config['password']) ? $config['password'] : null);
$options = $this->getPdoOptions($config);
... | [
"protected",
"function",
"createPdo",
"(",
"array",
"$",
"config",
")",
"{",
"$",
"dsn",
"=",
"$",
"this",
"->",
"getHostDsn",
"(",
"$",
"config",
")",
";",
"$",
"userName",
"=",
"(",
"isset",
"(",
"$",
"config",
"[",
"'username'",
"]",
")",
"?",
"... | create a pdo instance
@param array $config
@return PDO
@throws \PDOException | [
"create",
"a",
"pdo",
"instance"
] | 8c4c539ae2057217b2637fc72c2a90ba266e8e6c | https://github.com/flavorzyb/simple/blob/8c4c539ae2057217b2637fc72c2a90ba266e8e6c/src/Database/Db.php#L169-L177 |
3,342 | flavorzyb/simple | src/Database/Db.php | Db.initOptions | protected function initOptions(PDO $pdo)
{
// set time zone
if (isset($this->config['timezone']))
{
$pdo->prepare('set time_zone="' . $this->config['timezone'] . '"')->execute();
}
//set charset
if (isset($this->config['charset']))
{
$... | php | protected function initOptions(PDO $pdo)
{
// set time zone
if (isset($this->config['timezone']))
{
$pdo->prepare('set time_zone="' . $this->config['timezone'] . '"')->execute();
}
//set charset
if (isset($this->config['charset']))
{
$... | [
"protected",
"function",
"initOptions",
"(",
"PDO",
"$",
"pdo",
")",
"{",
"// set time zone",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"config",
"[",
"'timezone'",
"]",
")",
")",
"{",
"$",
"pdo",
"->",
"prepare",
"(",
"'set time_zone=\"'",
".",
"$",
... | init pdo connection options after instance
@param PDO $pdo
@return PDO | [
"init",
"pdo",
"connection",
"options",
"after",
"instance"
] | 8c4c539ae2057217b2637fc72c2a90ba266e8e6c | https://github.com/flavorzyb/simple/blob/8c4c539ae2057217b2637fc72c2a90ba266e8e6c/src/Database/Db.php#L184-L205 |
3,343 | flavorzyb/simple | src/Database/Db.php | Db.getPdo | public function getPdo($name)
{
if (!isset($this->connections[$name])) {
$name = $this->defaultPdoName;
}
if (isset($this->pdoArray[$name])) {
return $this->pdoArray[$name];
}
$pdo = $this->createPdo($this->connections[$name]);
... | php | public function getPdo($name)
{
if (!isset($this->connections[$name])) {
$name = $this->defaultPdoName;
}
if (isset($this->pdoArray[$name])) {
return $this->pdoArray[$name];
}
$pdo = $this->createPdo($this->connections[$name]);
... | [
"public",
"function",
"getPdo",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"connections",
"[",
"$",
"name",
"]",
")",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"defaultPdoName",
";",
"}",
"if",
"(",
"isset",... | get pdo connection by name
@param string $name
@return PDO
@throws DbException | [
"get",
"pdo",
"connection",
"by",
"name"
] | 8c4c539ae2057217b2637fc72c2a90ba266e8e6c | https://github.com/flavorzyb/simple/blob/8c4c539ae2057217b2637fc72c2a90ba266e8e6c/src/Database/Db.php#L214-L227 |
3,344 | flavorzyb/simple | src/Database/Db.php | Db.usePdo | public function usePdo($name)
{
if (!isset($this->connections[$name])) {
$name = $this->defaultPdoName;
}
$pdo = $this->getPdo($name);
$this->setActivePdo($pdo);
} | php | public function usePdo($name)
{
if (!isset($this->connections[$name])) {
$name = $this->defaultPdoName;
}
$pdo = $this->getPdo($name);
$this->setActivePdo($pdo);
} | [
"public",
"function",
"usePdo",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"connections",
"[",
"$",
"name",
"]",
")",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"defaultPdoName",
";",
"}",
"$",
"pdo",
"=",
... | use pdo connection by name
@param string $name
@throws DbException | [
"use",
"pdo",
"connection",
"by",
"name"
] | 8c4c539ae2057217b2637fc72c2a90ba266e8e6c | https://github.com/flavorzyb/simple/blob/8c4c539ae2057217b2637fc72c2a90ba266e8e6c/src/Database/Db.php#L265-L273 |
3,345 | flavorzyb/simple | src/Database/Db.php | Db.disconnect | public function disconnect($name)
{
if (isset($this->pdoArray[$name])) {
$pdo = $this->pdoArray[$name];
if ($this->activePdo == $pdo) {
$this->activePdo = null;
}
unset($this->pdoArray[$name]);
}
} | php | public function disconnect($name)
{
if (isset($this->pdoArray[$name])) {
$pdo = $this->pdoArray[$name];
if ($this->activePdo == $pdo) {
$this->activePdo = null;
}
unset($this->pdoArray[$name]);
}
} | [
"public",
"function",
"disconnect",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"pdoArray",
"[",
"$",
"name",
"]",
")",
")",
"{",
"$",
"pdo",
"=",
"$",
"this",
"->",
"pdoArray",
"[",
"$",
"name",
"]",
";",
"if",
"(",... | disconnect pdo by name
@param string $name
@throws DbException | [
"disconnect",
"pdo",
"by",
"name"
] | 8c4c539ae2057217b2637fc72c2a90ba266e8e6c | https://github.com/flavorzyb/simple/blob/8c4c539ae2057217b2637fc72c2a90ba266e8e6c/src/Database/Db.php#L290-L300 |
3,346 | flavorzyb/simple | src/Database/Db.php | Db.reconnect | public function reconnect($name)
{
if (isset($this->connections[$name])) {
$this->disconnect($name);
$this->usePdo($name);
}
} | php | public function reconnect($name)
{
if (isset($this->connections[$name])) {
$this->disconnect($name);
$this->usePdo($name);
}
} | [
"public",
"function",
"reconnect",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"connections",
"[",
"$",
"name",
"]",
")",
")",
"{",
"$",
"this",
"->",
"disconnect",
"(",
"$",
"name",
")",
";",
"$",
"this",
"->",
"usePd... | reconnect pdo by name
@param string $name
@throws DbException | [
"reconnect",
"pdo",
"by",
"name"
] | 8c4c539ae2057217b2637fc72c2a90ba266e8e6c | https://github.com/flavorzyb/simple/blob/8c4c539ae2057217b2637fc72c2a90ba266e8e6c/src/Database/Db.php#L308-L314 |
3,347 | PSchwisow/phergie-irc-plugin-react-altnick | src/Plugin.php | Plugin.handleEvent | public function handleEvent(Event $event, Queue $queue)
{
$iterator = $this->getIterator($event->getConnection());
if (!$iterator->valid()) {
$queue->ircQuit('All specified alternate nicks are in use');
return;
}
if ($this->recovery && $this->primaryNick ===... | php | public function handleEvent(Event $event, Queue $queue)
{
$iterator = $this->getIterator($event->getConnection());
if (!$iterator->valid()) {
$queue->ircQuit('All specified alternate nicks are in use');
return;
}
if ($this->recovery && $this->primaryNick ===... | [
"public",
"function",
"handleEvent",
"(",
"Event",
"$",
"event",
",",
"Queue",
"$",
"queue",
")",
"{",
"$",
"iterator",
"=",
"$",
"this",
"->",
"getIterator",
"(",
"$",
"event",
"->",
"getConnection",
"(",
")",
")",
";",
"if",
"(",
"!",
"$",
"iterato... | Nick is in use, pick another.
@param \Phergie\Irc\Event\EventInterface $event
@param \Phergie\Irc\Bot\React\EventQueueInterface $queue | [
"Nick",
"is",
"in",
"use",
"pick",
"another",
"."
] | 112b692cbbf9242450cc8caf073f6c021db29fba | https://github.com/PSchwisow/phergie-irc-plugin-react-altnick/blob/112b692cbbf9242450cc8caf073f6c021db29fba/src/Plugin.php#L134-L155 |
3,348 | PSchwisow/phergie-irc-plugin-react-altnick | src/Plugin.php | Plugin.handleQuit | public function handleQuit(UserEvent $event, Queue $queue)
{
$nick = $event->getNick();
if ($this->primaryNick !== null && $nick == $this->primaryNick) {
$this->logger->debug("[AltNick] '$nick' disconnected, switching to primary nick");
$queue->ircNick($this->primaryNick);
... | php | public function handleQuit(UserEvent $event, Queue $queue)
{
$nick = $event->getNick();
if ($this->primaryNick !== null && $nick == $this->primaryNick) {
$this->logger->debug("[AltNick] '$nick' disconnected, switching to primary nick");
$queue->ircNick($this->primaryNick);
... | [
"public",
"function",
"handleQuit",
"(",
"UserEvent",
"$",
"event",
",",
"Queue",
"$",
"queue",
")",
"{",
"$",
"nick",
"=",
"$",
"event",
"->",
"getNick",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"primaryNick",
"!==",
"null",
"&&",
"$",
"nick",
... | Handle primary nick recovery.
@param \Phergie\Irc\Event\UserEventInterface $event
@param \Phergie\Irc\Bot\React\EventQueueInterface $queue | [
"Handle",
"primary",
"nick",
"recovery",
"."
] | 112b692cbbf9242450cc8caf073f6c021db29fba | https://github.com/PSchwisow/phergie-irc-plugin-react-altnick/blob/112b692cbbf9242450cc8caf073f6c021db29fba/src/Plugin.php#L163-L171 |
3,349 | Kylob/Pagination | src/Component.php | Component.set | public function set($page = 'page', $limit = 10, $url = null)
{
if (is_null($url)) {
$url = $this->page->url();
}
$params = $this->page->url('params', $url);
$this->get = $page;
$this->url = $url;
$this->offset = 0;
$this->limit = $limit;
$... | php | public function set($page = 'page', $limit = 10, $url = null)
{
if (is_null($url)) {
$url = $this->page->url();
}
$params = $this->page->url('params', $url);
$this->get = $page;
$this->url = $url;
$this->offset = 0;
$this->limit = $limit;
$... | [
"public",
"function",
"set",
"(",
"$",
"page",
"=",
"'page'",
",",
"$",
"limit",
"=",
"10",
",",
"$",
"url",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"url",
")",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"page",
"->",
"url",... | Check if we need a total count. There's no sense in querying the database if you don't have to. Plus, you have to call this anyways to set things up.
@param string $page The url query parameter that pertains these records.
@param int $limit How many records to return at a time.
@param string $url The url to us... | [
"Check",
"if",
"we",
"need",
"a",
"total",
"count",
".",
"There",
"s",
"no",
"sense",
"in",
"querying",
"the",
"database",
"if",
"you",
"don",
"t",
"have",
"to",
".",
"Plus",
"you",
"have",
"to",
"call",
"this",
"anyways",
"to",
"set",
"things",
"up"... | 83b89566e36d3cf147518e93615ffefa17c7e30e | https://github.com/Kylob/Pagination/blob/83b89566e36d3cf147518e93615ffefa17c7e30e/src/Component.php#L147-L173 |
3,350 | Kylob/Pagination | src/Component.php | Component.html | public function html($type = 'bootstrap', array $options = array())
{
if ($type == 'links' && !empty($this->links)) {
$this->links = array_merge($this->links, $options);
} elseif ($type == 'pager' && !empty($this->pager)) {
$this->pager = array_merge($this->pager, $options);
... | php | public function html($type = 'bootstrap', array $options = array())
{
if ($type == 'links' && !empty($this->links)) {
$this->links = array_merge($this->links, $options);
} elseif ($type == 'pager' && !empty($this->pager)) {
$this->pager = array_merge($this->pager, $options);
... | [
"public",
"function",
"html",
"(",
"$",
"type",
"=",
"'bootstrap'",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"$",
"type",
"==",
"'links'",
"&&",
"!",
"empty",
"(",
"$",
"this",
"->",
"links",
")",
")",
"{",
"$",
... | Customize the pagination and pager links.
@param string $type Either the CSS framework you want to use ('[**bootstrap**](http://getbootstrap.com/components/#pagination)', '[**zurb_foundation**](http://foundation.zurb.com/docs/components/pagination.html)', '[**semantic_ui**](http://semantic-ui.com/collections/menu.h... | [
"Customize",
"the",
"pagination",
"and",
"pager",
"links",
"."
] | 83b89566e36d3cf147518e93615ffefa17c7e30e | https://github.com/Kylob/Pagination/blob/83b89566e36d3cf147518e93615ffefa17c7e30e/src/Component.php#L216-L280 |
3,351 | tekreme73/FrametekLight | src/Http/Cookie.php | Cookie.setWithExpire | public function setWithExpire($key, $value, $expire)
{
if (setcookie($key, $value, time() + $expire, '/', '', false, true)) {
return true;
}
return false;
} | php | public function setWithExpire($key, $value, $expire)
{
if (setcookie($key, $value, time() + $expire, '/', '', false, true)) {
return true;
}
return false;
} | [
"public",
"function",
"setWithExpire",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"expire",
")",
"{",
"if",
"(",
"setcookie",
"(",
"$",
"key",
",",
"$",
"value",
",",
"time",
"(",
")",
"+",
"$",
"expire",
",",
"'/'",
",",
"''",
",",
"false",
... | Set cookie item with expire
@param string $key
The cookie key
@param mixed $value
The cookie value
@param integer $expire
The cookie $expire
@return boolean Fail if an output has be done before this method call | [
"Set",
"cookie",
"item",
"with",
"expire"
] | 7a40e8dd14490488d80741d6a6fe5d9c2bcc7bd5 | https://github.com/tekreme73/FrametekLight/blob/7a40e8dd14490488d80741d6a6fe5d9c2bcc7bd5/src/Http/Cookie.php#L57-L63 |
3,352 | helthe/Segmentio | Templating/Helper.php | Helper.init | public function init()
{
$render = $this->asyncScript();
$render .= $this->load($this->client->getWriteKey());
return $render;
} | php | public function init()
{
$render = $this->asyncScript();
$render .= $this->load($this->client->getWriteKey());
return $render;
} | [
"public",
"function",
"init",
"(",
")",
"{",
"$",
"render",
"=",
"$",
"this",
"->",
"asyncScript",
"(",
")",
";",
"$",
"render",
".=",
"$",
"this",
"->",
"load",
"(",
"$",
"this",
"->",
"client",
"->",
"getWriteKey",
"(",
")",
")",
";",
"return",
... | Renders all the code necessary for initializing analytics.js.
@return string | [
"Renders",
"all",
"the",
"code",
"necessary",
"for",
"initializing",
"analytics",
".",
"js",
"."
] | 40a97cf9780404bf0a48ad4621cc994ca66e9128 | https://github.com/helthe/Segmentio/blob/40a97cf9780404bf0a48ad4621cc994ca66e9128/Templating/Helper.php#L90-L96 |
3,353 | helthe/Segmentio | Templating/Helper.php | Helper.page | public function page($name = null, $category = null, array $properties = array())
{
return $this->renderer->renderPage($name, $category, $properties);
} | php | public function page($name = null, $category = null, array $properties = array())
{
return $this->renderer->renderPage($name, $category, $properties);
} | [
"public",
"function",
"page",
"(",
"$",
"name",
"=",
"null",
",",
"$",
"category",
"=",
"null",
",",
"array",
"$",
"properties",
"=",
"array",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"renderer",
"->",
"renderPage",
"(",
"$",
"name",
",",
"... | Renders the page method.
@param string $name
@param string $category
@param array $properties
@return string | [
"Renders",
"the",
"page",
"method",
"."
] | 40a97cf9780404bf0a48ad4621cc994ca66e9128 | https://github.com/helthe/Segmentio/blob/40a97cf9780404bf0a48ad4621cc994ca66e9128/Templating/Helper.php#L119-L122 |
3,354 | xinc-develop/xinc-getopt | src/CommandLineParser.php | CommandLineParser.addOption | private function addOption($string, $value)
{
foreach ($this->optionList as $option) {
if ($option->matches($string)) {
if ($option->mode() == Getopt::IS_FLAG) {
if (is_null($value)) {
$value = isset($this->options[$string]) ?
... | php | private function addOption($string, $value)
{
foreach ($this->optionList as $option) {
if ($option->matches($string)) {
if ($option->mode() == Getopt::IS_FLAG) {
if (is_null($value)) {
$value = isset($this->options[$string]) ?
... | [
"private",
"function",
"addOption",
"(",
"$",
"string",
",",
"$",
"value",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"optionList",
"as",
"$",
"option",
")",
"{",
"if",
"(",
"$",
"option",
"->",
"matches",
"(",
"$",
"string",
")",
")",
"{",
"if",... | Add an option to the list of known options.
@param string $string the option's name
@param string $value the option's value (or null)
@throws \UnexpectedValueException | [
"Add",
"an",
"option",
"to",
"the",
"list",
"of",
"known",
"options",
"."
] | f6ba394d83a020e76187d08184849bd930b04a4e | https://github.com/xinc-develop/xinc-getopt/blob/f6ba394d83a020e76187d08184849bd930b04a4e/src/CommandLineParser.php#L175-L216 |
3,355 | xinc-develop/xinc-getopt | src/CommandLineParser.php | CommandLineParser.addDefaultValues | private function addDefaultValues()
{
foreach ($this->optionList as $option) {
if ($option->getArgument()->hasDefaultValue()
&& !isset($this->options[$option->short()])
&& !isset($this->options[$option->long()])
) {
if ($option-... | php | private function addDefaultValues()
{
foreach ($this->optionList as $option) {
if ($option->getArgument()->hasDefaultValue()
&& !isset($this->options[$option->short()])
&& !isset($this->options[$option->long()])
) {
if ($option-... | [
"private",
"function",
"addDefaultValues",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"optionList",
"as",
"$",
"option",
")",
"{",
"if",
"(",
"$",
"option",
"->",
"getArgument",
"(",
")",
"->",
"hasDefaultValue",
"(",
")",
"&&",
"!",
"isset",
"(... | If there are options with default values that were not overridden
by the parsed option string, add them to the list of known options. | [
"If",
"there",
"are",
"options",
"with",
"default",
"values",
"that",
"were",
"not",
"overridden",
"by",
"the",
"parsed",
"option",
"string",
"add",
"them",
"to",
"the",
"list",
"of",
"known",
"options",
"."
] | f6ba394d83a020e76187d08184849bd930b04a4e | https://github.com/xinc-develop/xinc-getopt/blob/f6ba394d83a020e76187d08184849bd930b04a4e/src/CommandLineParser.php#L222-L247 |
3,356 | phPoirot/Module-Authorization | src/Authorization/Actions/AuthenticatorAction.php | AuthenticatorAction.authenticator | function authenticator($authenticatorName = self::AUTHENTICATOR_DEFAULT)
{
if (!$this->authenticators->has($authenticatorName))
throw new \Exception(sprintf('Authenticator (%s) Not Registered.', $authenticatorName));
$authenticator = $this->authenticators->get($authenticatorName);
... | php | function authenticator($authenticatorName = self::AUTHENTICATOR_DEFAULT)
{
if (!$this->authenticators->has($authenticatorName))
throw new \Exception(sprintf('Authenticator (%s) Not Registered.', $authenticatorName));
$authenticator = $this->authenticators->get($authenticatorName);
... | [
"function",
"authenticator",
"(",
"$",
"authenticatorName",
"=",
"self",
"::",
"AUTHENTICATOR_DEFAULT",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"authenticators",
"->",
"has",
"(",
"$",
"authenticatorName",
")",
")",
"throw",
"new",
"\\",
"Exception",
"(... | Retrieve Registered Authenticator Service By Name
@param string $authenticatorName
@return iAuthenticator|Authenticator
@throws \Exception | [
"Retrieve",
"Registered",
"Authenticator",
"Service",
"By",
"Name"
] | 1adcb85d01bb7cfaa6cc6b0cbcb9907ef4778e06 | https://github.com/phPoirot/Module-Authorization/blob/1adcb85d01bb7cfaa6cc6b0cbcb9907ef4778e06/src/Authorization/Actions/AuthenticatorAction.php#L60-L67 |
3,357 | phPoirot/Module-Authorization | src/Authorization/Actions/AuthenticatorAction.php | AuthenticatorAction.guard | function guard($authorizeOfGuardName)
{
if (! $this->guards->has($authorizeOfGuardName) )
throw new \Exception(sprintf('Guard Authorization (%s) Not Registered.', $authorizeOfGuardName));
$guard = $this->guards->get($authorizeOfGuardName);
return $guard;
} | php | function guard($authorizeOfGuardName)
{
if (! $this->guards->has($authorizeOfGuardName) )
throw new \Exception(sprintf('Guard Authorization (%s) Not Registered.', $authorizeOfGuardName));
$guard = $this->guards->get($authorizeOfGuardName);
return $guard;
} | [
"function",
"guard",
"(",
"$",
"authorizeOfGuardName",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"guards",
"->",
"has",
"(",
"$",
"authorizeOfGuardName",
")",
")",
"throw",
"new",
"\\",
"Exception",
"(",
"sprintf",
"(",
"'Guard Authorization (%s) Not Regist... | Retrieve Authorization Guard
@param string $authorizeOfGuardName
@return iGuard
@throws \Exception | [
"Retrieve",
"Authorization",
"Guard"
] | 1adcb85d01bb7cfaa6cc6b0cbcb9907ef4778e06 | https://github.com/phPoirot/Module-Authorization/blob/1adcb85d01bb7cfaa6cc6b0cbcb9907ef4778e06/src/Authorization/Actions/AuthenticatorAction.php#L87-L94 |
3,358 | roygoldman/composer-installers-discovery | src/Installer.php | Installer.templatePath | protected function templatePath($path, array $path_vars = []) {
if (strpos($path, '{') !== false) {
extract($path_vars);
preg_match_all('@\{\$([A-Za-z0-9_]*)\}@i', $path, $matches);
if (!empty($matches[1])) {
foreach ($matches[1] as $var) {
$path = str_replace('{$' . $var . '}', ... | php | protected function templatePath($path, array $path_vars = []) {
if (strpos($path, '{') !== false) {
extract($path_vars);
preg_match_all('@\{\$([A-Za-z0-9_]*)\}@i', $path, $matches);
if (!empty($matches[1])) {
foreach ($matches[1] as $var) {
$path = str_replace('{$' . $var . '}', ... | [
"protected",
"function",
"templatePath",
"(",
"$",
"path",
",",
"array",
"$",
"path_vars",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"path",
",",
"'{'",
")",
"!==",
"false",
")",
"{",
"extract",
"(",
"$",
"path_vars",
")",
";",
"preg_... | Replace variables in a path
@param string $path
@param array $path_vars
@return string | [
"Replace",
"variables",
"in",
"a",
"path"
] | c5cd1acf067ae0843a511fd9af114b837f9784af | https://github.com/roygoldman/composer-installers-discovery/blob/c5cd1acf067ae0843a511fd9af114b837f9784af/src/Installer.php#L87-L99 |
3,359 | roygoldman/composer-installers-discovery | src/Installer.php | Installer.discoverInstallers | protected function discoverInstallers() {
$repo_manager = $this->composer->getRepositoryManager();
$package = $this->composer->getPackage();
return $this->discoverPackageInstallers($package, $repo_manager);
} | php | protected function discoverInstallers() {
$repo_manager = $this->composer->getRepositoryManager();
$package = $this->composer->getPackage();
return $this->discoverPackageInstallers($package, $repo_manager);
} | [
"protected",
"function",
"discoverInstallers",
"(",
")",
"{",
"$",
"repo_manager",
"=",
"$",
"this",
"->",
"composer",
"->",
"getRepositoryManager",
"(",
")",
";",
"$",
"package",
"=",
"$",
"this",
"->",
"composer",
"->",
"getPackage",
"(",
")",
";",
"retu... | Helper function to scan for installer definitions in dependencies.
@param string $dir
Installation directory of the project's composer.json.
@return array
Installer mappings keyed by type, with paths as values. | [
"Helper",
"function",
"to",
"scan",
"for",
"installer",
"definitions",
"in",
"dependencies",
"."
] | c5cd1acf067ae0843a511fd9af114b837f9784af | https://github.com/roygoldman/composer-installers-discovery/blob/c5cd1acf067ae0843a511fd9af114b837f9784af/src/Installer.php#L131-L137 |
3,360 | roygoldman/composer-installers-discovery | src/Installer.php | Installer.discoverPackageInstallers | protected function discoverPackageInstallers(PackageInterface $package, RepositoryManager $repo_manager) {
$package_name = $package->getName();
if (!isset($this->packageInstallers[$package_name])) {
// Initialize the package cache entry to prevent loops.
$this->packageInstallers[$package_name] = []... | php | protected function discoverPackageInstallers(PackageInterface $package, RepositoryManager $repo_manager) {
$package_name = $package->getName();
if (!isset($this->packageInstallers[$package_name])) {
// Initialize the package cache entry to prevent loops.
$this->packageInstallers[$package_name] = []... | [
"protected",
"function",
"discoverPackageInstallers",
"(",
"PackageInterface",
"$",
"package",
",",
"RepositoryManager",
"$",
"repo_manager",
")",
"{",
"$",
"package_name",
"=",
"$",
"package",
"->",
"getName",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",... | Recursively discover available installer paths in installers.
@param \Composer\Package\PackageInterface $package
Package to discover tree starting from.
@param \Composer\Repository\RepositoryManager $repo_manager
Local Package repository.
@return array
Installer mappings keyed by type, with paths as values. | [
"Recursively",
"discover",
"available",
"installer",
"paths",
"in",
"installers",
"."
] | c5cd1acf067ae0843a511fd9af114b837f9784af | https://github.com/roygoldman/composer-installers-discovery/blob/c5cd1acf067ae0843a511fd9af114b837f9784af/src/Installer.php#L150-L184 |
3,361 | roygoldman/composer-installers-discovery | src/Installer.php | Installer.isSystemRequirement | public static function isSystemRequirement(Link $requirement) {
$package_name = $requirement->getTarget();
if (strpos($package_name, '/') === FALSE) {
return TRUE;
}
return FALSE;
} | php | public static function isSystemRequirement(Link $requirement) {
$package_name = $requirement->getTarget();
if (strpos($package_name, '/') === FALSE) {
return TRUE;
}
return FALSE;
} | [
"public",
"static",
"function",
"isSystemRequirement",
"(",
"Link",
"$",
"requirement",
")",
"{",
"$",
"package_name",
"=",
"$",
"requirement",
"->",
"getTarget",
"(",
")",
";",
"if",
"(",
"strpos",
"(",
"$",
"package_name",
",",
"'/'",
")",
"===",
"FALSE"... | Checks if the required package doesn't have a vendor.
Packages without vendor definitions should only ever be php or a php
extension.
@param \Composer\Package\Link $requirement
Required package reference.
@return bool
True if the package is a php or an extension. False otherwise. | [
"Checks",
"if",
"the",
"required",
"package",
"doesn",
"t",
"have",
"a",
"vendor",
"."
] | c5cd1acf067ae0843a511fd9af114b837f9784af | https://github.com/roygoldman/composer-installers-discovery/blob/c5cd1acf067ae0843a511fd9af114b837f9784af/src/Installer.php#L198-L205 |
3,362 | gibboncms/gibbon | src/Filesystems/FlyFilesystem.php | FlyFilesystem.listFiles | public function listFiles($directory = null, $recursive = false)
{
return $this->flysystem->listFiles($directory, $recursive);
} | php | public function listFiles($directory = null, $recursive = false)
{
return $this->flysystem->listFiles($directory, $recursive);
} | [
"public",
"function",
"listFiles",
"(",
"$",
"directory",
"=",
"null",
",",
"$",
"recursive",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"flysystem",
"->",
"listFiles",
"(",
"$",
"directory",
",",
"$",
"recursive",
")",
";",
"}"
] | List all the files from a directory
@param string $directory
@param bool $recursive
@return array | [
"List",
"all",
"the",
"files",
"from",
"a",
"directory"
] | 2905e90b2902149b3358b385264e98b97cf4fc00 | https://github.com/gibboncms/gibbon/blob/2905e90b2902149b3358b385264e98b97cf4fc00/src/Filesystems/FlyFilesystem.php#L23-L26 |
3,363 | hschulz/php-http | src/HeaderCollection.php | HeaderCollection.addHeader | public function addHeader(string $name, string $value): bool
{
/* Initialize the return value */
$isSet = false;
/* If the given parameters aren't empty */
if (!empty($name) && !empty($value)) {
/* Assign the values */
$this->offsetSet($name, $value);
... | php | public function addHeader(string $name, string $value): bool
{
/* Initialize the return value */
$isSet = false;
/* If the given parameters aren't empty */
if (!empty($name) && !empty($value)) {
/* Assign the values */
$this->offsetSet($name, $value);
... | [
"public",
"function",
"addHeader",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"value",
")",
":",
"bool",
"{",
"/* Initialize the return value */",
"$",
"isSet",
"=",
"false",
";",
"/* If the given parameters aren't empty */",
"if",
"(",
"!",
"empty",
"(",
"... | Adds a new Header. If the header already exists it is overwritten.
@param string $name
@param string $value
@return bool | [
"Adds",
"a",
"new",
"Header",
".",
"If",
"the",
"header",
"already",
"exists",
"it",
"is",
"overwritten",
"."
] | 12ae2e60eadd5088700954aa088d72a9725d502c | https://github.com/hschulz/php-http/blob/12ae2e60eadd5088700954aa088d72a9725d502c/src/HeaderCollection.php#L41-L56 |
3,364 | zugoripls/laravel-framework | src/Illuminate/Routing/ControllerDispatcher.php | ControllerDispatcher.methodExcludedByOptions | public function methodExcludedByOptions($method, array $options)
{
return ( ! empty($options['only']) && ! in_array($method, (array) $options['only'])) ||
( ! empty($options['except']) && in_array($method, (array) $options['except']));
} | php | public function methodExcludedByOptions($method, array $options)
{
return ( ! empty($options['only']) && ! in_array($method, (array) $options['only'])) ||
( ! empty($options['except']) && in_array($method, (array) $options['except']));
} | [
"public",
"function",
"methodExcludedByOptions",
"(",
"$",
"method",
",",
"array",
"$",
"options",
")",
"{",
"return",
"(",
"!",
"empty",
"(",
"$",
"options",
"[",
"'only'",
"]",
")",
"&&",
"!",
"in_array",
"(",
"$",
"method",
",",
"(",
"array",
")",
... | Determine if the given options exclude a particular method.
@param string $method
@param array $options
@return bool | [
"Determine",
"if",
"the",
"given",
"options",
"exclude",
"a",
"particular",
"method",
"."
] | 90fa2b0e7a9b7786a6f02a9f10aba6a21ac03655 | https://github.com/zugoripls/laravel-framework/blob/90fa2b0e7a9b7786a6f02a9f10aba6a21ac03655/src/Illuminate/Routing/ControllerDispatcher.php#L142-L146 |
3,365 | zugoripls/laravel-framework | src/Illuminate/Routing/ControllerDispatcher.php | ControllerDispatcher.filterFailsOn | protected function filterFailsOn($filter, $request, $method)
{
$on = array_get($filter, 'options.on');
if (is_null($on)) return false;
// If the "on" is a string, we will explode it on the pipe so you can set any
// amount of methods on the filter constraints and it will still work like
// you specified an... | php | protected function filterFailsOn($filter, $request, $method)
{
$on = array_get($filter, 'options.on');
if (is_null($on)) return false;
// If the "on" is a string, we will explode it on the pipe so you can set any
// amount of methods on the filter constraints and it will still work like
// you specified an... | [
"protected",
"function",
"filterFailsOn",
"(",
"$",
"filter",
",",
"$",
"request",
",",
"$",
"method",
")",
"{",
"$",
"on",
"=",
"array_get",
"(",
"$",
"filter",
",",
"'options.on'",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"on",
")",
")",
"return",... | Determine if the filter fails the "on" constraint.
@param array $filter
@param \Illuminate\Http\Request $request
@param string $method
@return bool | [
"Determine",
"if",
"the",
"filter",
"fails",
"the",
"on",
"constraint",
"."
] | 90fa2b0e7a9b7786a6f02a9f10aba6a21ac03655 | https://github.com/zugoripls/laravel-framework/blob/90fa2b0e7a9b7786a6f02a9f10aba6a21ac03655/src/Illuminate/Routing/ControllerDispatcher.php#L268-L280 |
3,366 | ghiencode/util | Text.php | Text.uniqueId | public static function uniqueId(): string
{
$rand = random_bytes(16);
$rand[6] = chr(ord($rand[6]) & 0x0f | 0x40);
$rand[8] = chr(ord($rand[8]) & 0x3f | 0x80);
$rand = str_split(bin2hex($rand), 4);
return vsprintf('%s%s%s%s%s', array_map(function ($hex) {
return ... | php | public static function uniqueId(): string
{
$rand = random_bytes(16);
$rand[6] = chr(ord($rand[6]) & 0x0f | 0x40);
$rand[8] = chr(ord($rand[8]) & 0x3f | 0x80);
$rand = str_split(bin2hex($rand), 4);
return vsprintf('%s%s%s%s%s', array_map(function ($hex) {
return ... | [
"public",
"static",
"function",
"uniqueId",
"(",
")",
":",
"string",
"{",
"$",
"rand",
"=",
"random_bytes",
"(",
"16",
")",
";",
"$",
"rand",
"[",
"6",
"]",
"=",
"chr",
"(",
"ord",
"(",
"$",
"rand",
"[",
"6",
"]",
")",
"&",
"0x0f",
"|",
"0x40",... | Follow uuid v4 generation standard but remove dash and encode in base 32
Guarantee 128 bits of entropy but use ~ 20% less space compare to base 16
@see https://stackoverflow.com/a/15875555
@see https://connect2id.com/blog/how-to-generate-human-friendly-identifiers | [
"Follow",
"uuid",
"v4",
"generation",
"standard",
"but",
"remove",
"dash",
"and",
"encode",
"in",
"base",
"32",
"Guarantee",
"128",
"bits",
"of",
"entropy",
"but",
"use",
"~",
"20%",
"less",
"space",
"compare",
"to",
"base",
"16"
] | c27ead3cde04cc682055318a0836862aa7cd9d35 | https://github.com/ghiencode/util/blob/c27ead3cde04cc682055318a0836862aa7cd9d35/Text.php#L87-L97 |
3,367 | traceguide/api-php | lib/Traceguide.php | Traceguide.initialize | public static function initialize($group_name, $access_token, $opts = null) {
if (!is_string($group_name) || strlen($group_name) == 0) {
throw new Exception("Invalid group_name");
}
if (!is_string($access_token) || strlen($access_token) == 0) {
throw new Exception("Inval... | php | public static function initialize($group_name, $access_token, $opts = null) {
if (!is_string($group_name) || strlen($group_name) == 0) {
throw new Exception("Invalid group_name");
}
if (!is_string($access_token) || strlen($access_token) == 0) {
throw new Exception("Inval... | [
"public",
"static",
"function",
"initialize",
"(",
"$",
"group_name",
",",
"$",
"access_token",
",",
"$",
"opts",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"group_name",
")",
"||",
"strlen",
"(",
"$",
"group_name",
")",
"==",
"0",
... | Initializes and returns the singleton instance of the Runtime.
For convenience, multiple calls to initialize are allowed. For example,
in library code with more than possible first entry-point, this may
be helpful.
@return \TraceguideBase\Runtime
@throws Exception if the group name or access token is not a valid stri... | [
"Initializes",
"and",
"returns",
"the",
"singleton",
"instance",
"of",
"the",
"Runtime",
"."
] | 05d7958732b0e82a7b33bf55db4ef1b1fc6a9136 | https://github.com/traceguide/api-php/blob/05d7958732b0e82a7b33bf55db4ef1b1fc6a9136/lib/Traceguide.php#L25-L48 |
3,368 | traceguide/api-php | lib/Traceguide.php | Traceguide.getInstance | public static function getInstance($group_name = NULL, $access_token = NULL, $opts = NULL) {
if (!isset(self::$_singleton)) {
self::$_singleton = self::newRuntime($group_name, $access_token, $opts);
}
return self::$_singleton;
} | php | public static function getInstance($group_name = NULL, $access_token = NULL, $opts = NULL) {
if (!isset(self::$_singleton)) {
self::$_singleton = self::newRuntime($group_name, $access_token, $opts);
}
return self::$_singleton;
} | [
"public",
"static",
"function",
"getInstance",
"(",
"$",
"group_name",
"=",
"NULL",
",",
"$",
"access_token",
"=",
"NULL",
",",
"$",
"opts",
"=",
"NULL",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"_singleton",
")",
")",
"{",
"self",
... | Returns the singleton instance of the Runtime.
For convenience, this function can be passed the $group_name and
$access_token parameters to also initialize the runtime singleton. These
values will be ignored on any calls after the first to getInstance().
@param $group_name Group name to use for the runtime
@param $a... | [
"Returns",
"the",
"singleton",
"instance",
"of",
"the",
"Runtime",
"."
] | 05d7958732b0e82a7b33bf55db4ef1b1fc6a9136 | https://github.com/traceguide/api-php/blob/05d7958732b0e82a7b33bf55db4ef1b1fc6a9136/lib/Traceguide.php#L62-L67 |
3,369 | traceguide/api-php | lib/Traceguide.php | Traceguide.newRuntime | public static function newRuntime ($group_name, $access_token, $opts = NULL) {
if (is_null($opts)) {
$opts = array();
}
// It is valid to create and use the runtime before it is fully configured.
// The only constraint is that it will not be able to flush data until the
... | php | public static function newRuntime ($group_name, $access_token, $opts = NULL) {
if (is_null($opts)) {
$opts = array();
}
// It is valid to create and use the runtime before it is fully configured.
// The only constraint is that it will not be able to flush data until the
... | [
"public",
"static",
"function",
"newRuntime",
"(",
"$",
"group_name",
",",
"$",
"access_token",
",",
"$",
"opts",
"=",
"NULL",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"opts",
")",
")",
"{",
"$",
"opts",
"=",
"array",
"(",
")",
";",
"}",
"// It is... | Creates a new runtime instance.
@param $group_name Group name to use for the runtime
@param $access_token The project access token
@return \TraceguideBase\Runtime
@throws Exception if the group name or access token is not a valid string. | [
"Creates",
"a",
"new",
"runtime",
"instance",
"."
] | 05d7958732b0e82a7b33bf55db4ef1b1fc6a9136 | https://github.com/traceguide/api-php/blob/05d7958732b0e82a7b33bf55db4ef1b1fc6a9136/lib/Traceguide.php#L78-L93 |
3,370 | hiqdev/composer-asset-plugin | src/Constraint.php | Constraint.merge | public static function merge($a, $b)
{
$acon = static::parse($a);
$bcon = static::parse($b);
if ($acon instanceof EmptyConstraint) {
return $b;
} elseif ($bcon instanceof EmptyConstraint) {
return $a;
} elseif ($acon->matches($bcon) || $bcon->matches(... | php | public static function merge($a, $b)
{
$acon = static::parse($a);
$bcon = static::parse($b);
if ($acon instanceof EmptyConstraint) {
return $b;
} elseif ($bcon instanceof EmptyConstraint) {
return $a;
} elseif ($acon->matches($bcon) || $bcon->matches(... | [
"public",
"static",
"function",
"merge",
"(",
"$",
"a",
",",
"$",
"b",
")",
"{",
"$",
"acon",
"=",
"static",
"::",
"parse",
"(",
"$",
"a",
")",
";",
"$",
"bcon",
"=",
"static",
"::",
"parse",
"(",
"$",
"b",
")",
";",
"if",
"(",
"$",
"acon",
... | Merges two constraints.
Doesn't resolve version conflicts.
@param string $a
@param string $b
@return string | [
"Merges",
"two",
"constraints",
".",
"Doesn",
"t",
"resolve",
"version",
"conflicts",
"."
] | cdc55b07612334705e802197a39f41a0adca204c | https://github.com/hiqdev/composer-asset-plugin/blob/cdc55b07612334705e802197a39f41a0adca204c/src/Constraint.php#L48-L62 |
3,371 | edunola13/utils | helper/ApiRestHelper/JsonHelper.php | JsonHelper.array_fields | public function array_fields($array, array $fields){
$newArray= array();
foreach ($array as $value) {
$newValue= array();
foreach ($fields as $key) {
if(array_key_exists($key, $value)){
$newValue[$key]= $value[$key];
}
... | php | public function array_fields($array, array $fields){
$newArray= array();
foreach ($array as $value) {
$newValue= array();
foreach ($fields as $key) {
if(array_key_exists($key, $value)){
$newValue[$key]= $value[$key];
}
... | [
"public",
"function",
"array_fields",
"(",
"$",
"array",
",",
"array",
"$",
"fields",
")",
"{",
"$",
"newArray",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"array",
"as",
"$",
"value",
")",
"{",
"$",
"newValue",
"=",
"array",
"(",
")",
";",
... | Retorna un array con los campos indicados
@param array $array
@param array $fields
@return array | [
"Retorna",
"un",
"array",
"con",
"los",
"campos",
"indicados"
] | 6c637731cf805dba465658bbaf5cd8aefa6f8f22 | https://github.com/edunola13/utils/blob/6c637731cf805dba465658bbaf5cd8aefa6f8f22/helper/ApiRestHelper/JsonHelper.php#L18-L30 |
3,372 | edunola13/utils | helper/ApiRestHelper/JsonHelper.php | JsonHelper.json_encode_data | public function json_encode_data($object, array $fields, $options = 0){
$array= $this->object_to_array($object, $fields);
return json_encode($array, $options);
} | php | public function json_encode_data($object, array $fields, $options = 0){
$array= $this->object_to_array($object, $fields);
return json_encode($array, $options);
} | [
"public",
"function",
"json_encode_data",
"(",
"$",
"object",
",",
"array",
"$",
"fields",
",",
"$",
"options",
"=",
"0",
")",
"{",
"$",
"array",
"=",
"$",
"this",
"->",
"object_to_array",
"(",
"$",
"object",
",",
"$",
"fields",
")",
";",
"return",
"... | Este realiza el pasaje de un objeto a json asegurando que el mismo no entre en loop.
Para esto primero pasa el objeto a array en base a los campos que quiere mapear y despues lo pasa a json
@param Object $object
@param mixed $fields
@param int $options
@return string | [
"Este",
"realiza",
"el",
"pasaje",
"de",
"un",
"objeto",
"a",
"json",
"asegurando",
"que",
"el",
"mismo",
"no",
"entre",
"en",
"loop",
".",
"Para",
"esto",
"primero",
"pasa",
"el",
"objeto",
"a",
"array",
"en",
"base",
"a",
"los",
"campos",
"que",
"qui... | 6c637731cf805dba465658bbaf5cd8aefa6f8f22 | https://github.com/edunola13/utils/blob/6c637731cf805dba465658bbaf5cd8aefa6f8f22/helper/ApiRestHelper/JsonHelper.php#L82-L85 |
3,373 | edunola13/utils | helper/ApiRestHelper/JsonHelper.php | JsonHelper.json_encode_recursion | public function json_encode_recursion($object, $recursionLevel = 1, $options = 0){
$objects= array();
$ocurrencias= array();
$array= array();
if(is_array($object)){
$array= $object;
foreach ($array as &$var) {
$var= $this->json_encode_recursion_int... | php | public function json_encode_recursion($object, $recursionLevel = 1, $options = 0){
$objects= array();
$ocurrencias= array();
$array= array();
if(is_array($object)){
$array= $object;
foreach ($array as &$var) {
$var= $this->json_encode_recursion_int... | [
"public",
"function",
"json_encode_recursion",
"(",
"$",
"object",
",",
"$",
"recursionLevel",
"=",
"1",
",",
"$",
"options",
"=",
"0",
")",
"{",
"$",
"objects",
"=",
"array",
"(",
")",
";",
"$",
"ocurrencias",
"=",
"array",
"(",
")",
";",
"$",
"arra... | Este metodo realiza el pasaje de un objeto Doctrine a json.
Para esto indicamos el nivel de profundidad que se va a ingresar en el objeto y los objetos no cargados hasta
el momento solo se mapearan su id.
@param Object $object
@param int $recursionLevel
@param int $options
@return strong | [
"Este",
"metodo",
"realiza",
"el",
"pasaje",
"de",
"un",
"objeto",
"Doctrine",
"a",
"json",
".",
"Para",
"esto",
"indicamos",
"el",
"nivel",
"de",
"profundidad",
"que",
"se",
"va",
"a",
"ingresar",
"en",
"el",
"objeto",
"y",
"los",
"objetos",
"no",
"carg... | 6c637731cf805dba465658bbaf5cd8aefa6f8f22 | https://github.com/edunola13/utils/blob/6c637731cf805dba465658bbaf5cd8aefa6f8f22/helper/ApiRestHelper/JsonHelper.php#L95-L108 |
3,374 | edunola13/utils | helper/ApiRestHelper/JsonHelper.php | JsonHelper.json_encode_recursion_internal | protected function json_encode_recursion_internal($object, $recursionLevel = 1, $options = 0, $objects, $ocurrencias){
$pos= array_search($object, $objects);
$repeticiones= 1;
if($pos !== FALSE){
$ocurrencias[$pos]++;
$repeticiones= $ocurrencias[$pos];
}else{
... | php | protected function json_encode_recursion_internal($object, $recursionLevel = 1, $options = 0, $objects, $ocurrencias){
$pos= array_search($object, $objects);
$repeticiones= 1;
if($pos !== FALSE){
$ocurrencias[$pos]++;
$repeticiones= $ocurrencias[$pos];
}else{
... | [
"protected",
"function",
"json_encode_recursion_internal",
"(",
"$",
"object",
",",
"$",
"recursionLevel",
"=",
"1",
",",
"$",
"options",
"=",
"0",
",",
"$",
"objects",
",",
"$",
"ocurrencias",
")",
"{",
"$",
"pos",
"=",
"array_search",
"(",
"$",
"object",... | Este metodo es privado y realiza el pasaje de un objeto Doctrine a json.
Para esto indicamos el nivel de profundidad que se va a ingresar en el objeto y los objetos no cargados hasta
el momento solo se mapearan su id.
@param Object $object
@param int $recursionLevel
@param int $options
@param mixed $objects
@param int ... | [
"Este",
"metodo",
"es",
"privado",
"y",
"realiza",
"el",
"pasaje",
"de",
"un",
"objeto",
"Doctrine",
"a",
"json",
".",
"Para",
"esto",
"indicamos",
"el",
"nivel",
"de",
"profundidad",
"que",
"se",
"va",
"a",
"ingresar",
"en",
"el",
"objeto",
"y",
"los",
... | 6c637731cf805dba465658bbaf5cd8aefa6f8f22 | https://github.com/edunola13/utils/blob/6c637731cf805dba465658bbaf5cd8aefa6f8f22/helper/ApiRestHelper/JsonHelper.php#L120-L156 |
3,375 | liip/LiipDrupalRegistryModule | src/Liip/Drupal/Modules/Registry/Dispatcher.php | Dispatcher.attach | public function attach(Registry $registry, $id = '')
{
if (!empty($id) || 0 === $id) {
if (!empty($this->registries[$id])) {
throw new RegistryException(
RegistryException::DUPLICATE_REGISTRATION_ATTEMPT_TEXT,
RegistryException::DUPLICATE... | php | public function attach(Registry $registry, $id = '')
{
if (!empty($id) || 0 === $id) {
if (!empty($this->registries[$id])) {
throw new RegistryException(
RegistryException::DUPLICATE_REGISTRATION_ATTEMPT_TEXT,
RegistryException::DUPLICATE... | [
"public",
"function",
"attach",
"(",
"Registry",
"$",
"registry",
",",
"$",
"id",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"id",
")",
"||",
"0",
"===",
"$",
"id",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"regi... | Adds the provided registry to the dispatcher queue.
@param Registry $registry
@param string $id
@throws RegistryException | [
"Adds",
"the",
"provided",
"registry",
"to",
"the",
"dispatcher",
"queue",
"."
] | 2d860c1f88ef91d9af91909d8711ffbb6e2a1eab | https://github.com/liip/LiipDrupalRegistryModule/blob/2d860c1f88ef91d9af91909d8711ffbb6e2a1eab/src/Liip/Drupal/Modules/Registry/Dispatcher.php#L34-L52 |
3,376 | liip/LiipDrupalRegistryModule | src/Liip/Drupal/Modules/Registry/Dispatcher.php | Dispatcher.detach | public function detach($id)
{
if (empty($this->registries[$id])) {
throw new RegistryException(
RegistryException::MODIFICATION_ATTEMPT_FAILED_TEXT,
RegistryException::MODIFICATION_ATTEMPT_FAILED_CODE
);
}
unset($this->registries[$id])... | php | public function detach($id)
{
if (empty($this->registries[$id])) {
throw new RegistryException(
RegistryException::MODIFICATION_ATTEMPT_FAILED_TEXT,
RegistryException::MODIFICATION_ATTEMPT_FAILED_CODE
);
}
unset($this->registries[$id])... | [
"public",
"function",
"detach",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"registries",
"[",
"$",
"id",
"]",
")",
")",
"{",
"throw",
"new",
"RegistryException",
"(",
"RegistryException",
"::",
"MODIFICATION_ATTEMPT_FAILED_TEXT",
... | Removes the a registry from dispatcher.
@param string $id
@throws RegistryException | [
"Removes",
"the",
"a",
"registry",
"from",
"dispatcher",
"."
] | 2d860c1f88ef91d9af91909d8711ffbb6e2a1eab | https://github.com/liip/LiipDrupalRegistryModule/blob/2d860c1f88ef91d9af91909d8711ffbb6e2a1eab/src/Liip/Drupal/Modules/Registry/Dispatcher.php#L61-L71 |
3,377 | liip/LiipDrupalRegistryModule | src/Liip/Drupal/Modules/Registry/Dispatcher.php | Dispatcher.processRegistry | protected function processRegistry($action, Registry $registry, $id, array $output, array $args = array())
{
try {
$output[$id] = call_user_func_array(array($registry, $action), $args);
} catch (RegistryException $e) {
$this->errors[$id] = $e;
}
return $ou... | php | protected function processRegistry($action, Registry $registry, $id, array $output, array $args = array())
{
try {
$output[$id] = call_user_func_array(array($registry, $action), $args);
} catch (RegistryException $e) {
$this->errors[$id] = $e;
}
return $ou... | [
"protected",
"function",
"processRegistry",
"(",
"$",
"action",
",",
"Registry",
"$",
"registry",
",",
"$",
"id",
",",
"array",
"$",
"output",
",",
"array",
"$",
"args",
"=",
"array",
"(",
")",
")",
"{",
"try",
"{",
"$",
"output",
"[",
"$",
"id",
"... | Invokes the defined callback on the given registry.
@param string $action
@param Registry $registry
@param string $id
@param array $output
@param array $args
@return array | [
"Invokes",
"the",
"defined",
"callback",
"on",
"the",
"given",
"registry",
"."
] | 2d860c1f88ef91d9af91909d8711ffbb6e2a1eab | https://github.com/liip/LiipDrupalRegistryModule/blob/2d860c1f88ef91d9af91909d8711ffbb6e2a1eab/src/Liip/Drupal/Modules/Registry/Dispatcher.php#L118-L130 |
3,378 | liip/LiipDrupalRegistryModule | src/Liip/Drupal/Modules/Registry/Dispatcher.php | Dispatcher.getLastErrorMessages | public function getLastErrorMessages()
{
$message = '';
if ($this->hasError()) {
foreach ($this->errors as $exception) {
$message .= $exception->getMessage() . ',' . PHP_EOL;
}
}
return $message;
} | php | public function getLastErrorMessages()
{
$message = '';
if ($this->hasError()) {
foreach ($this->errors as $exception) {
$message .= $exception->getMessage() . ',' . PHP_EOL;
}
}
return $message;
} | [
"public",
"function",
"getLastErrorMessages",
"(",
")",
"{",
"$",
"message",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"hasError",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"errors",
"as",
"$",
"exception",
")",
"{",
"$",
"message",
... | Provides the messages generated by the last occurred errors.
@return string | [
"Provides",
"the",
"messages",
"generated",
"by",
"the",
"last",
"occurred",
"errors",
"."
] | 2d860c1f88ef91d9af91909d8711ffbb6e2a1eab | https://github.com/liip/LiipDrupalRegistryModule/blob/2d860c1f88ef91d9af91909d8711ffbb6e2a1eab/src/Liip/Drupal/Modules/Registry/Dispatcher.php#L145-L157 |
3,379 | XTAIN/JoomlaBundle | Library/Joomla/Database/Driver/AbstractDoctrineDriver.php | AbstractDoctrineDriver.fetchArray | protected function fetchArray($cursor = null)
{
if (!empty($cursor) && $cursor instanceof Statement) {
return $cursor->fetch(\PDO::FETCH_NUM);
}
if ($this->prepared instanceof Statement) {
return $this->prepared->fetch(\PDO::FETCH_NUM);
}
} | php | protected function fetchArray($cursor = null)
{
if (!empty($cursor) && $cursor instanceof Statement) {
return $cursor->fetch(\PDO::FETCH_NUM);
}
if ($this->prepared instanceof Statement) {
return $this->prepared->fetch(\PDO::FETCH_NUM);
}
} | [
"protected",
"function",
"fetchArray",
"(",
"$",
"cursor",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"cursor",
")",
"&&",
"$",
"cursor",
"instanceof",
"Statement",
")",
"{",
"return",
"$",
"cursor",
"->",
"fetch",
"(",
"\\",
"PDO",
":... | Method to fetch a row from the result set cursor as an array.
@param mixed $cursor The optional result set cursor from which to fetch the row.
@return mixed Either the next row from the result set or false if there are no more rows.
@author Maximiian Ruta <mr@xtain.net> | [
"Method",
"to",
"fetch",
"a",
"row",
"from",
"the",
"result",
"set",
"cursor",
"as",
"an",
"array",
"."
] | 3d39e1278deba77c5a2197ad91973964ed2a38bd | https://github.com/XTAIN/JoomlaBundle/blob/3d39e1278deba77c5a2197ad91973964ed2a38bd/Library/Joomla/Database/Driver/AbstractDoctrineDriver.php#L451-L460 |
3,380 | XTAIN/JoomlaBundle | Library/Joomla/Database/Driver/AbstractDoctrineDriver.php | AbstractDoctrineDriver.fetchAssoc | protected function fetchAssoc($cursor = null)
{
if (!empty($cursor) && $cursor instanceof Statement) {
return $cursor->fetch(\PDO::FETCH_ASSOC);
}
if ($this->prepared instanceof Statement) {
return $this->prepared->fetch(\PDO::FETCH_ASSOC);
}
return ... | php | protected function fetchAssoc($cursor = null)
{
if (!empty($cursor) && $cursor instanceof Statement) {
return $cursor->fetch(\PDO::FETCH_ASSOC);
}
if ($this->prepared instanceof Statement) {
return $this->prepared->fetch(\PDO::FETCH_ASSOC);
}
return ... | [
"protected",
"function",
"fetchAssoc",
"(",
"$",
"cursor",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"cursor",
")",
"&&",
"$",
"cursor",
"instanceof",
"Statement",
")",
"{",
"return",
"$",
"cursor",
"->",
"fetch",
"(",
"\\",
"PDO",
":... | Method to fetch a row from the result set cursor as an associative array.
@param mixed $cursor The optional result set cursor from which to fetch the row.
@return mixed Either the next row from the result set or false if there are no more rows.
@author Maximiian Ruta <mr@xtain.net> | [
"Method",
"to",
"fetch",
"a",
"row",
"from",
"the",
"result",
"set",
"cursor",
"as",
"an",
"associative",
"array",
"."
] | 3d39e1278deba77c5a2197ad91973964ed2a38bd | https://github.com/XTAIN/JoomlaBundle/blob/3d39e1278deba77c5a2197ad91973964ed2a38bd/Library/Joomla/Database/Driver/AbstractDoctrineDriver.php#L470-L481 |
3,381 | XTAIN/JoomlaBundle | Library/Joomla/Database/Driver/AbstractDoctrineDriver.php | AbstractDoctrineDriver.loadNextObject | public function loadNextObject($class = 'stdClass')
{
$this->connect();
// Execute the query and get the result set cursor.
if (!$this->executed) {
if (!($this->execute())) {
return $this->errorNum ? null : false;
}
}
// Get the next ... | php | public function loadNextObject($class = 'stdClass')
{
$this->connect();
// Execute the query and get the result set cursor.
if (!$this->executed) {
if (!($this->execute())) {
return $this->errorNum ? null : false;
}
}
// Get the next ... | [
"public",
"function",
"loadNextObject",
"(",
"$",
"class",
"=",
"'stdClass'",
")",
"{",
"$",
"this",
"->",
"connect",
"(",
")",
";",
"// Execute the query and get the result set cursor.",
"if",
"(",
"!",
"$",
"this",
"->",
"executed",
")",
"{",
"if",
"(",
"!... | Method to get the next row in the result set from the database query as an object.
@param string $class The class name to use for the returned row object.
@return mixed The result of the query as an array, false if there are no more rows.
@throws RuntimeException
@author Maximiian Ruta <mr@xtain.net> | [
"Method",
"to",
"get",
"the",
"next",
"row",
"in",
"the",
"result",
"set",
"from",
"the",
"database",
"query",
"as",
"an",
"object",
"."
] | 3d39e1278deba77c5a2197ad91973964ed2a38bd | https://github.com/XTAIN/JoomlaBundle/blob/3d39e1278deba77c5a2197ad91973964ed2a38bd/Library/Joomla/Database/Driver/AbstractDoctrineDriver.php#L549-L569 |
3,382 | XTAIN/JoomlaBundle | Library/Joomla/Database/Driver/AbstractDoctrineDriver.php | AbstractDoctrineDriver.escape | public function escape($text, $extra = false)
{
if (is_int($text) || is_float($text)) {
return $text;
}
$result = substr($this->connection->quote($text), 1, -1);
if ($extra) {
$result = addcslashes($result, '%_');
}
return $result;
} | php | public function escape($text, $extra = false)
{
if (is_int($text) || is_float($text)) {
return $text;
}
$result = substr($this->connection->quote($text), 1, -1);
if ($extra) {
$result = addcslashes($result, '%_');
}
return $result;
} | [
"public",
"function",
"escape",
"(",
"$",
"text",
",",
"$",
"extra",
"=",
"false",
")",
"{",
"if",
"(",
"is_int",
"(",
"$",
"text",
")",
"||",
"is_float",
"(",
"$",
"text",
")",
")",
"{",
"return",
"$",
"text",
";",
"}",
"$",
"result",
"=",
"su... | Escapes a string for usage in an SQL statement.
@param string $text The string to be escaped.
@param bool $extra Optional parameter to provide extra escaping.
@return string The escaped string.
@author Maximiian Ruta <mr@xtain.net> | [
"Escapes",
"a",
"string",
"for",
"usage",
"in",
"an",
"SQL",
"statement",
"."
] | 3d39e1278deba77c5a2197ad91973964ed2a38bd | https://github.com/XTAIN/JoomlaBundle/blob/3d39e1278deba77c5a2197ad91973964ed2a38bd/Library/Joomla/Database/Driver/AbstractDoctrineDriver.php#L638-L651 |
3,383 | znframework/package-security | Script.php | Script.encode | public static function encode(String $str) : String
{
return preg_replace
(
array_keys(self::$scriptTagChars),
array_values(self::$scriptTagChars),
$str
);
} | php | public static function encode(String $str) : String
{
return preg_replace
(
array_keys(self::$scriptTagChars),
array_values(self::$scriptTagChars),
$str
);
} | [
"public",
"static",
"function",
"encode",
"(",
"String",
"$",
"str",
")",
":",
"String",
"{",
"return",
"preg_replace",
"(",
"array_keys",
"(",
"self",
"::",
"$",
"scriptTagChars",
")",
",",
"array_values",
"(",
"self",
"::",
"$",
"scriptTagChars",
")",
",... | Encode Script Tags
@param string $str
@return string | [
"Encode",
"Script",
"Tags"
] | dfced60e243ab9f52a1b5bbdb695bfc39b26cac0 | https://github.com/znframework/package-security/blob/dfced60e243ab9f52a1b5bbdb695bfc39b26cac0/Script.php#L43-L51 |
3,384 | znframework/package-security | Script.php | Script.decode | public static function decode(String $str) : String
{
return preg_replace
(
array_keys(self::$scriptTagCharsDecode),
array_values(self::$scriptTagCharsDecode),
$str
);
} | php | public static function decode(String $str) : String
{
return preg_replace
(
array_keys(self::$scriptTagCharsDecode),
array_values(self::$scriptTagCharsDecode),
$str
);
} | [
"public",
"static",
"function",
"decode",
"(",
"String",
"$",
"str",
")",
":",
"String",
"{",
"return",
"preg_replace",
"(",
"array_keys",
"(",
"self",
"::",
"$",
"scriptTagCharsDecode",
")",
",",
"array_values",
"(",
"self",
"::",
"$",
"scriptTagCharsDecode",... | Decode Script Tags
@param string $str
@return string | [
"Decode",
"Script",
"Tags"
] | dfced60e243ab9f52a1b5bbdb695bfc39b26cac0 | https://github.com/znframework/package-security/blob/dfced60e243ab9f52a1b5bbdb695bfc39b26cac0/Script.php#L60-L68 |
3,385 | phPoirot/Http | HttpMessage/Request/Plugin/ParseRequestData.php | ParseRequestData.parseBody | function parseBody()
{
$request = $this->getMessageObject();
$reqID = spl_object_hash($request);
if ( isset(self::$_parsed[$reqID]) )
// parse from cached
return self::$_parsed[$reqID];
if ($request->headers()->has('content-type')) {
$contentTy... | php | function parseBody()
{
$request = $this->getMessageObject();
$reqID = spl_object_hash($request);
if ( isset(self::$_parsed[$reqID]) )
// parse from cached
return self::$_parsed[$reqID];
if ($request->headers()->has('content-type')) {
$contentTy... | [
"function",
"parseBody",
"(",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"getMessageObject",
"(",
")",
";",
"$",
"reqID",
"=",
"spl_object_hash",
"(",
"$",
"request",
")",
";",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"_parsed",
"[",
"$",
... | Parse Request Body Data
@return array
@throws \Exception | [
"Parse",
"Request",
"Body",
"Data"
] | 3230b3555abf0e74c3d593fc49c8978758969736 | https://github.com/phPoirot/Http/blob/3230b3555abf0e74c3d593fc49c8978758969736/HttpMessage/Request/Plugin/ParseRequestData.php#L23-L71 |
3,386 | phPoirot/Http | HttpMessage/Request/Plugin/ParseRequestData.php | ParseRequestData.parseQueryParams | function parseQueryParams()
{
$request = $this->getMessageObject();
$data = array();
$url = $request->getTarget();
if ($p = parse_url($url, PHP_URL_QUERY))
parse_str($p, $data);
return $data;
} | php | function parseQueryParams()
{
$request = $this->getMessageObject();
$data = array();
$url = $request->getTarget();
if ($p = parse_url($url, PHP_URL_QUERY))
parse_str($p, $data);
return $data;
} | [
"function",
"parseQueryParams",
"(",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"getMessageObject",
"(",
")",
";",
"$",
"data",
"=",
"array",
"(",
")",
";",
"$",
"url",
"=",
"$",
"request",
"->",
"getTarget",
"(",
")",
";",
"if",
"(",
"$",
... | Parse Request Query Params
@return array | [
"Parse",
"Request",
"Query",
"Params"
] | 3230b3555abf0e74c3d593fc49c8978758969736 | https://github.com/phPoirot/Http/blob/3230b3555abf0e74c3d593fc49c8978758969736/HttpMessage/Request/Plugin/ParseRequestData.php#L78-L88 |
3,387 | routegroup/native-media | src/Concerns/Paths.php | Paths.getUrlAttribute | public function getUrlAttribute()
{
if ($this->disk == 'public') {
return url($this->storage->url($this->path));
}
return config('media.download', false) ? url(str_finish(config('media.download'), '/') . $this->id) : null;
} | php | public function getUrlAttribute()
{
if ($this->disk == 'public') {
return url($this->storage->url($this->path));
}
return config('media.download', false) ? url(str_finish(config('media.download'), '/') . $this->id) : null;
} | [
"public",
"function",
"getUrlAttribute",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"disk",
"==",
"'public'",
")",
"{",
"return",
"url",
"(",
"$",
"this",
"->",
"storage",
"->",
"url",
"(",
"$",
"this",
"->",
"path",
")",
")",
";",
"}",
"return",... | Url to file.
@return string|null | [
"Url",
"to",
"file",
"."
] | 5ea35c46c2ac1019e277ec4fe698f17581524631 | https://github.com/routegroup/native-media/blob/5ea35c46c2ac1019e277ec4fe698f17581524631/src/Concerns/Paths.php#L56-L63 |
3,388 | aedart/model | src/Traits/Strings/FirstNameTrait.php | FirstNameTrait.getFirstName | public function getFirstName() : ?string
{
if ( ! $this->hasFirstName()) {
$this->setFirstName($this->getDefaultFirstName());
}
return $this->firstName;
} | php | public function getFirstName() : ?string
{
if ( ! $this->hasFirstName()) {
$this->setFirstName($this->getDefaultFirstName());
}
return $this->firstName;
} | [
"public",
"function",
"getFirstName",
"(",
")",
":",
"?",
"string",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasFirstName",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setFirstName",
"(",
"$",
"this",
"->",
"getDefaultFirstName",
"(",
")",
")",
";",
"}",... | Get first name
If no "first name" value has been set, this method will
set and return a default "first name" value,
if any such value is available
@see getDefaultFirstName()
@return string|null first name or null if no first name has been set | [
"Get",
"first",
"name"
] | 9a562c1c53a276d01ace0ab71f5305458bea542f | https://github.com/aedart/model/blob/9a562c1c53a276d01ace0ab71f5305458bea542f/src/Traits/Strings/FirstNameTrait.php#L48-L54 |
3,389 | circle314/type | src/TypeTrait/DateTimeTypeTrait.php | DateTimeTypeTrait.isUnixTimestamp | private function isUnixTimestamp($value): bool
{
return
(string)(float)$value == (string)$value &&
((float)$value <= PHP_INT_MAX) &&
((float)$value >= ~PHP_INT_MAX)
;
} | php | private function isUnixTimestamp($value): bool
{
return
(string)(float)$value == (string)$value &&
((float)$value <= PHP_INT_MAX) &&
((float)$value >= ~PHP_INT_MAX)
;
} | [
"private",
"function",
"isUnixTimestamp",
"(",
"$",
"value",
")",
":",
"bool",
"{",
"return",
"(",
"string",
")",
"(",
"float",
")",
"$",
"value",
"==",
"(",
"string",
")",
"$",
"value",
"&&",
"(",
"(",
"float",
")",
"$",
"value",
"<=",
"PHP_INT_MAX"... | Checks whether a value is a valid UNIX timestamp
@param $value
@return bool | [
"Checks",
"whether",
"a",
"value",
"is",
"a",
"valid",
"UNIX",
"timestamp"
] | 4048d57efad65f043b549c3c4b48b1d0e6c09a3f | https://github.com/circle314/type/blob/4048d57efad65f043b549c3c4b48b1d0e6c09a3f/src/TypeTrait/DateTimeTypeTrait.php#L27-L34 |
3,390 | circle314/type | src/TypeTrait/DateTimeTypeTrait.php | DateTimeTypeTrait.validateDateTime | private function validateDateTime($value): void
{
try {
if(
is_a($value, DateTime::class) ||
is_null($value) ||
$value === 'now'
) {
// Expected and valid values, no need to attempt conversion
} else {
... | php | private function validateDateTime($value): void
{
try {
if(
is_a($value, DateTime::class) ||
is_null($value) ||
$value === 'now'
) {
// Expected and valid values, no need to attempt conversion
} else {
... | [
"private",
"function",
"validateDateTime",
"(",
"$",
"value",
")",
":",
"void",
"{",
"try",
"{",
"if",
"(",
"is_a",
"(",
"$",
"value",
",",
"DateTime",
"::",
"class",
")",
"||",
"is_null",
"(",
"$",
"value",
")",
"||",
"$",
"value",
"===",
"'now'",
... | Validates a value as a nullable value that can be cast to DateTime
@param $value
@throws TypeValidationException | [
"Validates",
"a",
"value",
"as",
"a",
"nullable",
"value",
"that",
"can",
"be",
"cast",
"to",
"DateTime"
] | 4048d57efad65f043b549c3c4b48b1d0e6c09a3f | https://github.com/circle314/type/blob/4048d57efad65f043b549c3c4b48b1d0e6c09a3f/src/TypeTrait/DateTimeTypeTrait.php#L53-L74 |
3,391 | Fenzland/Htsl.php | libs/ReadingBuffer/StringBuffer.php | StringBuffer.goSide | public function goSide( $fileName ):parent
{
$filePath= $this->htsl->getFilePath($fileName,dirname($this->filePath));
$content= $this->htsl->getFileContent($filePath);
return new static($this->htsl,$content,$filePath);
} | php | public function goSide( $fileName ):parent
{
$filePath= $this->htsl->getFilePath($fileName,dirname($this->filePath));
$content= $this->htsl->getFileContent($filePath);
return new static($this->htsl,$content,$filePath);
} | [
"public",
"function",
"goSide",
"(",
"$",
"fileName",
")",
":",
"parent",
"{",
"$",
"filePath",
"=",
"$",
"this",
"->",
"htsl",
"->",
"getFilePath",
"(",
"$",
"fileName",
",",
"dirname",
"(",
"$",
"this",
"->",
"filePath",
")",
")",
";",
"$",
"conten... | Getting another file reference fake file of this buffer.
@access public
@param string $fileName
@return \Htsl\ReadingBuffer\Contracts\ABuffer | [
"Getting",
"another",
"file",
"reference",
"fake",
"file",
"of",
"this",
"buffer",
"."
] | 28ecc4afd1a5bdb29dea3589c8132adba87f3947 | https://github.com/Fenzland/Htsl.php/blob/28ecc4afd1a5bdb29dea3589c8132adba87f3947/libs/ReadingBuffer/StringBuffer.php#L64-L70 |
3,392 | heennkkee/rss | src/rss/Crss.php | Crss.connect | private function connect()
{
try {
$this->db = new \PDO(
$this->dbOptions['dsn'],
$this->dbOptions['username'],
$this->dbOptions['password'],
$this->dbOptions['driver_options']
);
} catch (\Exception $e) {
... | php | private function connect()
{
try {
$this->db = new \PDO(
$this->dbOptions['dsn'],
$this->dbOptions['username'],
$this->dbOptions['password'],
$this->dbOptions['driver_options']
);
} catch (\Exception $e) {
... | [
"private",
"function",
"connect",
"(",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"db",
"=",
"new",
"\\",
"PDO",
"(",
"$",
"this",
"->",
"dbOptions",
"[",
"'dsn'",
"]",
",",
"$",
"this",
"->",
"dbOptions",
"[",
"'username'",
"]",
",",
"$",
"this",
... | Internal function for connecting to the database
@return void | [
"Internal",
"function",
"for",
"connecting",
"to",
"the",
"database"
] | 3c990af5dc9d41edd2c6ca85232a0e2cbb1ef533 | https://github.com/heennkkee/rss/blob/3c990af5dc9d41edd2c6ca85232a0e2cbb1ef533/src/rss/Crss.php#L89-L110 |
3,393 | heennkkee/rss | src/rss/Crss.php | Crss.checkValidity | private function checkValidity()
{
if (!is_writable($this->rssFile)) {
$this->valid = false;
return;
}
$stmt = $this->db->prepare('SELECT CREATED FROM ' . $this->table . ' ORDER BY CREATED DESC LIMIT 1');
$stmt->execute();
$res = $stmt->fetchAll();
... | php | private function checkValidity()
{
if (!is_writable($this->rssFile)) {
$this->valid = false;
return;
}
$stmt = $this->db->prepare('SELECT CREATED FROM ' . $this->table . ' ORDER BY CREATED DESC LIMIT 1');
$stmt->execute();
$res = $stmt->fetchAll();
... | [
"private",
"function",
"checkValidity",
"(",
")",
"{",
"if",
"(",
"!",
"is_writable",
"(",
"$",
"this",
"->",
"rssFile",
")",
")",
"{",
"$",
"this",
"->",
"valid",
"=",
"false",
";",
"return",
";",
"}",
"$",
"stmt",
"=",
"$",
"this",
"->",
"db",
... | Compares RSS file created timestamp and database timestamp to judge if new RSS file is needed
Sets internal variable $this->valid to true/false depending if new file needs to be generate
@return void | [
"Compares",
"RSS",
"file",
"created",
"timestamp",
"and",
"database",
"timestamp",
"to",
"judge",
"if",
"new",
"RSS",
"file",
"is",
"needed"
] | 3c990af5dc9d41edd2c6ca85232a0e2cbb1ef533 | https://github.com/heennkkee/rss/blob/3c990af5dc9d41edd2c6ca85232a0e2cbb1ef533/src/rss/Crss.php#L124-L150 |
3,394 | heennkkee/rss | src/rss/Crss.php | Crss.createRSS | private function createRSS()
{
$file = fopen($this->rssFile, "w+");
$stmt = $this->db->prepare('SELECT * FROM ' . $this->table . ' ORDER BY CREATED DESC LIMIT ?');
$stmt->execute([$this->newsCount]);
$res = $stmt->fetchAll();
$xmlVersion = '<?xml version="1.0" encoding="UTF... | php | private function createRSS()
{
$file = fopen($this->rssFile, "w+");
$stmt = $this->db->prepare('SELECT * FROM ' . $this->table . ' ORDER BY CREATED DESC LIMIT ?');
$stmt->execute([$this->newsCount]);
$res = $stmt->fetchAll();
$xmlVersion = '<?xml version="1.0" encoding="UTF... | [
"private",
"function",
"createRSS",
"(",
")",
"{",
"$",
"file",
"=",
"fopen",
"(",
"$",
"this",
"->",
"rssFile",
",",
"\"w+\"",
")",
";",
"$",
"stmt",
"=",
"$",
"this",
"->",
"db",
"->",
"prepare",
"(",
"'SELECT * FROM '",
".",
"$",
"this",
"->",
"... | Creates a new RSS File with information from the database. Max amount of news is configured in the initiation.
@return void | [
"Creates",
"a",
"new",
"RSS",
"File",
"with",
"information",
"from",
"the",
"database",
".",
"Max",
"amount",
"of",
"news",
"is",
"configured",
"in",
"the",
"initiation",
"."
] | 3c990af5dc9d41edd2c6ca85232a0e2cbb1ef533 | https://github.com/heennkkee/rss/blob/3c990af5dc9d41edd2c6ca85232a0e2cbb1ef533/src/rss/Crss.php#L157-L194 |
3,395 | heennkkee/rss | src/rss/Crss.php | Crss.getRSS | public function getRSS()
{
$this->checkValidity();
if (!$this->valid) {
$this->createRSS();
}
if ($this->sendHeader) {
header('Content-type: application/rss+xml; charset=UTF-8');
}
readfile($this->rssFile);
} | php | public function getRSS()
{
$this->checkValidity();
if (!$this->valid) {
$this->createRSS();
}
if ($this->sendHeader) {
header('Content-type: application/rss+xml; charset=UTF-8');
}
readfile($this->rssFile);
} | [
"public",
"function",
"getRSS",
"(",
")",
"{",
"$",
"this",
"->",
"checkValidity",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"valid",
")",
"{",
"$",
"this",
"->",
"createRSS",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"sendHeader"... | Function that should be called to receive the RSS feed.
Checks if the latest RSS File is up to date, if not, generates a new one.
@return void | [
"Function",
"that",
"should",
"be",
"called",
"to",
"receive",
"the",
"RSS",
"feed",
".",
"Checks",
"if",
"the",
"latest",
"RSS",
"File",
"is",
"up",
"to",
"date",
"if",
"not",
"generates",
"a",
"new",
"one",
"."
] | 3c990af5dc9d41edd2c6ca85232a0e2cbb1ef533 | https://github.com/heennkkee/rss/blob/3c990af5dc9d41edd2c6ca85232a0e2cbb1ef533/src/rss/Crss.php#L201-L214 |
3,396 | axypro/creator | helpers/Validator.php | Validator.validate | public static function validate($result, array $context)
{
if (!empty($context['parent'])) {
if (!($result instanceof $context['parent'])) {
throw new InvalidPointer('Object must be an instance of '.$context['parent']);
}
}
if (!empty($context['validat... | php | public static function validate($result, array $context)
{
if (!empty($context['parent'])) {
if (!($result instanceof $context['parent'])) {
throw new InvalidPointer('Object must be an instance of '.$context['parent']);
}
}
if (!empty($context['validat... | [
"public",
"static",
"function",
"validate",
"(",
"$",
"result",
",",
"array",
"$",
"context",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"context",
"[",
"'parent'",
"]",
")",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"result",
"instanceof",
"$",
"conte... | Checks a result
@param mixed $result
the result of creating
@param array $context
the context of the creator
@return boolean
@throws \axy\creator\errors\InvalidPointer | [
"Checks",
"a",
"result"
] | 3d74e2201cdb93912d32b1d80d1fdc44018f132a | https://github.com/axypro/creator/blob/3d74e2201cdb93912d32b1d80d1fdc44018f132a/helpers/Validator.php#L27-L40 |
3,397 | phossa2/libs | src/Phossa2/Logger/Traits/ExtendedLoggerTrait.php | ExtendedLoggerTrait.removeFromQueue | protected function removeFromQueue(
PriorityQueueInterface $queue,
$callabOrClassname
) {
if (is_object($callabOrClassname)) {
$queue->remove($callabOrClassname);
} else {
foreach ($queue as $data) {
if (is_a($data['data'], $callabOrClassname))... | php | protected function removeFromQueue(
PriorityQueueInterface $queue,
$callabOrClassname
) {
if (is_object($callabOrClassname)) {
$queue->remove($callabOrClassname);
} else {
foreach ($queue as $data) {
if (is_a($data['data'], $callabOrClassname))... | [
"protected",
"function",
"removeFromQueue",
"(",
"PriorityQueueInterface",
"$",
"queue",
",",
"$",
"callabOrClassname",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"callabOrClassname",
")",
")",
"{",
"$",
"queue",
"->",
"remove",
"(",
"$",
"callabOrClassname",
... | Remove callable or matching classname object from the queue
@param PriorityQueueInterface $queue
@param callable|string $callabOrClassname
@access protected | [
"Remove",
"callable",
"or",
"matching",
"classname",
"object",
"from",
"the",
"queue"
] | 921e485c8cc29067f279da2cdd06f47a9bddd115 | https://github.com/phossa2/libs/blob/921e485c8cc29067f279da2cdd06f47a9bddd115/src/Phossa2/Logger/Traits/ExtendedLoggerTrait.php#L147-L160 |
3,398 | phossa2/libs | src/Phossa2/Logger/Traits/ExtendedLoggerTrait.php | ExtendedLoggerTrait.runProcessors | protected function runProcessors(LogEntryInterface $logEntry)
{
// get related processors
$queue = $this->getCallables('processors', $logEntry->getChannel());
// loop thru these processors
foreach ($queue as $data) {
call_user_func($data['data'], $logEntry);
}
... | php | protected function runProcessors(LogEntryInterface $logEntry)
{
// get related processors
$queue = $this->getCallables('processors', $logEntry->getChannel());
// loop thru these processors
foreach ($queue as $data) {
call_user_func($data['data'], $logEntry);
}
... | [
"protected",
"function",
"runProcessors",
"(",
"LogEntryInterface",
"$",
"logEntry",
")",
"{",
"// get related processors",
"$",
"queue",
"=",
"$",
"this",
"->",
"getCallables",
"(",
"'processors'",
",",
"$",
"logEntry",
"->",
"getChannel",
"(",
")",
")",
";",
... | Execute related processors on the log entry
@param LogEntryInterface $logEntry
@return $this
@access protected | [
"Execute",
"related",
"processors",
"on",
"the",
"log",
"entry"
] | 921e485c8cc29067f279da2cdd06f47a9bddd115 | https://github.com/phossa2/libs/blob/921e485c8cc29067f279da2cdd06f47a9bddd115/src/Phossa2/Logger/Traits/ExtendedLoggerTrait.php#L181-L192 |
3,399 | phossa2/libs | src/Phossa2/Logger/Traits/ExtendedLoggerTrait.php | ExtendedLoggerTrait.runHandlers | protected function runHandlers(LogEntryInterface $logEntry)
{
// get related handlers
$queue = $this->getCallables('handlers', $logEntry->getChannel());
// loop thru these handlers
foreach ($queue as $data) {
// stopped ?
if ($logEntry->isPropagationStopped()... | php | protected function runHandlers(LogEntryInterface $logEntry)
{
// get related handlers
$queue = $this->getCallables('handlers', $logEntry->getChannel());
// loop thru these handlers
foreach ($queue as $data) {
// stopped ?
if ($logEntry->isPropagationStopped()... | [
"protected",
"function",
"runHandlers",
"(",
"LogEntryInterface",
"$",
"logEntry",
")",
"{",
"// get related handlers",
"$",
"queue",
"=",
"$",
"this",
"->",
"getCallables",
"(",
"'handlers'",
",",
"$",
"logEntry",
"->",
"getChannel",
"(",
")",
")",
";",
"// l... | Execute related handlers on the log entry
@param LogEntryInterface $logEntry
@return $this
@access protected
@since 2.0.1 added level checking here | [
"Execute",
"related",
"handlers",
"on",
"the",
"log",
"entry"
] | 921e485c8cc29067f279da2cdd06f47a9bddd115 | https://github.com/phossa2/libs/blob/921e485c8cc29067f279da2cdd06f47a9bddd115/src/Phossa2/Logger/Traits/ExtendedLoggerTrait.php#L202-L222 |
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.