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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
14,300 | markwatkinson/luminous | src/Luminous/Utils/ColorUtils.php | ColorUtils.nearestColor | public static function nearestColor($refLabs, $lab, $algorithm, $returnArrayKey = false, $cacheKey = "")
{
// Calculating a unique cache key takes even longer than calculating the distance, so the caller needs to craft
// a cache key by hand
$subKey = $lab[0] . $lab[1] . $lab[2];
$re... | php | public static function nearestColor($refLabs, $lab, $algorithm, $returnArrayKey = false, $cacheKey = "")
{
// Calculating a unique cache key takes even longer than calculating the distance, so the caller needs to craft
// a cache key by hand
$subKey = $lab[0] . $lab[1] . $lab[2];
$re... | [
"public",
"static",
"function",
"nearestColor",
"(",
"$",
"refLabs",
",",
"$",
"lab",
",",
"$",
"algorithm",
",",
"$",
"returnArrayKey",
"=",
"false",
",",
"$",
"cacheKey",
"=",
"\"\"",
")",
"{",
"// Calculating a unique cache key takes even longer than calculating ... | Searches a list of colors for the one with the shortest distance to a given color | [
"Searches",
"a",
"list",
"of",
"colors",
"for",
"the",
"one",
"with",
"the",
"shortest",
"distance",
"to",
"a",
"given",
"color"
] | 4adc18f414534abe986133d6d38e8e9787d32e69 | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Utils/ColorUtils.php#L170-L204 |
14,301 | wpup/digster | src/cache/class-wordpress-cache-adapter.php | WordPress_Cache_Adapter.fetch | public function fetch( $key ) {
$key = $this->get_key( $key );
return wp_cache_get( $key, $this->group );
} | php | public function fetch( $key ) {
$key = $this->get_key( $key );
return wp_cache_get( $key, $this->group );
} | [
"public",
"function",
"fetch",
"(",
"$",
"key",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"get_key",
"(",
"$",
"key",
")",
";",
"return",
"wp_cache_get",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"group",
")",
";",
"}"
] | Fetch cache data.
@param string $key
@return mixed | [
"Fetch",
"cache",
"data",
"."
] | 9ef9626ce82673af698bc0976d6c38a532e4a6d9 | https://github.com/wpup/digster/blob/9ef9626ce82673af698bc0976d6c38a532e4a6d9/src/cache/class-wordpress-cache-adapter.php#L45-L48 |
14,302 | wpup/digster | src/cache/class-wordpress-cache-adapter.php | WordPress_Cache_Adapter.save | public function save( $key, $value, $expire = 0 ) {
$key = $this->get_key( $key );
wp_cache_set( $key, $value, $this->group, $expire );
} | php | public function save( $key, $value, $expire = 0 ) {
$key = $this->get_key( $key );
wp_cache_set( $key, $value, $this->group, $expire );
} | [
"public",
"function",
"save",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"expire",
"=",
"0",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"get_key",
"(",
"$",
"key",
")",
";",
"wp_cache_set",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
... | Save cache data.
@param string $key
@param mixed $value
@param int $expire | [
"Save",
"cache",
"data",
"."
] | 9ef9626ce82673af698bc0976d6c38a532e4a6d9 | https://github.com/wpup/digster/blob/9ef9626ce82673af698bc0976d6c38a532e4a6d9/src/cache/class-wordpress-cache-adapter.php#L68-L71 |
14,303 | markwatkinson/luminous | src/Luminous/Luminous.php | Luminous.getFormatter | public function getFormatter()
{
$fmt = $this->settings->format;
$formatter = null;
if (!is_string($fmt) && is_subclass_of($fmt, 'Luminous\\Formatters\\Formatter')) {
$formatter = clone $fmt;
} elseif ($fmt === 'html') {
$formatter = new HtmlFormatter();
... | php | public function getFormatter()
{
$fmt = $this->settings->format;
$formatter = null;
if (!is_string($fmt) && is_subclass_of($fmt, 'Luminous\\Formatters\\Formatter')) {
$formatter = clone $fmt;
} elseif ($fmt === 'html') {
$formatter = new HtmlFormatter();
... | [
"public",
"function",
"getFormatter",
"(",
")",
"{",
"$",
"fmt",
"=",
"$",
"this",
"->",
"settings",
"->",
"format",
";",
"$",
"formatter",
"=",
"null",
";",
"if",
"(",
"!",
"is_string",
"(",
"$",
"fmt",
")",
"&&",
"is_subclass_of",
"(",
"$",
"fmt",
... | Returns an instance of the current formatter | [
"Returns",
"an",
"instance",
"of",
"the",
"current",
"formatter"
] | 4adc18f414534abe986133d6d38e8e9787d32e69 | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Luminous.php#L120-L146 |
14,304 | markwatkinson/luminous | src/Luminous/Luminous.php | Luminous.highlight | public function highlight($scanner, $source, $settings = null)
{
$oldSettings = null;
if ($settings !== null) {
if (!is_array($settings)) {
throw new Exception('Luminous internal error: Settings is not an array');
}
$oldSettings = clone $this->sett... | php | public function highlight($scanner, $source, $settings = null)
{
$oldSettings = null;
if ($settings !== null) {
if (!is_array($settings)) {
throw new Exception('Luminous internal error: Settings is not an array');
}
$oldSettings = clone $this->sett... | [
"public",
"function",
"highlight",
"(",
"$",
"scanner",
",",
"$",
"source",
",",
"$",
"settings",
"=",
"null",
")",
"{",
"$",
"oldSettings",
"=",
"null",
";",
"if",
"(",
"$",
"settings",
"!==",
"null",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$"... | The real highlighting function
@throw InvalidArgumentException if $scanner is not either a string or a
LuminousScanner instance, or if $source is not a string. | [
"The",
"real",
"highlighting",
"function"
] | 4adc18f414534abe986133d6d38e8e9787d32e69 | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Luminous.php#L200-L260 |
14,305 | mimmi20/Wurfl | src/Configuration/InMemoryConfig.php | InMemoryConfig.persistence | public function persistence($provider, array $params = array())
{
$this->persistence = array_merge(array(Config::PROVIDER => $provider), array(Config::PARAMS => $params));
return $this;
} | php | public function persistence($provider, array $params = array())
{
$this->persistence = array_merge(array(Config::PROVIDER => $provider), array(Config::PARAMS => $params));
return $this;
} | [
"public",
"function",
"persistence",
"(",
"$",
"provider",
",",
"array",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"persistence",
"=",
"array_merge",
"(",
"array",
"(",
"Config",
"::",
"PROVIDER",
"=>",
"$",
"provider",
")",
"... | Set persistence provider
@param string $provider
@param array $params
@return \Wurfl\Configuration\InMemoryConfig $this | [
"Set",
"persistence",
"provider"
] | 443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Configuration/InMemoryConfig.php#L79-L84 |
14,306 | mimmi20/Wurfl | src/Configuration/InMemoryConfig.php | InMemoryConfig.cache | public function cache($provider, array $params = array())
{
$this->cache = array_merge(array(config::PROVIDER => $provider), array(Config::PARAMS => $params));
return $this;
} | php | public function cache($provider, array $params = array())
{
$this->cache = array_merge(array(config::PROVIDER => $provider), array(Config::PARAMS => $params));
return $this;
} | [
"public",
"function",
"cache",
"(",
"$",
"provider",
",",
"array",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"cache",
"=",
"array_merge",
"(",
"array",
"(",
"config",
"::",
"PROVIDER",
"=>",
"$",
"provider",
")",
",",
"array... | Set Cache provider
@param string $provider
@param array $params
@return \Wurfl\Configuration\InMemoryConfig $this | [
"Set",
"Cache",
"provider"
] | 443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Configuration/InMemoryConfig.php#L94-L99 |
14,307 | mimmi20/Wurfl | src/Configuration/InMemoryConfig.php | InMemoryConfig.logDir | public function logDir($dir)
{
$this->logDir = $dir;
$this->buildFileLogger($this->logDir);
return $this;
} | php | public function logDir($dir)
{
$this->logDir = $dir;
$this->buildFileLogger($this->logDir);
return $this;
} | [
"public",
"function",
"logDir",
"(",
"$",
"dir",
")",
"{",
"$",
"this",
"->",
"logDir",
"=",
"$",
"dir",
";",
"$",
"this",
"->",
"buildFileLogger",
"(",
"$",
"this",
"->",
"logDir",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Set logging directory
@param string $dir
@return \Wurfl\Configuration\InMemoryConfig $this | [
"Set",
"logging",
"directory"
] | 443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Configuration/InMemoryConfig.php#L108-L115 |
14,308 | LordDashMe/php-static-class-interface | src/Facade.php | Facade.getResolvedClassInstance | protected static function getResolvedClassInstance()
{
$classNamespace = static::getStaticClassAccessor();
$resolvedClassInstance = self::getClass($classNamespace);
if (! $resolvedClassInstance) {
return self::resolveClassNameSpace($classNamespace);
}
... | php | protected static function getResolvedClassInstance()
{
$classNamespace = static::getStaticClassAccessor();
$resolvedClassInstance = self::getClass($classNamespace);
if (! $resolvedClassInstance) {
return self::resolveClassNameSpace($classNamespace);
}
... | [
"protected",
"static",
"function",
"getResolvedClassInstance",
"(",
")",
"{",
"$",
"classNamespace",
"=",
"static",
"::",
"getStaticClassAccessor",
"(",
")",
";",
"$",
"resolvedClassInstance",
"=",
"self",
"::",
"getClass",
"(",
"$",
"classNamespace",
")",
";",
... | Check if the class namespace already have a cached resolved instance,
if not then the class namespace must be resolve.
@return mixed | [
"Check",
"if",
"the",
"class",
"namespace",
"already",
"have",
"a",
"cached",
"resolved",
"instance",
"if",
"not",
"then",
"the",
"class",
"namespace",
"must",
"be",
"resolve",
"."
] | 7c0855e47158c81e041723bede48a7b35652edb3 | https://github.com/LordDashMe/php-static-class-interface/blob/7c0855e47158c81e041723bede48a7b35652edb3/src/Facade.php#L83-L93 |
14,309 | LordDashMe/php-static-class-interface | src/Facade.php | Facade.resolveClassNameSpace | protected static function resolveClassNameSpace($classNamespace)
{
if (! \is_string($classNamespace)) {
throw ClassNamespaceResolverException::isNotString();
}
if (! \class_exists($classNamespace)) {
throw ClassNamespaceResolverException::isNotExist();
}
... | php | protected static function resolveClassNameSpace($classNamespace)
{
if (! \is_string($classNamespace)) {
throw ClassNamespaceResolverException::isNotString();
}
if (! \class_exists($classNamespace)) {
throw ClassNamespaceResolverException::isNotExist();
}
... | [
"protected",
"static",
"function",
"resolveClassNameSpace",
"(",
"$",
"classNamespace",
")",
"{",
"if",
"(",
"!",
"\\",
"is_string",
"(",
"$",
"classNamespace",
")",
")",
"{",
"throw",
"ClassNamespaceResolverException",
"::",
"isNotString",
"(",
")",
";",
"}",
... | Resolver for service class namespace.
Set the resolved service class instance to the class property.
@param string $classNamespace
@return mixed | [
"Resolver",
"for",
"service",
"class",
"namespace",
".",
"Set",
"the",
"resolved",
"service",
"class",
"instance",
"to",
"the",
"class",
"property",
"."
] | 7c0855e47158c81e041723bede48a7b35652edb3 | https://github.com/LordDashMe/php-static-class-interface/blob/7c0855e47158c81e041723bede48a7b35652edb3/src/Facade.php#L103-L120 |
14,310 | unimapper/unimapper | src/Entity/Reflection/Property.php | Property._initType | private function _initType($definition)
{
if (isset(self::$typeAliases[$definition])) {
$definition = self::$typeAliases[$definition];
}
if (self::isScalarType($definition)
|| in_array(
$definition,
[self::TYPE_ARRAY, self::TYPE_DATE, ... | php | private function _initType($definition)
{
if (isset(self::$typeAliases[$definition])) {
$definition = self::$typeAliases[$definition];
}
if (self::isScalarType($definition)
|| in_array(
$definition,
[self::TYPE_ARRAY, self::TYPE_DATE, ... | [
"private",
"function",
"_initType",
"(",
"$",
"definition",
")",
"{",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"typeAliases",
"[",
"$",
"definition",
"]",
")",
")",
"{",
"$",
"definition",
"=",
"self",
"::",
"$",
"typeAliases",
"[",
"$",
"definition... | Initialize property type
@param string $definition
@return mixed
@throws Exception\PropertyException | [
"Initialize",
"property",
"type"
] | a63b39f38a790fec7e852c8ef1e4c31653e689f7 | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Entity/Reflection/Property.php#L209-L240 |
14,311 | unimapper/unimapper | src/Entity/Reflection/Property.php | Property.convertValue | public function convertValue($value)
{
if ($value === null || ($value === "" && $this->type !== self::TYPE_STRING)) {
return;
}
if (self::isScalarType($this->type) || $this->type === self::TYPE_ARRAY) {
// Scalar and array
if ($this->type === self::TYPE_... | php | public function convertValue($value)
{
if ($value === null || ($value === "" && $this->type !== self::TYPE_STRING)) {
return;
}
if (self::isScalarType($this->type) || $this->type === self::TYPE_ARRAY) {
// Scalar and array
if ($this->type === self::TYPE_... | [
"public",
"function",
"convertValue",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
"||",
"(",
"$",
"value",
"===",
"\"\"",
"&&",
"$",
"this",
"->",
"type",
"!==",
"self",
"::",
"TYPE_STRING",
")",
")",
"{",
"return",
";",
"}... | Try to convert value on required type automatically
@param mixed $value
@return mixed
@throws Exception\InvalidArgumentException | [
"Try",
"to",
"convert",
"value",
"on",
"required",
"type",
"automatically"
] | a63b39f38a790fec7e852c8ef1e4c31653e689f7 | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Entity/Reflection/Property.php#L369-L428 |
14,312 | nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Printer/ConfigForm.php | HTMLPurifier_Printer_ConfigForm.renderNamespace | protected function renderNamespace($ns, $directives) {
$ret = '';
$ret .= $this->start('tbody', array('class' => 'namespace'));
$ret .= $this->start('tr');
$ret .= $this->element('th', $ns, array('colspan' => 2));
$ret .= $this->end('tr');
$ret .= $this->end('tbody');... | php | protected function renderNamespace($ns, $directives) {
$ret = '';
$ret .= $this->start('tbody', array('class' => 'namespace'));
$ret .= $this->start('tr');
$ret .= $this->element('th', $ns, array('colspan' => 2));
$ret .= $this->end('tr');
$ret .= $this->end('tbody');... | [
"protected",
"function",
"renderNamespace",
"(",
"$",
"ns",
",",
"$",
"directives",
")",
"{",
"$",
"ret",
"=",
"''",
";",
"$",
"ret",
".=",
"$",
"this",
"->",
"start",
"(",
"'tbody'",
",",
"array",
"(",
"'class'",
"=>",
"'namespace'",
")",
")",
";",
... | Renders a single namespace
@param $ns String namespace name
@param $directive Associative array of directives to values | [
"Renders",
"a",
"single",
"namespace"
] | ecffed0d75be1454901e1cb24633472b8f67c967 | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Printer/ConfigForm.php#L127-L181 |
14,313 | gorkalaucirica/HipchatAPIv2Client | Model/User.php | User.parseJson | public function parseJson($json)
{
$this->mentionName = $json['mention_name'];
$this->id = $json['id'];
$this->name = $json['name'];
if (isset($json['links'])) {
$this->links = $json['links'];
}
if(isset($json['xmpp_jid'])) {
$this->xmppJid = $... | php | public function parseJson($json)
{
$this->mentionName = $json['mention_name'];
$this->id = $json['id'];
$this->name = $json['name'];
if (isset($json['links'])) {
$this->links = $json['links'];
}
if(isset($json['xmpp_jid'])) {
$this->xmppJid = $... | [
"public",
"function",
"parseJson",
"(",
"$",
"json",
")",
"{",
"$",
"this",
"->",
"mentionName",
"=",
"$",
"json",
"[",
"'mention_name'",
"]",
";",
"$",
"this",
"->",
"id",
"=",
"$",
"json",
"[",
"'id'",
"]",
";",
"$",
"this",
"->",
"name",
"=",
... | Parses response given by the API and maps the fields to User object
@param array $json json_decoded response in json given by the server
@return void | [
"Parses",
"response",
"given",
"by",
"the",
"API",
"and",
"maps",
"the",
"fields",
"to",
"User",
"object"
] | eef9c91d5efe5ae9cad27c503601ffff089c9547 | https://github.com/gorkalaucirica/HipchatAPIv2Client/blob/eef9c91d5efe5ae9cad27c503601ffff089c9547/Model/User.php#L61-L81 |
14,314 | f3ath/appnexusclient | src/HttpClient.php | HttpClient.call | public function call($method, $url, array $post = array(), array $headers = array())
{
$options = array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => $headers,
);
switch ($method) {
case HttpMethod::GET:
... | php | public function call($method, $url, array $post = array(), array $headers = array())
{
$options = array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => $headers,
);
switch ($method) {
case HttpMethod::GET:
... | [
"public",
"function",
"call",
"(",
"$",
"method",
",",
"$",
"url",
",",
"array",
"$",
"post",
"=",
"array",
"(",
")",
",",
"array",
"$",
"headers",
"=",
"array",
"(",
")",
")",
"{",
"$",
"options",
"=",
"array",
"(",
"CURLOPT_URL",
"=>",
"$",
"ur... | Do raw HTTP call
@param string $method
@param string $url
@param array $post POST data
@param array $headers
@return object response | [
"Do",
"raw",
"HTTP",
"call"
] | cfe3f3a98a9c2883484154c8997c7459b1504742 | https://github.com/f3ath/appnexusclient/blob/cfe3f3a98a9c2883484154c8997c7459b1504742/src/HttpClient.php#L39-L84 |
14,315 | unimapper/unimapper | src/Repository.php | Repository.update | public function update(Entity $entity, $primaryValue)
{
if (!$entity->getValidator()->validate()) {
throw new Exception\ValidatorException($entity->getValidator());
}
try {
if (!$this->query()->updateOne($primaryValue, $entity->getData())->run($this->connection)) {
... | php | public function update(Entity $entity, $primaryValue)
{
if (!$entity->getValidator()->validate()) {
throw new Exception\ValidatorException($entity->getValidator());
}
try {
if (!$this->query()->updateOne($primaryValue, $entity->getData())->run($this->connection)) {
... | [
"public",
"function",
"update",
"(",
"Entity",
"$",
"entity",
",",
"$",
"primaryValue",
")",
"{",
"if",
"(",
"!",
"$",
"entity",
"->",
"getValidator",
"(",
")",
"->",
"validate",
"(",
")",
")",
"{",
"throw",
"new",
"Exception",
"\\",
"ValidatorException"... | Update single record
@param Entity $entity
@param mixed $primaryValue
@throws Exception\ValidatorException
@throws Exception\RepositoryException | [
"Update",
"single",
"record"
] | a63b39f38a790fec7e852c8ef1e4c31653e689f7 | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Repository.php#L116-L132 |
14,316 | unimapper/unimapper | src/Repository.php | Repository.destroy | public function destroy(Entity $entity)
{
$requiredClass = Convention::nameToClass($this->getEntityName(), Convention::ENTITY_MASK);
if (!$entity instanceof $requiredClass) {
throw new Exception\RepositoryException(
"Entity must be instance of ". $requiredClass . "!"
... | php | public function destroy(Entity $entity)
{
$requiredClass = Convention::nameToClass($this->getEntityName(), Convention::ENTITY_MASK);
if (!$entity instanceof $requiredClass) {
throw new Exception\RepositoryException(
"Entity must be instance of ". $requiredClass . "!"
... | [
"public",
"function",
"destroy",
"(",
"Entity",
"$",
"entity",
")",
"{",
"$",
"requiredClass",
"=",
"Convention",
"::",
"nameToClass",
"(",
"$",
"this",
"->",
"getEntityName",
"(",
")",
",",
"Convention",
"::",
"ENTITY_MASK",
")",
";",
"if",
"(",
"!",
"$... | Delete single record
@param Entity $entity
@return boolean
@throws Exception\RepositoryException | [
"Delete",
"single",
"record"
] | a63b39f38a790fec7e852c8ef1e4c31653e689f7 | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Repository.php#L185-L208 |
14,317 | unimapper/unimapper | src/Repository.php | Repository.find | public function find(array $filter = [], array $orderBy = [], $limit = 0,
$offset = 0, array $associate = []
) {
try {
$query = $this->query()
->select()
->associate($associate)
->setFilter($filter);
foreach ($orderBy as $orde... | php | public function find(array $filter = [], array $orderBy = [], $limit = 0,
$offset = 0, array $associate = []
) {
try {
$query = $this->query()
->select()
->associate($associate)
->setFilter($filter);
foreach ($orderBy as $orde... | [
"public",
"function",
"find",
"(",
"array",
"$",
"filter",
"=",
"[",
"]",
",",
"array",
"$",
"orderBy",
"=",
"[",
"]",
",",
"$",
"limit",
"=",
"0",
",",
"$",
"offset",
"=",
"0",
",",
"array",
"$",
"associate",
"=",
"[",
"]",
")",
"{",
"try",
... | Find all records
@param array $filter
@param array $orderBy
@param int $limit
@param int $offset
@param array $associate
@return Entity\Collection
@throws Exception\RepositoryException | [
"Find",
"all",
"records"
] | a63b39f38a790fec7e852c8ef1e4c31653e689f7 | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Repository.php#L254-L272 |
14,318 | unimapper/unimapper | src/Repository.php | Repository.findPrimaries | public function findPrimaries(array $primaryValues, array $associate = [])
{
$reflection = Entity\Reflection::load($this->getEntityName());
if (!$reflection->hasPrimary()) {
throw new Exception\RepositoryException(
"Method can not be used because entity " . $this->getEnt... | php | public function findPrimaries(array $primaryValues, array $associate = [])
{
$reflection = Entity\Reflection::load($this->getEntityName());
if (!$reflection->hasPrimary()) {
throw new Exception\RepositoryException(
"Method can not be used because entity " . $this->getEnt... | [
"public",
"function",
"findPrimaries",
"(",
"array",
"$",
"primaryValues",
",",
"array",
"$",
"associate",
"=",
"[",
"]",
")",
"{",
"$",
"reflection",
"=",
"Entity",
"\\",
"Reflection",
"::",
"load",
"(",
"$",
"this",
"->",
"getEntityName",
"(",
")",
")"... | Find records by set of primary values
@param array $primaryValues
@param array $associate
@return Entity\Collection
@throws Exception\RepositoryException | [
"Find",
"records",
"by",
"set",
"of",
"primary",
"values"
] | a63b39f38a790fec7e852c8ef1e4c31653e689f7 | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Repository.php#L295-L328 |
14,319 | antarestupin/Accessible | lib/Accessible/MethodManager/CollectionManager.php | CollectionManager.collectionContains | public static function collectionContains($needle, $haystack)
{
foreach ($haystack as $value) {
if ($value === $needle) {
return true;
}
}
return false;
} | php | public static function collectionContains($needle, $haystack)
{
foreach ($haystack as $value) {
if ($value === $needle) {
return true;
}
}
return false;
} | [
"public",
"static",
"function",
"collectionContains",
"(",
"$",
"needle",
",",
"$",
"haystack",
")",
"{",
"foreach",
"(",
"$",
"haystack",
"as",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"$",
"needle",
")",
"{",
"return",
"true",
";",
"... | Indicates wether given collection contains the wanted item or not.
@param mixed $needle
@param array $haystack
@return bool | [
"Indicates",
"wether",
"given",
"collection",
"contains",
"the",
"wanted",
"item",
"or",
"not",
"."
] | d12ce93d72f74c099dfd2109371fcd6ddfffdca4 | https://github.com/antarestupin/Accessible/blob/d12ce93d72f74c099dfd2109371fcd6ddfffdca4/lib/Accessible/MethodManager/CollectionManager.php#L15-L24 |
14,320 | crysalead/net | src/Transport/Protocol/Http/Curl.php | Curl._initRequest | protected function _initRequest($socket, $response)
{
$stream = $this->_classes['stream'];
$curlOptions = $socket->options();
$curlOptions[CURLOPT_INFILESIZE] = $socket->outgoing()->length();
if (isset($curlOptions[CURLOPT_FILE])) {
$response->body(fopen($curlOptions[CU... | php | protected function _initRequest($socket, $response)
{
$stream = $this->_classes['stream'];
$curlOptions = $socket->options();
$curlOptions[CURLOPT_INFILESIZE] = $socket->outgoing()->length();
if (isset($curlOptions[CURLOPT_FILE])) {
$response->body(fopen($curlOptions[CU... | [
"protected",
"function",
"_initRequest",
"(",
"$",
"socket",
",",
"$",
"response",
")",
"{",
"$",
"stream",
"=",
"$",
"this",
"->",
"_classes",
"[",
"'stream'",
"]",
";",
"$",
"curlOptions",
"=",
"$",
"socket",
"->",
"options",
"(",
")",
";",
"$",
"c... | Initialize a socket to be ready to send data.
@param integer $max The number of simultaneous allowed connections. | [
"Initialize",
"a",
"socket",
"to",
"be",
"ready",
"to",
"send",
"data",
"."
] | 4d75abead39e954529b56cbffa3841a9cd3044bb | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Transport/Protocol/Http/Curl.php#L117-L134 |
14,321 | crysalead/net | src/Transport/Protocol/Http/Curl.php | Curl.push | public function push($request, $response, $options = [])
{
$socket = $request instanceof $this->_classes['socket'] ? $request : $this($request, $options);
$this->_queue[$socket->id()] = [
'socket' => $socket,
'response' => $response
];
} | php | public function push($request, $response, $options = [])
{
$socket = $request instanceof $this->_classes['socket'] ? $request : $this($request, $options);
$this->_queue[$socket->id()] = [
'socket' => $socket,
'response' => $response
];
} | [
"public",
"function",
"push",
"(",
"$",
"request",
",",
"$",
"response",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"socket",
"=",
"$",
"request",
"instanceof",
"$",
"this",
"->",
"_classes",
"[",
"'socket'",
"]",
"?",
"$",
"request",
":",
... | Push a request in the queue. | [
"Push",
"a",
"request",
"in",
"the",
"queue",
"."
] | 4d75abead39e954529b56cbffa3841a9cd3044bb | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Transport/Protocol/Http/Curl.php#L296-L304 |
14,322 | crysalead/net | src/Transport/Protocol/Http/Curl.php | Curl.flush | public function flush($max = 10, $options = [])
{
$defaults = [
'selectTimeout' => 1.0
];
$options += $defaults;
do {
$this->select($options['selectTimeout']);
$this->process($max);
} while ($this->_running > 0);
$results = $thi... | php | public function flush($max = 10, $options = [])
{
$defaults = [
'selectTimeout' => 1.0
];
$options += $defaults;
do {
$this->select($options['selectTimeout']);
$this->process($max);
} while ($this->_running > 0);
$results = $thi... | [
"public",
"function",
"flush",
"(",
"$",
"max",
"=",
"10",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"defaults",
"=",
"[",
"'selectTimeout'",
"=>",
"1.0",
"]",
";",
"$",
"options",
"+=",
"$",
"defaults",
";",
"do",
"{",
"$",
"this",
"->"... | Runs until all outstanding requests have been completed.
@param integer $max The number of simultaneous allowed connections.
@return array The array of responses. | [
"Runs",
"until",
"all",
"outstanding",
"requests",
"have",
"been",
"completed",
"."
] | 4d75abead39e954529b56cbffa3841a9cd3044bb | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Transport/Protocol/Http/Curl.php#L312-L328 |
14,323 | crysalead/net | src/Transport/Protocol/Http/Curl.php | Curl._fillup | protected function _fillup($max)
{
$nb = $max - $this->_running;
$list = array_splice($this->_queue, 0, $nb);
foreach ($list as $item) {
$handle = $this->_initRequest($item['socket'], $item['response']);
$this->_handles[(integer) $handle] = $item;
curl_mul... | php | protected function _fillup($max)
{
$nb = $max - $this->_running;
$list = array_splice($this->_queue, 0, $nb);
foreach ($list as $item) {
$handle = $this->_initRequest($item['socket'], $item['response']);
$this->_handles[(integer) $handle] = $item;
curl_mul... | [
"protected",
"function",
"_fillup",
"(",
"$",
"max",
")",
"{",
"$",
"nb",
"=",
"$",
"max",
"-",
"$",
"this",
"->",
"_running",
";",
"$",
"list",
"=",
"array_splice",
"(",
"$",
"this",
"->",
"_queue",
",",
"0",
",",
"$",
"nb",
")",
";",
"foreach",... | Fill the multi handle up to the maximum allowed connections.
@param integer $max The number of simultaneous allowed connections. | [
"Fill",
"the",
"multi",
"handle",
"up",
"to",
"the",
"maximum",
"allowed",
"connections",
"."
] | 4d75abead39e954529b56cbffa3841a9cd3044bb | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Transport/Protocol/Http/Curl.php#L392-L401 |
14,324 | Webiny/AnalyticsDb | src/Webiny/AnalyticsDb/DateHelper.php | DateHelper.rangeThisWeek | public static function rangeThisWeek()
{
$ts = strtotime(date('Y-m-d')) + 86400;
do {
$ts -= 86400;
$startDate = date('N', $ts);
} while ($startDate != '1');
return [$ts, $ts + (86400 * 6)];
} | php | public static function rangeThisWeek()
{
$ts = strtotime(date('Y-m-d')) + 86400;
do {
$ts -= 86400;
$startDate = date('N', $ts);
} while ($startDate != '1');
return [$ts, $ts + (86400 * 6)];
} | [
"public",
"static",
"function",
"rangeThisWeek",
"(",
")",
"{",
"$",
"ts",
"=",
"strtotime",
"(",
"date",
"(",
"'Y-m-d'",
")",
")",
"+",
"86400",
";",
"do",
"{",
"$",
"ts",
"-=",
"86400",
";",
"$",
"startDate",
"=",
"date",
"(",
"'N'",
",",
"$",
... | Returns a date range for the current week.
@return array | [
"Returns",
"a",
"date",
"range",
"for",
"the",
"current",
"week",
"."
] | e0b1e920643cd63071406520767243736004052e | https://github.com/Webiny/AnalyticsDb/blob/e0b1e920643cd63071406520767243736004052e/src/Webiny/AnalyticsDb/DateHelper.php#L35-L44 |
14,325 | Webiny/AnalyticsDb | src/Webiny/AnalyticsDb/DateHelper.php | DateHelper.rangeThisMonth | public static function rangeThisMonth()
{
$currentMonth = date('Y-m-01', time());
$currentMonthTs = self::toTs($currentMonth);
return [$currentMonthTs, $currentMonthTs + (86400 * (date('t') - 1))];
} | php | public static function rangeThisMonth()
{
$currentMonth = date('Y-m-01', time());
$currentMonthTs = self::toTs($currentMonth);
return [$currentMonthTs, $currentMonthTs + (86400 * (date('t') - 1))];
} | [
"public",
"static",
"function",
"rangeThisMonth",
"(",
")",
"{",
"$",
"currentMonth",
"=",
"date",
"(",
"'Y-m-01'",
",",
"time",
"(",
")",
")",
";",
"$",
"currentMonthTs",
"=",
"self",
"::",
"toTs",
"(",
"$",
"currentMonth",
")",
";",
"return",
"[",
"$... | Returns a date range for the current month.
@return array | [
"Returns",
"a",
"date",
"range",
"for",
"the",
"current",
"month",
"."
] | e0b1e920643cd63071406520767243736004052e | https://github.com/Webiny/AnalyticsDb/blob/e0b1e920643cd63071406520767243736004052e/src/Webiny/AnalyticsDb/DateHelper.php#L75-L81 |
14,326 | Webiny/AnalyticsDb | src/Webiny/AnalyticsDb/DateHelper.php | DateHelper.rangeLastMonth | public static function rangeLastMonth()
{
$lastMonth = date('m') - 1;
if ($lastMonth <= 0) {
$lastMonth = 12;
}
$lastMonth = date('Y') . '-' . $lastMonth . '-01';
return [self::toTs($lastMonth), self::toTs($lastMonth) + (86400 * (date('t', strtotime($lastMonth))-... | php | public static function rangeLastMonth()
{
$lastMonth = date('m') - 1;
if ($lastMonth <= 0) {
$lastMonth = 12;
}
$lastMonth = date('Y') . '-' . $lastMonth . '-01';
return [self::toTs($lastMonth), self::toTs($lastMonth) + (86400 * (date('t', strtotime($lastMonth))-... | [
"public",
"static",
"function",
"rangeLastMonth",
"(",
")",
"{",
"$",
"lastMonth",
"=",
"date",
"(",
"'m'",
")",
"-",
"1",
";",
"if",
"(",
"$",
"lastMonth",
"<=",
"0",
")",
"{",
"$",
"lastMonth",
"=",
"12",
";",
"}",
"$",
"lastMonth",
"=",
"date",
... | Returns a date range for the previous month.
@return array | [
"Returns",
"a",
"date",
"range",
"for",
"the",
"previous",
"month",
"."
] | e0b1e920643cd63071406520767243736004052e | https://github.com/Webiny/AnalyticsDb/blob/e0b1e920643cd63071406520767243736004052e/src/Webiny/AnalyticsDb/DateHelper.php#L88-L97 |
14,327 | antarestupin/Accessible | lib/Accessible/Configuration.php | Configuration.getAnnotationReader | public static function getAnnotationReader()
{
if (self::$annotationReader === null) {
self::$annotationReader = new CachedReader(new AnnotationReader(), new ArrayCache());
}
return self::$annotationReader;
} | php | public static function getAnnotationReader()
{
if (self::$annotationReader === null) {
self::$annotationReader = new CachedReader(new AnnotationReader(), new ArrayCache());
}
return self::$annotationReader;
} | [
"public",
"static",
"function",
"getAnnotationReader",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"annotationReader",
"===",
"null",
")",
"{",
"self",
"::",
"$",
"annotationReader",
"=",
"new",
"CachedReader",
"(",
"new",
"AnnotationReader",
"(",
")",
",",... | Get the annotation reader that is used.
Initializes it if it doesn't already exists.
@return Reader The annotation reader. | [
"Get",
"the",
"annotation",
"reader",
"that",
"is",
"used",
".",
"Initializes",
"it",
"if",
"it",
"doesn",
"t",
"already",
"exists",
"."
] | d12ce93d72f74c099dfd2109371fcd6ddfffdca4 | https://github.com/antarestupin/Accessible/blob/d12ce93d72f74c099dfd2109371fcd6ddfffdca4/lib/Accessible/Configuration.php#L70-L77 |
14,328 | antarestupin/Accessible | lib/Accessible/Configuration.php | Configuration.getConstraintsValidator | public static function getConstraintsValidator()
{
if (self::$constraintsValidator === null) {
self::$constraintsValidator = Validation::createValidatorBuilder()
->enableAnnotationMapping(self::getAnnotationReader())
->getValidator();
}
return sel... | php | public static function getConstraintsValidator()
{
if (self::$constraintsValidator === null) {
self::$constraintsValidator = Validation::createValidatorBuilder()
->enableAnnotationMapping(self::getAnnotationReader())
->getValidator();
}
return sel... | [
"public",
"static",
"function",
"getConstraintsValidator",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"constraintsValidator",
"===",
"null",
")",
"{",
"self",
"::",
"$",
"constraintsValidator",
"=",
"Validation",
"::",
"createValidatorBuilder",
"(",
")",
"->",... | Get the constraints validator that is used.
Initializes it if it doesn't already exists.
@return ConstraintValidator The annotation reader. | [
"Get",
"the",
"constraints",
"validator",
"that",
"is",
"used",
".",
"Initializes",
"it",
"if",
"it",
"doesn",
"t",
"already",
"exists",
"."
] | d12ce93d72f74c099dfd2109371fcd6ddfffdca4 | https://github.com/antarestupin/Accessible/blob/d12ce93d72f74c099dfd2109371fcd6ddfffdca4/lib/Accessible/Configuration.php#L95-L104 |
14,329 | antarestupin/Accessible | lib/Accessible/Configuration.php | Configuration.setCache | private static function setCache(Cache &$cacheToChange = null, Cache $cache = null, $namespace = null)
{
if ($namespace === null) {
$namespace = self::$cacheDefaultNamespace;
}
if (!is_string($namespace)) {
throw new \InvalidArgumentException("The namespace must be a ... | php | private static function setCache(Cache &$cacheToChange = null, Cache $cache = null, $namespace = null)
{
if ($namespace === null) {
$namespace = self::$cacheDefaultNamespace;
}
if (!is_string($namespace)) {
throw new \InvalidArgumentException("The namespace must be a ... | [
"private",
"static",
"function",
"setCache",
"(",
"Cache",
"&",
"$",
"cacheToChange",
"=",
"null",
",",
"Cache",
"$",
"cache",
"=",
"null",
",",
"$",
"namespace",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"namespace",
"===",
"null",
")",
"{",
"$",
"name... | Set a cache driver.
@param Cache $cacheToChange The cache to change.
@param Cache $cache The cache driver.
@param string $namespace The cache namespace. | [
"Set",
"a",
"cache",
"driver",
"."
] | d12ce93d72f74c099dfd2109371fcd6ddfffdca4 | https://github.com/antarestupin/Accessible/blob/d12ce93d72f74c099dfd2109371fcd6ddfffdca4/lib/Accessible/Configuration.php#L173-L186 |
14,330 | antarestupin/Accessible | lib/Accessible/Configuration.php | Configuration.setCacheDriver | public static function setCacheDriver(Cache $cache = null, $namespace = null)
{
self::setCache(self::$cacheDriver, $cache, $namespace);
} | php | public static function setCacheDriver(Cache $cache = null, $namespace = null)
{
self::setCache(self::$cacheDriver, $cache, $namespace);
} | [
"public",
"static",
"function",
"setCacheDriver",
"(",
"Cache",
"$",
"cache",
"=",
"null",
",",
"$",
"namespace",
"=",
"null",
")",
"{",
"self",
"::",
"setCache",
"(",
"self",
"::",
"$",
"cacheDriver",
",",
"$",
"cache",
",",
"$",
"namespace",
")",
";"... | Set the cache driver that will be used.
@param Cache $cache The cache driver.
@param string $namespace The cache namespace. | [
"Set",
"the",
"cache",
"driver",
"that",
"will",
"be",
"used",
"."
] | d12ce93d72f74c099dfd2109371fcd6ddfffdca4 | https://github.com/antarestupin/Accessible/blob/d12ce93d72f74c099dfd2109371fcd6ddfffdca4/lib/Accessible/Configuration.php#L204-L207 |
14,331 | sifophp/sifo-common-instance | classes/HelperPasswordGenerator.php | HelperPasswordGenerator.beNice | public static function beNice( $strength = self::ALL_LOWER_CASE, $lenght = 8, $append_numbers = 2 )
{
$password = '';
$vocals = self::EVEN_CHARS;
$consonants = self::ODD_CHARS;
// Strength 1: Add upper case to vocals.
if ( $strength > 0 )
{
$vocals .= strtoupper( $vocals );
}
// Strength 2: Add u... | php | public static function beNice( $strength = self::ALL_LOWER_CASE, $lenght = 8, $append_numbers = 2 )
{
$password = '';
$vocals = self::EVEN_CHARS;
$consonants = self::ODD_CHARS;
// Strength 1: Add upper case to vocals.
if ( $strength > 0 )
{
$vocals .= strtoupper( $vocals );
}
// Strength 2: Add u... | [
"public",
"static",
"function",
"beNice",
"(",
"$",
"strength",
"=",
"self",
"::",
"ALL_LOWER_CASE",
",",
"$",
"lenght",
"=",
"8",
",",
"$",
"append_numbers",
"=",
"2",
")",
"{",
"$",
"password",
"=",
"''",
";",
"$",
"vocals",
"=",
"self",
"::",
"EVE... | Generate a random human readable password.
@param integer $strength Strength of the password.
@param integer $lenght Lenght of the password (excluding the final numbers).
@param integer $append_numbers Lenght of the number to append.
@return unknown | [
"Generate",
"a",
"random",
"human",
"readable",
"password",
"."
] | 52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5 | https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/classes/HelperPasswordGenerator.php#L29-L76 |
14,332 | bariew/yii2-rbac-cms-module | models/AuthItem.php | AuthItem.checkAccess | public static function checkAccess($permissionName, $user = false, $params = [])
{
if (is_array($permissionName)) {
$permissionName = self::createPermissionName($permissionName);
}
if (!$user) {
$user = Yii::$app->user;
}
if (!$user->isGuest && !isset... | php | public static function checkAccess($permissionName, $user = false, $params = [])
{
if (is_array($permissionName)) {
$permissionName = self::createPermissionName($permissionName);
}
if (!$user) {
$user = Yii::$app->user;
}
if (!$user->isGuest && !isset... | [
"public",
"static",
"function",
"checkAccess",
"(",
"$",
"permissionName",
",",
"$",
"user",
"=",
"false",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"permissionName",
")",
")",
"{",
"$",
"permissionName",
"=",
"self"... | Check whether the user has access to permission.
@param mixed $permissionName permission name or its components for self::createPermissionName.
@param mixed $user user
@param array $params
@return boolean whether user has access to permission name. | [
"Check",
"whether",
"the",
"user",
"has",
"access",
"to",
"permission",
"."
] | c1f0fd05bf6d1951a3fd929d974e6f4cc2b52262 | https://github.com/bariew/yii2-rbac-cms-module/blob/c1f0fd05bf6d1951a3fd929d974e6f4cc2b52262/models/AuthItem.php#L102-L127 |
14,333 | bariew/yii2-rbac-cms-module | models/AuthItem.php | AuthItem.move | public function move($oldParent, $newParent)
{
return $oldParent->removeChild($this)
? $newParent->addChild($this)
: false;
} | php | public function move($oldParent, $newParent)
{
return $oldParent->removeChild($this)
? $newParent->addChild($this)
: false;
} | [
"public",
"function",
"move",
"(",
"$",
"oldParent",
",",
"$",
"newParent",
")",
"{",
"return",
"$",
"oldParent",
"->",
"removeChild",
"(",
"$",
"this",
")",
"?",
"$",
"newParent",
"->",
"addChild",
"(",
"$",
"this",
")",
":",
"false",
";",
"}"
] | Detaches this model from its old parent
and attaches to the new one.
@param AuthItem $oldParent item
@param AuthItem $newParent item
@return boolean whether model has been moved. | [
"Detaches",
"this",
"model",
"from",
"its",
"old",
"parent",
"and",
"attaches",
"to",
"the",
"new",
"one",
"."
] | c1f0fd05bf6d1951a3fd929d974e6f4cc2b52262 | https://github.com/bariew/yii2-rbac-cms-module/blob/c1f0fd05bf6d1951a3fd929d974e6f4cc2b52262/models/AuthItem.php#L302-L307 |
14,334 | bariew/yii2-rbac-cms-module | models/AuthItem.php | AuthItem.addChild | public function addChild(AuthItem $item)
{
if ($item->isNewRecord && !$item->save()) {
return false;
}
return Yii::$app->authManager->addChild($this, $item);
} | php | public function addChild(AuthItem $item)
{
if ($item->isNewRecord && !$item->save()) {
return false;
}
return Yii::$app->authManager->addChild($this, $item);
} | [
"public",
"function",
"addChild",
"(",
"AuthItem",
"$",
"item",
")",
"{",
"if",
"(",
"$",
"item",
"->",
"isNewRecord",
"&&",
"!",
"$",
"item",
"->",
"save",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"Yii",
"::",
"$",
"app",
"->",
... | Attaches child related to this model by AuthItemChild.
@param AuthItem $item child.
@return integer whether child is attached. | [
"Attaches",
"child",
"related",
"to",
"this",
"model",
"by",
"AuthItemChild",
"."
] | c1f0fd05bf6d1951a3fd929d974e6f4cc2b52262 | https://github.com/bariew/yii2-rbac-cms-module/blob/c1f0fd05bf6d1951a3fd929d974e6f4cc2b52262/models/AuthItem.php#L314-L320 |
14,335 | soloproyectos-php/text-tokenizer | src/text/tokenizer/TextTokenizer.php | TextTokenizer.eq | public function eq($str, $flags = 0)
{
$ret = false;
if (list($str) = $this->match(preg_quote($str, "/"), $matches, $flags)
) {
$ret = array($str);
}
return $ret;
} | php | public function eq($str, $flags = 0)
{
$ret = false;
if (list($str) = $this->match(preg_quote($str, "/"), $matches, $flags)
) {
$ret = array($str);
}
return $ret;
} | [
"public",
"function",
"eq",
"(",
"$",
"str",
",",
"$",
"flags",
"=",
"0",
")",
"{",
"$",
"ret",
"=",
"false",
";",
"if",
"(",
"list",
"(",
"$",
"str",
")",
"=",
"$",
"this",
"->",
"match",
"(",
"preg_quote",
"(",
"$",
"str",
",",
"\"/\"",
")"... | Is the next token equal to a given string?
This function returns false if the next token is not equal to a given string
or an array with a single string.
@param string $str A string
@param integer $flags Flags (default is 0)
@return false|array of a single string | [
"Is",
"the",
"next",
"token",
"equal",
"to",
"a",
"given",
"string?"
] | 792b463ad8790fa19a7120d1354ee852fc70c017 | https://github.com/soloproyectos-php/text-tokenizer/blob/792b463ad8790fa19a7120d1354ee852fc70c017/src/text/tokenizer/TextTokenizer.php#L146-L156 |
14,336 | soloproyectos-php/text-tokenizer | src/text/tokenizer/TextTokenizer.php | TextTokenizer.in | public function in($items, $flags = 0)
{
$ret = false;
// sorts the items in descending order according to their length
usort(
$items,
function ($item1, $item2) {
return strlen($item1) < strlen($item2);
}
);
foreach ($item... | php | public function in($items, $flags = 0)
{
$ret = false;
// sorts the items in descending order according to their length
usort(
$items,
function ($item1, $item2) {
return strlen($item1) < strlen($item2);
}
);
foreach ($item... | [
"public",
"function",
"in",
"(",
"$",
"items",
",",
"$",
"flags",
"=",
"0",
")",
"{",
"$",
"ret",
"=",
"false",
";",
"// sorts the items in descending order according to their length",
"usort",
"(",
"$",
"items",
",",
"function",
"(",
"$",
"item1",
",",
"$",... | Is the next token the in a given list?
This function returns false if the next token is not in a given list
or an array with a single string.
@param array $items An array of strings
@param integer $flags Flags (default is 0)
@return false|array of a single string | [
"Is",
"the",
"next",
"token",
"the",
"in",
"a",
"given",
"list?"
] | 792b463ad8790fa19a7120d1354ee852fc70c017 | https://github.com/soloproyectos-php/text-tokenizer/blob/792b463ad8790fa19a7120d1354ee852fc70c017/src/text/tokenizer/TextTokenizer.php#L169-L189 |
14,337 | soloproyectos-php/text-tokenizer | src/text/tokenizer/TextTokenizer.php | TextTokenizer.number | public function number($flags = 0)
{
$ret = false;
if ($number = $this->match(TextTokenizer::NUMBER, $matches, $flags)) {
$ret = $number;
}
return $ret;
} | php | public function number($flags = 0)
{
$ret = false;
if ($number = $this->match(TextTokenizer::NUMBER, $matches, $flags)) {
$ret = $number;
}
return $ret;
} | [
"public",
"function",
"number",
"(",
"$",
"flags",
"=",
"0",
")",
"{",
"$",
"ret",
"=",
"false",
";",
"if",
"(",
"$",
"number",
"=",
"$",
"this",
"->",
"match",
"(",
"TextTokenizer",
"::",
"NUMBER",
",",
"$",
"matches",
",",
"$",
"flags",
")",
")... | Is the next token a number?
This function returns false if the next token is not a number or an array
with a single string.
@param integer $flags Flags (default is 0)
@return false|array of a single string | [
"Is",
"the",
"next",
"token",
"a",
"number?"
] | 792b463ad8790fa19a7120d1354ee852fc70c017 | https://github.com/soloproyectos-php/text-tokenizer/blob/792b463ad8790fa19a7120d1354ee852fc70c017/src/text/tokenizer/TextTokenizer.php#L201-L210 |
14,338 | soloproyectos-php/text-tokenizer | src/text/tokenizer/TextTokenizer.php | TextTokenizer.str | public function str($flags = 0)
{
$ret = false;
if ($this->match(TextTokenizer::STRING, $matches, $flags)) {
$delimiter = $matches[2];
$str = $matches[3];
$str = str_replace("\\$delimiter", "$delimiter", $str);
$ret = array($str);
}
r... | php | public function str($flags = 0)
{
$ret = false;
if ($this->match(TextTokenizer::STRING, $matches, $flags)) {
$delimiter = $matches[2];
$str = $matches[3];
$str = str_replace("\\$delimiter", "$delimiter", $str);
$ret = array($str);
}
r... | [
"public",
"function",
"str",
"(",
"$",
"flags",
"=",
"0",
")",
"{",
"$",
"ret",
"=",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"match",
"(",
"TextTokenizer",
"::",
"STRING",
",",
"$",
"matches",
",",
"$",
"flags",
")",
")",
"{",
"$",
"delimiter... | Is the next token a string?
This function returns false if the next token is not a string or an array
with a single string.
@param integer $flags Flags (default is 0)
@return false|array of a single string | [
"Is",
"the",
"next",
"token",
"a",
"string?"
] | 792b463ad8790fa19a7120d1354ee852fc70c017 | https://github.com/soloproyectos-php/text-tokenizer/blob/792b463ad8790fa19a7120d1354ee852fc70c017/src/text/tokenizer/TextTokenizer.php#L222-L234 |
14,339 | soloproyectos-php/text-tokenizer | src/text/tokenizer/TextTokenizer.php | TextTokenizer.id | public function id()
{
$ret = false;
if (list($id) = $this->match(TextTokenizer::IDENTIFIER)) {
$ret = array($id);
}
return $ret;
} | php | public function id()
{
$ret = false;
if (list($id) = $this->match(TextTokenizer::IDENTIFIER)) {
$ret = array($id);
}
return $ret;
} | [
"public",
"function",
"id",
"(",
")",
"{",
"$",
"ret",
"=",
"false",
";",
"if",
"(",
"list",
"(",
"$",
"id",
")",
"=",
"$",
"this",
"->",
"match",
"(",
"TextTokenizer",
"::",
"IDENTIFIER",
")",
")",
"{",
"$",
"ret",
"=",
"array",
"(",
"$",
"id"... | Is the next token an identifier?
This function returns false if the next token is not an identifier or an
array with a single string.
@return false|array of a single string | [
"Is",
"the",
"next",
"token",
"an",
"identifier?"
] | 792b463ad8790fa19a7120d1354ee852fc70c017 | https://github.com/soloproyectos-php/text-tokenizer/blob/792b463ad8790fa19a7120d1354ee852fc70c017/src/text/tokenizer/TextTokenizer.php#L272-L281 |
14,340 | soloproyectos-php/text-tokenizer | src/text/tokenizer/TextTokenizer.php | TextTokenizer.match | public function match($regexp, &$matches = array(), $flags = 0)
{
// we do not like empty strings
if (strlen($regexp) == 0) {
return false;
}
$ret = false;
$explicitRegexp = strlen($regexp) > 0 && $regexp[0] == "/";
$substr = substr($this->string, $this->... | php | public function match($regexp, &$matches = array(), $flags = 0)
{
// we do not like empty strings
if (strlen($regexp) == 0) {
return false;
}
$ret = false;
$explicitRegexp = strlen($regexp) > 0 && $regexp[0] == "/";
$substr = substr($this->string, $this->... | [
"public",
"function",
"match",
"(",
"$",
"regexp",
",",
"&",
"$",
"matches",
"=",
"array",
"(",
")",
",",
"$",
"flags",
"=",
"0",
")",
"{",
"// we do not like empty strings",
"if",
"(",
"strlen",
"(",
"$",
"regexp",
")",
"==",
"0",
")",
"{",
"return"... | Matches the string against a regex.
This function matches the string against a regular expressión. If they
match, it advances the offset position and returns an array with a single
string. Otherwise, it returns false. You can use regex without delimiters.
Instead of using /^\s*(\w+)/, you can use simply '\w+'.
Exampl... | [
"Matches",
"the",
"string",
"against",
"a",
"regex",
"."
] | 792b463ad8790fa19a7120d1354ee852fc70c017 | https://github.com/soloproyectos-php/text-tokenizer/blob/792b463ad8790fa19a7120d1354ee852fc70c017/src/text/tokenizer/TextTokenizer.php#L344-L394 |
14,341 | chippyash/Strong-Type | src/Chippyash/Type/Number/Complex/GMPComplexType.php | GMPComplexType.isZero | public function isZero()
{
return (
gmp_sign($this->value['real']->numerator()->gmp()) == 0
&& gmp_sign($this->value['imaginary']->numerator()->gmp()) == 0
);
} | php | public function isZero()
{
return (
gmp_sign($this->value['real']->numerator()->gmp()) == 0
&& gmp_sign($this->value['imaginary']->numerator()->gmp()) == 0
);
} | [
"public",
"function",
"isZero",
"(",
")",
"{",
"return",
"(",
"gmp_sign",
"(",
"$",
"this",
"->",
"value",
"[",
"'real'",
"]",
"->",
"numerator",
"(",
")",
"->",
"gmp",
"(",
")",
")",
"==",
"0",
"&&",
"gmp_sign",
"(",
"$",
"this",
"->",
"value",
... | Is this number equal to zero?
@return boolean | [
"Is",
"this",
"number",
"equal",
"to",
"zero?"
] | 9d364c10c68c10f768254fb25b0b1db3dbef6fa9 | https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/Number/Complex/GMPComplexType.php#L67-L73 |
14,342 | ganlvtech/php-simple-cas | src/PhpCas.php | PhpCas.forceAuthentication | public function forceAuthentication()
{
if (self::isAuthenticated()) {
return true;
} elseif ($this->getTicket()) {
return $this->validateCas();
}
session_write_close();
$this->redirectToCas();
// never reached
return true;
} | php | public function forceAuthentication()
{
if (self::isAuthenticated()) {
return true;
} elseif ($this->getTicket()) {
return $this->validateCas();
}
session_write_close();
$this->redirectToCas();
// never reached
return true;
} | [
"public",
"function",
"forceAuthentication",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"isAuthenticated",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"getTicket",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"v... | If not authenticated, redirect to CAS.
If authenticated, return true.
@return bool always true. | [
"If",
"not",
"authenticated",
"redirect",
"to",
"CAS",
".",
"If",
"authenticated",
"return",
"true",
"."
] | 21ce1e0988f14136536ff705a1b39e3603ea4a5c | https://github.com/ganlvtech/php-simple-cas/blob/21ce1e0988f14136536ff705a1b39e3603ea4a5c/src/PhpCas.php#L79-L90 |
14,343 | ganlvtech/php-simple-cas | src/PhpCas.php | PhpCas.checkAuthentication | public function checkAuthentication()
{
if (self::isAuthenticated()) {
return true;
} elseif (self::isGatewayed()) {
return $this->validateCas();
}
self::setGatewayed(true);
session_write_close();
$this->redirectToCas(true);
// never re... | php | public function checkAuthentication()
{
if (self::isAuthenticated()) {
return true;
} elseif (self::isGatewayed()) {
return $this->validateCas();
}
self::setGatewayed(true);
session_write_close();
$this->redirectToCas(true);
// never re... | [
"public",
"function",
"checkAuthentication",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"isAuthenticated",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"elseif",
"(",
"self",
"::",
"isGatewayed",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"valida... | If not gatewayed, redirect to CAS with gateway=true.
@return bool true - authenticated. false - guess mode. | [
"If",
"not",
"gatewayed",
"redirect",
"to",
"CAS",
"with",
"gateway",
"=",
"true",
"."
] | 21ce1e0988f14136536ff705a1b39e3603ea4a5c | https://github.com/ganlvtech/php-simple-cas/blob/21ce1e0988f14136536ff705a1b39e3603ea4a5c/src/PhpCas.php#L97-L109 |
14,344 | ganlvtech/php-simple-cas | src/PhpCas.php | PhpCas.redirectToCas | protected function redirectToCas($gateway = false)
{
$query['service'] = self::getDefaultService();
if ($gateway) {
$query['gateway'] = 'true';
}
self::http_redirect($this->server['login_url'] . '?' . http_build_query($query));
// never reached
return true... | php | protected function redirectToCas($gateway = false)
{
$query['service'] = self::getDefaultService();
if ($gateway) {
$query['gateway'] = 'true';
}
self::http_redirect($this->server['login_url'] . '?' . http_build_query($query));
// never reached
return true... | [
"protected",
"function",
"redirectToCas",
"(",
"$",
"gateway",
"=",
"false",
")",
"{",
"$",
"query",
"[",
"'service'",
"]",
"=",
"self",
"::",
"getDefaultService",
"(",
")",
";",
"if",
"(",
"$",
"gateway",
")",
"{",
"$",
"query",
"[",
"'gateway'",
"]",... | Redirect to CAS server for login
@param bool $gateway
@return bool always true, but never reach. | [
"Redirect",
"to",
"CAS",
"server",
"for",
"login"
] | 21ce1e0988f14136536ff705a1b39e3603ea4a5c | https://github.com/ganlvtech/php-simple-cas/blob/21ce1e0988f14136536ff705a1b39e3603ea4a5c/src/PhpCas.php#L166-L175 |
14,345 | ganlvtech/php-simple-cas | src/PhpCas.php | PhpCas.getDefaultService | protected static function getDefaultService()
{
$service = (isset($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
$parts = parse_url($service);
if (isset($parts['query'])) {
parse_str($parts['query'], $query);
} else {
... | php | protected static function getDefaultService()
{
$service = (isset($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
$parts = parse_url($service);
if (isset($parts['query'])) {
parse_str($parts['query'], $query);
} else {
... | [
"protected",
"static",
"function",
"getDefaultService",
"(",
")",
"{",
"$",
"service",
"=",
"(",
"isset",
"(",
"$",
"_SERVER",
"[",
"'HTTPS'",
"]",
")",
"?",
"'https'",
":",
"'http'",
")",
".",
"'://'",
".",
"$",
"_SERVER",
"[",
"'SERVER_NAME'",
"]",
"... | Get the service name of this request
@return string default service name | [
"Get",
"the",
"service",
"name",
"of",
"this",
"request"
] | 21ce1e0988f14136536ff705a1b39e3603ea4a5c | https://github.com/ganlvtech/php-simple-cas/blob/21ce1e0988f14136536ff705a1b39e3603ea4a5c/src/PhpCas.php#L287-L301 |
14,346 | keboola/juicer | Pagination/Decorator/ForceStopScrollerDecorator.php | ForceStopScrollerDecorator.checkPages | private function checkPages()
{
if (is_null($this->pageLimit)) {
return false;
}
if (++$this->pageCounter > $this->pageLimit) {
return true;
}
return false;
} | php | private function checkPages()
{
if (is_null($this->pageLimit)) {
return false;
}
if (++$this->pageCounter > $this->pageLimit) {
return true;
}
return false;
} | [
"private",
"function",
"checkPages",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"pageLimit",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"++",
"$",
"this",
"->",
"pageCounter",
">",
"$",
"this",
"->",
"pageLimit",
")",
... | Uses internal counter to check page limit
@return bool | [
"Uses",
"internal",
"counter",
"to",
"check",
"page",
"limit"
] | 780e7900ccd23082ed234cc2c51b279a4223e9f5 | https://github.com/keboola/juicer/blob/780e7900ccd23082ed234cc2c51b279a4223e9f5/Pagination/Decorator/ForceStopScrollerDecorator.php#L118-L128 |
14,347 | keboola/juicer | Pagination/Decorator/ForceStopScrollerDecorator.php | ForceStopScrollerDecorator.checkTime | private function checkTime()
{
if (is_null($this->timeLimit)) {
return false;
}
if (($this->startTime + $this->timeLimit) <= time()) {
return true;
}
return false;
} | php | private function checkTime()
{
if (is_null($this->timeLimit)) {
return false;
}
if (($this->startTime + $this->timeLimit) <= time()) {
return true;
}
return false;
} | [
"private",
"function",
"checkTime",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"timeLimit",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"(",
"$",
"this",
"->",
"startTime",
"+",
"$",
"this",
"->",
"timeLimit",
")",
"<="... | Checks time between first and current request
@return bool | [
"Checks",
"time",
"between",
"first",
"and",
"current",
"request"
] | 780e7900ccd23082ed234cc2c51b279a4223e9f5 | https://github.com/keboola/juicer/blob/780e7900ccd23082ed234cc2c51b279a4223e9f5/Pagination/Decorator/ForceStopScrollerDecorator.php#L134-L144 |
14,348 | nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/ConfigSchema.php | HTMLPurifier_ConfigSchema.add | public function add($key, $default, $type, $allow_null) {
$obj = new stdclass();
$obj->type = is_int($type) ? $type : HTMLPurifier_VarParser::$types[$type];
if ($allow_null) $obj->allow_null = true;
$this->info[$key] = $obj;
$this->defaults[$key] = $default;
$this->defaul... | php | public function add($key, $default, $type, $allow_null) {
$obj = new stdclass();
$obj->type = is_int($type) ? $type : HTMLPurifier_VarParser::$types[$type];
if ($allow_null) $obj->allow_null = true;
$this->info[$key] = $obj;
$this->defaults[$key] = $default;
$this->defaul... | [
"public",
"function",
"add",
"(",
"$",
"key",
",",
"$",
"default",
",",
"$",
"type",
",",
"$",
"allow_null",
")",
"{",
"$",
"obj",
"=",
"new",
"stdclass",
"(",
")",
";",
"$",
"obj",
"->",
"type",
"=",
"is_int",
"(",
"$",
"type",
")",
"?",
"$",
... | Defines a directive for configuration
@warning Will fail of directive's namespace is defined.
@warning This method's signature is slightly different from the legacy
define() static method! Beware!
@param $namespace Namespace the directive is in
@param $name Key of directive
@param $default Default value of directive
@p... | [
"Defines",
"a",
"directive",
"for",
"configuration"
] | ecffed0d75be1454901e1cb24633472b8f67c967 | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/ConfigSchema.php#L90-L97 |
14,349 | venta/framework | src/Console/src/ConsoleApplication.php | ConsoleApplication.run | public function run(InputInterface $input, OutputInterface $output): int
{
return $this->console->run($input, $output);
} | php | public function run(InputInterface $input, OutputInterface $output): int
{
return $this->console->run($input, $output);
} | [
"public",
"function",
"run",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
":",
"int",
"{",
"return",
"$",
"this",
"->",
"console",
"->",
"run",
"(",
"$",
"input",
",",
"$",
"output",
")",
";",
"}"
] | Runs Console Application.
@param InputInterface $input
@param OutputInterface $output
@return int | [
"Runs",
"Console",
"Application",
"."
] | 514a7854cc69f84f47e62a58cc55efd68b7c9f83 | https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Console/src/ConsoleApplication.php#L47-L50 |
14,350 | venta/framework | src/Console/src/ConsoleApplication.php | ConsoleApplication.initConsole | private function initConsole(string $name, string $version)
{
$this->console = $this->container->get(SymfonyConsoleApplication::class);
$this->console->setName($name);
$this->console->setVersion($version);
$this->console->setCatchExceptions(false);
$this->console->setAutoExit... | php | private function initConsole(string $name, string $version)
{
$this->console = $this->container->get(SymfonyConsoleApplication::class);
$this->console->setName($name);
$this->console->setVersion($version);
$this->console->setCatchExceptions(false);
$this->console->setAutoExit... | [
"private",
"function",
"initConsole",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"version",
")",
"{",
"$",
"this",
"->",
"console",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"SymfonyConsoleApplication",
"::",
"class",
")",
";",
"$",
"th... | Initiates Symfony Console Application.
@param string $name
@param string $version | [
"Initiates",
"Symfony",
"Console",
"Application",
"."
] | 514a7854cc69f84f47e62a58cc55efd68b7c9f83 | https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Console/src/ConsoleApplication.php#L58-L71 |
14,351 | mimmi20/Wurfl | src/Device/CustomDeviceRepository.php | CustomDeviceRepository.getAllDevices | public function getAllDevices()
{
$devices = array();
$devicesId = $this->getAllDevicesID();
foreach ($devicesId as $deviceId) {
/** @var $device \Wurfl\Device\ModelDeviceInterface */
$device = $this->getDevice($deviceId);
$devices[] = $device;
... | php | public function getAllDevices()
{
$devices = array();
$devicesId = $this->getAllDevicesID();
foreach ($devicesId as $deviceId) {
/** @var $device \Wurfl\Device\ModelDeviceInterface */
$device = $this->getDevice($deviceId);
$devices[] = $device;
... | [
"public",
"function",
"getAllDevices",
"(",
")",
"{",
"$",
"devices",
"=",
"array",
"(",
")",
";",
"$",
"devicesId",
"=",
"$",
"this",
"->",
"getAllDevicesID",
"(",
")",
";",
"foreach",
"(",
"$",
"devicesId",
"as",
"$",
"deviceId",
")",
"{",
"/** @var ... | Returns all devices in the repository
@throws \Wurfl\Exception
@return \Wurfl\Device\ModelDeviceInterface[] | [
"Returns",
"all",
"devices",
"in",
"the",
"repository"
] | 443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Device/CustomDeviceRepository.php#L163-L175 |
14,352 | FWidm/dwd-hourly-crawler | src/fwidm/dwdHourlyCrawler/hourly/DWDStationsController.php | DWDStationsController.getNearestStation | public static function getNearestStation($stations, $coordinatesRequest)
{
$calculator = new Vincenty();
$nearestStation = null;
$nextDist = INF;
foreach ($stations as $activeStation) {
if (is_object($activeStation) && $activeStation instanceof DWDStation) {
... | php | public static function getNearestStation($stations, $coordinatesRequest)
{
$calculator = new Vincenty();
$nearestStation = null;
$nextDist = INF;
foreach ($stations as $activeStation) {
if (is_object($activeStation) && $activeStation instanceof DWDStation) {
... | [
"public",
"static",
"function",
"getNearestStation",
"(",
"$",
"stations",
",",
"$",
"coordinatesRequest",
")",
"{",
"$",
"calculator",
"=",
"new",
"Vincenty",
"(",
")",
";",
"$",
"nearestStation",
"=",
"null",
";",
"$",
"nextDist",
"=",
"INF",
";",
"forea... | Return the nearest stations from a stations array.
@param $stations - array of DWDStation
@param $coordinatesRequest
@return DWDStation|null
@throws DWDLibException - if stations is empty | [
"Return",
"the",
"nearest",
"stations",
"from",
"a",
"stations",
"array",
"."
] | 36dec7d84a85af599e9d4fb6a3bcc302378ce4a8 | https://github.com/FWidm/dwd-hourly-crawler/blob/36dec7d84a85af599e9d4fb6a3bcc302378ce4a8/src/fwidm/dwdHourlyCrawler/hourly/DWDStationsController.php#L30-L49 |
14,353 | FWidm/dwd-hourly-crawler | src/fwidm/dwdHourlyCrawler/hourly/DWDStationsController.php | DWDStationsController.getNearestStations | public static function getNearestStations($stations, Coordinate $coordinatesRequest, int $radiusKM = 200)
{
//todo: make radius loadable from the config.
DWDUtil::log(self::class, "Getting nearest stations from a list of " . count($stations) . ", around coordinates: " . $coordinatesRequest->format(n... | php | public static function getNearestStations($stations, Coordinate $coordinatesRequest, int $radiusKM = 200)
{
//todo: make radius loadable from the config.
DWDUtil::log(self::class, "Getting nearest stations from a list of " . count($stations) . ", around coordinates: " . $coordinatesRequest->format(n... | [
"public",
"static",
"function",
"getNearestStations",
"(",
"$",
"stations",
",",
"Coordinate",
"$",
"coordinatesRequest",
",",
"int",
"$",
"radiusKM",
"=",
"200",
")",
"{",
"//todo: make radius loadable from the config.",
"DWDUtil",
"::",
"log",
"(",
"self",
"::",
... | Get all stations in an x km radius.
@param $stations - array of DWDStation
@param int $radiusKM - default 20km
@return array - of nearest stations in the given radius | [
"Get",
"all",
"stations",
"in",
"an",
"x",
"km",
"radius",
"."
] | 36dec7d84a85af599e9d4fb6a3bcc302378ce4a8 | https://github.com/FWidm/dwd-hourly-crawler/blob/36dec7d84a85af599e9d4fb6a3bcc302378ce4a8/src/fwidm/dwdHourlyCrawler/hourly/DWDStationsController.php#L57-L84 |
14,354 | FWidm/dwd-hourly-crawler | src/fwidm/dwdHourlyCrawler/hourly/DWDStationsController.php | DWDStationsController.getStationFile | public static function getStationFile($stationFtpPath, $outputPath)
{
$ftpConfig = DWDConfiguration::getFTPConfiguration();
$ftp_connection = ftp_connect($ftpConfig->url);
$login_result = ftp_login($ftp_connection, $ftpConfig->userName, $ftpConfig->userPassword);
if ($login_result ... | php | public static function getStationFile($stationFtpPath, $outputPath)
{
$ftpConfig = DWDConfiguration::getFTPConfiguration();
$ftp_connection = ftp_connect($ftpConfig->url);
$login_result = ftp_login($ftp_connection, $ftpConfig->userName, $ftpConfig->userPassword);
if ($login_result ... | [
"public",
"static",
"function",
"getStationFile",
"(",
"$",
"stationFtpPath",
",",
"$",
"outputPath",
")",
"{",
"$",
"ftpConfig",
"=",
"DWDConfiguration",
"::",
"getFTPConfiguration",
"(",
")",
";",
"$",
"ftp_connection",
"=",
"ftp_connect",
"(",
"$",
"ftpConfig... | Tries to download the station file from the given path.
@param $stationFtpPath - path/to/the/station_file.txt
@param $outputPath - location of the resulting file
@throws DWDLibException - if result is empty | [
"Tries",
"to",
"download",
"the",
"station",
"file",
"from",
"the",
"given",
"path",
"."
] | 36dec7d84a85af599e9d4fb6a3bcc302378ce4a8 | https://github.com/FWidm/dwd-hourly-crawler/blob/36dec7d84a85af599e9d4fb6a3bcc302378ce4a8/src/fwidm/dwdHourlyCrawler/hourly/DWDStationsController.php#L91-L109 |
14,355 | FWidm/dwd-hourly-crawler | src/fwidm/dwdHourlyCrawler/hourly/DWDStationsController.php | DWDStationsController.parseStations | public static function parseStations($filePath)
{
if (DIRECTORY_SEPARATOR == '\\')
$filePath = str_replace('/', '\\', $filePath);
ini_set('display_errors', 1);
error_reporting(E_ALL);
$stationConf = DWDConfiguration::getStationConfiguration();
$stations = array();... | php | public static function parseStations($filePath)
{
if (DIRECTORY_SEPARATOR == '\\')
$filePath = str_replace('/', '\\', $filePath);
ini_set('display_errors', 1);
error_reporting(E_ALL);
$stationConf = DWDConfiguration::getStationConfiguration();
$stations = array();... | [
"public",
"static",
"function",
"parseStations",
"(",
"$",
"filePath",
")",
"{",
"if",
"(",
"DIRECTORY_SEPARATOR",
"==",
"'\\\\'",
")",
"$",
"filePath",
"=",
"str_replace",
"(",
"'/'",
",",
"'\\\\'",
",",
"$",
"filePath",
")",
";",
"ini_set",
"(",
"'displa... | Parse the station files into station objects.
@param $filePath - path to the station file
@return array - of stations
@throws DWDLibException - if zip opening fails or zip does not exist | [
"Parse",
"the",
"station",
"files",
"into",
"station",
"objects",
"."
] | 36dec7d84a85af599e9d4fb6a3bcc302378ce4a8 | https://github.com/FWidm/dwd-hourly-crawler/blob/36dec7d84a85af599e9d4fb6a3bcc302378ce4a8/src/fwidm/dwdHourlyCrawler/hourly/DWDStationsController.php#L117-L170 |
14,356 | abhi1693/yii2-enum | helpers/BaseEnum.php | BaseEnum.createByName | public static function createByName($name)
{
$constants = self::getConstantsByName();
if (!array_key_exists($name, $constants)) {
throw EnumException::invalidName(get_called_class(), $name);
}
return new static($constants[$name]);
} | php | public static function createByName($name)
{
$constants = self::getConstantsByName();
if (!array_key_exists($name, $constants)) {
throw EnumException::invalidName(get_called_class(), $name);
}
return new static($constants[$name]);
} | [
"public",
"static",
"function",
"createByName",
"(",
"$",
"name",
")",
"{",
"$",
"constants",
"=",
"self",
"::",
"getConstantsByName",
"(",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"constants",
")",
")",
"{",
"throw",
"... | Creates a new type instance using the name of a value
@param string $name The name of a value
@return $this The new type instance
@throws EnumException If the name is invalid | [
"Creates",
"a",
"new",
"type",
"instance",
"using",
"the",
"name",
"of",
"a",
"value"
] | 1def6522303fa8f0277f09d1123229c32c942cd9 | https://github.com/abhi1693/yii2-enum/blob/1def6522303fa8f0277f09d1123229c32c942cd9/helpers/BaseEnum.php#L69-L78 |
14,357 | abhi1693/yii2-enum | helpers/BaseEnum.php | BaseEnum.createByValue | public static function createByValue($value)
{
$constants = self::getConstantsByValue();
if (!array_key_exists($value, $constants)) {
throw EnumException::invalidValue(get_called_class(), $value);
}
return new static ($value);
} | php | public static function createByValue($value)
{
$constants = self::getConstantsByValue();
if (!array_key_exists($value, $constants)) {
throw EnumException::invalidValue(get_called_class(), $value);
}
return new static ($value);
} | [
"public",
"static",
"function",
"createByValue",
"(",
"$",
"value",
")",
"{",
"$",
"constants",
"=",
"self",
"::",
"getConstantsByValue",
"(",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"value",
",",
"$",
"constants",
")",
")",
"{",
"throw",... | Creates a new type instance using the value
@param mixed $value The value
@throws EnumException If the value is invalid
@return $this The new instance | [
"Creates",
"a",
"new",
"type",
"instance",
"using",
"the",
"value"
] | 1def6522303fa8f0277f09d1123229c32c942cd9 | https://github.com/abhi1693/yii2-enum/blob/1def6522303fa8f0277f09d1123229c32c942cd9/helpers/BaseEnum.php#L88-L97 |
14,358 | FWidm/dwd-hourly-crawler | src/fwidm/dwdHourlyCrawler/hourly/services/AbstractHourlyService.php | AbstractHourlyService.parseHourlyDataOld | public function parseHourlyDataOld(String $content, DWDStation $nearestStation, Coordinate $coordinate, Carbon $startDate = null, Carbon $endDate = null): array
{
$time = microtime(true);
$lines = explode('eor', $content);
$data = array();
/**
* steps to refactor:
... | php | public function parseHourlyDataOld(String $content, DWDStation $nearestStation, Coordinate $coordinate, Carbon $startDate = null, Carbon $endDate = null): array
{
$time = microtime(true);
$lines = explode('eor', $content);
$data = array();
/**
* steps to refactor:
... | [
"public",
"function",
"parseHourlyDataOld",
"(",
"String",
"$",
"content",
",",
"DWDStation",
"$",
"nearestStation",
",",
"Coordinate",
"$",
"coordinate",
",",
"Carbon",
"$",
"startDate",
"=",
"null",
",",
"Carbon",
"$",
"endDate",
"=",
"null",
")",
":",
"ar... | Parse the textual representation of DWD Data, can be filtered by specifying before and after.
This means if you specify after - you will get timestamps after the specified team
If you also specify before you can pinpoint values.
@deprecated
@param String $content - Textual representation of a DWD Hourly/Recent pressure... | [
"Parse",
"the",
"textual",
"representation",
"of",
"DWD",
"Data",
"can",
"be",
"filtered",
"by",
"specifying",
"before",
"and",
"after",
".",
"This",
"means",
"if",
"you",
"specify",
"after",
"-",
"you",
"will",
"get",
"timestamps",
"after",
"the",
"specifie... | 36dec7d84a85af599e9d4fb6a3bcc302378ce4a8 | https://github.com/FWidm/dwd-hourly-crawler/blob/36dec7d84a85af599e9d4fb6a3bcc302378ce4a8/src/fwidm/dwdHourlyCrawler/hourly/services/AbstractHourlyService.php#L54-L147 |
14,359 | FWidm/dwd-hourly-crawler | src/fwidm/dwdHourlyCrawler/hourly/services/AbstractHourlyService.php | AbstractHourlyService.getStationFTPPath | public function getStationFTPPath(string $ftpPath)
{
$fileName = DWDUtil::getFileNameFromPath($ftpPath);
$filePath = DWDConfiguration::getConfiguration()->baseDirectory . DWDConfiguration::getConfiguration()->dwdHourly->localBaseFolder . '/' . $fileName;
return $filePath;
} | php | public function getStationFTPPath(string $ftpPath)
{
$fileName = DWDUtil::getFileNameFromPath($ftpPath);
$filePath = DWDConfiguration::getConfiguration()->baseDirectory . DWDConfiguration::getConfiguration()->dwdHourly->localBaseFolder . '/' . $fileName;
return $filePath;
} | [
"public",
"function",
"getStationFTPPath",
"(",
"string",
"$",
"ftpPath",
")",
"{",
"$",
"fileName",
"=",
"DWDUtil",
"::",
"getFileNameFromPath",
"(",
"$",
"ftpPath",
")",
";",
"$",
"filePath",
"=",
"DWDConfiguration",
"::",
"getConfiguration",
"(",
")",
"->",... | Return the path to the file that contains the stations.
@param string $ftpPath
@return string | [
"Return",
"the",
"path",
"to",
"the",
"file",
"that",
"contains",
"the",
"stations",
"."
] | 36dec7d84a85af599e9d4fb6a3bcc302378ce4a8 | https://github.com/FWidm/dwd-hourly-crawler/blob/36dec7d84a85af599e9d4fb6a3bcc302378ce4a8/src/fwidm/dwdHourlyCrawler/hourly/services/AbstractHourlyService.php#L238-L243 |
14,360 | PandaPlatform/framework | src/Panda/Foundation/Http/Kernel.php | Kernel.boot | public function boot($request = null)
{
// Initialize application
$this->getApp()->boot($request, $this->bootstrapRegistry->getItems());
// Set base controller router
Controller::setRouter($this->getRouter());
// Include routes
include_once $this->routesConfiguratio... | php | public function boot($request = null)
{
// Initialize application
$this->getApp()->boot($request, $this->bootstrapRegistry->getItems());
// Set base controller router
Controller::setRouter($this->getRouter());
// Include routes
include_once $this->routesConfiguratio... | [
"public",
"function",
"boot",
"(",
"$",
"request",
"=",
"null",
")",
"{",
"// Initialize application",
"$",
"this",
"->",
"getApp",
"(",
")",
"->",
"boot",
"(",
"$",
"request",
",",
"$",
"this",
"->",
"bootstrapRegistry",
"->",
"getItems",
"(",
")",
")",... | Init the panda application and start all the interfaces that
are needed for runtime.
@param Request|SymfonyRequest $request
@throws InvalidArgumentException
@throws \DI\DependencyException
@throws \DI\NotFoundException | [
"Init",
"the",
"panda",
"application",
"and",
"start",
"all",
"the",
"interfaces",
"that",
"are",
"needed",
"for",
"runtime",
"."
] | a78cf051b379896b5a4d5df620988e37a0e632f5 | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Foundation/Http/Kernel.php#L97-L107 |
14,361 | PandaPlatform/framework | src/Panda/Foundation/Http/Kernel.php | Kernel.handle | public function handle(SymfonyRequest $request)
{
// Boot kernel
$this->boot($request);
// Dispatch the response
return $this->getRouter()->dispatch($request);
} | php | public function handle(SymfonyRequest $request)
{
// Boot kernel
$this->boot($request);
// Dispatch the response
return $this->getRouter()->dispatch($request);
} | [
"public",
"function",
"handle",
"(",
"SymfonyRequest",
"$",
"request",
")",
"{",
"// Boot kernel",
"$",
"this",
"->",
"boot",
"(",
"$",
"request",
")",
";",
"// Dispatch the response",
"return",
"$",
"this",
"->",
"getRouter",
"(",
")",
"->",
"dispatch",
"("... | Handle the incoming request and return a response.
@param Request|SymfonyRequest $request
@return Response
@throws InvalidArgumentException
@throws \DI\DependencyException
@throws \DI\NotFoundException
@throws \LogicException
@throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
@throws \UnexpectedVal... | [
"Handle",
"the",
"incoming",
"request",
"and",
"return",
"a",
"response",
"."
] | a78cf051b379896b5a4d5df620988e37a0e632f5 | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Foundation/Http/Kernel.php#L122-L129 |
14,362 | Webiny/AnalyticsDb | src/Webiny/AnalyticsDb/Query/Dimensions.php | Dimensions.setDimension | public function setDimension($dimensionName, $dimensionValue = null)
{
$this->pipeline['$match']['name'] = $dimensionName;
if (!empty($dimensionValue)) {
$this->pipeline['$match']['value'] = $dimensionValue;
}
return $this;
} | php | public function setDimension($dimensionName, $dimensionValue = null)
{
$this->pipeline['$match']['name'] = $dimensionName;
if (!empty($dimensionValue)) {
$this->pipeline['$match']['value'] = $dimensionValue;
}
return $this;
} | [
"public",
"function",
"setDimension",
"(",
"$",
"dimensionName",
",",
"$",
"dimensionValue",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"pipeline",
"[",
"'$match'",
"]",
"[",
"'name'",
"]",
"=",
"$",
"dimensionName",
";",
"if",
"(",
"!",
"empty",
"(",
"... | Filter the dimension records.
@param string $dimensionName Dimension name.
@param string|null $dimensionValue Dimension value.
@return $this | [
"Filter",
"the",
"dimension",
"records",
"."
] | e0b1e920643cd63071406520767243736004052e | https://github.com/Webiny/AnalyticsDb/blob/e0b1e920643cd63071406520767243736004052e/src/Webiny/AnalyticsDb/Query/Dimensions.php#L29-L38 |
14,363 | Webiny/AnalyticsDb | src/Webiny/AnalyticsDb/Query/Dimensions.php | Dimensions.sortByDimensionName | public function sortByDimensionName($direction)
{
if ($this->id != '$name' && $this->id != '$value') {
throw new AnalyticsDbException('In order to sort by dimension name, you need to first group by dimension name or dimension value.');
}
$direction = (int)$direction;
if... | php | public function sortByDimensionName($direction)
{
if ($this->id != '$name' && $this->id != '$value') {
throw new AnalyticsDbException('In order to sort by dimension name, you need to first group by dimension name or dimension value.');
}
$direction = (int)$direction;
if... | [
"public",
"function",
"sortByDimensionName",
"(",
"$",
"direction",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"id",
"!=",
"'$name'",
"&&",
"$",
"this",
"->",
"id",
"!=",
"'$value'",
")",
"{",
"throw",
"new",
"AnalyticsDbException",
"(",
"'In order to sort by d... | Sort records by dimension name.
@param string $direction Mongo sort direction: 1 => ascending; -1 => descending
@return $this
@throws AnalyticsDbException | [
"Sort",
"records",
"by",
"dimension",
"name",
"."
] | e0b1e920643cd63071406520767243736004052e | https://github.com/Webiny/AnalyticsDb/blob/e0b1e920643cd63071406520767243736004052e/src/Webiny/AnalyticsDb/Query/Dimensions.php#L48-L64 |
14,364 | Webiny/AnalyticsDb | src/Webiny/AnalyticsDb/Query/Dimensions.php | Dimensions.sortByDimensionValue | public function sortByDimensionValue($direction)
{
if ($this->id != '$value') {
throw new AnalyticsDbException('In order to sort by dimension value, you need to first group by dimension value.');
}
$direction = (int)$direction;
$this->pipeline['$sort'] = ['_id.value' =>... | php | public function sortByDimensionValue($direction)
{
if ($this->id != '$value') {
throw new AnalyticsDbException('In order to sort by dimension value, you need to first group by dimension value.');
}
$direction = (int)$direction;
$this->pipeline['$sort'] = ['_id.value' =>... | [
"public",
"function",
"sortByDimensionValue",
"(",
"$",
"direction",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"id",
"!=",
"'$value'",
")",
"{",
"throw",
"new",
"AnalyticsDbException",
"(",
"'In order to sort by dimension value, you need to first group by dimension value.'"... | Sort records by dimension value.
@param string $direction Mongo sort direction: 1 => ascending; -1 => descending
@return $this
@throws AnalyticsDbException | [
"Sort",
"records",
"by",
"dimension",
"value",
"."
] | e0b1e920643cd63071406520767243736004052e | https://github.com/Webiny/AnalyticsDb/blob/e0b1e920643cd63071406520767243736004052e/src/Webiny/AnalyticsDb/Query/Dimensions.php#L74-L86 |
14,365 | nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/LanguageFactory.php | HTMLPurifier_LanguageFactory.loadLanguage | public function loadLanguage($code) {
static $languages_seen = array(); // recursion guard
// abort if we've already loaded it
if (isset($this->cache[$code])) return;
// generate filename
$filename = $this->dir . '/Language/messages/' . $code . '.php';
// default fallb... | php | public function loadLanguage($code) {
static $languages_seen = array(); // recursion guard
// abort if we've already loaded it
if (isset($this->cache[$code])) return;
// generate filename
$filename = $this->dir . '/Language/messages/' . $code . '.php';
// default fallb... | [
"public",
"function",
"loadLanguage",
"(",
"$",
"code",
")",
"{",
"static",
"$",
"languages_seen",
"=",
"array",
"(",
")",
";",
"// recursion guard",
"// abort if we've already loaded it",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"cache",
"[",
"$",
"code",
... | Loads language into the cache, handles message file and fallbacks
@param $code string language code | [
"Loads",
"language",
"into",
"the",
"cache",
"handles",
"message",
"file",
"and",
"fallbacks"
] | ecffed0d75be1454901e1cb24633472b8f67c967 | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/LanguageFactory.php#L138-L194 |
14,366 | epierce/cas-rest-client | src/CasRestClient.php | CasRestClient.setCasServer | public function setCasServer($server)
{
$this->casServer = $server;
$this->guzzleClient = new Client(['base_uri' => $server, 'cookies' => true]);
} | php | public function setCasServer($server)
{
$this->casServer = $server;
$this->guzzleClient = new Client(['base_uri' => $server, 'cookies' => true]);
} | [
"public",
"function",
"setCasServer",
"(",
"$",
"server",
")",
"{",
"$",
"this",
"->",
"casServer",
"=",
"$",
"server",
";",
"$",
"this",
"->",
"guzzleClient",
"=",
"new",
"Client",
"(",
"[",
"'base_uri'",
"=>",
"$",
"server",
",",
"'cookies'",
"=>",
"... | Set the CAS server URL
@param string $server | [
"Set",
"the",
"CAS",
"server",
"URL"
] | 342ce958ec5ce40d182a4ffad59c9fa123564ecd | https://github.com/epierce/cas-rest-client/blob/342ce958ec5ce40d182a4ffad59c9fa123564ecd/src/CasRestClient.php#L57-L61 |
14,367 | epierce/cas-rest-client | src/CasRestClient.php | CasRestClient.setTGT | public function setTGT($tgt)
{
$this->tgt = $tgt;
$this->tgtLocation = $this->casServer . $this->casRESTcontext . '/' . $tgt;
} | php | public function setTGT($tgt)
{
$this->tgt = $tgt;
$this->tgtLocation = $this->casServer . $this->casRESTcontext . '/' . $tgt;
} | [
"public",
"function",
"setTGT",
"(",
"$",
"tgt",
")",
"{",
"$",
"this",
"->",
"tgt",
"=",
"$",
"tgt",
";",
"$",
"this",
"->",
"tgtLocation",
"=",
"$",
"this",
"->",
"casServer",
".",
"$",
"this",
"->",
"casRESTcontext",
".",
"'/'",
".",
"$",
"tgt",... | Accepts the Ticket-Granting Ticket from the app running the client.
@param string $tgt | [
"Accepts",
"the",
"Ticket",
"-",
"Granting",
"Ticket",
"from",
"the",
"app",
"running",
"the",
"client",
"."
] | 342ce958ec5ce40d182a4ffad59c9fa123564ecd | https://github.com/epierce/cas-rest-client/blob/342ce958ec5ce40d182a4ffad59c9fa123564ecd/src/CasRestClient.php#L130-L134 |
14,368 | epierce/cas-rest-client | src/CasRestClient.php | CasRestClient.logout | public function logout()
{
// Make sure a TGT exists
$this->checkTgtExists();
$this->guzzleClient->delete($this->tgtLocation);
$this->tgtLocation = null;
$this->tgt = null;
// Remove the TGT storage file
if ($this->tgtStorageLocation) {
unlink($t... | php | public function logout()
{
// Make sure a TGT exists
$this->checkTgtExists();
$this->guzzleClient->delete($this->tgtLocation);
$this->tgtLocation = null;
$this->tgt = null;
// Remove the TGT storage file
if ($this->tgtStorageLocation) {
unlink($t... | [
"public",
"function",
"logout",
"(",
")",
"{",
"// Make sure a TGT exists",
"$",
"this",
"->",
"checkTgtExists",
"(",
")",
";",
"$",
"this",
"->",
"guzzleClient",
"->",
"delete",
"(",
"$",
"this",
"->",
"tgtLocation",
")",
";",
"$",
"this",
"->",
"tgtLocat... | Logout of the CAS session and destroy the TGT.
@return bool
@throws \Exception | [
"Logout",
"of",
"the",
"CAS",
"session",
"and",
"destroy",
"the",
"TGT",
"."
] | 342ce958ec5ce40d182a4ffad59c9fa123564ecd | https://github.com/epierce/cas-rest-client/blob/342ce958ec5ce40d182a4ffad59c9fa123564ecd/src/CasRestClient.php#L142-L157 |
14,369 | epierce/cas-rest-client | src/CasRestClient.php | CasRestClient.post | public function post($service, $headers = [], $body = '', $form_params = [])
{
return $this->callRestService('POST', $service, $headers, $body, $form_params);
} | php | public function post($service, $headers = [], $body = '', $form_params = [])
{
return $this->callRestService('POST', $service, $headers, $body, $form_params);
} | [
"public",
"function",
"post",
"(",
"$",
"service",
",",
"$",
"headers",
"=",
"[",
"]",
",",
"$",
"body",
"=",
"''",
",",
"$",
"form_params",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"callRestService",
"(",
"'POST'",
",",
"$",
"service"... | Request a Service Ticket for the CAS server and perform a HTTP POST operation.
@param $service
@param array $headers
@param array $body
@return mixed
@throws \Exception | [
"Request",
"a",
"Service",
"Ticket",
"for",
"the",
"CAS",
"server",
"and",
"perform",
"a",
"HTTP",
"POST",
"operation",
"."
] | 342ce958ec5ce40d182a4ffad59c9fa123564ecd | https://github.com/epierce/cas-rest-client/blob/342ce958ec5ce40d182a4ffad59c9fa123564ecd/src/CasRestClient.php#L182-L185 |
14,370 | epierce/cas-rest-client | src/CasRestClient.php | CasRestClient.patch | public function patch($service, $headers = [], $body = '', $form_params = [])
{
return $this->callRestService('PATCH', $service, $headers, $body, $form_params);
} | php | public function patch($service, $headers = [], $body = '', $form_params = [])
{
return $this->callRestService('PATCH', $service, $headers, $body, $form_params);
} | [
"public",
"function",
"patch",
"(",
"$",
"service",
",",
"$",
"headers",
"=",
"[",
"]",
",",
"$",
"body",
"=",
"''",
",",
"$",
"form_params",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"callRestService",
"(",
"'PATCH'",
",",
"$",
"servic... | Request a Service Ticket for the CAS server and perform a HTTP PATCH operation.
@param $service
@param array $headers
@param array $body
@return mixed
@throws \Exception | [
"Request",
"a",
"Service",
"Ticket",
"for",
"the",
"CAS",
"server",
"and",
"perform",
"a",
"HTTP",
"PATCH",
"operation",
"."
] | 342ce958ec5ce40d182a4ffad59c9fa123564ecd | https://github.com/epierce/cas-rest-client/blob/342ce958ec5ce40d182a4ffad59c9fa123564ecd/src/CasRestClient.php#L196-L199 |
14,371 | epierce/cas-rest-client | src/CasRestClient.php | CasRestClient.head | public function head($service, $headers = [], $body = '', $form_params = [])
{
return $this->callRestService('HEAD', $service, $headers, $body, $form_params);
} | php | public function head($service, $headers = [], $body = '', $form_params = [])
{
return $this->callRestService('HEAD', $service, $headers, $body, $form_params);
} | [
"public",
"function",
"head",
"(",
"$",
"service",
",",
"$",
"headers",
"=",
"[",
"]",
",",
"$",
"body",
"=",
"''",
",",
"$",
"form_params",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"callRestService",
"(",
"'HEAD'",
",",
"$",
"service"... | Request a Service Ticket for the CAS server and perform a HTTP HEAD operation.
@param $service
@param array $headers
@param array $body
@return mixed
@throws \Exception | [
"Request",
"a",
"Service",
"Ticket",
"for",
"the",
"CAS",
"server",
"and",
"perform",
"a",
"HTTP",
"HEAD",
"operation",
"."
] | 342ce958ec5ce40d182a4ffad59c9fa123564ecd | https://github.com/epierce/cas-rest-client/blob/342ce958ec5ce40d182a4ffad59c9fa123564ecd/src/CasRestClient.php#L210-L213 |
14,372 | epierce/cas-rest-client | src/CasRestClient.php | CasRestClient.put | public function put($service, $headers = [], $body = '', $form_params = [])
{
return $this->callRestService('PUT', $service, $headers, $body, $form_params);
} | php | public function put($service, $headers = [], $body = '', $form_params = [])
{
return $this->callRestService('PUT', $service, $headers, $body, $form_params);
} | [
"public",
"function",
"put",
"(",
"$",
"service",
",",
"$",
"headers",
"=",
"[",
"]",
",",
"$",
"body",
"=",
"''",
",",
"$",
"form_params",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"callRestService",
"(",
"'PUT'",
",",
"$",
"service",
... | Request a Service Ticket for the CAS server and perform a HTTP PUT operation.
@param $service
@param array $headers
@param array $body
@return mixed
@throws \Exception | [
"Request",
"a",
"Service",
"Ticket",
"for",
"the",
"CAS",
"server",
"and",
"perform",
"a",
"HTTP",
"PUT",
"operation",
"."
] | 342ce958ec5ce40d182a4ffad59c9fa123564ecd | https://github.com/epierce/cas-rest-client/blob/342ce958ec5ce40d182a4ffad59c9fa123564ecd/src/CasRestClient.php#L224-L227 |
14,373 | epierce/cas-rest-client | src/CasRestClient.php | CasRestClient.options | public function options($service, $headers = [], $body = '', $form_params = [])
{
return $this->callRestService('OPTIONS', $service, $headers, $body, $form_params);
} | php | public function options($service, $headers = [], $body = '', $form_params = [])
{
return $this->callRestService('OPTIONS', $service, $headers, $body, $form_params);
} | [
"public",
"function",
"options",
"(",
"$",
"service",
",",
"$",
"headers",
"=",
"[",
"]",
",",
"$",
"body",
"=",
"''",
",",
"$",
"form_params",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"callRestService",
"(",
"'OPTIONS'",
",",
"$",
"se... | Request a Service Ticket for the CAS server and perform a HTTP OPTIONS operation.
@param $service
@param array $headers
@param array $body
@return mixed
@throws \Exception | [
"Request",
"a",
"Service",
"Ticket",
"for",
"the",
"CAS",
"server",
"and",
"perform",
"a",
"HTTP",
"OPTIONS",
"operation",
"."
] | 342ce958ec5ce40d182a4ffad59c9fa123564ecd | https://github.com/epierce/cas-rest-client/blob/342ce958ec5ce40d182a4ffad59c9fa123564ecd/src/CasRestClient.php#L238-L241 |
14,374 | epierce/cas-rest-client | src/CasRestClient.php | CasRestClient.delete | public function delete($service, $headers = [], $body = '', $form_params = [])
{
return $this->callRestService('DELETE', $service, $headers, $body, $form_params);
} | php | public function delete($service, $headers = [], $body = '', $form_params = [])
{
return $this->callRestService('DELETE', $service, $headers, $body, $form_params);
} | [
"public",
"function",
"delete",
"(",
"$",
"service",
",",
"$",
"headers",
"=",
"[",
"]",
",",
"$",
"body",
"=",
"''",
",",
"$",
"form_params",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"callRestService",
"(",
"'DELETE'",
",",
"$",
"serv... | Request a Service Ticket for the CAS server and perform a HTTP DELETE operation.
@param $service
@param array $headers
@param array $body
@return mixed
@throws \Exception | [
"Request",
"a",
"Service",
"Ticket",
"for",
"the",
"CAS",
"server",
"and",
"perform",
"a",
"HTTP",
"DELETE",
"operation",
"."
] | 342ce958ec5ce40d182a4ffad59c9fa123564ecd | https://github.com/epierce/cas-rest-client/blob/342ce958ec5ce40d182a4ffad59c9fa123564ecd/src/CasRestClient.php#L252-L255 |
14,375 | epierce/cas-rest-client | src/CasRestClient.php | CasRestClient.callRestService | private function callRestService($method, $service, $headers = [], $body = '', $form_params = [])
{
// Make sure a TGT exists
$this->checkTgtExists();
$serviceTicket = $this->getServiceTicket($service);
// Append the ticket to the end of the service's parameters
if (strpos(... | php | private function callRestService($method, $service, $headers = [], $body = '', $form_params = [])
{
// Make sure a TGT exists
$this->checkTgtExists();
$serviceTicket = $this->getServiceTicket($service);
// Append the ticket to the end of the service's parameters
if (strpos(... | [
"private",
"function",
"callRestService",
"(",
"$",
"method",
",",
"$",
"service",
",",
"$",
"headers",
"=",
"[",
"]",
",",
"$",
"body",
"=",
"''",
",",
"$",
"form_params",
"=",
"[",
"]",
")",
"{",
"// Make sure a TGT exists",
"$",
"this",
"->",
"check... | Set up and execute a REST request.
@param $method
@param $service
@param array $headers
@param array $body
@return mixed|null
@throws \Exception | [
"Set",
"up",
"and",
"execute",
"a",
"REST",
"request",
"."
] | 342ce958ec5ce40d182a4ffad59c9fa123564ecd | https://github.com/epierce/cas-rest-client/blob/342ce958ec5ce40d182a4ffad59c9fa123564ecd/src/CasRestClient.php#L279-L333 |
14,376 | epierce/cas-rest-client | src/CasRestClient.php | CasRestClient.getServiceTicket | private function getServiceTicket($service)
{
try {
$response = $this->guzzleClient->request(
'POST',
$this->tgtLocation,
[
'verify' => $this->verifySSL,
'form_params' => [
'service'... | php | private function getServiceTicket($service)
{
try {
$response = $this->guzzleClient->request(
'POST',
$this->tgtLocation,
[
'verify' => $this->verifySSL,
'form_params' => [
'service'... | [
"private",
"function",
"getServiceTicket",
"(",
"$",
"service",
")",
"{",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"guzzleClient",
"->",
"request",
"(",
"'POST'",
",",
"$",
"this",
"->",
"tgtLocation",
",",
"[",
"'verify'",
"=>",
"$",
"this",... | Request Service ticket from CAS server
@param $service
@return bool|\GuzzleHttp\Stream\StreamInterface|null
@throws \Exception | [
"Request",
"Service",
"ticket",
"from",
"CAS",
"server"
] | 342ce958ec5ce40d182a4ffad59c9fa123564ecd | https://github.com/epierce/cas-rest-client/blob/342ce958ec5ce40d182a4ffad59c9fa123564ecd/src/CasRestClient.php#L342-L373 |
14,377 | epierce/cas-rest-client | src/CasRestClient.php | CasRestClient.login | public function login($tgtStorageLocation = '', $forceAuth = false)
{
if ((!$this->casServer) || (!$this->casPassword) || (!$this->casUsername)) {
throw new \Exception('CAS server and credentials must be set before calling login()', 1);
}
$this->tgtStorageLocation = $tgtStorage... | php | public function login($tgtStorageLocation = '', $forceAuth = false)
{
if ((!$this->casServer) || (!$this->casPassword) || (!$this->casUsername)) {
throw new \Exception('CAS server and credentials must be set before calling login()', 1);
}
$this->tgtStorageLocation = $tgtStorage... | [
"public",
"function",
"login",
"(",
"$",
"tgtStorageLocation",
"=",
"''",
",",
"$",
"forceAuth",
"=",
"false",
")",
"{",
"if",
"(",
"(",
"!",
"$",
"this",
"->",
"casServer",
")",
"||",
"(",
"!",
"$",
"this",
"->",
"casPassword",
")",
"||",
"(",
"!"... | Validate credentials against the CAS server and retrieve a Ticket-Granting Ticket. If a tgtStorageLocation is
specified, the fle is read and the saved TGT is used instead of validating credentials. If force_auth is TRUE,
always validate credentials.
@param string $tgtStorageLocation
@param bool $forceAuth
@return bo... | [
"Validate",
"credentials",
"against",
"the",
"CAS",
"server",
"and",
"retrieve",
"a",
"Ticket",
"-",
"Granting",
"Ticket",
".",
"If",
"a",
"tgtStorageLocation",
"is",
"specified",
"the",
"fle",
"is",
"read",
"and",
"the",
"saved",
"TGT",
"is",
"used",
"inste... | 342ce958ec5ce40d182a4ffad59c9fa123564ecd | https://github.com/epierce/cas-rest-client/blob/342ce958ec5ce40d182a4ffad59c9fa123564ecd/src/CasRestClient.php#L385-L445 |
14,378 | epierce/cas-rest-client | src/CasRestClient.php | CasRestClient.loadTGTfromFile | private function loadTGTfromFile($tgtStorageLocation)
{
$tgtStorageData = json_decode(file_get_contents($tgtStorageLocation), true);
if ($tgtStorageData['username']) {
$this->casUsername = $tgtStorageData['username'];
} else {
throw new \Exception('TGT storage missin... | php | private function loadTGTfromFile($tgtStorageLocation)
{
$tgtStorageData = json_decode(file_get_contents($tgtStorageLocation), true);
if ($tgtStorageData['username']) {
$this->casUsername = $tgtStorageData['username'];
} else {
throw new \Exception('TGT storage missin... | [
"private",
"function",
"loadTGTfromFile",
"(",
"$",
"tgtStorageLocation",
")",
"{",
"$",
"tgtStorageData",
"=",
"json_decode",
"(",
"file_get_contents",
"(",
"$",
"tgtStorageLocation",
")",
",",
"true",
")",
";",
"if",
"(",
"$",
"tgtStorageData",
"[",
"'username... | Read the TGT data from a file
@param string $tgtStorageLocation
@throws \Exception | [
"Read",
"the",
"TGT",
"data",
"from",
"a",
"file"
] | 342ce958ec5ce40d182a4ffad59c9fa123564ecd | https://github.com/epierce/cas-rest-client/blob/342ce958ec5ce40d182a4ffad59c9fa123564ecd/src/CasRestClient.php#L453-L478 |
14,379 | epierce/cas-rest-client | src/CasRestClient.php | CasRestClient.writeTGTtoFile | private function writeTGTtoFile($tgtStorageLocation, $tgt)
{
$tgtStorageData = [
'TGT' => $tgt,
'username' => $this->casUsername,
'server' => $this->casServer,
'context' => $this->casRESTcontext,
'saved' => time()
];
file_put_conte... | php | private function writeTGTtoFile($tgtStorageLocation, $tgt)
{
$tgtStorageData = [
'TGT' => $tgt,
'username' => $this->casUsername,
'server' => $this->casServer,
'context' => $this->casRESTcontext,
'saved' => time()
];
file_put_conte... | [
"private",
"function",
"writeTGTtoFile",
"(",
"$",
"tgtStorageLocation",
",",
"$",
"tgt",
")",
"{",
"$",
"tgtStorageData",
"=",
"[",
"'TGT'",
"=>",
"$",
"tgt",
",",
"'username'",
"=>",
"$",
"this",
"->",
"casUsername",
",",
"'server'",
"=>",
"$",
"this",
... | Save the TGT data to a local file
@param string $tgtStorageLocation
@param string $tgt | [
"Save",
"the",
"TGT",
"data",
"to",
"a",
"local",
"file"
] | 342ce958ec5ce40d182a4ffad59c9fa123564ecd | https://github.com/epierce/cas-rest-client/blob/342ce958ec5ce40d182a4ffad59c9fa123564ecd/src/CasRestClient.php#L486-L497 |
14,380 | lukebro/flash | src/lukebro/Flash/FlashFactory.php | FlashFactory.create | public function create($level, $message)
{
$this->next[] = ['level' => $level, 'message' => $message];
$this->session->flash($this->key, $this->next);
return $this;
} | php | public function create($level, $message)
{
$this->next[] = ['level' => $level, 'message' => $message];
$this->session->flash($this->key, $this->next);
return $this;
} | [
"public",
"function",
"create",
"(",
"$",
"level",
",",
"$",
"message",
")",
"{",
"$",
"this",
"->",
"next",
"[",
"]",
"=",
"[",
"'level'",
"=>",
"$",
"level",
",",
"'message'",
"=>",
"$",
"message",
"]",
";",
"$",
"this",
"->",
"session",
"->",
... | Create a new flash message.
@param string $message
@param string $level
@return this | [
"Create",
"a",
"new",
"flash",
"message",
"."
] | 5cecd16e6fe399cd8a222084f4f50fc813110ef9 | https://github.com/lukebro/flash/blob/5cecd16e6fe399cd8a222084f4f50fc813110ef9/src/lukebro/Flash/FlashFactory.php#L57-L64 |
14,381 | lukebro/flash | src/lukebro/Flash/FlashFactory.php | FlashFactory.again | public function again()
{
$this->next = $this->current->map(function ($item) {
return $item->toArray();
})->merge($this->next)->toArray();
$this->session->keep([$this->key]);
} | php | public function again()
{
$this->next = $this->current->map(function ($item) {
return $item->toArray();
})->merge($this->next)->toArray();
$this->session->keep([$this->key]);
} | [
"public",
"function",
"again",
"(",
")",
"{",
"$",
"this",
"->",
"next",
"=",
"$",
"this",
"->",
"current",
"->",
"map",
"(",
"function",
"(",
"$",
"item",
")",
"{",
"return",
"$",
"item",
"->",
"toArray",
"(",
")",
";",
"}",
")",
"->",
"merge",
... | Reflash message to next session.
@return void | [
"Reflash",
"message",
"to",
"next",
"session",
"."
] | 5cecd16e6fe399cd8a222084f4f50fc813110ef9 | https://github.com/lukebro/flash/blob/5cecd16e6fe399cd8a222084f4f50fc813110ef9/src/lukebro/Flash/FlashFactory.php#L92-L99 |
14,382 | lukebro/flash | src/lukebro/Flash/FlashFactory.php | FlashFactory.get | public function get($level = null)
{
if (isset($level)) {
return $this->getMessage();
}
return $this->current->where('level', $level);
} | php | public function get($level = null)
{
if (isset($level)) {
return $this->getMessage();
}
return $this->current->where('level', $level);
} | [
"public",
"function",
"get",
"(",
"$",
"level",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"level",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getMessage",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"current",
"->",
"where",
"("... | Get the current flash message.
@return string | [
"Get",
"the",
"current",
"flash",
"message",
"."
] | 5cecd16e6fe399cd8a222084f4f50fc813110ef9 | https://github.com/lukebro/flash/blob/5cecd16e6fe399cd8a222084f4f50fc813110ef9/src/lukebro/Flash/FlashFactory.php#L126-L133 |
14,383 | lukebro/flash | src/lukebro/Flash/FlashFactory.php | FlashFactory.getFromSession | private function getFromSession()
{
if ($this->exists()) {
$flashes = $this->session->get($this->key);
foreach ($flashes as $flash) {
$this->current->push(new Flash($flash['level'], $flash['message']));
}
}
} | php | private function getFromSession()
{
if ($this->exists()) {
$flashes = $this->session->get($this->key);
foreach ($flashes as $flash) {
$this->current->push(new Flash($flash['level'], $flash['message']));
}
}
} | [
"private",
"function",
"getFromSession",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"exists",
"(",
")",
")",
"{",
"$",
"flashes",
"=",
"$",
"this",
"->",
"session",
"->",
"get",
"(",
"$",
"this",
"->",
"key",
")",
";",
"foreach",
"(",
"$",
"fla... | Get current flash message from session.
@return void | [
"Get",
"current",
"flash",
"message",
"from",
"session",
"."
] | 5cecd16e6fe399cd8a222084f4f50fc813110ef9 | https://github.com/lukebro/flash/blob/5cecd16e6fe399cd8a222084f4f50fc813110ef9/src/lukebro/Flash/FlashFactory.php#L189-L198 |
14,384 | PandaPlatform/framework | src/Panda/Routing/Router.php | Router.gatherRoutes | protected function gatherRoutes()
{
// Get the base route path
$basePath = $this->container->get('app.base_path');
$routesPath = $this->container->get('app.routes_path');
// Include the route file
include $basePath . DIRECTORY_SEPARATOR . $routesPath;
} | php | protected function gatherRoutes()
{
// Get the base route path
$basePath = $this->container->get('app.base_path');
$routesPath = $this->container->get('app.routes_path');
// Include the route file
include $basePath . DIRECTORY_SEPARATOR . $routesPath;
} | [
"protected",
"function",
"gatherRoutes",
"(",
")",
"{",
"// Get the base route path",
"$",
"basePath",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"'app.base_path'",
")",
";",
"$",
"routesPath",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(... | Get all the routes that match to the given request.
@throws \DI\DependencyException
@throws \DI\NotFoundException
@throws \InvalidArgumentException | [
"Get",
"all",
"the",
"routes",
"that",
"match",
"to",
"the",
"given",
"request",
"."
] | a78cf051b379896b5a4d5df620988e37a0e632f5 | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Routing/Router.php#L402-L410 |
14,385 | markwatkinson/luminous | src/Luminous/Formatters/HtmlFormatter.php | HtmlFormatter.template | private static function template($t, $vars = array())
{
$t = preg_replace_callback('/\s+|<[^>]++>/', array('self', 'templateCb'), $t);
array_unshift($vars, $t);
$code = call_user_func_array('sprintf', $vars);
return $code;
} | php | private static function template($t, $vars = array())
{
$t = preg_replace_callback('/\s+|<[^>]++>/', array('self', 'templateCb'), $t);
array_unshift($vars, $t);
$code = call_user_func_array('sprintf', $vars);
return $code;
} | [
"private",
"static",
"function",
"template",
"(",
"$",
"t",
",",
"$",
"vars",
"=",
"array",
"(",
")",
")",
"{",
"$",
"t",
"=",
"preg_replace_callback",
"(",
"'/\\s+|<[^>]++>/'",
",",
"array",
"(",
"'self'",
",",
"'templateCb'",
")",
",",
"$",
"t",
")",... | strips out unnecessary whitespace from a template | [
"strips",
"out",
"unnecessary",
"whitespace",
"from",
"a",
"template"
] | 4adc18f414534abe986133d6d38e8e9787d32e69 | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Formatters/HtmlFormatter.php#L41-L47 |
14,386 | markwatkinson/luminous | src/Luminous/Formatters/HtmlFormatter.php | HtmlFormatter.linkifyCb | protected function linkifyCb($matches)
{
$uri = (isset($matches[1]) && strlen(trim($matches[1]))) ? $matches[0] : "http://" . $matches[0];
// we dont want to link if it would cause malformed HTML
$openTags = array();
$closeTags = array();
preg_match_all("/<(?!\/)([^\s>]*).*?... | php | protected function linkifyCb($matches)
{
$uri = (isset($matches[1]) && strlen(trim($matches[1]))) ? $matches[0] : "http://" . $matches[0];
// we dont want to link if it would cause malformed HTML
$openTags = array();
$closeTags = array();
preg_match_all("/<(?!\/)([^\s>]*).*?... | [
"protected",
"function",
"linkifyCb",
"(",
"$",
"matches",
")",
"{",
"$",
"uri",
"=",
"(",
"isset",
"(",
"$",
"matches",
"[",
"1",
"]",
")",
"&&",
"strlen",
"(",
"trim",
"(",
"$",
"matches",
"[",
"1",
"]",
")",
")",
")",
"?",
"$",
"matches",
"[... | Detects and links URLs - callback | [
"Detects",
"and",
"links",
"URLs",
"-",
"callback"
] | 4adc18f414534abe986133d6d38e8e9787d32e69 | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Formatters/HtmlFormatter.php#L114-L135 |
14,387 | markwatkinson/luminous | src/Luminous/Formatters/HtmlFormatter.php | HtmlFormatter.linkify | protected function linkify($src)
{
if (stripos($src, "http") === false && stripos($src, "www") === false) {
return $src;
}
$chars = "0-9a-zA-Z\$\-_\.+!\*,%";
$src_ = $src;
// everyone stand back, I know regular expressions
$src = preg_replace_callback(
... | php | protected function linkify($src)
{
if (stripos($src, "http") === false && stripos($src, "www") === false) {
return $src;
}
$chars = "0-9a-zA-Z\$\-_\.+!\*,%";
$src_ = $src;
// everyone stand back, I know regular expressions
$src = preg_replace_callback(
... | [
"protected",
"function",
"linkify",
"(",
"$",
"src",
")",
"{",
"if",
"(",
"stripos",
"(",
"$",
"src",
",",
"\"http\"",
")",
"===",
"false",
"&&",
"stripos",
"(",
"$",
"src",
",",
"\"www\"",
")",
"===",
"false",
")",
"{",
"return",
"$",
"src",
";",
... | Detects and links URLs | [
"Detects",
"and",
"links",
"URLs"
] | 4adc18f414534abe986133d6d38e8e9787d32e69 | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Formatters/HtmlFormatter.php#L140-L169 |
14,388 | guillaumemonet/Rad | src/Rad/Config/Config.php | Config.get | public static function get(string $section, $row = null) {
if ($row === null) {
return isset(self::$config[$section]) ? self::$config[$section] : null;
} else {
return isset(self::$config[$section][$row]) ? self::$config[$section][$row] : null;
}
} | php | public static function get(string $section, $row = null) {
if ($row === null) {
return isset(self::$config[$section]) ? self::$config[$section] : null;
} else {
return isset(self::$config[$section][$row]) ? self::$config[$section][$row] : null;
}
} | [
"public",
"static",
"function",
"get",
"(",
"string",
"$",
"section",
",",
"$",
"row",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"row",
"===",
"null",
")",
"{",
"return",
"isset",
"(",
"self",
"::",
"$",
"config",
"[",
"$",
"section",
"]",
")",
"?",... | Return current config
@param string $section
@param string $row
@return string | [
"Return",
"current",
"config"
] | cb9932f570cf3c2a7197f81e1d959c2729989e59 | https://github.com/guillaumemonet/Rad/blob/cb9932f570cf3c2a7197f81e1d959c2729989e59/src/Rad/Config/Config.php#L88-L94 |
14,389 | nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/UnitConverter.php | HTMLPurifier_UnitConverter.add | private function add($s1, $s2, $scale) {
if ($this->bcmath) return bcadd($s1, $s2, $scale);
else return $this->scale($s1 + $s2, $scale);
} | php | private function add($s1, $s2, $scale) {
if ($this->bcmath) return bcadd($s1, $s2, $scale);
else return $this->scale($s1 + $s2, $scale);
} | [
"private",
"function",
"add",
"(",
"$",
"s1",
",",
"$",
"s2",
",",
"$",
"scale",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"bcmath",
")",
"return",
"bcadd",
"(",
"$",
"s1",
",",
"$",
"s2",
",",
"$",
"scale",
")",
";",
"else",
"return",
"$",
"th... | Adds two numbers, using arbitrary precision when available. | [
"Adds",
"two",
"numbers",
"using",
"arbitrary",
"precision",
"when",
"available",
"."
] | ecffed0d75be1454901e1cb24633472b8f67c967 | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/UnitConverter.php#L188-L191 |
14,390 | nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/UnitConverter.php | HTMLPurifier_UnitConverter.mul | private function mul($s1, $s2, $scale) {
if ($this->bcmath) return bcmul($s1, $s2, $scale);
else return $this->scale($s1 * $s2, $scale);
} | php | private function mul($s1, $s2, $scale) {
if ($this->bcmath) return bcmul($s1, $s2, $scale);
else return $this->scale($s1 * $s2, $scale);
} | [
"private",
"function",
"mul",
"(",
"$",
"s1",
",",
"$",
"s2",
",",
"$",
"scale",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"bcmath",
")",
"return",
"bcmul",
"(",
"$",
"s1",
",",
"$",
"s2",
",",
"$",
"scale",
")",
";",
"else",
"return",
"$",
"th... | Multiples two numbers, using arbitrary precision when available. | [
"Multiples",
"two",
"numbers",
"using",
"arbitrary",
"precision",
"when",
"available",
"."
] | ecffed0d75be1454901e1cb24633472b8f67c967 | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/UnitConverter.php#L196-L199 |
14,391 | PendoNL/pro6pp-php-wrapper | src/Pro6pp.php | Pro6pp.autocomplete | public function autocomplete($postalcode, $number = '', $extension = '')
{
$postalcode = $this->determinePostalType($postalcode);
$this->data = array_merge($postalcode, ['streetnumber' => $number, 'extension' => $extension]);
return $this->call('autocomplete', $this->prepareData($this->dat... | php | public function autocomplete($postalcode, $number = '', $extension = '')
{
$postalcode = $this->determinePostalType($postalcode);
$this->data = array_merge($postalcode, ['streetnumber' => $number, 'extension' => $extension]);
return $this->call('autocomplete', $this->prepareData($this->dat... | [
"public",
"function",
"autocomplete",
"(",
"$",
"postalcode",
",",
"$",
"number",
"=",
"''",
",",
"$",
"extension",
"=",
"''",
")",
"{",
"$",
"postalcode",
"=",
"$",
"this",
"->",
"determinePostalType",
"(",
"$",
"postalcode",
")",
";",
"$",
"this",
"-... | Get a full address after providing a postalcode and number, the results also
include the coordinates from the address.
@param $postalcode
@param $number
@return mixed | [
"Get",
"a",
"full",
"address",
"after",
"providing",
"a",
"postalcode",
"and",
"number",
"the",
"results",
"also",
"include",
"the",
"coordinates",
"from",
"the",
"address",
"."
] | d3ad95ebb89a55b037a3a12689cd15431912f32f | https://github.com/PendoNL/pro6pp-php-wrapper/blob/d3ad95ebb89a55b037a3a12689cd15431912f32f/src/Pro6pp.php#L48-L55 |
14,392 | PendoNL/pro6pp-php-wrapper | src/Pro6pp.php | Pro6pp.reverse | public function reverse($lat, $lng)
{
$this->data = ['lat' => $lat, 'lng' => $lng];
return $this->call('reverse', $this->prepareData($this->data));
} | php | public function reverse($lat, $lng)
{
$this->data = ['lat' => $lat, 'lng' => $lng];
return $this->call('reverse', $this->prepareData($this->data));
} | [
"public",
"function",
"reverse",
"(",
"$",
"lat",
",",
"$",
"lng",
")",
"{",
"$",
"this",
"->",
"data",
"=",
"[",
"'lat'",
"=>",
"$",
"lat",
",",
"'lng'",
"=>",
"$",
"lng",
"]",
";",
"return",
"$",
"this",
"->",
"call",
"(",
"'reverse'",
",",
"... | Find an address by their coordinates, returns a full address if found.
@param $lat
@param $lng
@return mixed | [
"Find",
"an",
"address",
"by",
"their",
"coordinates",
"returns",
"a",
"full",
"address",
"if",
"found",
"."
] | d3ad95ebb89a55b037a3a12689cd15431912f32f | https://github.com/PendoNL/pro6pp-php-wrapper/blob/d3ad95ebb89a55b037a3a12689cd15431912f32f/src/Pro6pp.php#L65-L70 |
14,393 | PendoNL/pro6pp-php-wrapper | src/Pro6pp.php | Pro6pp.range | public function range($nl_fourpp, $range = 5000, $per_page = 10, $page = 1)
{
$this->data = ['nl_fourpp' => $nl_fourpp, 'range' => $range, 'per_page' => $per_page, 'page' => $page];
return $this->call('range', $this->prepareData($this->data));
} | php | public function range($nl_fourpp, $range = 5000, $per_page = 10, $page = 1)
{
$this->data = ['nl_fourpp' => $nl_fourpp, 'range' => $range, 'per_page' => $per_page, 'page' => $page];
return $this->call('range', $this->prepareData($this->data));
} | [
"public",
"function",
"range",
"(",
"$",
"nl_fourpp",
",",
"$",
"range",
"=",
"5000",
",",
"$",
"per_page",
"=",
"10",
",",
"$",
"page",
"=",
"1",
")",
"{",
"$",
"this",
"->",
"data",
"=",
"[",
"'nl_fourpp'",
"=>",
"$",
"nl_fourpp",
",",
"'range'",... | Returns a list of postalcodes within a given range.
@param $nl_fourpp
@param int $range
@param int $per_page
@param int $page
@return mixed | [
"Returns",
"a",
"list",
"of",
"postalcodes",
"within",
"a",
"given",
"range",
"."
] | d3ad95ebb89a55b037a3a12689cd15431912f32f | https://github.com/PendoNL/pro6pp-php-wrapper/blob/d3ad95ebb89a55b037a3a12689cd15431912f32f/src/Pro6pp.php#L100-L105 |
14,394 | PendoNL/pro6pp-php-wrapper | src/Pro6pp.php | Pro6pp.suggest | public function suggest($nl_city, $per_page = 10)
{
$this->data = ['nl_city' => $nl_city, 'per_page' => $per_page];
return $this->call('suggest', $this->prepareData($this->data));
} | php | public function suggest($nl_city, $per_page = 10)
{
$this->data = ['nl_city' => $nl_city, 'per_page' => $per_page];
return $this->call('suggest', $this->prepareData($this->data));
} | [
"public",
"function",
"suggest",
"(",
"$",
"nl_city",
",",
"$",
"per_page",
"=",
"10",
")",
"{",
"$",
"this",
"->",
"data",
"=",
"[",
"'nl_city'",
"=>",
"$",
"nl_city",
",",
"'per_page'",
"=>",
"$",
"per_page",
"]",
";",
"return",
"$",
"this",
"->",
... | Autocompletes a city name.
@param $nl_city
@param int $per_page
@return mixed | [
"Autocompletes",
"a",
"city",
"name",
"."
] | d3ad95ebb89a55b037a3a12689cd15431912f32f | https://github.com/PendoNL/pro6pp-php-wrapper/blob/d3ad95ebb89a55b037a3a12689cd15431912f32f/src/Pro6pp.php#L115-L120 |
14,395 | PendoNL/pro6pp-php-wrapper | src/Pro6pp.php | Pro6pp.distance | public function distance($from_nl_fourpp, $to_nl_fourpp, $algorithm = 'road')
{
$this->data = ['from_nl_fourpp' => $from_nl_fourpp, 'to_nl_fourpp' => $to_nl_fourpp, 'algorithm' => $algorithm];
return $this->call('distance', $this->prepareData($this->data));
} | php | public function distance($from_nl_fourpp, $to_nl_fourpp, $algorithm = 'road')
{
$this->data = ['from_nl_fourpp' => $from_nl_fourpp, 'to_nl_fourpp' => $to_nl_fourpp, 'algorithm' => $algorithm];
return $this->call('distance', $this->prepareData($this->data));
} | [
"public",
"function",
"distance",
"(",
"$",
"from_nl_fourpp",
",",
"$",
"to_nl_fourpp",
",",
"$",
"algorithm",
"=",
"'road'",
")",
"{",
"$",
"this",
"->",
"data",
"=",
"[",
"'from_nl_fourpp'",
"=>",
"$",
"from_nl_fourpp",
",",
"'to_nl_fourpp'",
"=>",
"$",
... | Calculates the distance between two nl_fourpp postalcodes. Optional you can choose between
road or straight distance.
@param $from_nl_fourpp
@param $to_nl_fourpp
@param $algorithm
@return mixed | [
"Calculates",
"the",
"distance",
"between",
"two",
"nl_fourpp",
"postalcodes",
".",
"Optional",
"you",
"can",
"choose",
"between",
"road",
"or",
"straight",
"distance",
"."
] | d3ad95ebb89a55b037a3a12689cd15431912f32f | https://github.com/PendoNL/pro6pp-php-wrapper/blob/d3ad95ebb89a55b037a3a12689cd15431912f32f/src/Pro6pp.php#L132-L137 |
14,396 | PendoNL/pro6pp-php-wrapper | src/Pro6pp.php | Pro6pp.coordinatesDistance | public function coordinatesDistance($lat1, $lng1, $lat2, $lng2, $miles = false)
{
$pi80 = M_PI / 180;
$lat1 *= $pi80;
$lng1 *= $pi80;
$lat2 *= $pi80;
$lng2 *= $pi80;
$r = 6372.797;
$dlat = $lat2 - $lat1;
$dlng = $lng2 - $lng1;
$a = sin($dlat ... | php | public function coordinatesDistance($lat1, $lng1, $lat2, $lng2, $miles = false)
{
$pi80 = M_PI / 180;
$lat1 *= $pi80;
$lng1 *= $pi80;
$lat2 *= $pi80;
$lng2 *= $pi80;
$r = 6372.797;
$dlat = $lat2 - $lat1;
$dlng = $lng2 - $lng1;
$a = sin($dlat ... | [
"public",
"function",
"coordinatesDistance",
"(",
"$",
"lat1",
",",
"$",
"lng1",
",",
"$",
"lat2",
",",
"$",
"lng2",
",",
"$",
"miles",
"=",
"false",
")",
"{",
"$",
"pi80",
"=",
"M_PI",
"/",
"180",
";",
"$",
"lat1",
"*=",
"$",
"pi80",
";",
"$",
... | Helper method to calculate the distance between two coordinates.
@param $lat1
@param $lng1
@param $lat2
@param $lng2
@param bool $miles
@return float | [
"Helper",
"method",
"to",
"calculate",
"the",
"distance",
"between",
"two",
"coordinates",
"."
] | d3ad95ebb89a55b037a3a12689cd15431912f32f | https://github.com/PendoNL/pro6pp-php-wrapper/blob/d3ad95ebb89a55b037a3a12689cd15431912f32f/src/Pro6pp.php#L150-L167 |
14,397 | PendoNL/pro6pp-php-wrapper | src/Pro6pp.php | Pro6pp.determinePostalType | public function determinePostalType($postalcode)
{
$postalcode = str_replace(' ', '', $postalcode);
if (strlen($postalcode) == 6) {
return ['nl_sixpp' => $postalcode];
}
if (strlen($postalcode) == 4) {
return ['nl_fourpp' => $postalcode];
}
... | php | public function determinePostalType($postalcode)
{
$postalcode = str_replace(' ', '', $postalcode);
if (strlen($postalcode) == 6) {
return ['nl_sixpp' => $postalcode];
}
if (strlen($postalcode) == 4) {
return ['nl_fourpp' => $postalcode];
}
... | [
"public",
"function",
"determinePostalType",
"(",
"$",
"postalcode",
")",
"{",
"$",
"postalcode",
"=",
"str_replace",
"(",
"' '",
",",
"''",
",",
"$",
"postalcode",
")",
";",
"if",
"(",
"strlen",
"(",
"$",
"postalcode",
")",
"==",
"6",
")",
"{",
"retur... | Checks if one of two valid postal types was sent along.
@param $postalcode
@throws \Exception
@return array | [
"Checks",
"if",
"one",
"of",
"two",
"valid",
"postal",
"types",
"was",
"sent",
"along",
"."
] | d3ad95ebb89a55b037a3a12689cd15431912f32f | https://github.com/PendoNL/pro6pp-php-wrapper/blob/d3ad95ebb89a55b037a3a12689cd15431912f32f/src/Pro6pp.php#L178-L191 |
14,398 | PendoNL/pro6pp-php-wrapper | src/Pro6pp.php | Pro6pp.prepareData | protected function prepareData($data)
{
$data['auth_key'] = $this->api_key;
$data['format'] = $this->api_format;
$data['pretty'] = $this->api_pretty;
return $data;
} | php | protected function prepareData($data)
{
$data['auth_key'] = $this->api_key;
$data['format'] = $this->api_format;
$data['pretty'] = $this->api_pretty;
return $data;
} | [
"protected",
"function",
"prepareData",
"(",
"$",
"data",
")",
"{",
"$",
"data",
"[",
"'auth_key'",
"]",
"=",
"$",
"this",
"->",
"api_key",
";",
"$",
"data",
"[",
"'format'",
"]",
"=",
"$",
"this",
"->",
"api_format",
";",
"$",
"data",
"[",
"'pretty'... | Make sure the data contains the api_key and desired format.
@param $data
@return mixed | [
"Make",
"sure",
"the",
"data",
"contains",
"the",
"api_key",
"and",
"desired",
"format",
"."
] | d3ad95ebb89a55b037a3a12689cd15431912f32f | https://github.com/PendoNL/pro6pp-php-wrapper/blob/d3ad95ebb89a55b037a3a12689cd15431912f32f/src/Pro6pp.php#L200-L207 |
14,399 | PendoNL/pro6pp-php-wrapper | src/Pro6pp.php | Pro6pp.call | protected function call($path, $data)
{
$url = $this->api_host.$path.'?'.http_build_query($data);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
$return = curl_exec($ch);
curl_close($ch);
retur... | php | protected function call($path, $data)
{
$url = $this->api_host.$path.'?'.http_build_query($data);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
$return = curl_exec($ch);
curl_close($ch);
retur... | [
"protected",
"function",
"call",
"(",
"$",
"path",
",",
"$",
"data",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"api_host",
".",
"$",
"path",
".",
"'?'",
".",
"http_build_query",
"(",
"$",
"data",
")",
";",
"$",
"ch",
"=",
"curl_init",
"(",
"$... | Method to do the actual call to Pro6PP's API and return the data
in the given format.
@param $path
@param $data
@return mixed | [
"Method",
"to",
"do",
"the",
"actual",
"call",
"to",
"Pro6PP",
"s",
"API",
"and",
"return",
"the",
"data",
"in",
"the",
"given",
"format",
"."
] | d3ad95ebb89a55b037a3a12689cd15431912f32f | https://github.com/PendoNL/pro6pp-php-wrapper/blob/d3ad95ebb89a55b037a3a12689cd15431912f32f/src/Pro6pp.php#L218-L232 |
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.