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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
229,900 | clickalicious/rng | src/Generator.php | Generator.checkRequirements | protected function checkRequirements($mode)
{
if (true !== in_array($mode, self::$validModes, true)) {
throw new Exception(
sprintf('Mode "%s" not supported. Supported: "%s"', $mode, var_export(self::$validModes, true))
);
}
switch ($mode) {
... | php | protected function checkRequirements($mode)
{
if (true !== in_array($mode, self::$validModes, true)) {
throw new Exception(
sprintf('Mode "%s" not supported. Supported: "%s"', $mode, var_export(self::$validModes, true))
);
}
switch ($mode) {
... | [
"protected",
"function",
"checkRequirements",
"(",
"$",
"mode",
")",
"{",
"if",
"(",
"true",
"!==",
"in_array",
"(",
"$",
"mode",
",",
"self",
"::",
"$",
"validModes",
",",
"true",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"sprintf",
"(",
"'Mode... | Checks if requirements for mode are fulfilled.
@param int $mode The mode to check requirements for
@author Benjamin Carl <opensource@clickalicious.de>
@return bool TRUE on success, otherwise FALSE
@throws \Clickalicious\Rng\Exception | [
"Checks",
"if",
"requirements",
"for",
"mode",
"are",
"fulfilled",
"."
] | 9ee48ac4c5a9000e5776559715d027228a015bf9 | https://github.com/clickalicious/rng/blob/9ee48ac4c5a9000e5776559715d027228a015bf9/src/Generator.php#L373-L391 |
229,901 | clickalicious/rng | src/Generator.php | Generator.setSeed | public function setSeed($seed)
{
if (is_int($seed) !== true) {
throw new Exception(
sprintf('The type of the seed value "%s" need to be int. You passed a(n) "%s".', $seed, gettype($seed))
);
}
// We need to call different methods depending on chosen s... | php | public function setSeed($seed)
{
if (is_int($seed) !== true) {
throw new Exception(
sprintf('The type of the seed value "%s" need to be int. You passed a(n) "%s".', $seed, gettype($seed))
);
}
// We need to call different methods depending on chosen s... | [
"public",
"function",
"setSeed",
"(",
"$",
"seed",
")",
"{",
"if",
"(",
"is_int",
"(",
"$",
"seed",
")",
"!==",
"true",
")",
"{",
"throw",
"new",
"Exception",
"(",
"sprintf",
"(",
"'The type of the seed value \"%s\" need to be int. You passed a(n) \"%s\".'",
",",
... | Setter for seed.
@param int $seed The seed value
@author Benjamin Carl <opensource@clickalicious.de>
@throws \Clickalicious\Rng\Exception | [
"Setter",
"for",
"seed",
"."
] | 9ee48ac4c5a9000e5776559715d027228a015bf9 | https://github.com/clickalicious/rng/blob/9ee48ac4c5a9000e5776559715d027228a015bf9/src/Generator.php#L447-L473 |
229,902 | Iandenh/cakephp-sendgrid | src/Mailer/Transport/SendgridTransport.php | SendgridTransport._send | protected function _send($message)
{
$options = [
'headers' => ['Authorization' => 'Bearer ' . $this->getConfig('api_key')]
];
$response = $this->http->post('/api/mail.send.json', $message, $options);
if ($response->getStatusCode() !== 200) {
throw new Sendgri... | php | protected function _send($message)
{
$options = [
'headers' => ['Authorization' => 'Bearer ' . $this->getConfig('api_key')]
];
$response = $this->http->post('/api/mail.send.json', $message, $options);
if ($response->getStatusCode() !== 200) {
throw new Sendgri... | [
"protected",
"function",
"_send",
"(",
"$",
"message",
")",
"{",
"$",
"options",
"=",
"[",
"'headers'",
"=>",
"[",
"'Authorization'",
"=>",
"'Bearer '",
".",
"$",
"this",
"->",
"getConfig",
"(",
"'api_key'",
")",
"]",
"]",
";",
"$",
"response",
"=",
"$... | Send normal email
@param array $message The Message Array
@return array Returns an array with the results from the SendGrid API
@throws \SendgridEmail\Mailer\Exception\SendgridEmailException | [
"Send",
"normal",
"email"
] | 491571517ff538653780b5c723bf9c9198f2f68c | https://github.com/Iandenh/cakephp-sendgrid/blob/491571517ff538653780b5c723bf9c9198f2f68c/src/Mailer/Transport/SendgridTransport.php#L97-L113 |
229,903 | Iandenh/cakephp-sendgrid | src/Mailer/Transport/SendgridTransport.php | SendgridTransport._attachments | protected function _attachments(Email $email, array $message = [])
{
foreach ($email->getAttachments() as $filename => $attach) {
$content = isset($attach['data']) ? base64_decode($attach['data']) : file_get_contents($attach['file']);
$message['files'][$filename] = $content;
... | php | protected function _attachments(Email $email, array $message = [])
{
foreach ($email->getAttachments() as $filename => $attach) {
$content = isset($attach['data']) ? base64_decode($attach['data']) : file_get_contents($attach['file']);
$message['files'][$filename] = $content;
... | [
"protected",
"function",
"_attachments",
"(",
"Email",
"$",
"email",
",",
"array",
"$",
"message",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"email",
"->",
"getAttachments",
"(",
")",
"as",
"$",
"filename",
"=>",
"$",
"attach",
")",
"{",
"$",
"co... | Format the attachments
@param \Cake\Mailer\Email $email Email instance.
@param array $message A message array.
@return array Message | [
"Format",
"the",
"attachments"
] | 491571517ff538653780b5c723bf9c9198f2f68c | https://github.com/Iandenh/cakephp-sendgrid/blob/491571517ff538653780b5c723bf9c9198f2f68c/src/Mailer/Transport/SendgridTransport.php#L122-L133 |
229,904 | Webiny/Framework | src/Webiny/Component/Rest/Parser/MethodParser.php | MethodParser.getHeader | private function getHeader(ConfigObject $annotations)
{
// headers status code depends on the request method type, unless it's forced on the class or method
$successStatus = $annotations->get('header.status.success', false);
if (!$successStatus) {
$successStatus = $this->classDef... | php | private function getHeader(ConfigObject $annotations)
{
// headers status code depends on the request method type, unless it's forced on the class or method
$successStatus = $annotations->get('header.status.success', false);
if (!$successStatus) {
$successStatus = $this->classDef... | [
"private",
"function",
"getHeader",
"(",
"ConfigObject",
"$",
"annotations",
")",
"{",
"// headers status code depends on the request method type, unless it's forced on the class or method",
"$",
"successStatus",
"=",
"$",
"annotations",
"->",
"get",
"(",
"'header.status.success'... | Extracts http header information from method annotations.
@param ConfigObject $annotations Method annotations.
@return array | [
"Extracts",
"http",
"header",
"information",
"from",
"method",
"annotations",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Rest/Parser/MethodParser.php#L203-L233 |
229,905 | Webiny/Framework | src/Webiny/Component/Rest/Parser/MethodParser.php | MethodParser.buildUrlPatternStandard | private function buildUrlPatternStandard($methodName, array $parameters)
{
$url = $methodName;
if ($this->normalize) {
$url = PathTransformations::methodNameToUrl($methodName);
}
foreach ($parameters as $p) {
$matchType = $p->matchPattern;
$url = ... | php | private function buildUrlPatternStandard($methodName, array $parameters)
{
$url = $methodName;
if ($this->normalize) {
$url = PathTransformations::methodNameToUrl($methodName);
}
foreach ($parameters as $p) {
$matchType = $p->matchPattern;
$url = ... | [
"private",
"function",
"buildUrlPatternStandard",
"(",
"$",
"methodName",
",",
"array",
"$",
"parameters",
")",
"{",
"$",
"url",
"=",
"$",
"methodName",
";",
"if",
"(",
"$",
"this",
"->",
"normalize",
")",
"{",
"$",
"url",
"=",
"PathTransformations",
"::",... | Builds the url match pattern for each of the method inside the api.
@param string $methodName Method name.
@param array $parameters List of the ParsedParameter instances.
@return string The url pattern. | [
"Builds",
"the",
"url",
"match",
"pattern",
"for",
"each",
"of",
"the",
"method",
"inside",
"the",
"api",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Rest/Parser/MethodParser.php#L255-L268 |
229,906 | Webiny/Framework | src/Webiny/Component/Rest/Parser/MethodParser.php | MethodParser.buildUrlPatternFromPattern | private function buildUrlPatternFromPattern($pattern, array $parameters)
{
foreach ($parameters as $p) {
$pattern = str_replace('{' . $p->name . '}', $p->matchPattern, $pattern, $rcount);
if ($rcount < 1) {
throw new RestException(sprintf('Missing parameter "%s" for "... | php | private function buildUrlPatternFromPattern($pattern, array $parameters)
{
foreach ($parameters as $p) {
$pattern = str_replace('{' . $p->name . '}', $p->matchPattern, $pattern, $rcount);
if ($rcount < 1) {
throw new RestException(sprintf('Missing parameter "%s" for "... | [
"private",
"function",
"buildUrlPatternFromPattern",
"(",
"$",
"pattern",
",",
"array",
"$",
"parameters",
")",
"{",
"foreach",
"(",
"$",
"parameters",
"as",
"$",
"p",
")",
"{",
"$",
"pattern",
"=",
"str_replace",
"(",
"'{'",
".",
"$",
"p",
"->",
"name",... | Builds the url pattern using the `rest.url` definition from method phpDoc.
@param string $pattern Defined `rest.url` pattern.
@param array $parameters List of method parameters.
@return string
@throws RestException | [
"Builds",
"the",
"url",
"pattern",
"using",
"the",
"rest",
".",
"url",
"definition",
"from",
"method",
"phpDoc",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Rest/Parser/MethodParser.php#L279-L290 |
229,907 | Webiny/Framework | src/Webiny/Component/Cache/Storage/Couchbase.php | Couchbase.getInstance | public static function getInstance($user, $password, $bucket, $host)
{
return \Webiny\Component\Cache\Bridge\Couchbase::getInstance($user, $password, $bucket, $host);
} | php | public static function getInstance($user, $password, $bucket, $host)
{
return \Webiny\Component\Cache\Bridge\Couchbase::getInstance($user, $password, $bucket, $host);
} | [
"public",
"static",
"function",
"getInstance",
"(",
"$",
"user",
",",
"$",
"password",
",",
"$",
"bucket",
",",
"$",
"host",
")",
"{",
"return",
"\\",
"Webiny",
"\\",
"Component",
"\\",
"Cache",
"\\",
"Bridge",
"\\",
"Couchbase",
"::",
"getInstance",
"("... | Get an instance of Couchbase cache storage.
@param string $user Couchbase username.
@param string $password Couchbase password.
@param string $bucket Couchbase bucket.
@param string $host Couchbase host (with port number).
@return CacheStorageInterface | [
"Get",
"an",
"instance",
"of",
"Couchbase",
"cache",
"storage",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Cache/Storage/Couchbase.php#L29-L32 |
229,908 | juliangut/slim-doctrine | src/ManagerBuilder.php | ManagerBuilder.loadSettings | public function loadSettings(array $settings)
{
$relationalManagerKey = $this->getOption(static::RELATIONAL_MANAGER_KEY);
if (array_key_exists($relationalManagerKey, $settings)) {
$this->registerEntityManagers((array) $settings[$relationalManagerKey]);
}
$mongoDBManagerK... | php | public function loadSettings(array $settings)
{
$relationalManagerKey = $this->getOption(static::RELATIONAL_MANAGER_KEY);
if (array_key_exists($relationalManagerKey, $settings)) {
$this->registerEntityManagers((array) $settings[$relationalManagerKey]);
}
$mongoDBManagerK... | [
"public",
"function",
"loadSettings",
"(",
"array",
"$",
"settings",
")",
"{",
"$",
"relationalManagerKey",
"=",
"$",
"this",
"->",
"getOption",
"(",
"static",
"::",
"RELATIONAL_MANAGER_KEY",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"relationalManagerK... | Load Doctrine managers from settings array.
@param array $settings
@throws \RuntimeException
@return $this | [
"Load",
"Doctrine",
"managers",
"from",
"settings",
"array",
"."
] | 1a7a24f445e9eb4d4223f5f851e2beb7305c0ab3 | https://github.com/juliangut/slim-doctrine/blob/1a7a24f445e9eb4d4223f5f851e2beb7305c0ab3/src/ManagerBuilder.php#L88-L106 |
229,909 | juliangut/slim-doctrine | src/ManagerBuilder.php | ManagerBuilder.registerEntityManagers | protected function registerEntityManagers(array $settings)
{
if (array_key_exists('connection', $settings)) {
$settings = [$settings];
}
foreach ($settings as $name => $config) {
if (!is_string($name)) {
$name = $this->getOption(static::RELATIONAL_MAN... | php | protected function registerEntityManagers(array $settings)
{
if (array_key_exists('connection', $settings)) {
$settings = [$settings];
}
foreach ($settings as $name => $config) {
if (!is_string($name)) {
$name = $this->getOption(static::RELATIONAL_MAN... | [
"protected",
"function",
"registerEntityManagers",
"(",
"array",
"$",
"settings",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"'connection'",
",",
"$",
"settings",
")",
")",
"{",
"$",
"settings",
"=",
"[",
"$",
"settings",
"]",
";",
"}",
"foreach",
"(",
... | Register ORM entity managers.
@param array $settings
@throws \RuntimeException | [
"Register",
"ORM",
"entity",
"managers",
"."
] | 1a7a24f445e9eb4d4223f5f851e2beb7305c0ab3 | https://github.com/juliangut/slim-doctrine/blob/1a7a24f445e9eb4d4223f5f851e2beb7305c0ab3/src/ManagerBuilder.php#L115-L128 |
229,910 | juliangut/slim-doctrine | src/ManagerBuilder.php | ManagerBuilder.registerMongoDBDocumentManagers | protected function registerMongoDBDocumentManagers(array $settings)
{
if (array_key_exists('connection', $settings)) {
$settings = [$settings];
}
foreach ($settings as $name => $config) {
if (!is_string($name)) {
$name = $this->getOption(static::MONGO... | php | protected function registerMongoDBDocumentManagers(array $settings)
{
if (array_key_exists('connection', $settings)) {
$settings = [$settings];
}
foreach ($settings as $name => $config) {
if (!is_string($name)) {
$name = $this->getOption(static::MONGO... | [
"protected",
"function",
"registerMongoDBDocumentManagers",
"(",
"array",
"$",
"settings",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"'connection'",
",",
"$",
"settings",
")",
")",
"{",
"$",
"settings",
"=",
"[",
"$",
"settings",
"]",
";",
"}",
"foreach"... | Register MongoDB ODM document managers.
@param array $settings
@throws \RuntimeException | [
"Register",
"MongoDB",
"ODM",
"document",
"managers",
"."
] | 1a7a24f445e9eb4d4223f5f851e2beb7305c0ab3 | https://github.com/juliangut/slim-doctrine/blob/1a7a24f445e9eb4d4223f5f851e2beb7305c0ab3/src/ManagerBuilder.php#L137-L150 |
229,911 | juliangut/slim-doctrine | src/ManagerBuilder.php | ManagerBuilder.registerCouchDBDocumentManagers | protected function registerCouchDBDocumentManagers(array $settings)
{
if (array_key_exists('connection', $settings)) {
$settings = [$settings];
}
foreach ($settings as $name => $config) {
if (!is_string($name)) {
$name = $this->getOption(static::COUCH... | php | protected function registerCouchDBDocumentManagers(array $settings)
{
if (array_key_exists('connection', $settings)) {
$settings = [$settings];
}
foreach ($settings as $name => $config) {
if (!is_string($name)) {
$name = $this->getOption(static::COUCH... | [
"protected",
"function",
"registerCouchDBDocumentManagers",
"(",
"array",
"$",
"settings",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"'connection'",
",",
"$",
"settings",
")",
")",
"{",
"$",
"settings",
"=",
"[",
"$",
"settings",
"]",
";",
"}",
"foreach"... | Register CouchDB ODM document managers.
@param array $settings
@throws \RuntimeException | [
"Register",
"CouchDB",
"ODM",
"document",
"managers",
"."
] | 1a7a24f445e9eb4d4223f5f851e2beb7305c0ab3 | https://github.com/juliangut/slim-doctrine/blob/1a7a24f445e9eb4d4223f5f851e2beb7305c0ab3/src/ManagerBuilder.php#L159-L172 |
229,912 | juliangut/slim-doctrine | src/ManagerBuilder.php | ManagerBuilder.getManagers | public function getManagers()
{
$managers = array_map(
function (Builder $builder) {
return $builder->getManager();
},
$this->builders
);
$this->registerGlobalAnnotationLoader();
return $managers;
} | php | public function getManagers()
{
$managers = array_map(
function (Builder $builder) {
return $builder->getManager();
},
$this->builders
);
$this->registerGlobalAnnotationLoader();
return $managers;
} | [
"public",
"function",
"getManagers",
"(",
")",
"{",
"$",
"managers",
"=",
"array_map",
"(",
"function",
"(",
"Builder",
"$",
"builder",
")",
"{",
"return",
"$",
"builder",
"->",
"getManager",
"(",
")",
";",
"}",
",",
"$",
"this",
"->",
"builders",
")",... | Get registered builder's managers.
@return \Doctrine\Common\Persistence\ObjectManager[] | [
"Get",
"registered",
"builder",
"s",
"managers",
"."
] | 1a7a24f445e9eb4d4223f5f851e2beb7305c0ab3 | https://github.com/juliangut/slim-doctrine/blob/1a7a24f445e9eb4d4223f5f851e2beb7305c0ab3/src/ManagerBuilder.php#L179-L191 |
229,913 | juliangut/slim-doctrine | src/ManagerBuilder.php | ManagerBuilder.getManager | public function getManager($name)
{
$builder = $this->getBuilder($name);
if (!$builder instanceof Builder) {
throw new \RuntimeException(sprintf('"%s" is not a registered manager', $name));
}
$manager = $builder->getManager();
$this->registerGlobalAnnotationLoad... | php | public function getManager($name)
{
$builder = $this->getBuilder($name);
if (!$builder instanceof Builder) {
throw new \RuntimeException(sprintf('"%s" is not a registered manager', $name));
}
$manager = $builder->getManager();
$this->registerGlobalAnnotationLoad... | [
"public",
"function",
"getManager",
"(",
"$",
"name",
")",
"{",
"$",
"builder",
"=",
"$",
"this",
"->",
"getBuilder",
"(",
"$",
"name",
")",
";",
"if",
"(",
"!",
"$",
"builder",
"instanceof",
"Builder",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException... | Get registered builder's manager.
@param string $name
@throws \RuntimeException
@return \Doctrine\Common\Persistence\ObjectManager | [
"Get",
"registered",
"builder",
"s",
"manager",
"."
] | 1a7a24f445e9eb4d4223f5f851e2beb7305c0ab3 | https://github.com/juliangut/slim-doctrine/blob/1a7a24f445e9eb4d4223f5f851e2beb7305c0ab3/src/ManagerBuilder.php#L202-L214 |
229,914 | deanblackborough/zf3-view-helpers | src/Bootstrap4ProgressBarMultiple.php | Bootstrap4ProgressBarMultiple.bgStyles | private function bgStyles(array $colors) : void
{
if (count($colors) !== count($this->values)) {
throw new Exception('Number of progress bar colours needs to match the number or progress bar values');
}
foreach ($colors as $color) {
if (in_array($color, $this->suppor... | php | private function bgStyles(array $colors) : void
{
if (count($colors) !== count($this->values)) {
throw new Exception('Number of progress bar colours needs to match the number or progress bar values');
}
foreach ($colors as $color) {
if (in_array($color, $this->suppor... | [
"private",
"function",
"bgStyles",
"(",
"array",
"$",
"colors",
")",
":",
"void",
"{",
"if",
"(",
"count",
"(",
"$",
"colors",
")",
"!==",
"count",
"(",
"$",
"this",
"->",
"values",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Number of progress ... | Set the background colour for each of the progress bars, values need to be one of the following, primary,
secondary, success, danger, warning, info, light, dark or white
@param array $colors
@throws Exception | [
"Set",
"the",
"background",
"colour",
"for",
"each",
"of",
"the",
"progress",
"bars",
"values",
"need",
"to",
"be",
"one",
"of",
"the",
"following",
"primary",
"secondary",
"success",
"danger",
"warning",
"info",
"light",
"dark",
"or",
"white"
] | db8bea4ca62709b2ac8c732aedbb2a5235223f23 | https://github.com/deanblackborough/zf3-view-helpers/blob/db8bea4ca62709b2ac8c732aedbb2a5235223f23/src/Bootstrap4ProgressBarMultiple.php#L83-L94 |
229,915 | deanblackborough/zf3-view-helpers | src/Bootstrap4ProgressBarMultiple.php | Bootstrap4ProgressBarMultiple.styles | private function styles(int $value) : string
{
$styles = '';
if ($value > 0) {
$styles .= ' width: ' . $value . '%;';
}
if ($this->height !== null && $this->height > 0) {
$styles .= ' height:' . $this->height . 'px;';
}
return $styles;
} | php | private function styles(int $value) : string
{
$styles = '';
if ($value > 0) {
$styles .= ' width: ' . $value . '%;';
}
if ($this->height !== null && $this->height > 0) {
$styles .= ' height:' . $this->height . 'px;';
}
return $styles;
} | [
"private",
"function",
"styles",
"(",
"int",
"$",
"value",
")",
":",
"string",
"{",
"$",
"styles",
"=",
"''",
";",
"if",
"(",
"$",
"value",
">",
"0",
")",
"{",
"$",
"styles",
".=",
"' width: '",
".",
"$",
"value",
".",
"'%;'",
";",
"}",
"if",
"... | Generate the style attributes for the progress bar
@param integer $value
@return string | [
"Generate",
"the",
"style",
"attributes",
"for",
"the",
"progress",
"bar"
] | db8bea4ca62709b2ac8c732aedbb2a5235223f23 | https://github.com/deanblackborough/zf3-view-helpers/blob/db8bea4ca62709b2ac8c732aedbb2a5235223f23/src/Bootstrap4ProgressBarMultiple.php#L194-L207 |
229,916 | fabulator/endomondo-api-old | lib/Fabulator/Endomondo/OldApiParser.php | OldApiParser.parsePoint | static function parsePoint($source)
{
$point = new Point;
if (isset($source['time'])) {
$point->setTime(new \DateTime($source['time']));
}
if (isset($source['lat'])) {
$point->setLatitude($source['lat']);
}
if (isset($source['lng'])) {
... | php | static function parsePoint($source)
{
$point = new Point;
if (isset($source['time'])) {
$point->setTime(new \DateTime($source['time']));
}
if (isset($source['lat'])) {
$point->setLatitude($source['lat']);
}
if (isset($source['lng'])) {
... | [
"static",
"function",
"parsePoint",
"(",
"$",
"source",
")",
"{",
"$",
"point",
"=",
"new",
"Point",
";",
"if",
"(",
"isset",
"(",
"$",
"source",
"[",
"'time'",
"]",
")",
")",
"{",
"$",
"point",
"->",
"setTime",
"(",
"new",
"\\",
"DateTime",
"(",
... | Parse point data from old Endomondo API.
@param $source array
@return Point | [
"Parse",
"point",
"data",
"from",
"old",
"Endomondo",
"API",
"."
] | c06871902f23ca9f40a7465cbecaf750a8114fa0 | https://github.com/fabulator/endomondo-api-old/blob/c06871902f23ca9f40a7465cbecaf750a8114fa0/lib/Fabulator/Endomondo/OldApiParser.php#L13-L54 |
229,917 | fabulator/endomondo-api-old | lib/Fabulator/Endomondo/OldApiParser.php | OldApiParser.parseWorkout | static function parseWorkout($source)
{
$workout = new Workout();
$workout
->setSource($source)
->setTypeId($source['sport'])
->setDuration($source['duration'])
->setStart(new \DateTime($source['start_time']))
->setMapPrivacy($source['priv... | php | static function parseWorkout($source)
{
$workout = new Workout();
$workout
->setSource($source)
->setTypeId($source['sport'])
->setDuration($source['duration'])
->setStart(new \DateTime($source['start_time']))
->setMapPrivacy($source['priv... | [
"static",
"function",
"parseWorkout",
"(",
"$",
"source",
")",
"{",
"$",
"workout",
"=",
"new",
"Workout",
"(",
")",
";",
"$",
"workout",
"->",
"setSource",
"(",
"$",
"source",
")",
"->",
"setTypeId",
"(",
"$",
"source",
"[",
"'sport'",
"]",
")",
"->... | Get Endomondo workout from old API
@param $source array
@return Workout | [
"Get",
"Endomondo",
"workout",
"from",
"old",
"API"
] | c06871902f23ca9f40a7465cbecaf750a8114fa0 | https://github.com/fabulator/endomondo-api-old/blob/c06871902f23ca9f40a7465cbecaf750a8114fa0/lib/Fabulator/Endomondo/OldApiParser.php#L62-L107 |
229,918 | alexandresalome/php-webdriver | src/WebDriver/Behat/AbstractWebDriverContext.php | AbstractWebDriverContext.tryRepeating | public function tryRepeating(\Closure $closure, $time = null)
{
if (null === $time) {
$time = $this->timeout;
}
$last = null;
$count = 0;
do {
$count++;
try {
return $closure($this->getBrowser());
} catch (\Exce... | php | public function tryRepeating(\Closure $closure, $time = null)
{
if (null === $time) {
$time = $this->timeout;
}
$last = null;
$count = 0;
do {
$count++;
try {
return $closure($this->getBrowser());
} catch (\Exce... | [
"public",
"function",
"tryRepeating",
"(",
"\\",
"Closure",
"$",
"closure",
",",
"$",
"time",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"time",
")",
"{",
"$",
"time",
"=",
"$",
"this",
"->",
"timeout",
";",
"}",
"$",
"last",
"=",
"nul... | Try repeating a statement until it stops throwing exception.
It's used for operations having a fail-tolerated risk.
@return mixed return value of closure | [
"Try",
"repeating",
"a",
"statement",
"until",
"it",
"stops",
"throwing",
"exception",
"."
] | ba187e7b13979e1db5001b7bfbe82d07c8e2e39d | https://github.com/alexandresalome/php-webdriver/blob/ba187e7b13979e1db5001b7bfbe82d07c8e2e39d/src/WebDriver/Behat/AbstractWebDriverContext.php#L43-L66 |
229,919 | alexandresalome/php-webdriver | src/WebDriver/Behat/AbstractWebDriverContext.php | AbstractWebDriverContext.getElements | public function getElements(By $by, Element $element = null)
{
try {
$obj = null === $element ? $this->getBrowser() : $element;
return $obj->elements($by);
} catch (ExceptionInterface $e) {
throw new \RuntimeException(sprintf('Error while searching for element "%... | php | public function getElements(By $by, Element $element = null)
{
try {
$obj = null === $element ? $this->getBrowser() : $element;
return $obj->elements($by);
} catch (ExceptionInterface $e) {
throw new \RuntimeException(sprintf('Error while searching for element "%... | [
"public",
"function",
"getElements",
"(",
"By",
"$",
"by",
",",
"Element",
"$",
"element",
"=",
"null",
")",
"{",
"try",
"{",
"$",
"obj",
"=",
"null",
"===",
"$",
"element",
"?",
"$",
"this",
"->",
"getBrowser",
"(",
")",
":",
"$",
"element",
";",
... | Proxy to browser, catch errors to display body on error.
@return array | [
"Proxy",
"to",
"browser",
"catch",
"errors",
"to",
"display",
"body",
"on",
"error",
"."
] | ba187e7b13979e1db5001b7bfbe82d07c8e2e39d | https://github.com/alexandresalome/php-webdriver/blob/ba187e7b13979e1db5001b7bfbe82d07c8e2e39d/src/WebDriver/Behat/AbstractWebDriverContext.php#L89-L98 |
229,920 | alexandresalome/php-webdriver | src/WebDriver/Behat/AbstractWebDriverContext.php | AbstractWebDriverContext.parseSelector | protected function parseSelector($text)
{
if (0 === strpos($text, 'id=')) {
return By::id(substr($text, 3));
}
if (0 === strpos($text, 'xpath=')) {
return By::xpath(substr($text, 6));
}
if (0 === strpos($text, 'css=')) {
return By::css(su... | php | protected function parseSelector($text)
{
if (0 === strpos($text, 'id=')) {
return By::id(substr($text, 3));
}
if (0 === strpos($text, 'xpath=')) {
return By::xpath(substr($text, 6));
}
if (0 === strpos($text, 'css=')) {
return By::css(su... | [
"protected",
"function",
"parseSelector",
"(",
"$",
"text",
")",
"{",
"if",
"(",
"0",
"===",
"strpos",
"(",
"$",
"text",
",",
"'id='",
")",
")",
"{",
"return",
"By",
"::",
"id",
"(",
"substr",
"(",
"$",
"text",
",",
"3",
")",
")",
";",
"}",
"if... | Converts a text selector to a By object.
Tries to find magic expressions (css=#foo, xpath=//div[@id="foo"], id=foo, name=q, class=active).
@return By|string returns a By instance when magic matched, the string otherwise | [
"Converts",
"a",
"text",
"selector",
"to",
"a",
"By",
"object",
"."
] | ba187e7b13979e1db5001b7bfbe82d07c8e2e39d | https://github.com/alexandresalome/php-webdriver/blob/ba187e7b13979e1db5001b7bfbe82d07c8e2e39d/src/WebDriver/Behat/AbstractWebDriverContext.php#L132-L155 |
229,921 | ZenMagick/ZenCart | includes/modules/payment/paypal.php | paypal.before_process | function before_process() {
global $order_total_modules;
list($this->transaction_amount, $this->transaction_currency) = $_SESSION['paypal_transaction_info'];
unset($_SESSION['paypal_transaction_info']);
if (isset($_GET['referer']) && $_GET['referer'] == 'paypal') {
$this->notify('NOTIFY_PAYMENT_PA... | php | function before_process() {
global $order_total_modules;
list($this->transaction_amount, $this->transaction_currency) = $_SESSION['paypal_transaction_info'];
unset($_SESSION['paypal_transaction_info']);
if (isset($_GET['referer']) && $_GET['referer'] == 'paypal') {
$this->notify('NOTIFY_PAYMENT_PA... | [
"function",
"before_process",
"(",
")",
"{",
"global",
"$",
"order_total_modules",
";",
"list",
"(",
"$",
"this",
"->",
"transaction_amount",
",",
"$",
"this",
"->",
"transaction_currency",
")",
"=",
"$",
"_SESSION",
"[",
"'paypal_transaction_info'",
"]",
";",
... | Store transaction info to the order and process any results that come back from the payment gateway | [
"Store",
"transaction",
"info",
"to",
"the",
"order",
"and",
"process",
"any",
"results",
"that",
"come",
"back",
"from",
"the",
"payment",
"gateway"
] | 00438ebc0faee786489aab4a6d70fc0d0c1461c7 | https://github.com/ZenMagick/ZenCart/blob/00438ebc0faee786489aab4a6d70fc0d0c1461c7/includes/modules/payment/paypal.php#L326-L359 |
229,922 | ZenMagick/ZenCart | includes/modules/payment/paypal.php | paypal.check | function check() {
global $db;
if (IS_ADMIN_FLAG === true) {
global $sniffer;
if ($sniffer->field_exists(TABLE_PAYPAL, 'zen_order_id')) $db->Execute("ALTER TABLE " . TABLE_PAYPAL . " CHANGE COLUMN zen_order_id order_id int(11) NOT NULL default '0'");
}
if (!isset($this->_check)) {
$ch... | php | function check() {
global $db;
if (IS_ADMIN_FLAG === true) {
global $sniffer;
if ($sniffer->field_exists(TABLE_PAYPAL, 'zen_order_id')) $db->Execute("ALTER TABLE " . TABLE_PAYPAL . " CHANGE COLUMN zen_order_id order_id int(11) NOT NULL default '0'");
}
if (!isset($this->_check)) {
$ch... | [
"function",
"check",
"(",
")",
"{",
"global",
"$",
"db",
";",
"if",
"(",
"IS_ADMIN_FLAG",
"===",
"true",
")",
"{",
"global",
"$",
"sniffer",
";",
"if",
"(",
"$",
"sniffer",
"->",
"field_exists",
"(",
"TABLE_PAYPAL",
",",
"'zen_order_id'",
")",
")",
"$"... | Check to see whether module is installed
@return boolean | [
"Check",
"to",
"see",
"whether",
"module",
"is",
"installed"
] | 00438ebc0faee786489aab4a6d70fc0d0c1461c7 | https://github.com/ZenMagick/ZenCart/blob/00438ebc0faee786489aab4a6d70fc0d0c1461c7/includes/modules/payment/paypal.php#L465-L476 |
229,923 | ikkez/f3-events | lib/event.php | Event.on | public function on($key,$func,$priority=10,$options=array()) {
$call = $options ? array($func,$options) : $func;
if ($e = &$this->f3->ref($this->ekey.$key))
$e[$priority][] = $call;
else
$e = array($priority=>array($call));
krsort($e);
} | php | public function on($key,$func,$priority=10,$options=array()) {
$call = $options ? array($func,$options) : $func;
if ($e = &$this->f3->ref($this->ekey.$key))
$e[$priority][] = $call;
else
$e = array($priority=>array($call));
krsort($e);
} | [
"public",
"function",
"on",
"(",
"$",
"key",
",",
"$",
"func",
",",
"$",
"priority",
"=",
"10",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"call",
"=",
"$",
"options",
"?",
"array",
"(",
"$",
"func",
",",
"$",
"options",
")",
... | add a listener to an event. It can catch the event dispatched by broadcast and emit.
@param $key
@param $func
@param int $priority
@param array $options | [
"add",
"a",
"listener",
"to",
"an",
"event",
".",
"It",
"can",
"catch",
"the",
"event",
"dispatched",
"by",
"broadcast",
"and",
"emit",
"."
] | 4dab051ad68ec93efa8ac42045579afc440189c3 | https://github.com/ikkez/f3-events/blob/4dab051ad68ec93efa8ac42045579afc440189c3/lib/event.php#L43-L50 |
229,924 | ikkez/f3-events | lib/event.php | Event.unwatch | public function unwatch($obj) {
$this->f3->clear('EVENTS_local.'.$this->f3->hash(spl_object_hash($obj)));
} | php | public function unwatch($obj) {
$this->f3->clear('EVENTS_local.'.$this->f3->hash(spl_object_hash($obj)));
} | [
"public",
"function",
"unwatch",
"(",
"$",
"obj",
")",
"{",
"$",
"this",
"->",
"f3",
"->",
"clear",
"(",
"'EVENTS_local.'",
".",
"$",
"this",
"->",
"f3",
"->",
"hash",
"(",
"spl_object_hash",
"(",
"$",
"obj",
")",
")",
")",
";",
"}"
] | drop the watching sensor for an object
@param $obj | [
"drop",
"the",
"watching",
"sensor",
"for",
"an",
"object"
] | 4dab051ad68ec93efa8ac42045579afc440189c3 | https://github.com/ikkez/f3-events/blob/4dab051ad68ec93efa8ac42045579afc440189c3/lib/event.php#L175-L177 |
229,925 | Webiny/Framework | src/Webiny/Component/StdLib/StdObject/ArrayObject/ArrayObject.php | ArrayObject.last | public function last()
{
$arr = $this->val();
$last = end($arr);
return StdObjectWrapper::returnStdObject($last);
} | php | public function last()
{
$arr = $this->val();
$last = end($arr);
return StdObjectWrapper::returnStdObject($last);
} | [
"public",
"function",
"last",
"(",
")",
"{",
"$",
"arr",
"=",
"$",
"this",
"->",
"val",
"(",
")",
";",
"$",
"last",
"=",
"end",
"(",
"$",
"arr",
")",
";",
"return",
"StdObjectWrapper",
"::",
"returnStdObject",
"(",
"$",
"last",
")",
";",
"}"
] | Get the last element in the array.
If the element is array, ArrayObject is returned, else StringObject is returned.
@return StringObject|ArrayObject|StdObjectWrapper The last element in the array. | [
"Get",
"the",
"last",
"element",
"in",
"the",
"array",
".",
"If",
"the",
"element",
"is",
"array",
"ArrayObject",
"is",
"returned",
"else",
"StringObject",
"is",
"returned",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/StdLib/StdObject/ArrayObject/ArrayObject.php#L107-L113 |
229,926 | Webiny/Framework | src/Webiny/Component/StdLib/StdObject/ArrayObject/ArrayObject.php | ArrayObject.first | public function first()
{
$arr = $this->val();
$first = reset($arr);
return StdObjectWrapper::returnStdObject($first);
} | php | public function first()
{
$arr = $this->val();
$first = reset($arr);
return StdObjectWrapper::returnStdObject($first);
} | [
"public",
"function",
"first",
"(",
")",
"{",
"$",
"arr",
"=",
"$",
"this",
"->",
"val",
"(",
")",
";",
"$",
"first",
"=",
"reset",
"(",
"$",
"arr",
")",
";",
"return",
"StdObjectWrapper",
"::",
"returnStdObject",
"(",
"$",
"first",
")",
";",
"}"
] | Get the first element in the array.
If the element is array, ArrayObject is returned, else StringObject is returned.
@return StringObject|ArrayObject|StdObjectWrapper The first element in the array. | [
"Get",
"the",
"first",
"element",
"in",
"the",
"array",
".",
"If",
"the",
"element",
"is",
"array",
"ArrayObject",
"is",
"returned",
"else",
"StringObject",
"is",
"returned",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/StdLib/StdObject/ArrayObject/ArrayObject.php#L121-L127 |
229,927 | Webiny/Framework | src/Webiny/Component/Http/HttpTrait.php | HttpTrait.httpRedirect | protected static function httpRedirect($url, $headers = [], $redirectCode = 301)
{
$url = new UrlObject($url);
$headers['Location'] = $url->val();
$response = new Response('', $redirectCode, $headers);
$response->sendHeaders();
} | php | protected static function httpRedirect($url, $headers = [], $redirectCode = 301)
{
$url = new UrlObject($url);
$headers['Location'] = $url->val();
$response = new Response('', $redirectCode, $headers);
$response->sendHeaders();
} | [
"protected",
"static",
"function",
"httpRedirect",
"(",
"$",
"url",
",",
"$",
"headers",
"=",
"[",
"]",
",",
"$",
"redirectCode",
"=",
"301",
")",
"{",
"$",
"url",
"=",
"new",
"UrlObject",
"(",
"$",
"url",
")",
";",
"$",
"headers",
"[",
"'Location'",... | Redirect the request to the given url.
@param string|UrlObject $url
@param string|int|array $headers Headers that you wish to send with your request.
@param int $redirectCode | [
"Redirect",
"the",
"request",
"to",
"the",
"given",
"url",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Http/HttpTrait.php#L71-L78 |
229,928 | ZenMagick/ZenCart | includes/modules/payment/authorizenet_aim.php | authorizenet_aim.tableCheckup | function tableCheckup() {
global $db, $sniffer;
$fieldOkay1 = (method_exists($sniffer, 'field_type')) ? $sniffer->field_type(TABLE_AUTHORIZENET, 'transaction_id', 'bigint(20)', true) : -1;
if ($fieldOkay1 !== true) {
$db->Execute("ALTER TABLE " . TABLE_AUTHORIZENET . " CHANGE transaction_id transactio... | php | function tableCheckup() {
global $db, $sniffer;
$fieldOkay1 = (method_exists($sniffer, 'field_type')) ? $sniffer->field_type(TABLE_AUTHORIZENET, 'transaction_id', 'bigint(20)', true) : -1;
if ($fieldOkay1 !== true) {
$db->Execute("ALTER TABLE " . TABLE_AUTHORIZENET . " CHANGE transaction_id transactio... | [
"function",
"tableCheckup",
"(",
")",
"{",
"global",
"$",
"db",
",",
"$",
"sniffer",
";",
"$",
"fieldOkay1",
"=",
"(",
"method_exists",
"(",
"$",
"sniffer",
",",
"'field_type'",
")",
")",
"?",
"$",
"sniffer",
"->",
"field_type",
"(",
"TABLE_AUTHORIZENET",
... | Check and fix table structure if appropriate | [
"Check",
"and",
"fix",
"table",
"structure",
"if",
"appropriate"
] | 00438ebc0faee786489aab4a6d70fc0d0c1461c7 | https://github.com/ZenMagick/ZenCart/blob/00438ebc0faee786489aab4a6d70fc0d0c1461c7/includes/modules/payment/authorizenet_aim.php#L674-L680 |
229,929 | Webiny/Framework | src/Webiny/Component/StdLib/StdObject/UrlObject/ManipulatorTrait.php | ManipulatorTrait.setScheme | public function setScheme($scheme)
{
// validate scheme
try {
$scheme = new StringObject($scheme);
} catch (\Exception $e) {
throw new UrlObjectException($e->getMessage());
}
if (!$scheme->endsWith('://')) {
$scheme->val($scheme->val() . '... | php | public function setScheme($scheme)
{
// validate scheme
try {
$scheme = new StringObject($scheme);
} catch (\Exception $e) {
throw new UrlObjectException($e->getMessage());
}
if (!$scheme->endsWith('://')) {
$scheme->val($scheme->val() . '... | [
"public",
"function",
"setScheme",
"(",
"$",
"scheme",
")",
"{",
"// validate scheme",
"try",
"{",
"$",
"scheme",
"=",
"new",
"StringObject",
"(",
"$",
"scheme",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"e",
")",
"{",
"throw",
"new",
"UrlOb... | Set url scheme.
@param StringObject|string $scheme - Scheme must end with '://'. Example 'http://'.
@throws UrlObjectException
@return $this | [
"Set",
"url",
"scheme",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/StdLib/StdObject/UrlObject/ManipulatorTrait.php#L32-L50 |
229,930 | Webiny/Framework | src/Webiny/Component/StdLib/StdObject/UrlObject/ManipulatorTrait.php | ManipulatorTrait.setHost | public function setHost($host)
{
try {
$host = new StringObject($host);
} catch (\Exception $e) {
throw new UrlObjectException($e->getMessage());
}
$this->host = $host->stripTrailingSlash()->trim()->val();
$this->rebuildUrl();
return $this;
... | php | public function setHost($host)
{
try {
$host = new StringObject($host);
} catch (\Exception $e) {
throw new UrlObjectException($e->getMessage());
}
$this->host = $host->stripTrailingSlash()->trim()->val();
$this->rebuildUrl();
return $this;
... | [
"public",
"function",
"setHost",
"(",
"$",
"host",
")",
"{",
"try",
"{",
"$",
"host",
"=",
"new",
"StringObject",
"(",
"$",
"host",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"e",
")",
"{",
"throw",
"new",
"UrlObjectException",
"(",
"$",
... | Set url host.
@param StringObject|string $host Url host.
@throws UrlObjectException
@return $this | [
"Set",
"url",
"host",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/StdLib/StdObject/UrlObject/ManipulatorTrait.php#L60-L73 |
229,931 | Webiny/Framework | src/Webiny/Component/StdLib/StdObject/UrlObject/ManipulatorTrait.php | ManipulatorTrait.setPort | public function setPort($port)
{
$this->port = StdObjectWrapper::toString($port);
$this->rebuildUrl();
return $this;
} | php | public function setPort($port)
{
$this->port = StdObjectWrapper::toString($port);
$this->rebuildUrl();
return $this;
} | [
"public",
"function",
"setPort",
"(",
"$",
"port",
")",
"{",
"$",
"this",
"->",
"port",
"=",
"StdObjectWrapper",
"::",
"toString",
"(",
"$",
"port",
")",
";",
"$",
"this",
"->",
"rebuildUrl",
"(",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Set url port.
@param StringObject|string $port Url port.
@return $this | [
"Set",
"url",
"port",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/StdLib/StdObject/UrlObject/ManipulatorTrait.php#L82-L88 |
229,932 | Webiny/Framework | src/Webiny/Component/StdLib/StdObject/UrlObject/ManipulatorTrait.php | ManipulatorTrait.setPath | public function setPath($path)
{
try {
$path = new StringObject($path);
} catch (\Exception $e) {
throw new UrlObjectException($e->getMessage());
}
if ($path != '') {
$path->trimLeft('/');
$this->path = '/' . $path->val();
} el... | php | public function setPath($path)
{
try {
$path = new StringObject($path);
} catch (\Exception $e) {
throw new UrlObjectException($e->getMessage());
}
if ($path != '') {
$path->trimLeft('/');
$this->path = '/' . $path->val();
} el... | [
"public",
"function",
"setPath",
"(",
"$",
"path",
")",
"{",
"try",
"{",
"$",
"path",
"=",
"new",
"StringObject",
"(",
"$",
"path",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"e",
")",
"{",
"throw",
"new",
"UrlObjectException",
"(",
"$",
... | Set url path.
@param StringObject|string $path Url path.
@throws UrlObjectException
@return $this | [
"Set",
"url",
"path",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/StdLib/StdObject/UrlObject/ManipulatorTrait.php#L98-L116 |
229,933 | Webiny/Framework | src/Webiny/Component/StdLib/StdObject/UrlObject/ManipulatorTrait.php | ManipulatorTrait.setQuery | public function setQuery($query, $append = false)
{
if ($this->isStdObject($query)) {
$query = $query->val();
}
if ($append && $this->query != '') {
if ($this->isString($this->query)) {
$currentQuery = new StringObject($this->query);
... | php | public function setQuery($query, $append = false)
{
if ($this->isStdObject($query)) {
$query = $query->val();
}
if ($append && $this->query != '') {
if ($this->isString($this->query)) {
$currentQuery = new StringObject($this->query);
... | [
"public",
"function",
"setQuery",
"(",
"$",
"query",
",",
"$",
"append",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isStdObject",
"(",
"$",
"query",
")",
")",
"{",
"$",
"query",
"=",
"$",
"query",
"->",
"val",
"(",
")",
";",
"}",
"i... | Set url query param.
@param StringObject|ArrayObject|string|array $query Query params.
@param bool $append Do you want to append or overwrite current query param.
In case when you are appending values, the values from $query,
that already exist in the current query, will be overwritte... | [
"Set",
"url",
"query",
"param",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/StdLib/StdObject/UrlObject/ManipulatorTrait.php#L130-L174 |
229,934 | Webiny/Framework | src/Webiny/Component/Security/Security.php | Security.firewall | public function firewall($firewallKey = '')
{
// initialize firewall
if (isset($this->firewalls[$firewallKey])) {
$fw = $this->firewalls[$firewallKey];
} else {
if ($firewallKey == '') {
$firewall = $this->getConfig()->Firewalls[0];
if ... | php | public function firewall($firewallKey = '')
{
// initialize firewall
if (isset($this->firewalls[$firewallKey])) {
$fw = $this->firewalls[$firewallKey];
} else {
if ($firewallKey == '') {
$firewall = $this->getConfig()->Firewalls[0];
if ... | [
"public",
"function",
"firewall",
"(",
"$",
"firewallKey",
"=",
"''",
")",
"{",
"// initialize firewall",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"firewalls",
"[",
"$",
"firewallKey",
"]",
")",
")",
"{",
"$",
"fw",
"=",
"$",
"this",
"->",
"firewall... | Initializes the security layer for a specific firewall.
@param string $firewallKey Name of the firewall you wish to return.
If you don't pass the name param, the first firewall from your configuration
will be used.
@throws SecurityException
@return Firewall | [
"Initializes",
"the",
"security",
"layer",
"for",
"a",
"specific",
"firewall",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Security/Security.php#L71-L98 |
229,935 | Webiny/Framework | src/Webiny/Component/Security/Security.php | Security.getFirewallEncoder | private function getFirewallEncoder($firewallKey)
{
// get the encoder name
$encoderName = $this->getFirewallConfig($firewallKey)->get('Encoder', 'Crypt');
if (!$encoderName) {
$encoderName = 'Plain';
}
// check if the encoder is defined in the global config
... | php | private function getFirewallEncoder($firewallKey)
{
// get the encoder name
$encoderName = $this->getFirewallConfig($firewallKey)->get('Encoder', 'Crypt');
if (!$encoderName) {
$encoderName = 'Plain';
}
// check if the encoder is defined in the global config
... | [
"private",
"function",
"getFirewallEncoder",
"(",
"$",
"firewallKey",
")",
"{",
"// get the encoder name",
"$",
"encoderName",
"=",
"$",
"this",
"->",
"getFirewallConfig",
"(",
"$",
"firewallKey",
")",
"->",
"get",
"(",
"'Encoder'",
",",
"'Crypt'",
")",
";",
"... | Returns the encoder instance for the given firewall.
@param string $firewallKey Firewall name.
@return Encoder
@throws SecurityException | [
"Returns",
"the",
"encoder",
"instance",
"for",
"the",
"given",
"firewall",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Security/Security.php#L174-L208 |
229,936 | jkphl/squeezr | squeezr/lib/Tollwerk/Squeezr/Image.php | Image.send | public function send()
{
// Set some defaults
$extension = null;
$returnImage = $this->_absoluteImagePath;
// If the GD extension is not available
if (!extension_loaded('gd') && (!function_exists('dl') || !dl('gd.so'))) {
$this->_addErrorHeader(\Tollwerk\Squeezr... | php | public function send()
{
// Set some defaults
$extension = null;
$returnImage = $this->_absoluteImagePath;
// If the GD extension is not available
if (!extension_loaded('gd') && (!function_exists('dl') || !dl('gd.so'))) {
$this->_addErrorHeader(\Tollwerk\Squeezr... | [
"public",
"function",
"send",
"(",
")",
"{",
"// Set some defaults",
"$",
"extension",
"=",
"null",
";",
"$",
"returnImage",
"=",
"$",
"this",
"->",
"_absoluteImagePath",
";",
"// If the GD extension is not available",
"if",
"(",
"!",
"extension_loaded",
"(",
"'gd... | Send the cached and possibly downsampled image
@return void | [
"Send",
"the",
"cached",
"and",
"possibly",
"downsampled",
"image"
] | 9aed77dcdca889a532a81630498fa51ad63138b7 | https://github.com/jkphl/squeezr/blob/9aed77dcdca889a532a81630498fa51ad63138b7/squeezr/lib/Tollwerk/Squeezr/Image.php#L92-L133 |
229,937 | jkphl/squeezr | squeezr/lib/Tollwerk/Squeezr/Image.php | Image.squeeze | public static function squeeze($source, $target, $breakpoint = SQUEEZR_BREAKPOINT, array &$errors = array())
{
$returnImage = null;
// Determine the image dimensions
list($width, $height, $type) = getImageSize($source);
// Determine the target width (considering the breakpoint)
... | php | public static function squeeze($source, $target, $breakpoint = SQUEEZR_BREAKPOINT, array &$errors = array())
{
$returnImage = null;
// Determine the image dimensions
list($width, $height, $type) = getImageSize($source);
// Determine the target width (considering the breakpoint)
... | [
"public",
"static",
"function",
"squeeze",
"(",
"$",
"source",
",",
"$",
"target",
",",
"$",
"breakpoint",
"=",
"SQUEEZR_BREAKPOINT",
",",
"array",
"&",
"$",
"errors",
"=",
"array",
"(",
")",
")",
"{",
"$",
"returnImage",
"=",
"null",
";",
"// Determine ... | Squeeze a particular source file
@param string $source Source file
@param string $target Target file
@param string $breakpoint Breakpoint
@param array $errors Errors
@return string Result file path
@link http://www.idux.com/2011/02/27/what-are-index-and-alpha-transparency/ | [
"Squeeze",
"a",
"particular",
"source",
"file"
] | 9aed77dcdca889a532a81630498fa51ad63138b7 | https://github.com/jkphl/squeezr/blob/9aed77dcdca889a532a81630498fa51ad63138b7/squeezr/lib/Tollwerk/Squeezr/Image.php#L190-L239 |
229,938 | jkphl/squeezr | squeezr/lib/Tollwerk/Squeezr/Image.php | Image._downscaleJpeg | protected static function _downscaleJpeg($source, $width, $height, $target, $targetWidth, $targetHeight)
{
$sourceImage = @imagecreatefromjpeg($source);
$targetImage = imagecreatetruecolor($targetWidth, $targetHeight);
// Enable interlacing for progressive JPEGs
imageinterlace($targ... | php | protected static function _downscaleJpeg($source, $width, $height, $target, $targetWidth, $targetHeight)
{
$sourceImage = @imagecreatefromjpeg($source);
$targetImage = imagecreatetruecolor($targetWidth, $targetHeight);
// Enable interlacing for progressive JPEGs
imageinterlace($targ... | [
"protected",
"static",
"function",
"_downscaleJpeg",
"(",
"$",
"source",
",",
"$",
"width",
",",
"$",
"height",
",",
"$",
"target",
",",
"$",
"targetWidth",
",",
"$",
"targetHeight",
")",
"{",
"$",
"sourceImage",
"=",
"@",
"imagecreatefromjpeg",
"(",
"$",
... | Downscale a JPEG image
@param string $source Source image path
@param int $width Source image width
@param int $height Source image height
@param string $target Target image path
@param int $targetWidth Target image width
@param int $targetHeight Target image height
@return boolean Downscaled image ... | [
"Downscale",
"a",
"JPEG",
"image"
] | 9aed77dcdca889a532a81630498fa51ad63138b7 | https://github.com/jkphl/squeezr/blob/9aed77dcdca889a532a81630498fa51ad63138b7/squeezr/lib/Tollwerk/Squeezr/Image.php#L371-L393 |
229,939 | jkphl/squeezr | squeezr/lib/Tollwerk/Squeezr/Image.php | Image._downscaleGif | protected static function _downscaleGif($source, $width, $height, $target, $targetWidth, $targetHeight)
{
$sourceImage = @imagecreatefromgif($source);
$targetImage = imagecreatetruecolor($targetWidth, $targetHeight);
// Determine the transparent color
$sourceTransparentIndex = image... | php | protected static function _downscaleGif($source, $width, $height, $target, $targetWidth, $targetHeight)
{
$sourceImage = @imagecreatefromgif($source);
$targetImage = imagecreatetruecolor($targetWidth, $targetHeight);
// Determine the transparent color
$sourceTransparentIndex = image... | [
"protected",
"static",
"function",
"_downscaleGif",
"(",
"$",
"source",
",",
"$",
"width",
",",
"$",
"height",
",",
"$",
"target",
",",
"$",
"targetWidth",
",",
"$",
"targetHeight",
")",
"{",
"$",
"sourceImage",
"=",
"@",
"imagecreatefromgif",
"(",
"$",
... | Downscale a GIF image
@param string $source Source image path
@param int $width Source image width
@param int $height Source image height
@param string $target Target image path
@param int $targetWidth Target image width
@param int $targetHeight Target image height
@return boolean Downscaled image h... | [
"Downscale",
"a",
"GIF",
"image"
] | 9aed77dcdca889a532a81630498fa51ad63138b7 | https://github.com/jkphl/squeezr/blob/9aed77dcdca889a532a81630498fa51ad63138b7/squeezr/lib/Tollwerk/Squeezr/Image.php#L406-L437 |
229,940 | jkphl/squeezr | squeezr/lib/Tollwerk/Squeezr/Image.php | Image._sharpenImage | protected static function _sharpenImage($image, $width, $targetWidth)
{
// Sharpen image if possible and requested
if (!!SQUEEZR_IMAGE_SHARPEN && function_exists('imageconvolution')) {
$intFinal = $targetWidth * (750.0 / $width);
$intA = 52;
$intB = -0.2781065088... | php | protected static function _sharpenImage($image, $width, $targetWidth)
{
// Sharpen image if possible and requested
if (!!SQUEEZR_IMAGE_SHARPEN && function_exists('imageconvolution')) {
$intFinal = $targetWidth * (750.0 / $width);
$intA = 52;
$intB = -0.2781065088... | [
"protected",
"static",
"function",
"_sharpenImage",
"(",
"$",
"image",
",",
"$",
"width",
",",
"$",
"targetWidth",
")",
"{",
"// Sharpen image if possible and requested",
"if",
"(",
"!",
"!",
"SQUEEZR_IMAGE_SHARPEN",
"&&",
"function_exists",
"(",
"'imageconvolution'",... | Sharpen an image
@param resource $image Image resource
@param int $width Original image width
@param int $targetWidth Downsampled image width
@return void | [
"Sharpen",
"an",
"image"
] | 9aed77dcdca889a532a81630498fa51ad63138b7 | https://github.com/jkphl/squeezr/blob/9aed77dcdca889a532a81630498fa51ad63138b7/squeezr/lib/Tollwerk/Squeezr/Image.php#L447-L465 |
229,941 | jkphl/squeezr | squeezr/lib/Tollwerk/Squeezr/Image.php | Image._enableTranparency | protected static function _enableTranparency($image, array $transparentColor = null)
{
if ($transparentColor === null) {
$transparentColor = array('red' => 0, 'green' => 0, 'blue' => 0, 'alpha' => 127);
}
$targetTransparent = imagecolorallocatealpha($image, $transparentColor['red... | php | protected static function _enableTranparency($image, array $transparentColor = null)
{
if ($transparentColor === null) {
$transparentColor = array('red' => 0, 'green' => 0, 'blue' => 0, 'alpha' => 127);
}
$targetTransparent = imagecolorallocatealpha($image, $transparentColor['red... | [
"protected",
"static",
"function",
"_enableTranparency",
"(",
"$",
"image",
",",
"array",
"$",
"transparentColor",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"transparentColor",
"===",
"null",
")",
"{",
"$",
"transparentColor",
"=",
"array",
"(",
"'red'",
"=>",
... | Enable transparency on an image resource
@param resource $image Image resource
@param array $transparentColor Transparent color
@return void | [
"Enable",
"transparency",
"on",
"an",
"image",
"resource"
] | 9aed77dcdca889a532a81630498fa51ad63138b7 | https://github.com/jkphl/squeezr/blob/9aed77dcdca889a532a81630498fa51ad63138b7/squeezr/lib/Tollwerk/Squeezr/Image.php#L474-L485 |
229,942 | beeyev/yandex-translate | src/Translate.php | Translate.detectLanguage | public function detectLanguage($text, $hint = null)
{
if (is_array($hint)) {
$hint = implode(',', $hint);
}
$callResult = $this->makeCall(
'detect', array(
'text' => $text,
'hint' => $hint
)
);
... | php | public function detectLanguage($text, $hint = null)
{
if (is_array($hint)) {
$hint = implode(',', $hint);
}
$callResult = $this->makeCall(
'detect', array(
'text' => $text,
'hint' => $hint
)
);
... | [
"public",
"function",
"detectLanguage",
"(",
"$",
"text",
",",
"$",
"hint",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"hint",
")",
")",
"{",
"$",
"hint",
"=",
"implode",
"(",
"','",
",",
"$",
"hint",
")",
";",
"}",
"$",
"callResult"... | Detects the language of the specified text.
@link https://tech.yandex.com/translate/doc/dg/reference/detect-docpage/
@param string $text The text to detect the language for.
@param string $hint Optional parameter. List of the most possible languages, separator is comma.
@return string | [
"Detects",
"the",
"language",
"of",
"the",
"specified",
"text",
"."
] | 4530d765de91d7c0bb53f9b43cf4ed1d170fe8cd | https://github.com/beeyev/yandex-translate/blob/4530d765de91d7c0bb53f9b43cf4ed1d170fe8cd/src/Translate.php#L119-L133 |
229,943 | beeyev/yandex-translate | src/Translate.php | Translate.translate | public function translate($text, $language, $format = 'plain', $options = null)
{
/*
html code autodetection
i will appreciate if smb tell me a beetter way
to detect html code in a string
*/
if ($format == 'auto') {
if (is_array($text)... | php | public function translate($text, $language, $format = 'plain', $options = null)
{
/*
html code autodetection
i will appreciate if smb tell me a beetter way
to detect html code in a string
*/
if ($format == 'auto') {
if (is_array($text)... | [
"public",
"function",
"translate",
"(",
"$",
"text",
",",
"$",
"language",
",",
"$",
"format",
"=",
"'plain'",
",",
"$",
"options",
"=",
"null",
")",
"{",
"/*\n html code autodetection\n i will appreciate if smb tell me a beetter way\n to de... | Translates text to the specified language.
@link https://tech.yandex.com/translate/doc/dg/reference/translate-docpage/
@param string|array $text The text to translate.
@param string $language The translation direction.
@param "plain"|"html"|"auto" $format If input text contains ... | [
"Translates",
"text",
"to",
"the",
"specified",
"language",
"."
] | 4530d765de91d7c0bb53f9b43cf4ed1d170fe8cd | https://github.com/beeyev/yandex-translate/blob/4530d765de91d7c0bb53f9b43cf4ed1d170fe8cd/src/Translate.php#L147-L172 |
229,944 | beeyev/yandex-translate | src/Translate.php | Translate.makeCall | protected function makeCall($uri, array $requestParameters)
{
$requestParameters['key'] = $this->getApiKey();
$text = '';
if (isset($requestParameters['text']) && is_array($requestParameters['text'])) {
$text = '&text=' . implode('&text=', $requestParameters['text']);
... | php | protected function makeCall($uri, array $requestParameters)
{
$requestParameters['key'] = $this->getApiKey();
$text = '';
if (isset($requestParameters['text']) && is_array($requestParameters['text'])) {
$text = '&text=' . implode('&text=', $requestParameters['text']);
... | [
"protected",
"function",
"makeCall",
"(",
"$",
"uri",
",",
"array",
"$",
"requestParameters",
")",
"{",
"$",
"requestParameters",
"[",
"'key'",
"]",
"=",
"$",
"this",
"->",
"getApiKey",
"(",
")",
";",
"$",
"text",
"=",
"''",
";",
"if",
"(",
"isset",
... | Makes call to an API server
@param string $uri API method
@param array $requestParameters API parameters
@throws TranslateException When curl error has occurred
@throws TranslateException When curl error has occurred
@throws TranslateException When API server returns error
@return array | [
"Makes",
"call",
"to",
"an",
"API",
"server"
] | 4530d765de91d7c0bb53f9b43cf4ed1d170fe8cd | https://github.com/beeyev/yandex-translate/blob/4530d765de91d7c0bb53f9b43cf4ed1d170fe8cd/src/Translate.php#L186-L224 |
229,945 | milesj/admin | Controller/CrudController.php | CrudController.index | public function index() {
if ($this->overrideAction('index')) {
return;
}
$this->paginate = array_merge(array(
'limit' => 25,
'order' => array($this->Model->alias . '.' . $this->Model->displayField => 'ASC'),
'contain' => array_keys($this->Model->... | php | public function index() {
if ($this->overrideAction('index')) {
return;
}
$this->paginate = array_merge(array(
'limit' => 25,
'order' => array($this->Model->alias . '.' . $this->Model->displayField => 'ASC'),
'contain' => array_keys($this->Model->... | [
"public",
"function",
"index",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"overrideAction",
"(",
"'index'",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"paginate",
"=",
"array_merge",
"(",
"array",
"(",
"'limit'",
"=>",
"25",
",",
"'order... | List out and paginate all the records in the model. | [
"List",
"out",
"and",
"paginate",
"all",
"the",
"records",
"in",
"the",
"model",
"."
] | e5e93823d1eb4415f05a3191f653eb50c296d2c6 | https://github.com/milesj/admin/blob/e5e93823d1eb4415f05a3191f653eb50c296d2c6/Controller/CrudController.php#L13-L69 |
229,946 | milesj/admin | Controller/CrudController.php | CrudController.read | public function read($id) {
if ($this->overrideAction('read', $id)) {
return;
}
$this->Model->id = $id;
$result = $this->AdminToolbar->getRecordById($this->Model, $id);
if (!$result) {
throw new NotFoundException(__d('admin', '%s Not Found', $this->Mode... | php | public function read($id) {
if ($this->overrideAction('read', $id)) {
return;
}
$this->Model->id = $id;
$result = $this->AdminToolbar->getRecordById($this->Model, $id);
if (!$result) {
throw new NotFoundException(__d('admin', '%s Not Found', $this->Mode... | [
"public",
"function",
"read",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"overrideAction",
"(",
"'read'",
",",
"$",
"id",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"Model",
"->",
"id",
"=",
"$",
"id",
";",
"$",
"result"... | Read a record and associated records.
@param int $id
@throws NotFoundException | [
"Read",
"a",
"record",
"and",
"associated",
"records",
"."
] | e5e93823d1eb4415f05a3191f653eb50c296d2c6 | https://github.com/milesj/admin/blob/e5e93823d1eb4415f05a3191f653eb50c296d2c6/Controller/CrudController.php#L107-L127 |
229,947 | milesj/admin | Controller/CrudController.php | CrudController.delete | public function delete($id) {
if (!$this->Model->admin['deletable']) {
throw new ForbiddenException(__d('admin', 'Delete Access Protected'));
}
if ($this->overrideAction('delete', $id)) {
return;
}
$this->Model->id = $id;
$result = $this->AdminT... | php | public function delete($id) {
if (!$this->Model->admin['deletable']) {
throw new ForbiddenException(__d('admin', 'Delete Access Protected'));
}
if ($this->overrideAction('delete', $id)) {
return;
}
$this->Model->id = $id;
$result = $this->AdminT... | [
"public",
"function",
"delete",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"Model",
"->",
"admin",
"[",
"'deletable'",
"]",
")",
"{",
"throw",
"new",
"ForbiddenException",
"(",
"__d",
"(",
"'admin'",
",",
"'Delete Access Protected'",
")... | Delete a record and all associated records after delete confirmation.
@param int $id
@throws NotFoundException
@throws ForbiddenException | [
"Delete",
"a",
"record",
"and",
"all",
"associated",
"records",
"after",
"delete",
"confirmation",
"."
] | e5e93823d1eb4415f05a3191f653eb50c296d2c6 | https://github.com/milesj/admin/blob/e5e93823d1eb4415f05a3191f653eb50c296d2c6/Controller/CrudController.php#L184-L215 |
229,948 | milesj/admin | Controller/CrudController.php | CrudController.type_ahead | public function type_ahead() {
if ($response = $this->overrideAction('type_ahead')) {
return;
}
$this->viewClass = 'Json';
$this->layout = 'ajax';
if (empty($this->request->query['term'])) {
throw new BadRequestException(__d('admin', 'Missing Query'));
... | php | public function type_ahead() {
if ($response = $this->overrideAction('type_ahead')) {
return;
}
$this->viewClass = 'Json';
$this->layout = 'ajax';
if (empty($this->request->query['term'])) {
throw new BadRequestException(__d('admin', 'Missing Query'));
... | [
"public",
"function",
"type_ahead",
"(",
")",
"{",
"if",
"(",
"$",
"response",
"=",
"$",
"this",
"->",
"overrideAction",
"(",
"'type_ahead'",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"viewClass",
"=",
"'Json'",
";",
"$",
"this",
"->",
"l... | Query the model for a list of records that match the term.
@throws BadRequestException | [
"Query",
"the",
"model",
"for",
"a",
"list",
"of",
"records",
"that",
"match",
"the",
"term",
"."
] | e5e93823d1eb4415f05a3191f653eb50c296d2c6 | https://github.com/milesj/admin/blob/e5e93823d1eb4415f05a3191f653eb50c296d2c6/Controller/CrudController.php#L222-L236 |
229,949 | milesj/admin | Controller/CrudController.php | CrudController.process_model | public function process_model($id, $method) {
$model = $this->Model;
$record = $this->AdminToolbar->getRecordById($model, $id);
if (!$record) {
throw new NotFoundException(__d('admin', '%s Not Found', $this->Model->singularName));
}
if ($model->hasMethod($method)) {... | php | public function process_model($id, $method) {
$model = $this->Model;
$record = $this->AdminToolbar->getRecordById($model, $id);
if (!$record) {
throw new NotFoundException(__d('admin', '%s Not Found', $this->Model->singularName));
}
if ($model->hasMethod($method)) {... | [
"public",
"function",
"process_model",
"(",
"$",
"id",
",",
"$",
"method",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"Model",
";",
"$",
"record",
"=",
"$",
"this",
"->",
"AdminToolbar",
"->",
"getRecordById",
"(",
"$",
"model",
",",
"$",
"id",
... | Trigger a callback method on the model.
@param int $id
@param string $method
@throws NotFoundException | [
"Trigger",
"a",
"callback",
"method",
"on",
"the",
"model",
"."
] | e5e93823d1eb4415f05a3191f653eb50c296d2c6 | https://github.com/milesj/admin/blob/e5e93823d1eb4415f05a3191f653eb50c296d2c6/Controller/CrudController.php#L245-L264 |
229,950 | milesj/admin | Controller/CrudController.php | CrudController.process_behavior | public function process_behavior($behavior, $method) {
$behavior = Inflector::camelize($behavior);
$model = $this->Model;
if ($model->Behaviors->loaded($behavior) && $model->hasMethod($method)) {
$model->Behaviors->{$behavior}->{$method}($model);
$this->AdminToolbar->lo... | php | public function process_behavior($behavior, $method) {
$behavior = Inflector::camelize($behavior);
$model = $this->Model;
if ($model->Behaviors->loaded($behavior) && $model->hasMethod($method)) {
$model->Behaviors->{$behavior}->{$method}($model);
$this->AdminToolbar->lo... | [
"public",
"function",
"process_behavior",
"(",
"$",
"behavior",
",",
"$",
"method",
")",
"{",
"$",
"behavior",
"=",
"Inflector",
"::",
"camelize",
"(",
"$",
"behavior",
")",
";",
"$",
"model",
"=",
"$",
"this",
"->",
"Model",
";",
"if",
"(",
"$",
"mo... | Trigger a callback method on the behavior.
@param string $behavior
@param string $method | [
"Trigger",
"a",
"callback",
"method",
"on",
"the",
"behavior",
"."
] | e5e93823d1eb4415f05a3191f653eb50c296d2c6 | https://github.com/milesj/admin/blob/e5e93823d1eb4415f05a3191f653eb50c296d2c6/Controller/CrudController.php#L272-L287 |
229,951 | milesj/admin | Controller/CrudController.php | CrudController.overrideAction | protected function overrideAction($action, $id = null) {
$overrides = Configure::read('Admin.actionOverrides');
$model = $this->Model->qualifiedName;
if (empty($overrides[$model][$action])) {
return false;
}
$url = (array) $overrides[$model][$action];
$url[]... | php | protected function overrideAction($action, $id = null) {
$overrides = Configure::read('Admin.actionOverrides');
$model = $this->Model->qualifiedName;
if (empty($overrides[$model][$action])) {
return false;
}
$url = (array) $overrides[$model][$action];
$url[]... | [
"protected",
"function",
"overrideAction",
"(",
"$",
"action",
",",
"$",
"id",
"=",
"null",
")",
"{",
"$",
"overrides",
"=",
"Configure",
"::",
"read",
"(",
"'Admin.actionOverrides'",
")",
";",
"$",
"model",
"=",
"$",
"this",
"->",
"Model",
"->",
"qualif... | Override a CRUD action with an external Controller's action.
Request the custom action and set its response.
@param string $action
@param int $id
@return bool | [
"Override",
"a",
"CRUD",
"action",
"with",
"an",
"external",
"Controller",
"s",
"action",
".",
"Request",
"the",
"custom",
"action",
"and",
"set",
"its",
"response",
"."
] | e5e93823d1eb4415f05a3191f653eb50c296d2c6 | https://github.com/milesj/admin/blob/e5e93823d1eb4415f05a3191f653eb50c296d2c6/Controller/CrudController.php#L369-L392 |
229,952 | milesj/admin | Controller/CrudController.php | CrudController.overrideView | protected function overrideView($action) {
$overrides = Configure::read('Admin.viewOverrides');
$model = $this->Model->qualifiedName;
$view = in_array($action, array('create', 'update')) ? 'form' : $action;
if (empty($overrides[$model][$action])) {
$this->render($view);
... | php | protected function overrideView($action) {
$overrides = Configure::read('Admin.viewOverrides');
$model = $this->Model->qualifiedName;
$view = in_array($action, array('create', 'update')) ? 'form' : $action;
if (empty($overrides[$model][$action])) {
$this->render($view);
... | [
"protected",
"function",
"overrideView",
"(",
"$",
"action",
")",
"{",
"$",
"overrides",
"=",
"Configure",
"::",
"read",
"(",
"'Admin.viewOverrides'",
")",
";",
"$",
"model",
"=",
"$",
"this",
"->",
"Model",
"->",
"qualifiedName",
";",
"$",
"view",
"=",
... | Override a CRUD view with an external view template.
@param string $action
@return bool | [
"Override",
"a",
"CRUD",
"view",
"with",
"an",
"external",
"view",
"template",
"."
] | e5e93823d1eb4415f05a3191f653eb50c296d2c6 | https://github.com/milesj/admin/blob/e5e93823d1eb4415f05a3191f653eb50c296d2c6/Controller/CrudController.php#L400-L425 |
229,953 | addiks/phpsql | src/Addiks/PHPSQL/Value/Value.php | Value.factory | public static function factory($value)
{
if ($value instanceof self) {
$value = $value->getValue();
}
$value = static::filter($value);
if (!is_scalar($value)) {
throw new ErrorException("A value object must be created from a scalar v... | php | public static function factory($value)
{
if ($value instanceof self) {
$value = $value->getValue();
}
$value = static::filter($value);
if (!is_scalar($value)) {
throw new ErrorException("A value object must be created from a scalar v... | [
"public",
"static",
"function",
"factory",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"instanceof",
"self",
")",
"{",
"$",
"value",
"=",
"$",
"value",
"->",
"getValue",
"(",
")",
";",
"}",
"$",
"value",
"=",
"static",
"::",
"filter",
"("... | Creates a new value object.
If the value is invalid, an invalid-argument-exception is thrown.
@see self::validate()
@param scalar $value
@throws InvalidArgumentException | [
"Creates",
"a",
"new",
"value",
"object",
"."
] | 28dae64ffc2123f39f801a50ab53bfe29890cbd9 | https://github.com/addiks/phpsql/blob/28dae64ffc2123f39f801a50ab53bfe29890cbd9/src/Addiks/PHPSQL/Value/Value.php#L68-L102 |
229,954 | geosocio/http-serializer | src/Loader/GroupLoader.php | GroupLoader.getGroups | protected function getGroups(array $annotations) :? array
{
if (empty($annotations)) {
return [];
}
return array_values(array_unique(array_reduce($annotations, function ($carry, $annotation) {
return array_merge($carry, $annotation->getGroups());
}, [])));
... | php | protected function getGroups(array $annotations) :? array
{
if (empty($annotations)) {
return [];
}
return array_values(array_unique(array_reduce($annotations, function ($carry, $annotation) {
return array_merge($carry, $annotation->getGroups());
}, [])));
... | [
"protected",
"function",
"getGroups",
"(",
"array",
"$",
"annotations",
")",
":",
"?",
"array",
"{",
"if",
"(",
"empty",
"(",
"$",
"annotations",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"return",
"array_values",
"(",
"array_unique",
"(",
"array_redu... | Gets the groups from annotations.
@param array $annotations
@return array|null | [
"Gets",
"the",
"groups",
"from",
"annotations",
"."
] | aa7f9c6b2e39d147d3e53ee13e0cafce11f5fc42 | https://github.com/geosocio/http-serializer/blob/aa7f9c6b2e39d147d3e53ee13e0cafce11f5fc42/src/Loader/GroupLoader.php#L45-L54 |
229,955 | geosocio/http-serializer | src/Loader/GroupLoader.php | GroupLoader.getAnnotations | protected function getAnnotations(Request $request) : array
{
$controller = $this->resolver->getController($request);
if (!$controller) {
return [];
}
[$class, $name] = $controller;
return $this->reader->getMethodAnnotations(new \ReflectionMethod($class, $name))... | php | protected function getAnnotations(Request $request) : array
{
$controller = $this->resolver->getController($request);
if (!$controller) {
return [];
}
[$class, $name] = $controller;
return $this->reader->getMethodAnnotations(new \ReflectionMethod($class, $name))... | [
"protected",
"function",
"getAnnotations",
"(",
"Request",
"$",
"request",
")",
":",
"array",
"{",
"$",
"controller",
"=",
"$",
"this",
"->",
"resolver",
"->",
"getController",
"(",
"$",
"request",
")",
";",
"if",
"(",
"!",
"$",
"controller",
")",
"{",
... | Gets the group annotations from the request
@param Request $request
@return array|null | [
"Gets",
"the",
"group",
"annotations",
"from",
"the",
"request"
] | aa7f9c6b2e39d147d3e53ee13e0cafce11f5fc42 | https://github.com/geosocio/http-serializer/blob/aa7f9c6b2e39d147d3e53ee13e0cafce11f5fc42/src/Loader/GroupLoader.php#L63-L73 |
229,956 | stefanzweifel/ScreeenlyClient | src/Wnx/ScreeenlyClient/Screenshot.php | Screenshot.capture | public function capture($url)
{
$this->setUrl($url);
$client = new Client();
$response = $client->post($this->apiUrl, ['form_params' =>
[
'key' => $this->key,
'url' => $url,
'width' => $this->width,
'height' ... | php | public function capture($url)
{
$this->setUrl($url);
$client = new Client();
$response = $client->post($this->apiUrl, ['form_params' =>
[
'key' => $this->key,
'url' => $url,
'width' => $this->width,
'height' ... | [
"public",
"function",
"capture",
"(",
"$",
"url",
")",
"{",
"$",
"this",
"->",
"setUrl",
"(",
"$",
"url",
")",
";",
"$",
"client",
"=",
"new",
"Client",
"(",
")",
";",
"$",
"response",
"=",
"$",
"client",
"->",
"post",
"(",
"$",
"this",
"->",
"... | Do API Request and store response
@param string $url
@return object | [
"Do",
"API",
"Request",
"and",
"store",
"response"
] | 854600b75da0eaa283f6f89407c8f3bcd8f80e21 | https://github.com/stefanzweifel/ScreeenlyClient/blob/854600b75da0eaa283f6f89407c8f3bcd8f80e21/src/Wnx/ScreeenlyClient/Screenshot.php#L68-L88 |
229,957 | stefanzweifel/ScreeenlyClient | src/Wnx/ScreeenlyClient/Screenshot.php | Screenshot.store | public function store($storagePath = '', $filename = '')
{
$path = $this->getPath();
$pathinfo = pathinfo($path);
$data = file_get_contents($path);
// Use Original Filename if no specific filename is set
if (empty($filename)) {
$filename = $pathinfo['file... | php | public function store($storagePath = '', $filename = '')
{
$path = $this->getPath();
$pathinfo = pathinfo($path);
$data = file_get_contents($path);
// Use Original Filename if no specific filename is set
if (empty($filename)) {
$filename = $pathinfo['file... | [
"public",
"function",
"store",
"(",
"$",
"storagePath",
"=",
"''",
",",
"$",
"filename",
"=",
"''",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"getPath",
"(",
")",
";",
"$",
"pathinfo",
"=",
"pathinfo",
"(",
"$",
"path",
")",
";",
"$",
"data"... | Store Screenshot no disk
@param string $storagePath
@param string $filename
@return string Local Storage Path | [
"Store",
"Screenshot",
"no",
"disk"
] | 854600b75da0eaa283f6f89407c8f3bcd8f80e21 | https://github.com/stefanzweifel/ScreeenlyClient/blob/854600b75da0eaa283f6f89407c8f3bcd8f80e21/src/Wnx/ScreeenlyClient/Screenshot.php#L96-L113 |
229,958 | milesj/admin | Model/ItemReport.php | ItemReport.markAs | public function markAs($id, $status, $user_id, $comment = null) {
$this->id = $id;
return $this->save(array(
'status' => $status,
'resolver_id' => $user_id,
'comment' => $comment
));
} | php | public function markAs($id, $status, $user_id, $comment = null) {
$this->id = $id;
return $this->save(array(
'status' => $status,
'resolver_id' => $user_id,
'comment' => $comment
));
} | [
"public",
"function",
"markAs",
"(",
"$",
"id",
",",
"$",
"status",
",",
"$",
"user_id",
",",
"$",
"comment",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"id",
"=",
"$",
"id",
";",
"return",
"$",
"this",
"->",
"save",
"(",
"array",
"(",
"'status'",... | Mark a report as resolved or invalid.
@param int $id
@param int $status
@param int $user_id
@param string $comment
@return bool | [
"Mark",
"a",
"report",
"as",
"resolved",
"or",
"invalid",
"."
] | e5e93823d1eb4415f05a3191f653eb50c296d2c6 | https://github.com/milesj/admin/blob/e5e93823d1eb4415f05a3191f653eb50c296d2c6/Model/ItemReport.php#L101-L109 |
229,959 | milesj/admin | Model/ItemReport.php | ItemReport.reportItem | public function reportItem($query) {
$conditions = $query;
$conditions['created >='] = date('Y-m-d H:i:s', strtotime('-7 days'));
unset($conditions['type'], $conditions['item'], $conditions['reason'], $conditions['comment']);
$count = $this->find('count', array(
'conditions... | php | public function reportItem($query) {
$conditions = $query;
$conditions['created >='] = date('Y-m-d H:i:s', strtotime('-7 days'));
unset($conditions['type'], $conditions['item'], $conditions['reason'], $conditions['comment']);
$count = $this->find('count', array(
'conditions... | [
"public",
"function",
"reportItem",
"(",
"$",
"query",
")",
"{",
"$",
"conditions",
"=",
"$",
"query",
";",
"$",
"conditions",
"[",
"'created >='",
"]",
"=",
"date",
"(",
"'Y-m-d H:i:s'",
",",
"strtotime",
"(",
"'-7 days'",
")",
")",
";",
"unset",
"(",
... | Log a unique report only once every 7 days.
@param array $query
@return bool | [
"Log",
"a",
"unique",
"report",
"only",
"once",
"every",
"7",
"days",
"."
] | e5e93823d1eb4415f05a3191f653eb50c296d2c6 | https://github.com/milesj/admin/blob/e5e93823d1eb4415f05a3191f653eb50c296d2c6/Model/ItemReport.php#L117-L134 |
229,960 | milesj/admin | Model/ItemReport.php | ItemReport.beforeSave | public function beforeSave($options = array()) {
if (isset($this->data[$this->alias]['model'])) {
list($plugin, $model) = Admin::parseName($this->data[$this->alias]['model']);
if ($plugin === Configure::read('Admin.coreName')) {
$this->data[$this->alias]['model'] = $mode... | php | public function beforeSave($options = array()) {
if (isset($this->data[$this->alias]['model'])) {
list($plugin, $model) = Admin::parseName($this->data[$this->alias]['model']);
if ($plugin === Configure::read('Admin.coreName')) {
$this->data[$this->alias]['model'] = $mode... | [
"public",
"function",
"beforeSave",
"(",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"$",
"this",
"->",
"alias",
"]",
"[",
"'model'",
"]",
")",
")",
"{",
"list",
"(",
"$",
"plugin",
... | Remove core plugin from models.
@param array $options
@return bool | [
"Remove",
"core",
"plugin",
"from",
"models",
"."
] | e5e93823d1eb4415f05a3191f653eb50c296d2c6 | https://github.com/milesj/admin/blob/e5e93823d1eb4415f05a3191f653eb50c296d2c6/Model/ItemReport.php#L142-L152 |
229,961 | khepin/KhepinYamlFixturesBundle | Loader/YamlLoader.php | YamlLoader.loadFixtureFiles | protected function loadFixtureFiles()
{
foreach ($this->bundles as $bundle) {
$file = '*';
if (strpos($bundle, '/')) {
list($bundle, $file) = explode('/', $bundle);
}
$path = $this->kernel->locateResource('@' . $bundle);
$files = gl... | php | protected function loadFixtureFiles()
{
foreach ($this->bundles as $bundle) {
$file = '*';
if (strpos($bundle, '/')) {
list($bundle, $file) = explode('/', $bundle);
}
$path = $this->kernel->locateResource('@' . $bundle);
$files = gl... | [
"protected",
"function",
"loadFixtureFiles",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"bundles",
"as",
"$",
"bundle",
")",
"{",
"$",
"file",
"=",
"'*'",
";",
"if",
"(",
"strpos",
"(",
"$",
"bundle",
",",
"'/'",
")",
")",
"{",
"list",
"(",
... | Gets all fixtures files | [
"Gets",
"all",
"fixtures",
"files"
] | 4f1947b03809421057e7b8a3553ccaa93423d192 | https://github.com/khepin/KhepinYamlFixturesBundle/blob/4f1947b03809421057e7b8a3553ccaa93423d192/Loader/YamlLoader.php#L87-L98 |
229,962 | khepin/KhepinYamlFixturesBundle | Loader/YamlLoader.php | YamlLoader.loadFixtures | public function loadFixtures()
{
$this->loadFixtureFiles();
foreach ($this->fixture_files as $file) {
$fixture_data = Yaml::parse(file_get_contents($file));
// if nothing is specified, we use doctrine orm for persistence
$persistence = isset($fixture_data['persist... | php | public function loadFixtures()
{
$this->loadFixtureFiles();
foreach ($this->fixture_files as $file) {
$fixture_data = Yaml::parse(file_get_contents($file));
// if nothing is specified, we use doctrine orm for persistence
$persistence = isset($fixture_data['persist... | [
"public",
"function",
"loadFixtures",
"(",
")",
"{",
"$",
"this",
"->",
"loadFixtureFiles",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"fixture_files",
"as",
"$",
"file",
")",
"{",
"$",
"fixture_data",
"=",
"Yaml",
"::",
"parse",
"(",
"file_get_co... | Loads the fixtures file by file and saves them to the database | [
"Loads",
"the",
"fixtures",
"file",
"by",
"file",
"and",
"saves",
"them",
"to",
"the",
"database"
] | 4f1947b03809421057e7b8a3553ccaa93423d192 | https://github.com/khepin/KhepinYamlFixturesBundle/blob/4f1947b03809421057e7b8a3553ccaa93423d192/Loader/YamlLoader.php#L103-L125 |
229,963 | khepin/KhepinYamlFixturesBundle | Loader/YamlLoader.php | YamlLoader.purgeDatabase | public function purgeDatabase($persistence, $databaseName = null, $withTruncate = false)
{
$purgetools = array(
'orm' => array(
'purger' => 'Doctrine\Common\DataFixtures\Purger\ORMPurger',
'executor' => 'Doctrine\Common\DataFixtures\Executor\ORMExecutor'... | php | public function purgeDatabase($persistence, $databaseName = null, $withTruncate = false)
{
$purgetools = array(
'orm' => array(
'purger' => 'Doctrine\Common\DataFixtures\Purger\ORMPurger',
'executor' => 'Doctrine\Common\DataFixtures\Executor\ORMExecutor'... | [
"public",
"function",
"purgeDatabase",
"(",
"$",
"persistence",
",",
"$",
"databaseName",
"=",
"null",
",",
"$",
"withTruncate",
"=",
"false",
")",
"{",
"$",
"purgetools",
"=",
"array",
"(",
"'orm'",
"=>",
"array",
"(",
"'purger'",
"=>",
"'Doctrine\\Common\\... | Remove all fixtures from the database | [
"Remove",
"all",
"fixtures",
"from",
"the",
"database"
] | 4f1947b03809421057e7b8a3553ccaa93423d192 | https://github.com/khepin/KhepinYamlFixturesBundle/blob/4f1947b03809421057e7b8a3553ccaa93423d192/Loader/YamlLoader.php#L130-L161 |
229,964 | Webiny/Framework | src/Webiny/Component/OAuth2/AbstractServer.php | AbstractServer.getUserDetails | public function getUserDetails()
{
$requestData = $this->getUserDetailsTargetData();
$result = $this->rawRequest($requestData['url'], $requestData['params']);
return $this->processUserDetails($result);
} | php | public function getUserDetails()
{
$requestData = $this->getUserDetailsTargetData();
$result = $this->rawRequest($requestData['url'], $requestData['params']);
return $this->processUserDetails($result);
} | [
"public",
"function",
"getUserDetails",
"(",
")",
"{",
"$",
"requestData",
"=",
"$",
"this",
"->",
"getUserDetailsTargetData",
"(",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"rawRequest",
"(",
"$",
"requestData",
"[",
"'url'",
"]",
",",
"$",
"requ... | Tries to get user details for the current OAuth2 server.
If you wish to get full account details you must use the rawRequest method because this one returns only the
standardized response in a form of OAuth2User object.
@return OAuth2User | [
"Tries",
"to",
"get",
"user",
"details",
"for",
"the",
"current",
"OAuth2",
"server",
".",
"If",
"you",
"wish",
"to",
"get",
"full",
"account",
"details",
"you",
"must",
"use",
"the",
"rawRequest",
"method",
"because",
"this",
"one",
"returns",
"only",
"th... | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/OAuth2/AbstractServer.php#L87-L94 |
229,965 | Webiny/Framework | src/Webiny/Component/OAuth2/AbstractServer.php | AbstractServer.rawRequest | private function rawRequest($url, $parameters = [])
{
$request = new OAuth2Request($this->oauth2);
$request->setUrl($url);
$request->setParams($parameters);
return $request->executeRequest();
} | php | private function rawRequest($url, $parameters = [])
{
$request = new OAuth2Request($this->oauth2);
$request->setUrl($url);
$request->setParams($parameters);
return $request->executeRequest();
} | [
"private",
"function",
"rawRequest",
"(",
"$",
"url",
",",
"$",
"parameters",
"=",
"[",
"]",
")",
"{",
"$",
"request",
"=",
"new",
"OAuth2Request",
"(",
"$",
"this",
"->",
"oauth2",
")",
";",
"$",
"request",
"->",
"setUrl",
"(",
"$",
"url",
")",
";... | Preforms an raw request on the current OAuth2 server.
@param string $url Targeted url.
@param array $parameters Query params that will be send along the request.
@return array | [
"Preforms",
"an",
"raw",
"request",
"on",
"the",
"current",
"OAuth2",
"server",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/OAuth2/AbstractServer.php#L104-L112 |
229,966 | decred/decred-php-api | src/Decred/Crypto/DecredNetwork.php | DecredNetwork.extendedKeyBase58Decode | public static function extendedKeyBase58Decode($key)
{
// The base58-decoded extended key must consist of a serialized payload
// plus an additional 4 bytes for the checksum.
$decoded = static::base58()->decode($key);
if (strlen($decoded) !== 82) {
throw new \InvalidArgu... | php | public static function extendedKeyBase58Decode($key)
{
// The base58-decoded extended key must consist of a serialized payload
// plus an additional 4 bytes for the checksum.
$decoded = static::base58()->decode($key);
if (strlen($decoded) !== 82) {
throw new \InvalidArgu... | [
"public",
"static",
"function",
"extendedKeyBase58Decode",
"(",
"$",
"key",
")",
"{",
"// The base58-decoded extended key must consist of a serialized payload",
"// plus an additional 4 bytes for the checksum.",
"$",
"decoded",
"=",
"static",
"::",
"base58",
"(",
")",
"->",
"... | Decode encrypted key and verify the checksum.
@param string $key
@return string | [
"Decode",
"encrypted",
"key",
"and",
"verify",
"the",
"checksum",
"."
] | dafea9ceac918c4c3cd9bc7c436009a95dfb1643 | https://github.com/decred/decred-php-api/blob/dafea9ceac918c4c3cd9bc7c436009a95dfb1643/src/Decred/Crypto/DecredNetwork.php#L28-L51 |
229,967 | Webiny/Framework | src/Webiny/Component/Logger/Driver/Webiny/Handler/AbstractHandler.php | AbstractHandler.canHandle | public function canHandle(Record $record)
{
if ($this->levels->count() < 1) {
return true;
}
return $this->levels->inArray($record->getLevel());
} | php | public function canHandle(Record $record)
{
if ($this->levels->count() < 1) {
return true;
}
return $this->levels->inArray($record->getLevel());
} | [
"public",
"function",
"canHandle",
"(",
"Record",
"$",
"record",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"levels",
"->",
"count",
"(",
")",
"<",
"1",
")",
"{",
"return",
"true",
";",
"}",
"return",
"$",
"this",
"->",
"levels",
"->",
"inArray",
"(",... | Check if this handler can handle the given Record
@param Record $record
@return bool Boolean telling whether this handler can handle the given Record | [
"Check",
"if",
"this",
"handler",
"can",
"handle",
"the",
"given",
"Record"
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Logger/Driver/Webiny/Handler/AbstractHandler.php#L86-L93 |
229,968 | Webiny/Framework | src/Webiny/Component/Logger/Driver/Webiny/Handler/AbstractHandler.php | AbstractHandler.addProcessor | public function addProcessor($callback, $processBufferRecord = false)
{
if (!is_callable($callback) && !$this->isInstanceOf($callback, ProcessorInterface::class)) {
throw new \InvalidArgumentException('Processor must be valid callable or an instance of ' . ProcessorInterface::class);
}
... | php | public function addProcessor($callback, $processBufferRecord = false)
{
if (!is_callable($callback) && !$this->isInstanceOf($callback, ProcessorInterface::class)) {
throw new \InvalidArgumentException('Processor must be valid callable or an instance of ' . ProcessorInterface::class);
}
... | [
"public",
"function",
"addProcessor",
"(",
"$",
"callback",
",",
"$",
"processBufferRecord",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"callback",
")",
"&&",
"!",
"$",
"this",
"->",
"isInstanceOf",
"(",
"$",
"callback",
",",
"Proce... | Add processor to this handler
@param mixed $callback Callable or instance of ProcessorInterface
@param bool $processBufferRecord
@throws \InvalidArgumentException
@return $this | [
"Add",
"processor",
"to",
"this",
"handler"
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Logger/Driver/Webiny/Handler/AbstractHandler.php#L118-L132 |
229,969 | Webiny/Framework | src/Webiny/Component/Logger/Driver/Webiny/Handler/AbstractHandler.php | AbstractHandler.process | public function process(Record $record)
{
if ($this->buffer) {
$this->processRecord($record);
$this->records[] = $record;
return $this->bubble;
}
$this->processRecord($record);
$this->getFormatter()->formatRecord($record);
$this->write($... | php | public function process(Record $record)
{
if ($this->buffer) {
$this->processRecord($record);
$this->records[] = $record;
return $this->bubble;
}
$this->processRecord($record);
$this->getFormatter()->formatRecord($record);
$this->write($... | [
"public",
"function",
"process",
"(",
"Record",
"$",
"record",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"buffer",
")",
"{",
"$",
"this",
"->",
"processRecord",
"(",
"$",
"record",
")",
";",
"$",
"this",
"->",
"records",
"[",
"]",
"=",
"$",
"record",... | Process given record
This will pass given record to ProcessorInterface instance, then format the record and output it according to current AbstractHandler instance
@param Record $record
@return bool Bubble flag (this either continues propagation of the Record to other handlers, or stops the logger from processing thi... | [
"Process",
"given",
"record",
"This",
"will",
"pass",
"given",
"record",
"to",
"ProcessorInterface",
"instance",
"then",
"format",
"the",
"record",
"and",
"output",
"it",
"according",
"to",
"current",
"AbstractHandler",
"instance"
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Logger/Driver/Webiny/Handler/AbstractHandler.php#L149-L164 |
229,970 | Webiny/Framework | src/Webiny/Component/Logger/Driver/Webiny/Handler/AbstractHandler.php | AbstractHandler.processRecords | protected function processRecords(array $records)
{
$record = new Record();
$formatter = $this->getFormatter();
if ($this->isInstanceOf($formatter, FormatterInterface::class)) {
$formatter->formatRecords($records, $record);
}
$this->write($record);
retur... | php | protected function processRecords(array $records)
{
$record = new Record();
$formatter = $this->getFormatter();
if ($this->isInstanceOf($formatter, FormatterInterface::class)) {
$formatter->formatRecords($records, $record);
}
$this->write($record);
retur... | [
"protected",
"function",
"processRecords",
"(",
"array",
"$",
"records",
")",
"{",
"$",
"record",
"=",
"new",
"Record",
"(",
")",
";",
"$",
"formatter",
"=",
"$",
"this",
"->",
"getFormatter",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"isInstanceOf"... | Process batch of records
@param array $records Batch of records to process
@return bool Bubble flag (this either continues propagation of the Record to other handlers, or stops the logger from processing this record any further) | [
"Process",
"batch",
"of",
"records"
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Logger/Driver/Webiny/Handler/AbstractHandler.php#L192-L203 |
229,971 | Webiny/Framework | src/Webiny/Component/Mailer/Bridge/Loader.php | Loader.getMessage | public static function getMessage($mailer, ConfigObject $config = null)
{
// Do it this way to avoid merging into the original mailer config
$mailerConfig = Mailer::getConfig()->get($mailer)->toArray();
$mailerConfig = new ConfigObject($mailerConfig);
if ($config) {
$mail... | php | public static function getMessage($mailer, ConfigObject $config = null)
{
// Do it this way to avoid merging into the original mailer config
$mailerConfig = Mailer::getConfig()->get($mailer)->toArray();
$mailerConfig = new ConfigObject($mailerConfig);
if ($config) {
$mail... | [
"public",
"static",
"function",
"getMessage",
"(",
"$",
"mailer",
",",
"ConfigObject",
"$",
"config",
"=",
"null",
")",
"{",
"// Do it this way to avoid merging into the original mailer config",
"$",
"mailerConfig",
"=",
"Mailer",
"::",
"getConfig",
"(",
")",
"->",
... | Returns an instance of MessageInterface based on current bridge.
@param $mailer
@param ConfigObject $config
@return \Webiny\Component\Mailer\MessageInterface
@throws MailerException
@throws \Webiny\Component\StdLib\Exception\Exception | [
"Returns",
"an",
"instance",
"of",
"MessageInterface",
"based",
"on",
"current",
"bridge",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Mailer/Bridge/Loader.php#L43-L62 |
229,972 | Webiny/Framework | src/Webiny/Component/Mailer/Bridge/Loader.php | Loader.getTransport | public static function getTransport($mailer)
{
$config = Mailer::getConfig()->get($mailer);
if (!$config) {
throw new MailerException(MailerException::INVALID_CONFIGURATION, [$mailer]);
}
$lib = self::getLibrary($mailer);
/* @var MailerInterface $libInstance */
... | php | public static function getTransport($mailer)
{
$config = Mailer::getConfig()->get($mailer);
if (!$config) {
throw new MailerException(MailerException::INVALID_CONFIGURATION, [$mailer]);
}
$lib = self::getLibrary($mailer);
/* @var MailerInterface $libInstance */
... | [
"public",
"static",
"function",
"getTransport",
"(",
"$",
"mailer",
")",
"{",
"$",
"config",
"=",
"Mailer",
"::",
"getConfig",
"(",
")",
"->",
"get",
"(",
"$",
"mailer",
")",
";",
"if",
"(",
"!",
"$",
"config",
")",
"{",
"throw",
"new",
"MailerExcept... | Returns an instance of TransportInterface based on current bridge.
@param string $mailer
@return TransportInterface
@throws MailerException
@throws \Webiny\Component\StdLib\Exception\Exception | [
"Returns",
"an",
"instance",
"of",
"TransportInterface",
"based",
"on",
"current",
"bridge",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Mailer/Bridge/Loader.php#L73-L91 |
229,973 | addiks/phpsql | src/Addiks/PHPSQL/Index/IndexSchema.php | IndexSchema.getColumns | public function getColumns()
{
$rawColumns = substr($this->data, 64, 128);
$columnsString = rtrim($rawColumns, "\0");
return explode("\0", $columnsString);
} | php | public function getColumns()
{
$rawColumns = substr($this->data, 64, 128);
$columnsString = rtrim($rawColumns, "\0");
return explode("\0", $columnsString);
} | [
"public",
"function",
"getColumns",
"(",
")",
"{",
"$",
"rawColumns",
"=",
"substr",
"(",
"$",
"this",
"->",
"data",
",",
"64",
",",
"128",
")",
";",
"$",
"columnsString",
"=",
"rtrim",
"(",
"$",
"rawColumns",
",",
"\"\\0\"",
")",
";",
"return",
"exp... | Array of column-schema-indexes.
@var array | [
"Array",
"of",
"column",
"-",
"schema",
"-",
"indexes",
"."
] | 28dae64ffc2123f39f801a50ab53bfe29890cbd9 | https://github.com/addiks/phpsql/blob/28dae64ffc2123f39f801a50ab53bfe29890cbd9/src/Addiks/PHPSQL/Index/IndexSchema.php#L80-L85 |
229,974 | deanblackborough/zf3-view-helpers | src/Bootstrap3ProgressBar.php | Bootstrap3ProgressBar.color | public function color(string $color): Bootstrap3ProgressBar
{
if (in_array($color, $this->supported_styles) === true) {
$this->color = $color;
}
return $this;
} | php | public function color(string $color): Bootstrap3ProgressBar
{
if (in_array($color, $this->supported_styles) === true) {
$this->color = $color;
}
return $this;
} | [
"public",
"function",
"color",
"(",
"string",
"$",
"color",
")",
":",
"Bootstrap3ProgressBar",
"{",
"if",
"(",
"in_array",
"(",
"$",
"color",
",",
"$",
"this",
"->",
"supported_styles",
")",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"color",
"=",
"$"... | Set the background color for the progress bar, one of the following, success, info,
warning or danger. If an incorrect style is passed in we don't apply the class.
@param string $color
@return Bootstrap3ProgressBar | [
"Set",
"the",
"background",
"color",
"for",
"the",
"progress",
"bar",
"one",
"of",
"the",
"following",
"success",
"info",
"warning",
"or",
"danger",
".",
"If",
"an",
"incorrect",
"style",
"is",
"passed",
"in",
"we",
"don",
"t",
"apply",
"the",
"class",
"... | db8bea4ca62709b2ac8c732aedbb2a5235223f23 | https://github.com/deanblackborough/zf3-view-helpers/blob/db8bea4ca62709b2ac8c732aedbb2a5235223f23/src/Bootstrap3ProgressBar.php#L77-L84 |
229,975 | Webiny/Framework | src/Webiny/Component/OAuth2/OAuth2.php | OAuth2.processUrl | private function processUrl($url)
{
$vars = [
'{CLIENT_ID}' => $this->getClientId(),
'{REDIRECT_URI}' => $this->getRedirectURI(),
'{SCOPE}' => $this->getScope(),
'{STATE}' => $this->getState(),
" " => '',
"... | php | private function processUrl($url)
{
$vars = [
'{CLIENT_ID}' => $this->getClientId(),
'{REDIRECT_URI}' => $this->getRedirectURI(),
'{SCOPE}' => $this->getScope(),
'{STATE}' => $this->getState(),
" " => '',
"... | [
"private",
"function",
"processUrl",
"(",
"$",
"url",
")",
"{",
"$",
"vars",
"=",
"[",
"'{CLIENT_ID}'",
"=>",
"$",
"this",
"->",
"getClientId",
"(",
")",
",",
"'{REDIRECT_URI}'",
"=>",
"$",
"this",
"->",
"getRedirectURI",
"(",
")",
",",
"'{SCOPE}'",
"=>"... | Replaces the url variables with real data.
@param string $url Url to process.
@return string Processed url. | [
"Replaces",
"the",
"url",
"variables",
"with",
"real",
"data",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/OAuth2/OAuth2.php#L219-L235 |
229,976 | Webiny/Framework | src/Webiny/Component/ServiceManager/ConfigCompiler.php | ConfigCompiler.compile | public function compile()
{
$this->manageInheritance();
$this->serviceConfig = $this->insertParameters($this->serviceConfig);
$this->buildArguments('Arguments');
$this->buildArguments('MethodArguments');
$this->buildCallsArguments();
$this->buildFactoryArgument();
... | php | public function compile()
{
$this->manageInheritance();
$this->serviceConfig = $this->insertParameters($this->serviceConfig);
$this->buildArguments('Arguments');
$this->buildArguments('MethodArguments');
$this->buildCallsArguments();
$this->buildFactoryArgument();
... | [
"public",
"function",
"compile",
"(",
")",
"{",
"$",
"this",
"->",
"manageInheritance",
"(",
")",
";",
"$",
"this",
"->",
"serviceConfig",
"=",
"$",
"this",
"->",
"insertParameters",
"(",
"$",
"this",
"->",
"serviceConfig",
")",
";",
"$",
"this",
"->",
... | Compile current config and return a valid ServiceConfig object.
That new ServiceConfig will be used to instantiate a service later in the process of creating a service instance.
@return ServiceConfig | [
"Compile",
"current",
"config",
"and",
"return",
"a",
"valid",
"ServiceConfig",
"object",
".",
"That",
"new",
"ServiceConfig",
"will",
"be",
"used",
"to",
"instantiate",
"a",
"service",
"later",
"in",
"the",
"process",
"of",
"creating",
"a",
"service",
"instan... | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/ServiceManager/ConfigCompiler.php#L48-L58 |
229,977 | Webiny/Framework | src/Webiny/Component/ServiceManager/ConfigCompiler.php | ConfigCompiler.manageInheritance | private function manageInheritance()
{
$config = $this->serviceConfig;
if ($config->keyExists('Parent')) {
$parentServiceName = $this->str($config->key('Parent'))->trimLeft('@')->val();
$parentConfig = ServiceManager::getInstance()->getServiceConfig($parentServiceName)->toArr... | php | private function manageInheritance()
{
$config = $this->serviceConfig;
if ($config->keyExists('Parent')) {
$parentServiceName = $this->str($config->key('Parent'))->trimLeft('@')->val();
$parentConfig = ServiceManager::getInstance()->getServiceConfig($parentServiceName)->toArr... | [
"private",
"function",
"manageInheritance",
"(",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"serviceConfig",
";",
"if",
"(",
"$",
"config",
"->",
"keyExists",
"(",
"'Parent'",
")",
")",
"{",
"$",
"parentServiceName",
"=",
"$",
"this",
"->",
"str",
... | Check if current service has a parent service and merge its config with parent service config.
@throws ServiceManagerException | [
"Check",
"if",
"current",
"service",
"has",
"a",
"parent",
"service",
"and",
"merge",
"its",
"config",
"with",
"parent",
"service",
"config",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/ServiceManager/ConfigCompiler.php#L65-L87 |
229,978 | Webiny/Framework | src/Webiny/Component/ServiceManager/ConfigCompiler.php | ConfigCompiler.insertParameters | private function insertParameters($config)
{
foreach ($config as $k => $v) {
if ($this->isArray($v)) {
$config[$k] = $this->insertParameters($v);
} elseif ($this->isString($v)) {
$str = $this->str($v)->trim();
if ($str->startsWith('%') ... | php | private function insertParameters($config)
{
foreach ($config as $k => $v) {
if ($this->isArray($v)) {
$config[$k] = $this->insertParameters($v);
} elseif ($this->isString($v)) {
$str = $this->str($v)->trim();
if ($str->startsWith('%') ... | [
"private",
"function",
"insertParameters",
"(",
"$",
"config",
")",
"{",
"foreach",
"(",
"$",
"config",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isArray",
"(",
"$",
"v",
")",
")",
"{",
"$",
"config",
"[",
"$",
"k... | Insert parameters into the config
@param ArrayObject $config Target config
@return ArrayObject
@throws ServiceManagerException | [
"Insert",
"parameters",
"into",
"the",
"config"
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/ServiceManager/ConfigCompiler.php#L98-L122 |
229,979 | Webiny/Framework | src/Webiny/Component/ServiceManager/ConfigCompiler.php | ConfigCompiler.buildArguments | private function buildArguments($key)
{
$newArguments = [];
if ($this->serviceConfig->keyExists($key)) {
$arguments = $this->serviceConfig->key($key);
if (!$this->isArray($arguments)) {
throw new ServiceManagerException(ServiceManagerException::INVALID_SERVICE... | php | private function buildArguments($key)
{
$newArguments = [];
if ($this->serviceConfig->keyExists($key)) {
$arguments = $this->serviceConfig->key($key);
if (!$this->isArray($arguments)) {
throw new ServiceManagerException(ServiceManagerException::INVALID_SERVICE... | [
"private",
"function",
"buildArguments",
"(",
"$",
"key",
")",
"{",
"$",
"newArguments",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"serviceConfig",
"->",
"keyExists",
"(",
"$",
"key",
")",
")",
"{",
"$",
"arguments",
"=",
"$",
"this",
"->",
... | Convert simple config arguments into Argument objects
@param string $key
@throws ServiceManagerException | [
"Convert",
"simple",
"config",
"arguments",
"into",
"Argument",
"objects"
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/ServiceManager/ConfigCompiler.php#L186-L201 |
229,980 | Webiny/Framework | src/Webiny/Component/ServiceManager/ConfigCompiler.php | ConfigCompiler.buildFactoryArgument | private function buildFactoryArgument()
{
if ($this->serviceConfig->keyExists('Factory')) {
$factory = $this->str($this->serviceConfig->key('Factory'));
$arguments = $this->serviceConfig->key('Arguments', null, true);
// If it's a STATIC method call - unset all arguments
... | php | private function buildFactoryArgument()
{
if ($this->serviceConfig->keyExists('Factory')) {
$factory = $this->str($this->serviceConfig->key('Factory'));
$arguments = $this->serviceConfig->key('Arguments', null, true);
// If it's a STATIC method call - unset all arguments
... | [
"private",
"function",
"buildFactoryArgument",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"serviceConfig",
"->",
"keyExists",
"(",
"'Factory'",
")",
")",
"{",
"$",
"factory",
"=",
"$",
"this",
"->",
"str",
"(",
"$",
"this",
"->",
"serviceConfig",
"->",... | Convert factory service arguments into FactoryArgument objects | [
"Convert",
"factory",
"service",
"arguments",
"into",
"FactoryArgument",
"objects"
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/ServiceManager/ConfigCompiler.php#L206-L220 |
229,981 | Webiny/Framework | src/Webiny/Component/ServiceManager/ConfigCompiler.php | ConfigCompiler.buildCallsArguments | private function buildCallsArguments()
{
if ($this->serviceConfig->keyExists('Calls')) {
$calls = $this->serviceConfig->key('Calls');
foreach ($calls as $callKey => $call) {
if ($this->isArray($call[1])) {
$newArguments = [];
fo... | php | private function buildCallsArguments()
{
if ($this->serviceConfig->keyExists('Calls')) {
$calls = $this->serviceConfig->key('Calls');
foreach ($calls as $callKey => $call) {
if ($this->isArray($call[1])) {
$newArguments = [];
fo... | [
"private",
"function",
"buildCallsArguments",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"serviceConfig",
"->",
"keyExists",
"(",
"'Calls'",
")",
")",
"{",
"$",
"calls",
"=",
"$",
"this",
"->",
"serviceConfig",
"->",
"key",
"(",
"'Calls'",
")",
";",
... | Build arguments for "Calls" methods | [
"Build",
"arguments",
"for",
"Calls",
"methods"
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/ServiceManager/ConfigCompiler.php#L225-L240 |
229,982 | Webiny/Framework | src/Webiny/Component/ServiceManager/ConfigCompiler.php | ConfigCompiler.buildServiceConfig | private function buildServiceConfig()
{
if ($this->serviceConfig->keyExists('Factory') && !$this->serviceConfig->keyExists('Method')) {
throw new ServiceManagerException(ServiceManagerException::FACTORY_SERVICE_METHOD_KEY_MISSING,
[$this->serviceName... | php | private function buildServiceConfig()
{
if ($this->serviceConfig->keyExists('Factory') && !$this->serviceConfig->keyExists('Method')) {
throw new ServiceManagerException(ServiceManagerException::FACTORY_SERVICE_METHOD_KEY_MISSING,
[$this->serviceName... | [
"private",
"function",
"buildServiceConfig",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"serviceConfig",
"->",
"keyExists",
"(",
"'Factory'",
")",
"&&",
"!",
"$",
"this",
"->",
"serviceConfig",
"->",
"keyExists",
"(",
"'Method'",
")",
")",
"{",
"throw",
... | Build final ServiceConfig object
@return ServiceConfig
@throws ServiceManagerException | [
"Build",
"final",
"ServiceConfig",
"object"
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/ServiceManager/ConfigCompiler.php#L249-L268 |
229,983 | fabulator/endomondo-api-old | lib/Fabulator/Endomondo/EndomondoApiOld.php | EndomondoApiOld.requestAuthToken | public function requestAuthToken($username, $password) {
$response = parent::requestAuthToken($username, $password);
$data = $this->decodeResponse($response);
if (count($data) === 0) {
throw new EndomondoApiOldException('Wrong username or password.');
}
$this->setAc... | php | public function requestAuthToken($username, $password) {
$response = parent::requestAuthToken($username, $password);
$data = $this->decodeResponse($response);
if (count($data) === 0) {
throw new EndomondoApiOldException('Wrong username or password.');
}
$this->setAc... | [
"public",
"function",
"requestAuthToken",
"(",
"$",
"username",
",",
"$",
"password",
")",
"{",
"$",
"response",
"=",
"parent",
"::",
"requestAuthToken",
"(",
"$",
"username",
",",
"$",
"password",
")",
";",
"$",
"data",
"=",
"$",
"this",
"->",
"decodeRe... | Request auth token and other base user information.
@param string $username endomondo username
@param string $password password for user
@return array Data that contain action, authToken, measure, displayName, userId, facebookConnected and secureToken
@throws EndomondoApiOldException when credentials are wrong | [
"Request",
"auth",
"token",
"and",
"other",
"base",
"user",
"information",
"."
] | c06871902f23ca9f40a7465cbecaf750a8114fa0 | https://github.com/fabulator/endomondo-api-old/blob/c06871902f23ca9f40a7465cbecaf750a8114fa0/lib/Fabulator/Endomondo/EndomondoApiOld.php#L47-L59 |
229,984 | fabulator/endomondo-api-old | lib/Fabulator/Endomondo/EndomondoApiOld.php | EndomondoApiOld.decodeResponse | private function decodeResponse(ResponseInterface $response)
{
$responseBody = trim((string) $response->getBody());
if ($response->getHeader('Content-Type')[0] === 'text/plain;charset=UTF-8') {
$lines = explode("\n", $responseBody);
$data = [];
// parse endomond... | php | private function decodeResponse(ResponseInterface $response)
{
$responseBody = trim((string) $response->getBody());
if ($response->getHeader('Content-Type')[0] === 'text/plain;charset=UTF-8') {
$lines = explode("\n", $responseBody);
$data = [];
// parse endomond... | [
"private",
"function",
"decodeResponse",
"(",
"ResponseInterface",
"$",
"response",
")",
"{",
"$",
"responseBody",
"=",
"trim",
"(",
"(",
"string",
")",
"$",
"response",
"->",
"getBody",
"(",
")",
")",
";",
"if",
"(",
"$",
"response",
"->",
"getHeader",
... | Decode response from Endomondo and convert it to array.
@param ResponseInterface $response
@return array response from endomondo
@throws EndomondoApiOldException when request to endomondo fail | [
"Decode",
"response",
"from",
"Endomondo",
"and",
"convert",
"it",
"to",
"array",
"."
] | c06871902f23ca9f40a7465cbecaf750a8114fa0 | https://github.com/fabulator/endomondo-api-old/blob/c06871902f23ca9f40a7465cbecaf750a8114fa0/lib/Fabulator/Endomondo/EndomondoApiOld.php#L68-L94 |
229,985 | fabulator/endomondo-api-old | lib/Fabulator/Endomondo/EndomondoApiOld.php | EndomondoApiOld.request | public function request($endpoint, $options = [], $body = '')
{
if ($this->getAcessToken()) {
$options['authToken'] = $this->getAcessToken();
}
try {
return $this->decodeResponse(parent::send($endpoint, $options, gzencode($body)));
} catch(ClientException $e)... | php | public function request($endpoint, $options = [], $body = '')
{
if ($this->getAcessToken()) {
$options['authToken'] = $this->getAcessToken();
}
try {
return $this->decodeResponse(parent::send($endpoint, $options, gzencode($body)));
} catch(ClientException $e)... | [
"public",
"function",
"request",
"(",
"$",
"endpoint",
",",
"$",
"options",
"=",
"[",
"]",
",",
"$",
"body",
"=",
"''",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getAcessToken",
"(",
")",
")",
"{",
"$",
"options",
"[",
"'authToken'",
"]",
"=",
"$"... | Request Old Endomondo API.
@param string $endpoint
@param array $options
@param string $body
@return array
@throws EndomondoApiOldException when api request fail | [
"Request",
"Old",
"Endomondo",
"API",
"."
] | c06871902f23ca9f40a7465cbecaf750a8114fa0 | https://github.com/fabulator/endomondo-api-old/blob/c06871902f23ca9f40a7465cbecaf750a8114fa0/lib/Fabulator/Endomondo/EndomondoApiOld.php#L105-L116 |
229,986 | fabulator/endomondo-api-old | lib/Fabulator/Endomondo/EndomondoApiOld.php | EndomondoApiOld.getWorkout | public function getWorkout($id, $fields = self::DEFAULT_WORKOUT_FIELDS)
{
return OldApiParser::parseWorkout($this->request(self::GET_WORKOUT_ENDPOINT, [
'fields' => join($fields, ','),
'workoutId' => $id,
]));
} | php | public function getWorkout($id, $fields = self::DEFAULT_WORKOUT_FIELDS)
{
return OldApiParser::parseWorkout($this->request(self::GET_WORKOUT_ENDPOINT, [
'fields' => join($fields, ','),
'workoutId' => $id,
]));
} | [
"public",
"function",
"getWorkout",
"(",
"$",
"id",
",",
"$",
"fields",
"=",
"self",
"::",
"DEFAULT_WORKOUT_FIELDS",
")",
"{",
"return",
"OldApiParser",
"::",
"parseWorkout",
"(",
"$",
"this",
"->",
"request",
"(",
"self",
"::",
"GET_WORKOUT_ENDPOINT",
",",
... | Get single Endomondo workout.
@param $id string
@param array $fields list of requested fields
@return Workout | [
"Get",
"single",
"Endomondo",
"workout",
"."
] | c06871902f23ca9f40a7465cbecaf750a8114fa0 | https://github.com/fabulator/endomondo-api-old/blob/c06871902f23ca9f40a7465cbecaf750a8114fa0/lib/Fabulator/Endomondo/EndomondoApiOld.php#L125-L131 |
229,987 | fabulator/endomondo-api-old | lib/Fabulator/Endomondo/EndomondoApiOld.php | EndomondoApiOld.getWorkouts | public function getWorkouts($limit = 10, $fields = self::DEFAULT_WORKOUT_FIELDS)
{
$workouts = [];
$response = $this->request(self::GET_WORKOUTS_ENDPOINT, [
'fields' => join(',', $fields),
'maxResults' => $limit,
]);
foreach ($response['data'] as $workout) {
... | php | public function getWorkouts($limit = 10, $fields = self::DEFAULT_WORKOUT_FIELDS)
{
$workouts = [];
$response = $this->request(self::GET_WORKOUTS_ENDPOINT, [
'fields' => join(',', $fields),
'maxResults' => $limit,
]);
foreach ($response['data'] as $workout) {
... | [
"public",
"function",
"getWorkouts",
"(",
"$",
"limit",
"=",
"10",
",",
"$",
"fields",
"=",
"self",
"::",
"DEFAULT_WORKOUT_FIELDS",
")",
"{",
"$",
"workouts",
"=",
"[",
"]",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"request",
"(",
"self",
"::",
... | Get list of last workouts
@param int $limit
@param array $fields list of requested fields
@return Workout[] | [
"Get",
"list",
"of",
"last",
"workouts"
] | c06871902f23ca9f40a7465cbecaf750a8114fa0 | https://github.com/fabulator/endomondo-api-old/blob/c06871902f23ca9f40a7465cbecaf750a8114fa0/lib/Fabulator/Endomondo/EndomondoApiOld.php#L140-L153 |
229,988 | fabulator/endomondo-api-old | lib/Fabulator/Endomondo/EndomondoApiOld.php | EndomondoApiOld.createWorkout | public function createWorkout(Workout $workout)
{
$response = $this->request(self::CREATE_WORKOUT_ENDPOINT, [
'workoutId' => '-' . $this->bigRandomNumber(16),
'duration' => $workout->getDuration(),
'sport' => $workout->getTypeId(),
'extendedResponse' => 'true'... | php | public function createWorkout(Workout $workout)
{
$response = $this->request(self::CREATE_WORKOUT_ENDPOINT, [
'workoutId' => '-' . $this->bigRandomNumber(16),
'duration' => $workout->getDuration(),
'sport' => $workout->getTypeId(),
'extendedResponse' => 'true'... | [
"public",
"function",
"createWorkout",
"(",
"Workout",
"$",
"workout",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"request",
"(",
"self",
"::",
"CREATE_WORKOUT_ENDPOINT",
",",
"[",
"'workoutId'",
"=>",
"'-'",
".",
"$",
"this",
"->",
"bigRandomNumber"... | Create Endomondo Workout.
@param Workout $workout
@return Workout
@throws EndomondoApiOldException when it fails to create workout | [
"Create",
"Endomondo",
"Workout",
"."
] | c06871902f23ca9f40a7465cbecaf750a8114fa0 | https://github.com/fabulator/endomondo-api-old/blob/c06871902f23ca9f40a7465cbecaf750a8114fa0/lib/Fabulator/Endomondo/EndomondoApiOld.php#L162-L179 |
229,989 | fabulator/endomondo-api-old | lib/Fabulator/Endomondo/EndomondoApiOld.php | EndomondoApiOld.updateWorkout | public function updateWorkout(Workout $workout)
{
if (!$workout->getId()) {
throw new EndomondoApiOldException('You cannot edit workout without knowing its ID.');
}
$utc = new \DateTimeZone('UTC');
$timeFormat = 'Y-m-d H:i:s \U\T\C';
$data = [
'durat... | php | public function updateWorkout(Workout $workout)
{
if (!$workout->getId()) {
throw new EndomondoApiOldException('You cannot edit workout without knowing its ID.');
}
$utc = new \DateTimeZone('UTC');
$timeFormat = 'Y-m-d H:i:s \U\T\C';
$data = [
'durat... | [
"public",
"function",
"updateWorkout",
"(",
"Workout",
"$",
"workout",
")",
"{",
"if",
"(",
"!",
"$",
"workout",
"->",
"getId",
"(",
")",
")",
"{",
"throw",
"new",
"EndomondoApiOldException",
"(",
"'You cannot edit workout without knowing its ID.'",
")",
";",
"}... | Update existing endomondo Workout.
@param Workout $workout
@return Workout
@throws EndomondoApiOldException when id of workout is not set | [
"Update",
"existing",
"endomondo",
"Workout",
"."
] | c06871902f23ca9f40a7465cbecaf750a8114fa0 | https://github.com/fabulator/endomondo-api-old/blob/c06871902f23ca9f40a7465cbecaf750a8114fa0/lib/Fabulator/Endomondo/EndomondoApiOld.php#L188-L230 |
229,990 | fabulator/endomondo-api-old | lib/Fabulator/Endomondo/EndomondoApiOld.php | EndomondoApiOld.bigRandomNumber | private function bigRandomNumber($randNumberLength)
{
$randNumber = null;
for ($i = 0; $i < $randNumberLength; $i++) {
$randNumber .= rand(0, 9);
}
return $randNumber;
} | php | private function bigRandomNumber($randNumberLength)
{
$randNumber = null;
for ($i = 0; $i < $randNumberLength; $i++) {
$randNumber .= rand(0, 9);
}
return $randNumber;
} | [
"private",
"function",
"bigRandomNumber",
"(",
"$",
"randNumberLength",
")",
"{",
"$",
"randNumber",
"=",
"null",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"randNumberLength",
";",
"$",
"i",
"++",
")",
"{",
"$",
"randNumber",
".="... | Generate really long number.
@param int $randNumberLength
@return string | [
"Generate",
"really",
"long",
"number",
"."
] | c06871902f23ca9f40a7465cbecaf750a8114fa0 | https://github.com/fabulator/endomondo-api-old/blob/c06871902f23ca9f40a7465cbecaf750a8114fa0/lib/Fabulator/Endomondo/EndomondoApiOld.php#L238-L247 |
229,991 | Webiny/Framework | src/Webiny/Component/Bootstrap/Environment.php | Environment.initializeEnvironment | public function initializeEnvironment($applicationAbsolutePath)
{
$this->applicationAbsolutePath = $applicationAbsolutePath;
$this->loadApplicationConfig();
$this->registerAppNamespace();
$this->initializeEnvironmentInternal();
$this->initializeComponentConfigurations();
... | php | public function initializeEnvironment($applicationAbsolutePath)
{
$this->applicationAbsolutePath = $applicationAbsolutePath;
$this->loadApplicationConfig();
$this->registerAppNamespace();
$this->initializeEnvironmentInternal();
$this->initializeComponentConfigurations();
... | [
"public",
"function",
"initializeEnvironment",
"(",
"$",
"applicationAbsolutePath",
")",
"{",
"$",
"this",
"->",
"applicationAbsolutePath",
"=",
"$",
"applicationAbsolutePath",
";",
"$",
"this",
"->",
"loadApplicationConfig",
"(",
")",
";",
"$",
"this",
"->",
"reg... | Initializes the environment and loads all the configurations from it.
@param string $applicationAbsolutePath Absolute path to the root of the application.
@throws BootstrapException | [
"Initializes",
"the",
"environment",
"and",
"loads",
"all",
"the",
"configurations",
"from",
"it",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Bootstrap/Environment.php#L83-L92 |
229,992 | Webiny/Framework | src/Webiny/Component/Bootstrap/Environment.php | Environment.getCurrentEnvironmentName | public function getCurrentEnvironmentName()
{
if (!empty($this->currentEnvironmentName)) {
return $this->currentEnvironmentName;
}
// get current environments
$environments = $this->applicationConfig->get('Application.Environments', false);
if($environments){
... | php | public function getCurrentEnvironmentName()
{
if (!empty($this->currentEnvironmentName)) {
return $this->currentEnvironmentName;
}
// get current environments
$environments = $this->applicationConfig->get('Application.Environments', false);
if($environments){
... | [
"public",
"function",
"getCurrentEnvironmentName",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"currentEnvironmentName",
")",
")",
"{",
"return",
"$",
"this",
"->",
"currentEnvironmentName",
";",
"}",
"// get current environments",
"$",
"envi... | Get the name of the current loaded environment.
@return string
@throws BootstrapException | [
"Get",
"the",
"name",
"of",
"the",
"current",
"loaded",
"environment",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Bootstrap/Environment.php#L130-L156 |
229,993 | Webiny/Framework | src/Webiny/Component/Bootstrap/Environment.php | Environment.loadApplicationConfig | private function loadApplicationConfig()
{
// load the config
try{
$this->applicationConfig = $this->config()->yaml($this->applicationAbsolutePath . 'App/Config/App.yaml');
}catch (\Exception $e){
throw new BootstrapException('Unable to read app config file: '.$this->... | php | private function loadApplicationConfig()
{
// load the config
try{
$this->applicationConfig = $this->config()->yaml($this->applicationAbsolutePath . 'App/Config/App.yaml');
}catch (\Exception $e){
throw new BootstrapException('Unable to read app config file: '.$this->... | [
"private",
"function",
"loadApplicationConfig",
"(",
")",
"{",
"// load the config",
"try",
"{",
"$",
"this",
"->",
"applicationConfig",
"=",
"$",
"this",
"->",
"config",
"(",
")",
"->",
"yaml",
"(",
"$",
"this",
"->",
"applicationAbsolutePath",
".",
"'App/Con... | Loads application configuration. | [
"Loads",
"application",
"configuration",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Bootstrap/Environment.php#L172-L181 |
229,994 | Webiny/Framework | src/Webiny/Component/Bootstrap/Environment.php | Environment.initializeEnvironmentInternal | private function initializeEnvironmentInternal()
{
// validate the environment
$environments = $this->applicationConfig->get('Application.Environments', false);
if($environments){
// get the production environment
$productionEnv = $environments->get('Production', fal... | php | private function initializeEnvironmentInternal()
{
// validate the environment
$environments = $this->applicationConfig->get('Application.Environments', false);
if($environments){
// get the production environment
$productionEnv = $environments->get('Production', fal... | [
"private",
"function",
"initializeEnvironmentInternal",
"(",
")",
"{",
"// validate the environment",
"$",
"environments",
"=",
"$",
"this",
"->",
"applicationConfig",
"->",
"get",
"(",
"'Application.Environments'",
",",
"false",
")",
";",
"if",
"(",
"$",
"environme... | Initializes current environment.
Method detect the current environment and loads all the configurations from it.
@throws BootstrapException
@throws \Webiny\Component\Config\ConfigException | [
"Initializes",
"current",
"environment",
".",
"Method",
"detect",
"the",
"current",
"environment",
"and",
"loads",
"all",
"the",
"configurations",
"from",
"it",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Bootstrap/Environment.php#L190-L214 |
229,995 | Webiny/Framework | src/Webiny/Component/Bootstrap/Environment.php | Environment.setErrorReporting | private function setErrorReporting()
{
// set error reporting
$errorReporting = $this->applicationConfig->get('Application.Environments.' . $this->getCurrentEnvironmentName(
) . '.ErrorReporting', 'off'
);
if (strtolower($errorReporting) == 'on') {
er... | php | private function setErrorReporting()
{
// set error reporting
$errorReporting = $this->applicationConfig->get('Application.Environments.' . $this->getCurrentEnvironmentName(
) . '.ErrorReporting', 'off'
);
if (strtolower($errorReporting) == 'on') {
er... | [
"private",
"function",
"setErrorReporting",
"(",
")",
"{",
"// set error reporting",
"$",
"errorReporting",
"=",
"$",
"this",
"->",
"applicationConfig",
"->",
"get",
"(",
"'Application.Environments.'",
".",
"$",
"this",
"->",
"getCurrentEnvironmentName",
"(",
")",
"... | Sets the error reporting based on the environment.
@throws BootstrapException | [
"Sets",
"the",
"error",
"reporting",
"based",
"on",
"the",
"environment",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Bootstrap/Environment.php#L221-L232 |
229,996 | Webiny/Framework | src/Webiny/Component/Bootstrap/Environment.php | Environment.registerAppNamespace | private function registerAppNamespace()
{
// get app namespace
$namespace = $this->applicationConfig->get('Application.Namespace', false);
if (!$namespace) {
throw new BootstrapException('Unable to register application namespace. You must define the application namespace in your ... | php | private function registerAppNamespace()
{
// get app namespace
$namespace = $this->applicationConfig->get('Application.Namespace', false);
if (!$namespace) {
throw new BootstrapException('Unable to register application namespace. You must define the application namespace in your ... | [
"private",
"function",
"registerAppNamespace",
"(",
")",
"{",
"// get app namespace",
"$",
"namespace",
"=",
"$",
"this",
"->",
"applicationConfig",
"->",
"get",
"(",
"'Application.Namespace'",
",",
"false",
")",
";",
"if",
"(",
"!",
"$",
"namespace",
")",
"{"... | Registers the application namespace with the ClassLoader component.
@throws BootstrapException | [
"Registers",
"the",
"application",
"namespace",
"with",
"the",
"ClassLoader",
"component",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Bootstrap/Environment.php#L239-L254 |
229,997 | Webiny/Framework | src/Webiny/Component/Bootstrap/Environment.php | Environment.initializeComponentConfigurations | private function initializeComponentConfigurations()
{
foreach ($this->webinyComponents as $c) {
$componentConfig = $this->componentConfigs->get($c, false);
if ($componentConfig) {
$class = 'Webiny\Component\\' . $c . '\\' . $c;
$method = 'setConfig';
... | php | private function initializeComponentConfigurations()
{
foreach ($this->webinyComponents as $c) {
$componentConfig = $this->componentConfigs->get($c, false);
if ($componentConfig) {
$class = 'Webiny\Component\\' . $c . '\\' . $c;
$method = 'setConfig';
... | [
"private",
"function",
"initializeComponentConfigurations",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"webinyComponents",
"as",
"$",
"c",
")",
"{",
"$",
"componentConfig",
"=",
"$",
"this",
"->",
"componentConfigs",
"->",
"get",
"(",
"$",
"c",
",",
... | Initializes component configurations.
Component configurations are all the configurations inside the specific environment.
If configuration name matches a Webiny Framework component, then the configuration is automatically assigned
to that component. | [
"Initializes",
"component",
"configurations",
".",
"Component",
"configurations",
"are",
"all",
"the",
"configurations",
"inside",
"the",
"specific",
"environment",
".",
"If",
"configuration",
"name",
"matches",
"a",
"Webiny",
"Framework",
"component",
"then",
"the",
... | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Bootstrap/Environment.php#L262-L276 |
229,998 | Webiny/Framework | src/Webiny/Component/Bootstrap/Environment.php | Environment.loadConfigurations | private function loadConfigurations($environment)
{
$configs = new ConfigObject([]);
$configFolder = $this->applicationAbsolutePath . 'App/Config/' . $environment;
$h = scandir($configFolder);
foreach ($h as $configFile) {
if (strpos($configFile, 'yaml') === false) {
... | php | private function loadConfigurations($environment)
{
$configs = new ConfigObject([]);
$configFolder = $this->applicationAbsolutePath . 'App/Config/' . $environment;
$h = scandir($configFolder);
foreach ($h as $configFile) {
if (strpos($configFile, 'yaml') === false) {
... | [
"private",
"function",
"loadConfigurations",
"(",
"$",
"environment",
")",
"{",
"$",
"configs",
"=",
"new",
"ConfigObject",
"(",
"[",
"]",
")",
";",
"$",
"configFolder",
"=",
"$",
"this",
"->",
"applicationAbsolutePath",
".",
"'App/Config/'",
".",
"$",
"envi... | Loads all the configurations from a specific environment.
@param string $environment Environment name.
@return ConfigObject
@throws \Webiny\Component\Config\ConfigException | [
"Loads",
"all",
"the",
"configurations",
"from",
"a",
"specific",
"environment",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Bootstrap/Environment.php#L286-L301 |
229,999 | Webiny/Framework | src/Webiny/Component/Security/Authorization/AccessControl.php | AccessControl.isUserAllowedAccess | public function isUserAllowedAccess()
{
$requestedRoles = $this->getRequestedRoles();
// we allow access if there are no requested roles that the user must have
if (count($requestedRoles) < 1) {
return true;
}
return $this->getAccessDecision($requestedRoles);
... | php | public function isUserAllowedAccess()
{
$requestedRoles = $this->getRequestedRoles();
// we allow access if there are no requested roles that the user must have
if (count($requestedRoles) < 1) {
return true;
}
return $this->getAccessDecision($requestedRoles);
... | [
"public",
"function",
"isUserAllowedAccess",
"(",
")",
"{",
"$",
"requestedRoles",
"=",
"$",
"this",
"->",
"getRequestedRoles",
"(",
")",
";",
"// we allow access if there are no requested roles that the user must have",
"if",
"(",
"count",
"(",
"$",
"requestedRoles",
"... | Checks if current user is allowed access.
@return bool | [
"Checks",
"if",
"current",
"user",
"is",
"allowed",
"access",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Security/Authorization/AccessControl.php#L76-L86 |
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.