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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
17,800 | buttress/collecterator | src/GeneratorCollection.php | GeneratorCollection.last | public function last(callable $callback = null, $default = null)
{
$collection = $callback ? $this->filter($callback) : $this;
foreach ($collection->all() as $key => $value) {
// Nothing needed here
}
return isset($value) ? $value : $default;
} | php | public function last(callable $callback = null, $default = null)
{
$collection = $callback ? $this->filter($callback) : $this;
foreach ($collection->all() as $key => $value) {
// Nothing needed here
}
return isset($value) ? $value : $default;
} | [
"public",
"function",
"last",
"(",
"callable",
"$",
"callback",
"=",
"null",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"collection",
"=",
"$",
"callback",
"?",
"$",
"this",
"->",
"filter",
"(",
"$",
"callback",
")",
":",
"$",
"this",
";",
"f... | Return the last element
@param callable|null $callback if a callback is provided, we will filter the collection using that callback
@param mixed $defualt
@return mixed | [
"Return",
"the",
"last",
"element"
] | 21e761c9c0457d85b5ec62d11051de2a62c3ee34 | https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L556-L565 |
17,801 | buttress/collecterator | src/GeneratorCollection.php | GeneratorCollection.accessKey | private function accessKey($mixed, $key, $givenKey = null)
{
// Handle callable keys, just pass in the mixed and return the result.
if (is_callable($key)) {
return $key($mixed, $givenKey);
}
// If it's a string, an array, or accessible through []
if (is_string($m... | php | private function accessKey($mixed, $key, $givenKey = null)
{
// Handle callable keys, just pass in the mixed and return the result.
if (is_callable($key)) {
return $key($mixed, $givenKey);
}
// If it's a string, an array, or accessible through []
if (is_string($m... | [
"private",
"function",
"accessKey",
"(",
"$",
"mixed",
",",
"$",
"key",
",",
"$",
"givenKey",
"=",
"null",
")",
"{",
"// Handle callable keys, just pass in the mixed and return the result.",
"if",
"(",
"is_callable",
"(",
"$",
"key",
")",
")",
"{",
"return",
"$"... | Get a value from a mixed key
@param mixed $mixed
@param mixed $key
@param null|string $givenKey
@return mixed
@throws \InvalidArgumentException | [
"Get",
"a",
"value",
"from",
"a",
"mixed",
"key"
] | 21e761c9c0457d85b5ec62d11051de2a62c3ee34 | https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L596-L615 |
17,802 | buttress/collecterator | src/GeneratorCollection.php | GeneratorCollection.append | public function append($items, bool $preserveKeys = true): CollectionInterface
{
return $this->wrap(function (Iterator $data) use ($items, $preserveKeys) {
$lists = [$data, self::make($items)];
foreach ($lists as $list) {
foreach ($list as $key => $item) {
... | php | public function append($items, bool $preserveKeys = true): CollectionInterface
{
return $this->wrap(function (Iterator $data) use ($items, $preserveKeys) {
$lists = [$data, self::make($items)];
foreach ($lists as $list) {
foreach ($list as $key => $item) {
... | [
"public",
"function",
"append",
"(",
"$",
"items",
",",
"bool",
"$",
"preserveKeys",
"=",
"true",
")",
":",
"CollectionInterface",
"{",
"return",
"$",
"this",
"->",
"wrap",
"(",
"function",
"(",
"Iterator",
"$",
"data",
")",
"use",
"(",
"$",
"items",
"... | Append items onto this collection
@param mixed $items
@param bool $preserveKeys
@return \Buttress\Collection\CollectionInterface | [
"Append",
"items",
"onto",
"this",
"collection"
] | 21e761c9c0457d85b5ec62d11051de2a62c3ee34 | https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L704-L719 |
17,803 | buttress/collecterator | src/GeneratorCollection.php | GeneratorCollection.combine | public function combine($values): CollectionInterface
{
if ($values instanceof IteratorAggregate) {
$values = $values->getIterator();
} elseif (is_array($values)) {
$values = new ArrayIterator($values);
}
return $this->wrap(function (Iterator $keys) use ($val... | php | public function combine($values): CollectionInterface
{
if ($values instanceof IteratorAggregate) {
$values = $values->getIterator();
} elseif (is_array($values)) {
$values = new ArrayIterator($values);
}
return $this->wrap(function (Iterator $keys) use ($val... | [
"public",
"function",
"combine",
"(",
"$",
"values",
")",
":",
"CollectionInterface",
"{",
"if",
"(",
"$",
"values",
"instanceof",
"IteratorAggregate",
")",
"{",
"$",
"values",
"=",
"$",
"values",
"->",
"getIterator",
"(",
")",
";",
"}",
"elseif",
"(",
"... | Create a collection by using this collection for keys and another for its values.
@param mixed $values
@return CollectionInterface | [
"Create",
"a",
"collection",
"by",
"using",
"this",
"collection",
"for",
"keys",
"and",
"another",
"for",
"its",
"values",
"."
] | 21e761c9c0457d85b5ec62d11051de2a62c3ee34 | https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L727-L741 |
17,804 | buttress/collecterator | src/GeneratorCollection.php | GeneratorCollection.put | public function put($key, $value): CollectionInterface
{
return $this->wrap(function (Iterator $data) use ($key, $value) {
$replaced = false;
foreach ($data as $dataKey => $datum) {
if ($key === $dataKey) {
yield $key => $value;
... | php | public function put($key, $value): CollectionInterface
{
return $this->wrap(function (Iterator $data) use ($key, $value) {
$replaced = false;
foreach ($data as $dataKey => $datum) {
if ($key === $dataKey) {
yield $key => $value;
... | [
"public",
"function",
"put",
"(",
"$",
"key",
",",
"$",
"value",
")",
":",
"CollectionInterface",
"{",
"return",
"$",
"this",
"->",
"wrap",
"(",
"function",
"(",
"Iterator",
"$",
"data",
")",
"use",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$"... | Put an item in the collection by key.
@param mixed $key
@param mixed $value
@return CollectionInterface | [
"Put",
"an",
"item",
"in",
"the",
"collection",
"by",
"key",
"."
] | 21e761c9c0457d85b5ec62d11051de2a62c3ee34 | https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L925-L943 |
17,805 | buttress/collecterator | src/GeneratorCollection.php | GeneratorCollection.reduce | public function reduce(callable $callback, $initial = null)
{
foreach ($this->generator as $key => $value) {
$initial = $callback($initial, $value, $key);
}
return $initial;
} | php | public function reduce(callable $callback, $initial = null)
{
foreach ($this->generator as $key => $value) {
$initial = $callback($initial, $value, $key);
}
return $initial;
} | [
"public",
"function",
"reduce",
"(",
"callable",
"$",
"callback",
",",
"$",
"initial",
"=",
"null",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"generator",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"initial",
"=",
"$",
"callback",
"(",
... | Reduce the collection to a single value.
@param callable $callback
@param mixed $initial
@return mixed | [
"Reduce",
"the",
"collection",
"to",
"a",
"single",
"value",
"."
] | 21e761c9c0457d85b5ec62d11051de2a62c3ee34 | https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L952-L959 |
17,806 | buttress/collecterator | src/GeneratorCollection.php | GeneratorCollection.slice | public function slice($offset, $length = null): CollectionInterface
{
if ($length < 0) {
throw new InvalidArgumentException('Negative slice lengths are not supported');
}
$result = $this;
if ($offset < 0) {
$result = $this->take($offset);
} elseif ($o... | php | public function slice($offset, $length = null): CollectionInterface
{
if ($length < 0) {
throw new InvalidArgumentException('Negative slice lengths are not supported');
}
$result = $this;
if ($offset < 0) {
$result = $this->take($offset);
} elseif ($o... | [
"public",
"function",
"slice",
"(",
"$",
"offset",
",",
"$",
"length",
"=",
"null",
")",
":",
"CollectionInterface",
"{",
"if",
"(",
"$",
"length",
"<",
"0",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Negative slice lengths are not supported'",... | Slice the underlying collection array.
@param int $offset
@param int $length
@return CollectionInterface
@throws \InvalidArgumentException | [
"Slice",
"the",
"underlying",
"collection",
"array",
"."
] | 21e761c9c0457d85b5ec62d11051de2a62c3ee34 | https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L991-L1009 |
17,807 | buttress/collecterator | src/GeneratorCollection.php | GeneratorCollection.offset | private function offset($offset): CollectionInterface
{
return $this->wrap(function (Iterator $iterator) use ($offset) {
while ($offset-- > 0 && $iterator->valid()) {
$iterator->next();
}
while ($iterator->valid()) {
yield $iterator->key()... | php | private function offset($offset): CollectionInterface
{
return $this->wrap(function (Iterator $iterator) use ($offset) {
while ($offset-- > 0 && $iterator->valid()) {
$iterator->next();
}
while ($iterator->valid()) {
yield $iterator->key()... | [
"private",
"function",
"offset",
"(",
"$",
"offset",
")",
":",
"CollectionInterface",
"{",
"return",
"$",
"this",
"->",
"wrap",
"(",
"function",
"(",
"Iterator",
"$",
"iterator",
")",
"use",
"(",
"$",
"offset",
")",
"{",
"while",
"(",
"$",
"offset",
"-... | Get items past an offset
@param $offset
@return CollectionInterface | [
"Get",
"items",
"past",
"an",
"offset"
] | 21e761c9c0457d85b5ec62d11051de2a62c3ee34 | https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L1016-L1028 |
17,808 | buttress/collecterator | src/GeneratorCollection.php | GeneratorCollection.takeFirst | public function takeFirst(int $count)
{
return $this->wrap(function (Iterator $data) use ($count) {
$first = true;
while ($count-- && $data->valid()) {
if (!$first) {
$data->next();
}
yield $data->key() => $data->c... | php | public function takeFirst(int $count)
{
return $this->wrap(function (Iterator $data) use ($count) {
$first = true;
while ($count-- && $data->valid()) {
if (!$first) {
$data->next();
}
yield $data->key() => $data->c... | [
"public",
"function",
"takeFirst",
"(",
"int",
"$",
"count",
")",
"{",
"return",
"$",
"this",
"->",
"wrap",
"(",
"function",
"(",
"Iterator",
"$",
"data",
")",
"use",
"(",
"$",
"count",
")",
"{",
"$",
"first",
"=",
"true",
";",
"while",
"(",
"$",
... | Take items from the beginning of the collection
@param int $count
@return \Buttress\Collection\CollectionInterface | [
"Take",
"items",
"from",
"the",
"beginning",
"of",
"the",
"collection"
] | 21e761c9c0457d85b5ec62d11051de2a62c3ee34 | https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L1143-L1157 |
17,809 | buttress/collecterator | src/GeneratorCollection.php | GeneratorCollection.takeLast | public function takeLast(int $count)
{
return $this->wrap(function (Iterator $data) use ($count) {
// From the end of the collection
$limit = max(0, $count);
$chunk = [];
foreach ($data as $key => $datum) {
$chunk[] = [$key, $datum];
... | php | public function takeLast(int $count)
{
return $this->wrap(function (Iterator $data) use ($count) {
// From the end of the collection
$limit = max(0, $count);
$chunk = [];
foreach ($data as $key => $datum) {
$chunk[] = [$key, $datum];
... | [
"public",
"function",
"takeLast",
"(",
"int",
"$",
"count",
")",
"{",
"return",
"$",
"this",
"->",
"wrap",
"(",
"function",
"(",
"Iterator",
"$",
"data",
")",
"use",
"(",
"$",
"count",
")",
"{",
"// From the end of the collection",
"$",
"limit",
"=",
"ma... | Take items from the end of the collection
@param int $count
@return \Buttress\Collection\CollectionInterface | [
"Take",
"items",
"from",
"the",
"end",
"of",
"the",
"collection"
] | 21e761c9c0457d85b5ec62d11051de2a62c3ee34 | https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L1165-L1184 |
17,810 | buttress/collecterator | src/GeneratorCollection.php | GeneratorCollection.values | public function values(): CollectionInterface
{
return $this->wrap(function (Iterator $data) {
foreach ($data as $item) {
yield $item;
}
});
} | php | public function values(): CollectionInterface
{
return $this->wrap(function (Iterator $data) {
foreach ($data as $item) {
yield $item;
}
});
} | [
"public",
"function",
"values",
"(",
")",
":",
"CollectionInterface",
"{",
"return",
"$",
"this",
"->",
"wrap",
"(",
"function",
"(",
"Iterator",
"$",
"data",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"item",
")",
"{",
"yield",
"$",
"item",
"... | Reset the keys on the underlying array.
@return CollectionInterface | [
"Reset",
"the",
"keys",
"on",
"the",
"underlying",
"array",
"."
] | 21e761c9c0457d85b5ec62d11051de2a62c3ee34 | https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L1240-L1247 |
17,811 | iocaste/microservice-foundation | src/Http/Responds.php | Responds.respond | public function respond(array $data = [], array $headers = []): JsonResponse
{
$meta = [
'meta' => [
'server_time' => time(),
'server_timezone' => date_default_timezone_get(),
'api_version' => 'v1',
],
];
return respons... | php | public function respond(array $data = [], array $headers = []): JsonResponse
{
$meta = [
'meta' => [
'server_time' => time(),
'server_timezone' => date_default_timezone_get(),
'api_version' => 'v1',
],
];
return respons... | [
"public",
"function",
"respond",
"(",
"array",
"$",
"data",
"=",
"[",
"]",
",",
"array",
"$",
"headers",
"=",
"[",
"]",
")",
":",
"JsonResponse",
"{",
"$",
"meta",
"=",
"[",
"'meta'",
"=>",
"[",
"'server_time'",
"=>",
"time",
"(",
")",
",",
"'serve... | Return JSON encoded response.
@param array $data
@param array $headers
@return \Illuminate\Http\JsonResponse | [
"Return",
"JSON",
"encoded",
"response",
"."
] | 274a154de4299e8a57314bab972e09f6d8cdae9e | https://github.com/iocaste/microservice-foundation/blob/274a154de4299e8a57314bab972e09f6d8cdae9e/src/Http/Responds.php#L53-L64 |
17,812 | iocaste/microservice-foundation | src/Http/Responds.php | Responds.respondWithError | public function respondWithError($code = null, $message = null, array $data = []): JsonResponse
{
return $this->respond([
'status' => [
'type' => 'error',
'message' => $this->getDefaultMessage($code, $message),
'code' => $code,
'htt... | php | public function respondWithError($code = null, $message = null, array $data = []): JsonResponse
{
return $this->respond([
'status' => [
'type' => 'error',
'message' => $this->getDefaultMessage($code, $message),
'code' => $code,
'htt... | [
"public",
"function",
"respondWithError",
"(",
"$",
"code",
"=",
"null",
",",
"$",
"message",
"=",
"null",
",",
"array",
"$",
"data",
"=",
"[",
"]",
")",
":",
"JsonResponse",
"{",
"return",
"$",
"this",
"->",
"respond",
"(",
"[",
"'status'",
"=>",
"[... | Return response with error.
@param null $code
@param null $message
@param array $data
@return JsonResponse | [
"Return",
"response",
"with",
"error",
"."
] | 274a154de4299e8a57314bab972e09f6d8cdae9e | https://github.com/iocaste/microservice-foundation/blob/274a154de4299e8a57314bab972e09f6d8cdae9e/src/Http/Responds.php#L75-L86 |
17,813 | iocaste/microservice-foundation | src/Http/Responds.php | Responds.respondWithSuccess | public function respondWithSuccess(array $data = []): JsonResponse
{
return $this->setStatusCode(IlluminateResponse::HTTP_OK)->respond([
'status' => [
'http_code' => $this->getStatusCode(),
],
'data' => $data,
]);
} | php | public function respondWithSuccess(array $data = []): JsonResponse
{
return $this->setStatusCode(IlluminateResponse::HTTP_OK)->respond([
'status' => [
'http_code' => $this->getStatusCode(),
],
'data' => $data,
]);
} | [
"public",
"function",
"respondWithSuccess",
"(",
"array",
"$",
"data",
"=",
"[",
"]",
")",
":",
"JsonResponse",
"{",
"return",
"$",
"this",
"->",
"setStatusCode",
"(",
"IlluminateResponse",
"::",
"HTTP_OK",
")",
"->",
"respond",
"(",
"[",
"'status'",
"=>",
... | Returns 200 response with data.
@param array $data
@return \Illuminate\Http\JsonResponse | [
"Returns",
"200",
"response",
"with",
"data",
"."
] | 274a154de4299e8a57314bab972e09f6d8cdae9e | https://github.com/iocaste/microservice-foundation/blob/274a154de4299e8a57314bab972e09f6d8cdae9e/src/Http/Responds.php#L197-L205 |
17,814 | iocaste/microservice-foundation | src/Http/Responds.php | Responds.respondCreated | public function respondCreated($code = ApiResponse::CODE_SUCCESS, array $data = [], $message = null): JsonResponse
{
return $this->setStatusCode(IlluminateResponse::HTTP_CREATED)->respond([
'status' => [
'type' => 'success',
'message' => $this->getDefaultMessage($... | php | public function respondCreated($code = ApiResponse::CODE_SUCCESS, array $data = [], $message = null): JsonResponse
{
return $this->setStatusCode(IlluminateResponse::HTTP_CREATED)->respond([
'status' => [
'type' => 'success',
'message' => $this->getDefaultMessage($... | [
"public",
"function",
"respondCreated",
"(",
"$",
"code",
"=",
"ApiResponse",
"::",
"CODE_SUCCESS",
",",
"array",
"$",
"data",
"=",
"[",
"]",
",",
"$",
"message",
"=",
"null",
")",
":",
"JsonResponse",
"{",
"return",
"$",
"this",
"->",
"setStatusCode",
"... | Returns 201 response with data.
@param int $code
@param array $data
@param null $message
@return \Illuminate\Http\JsonResponse | [
"Returns",
"201",
"response",
"with",
"data",
"."
] | 274a154de4299e8a57314bab972e09f6d8cdae9e | https://github.com/iocaste/microservice-foundation/blob/274a154de4299e8a57314bab972e09f6d8cdae9e/src/Http/Responds.php#L216-L227 |
17,815 | iocaste/microservice-foundation | src/Http/Responds.php | Responds.respondDeleted | public function respondDeleted($code = ApiResponse::CODE_DELETED, array $data = [], $message = null): JsonResponse
{
return $this->setStatusCode(IlluminateResponse::HTTP_NO_CONTENT)->respond([
'status' => [
'type' => 'success',
'message' => $this->getDefaultMessag... | php | public function respondDeleted($code = ApiResponse::CODE_DELETED, array $data = [], $message = null): JsonResponse
{
return $this->setStatusCode(IlluminateResponse::HTTP_NO_CONTENT)->respond([
'status' => [
'type' => 'success',
'message' => $this->getDefaultMessag... | [
"public",
"function",
"respondDeleted",
"(",
"$",
"code",
"=",
"ApiResponse",
"::",
"CODE_DELETED",
",",
"array",
"$",
"data",
"=",
"[",
"]",
",",
"$",
"message",
"=",
"null",
")",
":",
"JsonResponse",
"{",
"return",
"$",
"this",
"->",
"setStatusCode",
"... | Returns 204 response, enacted but the response does not include an entity.
@param int $code
@param array $data
@param string $message
@return \Illuminate\Http\JsonResponse | [
"Returns",
"204",
"response",
"enacted",
"but",
"the",
"response",
"does",
"not",
"include",
"an",
"entity",
"."
] | 274a154de4299e8a57314bab972e09f6d8cdae9e | https://github.com/iocaste/microservice-foundation/blob/274a154de4299e8a57314bab972e09f6d8cdae9e/src/Http/Responds.php#L238-L249 |
17,816 | iocaste/microservice-foundation | src/Http/Responds.php | Responds.getDefaultMessage | protected function getDefaultMessage($code, $message): string
{
if ($code !== null && $message === null) {
return ApiResponse::$statusTexts[$code]['message'];
}
return $message;
} | php | protected function getDefaultMessage($code, $message): string
{
if ($code !== null && $message === null) {
return ApiResponse::$statusTexts[$code]['message'];
}
return $message;
} | [
"protected",
"function",
"getDefaultMessage",
"(",
"$",
"code",
",",
"$",
"message",
")",
":",
"string",
"{",
"if",
"(",
"$",
"code",
"!==",
"null",
"&&",
"$",
"message",
"===",
"null",
")",
"{",
"return",
"ApiResponse",
"::",
"$",
"statusTexts",
"[",
... | Checks if specified code already has default message.
@param $code
@param $message
@return string | [
"Checks",
"if",
"specified",
"code",
"already",
"has",
"default",
"message",
"."
] | 274a154de4299e8a57314bab972e09f6d8cdae9e | https://github.com/iocaste/microservice-foundation/blob/274a154de4299e8a57314bab972e09f6d8cdae9e/src/Http/Responds.php#L259-L266 |
17,817 | titon/db | src/Titon/Db/Driver/Dialect/AbstractDialect.php | AbstractDialect.formatAttributes | public function formatAttributes(array $attributes) {
foreach ($attributes as $key => $attr) {
if ($attr instanceof Closure) {
$attributes[$key] = call_user_func($attr, $this);
} else if ($this->hasKeyword($attr)) {
$attributes[$key] = $this->getKeyword($... | php | public function formatAttributes(array $attributes) {
foreach ($attributes as $key => $attr) {
if ($attr instanceof Closure) {
$attributes[$key] = call_user_func($attr, $this);
} else if ($this->hasKeyword($attr)) {
$attributes[$key] = $this->getKeyword($... | [
"public",
"function",
"formatAttributes",
"(",
"array",
"$",
"attributes",
")",
"{",
"foreach",
"(",
"$",
"attributes",
"as",
"$",
"key",
"=>",
"$",
"attr",
")",
"{",
"if",
"(",
"$",
"attr",
"instanceof",
"Closure",
")",
"{",
"$",
"attributes",
"[",
"$... | Prepare the list of attributes for rendering.
If an attribute is found within a keyword, use the keyword.
@param array $attributes
@return array | [
"Prepare",
"the",
"list",
"of",
"attributes",
"for",
"rendering",
".",
"If",
"an",
"attribute",
"is",
"found",
"within",
"a",
"keyword",
"use",
"the",
"keyword",
"."
] | fbc5159d1ce9d2139759c9367565986981485604 | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractDialect.php#L230-L247 |
17,818 | titon/db | src/Titon/Db/Driver/Dialect/AbstractDialect.php | AbstractDialect.formatColumns | public function formatColumns(Schema $schema) {
$columns = [];
foreach ($schema->getColumns() as $column => $options) {
$dataType = $this->getDriver()->getType($options['type']);
$options = $options + $dataType->getDefaultOptions();
$type = $options['type'];
... | php | public function formatColumns(Schema $schema) {
$columns = [];
foreach ($schema->getColumns() as $column => $options) {
$dataType = $this->getDriver()->getType($options['type']);
$options = $options + $dataType->getDefaultOptions();
$type = $options['type'];
... | [
"public",
"function",
"formatColumns",
"(",
"Schema",
"$",
"schema",
")",
"{",
"$",
"columns",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"schema",
"->",
"getColumns",
"(",
")",
"as",
"$",
"column",
"=>",
"$",
"options",
")",
"{",
"$",
"dataType",
"=",... | Format columns for a table schema.
@param \Titon\Db\Driver\Schema $schema
@return string | [
"Format",
"columns",
"for",
"a",
"table",
"schema",
"."
] | fbc5159d1ce9d2139759c9367565986981485604 | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractDialect.php#L255-L311 |
17,819 | titon/db | src/Titon/Db/Driver/Dialect/AbstractDialect.php | AbstractDialect.formatDefault | public function formatDefault($value) {
if ($value === '') {
return '';
}
if ($value instanceof Closure) {
$value = call_user_func($value, $this);
} else if (is_string($value) || $value === null) {
$value = $this->getDriver()->escape($value);
... | php | public function formatDefault($value) {
if ($value === '') {
return '';
}
if ($value instanceof Closure) {
$value = call_user_func($value, $this);
} else if (is_string($value) || $value === null) {
$value = $this->getDriver()->escape($value);
... | [
"public",
"function",
"formatDefault",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"''",
")",
"{",
"return",
"''",
";",
"}",
"if",
"(",
"$",
"value",
"instanceof",
"Closure",
")",
"{",
"$",
"value",
"=",
"call_user_func",
"(",
"$",
... | Format the default value of a column.
@param mixed $value
@return string | [
"Format",
"the",
"default",
"value",
"of",
"a",
"column",
"."
] | fbc5159d1ce9d2139759c9367565986981485604 | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractDialect.php#L355-L368 |
17,820 | titon/db | src/Titon/Db/Driver/Dialect/AbstractDialect.php | AbstractDialect.formatExpression | public function formatExpression(Expr $expr) {
$field = $expr->getField();
$operator = $expr->getOperator();
$value = $expr->getValue();
if ($operator === Expr::AS_ALIAS) {
return sprintf($this->getClause(self::AS_ALIAS), $this->quote($field), $this->quote($value));
... | php | public function formatExpression(Expr $expr) {
$field = $expr->getField();
$operator = $expr->getOperator();
$value = $expr->getValue();
if ($operator === Expr::AS_ALIAS) {
return sprintf($this->getClause(self::AS_ALIAS), $this->quote($field), $this->quote($value));
... | [
"public",
"function",
"formatExpression",
"(",
"Expr",
"$",
"expr",
")",
"{",
"$",
"field",
"=",
"$",
"expr",
"->",
"getField",
"(",
")",
";",
"$",
"operator",
"=",
"$",
"expr",
"->",
"getOperator",
"(",
")",
";",
"$",
"value",
"=",
"$",
"expr",
"-... | Format database expressions.
@param \Titon\Db\Query\Expr $expr
@return string | [
"Format",
"database",
"expressions",
"."
] | fbc5159d1ce9d2139759c9367565986981485604 | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractDialect.php#L376-L436 |
17,821 | titon/db | src/Titon/Db/Driver/Dialect/AbstractDialect.php | AbstractDialect.formatFunction | public function formatFunction(Func $func) {
$arguments = [];
foreach ($func->getArguments() as $arg) {
$type = $arg['type'];
$value = $arg['value'];
if ($value instanceof Func) {
$value = $this->formatFunction($value);
} else if ($value... | php | public function formatFunction(Func $func) {
$arguments = [];
foreach ($func->getArguments() as $arg) {
$type = $arg['type'];
$value = $arg['value'];
if ($value instanceof Func) {
$value = $this->formatFunction($value);
} else if ($value... | [
"public",
"function",
"formatFunction",
"(",
"Func",
"$",
"func",
")",
"{",
"$",
"arguments",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"func",
"->",
"getArguments",
"(",
")",
"as",
"$",
"arg",
")",
"{",
"$",
"type",
"=",
"$",
"arg",
"[",
"'type'",
... | Format a database function.
@param \Titon\Db\Query\Func $func
@return string | [
"Format",
"a",
"database",
"function",
"."
] | fbc5159d1ce9d2139759c9367565986981485604 | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractDialect.php#L624-L660 |
17,822 | titon/db | src/Titon/Db/Driver/Dialect/AbstractDialect.php | AbstractDialect.formatGroupBy | public function formatGroupBy(array $groupBy) {
if ($groupBy) {
return sprintf($this->getClause(self::GROUP_BY), $this->quoteList($groupBy));
}
return '';
} | php | public function formatGroupBy(array $groupBy) {
if ($groupBy) {
return sprintf($this->getClause(self::GROUP_BY), $this->quoteList($groupBy));
}
return '';
} | [
"public",
"function",
"formatGroupBy",
"(",
"array",
"$",
"groupBy",
")",
"{",
"if",
"(",
"$",
"groupBy",
")",
"{",
"return",
"sprintf",
"(",
"$",
"this",
"->",
"getClause",
"(",
"self",
"::",
"GROUP_BY",
")",
",",
"$",
"this",
"->",
"quoteList",
"(",
... | Format the group by.
@param array $groupBy
@return string | [
"Format",
"the",
"group",
"by",
"."
] | fbc5159d1ce9d2139759c9367565986981485604 | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractDialect.php#L668-L674 |
17,823 | titon/db | src/Titon/Db/Driver/Dialect/AbstractDialect.php | AbstractDialect.formatHaving | public function formatHaving(Predicate $having) {
if ($having->getParams()) {
return sprintf($this->getClause(self::HAVING), $this->formatPredicate($having));
}
return '';
} | php | public function formatHaving(Predicate $having) {
if ($having->getParams()) {
return sprintf($this->getClause(self::HAVING), $this->formatPredicate($having));
}
return '';
} | [
"public",
"function",
"formatHaving",
"(",
"Predicate",
"$",
"having",
")",
"{",
"if",
"(",
"$",
"having",
"->",
"getParams",
"(",
")",
")",
"{",
"return",
"sprintf",
"(",
"$",
"this",
"->",
"getClause",
"(",
"self",
"::",
"HAVING",
")",
",",
"$",
"t... | Format the having clause.
@param \Titon\Db\Query\Predicate $having
@return string | [
"Format",
"the",
"having",
"clause",
"."
] | fbc5159d1ce9d2139759c9367565986981485604 | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractDialect.php#L682-L688 |
17,824 | titon/db | src/Titon/Db/Driver/Dialect/AbstractDialect.php | AbstractDialect.formatJoins | public function formatJoins(array $joins) {
if ($joins) {
$output = [];
foreach ($joins as $join) {
$conditions = [];
foreach ($join->getOn() as $pfk => $rfk) {
$conditions[] = $this->quote($pfk) . ' = ' . $this->quote($rfk);
... | php | public function formatJoins(array $joins) {
if ($joins) {
$output = [];
foreach ($joins as $join) {
$conditions = [];
foreach ($join->getOn() as $pfk => $rfk) {
$conditions[] = $this->quote($pfk) . ' = ' . $this->quote($rfk);
... | [
"public",
"function",
"formatJoins",
"(",
"array",
"$",
"joins",
")",
"{",
"if",
"(",
"$",
"joins",
")",
"{",
"$",
"output",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"joins",
"as",
"$",
"join",
")",
"{",
"$",
"conditions",
"=",
"[",
"]",
";",
"... | Format the list of joins.
@param \Titon\Db\Query\Join[] $joins
@return string | [
"Format",
"the",
"list",
"of",
"joins",
"."
] | fbc5159d1ce9d2139759c9367565986981485604 | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractDialect.php#L696-L716 |
17,825 | titon/db | src/Titon/Db/Driver/Dialect/AbstractDialect.php | AbstractDialect.formatLimit | public function formatLimit($limit) {
if ($limit) {
return sprintf($this->getClause(self::LIMIT), (int) $limit);
}
return '';
} | php | public function formatLimit($limit) {
if ($limit) {
return sprintf($this->getClause(self::LIMIT), (int) $limit);
}
return '';
} | [
"public",
"function",
"formatLimit",
"(",
"$",
"limit",
")",
"{",
"if",
"(",
"$",
"limit",
")",
"{",
"return",
"sprintf",
"(",
"$",
"this",
"->",
"getClause",
"(",
"self",
"::",
"LIMIT",
")",
",",
"(",
"int",
")",
"$",
"limit",
")",
";",
"}",
"re... | Format the limit.
@param int $limit
@return string | [
"Format",
"the",
"limit",
"."
] | fbc5159d1ce9d2139759c9367565986981485604 | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractDialect.php#L724-L730 |
17,826 | titon/db | src/Titon/Db/Driver/Dialect/AbstractDialect.php | AbstractDialect.formatLimitOffset | public function formatLimitOffset($limit, $offset = 0) {
if ($limit && $offset) {
return sprintf($this->getClause(self::LIMIT_OFFSET), (int) $limit, (int) $offset);
}
return $this->formatLimit($limit);
} | php | public function formatLimitOffset($limit, $offset = 0) {
if ($limit && $offset) {
return sprintf($this->getClause(self::LIMIT_OFFSET), (int) $limit, (int) $offset);
}
return $this->formatLimit($limit);
} | [
"public",
"function",
"formatLimitOffset",
"(",
"$",
"limit",
",",
"$",
"offset",
"=",
"0",
")",
"{",
"if",
"(",
"$",
"limit",
"&&",
"$",
"offset",
")",
"{",
"return",
"sprintf",
"(",
"$",
"this",
"->",
"getClause",
"(",
"self",
"::",
"LIMIT_OFFSET",
... | Format the limit and offset.
@param int $limit
@param int $offset
@return string | [
"Format",
"the",
"limit",
"and",
"offset",
"."
] | fbc5159d1ce9d2139759c9367565986981485604 | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractDialect.php#L739-L745 |
17,827 | titon/db | src/Titon/Db/Driver/Dialect/AbstractDialect.php | AbstractDialect.formatOrderBy | public function formatOrderBy(array $orderBy) {
if ($orderBy) {
$output = [];
foreach ($orderBy as $field => $direction) {
if ($direction instanceof Func) {
$output[] = $this->formatFunction($direction);
} else {
$o... | php | public function formatOrderBy(array $orderBy) {
if ($orderBy) {
$output = [];
foreach ($orderBy as $field => $direction) {
if ($direction instanceof Func) {
$output[] = $this->formatFunction($direction);
} else {
$o... | [
"public",
"function",
"formatOrderBy",
"(",
"array",
"$",
"orderBy",
")",
"{",
"if",
"(",
"$",
"orderBy",
")",
"{",
"$",
"output",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"orderBy",
"as",
"$",
"field",
"=>",
"$",
"direction",
")",
"{",
"if",
"(",
... | Format the order by.
@param array $orderBy
@return string | [
"Format",
"the",
"order",
"by",
"."
] | fbc5159d1ce9d2139759c9367565986981485604 | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractDialect.php#L753-L769 |
17,828 | titon/db | src/Titon/Db/Driver/Dialect/AbstractDialect.php | AbstractDialect.formatPredicate | public function formatPredicate(Predicate $predicate) {
$output = [];
foreach ($predicate->getParams() as $param) {
if ($param instanceof Predicate) {
$output[] = sprintf($this->getClause(self::GROUP), $this->formatPredicate($param));
} else if ($param instanceo... | php | public function formatPredicate(Predicate $predicate) {
$output = [];
foreach ($predicate->getParams() as $param) {
if ($param instanceof Predicate) {
$output[] = sprintf($this->getClause(self::GROUP), $this->formatPredicate($param));
} else if ($param instanceo... | [
"public",
"function",
"formatPredicate",
"(",
"Predicate",
"$",
"predicate",
")",
"{",
"$",
"output",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"predicate",
"->",
"getParams",
"(",
")",
"as",
"$",
"param",
")",
"{",
"if",
"(",
"$",
"param",
"instanceof"... | Format the predicate object by grouping nested predicates and parameters.
@param \Titon\Db\Query\Predicate $predicate
@return string | [
"Format",
"the",
"predicate",
"object",
"by",
"grouping",
"nested",
"predicates",
"and",
"parameters",
"."
] | fbc5159d1ce9d2139759c9367565986981485604 | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractDialect.php#L777-L790 |
17,829 | titon/db | src/Titon/Db/Driver/Dialect/AbstractDialect.php | AbstractDialect.formatSubQuery | public function formatSubQuery(SubQuery $query) {
// Reset the alias since statement would have double aliasing
$alias = $query->getAlias();
$query->asAlias(null);
// @codeCoverageIgnoreStart
if (method_exists($this, 'buildSelect')) {
$output = sprintf($this->getCla... | php | public function formatSubQuery(SubQuery $query) {
// Reset the alias since statement would have double aliasing
$alias = $query->getAlias();
$query->asAlias(null);
// @codeCoverageIgnoreStart
if (method_exists($this, 'buildSelect')) {
$output = sprintf($this->getCla... | [
"public",
"function",
"formatSubQuery",
"(",
"SubQuery",
"$",
"query",
")",
"{",
"// Reset the alias since statement would have double aliasing",
"$",
"alias",
"=",
"$",
"query",
"->",
"getAlias",
"(",
")",
";",
"$",
"query",
"->",
"asAlias",
"(",
"null",
")",
"... | Format a sub-query.
@param \Titon\Db\Query\SubQuery $query
@return string
@throws \Titon\Db\Exception\UnsupportedQueryStatementException | [
"Format",
"a",
"sub",
"-",
"query",
"."
] | fbc5159d1ce9d2139759c9367565986981485604 | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractDialect.php#L799-L822 |
17,830 | titon/db | src/Titon/Db/Driver/Dialect/AbstractDialect.php | AbstractDialect.formatTable | public function formatTable($table, $alias = null) {
if (!$table) {
throw new InvalidTableException('Missing table name for query');
}
$output = $this->quote($table);
if ($alias && $table !== $alias) {
$output = sprintf($this->getClause(self::AS_ALIAS), $output,... | php | public function formatTable($table, $alias = null) {
if (!$table) {
throw new InvalidTableException('Missing table name for query');
}
$output = $this->quote($table);
if ($alias && $table !== $alias) {
$output = sprintf($this->getClause(self::AS_ALIAS), $output,... | [
"public",
"function",
"formatTable",
"(",
"$",
"table",
",",
"$",
"alias",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"table",
")",
"{",
"throw",
"new",
"InvalidTableException",
"(",
"'Missing table name for query'",
")",
";",
"}",
"$",
"output",
"=",
"... | Format the table name and alias name.
@param string $table
@param string $alias
@return string
@throws \Titon\Db\Exception\InvalidTableException | [
"Format",
"the",
"table",
"name",
"and",
"alias",
"name",
"."
] | fbc5159d1ce9d2139759c9367565986981485604 | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractDialect.php#L832-L844 |
17,831 | titon/db | src/Titon/Db/Driver/Dialect/AbstractDialect.php | AbstractDialect.formatTableForeign | public function formatTableForeign(array $data) {
$ref = explode('.', $data['references']);
$key = sprintf($this->getClause(self::FOREIGN_KEY), $this->quote($data['column']), $this->quote($ref[0]), $this->quote($ref[1]));
if ($data['constraint']) {
$key = sprintf($this->getClause(se... | php | public function formatTableForeign(array $data) {
$ref = explode('.', $data['references']);
$key = sprintf($this->getClause(self::FOREIGN_KEY), $this->quote($data['column']), $this->quote($ref[0]), $this->quote($ref[1]));
if ($data['constraint']) {
$key = sprintf($this->getClause(se... | [
"public",
"function",
"formatTableForeign",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"ref",
"=",
"explode",
"(",
"'.'",
",",
"$",
"data",
"[",
"'references'",
"]",
")",
";",
"$",
"key",
"=",
"sprintf",
"(",
"$",
"this",
"->",
"getClause",
"(",
"self... | Format a table foreign key.
@param array $data
@return string | [
"Format",
"a",
"table",
"foreign",
"key",
"."
] | fbc5159d1ce9d2139759c9367565986981485604 | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractDialect.php#L852-L874 |
17,832 | titon/db | src/Titon/Db/Driver/Dialect/AbstractDialect.php | AbstractDialect.formatTableIndex | public function formatTableIndex($index, array $columns) {
return sprintf($this->getClause(self::INDEX), $this->quote($index), $this->quoteList($columns));
} | php | public function formatTableIndex($index, array $columns) {
return sprintf($this->getClause(self::INDEX), $this->quote($index), $this->quoteList($columns));
} | [
"public",
"function",
"formatTableIndex",
"(",
"$",
"index",
",",
"array",
"$",
"columns",
")",
"{",
"return",
"sprintf",
"(",
"$",
"this",
"->",
"getClause",
"(",
"self",
"::",
"INDEX",
")",
",",
"$",
"this",
"->",
"quote",
"(",
"$",
"index",
")",
"... | Format a table index key.
@param string $index
@param array $columns
@return string | [
"Format",
"a",
"table",
"index",
"key",
"."
] | fbc5159d1ce9d2139759c9367565986981485604 | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractDialect.php#L883-L885 |
17,833 | titon/db | src/Titon/Db/Driver/Dialect/AbstractDialect.php | AbstractDialect.formatTableOptions | public function formatTableOptions(array $options) {
$output = [];
foreach ($this->formatAttributes($options) as $key => $value) {
if ($this->hasClause($key)) {
$option = sprintf($this->getClause($key), $value);
} else {
$option = $this->getKeywo... | php | public function formatTableOptions(array $options) {
$output = [];
foreach ($this->formatAttributes($options) as $key => $value) {
if ($this->hasClause($key)) {
$option = sprintf($this->getClause($key), $value);
} else {
$option = $this->getKeywo... | [
"public",
"function",
"formatTableOptions",
"(",
"array",
"$",
"options",
")",
"{",
"$",
"output",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"formatAttributes",
"(",
"$",
"options",
")",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"i... | Format the table options for a create table statement.
@param array $options
@return string | [
"Format",
"the",
"table",
"options",
"for",
"a",
"create",
"table",
"statement",
"."
] | fbc5159d1ce9d2139759c9367565986981485604 | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractDialect.php#L923-L942 |
17,834 | titon/db | src/Titon/Db/Driver/Dialect/AbstractDialect.php | AbstractDialect.formatTablePrimary | public function formatTablePrimary(array $data) {
$key = sprintf($this->getClause(self::PRIMARY_KEY), $this->quoteList($data['columns']));
if ($data['constraint']) {
$key = sprintf($this->getClause(self::CONSTRAINT), $this->quote($data['constraint'])) . ' ' . $key;
}
return... | php | public function formatTablePrimary(array $data) {
$key = sprintf($this->getClause(self::PRIMARY_KEY), $this->quoteList($data['columns']));
if ($data['constraint']) {
$key = sprintf($this->getClause(self::CONSTRAINT), $this->quote($data['constraint'])) . ' ' . $key;
}
return... | [
"public",
"function",
"formatTablePrimary",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"key",
"=",
"sprintf",
"(",
"$",
"this",
"->",
"getClause",
"(",
"self",
"::",
"PRIMARY_KEY",
")",
",",
"$",
"this",
"->",
"quoteList",
"(",
"$",
"data",
"[",
"'colum... | Format a table primary key.
@param array $data
@return string | [
"Format",
"a",
"table",
"primary",
"key",
"."
] | fbc5159d1ce9d2139759c9367565986981485604 | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractDialect.php#L950-L958 |
17,835 | titon/db | src/Titon/Db/Driver/Dialect/AbstractDialect.php | AbstractDialect.formatTableUnique | public function formatTableUnique(array $data) {
$key = sprintf($this->getClause(self::UNIQUE_KEY), $this->quote($data['index']), $this->quoteList($data['columns']));
if ($data['constraint']) {
$key = sprintf($this->getClause(self::CONSTRAINT), $this->quote($data['constraint'])) . ' ' . $ke... | php | public function formatTableUnique(array $data) {
$key = sprintf($this->getClause(self::UNIQUE_KEY), $this->quote($data['index']), $this->quoteList($data['columns']));
if ($data['constraint']) {
$key = sprintf($this->getClause(self::CONSTRAINT), $this->quote($data['constraint'])) . ' ' . $ke... | [
"public",
"function",
"formatTableUnique",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"key",
"=",
"sprintf",
"(",
"$",
"this",
"->",
"getClause",
"(",
"self",
"::",
"UNIQUE_KEY",
")",
",",
"$",
"this",
"->",
"quote",
"(",
"$",
"data",
"[",
"'index'",
... | Format a table unique key.
@param array $data
@return string | [
"Format",
"a",
"table",
"unique",
"key",
"."
] | fbc5159d1ce9d2139759c9367565986981485604 | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractDialect.php#L966-L974 |
17,836 | titon/db | src/Titon/Db/Driver/Dialect/AbstractDialect.php | AbstractDialect.formatValues | public function formatValues(Query $query) {
$fields = $query->getData();
switch ($query->getType()) {
case Query::INSERT:
return sprintf($this->getClause(self::GROUP), implode(', ', array_fill(0, count($fields), '?')));
break;
case Query::MULTI_INSER... | php | public function formatValues(Query $query) {
$fields = $query->getData();
switch ($query->getType()) {
case Query::INSERT:
return sprintf($this->getClause(self::GROUP), implode(', ', array_fill(0, count($fields), '?')));
break;
case Query::MULTI_INSER... | [
"public",
"function",
"formatValues",
"(",
"Query",
"$",
"query",
")",
"{",
"$",
"fields",
"=",
"$",
"query",
"->",
"getData",
"(",
")",
";",
"switch",
"(",
"$",
"query",
"->",
"getType",
"(",
")",
")",
"{",
"case",
"Query",
"::",
"INSERT",
":",
"r... | Format the fields values structure depending on the type of query.
@param \Titon\Db\Query $query
@return string | [
"Format",
"the",
"fields",
"values",
"structure",
"depending",
"on",
"the",
"type",
"of",
"query",
"."
] | fbc5159d1ce9d2139759c9367565986981485604 | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractDialect.php#L982-L997 |
17,837 | titon/db | src/Titon/Db/Driver/Dialect/AbstractDialect.php | AbstractDialect.formatWhere | public function formatWhere(Predicate $where) {
if ($where->getParams()) {
return sprintf($this->getClause(self::WHERE), $this->formatPredicate($where));
}
return '';
} | php | public function formatWhere(Predicate $where) {
if ($where->getParams()) {
return sprintf($this->getClause(self::WHERE), $this->formatPredicate($where));
}
return '';
} | [
"public",
"function",
"formatWhere",
"(",
"Predicate",
"$",
"where",
")",
"{",
"if",
"(",
"$",
"where",
"->",
"getParams",
"(",
")",
")",
"{",
"return",
"sprintf",
"(",
"$",
"this",
"->",
"getClause",
"(",
"self",
"::",
"WHERE",
")",
",",
"$",
"this"... | Format the where clause.
@param \Titon\Db\Query\Predicate $where
@return string | [
"Format",
"the",
"where",
"clause",
"."
] | fbc5159d1ce9d2139759c9367565986981485604 | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractDialect.php#L1005-L1011 |
17,838 | lode/fem | src/request.php | request.redirect | public static function redirect($location, $stop_execution=true, $code=null) {
if (preg_match('{^(http(s)?:)?//}', $location) == false) {
$base_url = 'http';
$base_url .= !empty($_SERVER['HTTPS']) ? 's' : '';
$base_url .= '://'.$_SERVER['SERVER_NAME'];
if (strpos($location, '/') !== 0) {
$base_url .= '/... | php | public static function redirect($location, $stop_execution=true, $code=null) {
if (preg_match('{^(http(s)?:)?//}', $location) == false) {
$base_url = 'http';
$base_url .= !empty($_SERVER['HTTPS']) ? 's' : '';
$base_url .= '://'.$_SERVER['SERVER_NAME'];
if (strpos($location, '/') !== 0) {
$base_url .= '/... | [
"public",
"static",
"function",
"redirect",
"(",
"$",
"location",
",",
"$",
"stop_execution",
"=",
"true",
",",
"$",
"code",
"=",
"null",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'{^(http(s)?:)?//}'",
",",
"$",
"location",
")",
"==",
"false",
")",
"{",
... | redirect a browser session to a new url
also exists flow
@param string $location relative to the host
@param boolean $stop_execution defaults to true
@param int $code optional, status code instead of default 302
@return void | [
"redirect",
"a",
"browser",
"session",
"to",
"a",
"new",
"url",
"also",
"exists",
"flow"
] | c1c466c1a904d99452b341c5ae7cbc3e22b106e1 | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/request.php#L16-L36 |
17,839 | lode/fem | src/request.php | request.get_method | public static function get_method() {
if (empty($_SERVER['REQUEST_METHOD'])) {
return 'GET';
}
$allowed_methods = ['GET', 'PUT', 'POST', 'PATCH', 'DELETE', 'OPTIONS', 'HEAD'];
if (in_array($_SERVER['REQUEST_METHOD'], $allowed_methods) == false) {
return false;
}
return $_SERVER['REQUEST_METHOD'];
} | php | public static function get_method() {
if (empty($_SERVER['REQUEST_METHOD'])) {
return 'GET';
}
$allowed_methods = ['GET', 'PUT', 'POST', 'PATCH', 'DELETE', 'OPTIONS', 'HEAD'];
if (in_array($_SERVER['REQUEST_METHOD'], $allowed_methods) == false) {
return false;
}
return $_SERVER['REQUEST_METHOD'];
} | [
"public",
"static",
"function",
"get_method",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"_SERVER",
"[",
"'REQUEST_METHOD'",
"]",
")",
")",
"{",
"return",
"'GET'",
";",
"}",
"$",
"allowed_methods",
"=",
"[",
"'GET'",
",",
"'PUT'",
",",
"'POST'",
",",... | get the http method used for the current session
@return string|boolean one of GET|PUT|POST|PATCH|DELETE|OPTIONS|HEAD
or false for unknown types | [
"get",
"the",
"http",
"method",
"used",
"for",
"the",
"current",
"session"
] | c1c466c1a904d99452b341c5ae7cbc3e22b106e1 | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/request.php#L57-L68 |
17,840 | lode/fem | src/request.php | request.get_primary_accept | public static function get_primary_accept() {
if (empty($_SERVER['HTTP_ACCEPT'])) {
return '*';
}
// catch the most common formats
if (strpos($_SERVER['HTTP_ACCEPT'], 'text/html,') === 0) {
return 'html';
}
if (strpos($_SERVER['HTTP_ACCEPT'], 'application/json,') === 0) {
return 'json';
}
// use a gen... | php | public static function get_primary_accept() {
if (empty($_SERVER['HTTP_ACCEPT'])) {
return '*';
}
// catch the most common formats
if (strpos($_SERVER['HTTP_ACCEPT'], 'text/html,') === 0) {
return 'html';
}
if (strpos($_SERVER['HTTP_ACCEPT'], 'application/json,') === 0) {
return 'json';
}
// use a gen... | [
"public",
"static",
"function",
"get_primary_accept",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"_SERVER",
"[",
"'HTTP_ACCEPT'",
"]",
")",
")",
"{",
"return",
"'*'",
";",
"}",
"// catch the most common formats",
"if",
"(",
"strpos",
"(",
"$",
"_SERVER",
... | get the primary http accepted output format for the current session
@return string @see ::get_primary_mime_type() | [
"get",
"the",
"primary",
"http",
"accepted",
"output",
"format",
"for",
"the",
"current",
"session"
] | c1c466c1a904d99452b341c5ae7cbc3e22b106e1 | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/request.php#L136-L151 |
17,841 | lode/fem | src/request.php | request.get_basic_auth | public static function get_basic_auth() {
// normally it just works
if (!empty($_SERVER['PHP_AUTH_USER'])) {
return [
'USER' => $_SERVER['PHP_AUTH_USER'],
'PW' => $_SERVER['PHP_AUTH_PW'],
];
}
// php cgi mode requires a work around
if (!empty($_SERVER['REDIRECT_REMOTE_USER']) && strpos($_SERVER['REDI... | php | public static function get_basic_auth() {
// normally it just works
if (!empty($_SERVER['PHP_AUTH_USER'])) {
return [
'USER' => $_SERVER['PHP_AUTH_USER'],
'PW' => $_SERVER['PHP_AUTH_PW'],
];
}
// php cgi mode requires a work around
if (!empty($_SERVER['REDIRECT_REMOTE_USER']) && strpos($_SERVER['REDI... | [
"public",
"static",
"function",
"get_basic_auth",
"(",
")",
"{",
"// normally it just works",
"if",
"(",
"!",
"empty",
"(",
"$",
"_SERVER",
"[",
"'PHP_AUTH_USER'",
"]",
")",
")",
"{",
"return",
"[",
"'USER'",
"=>",
"$",
"_SERVER",
"[",
"'PHP_AUTH_USER'",
"]"... | returns basic auth credentials
this works around php cgi mode not passing them directly
@note this requires a change in the htaccess as well
@see example-project/public_html/.htaccess
@return array|null with 'USER' and 'PW' keys | [
"returns",
"basic",
"auth",
"credentials",
"this",
"works",
"around",
"php",
"cgi",
"mode",
"not",
"passing",
"them",
"directly"
] | c1c466c1a904d99452b341c5ae7cbc3e22b106e1 | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/request.php#L162-L185 |
17,842 | lode/fem | src/request.php | request.get_primary_mime_type | private static function get_primary_mime_type($type) {
if (strpos($type, ',')) {
$type = substr($type, 0, strpos($type, ','));
}
if (strpos($type, '/')) {
$type = substr($type, strpos($type, '/')+1);
}
if (strpos($type, ';')) {
$type = substr($type, 0, strpos($type, ';'));
}
if (strpos($type, '+')) {
$ty... | php | private static function get_primary_mime_type($type) {
if (strpos($type, ',')) {
$type = substr($type, 0, strpos($type, ','));
}
if (strpos($type, '/')) {
$type = substr($type, strpos($type, '/')+1);
}
if (strpos($type, ';')) {
$type = substr($type, 0, strpos($type, ';'));
}
if (strpos($type, '+')) {
$ty... | [
"private",
"static",
"function",
"get_primary_mime_type",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"type",
",",
"','",
")",
")",
"{",
"$",
"type",
"=",
"substr",
"(",
"$",
"type",
",",
"0",
",",
"strpos",
"(",
"$",
"type",
",",
... | gets a friendly version of a mime type
@param string $type
@return string the most interesting part of the mime type ..
.. only the first format, and only the most determinating part ..
i.e. 'text/html, ...' returns 'html'
i.e. 'application/json, ...' returns 'json' | [
"gets",
"a",
"friendly",
"version",
"of",
"a",
"mime",
"type"
] | c1c466c1a904d99452b341c5ae7cbc3e22b106e1 | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/request.php#L196-L211 |
17,843 | jfusion/org.jfusion.framework | src/Authentication/Cookies.php | Cookies.executeRedirect | function executeRedirect($source_url = null, $return = null) {
if (!$this->secret) {
if(count($this->cookies)) {
if (empty($return)) {
$return = Application::getInstance()->input->getBase64('return', '');
if ($return) {
$return = base64_decode($return);
if... | php | function executeRedirect($source_url = null, $return = null) {
if (!$this->secret) {
if(count($this->cookies)) {
if (empty($return)) {
$return = Application::getInstance()->input->getBase64('return', '');
if ($return) {
$return = base64_decode($return);
if... | [
"function",
"executeRedirect",
"(",
"$",
"source_url",
"=",
"null",
",",
"$",
"return",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"secret",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"cookies",
")",
")",
"{",
"if",
"(",... | Execute the cross domain login redirects
@param string $source_url
@param string $return | [
"Execute",
"the",
"cross",
"domain",
"login",
"redirects"
] | 65771963f23ccabcf1f867eb17c9452299cfe683 | https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Authentication/Cookies.php#L104-L135 |
17,844 | redaigbaria/oauth2 | src/Entity/AuthCodeEntity.php | AuthCodeEntity.generateRedirectUri | public function generateRedirectUri($state = null, $queryDelimeter = '?')
{
$uri = $this->getRedirectUri();
$uri .= (strstr($this->getRedirectUri(), $queryDelimeter) === false) ? $queryDelimeter : '&';
return $uri.http_build_query([
'code' => $this->getId(),
'state... | php | public function generateRedirectUri($state = null, $queryDelimeter = '?')
{
$uri = $this->getRedirectUri();
$uri .= (strstr($this->getRedirectUri(), $queryDelimeter) === false) ? $queryDelimeter : '&';
return $uri.http_build_query([
'code' => $this->getId(),
'state... | [
"public",
"function",
"generateRedirectUri",
"(",
"$",
"state",
"=",
"null",
",",
"$",
"queryDelimeter",
"=",
"'?'",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getRedirectUri",
"(",
")",
";",
"$",
"uri",
".=",
"(",
"strstr",
"(",
"$",
"this",
"->... | Generate a redirect URI
@param string $state The state parameter if set by the client
@param string $queryDelimeter The query delimiter ('?' for auth code grant, '#' for implicit grant)
@return string | [
"Generate",
"a",
"redirect",
"URI"
] | 54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a | https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/src/Entity/AuthCodeEntity.php#L58-L67 |
17,845 | anime-db/app-bundle | src/Util/Filesystem.php | Filesystem.scandir | public static function scandir($path, $filter = 0, $order = SCANDIR_SORT_ASCENDING)
{
if (!$filter || (
($filter & self::FILE) != self::FILE &&
($filter & self::DIRECTORY) != self::DIRECTORY
)) {
$filter = self::FILE | self::DIRECTORY;
}
// add sla... | php | public static function scandir($path, $filter = 0, $order = SCANDIR_SORT_ASCENDING)
{
if (!$filter || (
($filter & self::FILE) != self::FILE &&
($filter & self::DIRECTORY) != self::DIRECTORY
)) {
$filter = self::FILE | self::DIRECTORY;
}
// add sla... | [
"public",
"static",
"function",
"scandir",
"(",
"$",
"path",
",",
"$",
"filter",
"=",
"0",
",",
"$",
"order",
"=",
"SCANDIR_SORT_ASCENDING",
")",
"{",
"if",
"(",
"!",
"$",
"filter",
"||",
"(",
"(",
"$",
"filter",
"&",
"self",
"::",
"FILE",
")",
"!=... | List files and directories inside the specified path.
@param string $path
@param int $filter
@param int $order
@return array | [
"List",
"files",
"and",
"directories",
"inside",
"the",
"specified",
"path",
"."
] | ca3b342081719d41ba018792a75970cbb1f1fe22 | https://github.com/anime-db/app-bundle/blob/ca3b342081719d41ba018792a75970cbb1f1fe22/src/Util/Filesystem.php#L93-L149 |
17,846 | aryelgois/yasql-php | src/Populator.php | Populator.load | public function load(string $file)
{
$this->data = Yaml::parse(file_get_contents($file));
$this->filename = basename($file);
} | php | public function load(string $file)
{
$this->data = Yaml::parse(file_get_contents($file));
$this->filename = basename($file);
} | [
"public",
"function",
"load",
"(",
"string",
"$",
"file",
")",
"{",
"$",
"this",
"->",
"data",
"=",
"Yaml",
"::",
"parse",
"(",
"file_get_contents",
"(",
"$",
"file",
")",
")",
";",
"$",
"this",
"->",
"filename",
"=",
"basename",
"(",
"$",
"file",
... | Loads a YAML file to be processed
@param string $file Path to YAML source file | [
"Loads",
"a",
"YAML",
"file",
"to",
"be",
"processed"
] | f428b180d35bfc1ddf1f9b3323f9b085fbc09ac7 | https://github.com/aryelgois/yasql-php/blob/f428b180d35bfc1ddf1f9b3323f9b085fbc09ac7/src/Populator.php#L57-L61 |
17,847 | left-right/center | src/libraries/Trail.php | Trail.manage | public static function manage() {
$back = (Session::has('back')) ? Session::get('back') : [];
if (URL::current() == end($back)) {
//going back down the stack
array_pop($back);
} elseif (URL::previous() != end($back)) {
//going up the stack
$back[] = URL::previous();
}
//persist
if (count($bac... | php | public static function manage() {
$back = (Session::has('back')) ? Session::get('back') : [];
if (URL::current() == end($back)) {
//going back down the stack
array_pop($back);
} elseif (URL::previous() != end($back)) {
//going up the stack
$back[] = URL::previous();
}
//persist
if (count($bac... | [
"public",
"static",
"function",
"manage",
"(",
")",
"{",
"$",
"back",
"=",
"(",
"Session",
"::",
"has",
"(",
"'back'",
")",
")",
"?",
"Session",
"::",
"get",
"(",
"'back'",
")",
":",
"[",
"]",
";",
"if",
"(",
"URL",
"::",
"current",
"(",
")",
"... | manage the return stack | [
"manage",
"the",
"return",
"stack"
] | 47c225538475ca3e87fa49f31a323b6e6bd4eff2 | https://github.com/left-right/center/blob/47c225538475ca3e87fa49f31a323b6e6bd4eff2/src/libraries/Trail.php#L9-L28 |
17,848 | ClanCats/Core | src/classes/CCError/Handler.php | CCError_Handler.log | protected function log()
{
if ( class_exists( 'CCLog' ) )
{
try {
\CCLog::add(
$this->inspector->exception()->getMessage()." - ".
str_replace( CCROOT, '', $this->inspector->exception()->getFile() ).":".
$this->inspector->exception()->getLine(), 'exception'
);
\CCLog::write();
} ca... | php | protected function log()
{
if ( class_exists( 'CCLog' ) )
{
try {
\CCLog::add(
$this->inspector->exception()->getMessage()." - ".
str_replace( CCROOT, '', $this->inspector->exception()->getFile() ).":".
$this->inspector->exception()->getLine(), 'exception'
);
\CCLog::write();
} ca... | [
"protected",
"function",
"log",
"(",
")",
"{",
"if",
"(",
"class_exists",
"(",
"'CCLog'",
")",
")",
"{",
"try",
"{",
"\\",
"CCLog",
"::",
"add",
"(",
"$",
"this",
"->",
"inspector",
"->",
"exception",
"(",
")",
"->",
"getMessage",
"(",
")",
".",
"\... | Try to log that something went wrong
@return void | [
"Try",
"to",
"log",
"that",
"something",
"went",
"wrong"
] | 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCError/Handler.php#L39-L52 |
17,849 | ClanCats/Core | src/classes/CCError/Handler.php | CCError_Handler.handle | public function handle()
{
$this->log();
// when not in development we respond using a route
if ( !ClanCats::in_development() && !ClanCats::is_cli() )
{
CCResponse::error(500)->send( true );
}
// when in development continue with the default responder
else
{
$this->respond();
}
} | php | public function handle()
{
$this->log();
// when not in development we respond using a route
if ( !ClanCats::in_development() && !ClanCats::is_cli() )
{
CCResponse::error(500)->send( true );
}
// when in development continue with the default responder
else
{
$this->respond();
}
} | [
"public",
"function",
"handle",
"(",
")",
"{",
"$",
"this",
"->",
"log",
"(",
")",
";",
"// when not in development we respond using a route",
"if",
"(",
"!",
"ClanCats",
"::",
"in_development",
"(",
")",
"&&",
"!",
"ClanCats",
"::",
"is_cli",
"(",
")",
")",... | trigger the handler
@return void | [
"trigger",
"the",
"handler"
] | 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCError/Handler.php#L59-L73 |
17,850 | webforge-labs/psc-cms | lib/Psc/CMS/Item/TabButtonableValueObject.php | TabButtonableValueObject.copyFromTabButtonable | public static function copyFromTabButtonable(TabButtonable $tabButtonable) {
$valueObject = new static();
// ugly, but fast
$valueObject->setButtonLabel($tabButtonable->getButtonLabel());
$valueObject->setFullButtonLabel($tabButtonable->getFullButtonLabel());
$valueObject->setButtonLeftIcon($ta... | php | public static function copyFromTabButtonable(TabButtonable $tabButtonable) {
$valueObject = new static();
// ugly, but fast
$valueObject->setButtonLabel($tabButtonable->getButtonLabel());
$valueObject->setFullButtonLabel($tabButtonable->getFullButtonLabel());
$valueObject->setButtonLeftIcon($ta... | [
"public",
"static",
"function",
"copyFromTabButtonable",
"(",
"TabButtonable",
"$",
"tabButtonable",
")",
"{",
"$",
"valueObject",
"=",
"new",
"static",
"(",
")",
";",
"// ugly, but fast",
"$",
"valueObject",
"->",
"setButtonLabel",
"(",
"$",
"tabButtonable",
"->"... | Creates a copy of an tabButtonable
use this to have a modified Version of the interface
@return TabButtonableValueObject | [
"Creates",
"a",
"copy",
"of",
"an",
"tabButtonable"
] | 467bfa2547e6b4fa487d2d7f35fa6cc618dbc763 | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Item/TabButtonableValueObject.php#L18-L31 |
17,851 | discordier/justtextwidgets | src/Widgets/JustAnExplanation.php | JustAnExplanation.generateLabel | public function generateLabel()
{
if ($this->strLabel === '') {
return '';
}
return sprintf(
'<span %s>%s%s</span>',
('' !== $this->strClass ? ' class="' . $this->strClass . '"' : ''),
$this->strLabel,
($this->required ? '<span cla... | php | public function generateLabel()
{
if ($this->strLabel === '') {
return '';
}
return sprintf(
'<span %s>%s%s</span>',
('' !== $this->strClass ? ' class="' . $this->strClass . '"' : ''),
$this->strLabel,
($this->required ? '<span cla... | [
"public",
"function",
"generateLabel",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"strLabel",
"===",
"''",
")",
"{",
"return",
"''",
";",
"}",
"return",
"sprintf",
"(",
"'<span %s>%s%s</span>'",
",",
"(",
"''",
"!==",
"$",
"this",
"->",
"strClass",
"... | Generate the label and return it as string.
@return string | [
"Generate",
"the",
"label",
"and",
"return",
"it",
"as",
"string",
"."
] | 585f20eec05d592bb13281ca8ef0972e956d3f06 | https://github.com/discordier/justtextwidgets/blob/585f20eec05d592bb13281ca8ef0972e956d3f06/src/Widgets/JustAnExplanation.php#L53-L65 |
17,852 | iamapen/dbunit-ExcelFriendlyDataSet | src/lib/Iamapen/ExcelFriendlyDataSet/Database/DataSet/CommentableCsvDataSet.php | CommentableCsvDataSet.getCsvRow | protected function getCsvRow($fh)
{
if (version_compare(PHP_VERSION, '5.3.0', '>')) {
$rows = fgetcsv($fh, NULL, $this->delimiter, $this->enclosure, $this->escape);
} else {
$rows = fgetcsv($fh, NULL, $this->delimiter, $this->enclosure);
}
if ($rows === false... | php | protected function getCsvRow($fh)
{
if (version_compare(PHP_VERSION, '5.3.0', '>')) {
$rows = fgetcsv($fh, NULL, $this->delimiter, $this->enclosure, $this->escape);
} else {
$rows = fgetcsv($fh, NULL, $this->delimiter, $this->enclosure);
}
if ($rows === false... | [
"protected",
"function",
"getCsvRow",
"(",
"$",
"fh",
")",
"{",
"if",
"(",
"version_compare",
"(",
"PHP_VERSION",
",",
"'5.3.0'",
",",
"'>'",
")",
")",
"{",
"$",
"rows",
"=",
"fgetcsv",
"(",
"$",
"fh",
",",
"NULL",
",",
"$",
"this",
"->",
"delimiter"... | Returns a row from the csv file in an indexed array.
@param resource $fh
@return array | [
"Returns",
"a",
"row",
"from",
"the",
"csv",
"file",
"in",
"an",
"indexed",
"array",
"."
] | 036103cb2a2a75608f0a00448301cd3f4a5c4e19 | https://github.com/iamapen/dbunit-ExcelFriendlyDataSet/blob/036103cb2a2a75608f0a00448301cd3f4a5c4e19/src/lib/Iamapen/ExcelFriendlyDataSet/Database/DataSet/CommentableCsvDataSet.php#L37-L53 |
17,853 | aedart/laravel-helpers | src/Traits/Database/DBTrait.php | DBTrait.getDefaultDb | public function getDefaultDb(): ?ConnectionInterface
{
// By default, the DB Facade does not return the
// any actual database connection, but rather an
// instance of \Illuminate\Database\DatabaseManager.
// Therefore, we make sure only to obtain its
// "connection", to make... | php | public function getDefaultDb(): ?ConnectionInterface
{
// By default, the DB Facade does not return the
// any actual database connection, but rather an
// instance of \Illuminate\Database\DatabaseManager.
// Therefore, we make sure only to obtain its
// "connection", to make... | [
"public",
"function",
"getDefaultDb",
"(",
")",
":",
"?",
"ConnectionInterface",
"{",
"// By default, the DB Facade does not return the",
"// any actual database connection, but rather an",
"// instance of \\Illuminate\\Database\\DatabaseManager.",
"// Therefore, we make sure only to obtain ... | Get a default db value, if any is available
@return ConnectionInterface|null A default db value or Null if no default value is available | [
"Get",
"a",
"default",
"db",
"value",
"if",
"any",
"is",
"available"
] | 8b81a2d6658f3f8cb62b6be2c34773aaa2df219a | https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Database/DBTrait.php#L76-L89 |
17,854 | ivory-php/fbi | src/Fbi.php | Fbi.showStatusBar | public function showStatusBar()
{
return $this;
/**
* In case the without status bar has been set, remove it first.
*/
if( array_key_exists('noverbose', $this->options) ) unset($this->options['noverbose']);
$this->options['v'] = '';
return $this;
} | php | public function showStatusBar()
{
return $this;
/**
* In case the without status bar has been set, remove it first.
*/
if( array_key_exists('noverbose', $this->options) ) unset($this->options['noverbose']);
$this->options['v'] = '';
return $this;
} | [
"public",
"function",
"showStatusBar",
"(",
")",
"{",
"return",
"$",
"this",
";",
"/**\n\t\t * In case the without status bar has been set, remove it first.\n\t\t */",
"if",
"(",
"array_key_exists",
"(",
"'noverbose'",
",",
"$",
"this",
"->",
"options",
")",
")",
"unset... | This shows the status bar at the bottom of the screen with image
about the file being displayed in it.
@return $this | [
"This",
"shows",
"the",
"status",
"bar",
"at",
"the",
"bottom",
"of",
"the",
"screen",
"with",
"image",
"about",
"the",
"file",
"being",
"displayed",
"in",
"it",
"."
] | fce0839ed4d5693bd161fe45260311cc27f46cef | https://github.com/ivory-php/fbi/blob/fce0839ed4d5693bd161fe45260311cc27f46cef/src/Fbi.php#L88-L100 |
17,855 | ivory-php/fbi | src/Fbi.php | Fbi.withoutStatusBar | public function withoutStatusBar()
{
return $this;
if( array_key_exists('v', $this->options) ) unset($this->options['v']);
$this->options['noverbose'] = '';
return $this;
} | php | public function withoutStatusBar()
{
return $this;
if( array_key_exists('v', $this->options) ) unset($this->options['v']);
$this->options['noverbose'] = '';
return $this;
} | [
"public",
"function",
"withoutStatusBar",
"(",
")",
"{",
"return",
"$",
"this",
";",
"if",
"(",
"array_key_exists",
"(",
"'v'",
",",
"$",
"this",
"->",
"options",
")",
")",
"unset",
"(",
"$",
"this",
"->",
"options",
"[",
"'v'",
"]",
")",
";",
"$",
... | Don't display the status bar at the bottom of the screen
@return $this | [
"Don",
"t",
"display",
"the",
"status",
"bar",
"at",
"the",
"bottom",
"of",
"the",
"screen"
] | fce0839ed4d5693bd161fe45260311cc27f46cef | https://github.com/ivory-php/fbi/blob/fce0839ed4d5693bd161fe45260311cc27f46cef/src/Fbi.php#L106-L114 |
17,856 | ivory-php/fbi | src/Fbi.php | Fbi.display | public function display()
{
$options = $this->_compileOptions();
$command = system('sudo fbi --noverbose ' . $this->_compileOptions() . ' ' .$this->file . ' > /dev/null 2>&1');
/**
* If $displayFor is set to 0, then the application doesn't need to be terminated. It's showing
* indefinetly.
*/
if(... | php | public function display()
{
$options = $this->_compileOptions();
$command = system('sudo fbi --noverbose ' . $this->_compileOptions() . ' ' .$this->file . ' > /dev/null 2>&1');
/**
* If $displayFor is set to 0, then the application doesn't need to be terminated. It's showing
* indefinetly.
*/
if(... | [
"public",
"function",
"display",
"(",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"_compileOptions",
"(",
")",
";",
"$",
"command",
"=",
"system",
"(",
"'sudo fbi --noverbose '",
".",
"$",
"this",
"->",
"_compileOptions",
"(",
")",
".",
"' '",
".",... | Display The Image
@return | [
"Display",
"The",
"Image"
] | fce0839ed4d5693bd161fe45260311cc27f46cef | https://github.com/ivory-php/fbi/blob/fce0839ed4d5693bd161fe45260311cc27f46cef/src/Fbi.php#L315-L329 |
17,857 | ivory-php/fbi | src/Fbi.php | Fbi._compileOptions | public function _compileOptions()
{
$compiled = '';
/**
* We'll cycle through the options. If the option has only one
* character, it needs a hash, multiple characters needs two hashes.
*/
foreach( $this->options as $option => $value ) :
if( strlen($option) > 1 ) $compiled.= "--{$option} {$value} ... | php | public function _compileOptions()
{
$compiled = '';
/**
* We'll cycle through the options. If the option has only one
* character, it needs a hash, multiple characters needs two hashes.
*/
foreach( $this->options as $option => $value ) :
if( strlen($option) > 1 ) $compiled.= "--{$option} {$value} ... | [
"public",
"function",
"_compileOptions",
"(",
")",
"{",
"$",
"compiled",
"=",
"''",
";",
"/**\n\t\t * We'll cycle through the options. If the option has only one \n\t\t * character, it needs a hash, multiple characters needs two hashes. \n\t\t */",
"foreach",
"(",
"$",
"this",
"->",
... | Compile the options to a string passable to the command
@return string | [
"Compile",
"the",
"options",
"to",
"a",
"string",
"passable",
"to",
"the",
"command"
] | fce0839ed4d5693bd161fe45260311cc27f46cef | https://github.com/ivory-php/fbi/blob/fce0839ed4d5693bd161fe45260311cc27f46cef/src/Fbi.php#L335-L349 |
17,858 | vi-kon/laravel-auth | src/ViKon/Auth/Guard.php | Guard.hasGroup | public function hasGroup($group)
{
if ($this->user() === null) {
return null;
}
return in_array($group, $this->groups, true);
} | php | public function hasGroup($group)
{
if ($this->user() === null) {
return null;
}
return in_array($group, $this->groups, true);
} | [
"public",
"function",
"hasGroup",
"(",
"$",
"group",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"user",
"(",
")",
"===",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"in_array",
"(",
"$",
"group",
",",
"$",
"this",
"->",
"groups",
",",
"t... | Check if authenticate user has group
@param string $group
@return bool|null return NULL if user is not authenticated | [
"Check",
"if",
"authenticate",
"user",
"has",
"group"
] | 501c20128f43347a2ca271a53435297f9ef7f567 | https://github.com/vi-kon/laravel-auth/blob/501c20128f43347a2ca271a53435297f9ef7f567/src/ViKon/Auth/Guard.php#L49-L56 |
17,859 | vi-kon/laravel-auth | src/ViKon/Auth/Guard.php | Guard.hasGroups | public function hasGroups($groups)
{
if ($this->user() === null) {
return null;
}
if (!is_array($groups)) {
$groups = func_get_args();
}
// Count roles because user need user to have all roles passed as parameter
return count(array_intersect(... | php | public function hasGroups($groups)
{
if ($this->user() === null) {
return null;
}
if (!is_array($groups)) {
$groups = func_get_args();
}
// Count roles because user need user to have all roles passed as parameter
return count(array_intersect(... | [
"public",
"function",
"hasGroups",
"(",
"$",
"groups",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"user",
"(",
")",
"===",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"!",
"is_array",
"(",
"$",
"groups",
")",
")",
"{",
"$",
"groups",
... | Check if authenticated user has all groups passed by parameter
@param string[] $groups
@return bool|null return NULL if user is not authenticated | [
"Check",
"if",
"authenticated",
"user",
"has",
"all",
"groups",
"passed",
"by",
"parameter"
] | 501c20128f43347a2ca271a53435297f9ef7f567 | https://github.com/vi-kon/laravel-auth/blob/501c20128f43347a2ca271a53435297f9ef7f567/src/ViKon/Auth/Guard.php#L65-L77 |
17,860 | vi-kon/laravel-auth | src/ViKon/Auth/Guard.php | Guard.hasRole | public function hasRole($role)
{
if ($this->user() === null) {
return null;
}
return in_array($role, $this->roles, true);
} | php | public function hasRole($role)
{
if ($this->user() === null) {
return null;
}
return in_array($role, $this->roles, true);
} | [
"public",
"function",
"hasRole",
"(",
"$",
"role",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"user",
"(",
")",
"===",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"in_array",
"(",
"$",
"role",
",",
"$",
"this",
"->",
"roles",
",",
"true"... | Check if authenticate user has role
@param string $role
@return bool|null return NULL if user is not authenticated | [
"Check",
"if",
"authenticate",
"user",
"has",
"role"
] | 501c20128f43347a2ca271a53435297f9ef7f567 | https://github.com/vi-kon/laravel-auth/blob/501c20128f43347a2ca271a53435297f9ef7f567/src/ViKon/Auth/Guard.php#L86-L93 |
17,861 | vi-kon/laravel-auth | src/ViKon/Auth/Guard.php | Guard.hasRoles | public function hasRoles($roles)
{
if ($this->user() === null) {
return null;
}
if (!is_array($roles)) {
$roles = func_get_args();
}
// Count roles because user need user to have all roles passed as parameter
return count(array_intersect($rol... | php | public function hasRoles($roles)
{
if ($this->user() === null) {
return null;
}
if (!is_array($roles)) {
$roles = func_get_args();
}
// Count roles because user need user to have all roles passed as parameter
return count(array_intersect($rol... | [
"public",
"function",
"hasRoles",
"(",
"$",
"roles",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"user",
"(",
")",
"===",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"!",
"is_array",
"(",
"$",
"roles",
")",
")",
"{",
"$",
"roles",
"=",... | Check if authenticated user has all roles passed by parameter
@param string[] $roles
@return bool|null return NULL if user is not authenticated | [
"Check",
"if",
"authenticated",
"user",
"has",
"all",
"roles",
"passed",
"by",
"parameter"
] | 501c20128f43347a2ca271a53435297f9ef7f567 | https://github.com/vi-kon/laravel-auth/blob/501c20128f43347a2ca271a53435297f9ef7f567/src/ViKon/Auth/Guard.php#L102-L114 |
17,862 | vi-kon/laravel-auth | src/ViKon/Auth/Guard.php | Guard.hasPermission | public function hasPermission($permission)
{
if ($this->user() === null) {
return null;
}
return in_array($permission, $this->permissions, true);
} | php | public function hasPermission($permission)
{
if ($this->user() === null) {
return null;
}
return in_array($permission, $this->permissions, true);
} | [
"public",
"function",
"hasPermission",
"(",
"$",
"permission",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"user",
"(",
")",
"===",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"in_array",
"(",
"$",
"permission",
",",
"$",
"this",
"->",
"permi... | Check if authenticated user has permission
@param string $permission
@return bool|null return NULL if user is not authenticated | [
"Check",
"if",
"authenticated",
"user",
"has",
"permission"
] | 501c20128f43347a2ca271a53435297f9ef7f567 | https://github.com/vi-kon/laravel-auth/blob/501c20128f43347a2ca271a53435297f9ef7f567/src/ViKon/Auth/Guard.php#L123-L130 |
17,863 | vi-kon/laravel-auth | src/ViKon/Auth/Guard.php | Guard.hasPermissions | public function hasPermissions($permissions)
{
if ($this->user() === null) {
return null;
}
if (!is_array($permissions)) {
$permissions = func_get_args();
}
// Count permissions because user need user to have all permissions passed as parameter
... | php | public function hasPermissions($permissions)
{
if ($this->user() === null) {
return null;
}
if (!is_array($permissions)) {
$permissions = func_get_args();
}
// Count permissions because user need user to have all permissions passed as parameter
... | [
"public",
"function",
"hasPermissions",
"(",
"$",
"permissions",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"user",
"(",
")",
"===",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"!",
"is_array",
"(",
"$",
"permissions",
")",
")",
"{",
"$",... | Check if authenticated user has all permission passed by parameter
@param string[] $permissions
@return bool|null return NULL if user is not authenticated | [
"Check",
"if",
"authenticated",
"user",
"has",
"all",
"permission",
"passed",
"by",
"parameter"
] | 501c20128f43347a2ca271a53435297f9ef7f567 | https://github.com/vi-kon/laravel-auth/blob/501c20128f43347a2ca271a53435297f9ef7f567/src/ViKon/Auth/Guard.php#L139-L151 |
17,864 | vi-kon/laravel-auth | src/ViKon/Auth/Guard.php | Guard.isBlocked | public function isBlocked()
{
if ($this->user() === null) {
return null;
}
// Check user blocking status only if User model is role based user
if ($this->user instanceof User) {
return $this->user->blocked;
}
return false;
} | php | public function isBlocked()
{
if ($this->user() === null) {
return null;
}
// Check user blocking status only if User model is role based user
if ($this->user instanceof User) {
return $this->user->blocked;
}
return false;
} | [
"public",
"function",
"isBlocked",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"user",
"(",
")",
"===",
"null",
")",
"{",
"return",
"null",
";",
"}",
"// Check user blocking status only if User model is role based user",
"if",
"(",
"$",
"this",
"->",
"user",
... | Return if current user is blocked
If user is not role based user, then always return false
@return bool|null return NULL if user is not authenticated | [
"Return",
"if",
"current",
"user",
"is",
"blocked"
] | 501c20128f43347a2ca271a53435297f9ef7f567 | https://github.com/vi-kon/laravel-auth/blob/501c20128f43347a2ca271a53435297f9ef7f567/src/ViKon/Auth/Guard.php#L201-L213 |
17,865 | maniaplanet/matchmaking-lobby | MatchMakingLobby/Services/Match.php | Match.addPlayerInTeam | function addPlayerInTeam($login, $teamId)
{
switch($teamId)
{
case 0:
if(array_search($login, $this->team2))
{
throw new \InvalidArgumentException();
}
if(!array_search($login, $this->team1))
{
$this->team1[] = $login;
}
break;
case 1:
if(array_search($login, $this->... | php | function addPlayerInTeam($login, $teamId)
{
switch($teamId)
{
case 0:
if(array_search($login, $this->team2))
{
throw new \InvalidArgumentException();
}
if(!array_search($login, $this->team1))
{
$this->team1[] = $login;
}
break;
case 1:
if(array_search($login, $this->... | [
"function",
"addPlayerInTeam",
"(",
"$",
"login",
",",
"$",
"teamId",
")",
"{",
"switch",
"(",
"$",
"teamId",
")",
"{",
"case",
"0",
":",
"if",
"(",
"array_search",
"(",
"$",
"login",
",",
"$",
"this",
"->",
"team2",
")",
")",
"{",
"throw",
"new",
... | add a login in a team, throw an exception if the login is already teamed or if the team does not exist
@param string $login
@param int $teamId
@throws \InvalidArgumentException | [
"add",
"a",
"login",
"in",
"a",
"team",
"throw",
"an",
"exception",
"if",
"the",
"login",
"is",
"already",
"teamed",
"or",
"if",
"the",
"team",
"does",
"not",
"exist"
] | 384f22cdd2cfb0204a071810549eaf1eb01d8b7f | https://github.com/maniaplanet/matchmaking-lobby/blob/384f22cdd2cfb0204a071810549eaf1eb01d8b7f/MatchMakingLobby/Services/Match.php#L112-L139 |
17,866 | accgit/single-web | src/Single/Configurator.php | Configurator.enableTracy | public function enableTracy($logDirectory = null, $email = null)
{
Tracy\Debugger::$strictMode = true;
Tracy\Debugger::enable($this->mode, $logDirectory, $email);
} | php | public function enableTracy($logDirectory = null, $email = null)
{
Tracy\Debugger::$strictMode = true;
Tracy\Debugger::enable($this->mode, $logDirectory, $email);
} | [
"public",
"function",
"enableTracy",
"(",
"$",
"logDirectory",
"=",
"null",
",",
"$",
"email",
"=",
"null",
")",
"{",
"Tracy",
"\\",
"Debugger",
"::",
"$",
"strictMode",
"=",
"true",
";",
"Tracy",
"\\",
"Debugger",
"::",
"enable",
"(",
"$",
"this",
"->... | Enable Tracy Tools.
@param string $logDirectory
@param string $email | [
"Enable",
"Tracy",
"Tools",
"."
] | 5d0dce3313df9e22ab60749bcf01f1753de8c143 | https://github.com/accgit/single-web/blob/5d0dce3313df9e22ab60749bcf01f1753de8c143/src/Single/Configurator.php#L52-L56 |
17,867 | accgit/single-web | src/Single/Configurator.php | Configurator.createAutoload | public function createAutoload($path)
{
$loader = new Loaders\RobotLoader;
$loader->setCacheStorage(new Caching\Storages\FileStorage($this->temp));
$loader->addDirectory($path)->register();
return $loader;
} | php | public function createAutoload($path)
{
$loader = new Loaders\RobotLoader;
$loader->setCacheStorage(new Caching\Storages\FileStorage($this->temp));
$loader->addDirectory($path)->register();
return $loader;
} | [
"public",
"function",
"createAutoload",
"(",
"$",
"path",
")",
"{",
"$",
"loader",
"=",
"new",
"Loaders",
"\\",
"RobotLoader",
";",
"$",
"loader",
"->",
"setCacheStorage",
"(",
"new",
"Caching",
"\\",
"Storages",
"\\",
"FileStorage",
"(",
"$",
"this",
"->"... | Autoloading classes.
@param string|array $path
@return Loaders\RobotLoader | [
"Autoloading",
"classes",
"."
] | 5d0dce3313df9e22ab60749bcf01f1753de8c143 | https://github.com/accgit/single-web/blob/5d0dce3313df9e22ab60749bcf01f1753de8c143/src/Single/Configurator.php#L63-L69 |
17,868 | qcubed/orm | src/Query/ModelTrait.php | ModelTrait.buildQueryStatement | protected static function buildQueryStatement(
&$objQueryBuilder,
iCondition $objConditions,
$objOptionalClauses,
$mixParameterArray,
$blnCountOnly
) {
// Get the Database Object for this Class
$objDatabase = static::getDatabase();
$strTableName = stat... | php | protected static function buildQueryStatement(
&$objQueryBuilder,
iCondition $objConditions,
$objOptionalClauses,
$mixParameterArray,
$blnCountOnly
) {
// Get the Database Object for this Class
$objDatabase = static::getDatabase();
$strTableName = stat... | [
"protected",
"static",
"function",
"buildQueryStatement",
"(",
"&",
"$",
"objQueryBuilder",
",",
"iCondition",
"$",
"objConditions",
",",
"$",
"objOptionalClauses",
",",
"$",
"mixParameterArray",
",",
"$",
"blnCountOnly",
")",
"{",
"// Get the Database Object for this C... | Takes a query builder object and outputs the sql query that corresponds to its structure and the given parameters.
@param Builder &$objQueryBuilder the QueryBuilder object that will be created
@param iCondition $objConditions any conditions on the query, itself
@param iClause[] $objOptionalClauses additional optional ... | [
"Takes",
"a",
"query",
"builder",
"object",
"and",
"outputs",
"the",
"sql",
"query",
"that",
"corresponds",
"to",
"its",
"structure",
"and",
"the",
"given",
"parameters",
"."
] | f320eba671f20874b1f3809c5293f8c02d5b1204 | https://github.com/qcubed/orm/blob/f320eba671f20874b1f3809c5293f8c02d5b1204/src/Query/ModelTrait.php#L89-L199 |
17,869 | qcubed/orm | src/Query/ModelTrait.php | ModelTrait._QueryArray | protected static function _QueryArray(
iCondition $objConditions,
$objOptionalClauses = null,
$mixParameterArray = null
) {
// Get the Query Statement
try {
$strQuery = static::buildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses,
... | php | protected static function _QueryArray(
iCondition $objConditions,
$objOptionalClauses = null,
$mixParameterArray = null
) {
// Get the Query Statement
try {
$strQuery = static::buildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses,
... | [
"protected",
"static",
"function",
"_QueryArray",
"(",
"iCondition",
"$",
"objConditions",
",",
"$",
"objOptionalClauses",
"=",
"null",
",",
"$",
"mixParameterArray",
"=",
"null",
")",
"{",
"// Get the Query Statement",
"try",
"{",
"$",
"strQuery",
"=",
"static",
... | Static Qcubed Query method to query for an array of objects.
Uses BuildQueryStatment to perform most of the work.
Is called by QueryArray function of each object so that the correct return type will be put in the comments.
@param iCondition $objConditions any conditions on the query, itself
@param iClause[]|null $objO... | [
"Static",
"Qcubed",
"Query",
"method",
"to",
"query",
"for",
"an",
"array",
"of",
"objects",
".",
"Uses",
"BuildQueryStatment",
"to",
"perform",
"most",
"of",
"the",
"work",
".",
"Is",
"called",
"by",
"QueryArray",
"function",
"of",
"each",
"object",
"so",
... | f320eba671f20874b1f3809c5293f8c02d5b1204 | https://github.com/qcubed/orm/blob/f320eba671f20874b1f3809c5293f8c02d5b1204/src/Query/ModelTrait.php#L274-L292 |
17,870 | qcubed/orm | src/Query/ModelTrait.php | ModelTrait.queryCursor | public static function queryCursor(iCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null)
{
// Get the query statement
try {
$strQuery = static::buildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses,
$mixParameterArray, false... | php | public static function queryCursor(iCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null)
{
// Get the query statement
try {
$strQuery = static::buildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses,
$mixParameterArray, false... | [
"public",
"static",
"function",
"queryCursor",
"(",
"iCondition",
"$",
"objConditions",
",",
"$",
"objOptionalClauses",
"=",
"null",
",",
"$",
"mixParameterArray",
"=",
"null",
")",
"{",
"// Get the query statement",
"try",
"{",
"$",
"strQuery",
"=",
"static",
"... | Static Qcubed query method to issue a query and get a cursor to progressively fetch its results.
Uses BuildQueryStatment to perform most of the work.
@param iCondition $objConditions any conditions on the query, itself
@param iClause[] $objOptionalClauses additional optional iClause objects for this query
@param mixed... | [
"Static",
"Qcubed",
"query",
"method",
"to",
"issue",
"a",
"query",
"and",
"get",
"a",
"cursor",
"to",
"progressively",
"fetch",
"its",
"results",
".",
"Uses",
"BuildQueryStatment",
"to",
"perform",
"most",
"of",
"the",
"work",
"."
] | f320eba671f20874b1f3809c5293f8c02d5b1204 | https://github.com/qcubed/orm/blob/f320eba671f20874b1f3809c5293f8c02d5b1204/src/Query/ModelTrait.php#L305-L328 |
17,871 | qcubed/orm | src/Query/ModelTrait.php | ModelTrait.queryCount | public static function queryCount(iCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null)
{
// Get the Query Statement
try {
$strQuery = static::buildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses,
$mixParameterArray, true);... | php | public static function queryCount(iCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null)
{
// Get the Query Statement
try {
$strQuery = static::buildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses,
$mixParameterArray, true);... | [
"public",
"static",
"function",
"queryCount",
"(",
"iCondition",
"$",
"objConditions",
",",
"$",
"objOptionalClauses",
"=",
"null",
",",
"$",
"mixParameterArray",
"=",
"null",
")",
"{",
"// Get the Query Statement",
"try",
"{",
"$",
"strQuery",
"=",
"static",
":... | Static Qcubed Query method to query for a count of objects.
Uses BuildQueryStatment to perform most of the work.
@param iCondition $objConditions any conditions on the query, itself
@param iClause[] $objOptionalClauses additional optional iClause objects for this query
@param mixed[] $mixParameterArray a array of name... | [
"Static",
"Qcubed",
"Query",
"method",
"to",
"query",
"for",
"a",
"count",
"of",
"objects",
".",
"Uses",
"BuildQueryStatment",
"to",
"perform",
"most",
"of",
"the",
"work",
"."
] | f320eba671f20874b1f3809c5293f8c02d5b1204 | https://github.com/qcubed/orm/blob/f320eba671f20874b1f3809c5293f8c02d5b1204/src/Query/ModelTrait.php#L340-L384 |
17,872 | qcubed/orm | src/Query/ModelTrait.php | ModelTrait.expandArray | public static function expandArray(
$objDbRow,
$strAliasPrefix,
$objNode,
$objPreviousItemArray,
$strColumnAliasArray
) {
if (!$objNode->ChildNodeArray) {
return null;
}
$blnExpanded = null;
$pk = static::getRowPrimaryKey($objDbRow... | php | public static function expandArray(
$objDbRow,
$strAliasPrefix,
$objNode,
$objPreviousItemArray,
$strColumnAliasArray
) {
if (!$objNode->ChildNodeArray) {
return null;
}
$blnExpanded = null;
$pk = static::getRowPrimaryKey($objDbRow... | [
"public",
"static",
"function",
"expandArray",
"(",
"$",
"objDbRow",
",",
"$",
"strAliasPrefix",
",",
"$",
"objNode",
",",
"$",
"objPreviousItemArray",
",",
"$",
"strColumnAliasArray",
")",
"{",
"if",
"(",
"!",
"$",
"objNode",
"->",
"ChildNodeArray",
")",
"{... | Do a possible array expansion on the given node. If the node is an ExpandAsArray node,
it will add to the corresponding array in the object. Otherwise, it will follow the node
so that any leaf expansions can be handled.
@param \QCubed\Database\RowBase $objDbRow
@param string $strAliasPrefix
@param Node\NodeBase $objNo... | [
"Do",
"a",
"possible",
"array",
"expansion",
"on",
"the",
"given",
"node",
".",
"If",
"the",
"node",
"is",
"an",
"ExpandAsArray",
"node",
"it",
"will",
"add",
"to",
"the",
"corresponding",
"array",
"in",
"the",
"object",
".",
"Otherwise",
"it",
"will",
"... | f320eba671f20874b1f3809c5293f8c02d5b1204 | https://github.com/qcubed/orm/blob/f320eba671f20874b1f3809c5293f8c02d5b1204/src/Query/ModelTrait.php#L416-L498 |
17,873 | flipboxstudio/orm-manager | src/Flipbox/OrmManager/DatabaseConnection.php | DatabaseConnection.getTableFields | protected function getTableFields(Table $table)
{
$fileds = [];
foreach ($table->getColumns() as $column) {
$fileds[] = [
'name' => $column->getName(),
'type' => $column->getType()->getName(),
'not_null' => $column->getNotnull(),
'length' => $column->getLengt... | php | protected function getTableFields(Table $table)
{
$fileds = [];
foreach ($table->getColumns() as $column) {
$fileds[] = [
'name' => $column->getName(),
'type' => $column->getType()->getName(),
'not_null' => $column->getNotnull(),
'length' => $column->getLengt... | [
"protected",
"function",
"getTableFields",
"(",
"Table",
"$",
"table",
")",
"{",
"$",
"fileds",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"table",
"->",
"getColumns",
"(",
")",
"as",
"$",
"column",
")",
"{",
"$",
"fileds",
"[",
"]",
"=",
"[",
"'name... | get database fileds
@param Table $table
@return array | [
"get",
"database",
"fileds"
] | 4288426517f53d05177b8729c4ba94c5beca9a98 | https://github.com/flipboxstudio/orm-manager/blob/4288426517f53d05177b8729c4ba94c5beca9a98/src/Flipbox/OrmManager/DatabaseConnection.php#L100-L118 |
17,874 | flipboxstudio/orm-manager | src/Flipbox/OrmManager/DatabaseConnection.php | DatabaseConnection.isPrimaryKey | protected function isPrimaryKey(Table $table, Column $column)
{
if ($table->hasPrimaryKey()) {
$primaryKeys = $table->getPrimaryKey()->getColumns();
return in_array($column->getName(), $primaryKeys);
}
return false;
} | php | protected function isPrimaryKey(Table $table, Column $column)
{
if ($table->hasPrimaryKey()) {
$primaryKeys = $table->getPrimaryKey()->getColumns();
return in_array($column->getName(), $primaryKeys);
}
return false;
} | [
"protected",
"function",
"isPrimaryKey",
"(",
"Table",
"$",
"table",
",",
"Column",
"$",
"column",
")",
"{",
"if",
"(",
"$",
"table",
"->",
"hasPrimaryKey",
"(",
")",
")",
"{",
"$",
"primaryKeys",
"=",
"$",
"table",
"->",
"getPrimaryKey",
"(",
")",
"->... | check is column primary key
@param Table $table
@param Column $column
@return bool | [
"check",
"is",
"column",
"primary",
"key"
] | 4288426517f53d05177b8729c4ba94c5beca9a98 | https://github.com/flipboxstudio/orm-manager/blob/4288426517f53d05177b8729c4ba94c5beca9a98/src/Flipbox/OrmManager/DatabaseConnection.php#L127-L136 |
17,875 | flipboxstudio/orm-manager | src/Flipbox/OrmManager/DatabaseConnection.php | DatabaseConnection.isForeignKey | protected function isForeignKey(Table $table, Column $column)
{
$foreignKey = false;
foreach ($table->getIndexes() as $key => $index) {
if ($key !== 'primary') {
try {
$fkConstrain = $table->getForeignkey($key);
$foreignKey = in_array($column->getName(), $fkConstrain->getColumns());
} catch (... | php | protected function isForeignKey(Table $table, Column $column)
{
$foreignKey = false;
foreach ($table->getIndexes() as $key => $index) {
if ($key !== 'primary') {
try {
$fkConstrain = $table->getForeignkey($key);
$foreignKey = in_array($column->getName(), $fkConstrain->getColumns());
} catch (... | [
"protected",
"function",
"isForeignKey",
"(",
"Table",
"$",
"table",
",",
"Column",
"$",
"column",
")",
"{",
"$",
"foreignKey",
"=",
"false",
";",
"foreach",
"(",
"$",
"table",
"->",
"getIndexes",
"(",
")",
"as",
"$",
"key",
"=>",
"$",
"index",
")",
... | check is column foreign key
@param Table $table
@param Column $column
@return bool | [
"check",
"is",
"column",
"foreign",
"key"
] | 4288426517f53d05177b8729c4ba94c5beca9a98 | https://github.com/flipboxstudio/orm-manager/blob/4288426517f53d05177b8729c4ba94c5beca9a98/src/Flipbox/OrmManager/DatabaseConnection.php#L145-L161 |
17,876 | flipboxstudio/orm-manager | src/Flipbox/OrmManager/DatabaseConnection.php | DatabaseConnection.getFields | public function getFields($table)
{
if (isset($this->tables[$table])) {
return new Collection($this->tables[$table]);
}
} | php | public function getFields($table)
{
if (isset($this->tables[$table])) {
return new Collection($this->tables[$table]);
}
} | [
"public",
"function",
"getFields",
"(",
"$",
"table",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"tables",
"[",
"$",
"table",
"]",
")",
")",
"{",
"return",
"new",
"Collection",
"(",
"$",
"this",
"->",
"tables",
"[",
"$",
"table",
"]",
... | get table fields
@param string $table
@return array | [
"get",
"table",
"fields"
] | 4288426517f53d05177b8729c4ba94c5beca9a98 | https://github.com/flipboxstudio/orm-manager/blob/4288426517f53d05177b8729c4ba94c5beca9a98/src/Flipbox/OrmManager/DatabaseConnection.php#L189-L194 |
17,877 | flipboxstudio/orm-manager | src/Flipbox/OrmManager/DatabaseConnection.php | DatabaseConnection.isFieldExists | public function isFieldExists($table, $field)
{
if (isset($this->tables[$table])) {
$fields = $this->getFields($table);
return $fields->where('name', $field)->count() > 0;
}
return false;
} | php | public function isFieldExists($table, $field)
{
if (isset($this->tables[$table])) {
$fields = $this->getFields($table);
return $fields->where('name', $field)->count() > 0;
}
return false;
} | [
"public",
"function",
"isFieldExists",
"(",
"$",
"table",
",",
"$",
"field",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"tables",
"[",
"$",
"table",
"]",
")",
")",
"{",
"$",
"fields",
"=",
"$",
"this",
"->",
"getFields",
"(",
"$",
"tab... | check is model table exists
@param string $table
@param string $field
@return bool | [
"check",
"is",
"model",
"table",
"exists"
] | 4288426517f53d05177b8729c4ba94c5beca9a98 | https://github.com/flipboxstudio/orm-manager/blob/4288426517f53d05177b8729c4ba94c5beca9a98/src/Flipbox/OrmManager/DatabaseConnection.php#L214-L223 |
17,878 | ARCANEDEV/Sanitizer | src/Filters/UrlFilter.php | UrlFilter.filter | public function filter($value, array $options = [])
{
if ( ! is_string($value)) return $value;
$value = trim($value);
if ( ! Str::startsWith($value, ['http://', 'https://'])) {
$value = "http://$value";
}
return filter_var($value, FILTER_SANITIZE_URL);
} | php | public function filter($value, array $options = [])
{
if ( ! is_string($value)) return $value;
$value = trim($value);
if ( ! Str::startsWith($value, ['http://', 'https://'])) {
$value = "http://$value";
}
return filter_var($value, FILTER_SANITIZE_URL);
} | [
"public",
"function",
"filter",
"(",
"$",
"value",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"value",
")",
")",
"return",
"$",
"value",
";",
"$",
"value",
"=",
"trim",
"(",
"$",
"value",
")",
... | Sanitize url of the given string.
@param mixed $value
@param array $options
@return string|mixed | [
"Sanitize",
"url",
"of",
"the",
"given",
"string",
"."
] | e21990ce6d881366d52a7f4e5040b07cc3ecca96 | https://github.com/ARCANEDEV/Sanitizer/blob/e21990ce6d881366d52a7f4e5040b07cc3ecca96/src/Filters/UrlFilter.php#L26-L37 |
17,879 | amostajo/wordpress-plugin-core | src/psr4/Cache.php | Cache.add | public static function add( $key, $value, $expires )
{
$cache = self::instance();
if ( $cache && $value != null) {
$cache->set( $key, $value, $expires * 60 );
}
} | php | public static function add( $key, $value, $expires )
{
$cache = self::instance();
if ( $cache && $value != null) {
$cache->set( $key, $value, $expires * 60 );
}
} | [
"public",
"static",
"function",
"add",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"expires",
")",
"{",
"$",
"cache",
"=",
"self",
"::",
"instance",
"(",
")",
";",
"if",
"(",
"$",
"cache",
"&&",
"$",
"value",
"!=",
"null",
")",
"{",
"$",
"cac... | Adds a value to cache.
@since 1.0
@param string $key Main plugin object as reference.
@param mixed $value Value to cache.
@param int $expires Expiration time in minutes. | [
"Adds",
"a",
"value",
"to",
"cache",
"."
] | 63aba30b07057df540c3af4dc50b92bd5501d6fd | https://github.com/amostajo/wordpress-plugin-core/blob/63aba30b07057df540c3af4dc50b92bd5501d6fd/src/psr4/Cache.php#L89-L95 |
17,880 | amostajo/wordpress-plugin-core | src/psr4/Cache.php | Cache.has | public static function has( $key )
{
$cache = self::instance();
if ( $cache ) {
return $cache->isExisting( $key );
}
return false;
} | php | public static function has( $key )
{
$cache = self::instance();
if ( $cache ) {
return $cache->isExisting( $key );
}
return false;
} | [
"public",
"static",
"function",
"has",
"(",
"$",
"key",
")",
"{",
"$",
"cache",
"=",
"self",
"::",
"instance",
"(",
")",
";",
"if",
"(",
"$",
"cache",
")",
"{",
"return",
"$",
"cache",
"->",
"isExisting",
"(",
"$",
"key",
")",
";",
"}",
"return",... | Returns flag if a given key has a value in cache or not.
@since 1.0
@param string $key Cache key name.
@return bool | [
"Returns",
"flag",
"if",
"a",
"given",
"key",
"has",
"a",
"value",
"in",
"cache",
"or",
"not",
"."
] | 63aba30b07057df540c3af4dc50b92bd5501d6fd | https://github.com/amostajo/wordpress-plugin-core/blob/63aba30b07057df540c3af4dc50b92bd5501d6fd/src/psr4/Cache.php#L103-L110 |
17,881 | amostajo/wordpress-plugin-core | src/psr4/Cache.php | Cache.remember | public static function remember( $key, $expires, Closure $closure )
{
$cache = self::instance();
if ( $cache ) {
if ( $cache->isExisting( $key ) ) {
return $cache->get( $key );
} else if ( $closure != null ) {
$value = $closure();
$cache->set( $key, $value, $expires * 60 );
return $value;
... | php | public static function remember( $key, $expires, Closure $closure )
{
$cache = self::instance();
if ( $cache ) {
if ( $cache->isExisting( $key ) ) {
return $cache->get( $key );
} else if ( $closure != null ) {
$value = $closure();
$cache->set( $key, $value, $expires * 60 );
return $value;
... | [
"public",
"static",
"function",
"remember",
"(",
"$",
"key",
",",
"$",
"expires",
",",
"Closure",
"$",
"closure",
")",
"{",
"$",
"cache",
"=",
"self",
"::",
"instance",
"(",
")",
";",
"if",
"(",
"$",
"cache",
")",
"{",
"if",
"(",
"$",
"cache",
"-... | Returns the value of a given key.
If it doesn't exist, then the value pass by is returned.
@since 1.0
@param string $key Main plugin object as reference.
@param int $expires Expiration time in minutes.
@param Closure $value Value to cache.
@return mixed | [
"Returns",
"the",
"value",
"of",
"a",
"given",
"key",
".",
"If",
"it",
"doesn",
"t",
"exist",
"then",
"the",
"value",
"pass",
"by",
"is",
"returned",
"."
] | 63aba30b07057df540c3af4dc50b92bd5501d6fd | https://github.com/amostajo/wordpress-plugin-core/blob/63aba30b07057df540c3af4dc50b92bd5501d6fd/src/psr4/Cache.php#L121-L134 |
17,882 | dashifen/wordpress-php7-plugin-boilerplate | src/Controller/AbstractController.php | AbstractController.defineActivationHooks | protected function defineActivationHooks(): void {
$backend = $this->getBackend();
$pluginName = $this->getFilename();
$handlers = ["activate", "deactivate", "uninstall"];
foreach ($handlers as $handler) {
// for each of our handlers, we hook an action handler to our
// backend component. the purpose... | php | protected function defineActivationHooks(): void {
$backend = $this->getBackend();
$pluginName = $this->getFilename();
$handlers = ["activate", "deactivate", "uninstall"];
foreach ($handlers as $handler) {
// for each of our handlers, we hook an action handler to our
// backend component. the purpose... | [
"protected",
"function",
"defineActivationHooks",
"(",
")",
":",
"void",
"{",
"$",
"backend",
"=",
"$",
"this",
"->",
"getBackend",
"(",
")",
";",
"$",
"pluginName",
"=",
"$",
"this",
"->",
"getFilename",
"(",
")",
";",
"$",
"handlers",
"=",
"[",
"\"ac... | Defines hooks using the Backend object for the activate,
deactivate, and uninstall actions of this plugin.
@return void | [
"Defines",
"hooks",
"using",
"the",
"Backend",
"object",
"for",
"the",
"activate",
"deactivate",
"and",
"uninstall",
"actions",
"of",
"this",
"plugin",
"."
] | c7875deb403d311efca72dc3c8beb566972a56cb | https://github.com/dashifen/wordpress-php7-plugin-boilerplate/blob/c7875deb403d311efca72dc3c8beb566972a56cb/src/Controller/AbstractController.php#L115-L129 |
17,883 | nyeholt/silverstripe-external-content | thirdparty/Zend/Feed/Builder.php | Zend_Feed_Builder._createEntries | private function _createEntries(array $data)
{
foreach ($data as $row) {
$mandatories = array('title', 'link', 'description');
foreach ($mandatories as $mandatory) {
if (!isset($row[$mandatory])) {
/**
* @see Zend_Feed_Builder_... | php | private function _createEntries(array $data)
{
foreach ($data as $row) {
$mandatories = array('title', 'link', 'description');
foreach ($mandatories as $mandatory) {
if (!isset($row[$mandatory])) {
/**
* @see Zend_Feed_Builder_... | [
"private",
"function",
"_createEntries",
"(",
"array",
"$",
"data",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"row",
")",
"{",
"$",
"mandatories",
"=",
"array",
"(",
"'title'",
",",
"'link'",
",",
"'description'",
")",
";",
"foreach",
"(",
"$",... | Create the array of article entries
@param array $data
@throws Zend_Feed_Builder_Exception
@return void | [
"Create",
"the",
"array",
"of",
"article",
"entries"
] | 1c6da8c56ef717225ff904e1522aff94ed051601 | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed/Builder.php#L343-L397 |
17,884 | anime-db/world-art-filler-bundle | src/Service/Filler.php | Filler.getAttrAsArray | private function getAttrAsArray(\DOMElement $element)
{
$return = [];
for ($i = 0; $i < $element->attributes->length; ++$i) {
$return[$element->attributes->item($i)->nodeName] = $element->attributes->item($i)->nodeValue;
}
return $return;
} | php | private function getAttrAsArray(\DOMElement $element)
{
$return = [];
for ($i = 0; $i < $element->attributes->length; ++$i) {
$return[$element->attributes->item($i)->nodeName] = $element->attributes->item($i)->nodeValue;
}
return $return;
} | [
"private",
"function",
"getAttrAsArray",
"(",
"\\",
"DOMElement",
"$",
"element",
")",
"{",
"$",
"return",
"=",
"[",
"]",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"element",
"->",
"attributes",
"->",
"length",
";",
"++",
"$",
... | Get element attributes as array.
@param \DOMElement $element
@return array | [
"Get",
"element",
"attributes",
"as",
"array",
"."
] | f2ef4dbd12fe39c18183d1628b5049b8d381e42c | https://github.com/anime-db/world-art-filler-bundle/blob/f2ef4dbd12fe39c18183d1628b5049b8d381e42c/src/Service/Filler.php#L447-L455 |
17,885 | anime-db/world-art-filler-bundle | src/Service/Filler.php | Filler.setCover | private function setCover(Item $item, $id, $type)
{
$item->setCover(self::NAME.'/'.$id.'/1.jpg');
return $this->uploadImage($this->getCoverUrl($id, $type), $item);
} | php | private function setCover(Item $item, $id, $type)
{
$item->setCover(self::NAME.'/'.$id.'/1.jpg');
return $this->uploadImage($this->getCoverUrl($id, $type), $item);
} | [
"private",
"function",
"setCover",
"(",
"Item",
"$",
"item",
",",
"$",
"id",
",",
"$",
"type",
")",
"{",
"$",
"item",
"->",
"setCover",
"(",
"self",
"::",
"NAME",
".",
"'/'",
".",
"$",
"id",
".",
"'/1.jpg'",
")",
";",
"return",
"$",
"this",
"->",... | Get cover from source id.
@param \AnimeDb\Bundle\CatalogBundle\Entity\Item $item
@param string $id
@param string $type
@return bool | [
"Get",
"cover",
"from",
"source",
"id",
"."
] | f2ef4dbd12fe39c18183d1628b5049b8d381e42c | https://github.com/anime-db/world-art-filler-bundle/blob/f2ef4dbd12fe39c18183d1628b5049b8d381e42c/src/Service/Filler.php#L466-L471 |
17,886 | anime-db/world-art-filler-bundle | src/Service/Filler.php | Filler.getGenreByName | private function getGenreByName($name)
{
if (isset($this->genres[$name])) {
return $this->doctrine
->getRepository('AnimeDbCatalogBundle:Genre')
->findOneByName($this->genres[$name]);
}
} | php | private function getGenreByName($name)
{
if (isset($this->genres[$name])) {
return $this->doctrine
->getRepository('AnimeDbCatalogBundle:Genre')
->findOneByName($this->genres[$name]);
}
} | [
"private",
"function",
"getGenreByName",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"genres",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"doctrine",
"->",
"getRepository",
"(",
"'AnimeDbCatalogBundle:G... | Get real genre by name.
@param string $name
@return \AnimeDb\Bundle\CatalogBundle\Entity\Genre|null | [
"Get",
"real",
"genre",
"by",
"name",
"."
] | f2ef4dbd12fe39c18183d1628b5049b8d381e42c | https://github.com/anime-db/world-art-filler-bundle/blob/f2ef4dbd12fe39c18183d1628b5049b8d381e42c/src/Service/Filler.php#L696-L703 |
17,887 | anime-db/world-art-filler-bundle | src/Service/Filler.php | Filler.getTypeByName | private function getTypeByName($name)
{
if (isset($this->types[$name])) {
return $this->doctrine
->getRepository('AnimeDbCatalogBundle:Type')
->find($this->types[$name]);
}
} | php | private function getTypeByName($name)
{
if (isset($this->types[$name])) {
return $this->doctrine
->getRepository('AnimeDbCatalogBundle:Type')
->find($this->types[$name]);
}
} | [
"private",
"function",
"getTypeByName",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"types",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"doctrine",
"->",
"getRepository",
"(",
"'AnimeDbCatalogBundle:Typ... | Get real type by name.
@param string $name
@return \AnimeDb\Bundle\CatalogBundle\Entity\Type|null | [
"Get",
"real",
"type",
"by",
"name",
"."
] | f2ef4dbd12fe39c18183d1628b5049b8d381e42c | https://github.com/anime-db/world-art-filler-bundle/blob/f2ef4dbd12fe39c18183d1628b5049b8d381e42c/src/Service/Filler.php#L712-L719 |
17,888 | anime-db/world-art-filler-bundle | src/Service/Filler.php | Filler.getFrames | public function getFrames($id, $type)
{
$dom = $this->browser->getDom('/'.$type.'/'.$type.'_photos.php?id='.$id);
if (!$dom) {
return [];
}
$images = (new \DOMXPath($dom))->query('//table//table//table//img');
$frames = [];
foreach ($images as $image) {
... | php | public function getFrames($id, $type)
{
$dom = $this->browser->getDom('/'.$type.'/'.$type.'_photos.php?id='.$id);
if (!$dom) {
return [];
}
$images = (new \DOMXPath($dom))->query('//table//table//table//img');
$frames = [];
foreach ($images as $image) {
... | [
"public",
"function",
"getFrames",
"(",
"$",
"id",
",",
"$",
"type",
")",
"{",
"$",
"dom",
"=",
"$",
"this",
"->",
"browser",
"->",
"getDom",
"(",
"'/'",
".",
"$",
"type",
".",
"'/'",
".",
"$",
"type",
".",
"'_photos.php?id='",
".",
"$",
"id",
")... | Get item frames.
@param int $id
@param string $type
@return array | [
"Get",
"item",
"frames",
"."
] | f2ef4dbd12fe39c18183d1628b5049b8d381e42c | https://github.com/anime-db/world-art-filler-bundle/blob/f2ef4dbd12fe39c18183d1628b5049b8d381e42c/src/Service/Filler.php#L729-L761 |
17,889 | anime-db/world-art-filler-bundle | src/Service/Filler.php | Filler.getNodeValueAsText | private function getNodeValueAsText(\DOMNode $node)
{
$text = $node->ownerDocument->saveHTML($node);
$text = str_replace(["<br>\n", "\n", '<br>'], ['<br>', ' ', "\n"], $text);
return trim(strip_tags($text));
} | php | private function getNodeValueAsText(\DOMNode $node)
{
$text = $node->ownerDocument->saveHTML($node);
$text = str_replace(["<br>\n", "\n", '<br>'], ['<br>', ' ', "\n"], $text);
return trim(strip_tags($text));
} | [
"private",
"function",
"getNodeValueAsText",
"(",
"\\",
"DOMNode",
"$",
"node",
")",
"{",
"$",
"text",
"=",
"$",
"node",
"->",
"ownerDocument",
"->",
"saveHTML",
"(",
"$",
"node",
")",
";",
"$",
"text",
"=",
"str_replace",
"(",
"[",
"\"<br>\\n\"",
",",
... | Get node value as text.
@param \DOMNode $node
@return string | [
"Get",
"node",
"value",
"as",
"text",
"."
] | f2ef4dbd12fe39c18183d1628b5049b8d381e42c | https://github.com/anime-db/world-art-filler-bundle/blob/f2ef4dbd12fe39c18183d1628b5049b8d381e42c/src/Service/Filler.php#L770-L776 |
17,890 | anime-db/world-art-filler-bundle | src/Service/Filler.php | Filler.getStudio | private function getStudio(\DOMXPath $xpath, \DOMNode $body)
{
$studios = $xpath->query('//img[starts-with(@src,"http://www.world-art.ru/img/company_new/")]', $body);
if ($studios->length) {
foreach ($studios as $studio) {
$url = $studio->attributes->getNamedItem('src')->... | php | private function getStudio(\DOMXPath $xpath, \DOMNode $body)
{
$studios = $xpath->query('//img[starts-with(@src,"http://www.world-art.ru/img/company_new/")]', $body);
if ($studios->length) {
foreach ($studios as $studio) {
$url = $studio->attributes->getNamedItem('src')->... | [
"private",
"function",
"getStudio",
"(",
"\\",
"DOMXPath",
"$",
"xpath",
",",
"\\",
"DOMNode",
"$",
"body",
")",
"{",
"$",
"studios",
"=",
"$",
"xpath",
"->",
"query",
"(",
"'//img[starts-with(@src,\"http://www.world-art.ru/img/company_new/\")]'",
",",
"$",
"body"... | Get item studio.
@param \DOMXPath $xpath
@param \DOMNode $body
@return \AnimeDb\Bundle\CatalogBundle\Entity\Studio|null | [
"Get",
"item",
"studio",
"."
] | f2ef4dbd12fe39c18183d1628b5049b8d381e42c | https://github.com/anime-db/world-art-filler-bundle/blob/f2ef4dbd12fe39c18183d1628b5049b8d381e42c/src/Service/Filler.php#L786-L799 |
17,891 | anime-db/world-art-filler-bundle | src/Service/Filler.php | Filler.getItemType | public function getItemType($url)
{
if (strpos($url, self::ITEM_TYPE_ANIMATION.'/'.self::ITEM_TYPE_ANIMATION) !== false) {
return self::ITEM_TYPE_ANIMATION;
} elseif (strpos($url, self::ITEM_TYPE_CINEMA.'/'.self::ITEM_TYPE_CINEMA) !== false) {
return self::ITEM_TYPE_CINEMA;
... | php | public function getItemType($url)
{
if (strpos($url, self::ITEM_TYPE_ANIMATION.'/'.self::ITEM_TYPE_ANIMATION) !== false) {
return self::ITEM_TYPE_ANIMATION;
} elseif (strpos($url, self::ITEM_TYPE_CINEMA.'/'.self::ITEM_TYPE_CINEMA) !== false) {
return self::ITEM_TYPE_CINEMA;
... | [
"public",
"function",
"getItemType",
"(",
"$",
"url",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"url",
",",
"self",
"::",
"ITEM_TYPE_ANIMATION",
".",
"'/'",
".",
"self",
"::",
"ITEM_TYPE_ANIMATION",
")",
"!==",
"false",
")",
"{",
"return",
"self",
"::",
... | Get item type by URL.
@param string $url
@return string | [
"Get",
"item",
"type",
"by",
"URL",
"."
] | f2ef4dbd12fe39c18183d1628b5049b8d381e42c | https://github.com/anime-db/world-art-filler-bundle/blob/f2ef4dbd12fe39c18183d1628b5049b8d381e42c/src/Service/Filler.php#L808-L817 |
17,892 | anime-db/world-art-filler-bundle | src/Service/Filler.php | Filler.fillAnimationNames | protected function fillAnimationNames(Item $item, \DOMXPath $xpath, \DOMElement $head)
{
// add main name
$names = $xpath->query('table[1]/tr/td', $head)->item(0)->nodeValue;
$names = explode("\n", trim($names));
// clear
$name = preg_replace('/\[\d{4}\]/', '', array_shift($... | php | protected function fillAnimationNames(Item $item, \DOMXPath $xpath, \DOMElement $head)
{
// add main name
$names = $xpath->query('table[1]/tr/td', $head)->item(0)->nodeValue;
$names = explode("\n", trim($names));
// clear
$name = preg_replace('/\[\d{4}\]/', '', array_shift($... | [
"protected",
"function",
"fillAnimationNames",
"(",
"Item",
"$",
"item",
",",
"\\",
"DOMXPath",
"$",
"xpath",
",",
"\\",
"DOMElement",
"$",
"head",
")",
"{",
"// add main name",
"$",
"names",
"=",
"$",
"xpath",
"->",
"query",
"(",
"'table[1]/tr/td'",
",",
... | Fill names for Animation type.
@param \AnimeDb\Bundle\CatalogBundle\Entity\Item $item
@param \DOMXPath $xpath
@param \DOMElement $head
@return \AnimeDb\Bundle\CatalogBundle\Entity\Item | [
"Fill",
"names",
"for",
"Animation",
"type",
"."
] | f2ef4dbd12fe39c18183d1628b5049b8d381e42c | https://github.com/anime-db/world-art-filler-bundle/blob/f2ef4dbd12fe39c18183d1628b5049b8d381e42c/src/Service/Filler.php#L828-L848 |
17,893 | anime-db/world-art-filler-bundle | src/Service/Filler.php | Filler.getCoverUrl | public function getCoverUrl($id, $type)
{
switch ($type) {
case self::ITEM_TYPE_ANIMATION:
return $this->browser->getHost().'/'.$type.'/img/'.(ceil($id / 1000) * 1000).'/'.$id.'/1.jpg';
case self::ITEM_TYPE_CINEMA:
return $this->browser->getHost().'/'.... | php | public function getCoverUrl($id, $type)
{
switch ($type) {
case self::ITEM_TYPE_ANIMATION:
return $this->browser->getHost().'/'.$type.'/img/'.(ceil($id / 1000) * 1000).'/'.$id.'/1.jpg';
case self::ITEM_TYPE_CINEMA:
return $this->browser->getHost().'/'.... | [
"public",
"function",
"getCoverUrl",
"(",
"$",
"id",
",",
"$",
"type",
")",
"{",
"switch",
"(",
"$",
"type",
")",
"{",
"case",
"self",
"::",
"ITEM_TYPE_ANIMATION",
":",
"return",
"$",
"this",
"->",
"browser",
"->",
"getHost",
"(",
")",
".",
"'/'",
".... | Get cover URL.
@param string $id
@param string $type
@return string|null | [
"Get",
"cover",
"URL",
"."
] | f2ef4dbd12fe39c18183d1628b5049b8d381e42c | https://github.com/anime-db/world-art-filler-bundle/blob/f2ef4dbd12fe39c18183d1628b5049b8d381e42c/src/Service/Filler.php#L890-L900 |
17,894 | EvanDotPro/EdpGithub | src/EdpGithub/Listener/Auth/UrlToken.php | UrlToken.preSend | public function preSend(Event $e)
{
$validator = new NotEmpty();
if (!isset($this->options['tokenOrLogin'])
|| !$validator->isValid($this->options['tokenOrLogin'])
) {
throw new Exception\InvalidArgumentException('You need to set OAuth token!');
}
/*... | php | public function preSend(Event $e)
{
$validator = new NotEmpty();
if (!isset($this->options['tokenOrLogin'])
|| !$validator->isValid($this->options['tokenOrLogin'])
) {
throw new Exception\InvalidArgumentException('You need to set OAuth token!');
}
/*... | [
"public",
"function",
"preSend",
"(",
"Event",
"$",
"e",
")",
"{",
"$",
"validator",
"=",
"new",
"NotEmpty",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"options",
"[",
"'tokenOrLogin'",
"]",
")",
"||",
"!",
"$",
"validator",
"-... | Add access token to Request Parameters
@throws Exception\InvalidArgumentException | [
"Add",
"access",
"token",
"to",
"Request",
"Parameters"
] | 51f3e33e02edbef011103e3c2c1629d46af011a3 | https://github.com/EvanDotPro/EdpGithub/blob/51f3e33e02edbef011103e3c2c1629d46af011a3/src/EdpGithub/Listener/Auth/UrlToken.php#L16-L31 |
17,895 | dashifen/wordpress-php7-plugin-boilerplate | src/Controller/ControllerTraits/PostStatusesTrait.php | PostStatusesTrait.initPostStatusesTrait | final protected function initPostStatusesTrait(): void {
$postStatuses = $this->getPostStatuses();
// first, we register our statuses. notice that we directly call the
// WordPress add_action() function because we want to use anonymous
// functions here, and there's no good way to add these actions to a
/... | php | final protected function initPostStatusesTrait(): void {
$postStatuses = $this->getPostStatuses();
// first, we register our statuses. notice that we directly call the
// WordPress add_action() function because we want to use anonymous
// functions here, and there's no good way to add these actions to a
/... | [
"final",
"protected",
"function",
"initPostStatusesTrait",
"(",
")",
":",
"void",
"{",
"$",
"postStatuses",
"=",
"$",
"this",
"->",
"getPostStatuses",
"(",
")",
";",
"// first, we register our statuses. notice that we directly call the",
"// WordPress add_action() function b... | When we initialize this trait, we want to register our post statuses
and ensure that they appear in the status drop-downs throughout Word-
Press core.
@return void | [
"When",
"we",
"initialize",
"this",
"trait",
"we",
"want",
"to",
"register",
"our",
"post",
"statuses",
"and",
"ensure",
"that",
"they",
"appear",
"in",
"the",
"status",
"drop",
"-",
"downs",
"throughout",
"Word",
"-",
"Press",
"core",
"."
] | c7875deb403d311efca72dc3c8beb566972a56cb | https://github.com/dashifen/wordpress-php7-plugin-boilerplate/blob/c7875deb403d311efca72dc3c8beb566972a56cb/src/Controller/ControllerTraits/PostStatusesTrait.php#L38-L171 |
17,896 | ClanCats/Core | src/bundles/Database/Query.php | Query.insert | public static function insert( $table, $values = array(), $handler = null )
{
return Query_Insert::create( $table, $handler )->values( $values );
} | php | public static function insert( $table, $values = array(), $handler = null )
{
return Query_Insert::create( $table, $handler )->values( $values );
} | [
"public",
"static",
"function",
"insert",
"(",
"$",
"table",
",",
"$",
"values",
"=",
"array",
"(",
")",
",",
"$",
"handler",
"=",
"null",
")",
"{",
"return",
"Query_Insert",
"::",
"create",
"(",
"$",
"table",
",",
"$",
"handler",
")",
"->",
"values"... | Create an insert
@param string $table
@param array $values
@param string $handler
@return DB\Query | [
"Create",
"an",
"insert"
] | 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Query.php#L50-L53 |
17,897 | ClanCats/Core | src/bundles/Database/Query.php | Query.or_where | public function or_where( $column, $param1 = null, $param2 = null )
{
return $this->where( $column, $param1, $param2, 'or' );
} | php | public function or_where( $column, $param1 = null, $param2 = null )
{
return $this->where( $column, $param1, $param2, 'or' );
} | [
"public",
"function",
"or_where",
"(",
"$",
"column",
",",
"$",
"param1",
"=",
"null",
",",
"$",
"param2",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"where",
"(",
"$",
"column",
",",
"$",
"param1",
",",
"$",
"param2",
",",
"'or'",
")",
... | Create an or where statement
This is the same as the normal where just with a fixed type
@param string $column The SQL column
@param mixed $param1
@param mixed $param2
@return self | [
"Create",
"an",
"or",
"where",
"statement"
] | 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Query.php#L237-L240 |
17,898 | aedart/laravel-helpers | src/Traits/Logging/LogManagerTrait.php | LogManagerTrait.getLogManager | public function getLogManager(): ?LogManager
{
if (!$this->hasLogManager()) {
$this->setLogManager($this->getDefaultLogManager());
}
return $this->logManager;
} | php | public function getLogManager(): ?LogManager
{
if (!$this->hasLogManager()) {
$this->setLogManager($this->getDefaultLogManager());
}
return $this->logManager;
} | [
"public",
"function",
"getLogManager",
"(",
")",
":",
"?",
"LogManager",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasLogManager",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setLogManager",
"(",
"$",
"this",
"->",
"getDefaultLogManager",
"(",
")",
")",
";"... | Get log manager
If no log manager has been set, this method will
set and return a default log manager, if any such
value is available
@see getDefaultLogManager()
@return LogManager|null log manager or null if none log manager has been set | [
"Get",
"log",
"manager"
] | 8b81a2d6658f3f8cb62b6be2c34773aaa2df219a | https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Logging/LogManagerTrait.php#L52-L58 |
17,899 | ClanCats/Core | src/classes/CCFinder.php | CCFinder.bundle | public static function bundle( $name, $path = null )
{
static::$bundles[$name] = $path;
static::$namespaces[$name] = $path.CCDIR_CLASS;
} | php | public static function bundle( $name, $path = null )
{
static::$bundles[$name] = $path;
static::$namespaces[$name] = $path.CCDIR_CLASS;
} | [
"public",
"static",
"function",
"bundle",
"(",
"$",
"name",
",",
"$",
"path",
"=",
"null",
")",
"{",
"static",
"::",
"$",
"bundles",
"[",
"$",
"name",
"]",
"=",
"$",
"path",
";",
"static",
"::",
"$",
"namespaces",
"[",
"$",
"name",
"]",
"=",
"$",... | Add a bundle
A bundle is a CCF style package with classes, controllers, views etc.
@param string|array $name
@param path $path
@return void | [
"Add",
"a",
"bundle",
"A",
"bundle",
"is",
"a",
"CCF",
"style",
"package",
"with",
"classes",
"controllers",
"views",
"etc",
"."
] | 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCFinder.php#L68-L72 |
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.