repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
vaniocz/stdlib | src/UniversalJsonSerializer.php | UniversalJsonSerializer.encode | private static function encode($value, SplObjectStorage $objectIds)
{
$encoded = [$value];
array_walk_recursive($encoded, function (&$value) use ($objectIds) {
if (!is_object($value)) {
return;
}
$isReference = isset($objectIds[$value]);
... | php | private static function encode($value, SplObjectStorage $objectIds)
{
$encoded = [$value];
array_walk_recursive($encoded, function (&$value) use ($objectIds) {
if (!is_object($value)) {
return;
}
$isReference = isset($objectIds[$value]);
... | [
"private",
"static",
"function",
"encode",
"(",
"$",
"value",
",",
"SplObjectStorage",
"$",
"objectIds",
")",
"{",
"$",
"encoded",
"=",
"[",
"$",
"value",
"]",
";",
"array_walk_recursive",
"(",
"$",
"encoded",
",",
"function",
"(",
"&",
"$",
"value",
")"... | Encode the given value into a normalized structure.
@param mixed $value The value to be encoded into a normalized structure.
@param SplObjectStorage $objectIds The set of IDs of all currently processed objects.
@return mixed The normalized structure. | [
"Encode",
"the",
"given",
"value",
"into",
"a",
"normalized",
"structure",
"."
] | train | https://github.com/vaniocz/stdlib/blob/06a8343c42829d8fdeecad2bb5c30946fbd73e74/src/UniversalJsonSerializer.php#L44-L63 |
vaniocz/stdlib | src/UniversalJsonSerializer.php | UniversalJsonSerializer.objectProperties | private static function objectProperties($object): array
{
if ($object instanceof Serializable) {
return ['$' => $object->serialize()];
}
$class = get_class($object);
$properties = [];
do {
try {
$properties += Closure::bind(function ... | php | private static function objectProperties($object): array
{
if ($object instanceof Serializable) {
return ['$' => $object->serialize()];
}
$class = get_class($object);
$properties = [];
do {
try {
$properties += Closure::bind(function ... | [
"private",
"static",
"function",
"objectProperties",
"(",
"$",
"object",
")",
":",
"array",
"{",
"if",
"(",
"$",
"object",
"instanceof",
"Serializable",
")",
"{",
"return",
"[",
"'$'",
"=>",
"$",
"object",
"->",
"serialize",
"(",
")",
"]",
";",
"}",
"$... | Get array of all the object properties.
@param object $object
@return mixed[] The array of all the object properties. | [
"Get",
"array",
"of",
"all",
"the",
"object",
"properties",
"."
] | train | https://github.com/vaniocz/stdlib/blob/06a8343c42829d8fdeecad2bb5c30946fbd73e74/src/UniversalJsonSerializer.php#L72-L94 |
zhaoxianfang/tools | src/Symfony/Component/DependencyInjection/Compiler/ResolveBindingsPass.php | ResolveBindingsPass.process | public function process(ContainerBuilder $container)
{
try {
parent::process($container);
foreach ($this->unusedBindings as list($key, $serviceId)) {
$message = sprintf('Unused binding "%s" in service "%s".', $key, $serviceId);
if ($this->errorMessage... | php | public function process(ContainerBuilder $container)
{
try {
parent::process($container);
foreach ($this->unusedBindings as list($key, $serviceId)) {
$message = sprintf('Unused binding "%s" in service "%s".', $key, $serviceId);
if ($this->errorMessage... | [
"public",
"function",
"process",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"try",
"{",
"parent",
"::",
"process",
"(",
"$",
"container",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"unusedBindings",
"as",
"list",
"(",
"$",
"key",
",",
"$",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/DependencyInjection/Compiler/ResolveBindingsPass.php#L35-L55 |
phpgears/event-async | src/Discriminator/ArrayEventDiscriminator.php | ArrayEventDiscriminator.shouldEnqueue | public function shouldEnqueue(Event $event): bool
{
return \in_array(\get_class($event), $this->events, true);
} | php | public function shouldEnqueue(Event $event): bool
{
return \in_array(\get_class($event), $this->events, true);
} | [
"public",
"function",
"shouldEnqueue",
"(",
"Event",
"$",
"event",
")",
":",
"bool",
"{",
"return",
"\\",
"in_array",
"(",
"\\",
"get_class",
"(",
"$",
"event",
")",
",",
"$",
"this",
"->",
"events",
",",
"true",
")",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/phpgears/event-async/blob/e2d72b32e8852ec3926636af1c686a7c582b0bca/src/Discriminator/ArrayEventDiscriminator.php#L38-L41 |
zodream/html | src/Dark/Input.php | Input.getColumnsSource | protected static function getColumnsSource($data, $value = 'name', $key = 'id', array $prepend = []) {
if (is_array($value)) {
list($prepend, $value, $key) = [$value, 'name', 'id'];
} elseif (is_array($key)) {
list($prepend, $key) = [$key, 'id'];
}
if (empty($data... | php | protected static function getColumnsSource($data, $value = 'name', $key = 'id', array $prepend = []) {
if (is_array($value)) {
list($prepend, $value, $key) = [$value, 'name', 'id'];
} elseif (is_array($key)) {
list($prepend, $key) = [$key, 'id'];
}
if (empty($data... | [
"protected",
"static",
"function",
"getColumnsSource",
"(",
"$",
"data",
",",
"$",
"value",
"=",
"'name'",
",",
"$",
"key",
"=",
"'id'",
",",
"array",
"$",
"prepend",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",... | 转化为键值对数组
@param array $data
@param string $value
@param string $key
@param array $prepend
@return array|mixed | [
"转化为键值对数组"
] | train | https://github.com/zodream/html/blob/bc21574091380007742bbc5c1c6d78bb87c47896/src/Dark/Input.php#L262-L280 |
wearenolte/wp-acf | src/Acf/Transforms/Repeater.php | Repeater.apply | public static function apply( $field ) {
if ( 'repeater' === $field['type'] && is_array( $field['value'] ) ) {
self::transform_image_fields( $field );
self::transform_to_object( $field );
}
return $field['value'];
} | php | public static function apply( $field ) {
if ( 'repeater' === $field['type'] && is_array( $field['value'] ) ) {
self::transform_image_fields( $field );
self::transform_to_object( $field );
}
return $field['value'];
} | [
"public",
"static",
"function",
"apply",
"(",
"$",
"field",
")",
"{",
"if",
"(",
"'repeater'",
"===",
"$",
"field",
"[",
"'type'",
"]",
"&&",
"is_array",
"(",
"$",
"field",
"[",
"'value'",
"]",
")",
")",
"{",
"self",
"::",
"transform_image_fields",
"("... | Apply the transforms
@param array $field The field.
@return array | [
"Apply",
"the",
"transforms"
] | train | https://github.com/wearenolte/wp-acf/blob/2f5093438d637fa0eca42ad6d10f6b433ec078b2/src/Acf/Transforms/Repeater.php#L17-L25 |
wearenolte/wp-acf | src/Acf/Transforms/Repeater.php | Repeater.transform_image_fields | public static function transform_image_fields( &$field ) {
if ( empty( $field['value'] ) ) {
return $field['value'];
}
foreach ( $field['sub_fields'] as $sub_field ) {
if ( 'image' === $sub_field['type'] && 'id' === $sub_field['return_format'] ) {
foreach ( $field['value'] as $id => $item ) {
$fie... | php | public static function transform_image_fields( &$field ) {
if ( empty( $field['value'] ) ) {
return $field['value'];
}
foreach ( $field['sub_fields'] as $sub_field ) {
if ( 'image' === $sub_field['type'] && 'id' === $sub_field['return_format'] ) {
foreach ( $field['value'] as $id => $item ) {
$fie... | [
"public",
"static",
"function",
"transform_image_fields",
"(",
"&",
"$",
"field",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"field",
"[",
"'value'",
"]",
")",
")",
"{",
"return",
"$",
"field",
"[",
"'value'",
"]",
";",
"}",
"foreach",
"(",
"$",
"field"... | Do the image size transform for an image sub fields.
@param string $field Field.
@return array | [
"Do",
"the",
"image",
"size",
"transform",
"for",
"an",
"image",
"sub",
"fields",
"."
] | train | https://github.com/wearenolte/wp-acf/blob/2f5093438d637fa0eca42ad6d10f6b433ec078b2/src/Acf/Transforms/Repeater.php#L33-L46 |
wearenolte/wp-acf | src/Acf/Transforms/Repeater.php | Repeater.transform_to_object | public static function transform_to_object( &$field ) {
if ( 1 !== count( $field['value'] ) ) {
return $field['value'];
}
$as_array = ! ( 1 === $field['min'] && 1 === $field['max'] );
$as_array = apply_filters( Filter::REPEATER_AS_ARRAY, $as_array, $field );
$field['value'] = $as_array ? $field['value'] ... | php | public static function transform_to_object( &$field ) {
if ( 1 !== count( $field['value'] ) ) {
return $field['value'];
}
$as_array = ! ( 1 === $field['min'] && 1 === $field['max'] );
$as_array = apply_filters( Filter::REPEATER_AS_ARRAY, $as_array, $field );
$field['value'] = $as_array ? $field['value'] ... | [
"public",
"static",
"function",
"transform_to_object",
"(",
"&",
"$",
"field",
")",
"{",
"if",
"(",
"1",
"!==",
"count",
"(",
"$",
"field",
"[",
"'value'",
"]",
")",
")",
"{",
"return",
"$",
"field",
"[",
"'value'",
"]",
";",
"}",
"$",
"as_array",
... | Transform to an object if the filter is set and there is only 1 item.
@param array $field Field.
@return mixed | [
"Transform",
"to",
"an",
"object",
"if",
"the",
"filter",
"is",
"set",
"and",
"there",
"is",
"only",
"1",
"item",
"."
] | train | https://github.com/wearenolte/wp-acf/blob/2f5093438d637fa0eca42ad6d10f6b433ec078b2/src/Acf/Transforms/Repeater.php#L54-L63 |
danielgp/browser-agent-info | source/ArchitecturesCpu.php | ArchiecturesCpu.listOfKnownCpuArchitectures | private function listOfKnownCpuArchitectures()
{
$arc = array_merge($this->listOfCpuArchitecturesX86(), $this->listOfCpuArchitecturesX64());
ksort($arc);
return $arc;
} | php | private function listOfKnownCpuArchitectures()
{
$arc = array_merge($this->listOfCpuArchitecturesX86(), $this->listOfCpuArchitecturesX64());
ksort($arc);
return $arc;
} | [
"private",
"function",
"listOfKnownCpuArchitectures",
"(",
")",
"{",
"$",
"arc",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"listOfCpuArchitecturesX86",
"(",
")",
",",
"$",
"this",
"->",
"listOfCpuArchitecturesX64",
"(",
")",
")",
";",
"ksort",
"(",
"$",
"a... | Holds a list of Known CPU Srchitectures as array
@return array | [
"Holds",
"a",
"list",
"of",
"Known",
"CPU",
"Srchitectures",
"as",
"array"
] | train | https://github.com/danielgp/browser-agent-info/blob/5e4b2c01793ee47ce517be2c799d64abe78d7f8a/source/ArchitecturesCpu.php#L164-L169 |
Soneritics/Database | Soneritics/Database/DatabaseConnection/PDOMySQL.php | PDOMySQL.quote | public function quote($value)
{
if (is_array($value)) {
$result = [];
foreach ($value as $single) {
$result[] = $this->quote($single);
}
return sprintf(
'(%s)',
implode(', ', $result)
);
} els... | php | public function quote($value)
{
if (is_array($value)) {
$result = [];
foreach ($value as $single) {
$result[] = $this->quote($single);
}
return sprintf(
'(%s)',
implode(', ', $result)
);
} els... | [
"public",
"function",
"quote",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"value",
"as",
"$",
"single",
")",
"{",
"$",
"result",
"[",
"]",
"=",
... | Quote a value for use in a query.
@param $value
@return string | [
"Quote",
"a",
"value",
"for",
"use",
"in",
"a",
"query",
"."
] | train | https://github.com/Soneritics/Database/blob/20cb74f2a2ee8d9161d3144b5c061a6da11cd066/Soneritics/Database/DatabaseConnection/PDOMySQL.php#L67-L81 |
Soneritics/Database | Soneritics/Database/DatabaseConnection/PDOMySQL.php | PDOMySQL.query | public function query($query)
{
if (is_subclass_of($query, 'Database\Query\QueryAbstract')) {
return $this->query($this->buildQuery($query));
}
$debug = (new Debug\ExecutedQuery($query))->setBacktrace(debug_backtrace());
$startTime = microtime(true);
try {
... | php | public function query($query)
{
if (is_subclass_of($query, 'Database\Query\QueryAbstract')) {
return $this->query($this->buildQuery($query));
}
$debug = (new Debug\ExecutedQuery($query))->setBacktrace(debug_backtrace());
$startTime = microtime(true);
try {
... | [
"public",
"function",
"query",
"(",
"$",
"query",
")",
"{",
"if",
"(",
"is_subclass_of",
"(",
"$",
"query",
",",
"'Database\\Query\\QueryAbstract'",
")",
")",
"{",
"return",
"$",
"this",
"->",
"query",
"(",
"$",
"this",
"->",
"buildQuery",
"(",
"$",
"que... | Execute a query. The parameter can either be a Query(Abstract) object, or a string containing a full query.
@param $query
@return DatabaseRecord | [
"Execute",
"a",
"query",
".",
"The",
"parameter",
"can",
"either",
"be",
"a",
"Query",
"(",
"Abstract",
")",
"object",
"or",
"a",
"string",
"containing",
"a",
"full",
"query",
"."
] | train | https://github.com/Soneritics/Database/blob/20cb74f2a2ee8d9161d3144b5c061a6da11cd066/Soneritics/Database/DatabaseConnection/PDOMySQL.php#L88-L107 |
miguelibero/meinhof | src/Meinhof/Assetic/DelegatingResourceLoader.php | DelegatingResourceLoader.setLoaders | public function setLoaders(array $loaders)
{
$this->loaders = array();
foreach ($loaders as $type=>$loader) {
if (!$loader instanceof ResourceLoaderInterface) {
throw new \InvalidArgumentException("Not a valid resource loader.");
}
$this->loaders[$... | php | public function setLoaders(array $loaders)
{
$this->loaders = array();
foreach ($loaders as $type=>$loader) {
if (!$loader instanceof ResourceLoaderInterface) {
throw new \InvalidArgumentException("Not a valid resource loader.");
}
$this->loaders[$... | [
"public",
"function",
"setLoaders",
"(",
"array",
"$",
"loaders",
")",
"{",
"$",
"this",
"->",
"loaders",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"loaders",
"as",
"$",
"type",
"=>",
"$",
"loader",
")",
"{",
"if",
"(",
"!",
"$",
"loader",
... | sets the list of available resource loaders
@param array $loaders a list of resource loaders indexed by type | [
"sets",
"the",
"list",
"of",
"available",
"resource",
"loaders"
] | train | https://github.com/miguelibero/meinhof/blob/3a090f08485dc0da3e27463cf349dba374201072/src/Meinhof/Assetic/DelegatingResourceLoader.php#L56-L65 |
miguelibero/meinhof | src/Meinhof/Assetic/DelegatingResourceLoader.php | DelegatingResourceLoader.getLoader | protected function getLoader($type)
{
if (!isset($this->loaders[$type])) {
throw new \InvalidArgumentException("No loader defined for type '${type}'.");
}
return $this->loaders[$type];
} | php | protected function getLoader($type)
{
if (!isset($this->loaders[$type])) {
throw new \InvalidArgumentException("No loader defined for type '${type}'.");
}
return $this->loaders[$type];
} | [
"protected",
"function",
"getLoader",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"loaders",
"[",
"$",
"type",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\"No loader defined for type '${type}'... | Get the resource loader for a given type
@param string $type the resource type
@return ResourceLoaderInterface the resource loader
@throws \InvalidArgumentException if no loader defined for the given type | [
"Get",
"the",
"resource",
"loader",
"for",
"a",
"given",
"type"
] | train | https://github.com/miguelibero/meinhof/blob/3a090f08485dc0da3e27463cf349dba374201072/src/Meinhof/Assetic/DelegatingResourceLoader.php#L87-L94 |
miguelibero/meinhof | src/Meinhof/Assetic/DelegatingResourceLoader.php | DelegatingResourceLoader.getResourceType | protected function getResourceType($name)
{
if (!isset($this->types[$name])) {
$template = $this->parser->parse($name);
if ($template instanceof TemplateReferenceInterface) {
$this->types[$name] = $template->get('engine');
}
}
if (!isset($t... | php | protected function getResourceType($name)
{
if (!isset($this->types[$name])) {
$template = $this->parser->parse($name);
if ($template instanceof TemplateReferenceInterface) {
$this->types[$name] = $template->get('engine');
}
}
if (!isset($t... | [
"protected",
"function",
"getResourceType",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"types",
"[",
"$",
"name",
"]",
")",
")",
"{",
"$",
"template",
"=",
"$",
"this",
"->",
"parser",
"->",
"parse",
"(",
"$",
"n... | Returns the type of a resource
@param string $name the name of the resource
@return string type of the resource
@throws \RuntimeException if the resource could not be loaded | [
"Returns",
"the",
"type",
"of",
"a",
"resource"
] | train | https://github.com/miguelibero/meinhof/blob/3a090f08485dc0da3e27463cf349dba374201072/src/Meinhof/Assetic/DelegatingResourceLoader.php#L104-L117 |
nguyenanhung/my-debug | src/Manager/File.php | File.directoryScanner | public function directoryScanner($path = '', $include = NULL, $exclude = NULL)
{
$scanner = new DirectoryScanner();
if (is_array($include) && !empty($include)) {
foreach ($include as $inc) {
$scanner->addInclude($inc);
}
}
if (is_array($exclude... | php | public function directoryScanner($path = '', $include = NULL, $exclude = NULL)
{
$scanner = new DirectoryScanner();
if (is_array($include) && !empty($include)) {
foreach ($include as $inc) {
$scanner->addInclude($inc);
}
}
if (is_array($exclude... | [
"public",
"function",
"directoryScanner",
"(",
"$",
"path",
"=",
"''",
",",
"$",
"include",
"=",
"NULL",
",",
"$",
"exclude",
"=",
"NULL",
")",
"{",
"$",
"scanner",
"=",
"new",
"DirectoryScanner",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"incl... | Hàm quét thư mục và list ra danh sách các file con
@author: 713uk13m <dev@nguyenanhung.com>
@time : 10/17/18 10:19
@param string $path Đường dẫn thư mục cần quét, VD: /your/to/path
@param null|array $include Mảng dữ liệu chứa các thuộc tính cần quét
@param null|array $exclude Mảng dữ liệu chứa các thuộc tính ... | [
"Hàm",
"quét",
"thư",
"mục",
"và",
"list",
"ra",
"danh",
"sách",
"các",
"file",
"con"
] | train | https://github.com/nguyenanhung/my-debug/blob/9dde293d6c04098ee68858035bd04076874f43d6/src/Manager/File.php#L72-L87 |
nguyenanhung/my-debug | src/Manager/File.php | File.cleanLog | public function cleanLog($path = '', $dayToDel = 3)
{
$getDir = $this->directoryScanner($path, $this->scanInclude, $this->scanExclude);
$result = [];
$result['time'] = date('Y-m-d H:i:s');
$result['listFile'] = [];
foreach ($getDir as $fileName) {
... | php | public function cleanLog($path = '', $dayToDel = 3)
{
$getDir = $this->directoryScanner($path, $this->scanInclude, $this->scanExclude);
$result = [];
$result['time'] = date('Y-m-d H:i:s');
$result['listFile'] = [];
foreach ($getDir as $fileName) {
... | [
"public",
"function",
"cleanLog",
"(",
"$",
"path",
"=",
"''",
",",
"$",
"dayToDel",
"=",
"3",
")",
"{",
"$",
"getDir",
"=",
"$",
"this",
"->",
"directoryScanner",
"(",
"$",
"path",
",",
"$",
"this",
"->",
"scanInclude",
",",
"$",
"this",
"->",
"sc... | Hàm xóa các file Log được chỉ định
@author: 713uk13m <dev@nguyenanhung.com>
@time : 10/17/18 10:21
@param string $path Thư mục cần quét và xóa
@param int $dayToDel Số ngày cần giữ lại file
@return array Mảng thông tin về các file đã xóa
@throws \Exception | [
"Hàm",
"xóa",
"các",
"file",
"Log",
"được",
"chỉ",
"định"
] | train | https://github.com/nguyenanhung/my-debug/blob/9dde293d6c04098ee68858035bd04076874f43d6/src/Manager/File.php#L127-L151 |
nguyenanhung/my-debug | src/Manager/File.php | File.scanAndZip | public function scanAndZip($scanPath = '', $dayToZip = 3, $zipPath = '')
{
$getDir = $this->directoryScanner($scanPath, $this->scanInclude, $this->scanExclude);
if (empty($zipPath)) {
/**
* Nếu không truyền folder đích lưu trữ file Zip
* sẽ Tạo 1 thư mục Con tro... | php | public function scanAndZip($scanPath = '', $dayToZip = 3, $zipPath = '')
{
$getDir = $this->directoryScanner($scanPath, $this->scanInclude, $this->scanExclude);
if (empty($zipPath)) {
/**
* Nếu không truyền folder đích lưu trữ file Zip
* sẽ Tạo 1 thư mục Con tro... | [
"public",
"function",
"scanAndZip",
"(",
"$",
"scanPath",
"=",
"''",
",",
"$",
"dayToZip",
"=",
"3",
",",
"$",
"zipPath",
"=",
"''",
")",
"{",
"$",
"getDir",
"=",
"$",
"this",
"->",
"directoryScanner",
"(",
"$",
"scanPath",
",",
"$",
"this",
"->",
... | Hàm quét thư mục và zip toàn bộ các file thỏa mãn điều kiện
@author: 713uk13m <dev@nguyenanhung.com>
@time : 10/17/18 10:51
@param string $scanPath Thư mục cần quét file và zip
@param int $dayToZip Số ngày bỏ qua không zipm mặc định = 3
@param string $zipPath Thư mục lưu trữ file Zip
@return array Mảng thông ti... | [
"Hàm",
"quét",
"thư",
"mục",
"và",
"zip",
"toàn",
"bộ",
"các",
"file",
"thỏa",
"mãn",
"điều",
"kiện"
] | train | https://github.com/nguyenanhung/my-debug/blob/9dde293d6c04098ee68858035bd04076874f43d6/src/Manager/File.php#L176-L217 |
ekyna/PaymentBundle | Controller/Admin/MethodController.php | MethodController.newAction | public function newAction(Request $request)
{
if ($request->isXmlHttpRequest()) {
throw new NotFoundHttpException('Method creation through XMLHttpRequest is not yet implemented.');
}
$this->isGranted('CREATE');
$context = $this->loadContext($request);
$resource... | php | public function newAction(Request $request)
{
if ($request->isXmlHttpRequest()) {
throw new NotFoundHttpException('Method creation through XMLHttpRequest is not yet implemented.');
}
$this->isGranted('CREATE');
$context = $this->loadContext($request);
$resource... | [
"public",
"function",
"newAction",
"(",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"$",
"request",
"->",
"isXmlHttpRequest",
"(",
")",
")",
"{",
"throw",
"new",
"NotFoundHttpException",
"(",
"'Method creation through XMLHttpRequest is not yet implemented.'",
")",... | {@inheritdoc} | [
"{"
] | train | https://github.com/ekyna/PaymentBundle/blob/1b4f4103b28e3a4f8dbfac2cbd872d728238f4d1/Controller/Admin/MethodController.php#L24-L73 |
praxigento/mobi_mod_downline | Observer/CustomerSaveAfterDataObject/A/GroupSwitch.php | GroupSwitch.registerGroupChange | private function registerGroupChange($custId, $groupIdOld, $groupIdNew)
{
$data = new EChangeGroup();
$data->setCustomerRef($custId);
$data->setGroupOld($groupIdOld);
$data->setGroupNew($groupIdNew);
$dateChanged = $this->hlpDate->getUtcNowForDb();
$data->setDateChang... | php | private function registerGroupChange($custId, $groupIdOld, $groupIdNew)
{
$data = new EChangeGroup();
$data->setCustomerRef($custId);
$data->setGroupOld($groupIdOld);
$data->setGroupNew($groupIdNew);
$dateChanged = $this->hlpDate->getUtcNowForDb();
$data->setDateChang... | [
"private",
"function",
"registerGroupChange",
"(",
"$",
"custId",
",",
"$",
"groupIdOld",
",",
"$",
"groupIdNew",
")",
"{",
"$",
"data",
"=",
"new",
"EChangeGroup",
"(",
")",
";",
"$",
"data",
"->",
"setCustomerRef",
"(",
"$",
"custId",
")",
";",
"$",
... | Save group change event into registry.
@param int $custId
@param int $groupIdOld
@param int $groupIdNew | [
"Save",
"group",
"change",
"event",
"into",
"registry",
"."
] | train | https://github.com/praxigento/mobi_mod_downline/blob/0f3c276dfff1aa029f9fd205ccfc56f207a2e75b/Observer/CustomerSaveAfterDataObject/A/GroupSwitch.php#L65-L74 |
praxigento/mobi_mod_downline | Observer/CustomerSaveAfterDataObject/A/GroupSwitch.php | GroupSwitch.switchDownline | private function switchDownline($custId, $groupIdBefore, $groupIdAfter)
{
$isDowngrade = $this->hlpGroupTrans->isDowngrade($groupIdBefore, $groupIdAfter);
if ($isDowngrade) {
/* we need to switch all customer's children to the customer's parent */
$req = new ASwitchUpRequest(... | php | private function switchDownline($custId, $groupIdBefore, $groupIdAfter)
{
$isDowngrade = $this->hlpGroupTrans->isDowngrade($groupIdBefore, $groupIdAfter);
if ($isDowngrade) {
/* we need to switch all customer's children to the customer's parent */
$req = new ASwitchUpRequest(... | [
"private",
"function",
"switchDownline",
"(",
"$",
"custId",
",",
"$",
"groupIdBefore",
",",
"$",
"groupIdAfter",
")",
"{",
"$",
"isDowngrade",
"=",
"$",
"this",
"->",
"hlpGroupTrans",
"->",
"isDowngrade",
"(",
"$",
"groupIdBefore",
",",
"$",
"groupIdAfter",
... | Change downline on group upgrade/downgrade event.
@param int $custId
@param int $groupIdBefore
@param int $groupIdAfter
@throws \Exception | [
"Change",
"downline",
"on",
"group",
"upgrade",
"/",
"downgrade",
"event",
"."
] | train | https://github.com/praxigento/mobi_mod_downline/blob/0f3c276dfff1aa029f9fd205ccfc56f207a2e75b/Observer/CustomerSaveAfterDataObject/A/GroupSwitch.php#L84-L101 |
Aviogram/Common | src/Hydrator/ByClassMethods.php | ByClassMethods.hydrate | public function hydrate(
$object,
$data,
$recursive = true,
&$remainder = array()
) {
// Object should be an object. Duh makes sense ;)
if (is_object($object) === false) {
$type = gettype($object);
throw new Exception\HydrateFailed(sp... | php | public function hydrate(
$object,
$data,
$recursive = true,
&$remainder = array()
) {
// Object should be an object. Duh makes sense ;)
if (is_object($object) === false) {
$type = gettype($object);
throw new Exception\HydrateFailed(sp... | [
"public",
"function",
"hydrate",
"(",
"$",
"object",
",",
"$",
"data",
",",
"$",
"recursive",
"=",
"true",
",",
"&",
"$",
"remainder",
"=",
"array",
"(",
")",
")",
"{",
"// Object should be an object. Duh makes sense ;)\r",
"if",
"(",
"is_object",
"(",
"$",
... | Hydrate aan array to an object. By default in recursive manner
@param object $object
@param array | ArrayIterator $data
@param boolean $recursive
@param array $remainder Contains the unhydrated values from data not added to the target object
@return object
@throws Exception\HydrateFailed When $object is no object or ... | [
"Hydrate",
"aan",
"array",
"to",
"an",
"object",
".",
"By",
"default",
"in",
"recursive",
"manner"
] | train | https://github.com/Aviogram/Common/blob/bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5/src/Hydrator/ByClassMethods.php#L40-L128 |
Aviogram/Common | src/Hydrator/ByClassMethods.php | ByClassMethods.getSetters | protected function getSetters($object)
{
// Get the current class
$class = get_class($object);
// Check if we have already parsed this class
if (array_key_exists($class, $this->classMethodsCache) === true) {
return $this->classMethodsCache[$class];
}
... | php | protected function getSetters($object)
{
// Get the current class
$class = get_class($object);
// Check if we have already parsed this class
if (array_key_exists($class, $this->classMethodsCache) === true) {
return $this->classMethodsCache[$class];
}
... | [
"protected",
"function",
"getSetters",
"(",
"$",
"object",
")",
"{",
"// Get the current class\r",
"$",
"class",
"=",
"get_class",
"(",
"$",
"object",
")",
";",
"// Check if we have already parsed this class\r",
"if",
"(",
"array_key_exists",
"(",
"$",
"class",
",",... | Get the setters of an object
@param mixed $object
@return Collection\Method | [
"Get",
"the",
"setters",
"of",
"an",
"object"
] | train | https://github.com/Aviogram/Common/blob/bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5/src/Hydrator/ByClassMethods.php#L136-L221 |
geoffadams/bedrest-core | library/BedRest/Content/Negotiation/Negotiator.php | Negotiator.setSupportedMediaTypes | public function setSupportedMediaTypes(array $mediaTypes)
{
foreach ($mediaTypes as $mediaType => $converterClass) {
if (!is_string($mediaType)) {
throw new Exception('Media type must be a string.');
}
if (!is_string($converterClass)) {
th... | php | public function setSupportedMediaTypes(array $mediaTypes)
{
foreach ($mediaTypes as $mediaType => $converterClass) {
if (!is_string($mediaType)) {
throw new Exception('Media type must be a string.');
}
if (!is_string($converterClass)) {
th... | [
"public",
"function",
"setSupportedMediaTypes",
"(",
"array",
"$",
"mediaTypes",
")",
"{",
"foreach",
"(",
"$",
"mediaTypes",
"as",
"$",
"mediaType",
"=>",
"$",
"converterClass",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"mediaType",
")",
")",
"{",
... | Sets the list of supported media types for negotiation.
@param array $mediaTypes
@throws \BedRest\Content\Negotiation\Exception | [
"Sets",
"the",
"list",
"of",
"supported",
"media",
"types",
"for",
"negotiation",
"."
] | train | https://github.com/geoffadams/bedrest-core/blob/a77bf8b7492dfbfb720b201f7ec91a4f03417b5c/library/BedRest/Content/Negotiation/Negotiator.php#L54-L67 |
geoffadams/bedrest-core | library/BedRest/Content/Negotiation/Negotiator.php | Negotiator.negotiate | public function negotiate($content, MediaTypeList $mediaTypeList)
{
$contentType = $mediaTypeList->getBestMatch(array_keys($this->supportedMediaTypes));
if (!$contentType) {
throw new Exception('A suitable Content-Type could not be found.');
}
$result = new NegotiatedRes... | php | public function negotiate($content, MediaTypeList $mediaTypeList)
{
$contentType = $mediaTypeList->getBestMatch(array_keys($this->supportedMediaTypes));
if (!$contentType) {
throw new Exception('A suitable Content-Type could not be found.');
}
$result = new NegotiatedRes... | [
"public",
"function",
"negotiate",
"(",
"$",
"content",
",",
"MediaTypeList",
"$",
"mediaTypeList",
")",
"{",
"$",
"contentType",
"=",
"$",
"mediaTypeList",
"->",
"getBestMatch",
"(",
"array_keys",
"(",
"$",
"this",
"->",
"supportedMediaTypes",
")",
")",
";",
... | Negotiates content based on a set of input criteria.
@param mixed $content
@param \BedRest\Content\Negotiation\MediaTypeList $mediaTypeList
@throws \BedRest\Content\Negotiation\Exception
@return \BedRest\Content\Negotiation\NegotiatedResult | [
"Negotiates",
"content",
"based",
"on",
"a",
"set",
"of",
"input",
"criteria",
"."
] | train | https://github.com/geoffadams/bedrest-core/blob/a77bf8b7492dfbfb720b201f7ec91a4f03417b5c/library/BedRest/Content/Negotiation/Negotiator.php#L78-L90 |
geoffadams/bedrest-core | library/BedRest/Content/Negotiation/Negotiator.php | Negotiator.getConverter | protected function getConverter($contentType)
{
if (!isset($this->supportedMediaTypes[$contentType])) {
throw new Exception("No converter found for content type '$contentType'");
}
$converterClass = $this->supportedMediaTypes[$contentType];
return new $converterClass;
... | php | protected function getConverter($contentType)
{
if (!isset($this->supportedMediaTypes[$contentType])) {
throw new Exception("No converter found for content type '$contentType'");
}
$converterClass = $this->supportedMediaTypes[$contentType];
return new $converterClass;
... | [
"protected",
"function",
"getConverter",
"(",
"$",
"contentType",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"supportedMediaTypes",
"[",
"$",
"contentType",
"]",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"\"No converter found for content... | @todo This should use a service locator.
@param string $contentType
@return mixed | [
"@todo",
"This",
"should",
"use",
"a",
"service",
"locator",
"."
] | train | https://github.com/geoffadams/bedrest-core/blob/a77bf8b7492dfbfb720b201f7ec91a4f03417b5c/library/BedRest/Content/Negotiation/Negotiator.php#L99-L108 |
geoffadams/bedrest-core | library/BedRest/Content/Negotiation/Negotiator.php | Negotiator.encode | public function encode($content, $contentType)
{
$converter = $this->getConverter($contentType);
return $converter->encode($content);
} | php | public function encode($content, $contentType)
{
$converter = $this->getConverter($contentType);
return $converter->encode($content);
} | [
"public",
"function",
"encode",
"(",
"$",
"content",
",",
"$",
"contentType",
")",
"{",
"$",
"converter",
"=",
"$",
"this",
"->",
"getConverter",
"(",
"$",
"contentType",
")",
";",
"return",
"$",
"converter",
"->",
"encode",
"(",
"$",
"content",
")",
"... | @param mixed $content
@param string $contentType
@return mixed | [
"@param",
"mixed",
"$content",
"@param",
"string",
"$contentType"
] | train | https://github.com/geoffadams/bedrest-core/blob/a77bf8b7492dfbfb720b201f7ec91a4f03417b5c/library/BedRest/Content/Negotiation/Negotiator.php#L116-L121 |
geoffadams/bedrest-core | library/BedRest/Content/Negotiation/Negotiator.php | Negotiator.decode | public function decode($content, $contentType)
{
$converter = $this->getConverter($contentType);
return $converter->decode($content);
} | php | public function decode($content, $contentType)
{
$converter = $this->getConverter($contentType);
return $converter->decode($content);
} | [
"public",
"function",
"decode",
"(",
"$",
"content",
",",
"$",
"contentType",
")",
"{",
"$",
"converter",
"=",
"$",
"this",
"->",
"getConverter",
"(",
"$",
"contentType",
")",
";",
"return",
"$",
"converter",
"->",
"decode",
"(",
"$",
"content",
")",
"... | @param mixed $content
@param string $contentType
@return mixed | [
"@param",
"mixed",
"$content",
"@param",
"string",
"$contentType"
] | train | https://github.com/geoffadams/bedrest-core/blob/a77bf8b7492dfbfb720b201f7ec91a4f03417b5c/library/BedRest/Content/Negotiation/Negotiator.php#L129-L134 |
fuelphp-storage/security | src/Filter/HtmlEntities.php | HtmlEntities.cleanString | protected function cleanString($input)
{
return htmlentities(
$input,
$this->parent->getConfig('htmlentities_flags', ENT_QUOTES),
$this->parent->getConfig('htmlentities_encoding', 'UTF-8'),
$this->parent->getConfig('htmlentities_double_encode', false)
);
} | php | protected function cleanString($input)
{
return htmlentities(
$input,
$this->parent->getConfig('htmlentities_flags', ENT_QUOTES),
$this->parent->getConfig('htmlentities_encoding', 'UTF-8'),
$this->parent->getConfig('htmlentities_double_encode', false)
);
} | [
"protected",
"function",
"cleanString",
"(",
"$",
"input",
")",
"{",
"return",
"htmlentities",
"(",
"$",
"input",
",",
"$",
"this",
"->",
"parent",
"->",
"getConfig",
"(",
"'htmlentities_flags'",
",",
"ENT_QUOTES",
")",
",",
"$",
"this",
"->",
"parent",
"-... | @param string $input
@return string | [
"@param",
"string",
"$input"
] | train | https://github.com/fuelphp-storage/security/blob/2cad42a8432bc9c9de46486623b71e105ff84b1b/src/Filter/HtmlEntities.php#L25-L33 |
zhaoxianfang/tools | src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php | YamlFileLoader.parseDefinitions | private function parseDefinitions(array $content, $file)
{
if (!isset($content['services'])) {
return;
}
if (!is_array($content['services'])) {
throw new InvalidArgumentException(sprintf('The "services" key should contain an array in %s. Check your YAML syntax.', $fi... | php | private function parseDefinitions(array $content, $file)
{
if (!isset($content['services'])) {
return;
}
if (!is_array($content['services'])) {
throw new InvalidArgumentException(sprintf('The "services" key should contain an array in %s. Check your YAML syntax.', $fi... | [
"private",
"function",
"parseDefinitions",
"(",
"array",
"$",
"content",
",",
"$",
"file",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"content",
"[",
"'services'",
"]",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"is_array",
"(",
"$",
"con... | Parses definitions.
@param array $content
@param string $file | [
"Parses",
"definitions",
"."
] | train | https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php#L206-L241 |
zhaoxianfang/tools | src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php | YamlFileLoader.parseDefaults | private function parseDefaults(array &$content, $file)
{
if (!array_key_exists('_defaults', $content['services'])) {
return array();
}
$defaults = $content['services']['_defaults'];
unset($content['services']['_defaults']);
if (!is_array($defaults)) {
... | php | private function parseDefaults(array &$content, $file)
{
if (!array_key_exists('_defaults', $content['services'])) {
return array();
}
$defaults = $content['services']['_defaults'];
unset($content['services']['_defaults']);
if (!is_array($defaults)) {
... | [
"private",
"function",
"parseDefaults",
"(",
"array",
"&",
"$",
"content",
",",
"$",
"file",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"'_defaults'",
",",
"$",
"content",
"[",
"'services'",
"]",
")",
")",
"{",
"return",
"array",
"(",
")",
";",... | @param array $content
@param string $file
@return array
@throws InvalidArgumentException | [
"@param",
"array",
"$content",
"@param",
"string",
"$file"
] | train | https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php#L251-L306 |
zhaoxianfang/tools | src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php | YamlFileLoader.isUsingShortSyntax | private function isUsingShortSyntax(array $service)
{
foreach ($service as $key => $value) {
if (is_string($key) && ('' === $key || '$' !== $key[0])) {
return false;
}
}
return true;
} | php | private function isUsingShortSyntax(array $service)
{
foreach ($service as $key => $value) {
if (is_string($key) && ('' === $key || '$' !== $key[0])) {
return false;
}
}
return true;
} | [
"private",
"function",
"isUsingShortSyntax",
"(",
"array",
"$",
"service",
")",
"{",
"foreach",
"(",
"$",
"service",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"key",
")",
"&&",
"(",
"''",
"===",
"$",
"key",
"... | @param array $service
@return bool | [
"@param",
"array",
"$service"
] | train | https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php#L313-L322 |
zhaoxianfang/tools | src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php | YamlFileLoader.parseDefinition | private function parseDefinition($id, $service, $file, array $defaults)
{
if (preg_match('/^_[a-zA-Z0-9_]*$/', $id)) {
@trigger_error(sprintf('Service names that start with an underscore are deprecated since Symfony 3.3 and will be reserved in 4.0. Rename the "%s" service or define it in XML ins... | php | private function parseDefinition($id, $service, $file, array $defaults)
{
if (preg_match('/^_[a-zA-Z0-9_]*$/', $id)) {
@trigger_error(sprintf('Service names that start with an underscore are deprecated since Symfony 3.3 and will be reserved in 4.0. Rename the "%s" service or define it in XML ins... | [
"private",
"function",
"parseDefinition",
"(",
"$",
"id",
",",
"$",
"service",
",",
"$",
"file",
",",
"array",
"$",
"defaults",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'/^_[a-zA-Z0-9_]*$/'",
",",
"$",
"id",
")",
")",
"{",
"@",
"trigger_error",
"(",
"s... | Parses a definition.
@param string $id
@param array|string $service
@param string $file
@param array $defaults
@throws InvalidArgumentException When tags are invalid | [
"Parses",
"a",
"definition",
"."
] | train | https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php#L334-L588 |
zhaoxianfang/tools | src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php | YamlFileLoader.loadFile | protected function loadFile($file)
{
if (!class_exists('zxf\Symfony\Component\Yaml\Parser')) {
throw new RuntimeException('Unable to load YAML config files as the Symfony Yaml Component is not installed.');
}
if (!stream_is_local($file)) {
throw new InvalidArgumentEx... | php | protected function loadFile($file)
{
if (!class_exists('zxf\Symfony\Component\Yaml\Parser')) {
throw new RuntimeException('Unable to load YAML config files as the Symfony Yaml Component is not installed.');
}
if (!stream_is_local($file)) {
throw new InvalidArgumentEx... | [
"protected",
"function",
"loadFile",
"(",
"$",
"file",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"'zxf\\Symfony\\Component\\Yaml\\Parser'",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"'Unable to load YAML config files as the Symfony Yaml Component is not i... | Loads a YAML file.
@param string $file
@return array The file content
@throws InvalidArgumentException when the given file is not a local file or when it does not exist | [
"Loads",
"a",
"YAML",
"file",
"."
] | train | https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php#L642-L675 |
zhaoxianfang/tools | src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php | YamlFileLoader.validate | private function validate($content, $file)
{
if (null === $content) {
return $content;
}
if (!is_array($content)) {
throw new InvalidArgumentException(sprintf('The service file "%s" is not valid. It should contain an array. Check your YAML syntax.', $file));
... | php | private function validate($content, $file)
{
if (null === $content) {
return $content;
}
if (!is_array($content)) {
throw new InvalidArgumentException(sprintf('The service file "%s" is not valid. It should contain an array. Check your YAML syntax.', $file));
... | [
"private",
"function",
"validate",
"(",
"$",
"content",
",",
"$",
"file",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"content",
")",
"{",
"return",
"$",
"content",
";",
"}",
"if",
"(",
"!",
"is_array",
"(",
"$",
"content",
")",
")",
"{",
"throw",
"... | Validates a YAML file.
@param mixed $content
@param string $file
@return array
@throws InvalidArgumentException When service file is not valid | [
"Validates",
"a",
"YAML",
"file",
"."
] | train | https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php#L687-L715 |
zhaoxianfang/tools | src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php | YamlFileLoader.resolveServices | private function resolveServices($value, $file, $isParameter = false)
{
if ($value instanceof TaggedValue) {
$argument = $value->getValue();
if ('iterator' === $value->getTag()) {
if (!is_array($argument)) {
throw new InvalidArgumentException(sprin... | php | private function resolveServices($value, $file, $isParameter = false)
{
if ($value instanceof TaggedValue) {
$argument = $value->getValue();
if ('iterator' === $value->getTag()) {
if (!is_array($argument)) {
throw new InvalidArgumentException(sprin... | [
"private",
"function",
"resolveServices",
"(",
"$",
"value",
",",
"$",
"file",
",",
"$",
"isParameter",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"value",
"instanceof",
"TaggedValue",
")",
"{",
"$",
"argument",
"=",
"$",
"value",
"->",
"getValue",
"(",
"... | Resolves services.
@param mixed $value
@param string $file
@param bool $isParameter
@return array|string|Reference|ArgumentInterface | [
"Resolves",
"services",
"."
] | train | https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php#L726-L812 |
zhaoxianfang/tools | src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php | YamlFileLoader.loadFromExtensions | private function loadFromExtensions(array $content)
{
foreach ($content as $namespace => $values) {
if (in_array($namespace, array('imports', 'parameters', 'services'))) {
continue;
}
if (!is_array($values) && null !== $values) {
$values =... | php | private function loadFromExtensions(array $content)
{
foreach ($content as $namespace => $values) {
if (in_array($namespace, array('imports', 'parameters', 'services'))) {
continue;
}
if (!is_array($values) && null !== $values) {
$values =... | [
"private",
"function",
"loadFromExtensions",
"(",
"array",
"$",
"content",
")",
"{",
"foreach",
"(",
"$",
"content",
"as",
"$",
"namespace",
"=>",
"$",
"values",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"namespace",
",",
"array",
"(",
"'imports'",
",",... | Loads from Extensions. | [
"Loads",
"from",
"Extensions",
"."
] | train | https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php#L817-L830 |
zhaoxianfang/tools | src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php | YamlFileLoader.checkDefinition | private function checkDefinition($id, array $definition, $file)
{
if ($throw = $this->isLoadingInstanceof) {
$keywords = self::$instanceofKeywords;
} elseif ($throw = (isset($definition['resource']) || isset($definition['namespace']))) {
$keywords = self::$prototypeKeywords;
... | php | private function checkDefinition($id, array $definition, $file)
{
if ($throw = $this->isLoadingInstanceof) {
$keywords = self::$instanceofKeywords;
} elseif ($throw = (isset($definition['resource']) || isset($definition['namespace']))) {
$keywords = self::$prototypeKeywords;
... | [
"private",
"function",
"checkDefinition",
"(",
"$",
"id",
",",
"array",
"$",
"definition",
",",
"$",
"file",
")",
"{",
"if",
"(",
"$",
"throw",
"=",
"$",
"this",
"->",
"isLoadingInstanceof",
")",
"{",
"$",
"keywords",
"=",
"self",
"::",
"$",
"instanceo... | Checks the keywords used to define a service.
@param string $id The service name
@param array $definition The service definition to check
@param string $file The loaded YAML file | [
"Checks",
"the",
"keywords",
"used",
"to",
"define",
"a",
"service",
"."
] | train | https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php#L839-L858 |
rutger-speksnijder/simpleroute | src/SimpleRoute/Router.php | Router.setUrl | public function setUrl($url)
{
$this->url = $url;
// Check if the url ends with a slash
if ($this->url && substr($this->url, -1) !== '/') {
$this->url .= '/';
}
return $this;
} | php | public function setUrl($url)
{
$this->url = $url;
// Check if the url ends with a slash
if ($this->url && substr($this->url, -1) !== '/') {
$this->url .= '/';
}
return $this;
} | [
"public",
"function",
"setUrl",
"(",
"$",
"url",
")",
"{",
"$",
"this",
"->",
"url",
"=",
"$",
"url",
";",
"// Check if the url ends with a slash",
"if",
"(",
"$",
"this",
"->",
"url",
"&&",
"substr",
"(",
"$",
"this",
"->",
"url",
",",
"-",
"1",
")"... | Sets the request url.
@param string $url The url.
@return $this The current object. | [
"Sets",
"the",
"request",
"url",
"."
] | train | https://github.com/rutger-speksnijder/simpleroute/blob/b862cea540d515e91d2c3a912b53e5e31939695e/src/SimpleRoute/Router.php#L124-L134 |
rutger-speksnijder/simpleroute | src/SimpleRoute/Router.php | Router.add | public function add($route, $callable, $type = 'any')
{
// Check if the route ends with a forward slash
if ($route && substr($route, -1) !== '/') {
$route .= '/';
}
// Add the route
$this->routes[strtolower($type)][$route] = $callable;
return $this;
} | php | public function add($route, $callable, $type = 'any')
{
// Check if the route ends with a forward slash
if ($route && substr($route, -1) !== '/') {
$route .= '/';
}
// Add the route
$this->routes[strtolower($type)][$route] = $callable;
return $this;
} | [
"public",
"function",
"add",
"(",
"$",
"route",
",",
"$",
"callable",
",",
"$",
"type",
"=",
"'any'",
")",
"{",
"// Check if the route ends with a forward slash",
"if",
"(",
"$",
"route",
"&&",
"substr",
"(",
"$",
"route",
",",
"-",
"1",
")",
"!==",
"'/'... | Adds a route to the router.
@param string $route The route.
@param callable $callable The method to execute when this route gets called.
@param string $type The request type to bind this route to.
@return $this The current object. | [
"Adds",
"a",
"route",
"to",
"the",
"router",
"."
] | train | https://github.com/rutger-speksnijder/simpleroute/blob/b862cea540d515e91d2c3a912b53e5e31939695e/src/SimpleRoute/Router.php#L155-L165 |
rutger-speksnijder/simpleroute | src/SimpleRoute/Router.php | Router.remove | public function remove($route, $type = 'any')
{
if (isset($this->routes[$type][$route])) {
unset($this->routes[$type][$route]);
}
return $this;
} | php | public function remove($route, $type = 'any')
{
if (isset($this->routes[$type][$route])) {
unset($this->routes[$type][$route]);
}
return $this;
} | [
"public",
"function",
"remove",
"(",
"$",
"route",
",",
"$",
"type",
"=",
"'any'",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"routes",
"[",
"$",
"type",
"]",
"[",
"$",
"route",
"]",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
... | Removes a route.
@param string $route The route to remove.
@param string $type The request type.
@return \SimpleRoute\Router The current object. | [
"Removes",
"a",
"route",
"."
] | train | https://github.com/rutger-speksnijder/simpleroute/blob/b862cea540d515e91d2c3a912b53e5e31939695e/src/SimpleRoute/Router.php#L259-L265 |
rutger-speksnijder/simpleroute | src/SimpleRoute/Router.php | Router.getMethodsByRoute | public function getMethodsByRoute($route)
{
// Check if a route was provided
if (!$route) {
return [];
}
// Loop through our routes
$methods = [];
foreach ($this->routes as $method => $routes) {
foreach ($routes as $availableRoute => $callable... | php | public function getMethodsByRoute($route)
{
// Check if a route was provided
if (!$route) {
return [];
}
// Loop through our routes
$methods = [];
foreach ($this->routes as $method => $routes) {
foreach ($routes as $availableRoute => $callable... | [
"public",
"function",
"getMethodsByRoute",
"(",
"$",
"route",
")",
"{",
"// Check if a route was provided",
"if",
"(",
"!",
"$",
"route",
")",
"{",
"return",
"[",
"]",
";",
"}",
"// Loop through our routes",
"$",
"methods",
"=",
"[",
"]",
";",
"foreach",
"("... | Returns an array of methods defined for a specific route.
Useful for an "OPTIONS" request.
@param string $route The route to get the methods from.
@return array An array with methods. | [
"Returns",
"an",
"array",
"of",
"methods",
"defined",
"for",
"a",
"specific",
"route",
".",
"Useful",
"for",
"an",
"OPTIONS",
"request",
"."
] | train | https://github.com/rutger-speksnijder/simpleroute/blob/b862cea540d515e91d2c3a912b53e5e31939695e/src/SimpleRoute/Router.php#L275-L303 |
rutger-speksnijder/simpleroute | src/SimpleRoute/Router.php | Router.execute | public function execute()
{
// Check if we have a url
if (!$this->url || trim($this->url) == '') {
$this->url = '/';
}
// Make sure the url starts with a slash
if (substr($this->url, 0, 1) !== '/') {
$this->url = '/' . $this->url;
}
/... | php | public function execute()
{
// Check if we have a url
if (!$this->url || trim($this->url) == '') {
$this->url = '/';
}
// Make sure the url starts with a slash
if (substr($this->url, 0, 1) !== '/') {
$this->url = '/' . $this->url;
}
/... | [
"public",
"function",
"execute",
"(",
")",
"{",
"// Check if we have a url",
"if",
"(",
"!",
"$",
"this",
"->",
"url",
"||",
"trim",
"(",
"$",
"this",
"->",
"url",
")",
"==",
"''",
")",
"{",
"$",
"this",
"->",
"url",
"=",
"'/'",
";",
"}",
"// Make ... | Executes the router based on the url.
@throws Exception Throws an exception if no location was set and no default route was found.
@return mixed The result of the callable method. | [
"Executes",
"the",
"router",
"based",
"on",
"the",
"url",
"."
] | train | https://github.com/rutger-speksnijder/simpleroute/blob/b862cea540d515e91d2c3a912b53e5e31939695e/src/SimpleRoute/Router.php#L312-L363 |
kduma-OSS/L5-permissions | SampleMigrations/2015_01_01_000005_create_and_assign_roles_and_permissions.php | CreateAndAssignRolesAndPermissions.up | public function up()
{
PermissionsManager::createRole('admin', 'Administrator');
PermissionsManager::createRole('user', 'User');
PermissionsManager::createRole('banned', 'Banned user');
PermissionsManager::createPermission('login', 'Allow login');
PermissionsManager::createP... | php | public function up()
{
PermissionsManager::createRole('admin', 'Administrator');
PermissionsManager::createRole('user', 'User');
PermissionsManager::createRole('banned', 'Banned user');
PermissionsManager::createPermission('login', 'Allow login');
PermissionsManager::createP... | [
"public",
"function",
"up",
"(",
")",
"{",
"PermissionsManager",
"::",
"createRole",
"(",
"'admin'",
",",
"'Administrator'",
")",
";",
"PermissionsManager",
"::",
"createRole",
"(",
"'user'",
",",
"'User'",
")",
";",
"PermissionsManager",
"::",
"createRole",
"("... | Run the migrations.
@return void | [
"Run",
"the",
"migrations",
"."
] | train | https://github.com/kduma-OSS/L5-permissions/blob/0e11c1dc1dc083f972cef5a52ced664b7390b054/SampleMigrations/2015_01_01_000005_create_and_assign_roles_and_permissions.php#L12-L30 |
kduma-OSS/L5-permissions | SampleMigrations/2015_01_01_000005_create_and_assign_roles_and_permissions.php | CreateAndAssignRolesAndPermissions.down | public function down()
{
PermissionsManager::deleteRole('admin', 'Administrator');
PermissionsManager::deleteRole('user', 'User');
PermissionsManager::deleteRole('banned', 'Banned user');
PermissionsManager::deletePermission('login', 'Allow login');
PermissionsManager::delet... | php | public function down()
{
PermissionsManager::deleteRole('admin', 'Administrator');
PermissionsManager::deleteRole('user', 'User');
PermissionsManager::deleteRole('banned', 'Banned user');
PermissionsManager::deletePermission('login', 'Allow login');
PermissionsManager::delet... | [
"public",
"function",
"down",
"(",
")",
"{",
"PermissionsManager",
"::",
"deleteRole",
"(",
"'admin'",
",",
"'Administrator'",
")",
";",
"PermissionsManager",
"::",
"deleteRole",
"(",
"'user'",
",",
"'User'",
")",
";",
"PermissionsManager",
"::",
"deleteRole",
"... | Reverse the migrations.
@return void | [
"Reverse",
"the",
"migrations",
"."
] | train | https://github.com/kduma-OSS/L5-permissions/blob/0e11c1dc1dc083f972cef5a52ced664b7390b054/SampleMigrations/2015_01_01_000005_create_and_assign_roles_and_permissions.php#L37-L45 |
Stinger-Soft/DoctrineCommons | src/StingerSoft/DoctrineCommons/Utils/JsonImporter.php | JsonImporter.before | protected function before() {
if($this->connection->getDatabasePlatform() instanceof SQLServerPlatform) {
$this->connection->executeUpdate('EXEC sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all"');
} else if($this->connection->getDatabasePlatform() instanceof MySqlPlatform) {
$this->connection->execute... | php | protected function before() {
if($this->connection->getDatabasePlatform() instanceof SQLServerPlatform) {
$this->connection->executeUpdate('EXEC sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all"');
} else if($this->connection->getDatabasePlatform() instanceof MySqlPlatform) {
$this->connection->execute... | [
"protected",
"function",
"before",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"connection",
"->",
"getDatabasePlatform",
"(",
")",
"instanceof",
"SQLServerPlatform",
")",
"{",
"$",
"this",
"->",
"connection",
"->",
"executeUpdate",
"(",
"'EXEC sp_msforeachtabl... | Executed before the import is started | [
"Executed",
"before",
"the",
"import",
"is",
"started"
] | train | https://github.com/Stinger-Soft/DoctrineCommons/blob/1f0dd56a94654c8de63927d7eec2175aab3cf809/src/StingerSoft/DoctrineCommons/Utils/JsonImporter.php#L132-L140 |
Stinger-Soft/DoctrineCommons | src/StingerSoft/DoctrineCommons/Utils/JsonImporter.php | JsonImporter.after | protected function after() {
if($this->connection->getDatabasePlatform() instanceof SQLServerPlatform) {
$this->connection->executeUpdate('exec sp_msforeachtable "ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all"');
} else if($this->connection->getDatabasePlatform() instanceof MySqlPlatform) {
$this->connection-... | php | protected function after() {
if($this->connection->getDatabasePlatform() instanceof SQLServerPlatform) {
$this->connection->executeUpdate('exec sp_msforeachtable "ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all"');
} else if($this->connection->getDatabasePlatform() instanceof MySqlPlatform) {
$this->connection-... | [
"protected",
"function",
"after",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"connection",
"->",
"getDatabasePlatform",
"(",
")",
"instanceof",
"SQLServerPlatform",
")",
"{",
"$",
"this",
"->",
"connection",
"->",
"executeUpdate",
"(",
"'exec sp_msforeachtable... | Executed after the import is finished | [
"Executed",
"after",
"the",
"import",
"is",
"finished"
] | train | https://github.com/Stinger-Soft/DoctrineCommons/blob/1f0dd56a94654c8de63927d7eec2175aab3cf809/src/StingerSoft/DoctrineCommons/Utils/JsonImporter.php#L145-L153 |
kambalabs/KmbPmProxy | src/KmbPmProxy/Hydrator/GroupHydrator.php | GroupHydrator.hydrate | public function hydrate($puppetModules, $group)
{
$availableClasses = [];
if (!empty($puppetModules)) {
foreach ($puppetModules as $puppetModule) {
if ($puppetModule->hasClasses()) {
foreach ($puppetModule->getClasses() as $puppetClass) {
... | php | public function hydrate($puppetModules, $group)
{
$availableClasses = [];
if (!empty($puppetModules)) {
foreach ($puppetModules as $puppetModule) {
if ($puppetModule->hasClasses()) {
foreach ($puppetModule->getClasses() as $puppetClass) {
... | [
"public",
"function",
"hydrate",
"(",
"$",
"puppetModules",
",",
"$",
"group",
")",
"{",
"$",
"availableClasses",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"puppetModules",
")",
")",
"{",
"foreach",
"(",
"$",
"puppetModules",
"as",
"$",
... | Hydrate group with the provided puppet modules data.
@param PuppetModule[] $puppetModules
@param GroupInterface $group
@return GroupInterface | [
"Hydrate",
"group",
"with",
"the",
"provided",
"puppet",
"modules",
"data",
"."
] | train | https://github.com/kambalabs/KmbPmProxy/blob/b4c664ae8b6f29e4e8768461ed99e1b0b80bde18/src/KmbPmProxy/Hydrator/GroupHydrator.php#L38-L58 |
chanhong/pdolite | src/PdoLite.php | PdoLite.getInstance | public static function getInstance( ) {
if(!self::$objInstance){
self::$options = array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
);
self::$objInstance = new PDO(PDOLITE_DB_DSN, PDOLITE_DB_USER, PDOLITE_DB_PASS, self::$op... | php | public static function getInstance( ) {
if(!self::$objInstance){
self::$options = array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
);
self::$objInstance = new PDO(PDOLITE_DB_DSN, PDOLITE_DB_USER, PDOLITE_DB_PASS, self::$op... | [
"public",
"static",
"function",
"getInstance",
"(",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"$",
"objInstance",
")",
"{",
"self",
"::",
"$",
"options",
"=",
"array",
"(",
"PDO",
"::",
"ATTR_ERRMODE",
"=>",
"PDO",
"::",
"ERRMODE_EXCEPTION",
")",
";",
"s... | /*
Returns DB instance or create initial connection
@param
@return $objInstance; | [
"/",
"*",
"Returns",
"DB",
"instance",
"or",
"create",
"initial",
"connection"
] | train | https://github.com/chanhong/pdolite/blob/93f35e6df25db2f0a03ff8fed751ddac1439b68a/src/PdoLite.php#L55-L66 |
chanhong/pdolite | src/PdoLite.php | PdoLite.backTrace | public static function backTrace() {
$str = "<br />[backTrace]";
foreach (debug_backtrace() as $row) {
$str .= "<br />FILE: "
. $row['file'] . " FUNC: " . $row['function']
. " LINE: " . $row['line'] . " ARGS: "
. print_r($ro... | php | public static function backTrace() {
$str = "<br />[backTrace]";
foreach (debug_backtrace() as $row) {
$str .= "<br />FILE: "
. $row['file'] . " FUNC: " . $row['function']
. " LINE: " . $row['line'] . " ARGS: "
. print_r($ro... | [
"public",
"static",
"function",
"backTrace",
"(",
")",
"{",
"$",
"str",
"=",
"\"<br />[backTrace]\"",
";",
"foreach",
"(",
"debug_backtrace",
"(",
")",
"as",
"$",
"row",
")",
"{",
"$",
"str",
".=",
"\"<br />FILE: \"",
".",
"$",
"row",
"[",
"'file'",
"]",... | /*
Backtrace errors
@param
@return $str; | [
"/",
"*",
"Backtrace",
"errors"
] | train | https://github.com/chanhong/pdolite/blob/93f35e6df25db2f0a03ff8fed751ddac1439b68a/src/PdoLite.php#L95-L105 |
chanhong/pdolite | src/PdoLite.php | PdoLite.dbConnect | public static function dbConnect($dsn, $user="", $passwd="", $options=array()) {
try {
if (!self::$objInstance){
if (!empty($dsn)) {
defined('PDOLITE_DB_DSN') or define('PDOLITE_DB_DSN', $dsn);
defined('PDOLITE_DB_USER') or define('PDOLITE_DB_... | php | public static function dbConnect($dsn, $user="", $passwd="", $options=array()) {
try {
if (!self::$objInstance){
if (!empty($dsn)) {
defined('PDOLITE_DB_DSN') or define('PDOLITE_DB_DSN', $dsn);
defined('PDOLITE_DB_USER') or define('PDOLITE_DB_... | [
"public",
"static",
"function",
"dbConnect",
"(",
"$",
"dsn",
",",
"$",
"user",
"=",
"\"\"",
",",
"$",
"passwd",
"=",
"\"\"",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"self",
"::",
"$",
"objInstance",
")"... | /*
Returns DB instance or create initial connection
@param
@return $objInstance; | [
"/",
"*",
"Returns",
"DB",
"instance",
"or",
"create",
"initial",
"connection"
] | train | https://github.com/chanhong/pdolite/blob/93f35e6df25db2f0a03ff8fed751ddac1439b68a/src/PdoLite.php#L122-L145 |
chanhong/pdolite | src/PdoLite.php | PdoLite.dbQuery | public static function dbQuery($sql) {
try {
return self::query($sql);
} catch (PDOException $e) {
die(self::dbError($sql));
}
} | php | public static function dbQuery($sql) {
try {
return self::query($sql);
} catch (PDOException $e) {
die(self::dbError($sql));
}
} | [
"public",
"static",
"function",
"dbQuery",
"(",
"$",
"sql",
")",
"{",
"try",
"{",
"return",
"self",
"::",
"query",
"(",
"$",
"sql",
")",
";",
"}",
"catch",
"(",
"PDOException",
"$",
"e",
")",
"{",
"die",
"(",
"self",
"::",
"dbError",
"(",
"$",
"s... | /*
alias to PDO query
@param $sql
@return object of rows | [
"/",
"*",
"alias",
"to",
"PDO",
"query"
] | train | https://github.com/chanhong/pdolite/blob/93f35e6df25db2f0a03ff8fed751ddac1439b68a/src/PdoLite.php#L152-L159 |
chanhong/pdolite | src/PdoLite.php | PdoLite.getLastId | public static function getLastId($table, $field) {
try {
$sql = 'SELECT max(' . $field . ') as lastid FROM ' . $table;
list($lastid) = self::dbFetch(self::query($sql), "num"); // cause warning when use assoc array
return (int) $lastid;
} catch (Exception $e) {
... | php | public static function getLastId($table, $field) {
try {
$sql = 'SELECT max(' . $field . ') as lastid FROM ' . $table;
list($lastid) = self::dbFetch(self::query($sql), "num"); // cause warning when use assoc array
return (int) $lastid;
} catch (Exception $e) {
... | [
"public",
"static",
"function",
"getLastId",
"(",
"$",
"table",
",",
"$",
"field",
")",
"{",
"try",
"{",
"$",
"sql",
"=",
"'SELECT max('",
".",
"$",
"field",
".",
"') as lastid FROM '",
".",
"$",
"table",
";",
"list",
"(",
"$",
"lastid",
")",
"=",
"s... | /*
call query and dbFetch num to get lastID
@param $table, $field
@return $integer | [
"/",
"*",
"call",
"query",
"and",
"dbFetch",
"num",
"to",
"get",
"lastID"
] | train | https://github.com/chanhong/pdolite/blob/93f35e6df25db2f0a03ff8fed751ddac1439b68a/src/PdoLite.php#L167-L176 |
chanhong/pdolite | src/PdoLite.php | PdoLite.dbFetch | public static function dbFetch($qhandle, $atype = "assoc") {
try {
if (is_object($qhandle)) {
$type = self::getPDOFetchType($atype);
return $qhandle->fetch($type);
}
} catch (PDOException $e) {
die(self::dbError(__METHOD__));
... | php | public static function dbFetch($qhandle, $atype = "assoc") {
try {
if (is_object($qhandle)) {
$type = self::getPDOFetchType($atype);
return $qhandle->fetch($type);
}
} catch (PDOException $e) {
die(self::dbError(__METHOD__));
... | [
"public",
"static",
"function",
"dbFetch",
"(",
"$",
"qhandle",
",",
"$",
"atype",
"=",
"\"assoc\"",
")",
"{",
"try",
"{",
"if",
"(",
"is_object",
"(",
"$",
"qhandle",
")",
")",
"{",
"$",
"type",
"=",
"self",
"::",
"getPDOFetchType",
"(",
"$",
"atype... | /*
Alias to fetch to use with while ($row = Pdolite::dbFetch($res, "both")) {}
@param $qhandle, $atype (both, assoc or array, num or blank)
@return $array of FETCH_BOTH | [
"/",
"*",
"Alias",
"to",
"fetch",
"to",
"use",
"with",
"while",
"(",
"$row",
"=",
"Pdolite",
"::",
"dbFetch",
"(",
"$res",
"both",
"))",
"{}"
] | train | https://github.com/chanhong/pdolite/blob/93f35e6df25db2f0a03ff8fed751ddac1439b68a/src/PdoLite.php#L213-L223 |
chanhong/pdolite | src/PdoLite.php | PdoLite.dbQ2Array | public static function dbQ2Array($sql, $atype = "assoc", $fetch = "fetch") {
try {
$myrows = array();
$res = self::query($sql);
if (is_object($res)) {
If (strtolower($fetch) == "all") {
$type = self::getPDOFetchType($atype);
... | php | public static function dbQ2Array($sql, $atype = "assoc", $fetch = "fetch") {
try {
$myrows = array();
$res = self::query($sql);
if (is_object($res)) {
If (strtolower($fetch) == "all") {
$type = self::getPDOFetchType($atype);
... | [
"public",
"static",
"function",
"dbQ2Array",
"(",
"$",
"sql",
",",
"$",
"atype",
"=",
"\"assoc\"",
",",
"$",
"fetch",
"=",
"\"fetch\"",
")",
"{",
"try",
"{",
"$",
"myrows",
"=",
"array",
"(",
")",
";",
"$",
"res",
"=",
"self",
"::",
"query",
"(",
... | /*
call query and dbFetch (slower but less memory)
@param $sql $atype
@return nested array of rows | [
"/",
"*",
"call",
"query",
"and",
"dbFetch",
"(",
"slower",
"but",
"less",
"memory",
")"
] | train | https://github.com/chanhong/pdolite/blob/93f35e6df25db2f0a03ff8fed751ddac1439b68a/src/PdoLite.php#L281-L301 |
chanhong/pdolite | src/PdoLite.php | PdoLite.dbQ2ArrayAll | public static function dbQ2ArrayAll($sql, $atype = "assoc") {
try {
$res = self::query($sql);
if (is_object($res)) {
$type = self::getPDOFetchType($atype);
return $res->fetchAll($type);
}
} catch (PDOException $e) {
... | php | public static function dbQ2ArrayAll($sql, $atype = "assoc") {
try {
$res = self::query($sql);
if (is_object($res)) {
$type = self::getPDOFetchType($atype);
return $res->fetchAll($type);
}
} catch (PDOException $e) {
... | [
"public",
"static",
"function",
"dbQ2ArrayAll",
"(",
"$",
"sql",
",",
"$",
"atype",
"=",
"\"assoc\"",
")",
"{",
"try",
"{",
"$",
"res",
"=",
"self",
"::",
"query",
"(",
"$",
"sql",
")",
";",
"if",
"(",
"is_object",
"(",
"$",
"res",
")",
")",
"{",... | /*
call query and fetchAll (faster but more memory)
@param $sql
@return nested array of rows | [
"/",
"*",
"call",
"query",
"and",
"fetchAll",
"(",
"faster",
"but",
"more",
"memory",
")"
] | train | https://github.com/chanhong/pdolite/blob/93f35e6df25db2f0a03ff8fed751ddac1439b68a/src/PdoLite.php#L308-L319 |
chanhong/pdolite | src/PdoLite.php | PdoLite.fieldsKey | public static function fieldsKey($table, $filter="id") {
try {
$row = (array) self::findRow("select * from ".$table, "assoc");
// remove array element base on filter if _none_ no filter
if (strtolower($filter)!="_none_") {
// default is to filter id fie... | php | public static function fieldsKey($table, $filter="id") {
try {
$row = (array) self::findRow("select * from ".$table, "assoc");
// remove array element base on filter if _none_ no filter
if (strtolower($filter)!="_none_") {
// default is to filter id fie... | [
"public",
"static",
"function",
"fieldsKey",
"(",
"$",
"table",
",",
"$",
"filter",
"=",
"\"id\"",
")",
"{",
"try",
"{",
"$",
"row",
"=",
"(",
"array",
")",
"self",
"::",
"findRow",
"(",
"\"select * from \"",
".",
"$",
"table",
",",
"\"assoc\"",
")",
... | /*
get one row from table
@param $table $filter
@return assoc array of fields | [
"/",
"*",
"get",
"one",
"row",
"from",
"table"
] | train | https://github.com/chanhong/pdolite/blob/93f35e6df25db2f0a03ff8fed751ddac1439b68a/src/PdoLite.php#L377-L390 |
chanhong/pdolite | src/PdoLite.php | PdoLite.schema | public static function schema($table, $filter="id") {
try {
return array_flip(self::fieldsKey($table, $filter));
} catch (Exception $e) {
echo $e->getTraceAsString();
}
} | php | public static function schema($table, $filter="id") {
try {
return array_flip(self::fieldsKey($table, $filter));
} catch (Exception $e) {
echo $e->getTraceAsString();
}
} | [
"public",
"static",
"function",
"schema",
"(",
"$",
"table",
",",
"$",
"filter",
"=",
"\"id\"",
")",
"{",
"try",
"{",
"return",
"array_flip",
"(",
"self",
"::",
"fieldsKey",
"(",
"$",
"table",
",",
"$",
"filter",
")",
")",
";",
"}",
"catch",
"(",
"... | /*
flip fields key into array
@param $table $filter
@return assoc array of fields Array ( [name] => 0 [biography] => 1 ) | [
"/",
"*",
"flip",
"fields",
"key",
"into",
"array"
] | train | https://github.com/chanhong/pdolite/blob/93f35e6df25db2f0a03ff8fed751ddac1439b68a/src/PdoLite.php#L397-L404 |
chanhong/pdolite | src/PdoLite.php | PdoLite.aIntersec | public static function aIntersec($iArray, $allowArray = array()) {
try {
$return = $iArray;
// if empty do not filter the array
if (!empty($allowArray)) {
$return = array_intersect_key($iArray, array_flip($allowArray));
}
... | php | public static function aIntersec($iArray, $allowArray = array()) {
try {
$return = $iArray;
// if empty do not filter the array
if (!empty($allowArray)) {
$return = array_intersect_key($iArray, array_flip($allowArray));
}
... | [
"public",
"static",
"function",
"aIntersec",
"(",
"$",
"iArray",
",",
"$",
"allowArray",
"=",
"array",
"(",
")",
")",
"{",
"try",
"{",
"$",
"return",
"=",
"$",
"iArray",
";",
"// if empty do not filter the array\r",
"if",
"(",
"!",
"empty",
"(",
"$",
"al... | /*
get array elements match from both array
@param $iArray, $allowArray
@return assoc array of fields | [
"/",
"*",
"get",
"array",
"elements",
"match",
"from",
"both",
"array"
] | train | https://github.com/chanhong/pdolite/blob/93f35e6df25db2f0a03ff8fed751ddac1439b68a/src/PdoLite.php#L411-L424 |
chanhong/pdolite | src/PdoLite.php | PdoLite.schemaBasedArray | public static function schemaBasedArray($tname, $iArray) {
if (empty($tname) or empty($iArray)) return array();
$fields = self::fieldsKey($tname);
$carray = array_merge(array_flip($fields), $iArray);
return self::aIntersec($carray, $fields);
} | php | public static function schemaBasedArray($tname, $iArray) {
if (empty($tname) or empty($iArray)) return array();
$fields = self::fieldsKey($tname);
$carray = array_merge(array_flip($fields), $iArray);
return self::aIntersec($carray, $fields);
} | [
"public",
"static",
"function",
"schemaBasedArray",
"(",
"$",
"tname",
",",
"$",
"iArray",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"tname",
")",
"or",
"empty",
"(",
"$",
"iArray",
")",
")",
"return",
"array",
"(",
")",
";",
"$",
"fields",
"=",
"sel... | /* filterBySchema might be better, to decide delete this later (TODO)
merge and intersec array with schema
@param table, $array
@return array of assoc | [
"/",
"*",
"filterBySchema",
"might",
"be",
"better",
"to",
"decide",
"delete",
"this",
"later",
"(",
"TODO",
")",
"merge",
"and",
"intersec",
"array",
"with",
"schema"
] | train | https://github.com/chanhong/pdolite/blob/93f35e6df25db2f0a03ff8fed751ddac1439b68a/src/PdoLite.php#L431-L438 |
chanhong/pdolite | src/PdoLite.php | PdoLite.filterBySchema | public static function filterBySchema($tname, $iArray) {
try {
$fields = self::schema($tname,"_none_");
// diff in array with schma fields
$diffs = array_diff_key($iArray, $fields);
// remove unwanted fields
foreach ($diffs as $k=>$v) {
... | php | public static function filterBySchema($tname, $iArray) {
try {
$fields = self::schema($tname,"_none_");
// diff in array with schma fields
$diffs = array_diff_key($iArray, $fields);
// remove unwanted fields
foreach ($diffs as $k=>$v) {
... | [
"public",
"static",
"function",
"filterBySchema",
"(",
"$",
"tname",
",",
"$",
"iArray",
")",
"{",
"try",
"{",
"$",
"fields",
"=",
"self",
"::",
"schema",
"(",
"$",
"tname",
",",
"\"_none_\"",
")",
";",
"// diff in array with schma fields\r",
"$",
"diffs",
... | /*
filter out fields not match schema fields
@param table, $fldArray
@return filtered field Array ( [name] => some name [biography] => some bio ) | [
"/",
"*",
"filter",
"out",
"fields",
"not",
"match",
"schema",
"fields"
] | train | https://github.com/chanhong/pdolite/blob/93f35e6df25db2f0a03ff8fed751ddac1439b68a/src/PdoLite.php#L445-L460 |
chanhong/pdolite | src/PdoLite.php | PdoLite.escapeQuote | public static function escapeQuote($iArray) {
// clean \' into single quote before double it
(!empty($iArray))
? $ret = str_replace("'", "''", str_replace("\'", "'", $iArray))
: $ret = "";
return $ret;
} | php | public static function escapeQuote($iArray) {
// clean \' into single quote before double it
(!empty($iArray))
? $ret = str_replace("'", "''", str_replace("\'", "'", $iArray))
: $ret = "";
return $ret;
} | [
"public",
"static",
"function",
"escapeQuote",
"(",
"$",
"iArray",
")",
"{",
"// clean \\' into single quote before double it\r",
"(",
"!",
"empty",
"(",
"$",
"iArray",
")",
")",
"?",
"$",
"ret",
"=",
"str_replace",
"(",
"\"'\"",
",",
"\"''\"",
",",
"str_repla... | /*
escape quote before insert to database
@param $array
@return string with escape quote | [
"/",
"*",
"escape",
"quote",
"before",
"insert",
"to",
"database"
] | train | https://github.com/chanhong/pdolite/blob/93f35e6df25db2f0a03ff8fed751ddac1439b68a/src/PdoLite.php#L484-L491 |
chanhong/pdolite | src/PdoLite.php | PdoLite.debug | public static function debug($iVar, $iStr = "", $iFormat = "") {
$preText = $dTrace = "";
if (!empty($iStr) and strtolower($iStr) == "dtrace") {
$dTrace = "dtrace";
}
if (!empty($iStr) and strtolower($iStr) <> "dtrace") {
$preText = "[-" . strtoupp... | php | public static function debug($iVar, $iStr = "", $iFormat = "") {
$preText = $dTrace = "";
if (!empty($iStr) and strtolower($iStr) == "dtrace") {
$dTrace = "dtrace";
}
if (!empty($iStr) and strtolower($iStr) <> "dtrace") {
$preText = "[-" . strtoupp... | [
"public",
"static",
"function",
"debug",
"(",
"$",
"iVar",
",",
"$",
"iStr",
"=",
"\"\"",
",",
"$",
"iFormat",
"=",
"\"\"",
")",
"{",
"$",
"preText",
"=",
"$",
"dTrace",
"=",
"\"\"",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"iStr",
")",
"and",
"... | /*
print debug message
@param $ivar $istr $iformat
@return string | [
"/",
"*",
"print",
"debug",
"message"
] | train | https://github.com/chanhong/pdolite/blob/93f35e6df25db2f0a03ff8fed751ddac1439b68a/src/PdoLite.php#L520-L553 |
chanhong/pdolite | src/PdoLite.php | PdoLite.a2sUpdate | public static function a2sUpdate($iArray, $defaultArray = array()) {
$str = "";
// self::pln($iArray,"ns");
while (list($key, $val) = each($iArray)) {
// self::pln(gettype($val),"t=$key");
// override value from $defaultArray value of the same key
if (em... | php | public static function a2sUpdate($iArray, $defaultArray = array()) {
$str = "";
// self::pln($iArray,"ns");
while (list($key, $val) = each($iArray)) {
// self::pln(gettype($val),"t=$key");
// override value from $defaultArray value of the same key
if (em... | [
"public",
"static",
"function",
"a2sUpdate",
"(",
"$",
"iArray",
",",
"$",
"defaultArray",
"=",
"array",
"(",
")",
")",
"{",
"$",
"str",
"=",
"\"\"",
";",
"// self::pln($iArray,\"ns\");\r",
"while",
"(",
"list",
"(",
"$",
"key",
",",
"$",
"val",
"... | /*
array to fields list for sql update
@param $array $checkNumArray
@return string | [
"/",
"*",
"array",
"to",
"fields",
"list",
"for",
"sql",
"update"
] | train | https://github.com/chanhong/pdolite/blob/93f35e6df25db2f0a03ff8fed751ddac1439b68a/src/PdoLite.php#L571-L594 |
chanhong/pdolite | src/PdoLite.php | PdoLite.a2sInsert | public static function a2sInsert($iArray, $defaultArray = array()) {
$nameStr = $valStr = "";
// self::pln($iArray,"ns");
while (list($key, $val) = each($iArray)) {
// self::pln(gettype($val),"t=$key");
// use single quote to work around sqlsrv error
// ov... | php | public static function a2sInsert($iArray, $defaultArray = array()) {
$nameStr = $valStr = "";
// self::pln($iArray,"ns");
while (list($key, $val) = each($iArray)) {
// self::pln(gettype($val),"t=$key");
// use single quote to work around sqlsrv error
// ov... | [
"public",
"static",
"function",
"a2sInsert",
"(",
"$",
"iArray",
",",
"$",
"defaultArray",
"=",
"array",
"(",
")",
")",
"{",
"$",
"nameStr",
"=",
"$",
"valStr",
"=",
"\"\"",
";",
"// self::pln($iArray,\"ns\");\r",
"while",
"(",
"list",
"(",
"$",
"ke... | /*
array to sql insert statement
@param $array
@return string (title, maker) VALUES ("Title","Maker") | [
"/",
"*",
"array",
"to",
"sql",
"insert",
"statement"
] | train | https://github.com/chanhong/pdolite/blob/93f35e6df25db2f0a03ff8fed751ddac1439b68a/src/PdoLite.php#L601-L626 |
chanhong/pdolite | src/PdoLite.php | PdoLite.qbSelect | public static function qbSelect($tname, $options=array()) {
if (empty($tname)) return;
$one = self::getSUDIOptions("select", $tname, $options);
(!empty($one['where']))
? $where = " WHERE " . $one['where']
: $where = "";
... | php | public static function qbSelect($tname, $options=array()) {
if (empty($tname)) return;
$one = self::getSUDIOptions("select", $tname, $options);
(!empty($one['where']))
? $where = " WHERE " . $one['where']
: $where = "";
... | [
"public",
"static",
"function",
"qbSelect",
"(",
"$",
"tname",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"tname",
")",
")",
"return",
";",
"$",
"one",
"=",
"self",
"::",
"getSUDIOptions",
"(",
"\"select\"",
... | /*
build select statement (fieldlist must be already single quote safe)
@param table, $iFldList, $where
@return string | [
"/",
"*",
"build",
"select",
"statement",
"(",
"fieldlist",
"must",
"be",
"already",
"single",
"quote",
"safe",
")"
] | train | https://github.com/chanhong/pdolite/blob/93f35e6df25db2f0a03ff8fed751ddac1439b68a/src/PdoLite.php#L634-L653 |
chanhong/pdolite | src/PdoLite.php | PdoLite.qbInsert | public static function qbInsert($tname, $options) {
if (empty($tname) or empty($options['fl'])) return;
$one = self::getSUDIOptions("insert", $tname, $options);
return "INSERT INTO $tname " . $one['fl'] . ";"
;
} | php | public static function qbInsert($tname, $options) {
if (empty($tname) or empty($options['fl'])) return;
$one = self::getSUDIOptions("insert", $tname, $options);
return "INSERT INTO $tname " . $one['fl'] . ";"
;
} | [
"public",
"static",
"function",
"qbInsert",
"(",
"$",
"tname",
",",
"$",
"options",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"tname",
")",
"or",
"empty",
"(",
"$",
"options",
"[",
"'fl'",
"]",
")",
")",
"return",
";",
"$",
"one",
"=",
"self",
"::"... | /*
build insert statement (fieldlist must be already single quote safe)
@param table, $iFldList
@return string | [
"/",
"*",
"build",
"insert",
"statement",
"(",
"fieldlist",
"must",
"be",
"already",
"single",
"quote",
"safe",
")"
] | train | https://github.com/chanhong/pdolite/blob/93f35e6df25db2f0a03ff8fed751ddac1439b68a/src/PdoLite.php#L660-L666 |
chanhong/pdolite | src/PdoLite.php | PdoLite.qbUpdate | public static function qbUpdate($tname, $options) {
if (empty($tname) or empty($options['fl'])) return;
$one = self::getSUDIOptions("update", $tname, $options);
(!empty($one['where']))
? $where = " WHERE " . $one['where']
: $where = "";
... | php | public static function qbUpdate($tname, $options) {
if (empty($tname) or empty($options['fl'])) return;
$one = self::getSUDIOptions("update", $tname, $options);
(!empty($one['where']))
? $where = " WHERE " . $one['where']
: $where = "";
... | [
"public",
"static",
"function",
"qbUpdate",
"(",
"$",
"tname",
",",
"$",
"options",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"tname",
")",
"or",
"empty",
"(",
"$",
"options",
"[",
"'fl'",
"]",
")",
")",
"return",
";",
"$",
"one",
"=",
"self",
"::"... | /*
build update statement (fieldlist must be already single quote safe)
@param table, $iFldList, $where
@return string | [
"/",
"*",
"build",
"update",
"statement",
"(",
"fieldlist",
"must",
"be",
"already",
"single",
"quote",
"safe",
")"
] | train | https://github.com/chanhong/pdolite/blob/93f35e6df25db2f0a03ff8fed751ddac1439b68a/src/PdoLite.php#L685-L699 |
chanhong/pdolite | src/PdoLite.php | PdoLite.getSUDIOptions | public static function getSUDIOptions($opr, $tname, $options=array()) {
try {
$fldList = "";
$iFldList = self::getKeyVal($options, 'fl');
$where = self::getKeyVal($options, 'where');
$otype = self::getKeyVal($options, 'type');
... | php | public static function getSUDIOptions($opr, $tname, $options=array()) {
try {
$fldList = "";
$iFldList = self::getKeyVal($options, 'fl');
$where = self::getKeyVal($options, 'where');
$otype = self::getKeyVal($options, 'type');
... | [
"public",
"static",
"function",
"getSUDIOptions",
"(",
"$",
"opr",
",",
"$",
"tname",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"try",
"{",
"$",
"fldList",
"=",
"\"\"",
";",
"$",
"iFldList",
"=",
"self",
"::",
"getKeyVal",
"(",
"$",
"o... | /*
get SUDI options
@param table, $iFldList, $where
@return string | [
"/",
"*",
"get",
"SUDI",
"options"
] | train | https://github.com/chanhong/pdolite/blob/93f35e6df25db2f0a03ff8fed751ddac1439b68a/src/PdoLite.php#L707-L747 |
chanhong/pdolite | src/PdoLite.php | PdoLite.select | public static function select($tname, $options=array()) {
try {
$otype = self::getKeyVal($options, 'type', 'assoc');
$all = self::getKeyVal($options, 'all');
$sql = self::qbSelect($tname, $options);
if (strtolower($all)=="all") {
$ret... | php | public static function select($tname, $options=array()) {
try {
$otype = self::getKeyVal($options, 'type', 'assoc');
$all = self::getKeyVal($options, 'all');
$sql = self::qbSelect($tname, $options);
if (strtolower($all)=="all") {
$ret... | [
"public",
"static",
"function",
"select",
"(",
"$",
"tname",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"try",
"{",
"$",
"otype",
"=",
"self",
"::",
"getKeyVal",
"(",
"$",
"options",
",",
"'type'",
",",
"'assoc'",
")",
";",
"$",
"all",
... | /*
select record set
@param table, $options
@return record set of array ['type'] | [
"/",
"*",
"select",
"record",
"set"
] | train | https://github.com/chanhong/pdolite/blob/93f35e6df25db2f0a03ff8fed751ddac1439b68a/src/PdoLite.php#L754-L769 |
chanhong/pdolite | src/PdoLite.php | PdoLite.insert | public static function insert($tname, $options=array()) {
try {
return PdoLite::exec(self::qbInsert($tname, $options));
} catch (PDOException $e) {
die(self::dbError($tname));
}
} | php | public static function insert($tname, $options=array()) {
try {
return PdoLite::exec(self::qbInsert($tname, $options));
} catch (PDOException $e) {
die(self::dbError($tname));
}
} | [
"public",
"static",
"function",
"insert",
"(",
"$",
"tname",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"try",
"{",
"return",
"PdoLite",
"::",
"exec",
"(",
"self",
"::",
"qbInsert",
"(",
"$",
"tname",
",",
"$",
"options",
")",
")",
";",... | /*
insert record
@param table, $options
@return status | [
"/",
"*",
"insert",
"record"
] | train | https://github.com/chanhong/pdolite/blob/93f35e6df25db2f0a03ff8fed751ddac1439b68a/src/PdoLite.php#L776-L783 |
chanhong/pdolite | src/PdoLite.php | PdoLite.delete | public static function delete($tname, $options=array()) {
try {
return PdoLite::exec(self::qbDelete($tname, $options));
} catch (PDOException $e) {
die(self::dbError($tname));
}
} | php | public static function delete($tname, $options=array()) {
try {
return PdoLite::exec(self::qbDelete($tname, $options));
} catch (PDOException $e) {
die(self::dbError($tname));
}
} | [
"public",
"static",
"function",
"delete",
"(",
"$",
"tname",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"try",
"{",
"return",
"PdoLite",
"::",
"exec",
"(",
"self",
"::",
"qbDelete",
"(",
"$",
"tname",
",",
"$",
"options",
")",
")",
";",... | /*
delete record
@param table, $options
@return status | [
"/",
"*",
"delete",
"record"
] | train | https://github.com/chanhong/pdolite/blob/93f35e6df25db2f0a03ff8fed751ddac1439b68a/src/PdoLite.php#L790-L797 |
chanhong/pdolite | src/PdoLite.php | PdoLite.update | public static function update($tname, $options=array()) {
try {
return PdoLite::exec(self::qbUpdate($tname, $options));
} catch (PDOException $e) {
die(self::dbError($tname));
}
} | php | public static function update($tname, $options=array()) {
try {
return PdoLite::exec(self::qbUpdate($tname, $options));
} catch (PDOException $e) {
die(self::dbError($tname));
}
} | [
"public",
"static",
"function",
"update",
"(",
"$",
"tname",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"try",
"{",
"return",
"PdoLite",
"::",
"exec",
"(",
"self",
"::",
"qbUpdate",
"(",
"$",
"tname",
",",
"$",
"options",
")",
")",
";",... | /*
update record
@param table, $options
@return status | [
"/",
"*",
"update",
"record"
] | train | https://github.com/chanhong/pdolite/blob/93f35e6df25db2f0a03ff8fed751ddac1439b68a/src/PdoLite.php#L804-L811 |
chanhong/pdolite | src/PdoLite.php | PdoLite.dbField | public static function dbField($table, $field, $where) {
$fldValue = "";
$row = self::dbRow($table, ['type'=>'num', 'fl'=>$field, 'where'=>$where]);
if (!empty($row)) {
list($fldValue) = $row;
}
return $fldValue;
} | php | public static function dbField($table, $field, $where) {
$fldValue = "";
$row = self::dbRow($table, ['type'=>'num', 'fl'=>$field, 'where'=>$where]);
if (!empty($row)) {
list($fldValue) = $row;
}
return $fldValue;
} | [
"public",
"static",
"function",
"dbField",
"(",
"$",
"table",
",",
"$",
"field",
",",
"$",
"where",
")",
"{",
"$",
"fldValue",
"=",
"\"\"",
";",
"$",
"row",
"=",
"self",
"::",
"dbRow",
"(",
"$",
"table",
",",
"[",
"'type'",
"=>",
"'num'",
",",
"'... | /*
call dbRow to get value of table field
@param $table, $field, $where
@return field value | [
"/",
"*",
"call",
"dbRow",
"to",
"get",
"value",
"of",
"table",
"field"
] | train | https://github.com/chanhong/pdolite/blob/93f35e6df25db2f0a03ff8fed751ddac1439b68a/src/PdoLite.php#L819-L827 |
chanhong/pdolite | src/PdoLite.php | PdoLite.dbRow | public static function dbRow($tname, $options=array()) {
try {
$row = array();
$defArray = ['type'=>'assoc', 'all'=>'all'];
// options array will override the default array
$coptions = array_merge($defArray, $options);
$rows = self::select($tna... | php | public static function dbRow($tname, $options=array()) {
try {
$row = array();
$defArray = ['type'=>'assoc', 'all'=>'all'];
// options array will override the default array
$coptions = array_merge($defArray, $options);
$rows = self::select($tna... | [
"public",
"static",
"function",
"dbRow",
"(",
"$",
"tname",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"try",
"{",
"$",
"row",
"=",
"array",
"(",
")",
";",
"$",
"defArray",
"=",
"[",
"'type'",
"=>",
"'assoc'",
",",
"'all'",
"=>",
"'al... | /*
call select to get one row
@param $table, $field, $where
@return field value | [
"/",
"*",
"call",
"select",
"to",
"get",
"one",
"row"
] | train | https://github.com/chanhong/pdolite/blob/93f35e6df25db2f0a03ff8fed751ddac1439b68a/src/PdoLite.php#L834-L849 |
chanhong/pdolite | src/PdoLite.php | PdoLite.dbtypeSqlStr2Date | public function dbtypeSqlStr2Date($one) {
if (empty($one['fieldname'])) return;
if (empty($one['dbtype'])) {
$one['dbtype'] = "pdo-mysql";
}
if (empty($one['format'])) {
$one['format'] = "%m/%d/%y";
}
switch (s... | php | public function dbtypeSqlStr2Date($one) {
if (empty($one['fieldname'])) return;
if (empty($one['dbtype'])) {
$one['dbtype'] = "pdo-mysql";
}
if (empty($one['format'])) {
$one['format'] = "%m/%d/%y";
}
switch (s... | [
"public",
"function",
"dbtypeSqlStr2Date",
"(",
"$",
"one",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"one",
"[",
"'fieldname'",
"]",
")",
")",
"return",
";",
"if",
"(",
"empty",
"(",
"$",
"one",
"[",
"'dbtype'",
"]",
")",
")",
"{",
"$",
"one",
"["... | /*
get query string for string to date based on dbtype such as 'pdo-mysql' or 'pdo-sqlsrv'
@param array('dbtype'=>'pdo-mysql','fieldname'=>'first', 'format'=>'%d/%d/%y')
@return string
sqlite date string must be in ths format "%Y-%m-%d" such '2017-12-01' then use date between | [
"/",
"*",
"get",
"query",
"string",
"for",
"string",
"to",
"date",
"based",
"on",
"dbtype",
"such",
"as",
"pdo",
"-",
"mysql",
"or",
"pdo",
"-",
"sqlsrv"
] | train | https://github.com/chanhong/pdolite/blob/93f35e6df25db2f0a03ff8fed751ddac1439b68a/src/PdoLite.php#L857-L879 |
chanhong/pdolite | src/PdoLite.php | PdoLite.dbtypeSqlSelectRange | public function dbtypeSqlSelectRange($one) {
if (empty($one['tbl']) or empty($one['where'])) return;
if (empty($one['dbtype'])) {
$one['dbtype'] = "pdo-mysql";
}
if (empty($one['fl'])) {
$one['fl'] = "*";
}
... | php | public function dbtypeSqlSelectRange($one) {
if (empty($one['tbl']) or empty($one['where'])) return;
if (empty($one['dbtype'])) {
$one['dbtype'] = "pdo-mysql";
}
if (empty($one['fl'])) {
$one['fl'] = "*";
}
... | [
"public",
"function",
"dbtypeSqlSelectRange",
"(",
"$",
"one",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"one",
"[",
"'tbl'",
"]",
")",
"or",
"empty",
"(",
"$",
"one",
"[",
"'where'",
"]",
")",
")",
"return",
";",
"if",
"(",
"empty",
"(",
"$",
"one... | /*
get query string for select date range based on dbtype such as 'pdo-mysql' or 'pdo-sqlsrv' MUST have order by in WHERE to work
@param array('dbtype'=>'pdo-mysql','tbl'=>'tname', ,'fl'=>'*', 'where'=>'id=1 order by id', 'start'=>1, 'limit'=>10)
@return string | [
"/",
"*",
"get",
"query",
"string",
"for",
"select",
"date",
"range",
"based",
"on",
"dbtype",
"such",
"as",
"pdo",
"-",
"mysql",
"or",
"pdo",
"-",
"sqlsrv",
"MUST",
"have",
"order",
"by",
"in",
"WHERE",
"to",
"work"
] | train | https://github.com/chanhong/pdolite/blob/93f35e6df25db2f0a03ff8fed751ddac1439b68a/src/PdoLite.php#L886-L931 |
dmitrya2e/filtration-bundle | Manager/FilterSuperManager.php | FilterSuperManager.addFilter | public function addFilter(CollectionInterface $collection, $typeAlias, $name, array $options = [])
{
$filter = $this->filterCreator->create($typeAlias, $name, $options);
$collection->addFilter($filter);
return $filter;
} | php | public function addFilter(CollectionInterface $collection, $typeAlias, $name, array $options = [])
{
$filter = $this->filterCreator->create($typeAlias, $name, $options);
$collection->addFilter($filter);
return $filter;
} | [
"public",
"function",
"addFilter",
"(",
"CollectionInterface",
"$",
"collection",
",",
"$",
"typeAlias",
",",
"$",
"name",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"filter",
"=",
"$",
"this",
"->",
"filterCreator",
"->",
"create",
"(",... | Adds a filter to the collection.
@param CollectionInterface $collection The filter collection
@param string $typeAlias The alias of the filter service definition
@param string $name The internal name of the filter
@param array $options (Optional) The options of the fil... | [
"Adds",
"a",
"filter",
"to",
"the",
"collection",
"."
] | train | https://github.com/dmitrya2e/filtration-bundle/blob/fed5764af4e43871835744fb84957b2a76e9a215/Manager/FilterSuperManager.php#L114-L120 |
dmitrya2e/filtration-bundle | Manager/FilterSuperManager.php | FilterSuperManager.createForm | public function createForm(
CollectionInterface $collection,
array $rootFormBuilderOptions = [],
array $filterFormBuilderOptions = [],
Request $request = null
) {
$form = $this->formCreator->create($collection, $rootFormBuilderOptions, $filterFormBuilderOptions);
if ... | php | public function createForm(
CollectionInterface $collection,
array $rootFormBuilderOptions = [],
array $filterFormBuilderOptions = [],
Request $request = null
) {
$form = $this->formCreator->create($collection, $rootFormBuilderOptions, $filterFormBuilderOptions);
if ... | [
"public",
"function",
"createForm",
"(",
"CollectionInterface",
"$",
"collection",
",",
"array",
"$",
"rootFormBuilderOptions",
"=",
"[",
"]",
",",
"array",
"$",
"filterFormBuilderOptions",
"=",
"[",
"]",
",",
"Request",
"$",
"request",
"=",
"null",
")",
"{",
... | Creates a filtration form (unnamed).
@param CollectionInterface $collection The filter collection
@param array $rootFormBuilderOptions (Optional)
@param array $filterFormBuilderOptions (Optional)
@param Request|null $request (Optional) If passed Reque... | [
"Creates",
"a",
"filtration",
"form",
"(",
"unnamed",
")",
"."
] | train | https://github.com/dmitrya2e/filtration-bundle/blob/fed5764af4e43871835744fb84957b2a76e9a215/Manager/FilterSuperManager.php#L135-L148 |
dmitrya2e/filtration-bundle | Manager/FilterSuperManager.php | FilterSuperManager.createNamedForm | public function createNamedForm(
$name,
CollectionInterface $collection,
array $rootFormBuilderOptions = [],
array $filterFormBuilderOptions = [],
Request $request = null
) {
$form = $this->formCreator->createNamed($name, $collection, $rootFormBuilderOptions, $filterF... | php | public function createNamedForm(
$name,
CollectionInterface $collection,
array $rootFormBuilderOptions = [],
array $filterFormBuilderOptions = [],
Request $request = null
) {
$form = $this->formCreator->createNamed($name, $collection, $rootFormBuilderOptions, $filterF... | [
"public",
"function",
"createNamedForm",
"(",
"$",
"name",
",",
"CollectionInterface",
"$",
"collection",
",",
"array",
"$",
"rootFormBuilderOptions",
"=",
"[",
"]",
",",
"array",
"$",
"filterFormBuilderOptions",
"=",
"[",
"]",
",",
"Request",
"$",
"request",
... | Creates a filtration named form.
@param string $name The name of the root form
@param CollectionInterface $collection The filter collection
@param array $rootFormBuilderOptions (Optional)
@param array $filterFormBuilderOptions (Optional)
@par... | [
"Creates",
"a",
"filtration",
"named",
"form",
"."
] | train | https://github.com/dmitrya2e/filtration-bundle/blob/fed5764af4e43871835744fb84957b2a76e9a215/Manager/FilterSuperManager.php#L164-L178 |
ARCANESOFT/Auth | src/Http/Controllers/Admin/UsersController.php | UsersController.index | public function index($trashed = false)
{
$this->authorize(UsersPolicy::PERMISSION_LIST);
$users = $this->user->with('roles')->protectAdmins()->when($trashed, function ($query) {
return $query->onlyTrashed();
})->paginate(30);
$title = trans('auth::users.titles.users-li... | php | public function index($trashed = false)
{
$this->authorize(UsersPolicy::PERMISSION_LIST);
$users = $this->user->with('roles')->protectAdmins()->when($trashed, function ($query) {
return $query->onlyTrashed();
})->paginate(30);
$title = trans('auth::users.titles.users-li... | [
"public",
"function",
"index",
"(",
"$",
"trashed",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"authorize",
"(",
"UsersPolicy",
"::",
"PERMISSION_LIST",
")",
";",
"$",
"users",
"=",
"$",
"this",
"->",
"user",
"->",
"with",
"(",
"'roles'",
")",
"->",
... | List the users.
@param bool $trashed
@return \Illuminate\View\View | [
"List",
"the",
"users",
"."
] | train | https://github.com/ARCANESOFT/Auth/blob/b33ca82597a76b1e395071f71ae3e51f1ec67e62/src/Http/Controllers/Admin/UsersController.php#L71-L84 |
ARCANESOFT/Auth | src/Http/Controllers/Admin/UsersController.php | UsersController.listByRole | public function listByRole(Role $role, $trashed = false)
{
$this->authorize(UsersPolicy::PERMISSION_LIST);
$users = $role->users()->with('roles')
->protectAdmins()
->paginate(30);
$title = trans('auth::users.titles.users-list')." - {$role->name} Role". ($trashed ? '... | php | public function listByRole(Role $role, $trashed = false)
{
$this->authorize(UsersPolicy::PERMISSION_LIST);
$users = $role->users()->with('roles')
->protectAdmins()
->paginate(30);
$title = trans('auth::users.titles.users-list')." - {$role->name} Role". ($trashed ? '... | [
"public",
"function",
"listByRole",
"(",
"Role",
"$",
"role",
",",
"$",
"trashed",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"authorize",
"(",
"UsersPolicy",
"::",
"PERMISSION_LIST",
")",
";",
"$",
"users",
"=",
"$",
"role",
"->",
"users",
"(",
")",
... | List the users by a role.
@param \Arcanesoft\Contracts\Auth\Models\Role $role
@param bool $trashed
@return \Illuminate\View\View | [
"List",
"the",
"users",
"by",
"a",
"role",
"."
] | train | https://github.com/ARCANESOFT/Auth/blob/b33ca82597a76b1e395071f71ae3e51f1ec67e62/src/Http/Controllers/Admin/UsersController.php#L104-L117 |
ARCANESOFT/Auth | src/Http/Controllers/Admin/UsersController.php | UsersController.create | public function create(Role $role)
{
$this->authorize(UsersPolicy::PERMISSION_CREATE);
$roles = $role->all();
$this->setTitle($title = trans('auth::users.titles.create-user'));
$this->addBreadcrumb($title);
return $this->view('admin.users.create', compact('roles'));
} | php | public function create(Role $role)
{
$this->authorize(UsersPolicy::PERMISSION_CREATE);
$roles = $role->all();
$this->setTitle($title = trans('auth::users.titles.create-user'));
$this->addBreadcrumb($title);
return $this->view('admin.users.create', compact('roles'));
} | [
"public",
"function",
"create",
"(",
"Role",
"$",
"role",
")",
"{",
"$",
"this",
"->",
"authorize",
"(",
"UsersPolicy",
"::",
"PERMISSION_CREATE",
")",
";",
"$",
"roles",
"=",
"$",
"role",
"->",
"all",
"(",
")",
";",
"$",
"this",
"->",
"setTitle",
"(... | Show the create a new user form.
@param \Arcanesoft\Contracts\Auth\Models\Role $role
@return \Illuminate\View\View | [
"Show",
"the",
"create",
"a",
"new",
"user",
"form",
"."
] | train | https://github.com/ARCANESOFT/Auth/blob/b33ca82597a76b1e395071f71ae3e51f1ec67e62/src/Http/Controllers/Admin/UsersController.php#L126-L136 |
ARCANESOFT/Auth | src/Http/Controllers/Admin/UsersController.php | UsersController.store | public function store(CreateUserRequest $request, User $user)
{
$this->authorize(UsersPolicy::PERMISSION_CREATE);
$user->fill($request->getValidatedData());
$user->is_active = true;
$user->save();
$user->roles()->sync($request->get('roles'));
$this->transNotificatio... | php | public function store(CreateUserRequest $request, User $user)
{
$this->authorize(UsersPolicy::PERMISSION_CREATE);
$user->fill($request->getValidatedData());
$user->is_active = true;
$user->save();
$user->roles()->sync($request->get('roles'));
$this->transNotificatio... | [
"public",
"function",
"store",
"(",
"CreateUserRequest",
"$",
"request",
",",
"User",
"$",
"user",
")",
"{",
"$",
"this",
"->",
"authorize",
"(",
"UsersPolicy",
"::",
"PERMISSION_CREATE",
")",
";",
"$",
"user",
"->",
"fill",
"(",
"$",
"request",
"->",
"g... | Store the new user.
@param \Arcanesoft\Auth\Http\Requests\Admin\Users\CreateUserRequest $request
@param \Arcanesoft\Contracts\Auth\Models\User $user
@return \Illuminate\Http\RedirectResponse | [
"Store",
"the",
"new",
"user",
"."
] | train | https://github.com/ARCANESOFT/Auth/blob/b33ca82597a76b1e395071f71ae3e51f1ec67e62/src/Http/Controllers/Admin/UsersController.php#L146-L158 |
ARCANESOFT/Auth | src/Http/Controllers/Admin/UsersController.php | UsersController.show | public function show(User $user)
{
$this->authorize(UsersPolicy::PERMISSION_SHOW);
$user->load(['roles', 'roles.permissions']);
$this->setTitle($title = trans('auth::users.titles.user-details'));
$this->addBreadcrumb($title);
return $this->view('admin.users.show', compact(... | php | public function show(User $user)
{
$this->authorize(UsersPolicy::PERMISSION_SHOW);
$user->load(['roles', 'roles.permissions']);
$this->setTitle($title = trans('auth::users.titles.user-details'));
$this->addBreadcrumb($title);
return $this->view('admin.users.show', compact(... | [
"public",
"function",
"show",
"(",
"User",
"$",
"user",
")",
"{",
"$",
"this",
"->",
"authorize",
"(",
"UsersPolicy",
"::",
"PERMISSION_SHOW",
")",
";",
"$",
"user",
"->",
"load",
"(",
"[",
"'roles'",
",",
"'roles.permissions'",
"]",
")",
";",
"$",
"th... | Show the user's details.
@param \Arcanesoft\Contracts\Auth\Models\User $user
@return \Illuminate\View\View | [
"Show",
"the",
"user",
"s",
"details",
"."
] | train | https://github.com/ARCANESOFT/Auth/blob/b33ca82597a76b1e395071f71ae3e51f1ec67e62/src/Http/Controllers/Admin/UsersController.php#L167-L177 |
ARCANESOFT/Auth | src/Http/Controllers/Admin/UsersController.php | UsersController.edit | public function edit(User $user, Role $role)
{
$this->authorize(UsersPolicy::PERMISSION_UPDATE);
$user->load(['roles', 'roles.permissions']);
$roles = $role->all();
$this->setTitle($title = trans('auth::users.titles.edit-user'));
$this->addBreadcrumb($title);
retur... | php | public function edit(User $user, Role $role)
{
$this->authorize(UsersPolicy::PERMISSION_UPDATE);
$user->load(['roles', 'roles.permissions']);
$roles = $role->all();
$this->setTitle($title = trans('auth::users.titles.edit-user'));
$this->addBreadcrumb($title);
retur... | [
"public",
"function",
"edit",
"(",
"User",
"$",
"user",
",",
"Role",
"$",
"role",
")",
"{",
"$",
"this",
"->",
"authorize",
"(",
"UsersPolicy",
"::",
"PERMISSION_UPDATE",
")",
";",
"$",
"user",
"->",
"load",
"(",
"[",
"'roles'",
",",
"'roles.permissions'... | Show the edit the user form.
@param \Arcanesoft\Contracts\Auth\Models\User $user
@param \Arcanesoft\Contracts\Auth\Models\Role $role
@return \Illuminate\View\View | [
"Show",
"the",
"edit",
"the",
"user",
"form",
"."
] | train | https://github.com/ARCANESOFT/Auth/blob/b33ca82597a76b1e395071f71ae3e51f1ec67e62/src/Http/Controllers/Admin/UsersController.php#L187-L198 |
ARCANESOFT/Auth | src/Http/Controllers/Admin/UsersController.php | UsersController.update | public function update(UpdateUserRequest $request, User $user)
{
$this->authorize(UsersPolicy::PERMISSION_UPDATE);
$user->update($request->getValidatedData());
$user->roles()->sync($request->get('roles'));
$this->transNotification('updated', ['name' => $user->full_name], $user->toA... | php | public function update(UpdateUserRequest $request, User $user)
{
$this->authorize(UsersPolicy::PERMISSION_UPDATE);
$user->update($request->getValidatedData());
$user->roles()->sync($request->get('roles'));
$this->transNotification('updated', ['name' => $user->full_name], $user->toA... | [
"public",
"function",
"update",
"(",
"UpdateUserRequest",
"$",
"request",
",",
"User",
"$",
"user",
")",
"{",
"$",
"this",
"->",
"authorize",
"(",
"UsersPolicy",
"::",
"PERMISSION_UPDATE",
")",
";",
"$",
"user",
"->",
"update",
"(",
"$",
"request",
"->",
... | Update the user.
@param \Arcanesoft\Auth\Http\Requests\Admin\Users\UpdateUserRequest $request
@param \Arcanesoft\Contracts\Auth\Models\User $user
@return \Illuminate\Http\RedirectResponse | [
"Update",
"the",
"user",
"."
] | train | https://github.com/ARCANESOFT/Auth/blob/b33ca82597a76b1e395071f71ae3e51f1ec67e62/src/Http/Controllers/Admin/UsersController.php#L208-L218 |
ARCANESOFT/Auth | src/Http/Controllers/Admin/UsersController.php | UsersController.activate | public function activate(User $user)
{
$this->authorize(UsersPolicy::PERMISSION_UPDATE);
try {
($active = $user->isActive()) ? $user->deactivate() : $user->activate();
$message = $this->transNotification(
$active ? 'disabled' : 'enabled',
['n... | php | public function activate(User $user)
{
$this->authorize(UsersPolicy::PERMISSION_UPDATE);
try {
($active = $user->isActive()) ? $user->deactivate() : $user->activate();
$message = $this->transNotification(
$active ? 'disabled' : 'enabled',
['n... | [
"public",
"function",
"activate",
"(",
"User",
"$",
"user",
")",
"{",
"$",
"this",
"->",
"authorize",
"(",
"UsersPolicy",
"::",
"PERMISSION_UPDATE",
")",
";",
"try",
"{",
"(",
"$",
"active",
"=",
"$",
"user",
"->",
"isActive",
"(",
")",
")",
"?",
"$"... | Activate/Disable a user.
@param \Arcanesoft\Contracts\Auth\Models\User $user
@return \Illuminate\Http\JsonResponse | [
"Activate",
"/",
"Disable",
"a",
"user",
"."
] | train | https://github.com/ARCANESOFT/Auth/blob/b33ca82597a76b1e395071f71ae3e51f1ec67e62/src/Http/Controllers/Admin/UsersController.php#L227-L245 |
ARCANESOFT/Auth | src/Http/Controllers/Admin/UsersController.php | UsersController.restore | public function restore(User $user)
{
$this->authorize(UsersPolicy::PERMISSION_UPDATE);
try {
$user->restore();
$message = $this->transNotification('restored', ['name' => $user->full_name], $user->toArray());
return $this->jsonResponseSuccess(compact('message')... | php | public function restore(User $user)
{
$this->authorize(UsersPolicy::PERMISSION_UPDATE);
try {
$user->restore();
$message = $this->transNotification('restored', ['name' => $user->full_name], $user->toArray());
return $this->jsonResponseSuccess(compact('message')... | [
"public",
"function",
"restore",
"(",
"User",
"$",
"user",
")",
"{",
"$",
"this",
"->",
"authorize",
"(",
"UsersPolicy",
"::",
"PERMISSION_UPDATE",
")",
";",
"try",
"{",
"$",
"user",
"->",
"restore",
"(",
")",
";",
"$",
"message",
"=",
"$",
"this",
"... | Restore the trashed user.
@param \Arcanesoft\Contracts\Auth\Models\User $user
@return \Illuminate\Http\JsonResponse | [
"Restore",
"the",
"trashed",
"user",
"."
] | train | https://github.com/ARCANESOFT/Auth/blob/b33ca82597a76b1e395071f71ae3e51f1ec67e62/src/Http/Controllers/Admin/UsersController.php#L254-L268 |
ARCANESOFT/Auth | src/Http/Controllers/Admin/UsersController.php | UsersController.delete | public function delete(User $user)
{
$this->authorize(UsersPolicy::PERMISSION_DELETE);
try {
($trashed = $user->trashed()) ? $user->forceDelete() : $user->delete();
$message = $this->transNotification(
$trashed ? 'deleted' : 'trashed',
['name... | php | public function delete(User $user)
{
$this->authorize(UsersPolicy::PERMISSION_DELETE);
try {
($trashed = $user->trashed()) ? $user->forceDelete() : $user->delete();
$message = $this->transNotification(
$trashed ? 'deleted' : 'trashed',
['name... | [
"public",
"function",
"delete",
"(",
"User",
"$",
"user",
")",
"{",
"$",
"this",
"->",
"authorize",
"(",
"UsersPolicy",
"::",
"PERMISSION_DELETE",
")",
";",
"try",
"{",
"(",
"$",
"trashed",
"=",
"$",
"user",
"->",
"trashed",
"(",
")",
")",
"?",
"$",
... | Delete a user.
@param \Arcanesoft\Contracts\Auth\Models\User $user
@return \Illuminate\Http\JsonResponse | [
"Delete",
"a",
"user",
"."
] | train | https://github.com/ARCANESOFT/Auth/blob/b33ca82597a76b1e395071f71ae3e51f1ec67e62/src/Http/Controllers/Admin/UsersController.php#L277-L295 |
ARCANESOFT/Auth | src/Http/Controllers/Admin/UsersController.php | UsersController.impersonate | public function impersonate(User $user, Impersonator $impersonator)
{
/** @var \Arcanedev\LaravelImpersonator\Contracts\Impersonatable $user */
if ( ! $impersonator->start(auth()->user(), $user)) {
$this->notifyDanger(
trans('auth::users.messages.impersonation-failed.me... | php | public function impersonate(User $user, Impersonator $impersonator)
{
/** @var \Arcanedev\LaravelImpersonator\Contracts\Impersonatable $user */
if ( ! $impersonator->start(auth()->user(), $user)) {
$this->notifyDanger(
trans('auth::users.messages.impersonation-failed.me... | [
"public",
"function",
"impersonate",
"(",
"User",
"$",
"user",
",",
"Impersonator",
"$",
"impersonator",
")",
"{",
"/** @var \\Arcanedev\\LaravelImpersonator\\Contracts\\Impersonatable $user */",
"if",
"(",
"!",
"$",
"impersonator",
"->",
"start",
"(",
"auth",
"(",
... | Impersonate a user.
@param \Arcanesoft\Contracts\Auth\Models\User $user
@param \Arcanedev\LaravelImpersonator\Contracts\Impersonator $impersonator
@return \Illuminate\Http\RedirectResponse | [
"Impersonate",
"a",
"user",
"."
] | train | https://github.com/ARCANESOFT/Auth/blob/b33ca82597a76b1e395071f71ae3e51f1ec67e62/src/Http/Controllers/Admin/UsersController.php#L305-L318 |
native5/native5-sdk-client-php | src/Native5/Route/Router.php | Router.route | public function route()
{
global $app;
$controllerName = $this->_command->getControllerName();
if (!$this->routeExists($controllerName)) {
$controllerName = 'error';
}
include 'controllers/'.$controllerName.'.php';
// Only log analytics data for... | php | public function route()
{
global $app;
$controllerName = $this->_command->getControllerName();
if (!$this->routeExists($controllerName)) {
$controllerName = 'error';
}
include 'controllers/'.$controllerName.'.php';
// Only log analytics data for... | [
"public",
"function",
"route",
"(",
")",
"{",
"global",
"$",
"app",
";",
"$",
"controllerName",
"=",
"$",
"this",
"->",
"_command",
"->",
"getControllerName",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"routeExists",
"(",
"$",
"controllerName",
... | route
@access public
@return void | [
"route"
] | train | https://github.com/native5/native5-sdk-client-php/blob/e1f598cf27654d81bb5facace1990b737242a2f9/src/Native5/Route/Router.php#L81-L122 |
OxfordInfoLabs/kinikit-core | src/Util/StringUtils.php | StringUtils.matchesWildcardPattern | public static function matchesWildcardPattern($predicateString, $pattern) {
// Only do a fuzzy match if at least a single * character found.
if (is_numeric(strpos($pattern, "*"))) {
$pattern = str_replace("\\*", "(.*)", preg_quote($pattern, "/"));
$regex = "/" . $pattern . "/";
... | php | public static function matchesWildcardPattern($predicateString, $pattern) {
// Only do a fuzzy match if at least a single * character found.
if (is_numeric(strpos($pattern, "*"))) {
$pattern = str_replace("\\*", "(.*)", preg_quote($pattern, "/"));
$regex = "/" . $pattern . "/";
... | [
"public",
"static",
"function",
"matchesWildcardPattern",
"(",
"$",
"predicateString",
",",
"$",
"pattern",
")",
"{",
"// Only do a fuzzy match if at least a single * character found.",
"if",
"(",
"is_numeric",
"(",
"strpos",
"(",
"$",
"pattern",
",",
"\"*\"",
")",
")... | Return a boolean indicating whether the passed string matches the supplied pattern
which may contain * wildcards
@param string $predicateString
@param string $pattern | [
"Return",
"a",
"boolean",
"indicating",
"whether",
"the",
"passed",
"string",
"matches",
"the",
"supplied",
"pattern",
"which",
"may",
"contain",
"*",
"wildcards"
] | train | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/StringUtils.php#L20-L32 |
OxfordInfoLabs/kinikit-core | src/Util/StringUtils.php | StringUtils.generateRandomString | public static function generateRandomString($numberOfChars, $includeCaps = true, $includeNumbers = true, $includeSymbols = false) {
$possibleChars = range(97, 122);
// If include caps, add in capital letters
if ($includeCaps) $possibleChars = array_merge($possibleChars, range(65, 90));
... | php | public static function generateRandomString($numberOfChars, $includeCaps = true, $includeNumbers = true, $includeSymbols = false) {
$possibleChars = range(97, 122);
// If include caps, add in capital letters
if ($includeCaps) $possibleChars = array_merge($possibleChars, range(65, 90));
... | [
"public",
"static",
"function",
"generateRandomString",
"(",
"$",
"numberOfChars",
",",
"$",
"includeCaps",
"=",
"true",
",",
"$",
"includeNumbers",
"=",
"true",
",",
"$",
"includeSymbols",
"=",
"false",
")",
"{",
"$",
"possibleChars",
"=",
"range",
"(",
"97... | Generate a random string of the given length (for e.g. passwords etc).
Optional flags allow for capital letters, numbers and symbols
@param $numberOfChars
@param bool $includeSymbols | [
"Generate",
"a",
"random",
"string",
"of",
"the",
"given",
"length",
"(",
"for",
"e",
".",
"g",
".",
"passwords",
"etc",
")",
".",
"Optional",
"flags",
"allow",
"for",
"capital",
"letters",
"numbers",
"and",
"symbols"
] | train | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/StringUtils.php#L42-L59 |
CaliCastle/socialite | src/Two/AbstractProvider.php | AbstractProvider.redirect | public function redirect()
{
$state = null;
if ($this->usesState()) {
$this->request->getSession()->set('state', $state = Str::random(40));
}
return new RedirectResponse($this->getAuthUrl($state));
} | php | public function redirect()
{
$state = null;
if ($this->usesState()) {
$this->request->getSession()->set('state', $state = Str::random(40));
}
return new RedirectResponse($this->getAuthUrl($state));
} | [
"public",
"function",
"redirect",
"(",
")",
"{",
"$",
"state",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"usesState",
"(",
")",
")",
"{",
"$",
"this",
"->",
"request",
"->",
"getSession",
"(",
")",
"->",
"set",
"(",
"'state'",
",",
"$",
"st... | Redirect the user of the application to the provider's authentication screen.
@return \Symfony\Component\HttpFoundation\RedirectResponse | [
"Redirect",
"the",
"user",
"of",
"the",
"application",
"to",
"the",
"provider",
"s",
"authentication",
"screen",
"."
] | train | https://github.com/CaliCastle/socialite/blob/68acdf290c7e3afbc3db08b3a197230a3f6b0370/src/Two/AbstractProvider.php#L129-L138 |
CaliCastle/socialite | src/Two/AbstractProvider.php | AbstractProvider.user | public function user()
{
if ($this->hasInvalidState()) {
throw new InvalidStateException;
}
$user = $this->mapUserToObject($this->getUserByToken(
$token = $this->getAccessToken($this->getCode())
));
return $user->setToken($token);
} | php | public function user()
{
if ($this->hasInvalidState()) {
throw new InvalidStateException;
}
$user = $this->mapUserToObject($this->getUserByToken(
$token = $this->getAccessToken($this->getCode())
));
return $user->setToken($token);
} | [
"public",
"function",
"user",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasInvalidState",
"(",
")",
")",
"{",
"throw",
"new",
"InvalidStateException",
";",
"}",
"$",
"user",
"=",
"$",
"this",
"->",
"mapUserToObject",
"(",
"$",
"this",
"->",
"getUse... | {@inheritdoc} | [
"{"
] | train | https://github.com/CaliCastle/socialite/blob/68acdf290c7e3afbc3db08b3a197230a3f6b0370/src/Two/AbstractProvider.php#L188-L199 |
CaliCastle/socialite | src/Two/AbstractProvider.php | AbstractProvider.hasInvalidState | protected function hasInvalidState()
{
if ($this->isStateless()) {
return false;
}
$state = $this->request->getSession()->pull('state');
return !(strlen($state) > 0 && $this->request->input('state') === $state);
} | php | protected function hasInvalidState()
{
if ($this->isStateless()) {
return false;
}
$state = $this->request->getSession()->pull('state');
return !(strlen($state) > 0 && $this->request->input('state') === $state);
} | [
"protected",
"function",
"hasInvalidState",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isStateless",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"state",
"=",
"$",
"this",
"->",
"request",
"->",
"getSession",
"(",
")",
"->",
"pull",
"(",... | Determine if the current request / session has a mismatching "state".
@return bool | [
"Determine",
"if",
"the",
"current",
"request",
"/",
"session",
"has",
"a",
"mismatching",
"state",
"."
] | train | https://github.com/CaliCastle/socialite/blob/68acdf290c7e3afbc3db08b3a197230a3f6b0370/src/Two/AbstractProvider.php#L219-L228 |
squareproton/Bond | src/Bond/Pg/Catalog.php | Catalog.getEnum | private function getEnum()
{
$enumResult = $this->db->query(
new Raw( <<<SQL
SELECT
t.typname as name,
n.nspname as schema,
array_agg( e.enumlabel ORDER BY e.enumsortorder ) as labels
FROM
... | php | private function getEnum()
{
$enumResult = $this->db->query(
new Raw( <<<SQL
SELECT
t.typname as name,
n.nspname as schema,
array_agg( e.enumlabel ORDER BY e.enumsortorder ) as labels
FROM
... | [
"private",
"function",
"getEnum",
"(",
")",
"{",
"$",
"enumResult",
"=",
"$",
"this",
"->",
"db",
"->",
"query",
"(",
"new",
"Raw",
"(",
" <<<SQL\n SELECT\n t.typname as name,\n n.nspname as schema,\n array... | Get array of enum's and their values from the database
@param Bond\Pg
@return array | [
"Get",
"array",
"of",
"enum",
"s",
"and",
"their",
"values",
"from",
"the",
"database"
] | train | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Pg/Catalog.php#L75-L107 |
squareproton/Bond | src/Bond/Pg/Catalog.php | Catalog.loadReferences | private function loadReferences()
{
// References defined in pg_catalog
$sql = new Raw('SELECT * FROM dev."vAttributeReferences" WHERE "isInherited" = false');
$sql = new Raw( <<<SQL
-- Based on. http://code.google.com/p/pgutils/ but very heavily modified
-- Potentially inheritance aware/co... | php | private function loadReferences()
{
// References defined in pg_catalog
$sql = new Raw('SELECT * FROM dev."vAttributeReferences" WHERE "isInherited" = false');
$sql = new Raw( <<<SQL
-- Based on. http://code.google.com/p/pgutils/ but very heavily modified
-- Potentially inheritance aware/co... | [
"private",
"function",
"loadReferences",
"(",
")",
"{",
"// References defined in pg_catalog",
"$",
"sql",
"=",
"new",
"Raw",
"(",
"'SELECT * FROM dev.\"vAttributeReferences\" WHERE \"isInherited\" = false'",
")",
";",
"$",
"sql",
"=",
"new",
"Raw",
"(",
" <<<SQL\n-- Base... | See, http://www.postgresql.org/docs/8.4/interactive/catalog-pg-constraint.html
@return bool. Populate the static variables $this->references $this->isReferencedBy | [
"See",
"http",
":",
"//",
"www",
".",
"postgresql",
".",
"org",
"/",
"docs",
"/",
"8",
".",
"4",
"/",
"interactive",
"/",
"catalog",
"-",
"pg",
"-",
"constraint",
".",
"html"
] | train | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Pg/Catalog.php#L113-L303 |
Sectorr/Core | Sectorr/Core/Input/Input.php | Input.exists | public static function exists($type = 'post')
{
switch ($type) {
case 'post':
return (!empty($_POST)) ? true : false;
break;
case 'get':
return (!empty($_GET)) ? true : false;
break;
default:
... | php | public static function exists($type = 'post')
{
switch ($type) {
case 'post':
return (!empty($_POST)) ? true : false;
break;
case 'get':
return (!empty($_GET)) ? true : false;
break;
default:
... | [
"public",
"static",
"function",
"exists",
"(",
"$",
"type",
"=",
"'post'",
")",
"{",
"switch",
"(",
"$",
"type",
")",
"{",
"case",
"'post'",
":",
"return",
"(",
"!",
"empty",
"(",
"$",
"_POST",
")",
")",
"?",
"true",
":",
"false",
";",
"break",
"... | Check the given request type exists.
@param string $type
@return bool | [
"Check",
"the",
"given",
"request",
"type",
"exists",
"."
] | train | https://github.com/Sectorr/Core/blob/31df852dc6cc61642b0b87d9f0ae56c8e7da5a27/Sectorr/Core/Input/Input.php#L24-L37 |
Sectorr/Core | Sectorr/Core/Input/Input.php | Input.get | public static function get($item)
{
if (isset($_POST[$item])) {
return $_POST[$item];
} elseif (isset($_GET[$item])) {
return $_GET[$item];
} else {
return '';
}
} | php | public static function get($item)
{
if (isset($_POST[$item])) {
return $_POST[$item];
} elseif (isset($_GET[$item])) {
return $_GET[$item];
} else {
return '';
}
} | [
"public",
"static",
"function",
"get",
"(",
"$",
"item",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"_POST",
"[",
"$",
"item",
"]",
")",
")",
"{",
"return",
"$",
"_POST",
"[",
"$",
"item",
"]",
";",
"}",
"elseif",
"(",
"isset",
"(",
"$",
"_GET",
... | Returns the given input item.
@param $item
@return string | [
"Returns",
"the",
"given",
"input",
"item",
"."
] | train | https://github.com/Sectorr/Core/blob/31df852dc6cc61642b0b87d9f0ae56c8e7da5a27/Sectorr/Core/Input/Input.php#L45-L54 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.