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
huasituo/hstcms
src/Libraries/Fields/Redirect.php
Redirect.input
public function input($cname, $name, $cfg, $value = NULL, $id = 0) { $cfg['option']['value'] = isset($cfg['option']['value']) ? $cfg['option']['value'] : ""; // 字段显示名称 $text = (isset($cfg['validate']['required']) && $cfg['validate']['required'] == 1 ? '<font color="red">*</font>&nbsp;' : '').$cname; // 表单宽度设置...
php
public function input($cname, $name, $cfg, $value = NULL, $id = 0) { $cfg['option']['value'] = isset($cfg['option']['value']) ? $cfg['option']['value'] : ""; // 字段显示名称 $text = (isset($cfg['validate']['required']) && $cfg['validate']['required'] == 1 ? '<font color="red">*</font>&nbsp;' : '').$cname; // 表单宽度设置...
[ "public", "function", "input", "(", "$", "cname", ",", "$", "name", ",", "$", "cfg", ",", "$", "value", "=", "NULL", ",", "$", "id", "=", "0", ")", "{", "$", "cfg", "[", "'option'", "]", "[", "'value'", "]", "=", "isset", "(", "$", "cfg", "["...
字段表单输入 @param string $cname 字段别名 @param string $name 字段名称 @param array $cfg 字段配置 @param array $value 值 @param array $id 当前内容表的id(表示非发布操作) @return string
[ "字段表单输入" ]
train
https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Libraries/Fields/Redirect.php#L60-L83
huasituo/hstcms
src/Libraries/Fields/Redirect.php
Redirect.insert_value
public function insert_value(Request $request, $filed, $postData = []) { $value = $request->get($field['fieldname']); if ($value) { $value = stripos($value, 'http://') != 0 || stripos($value, 'ftp://') != 0 || stripos($value, 'https://') != 0 ? 'http://'.$value : $value; } $postData[$field['relatedtable']] ...
php
public function insert_value(Request $request, $filed, $postData = []) { $value = $request->get($field['fieldname']); if ($value) { $value = stripos($value, 'http://') != 0 || stripos($value, 'ftp://') != 0 || stripos($value, 'https://') != 0 ? 'http://'.$value : $value; } $postData[$field['relatedtable']] ...
[ "public", "function", "insert_value", "(", "Request", "$", "request", ",", "$", "filed", ",", "$", "postData", "=", "[", "]", ")", "{", "$", "value", "=", "$", "request", "->", "get", "(", "$", "field", "[", "'fieldname'", "]", ")", ";", "if", "(",...
处理输入数据,提供给入库
[ "处理输入数据,提供给入库" ]
train
https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Libraries/Fields/Redirect.php#L88-L98
verschoof/bunq-api
src/Certificate/CertificateType.php
CertificateType.protect
private function protect() { if (!in_array($this->certificateType, self::allAsString(), true)) { throw new \InvalidArgumentException(sprintf('Invalid certificate type %s', $this->certificateType)); } }
php
private function protect() { if (!in_array($this->certificateType, self::allAsString(), true)) { throw new \InvalidArgumentException(sprintf('Invalid certificate type %s', $this->certificateType)); } }
[ "private", "function", "protect", "(", ")", "{", "if", "(", "!", "in_array", "(", "$", "this", "->", "certificateType", ",", "self", "::", "allAsString", "(", ")", ",", "true", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "sprint...
Check if the certificateType exists in our list
[ "Check", "if", "the", "certificateType", "exists", "in", "our", "list" ]
train
https://github.com/verschoof/bunq-api/blob/df9aa19f384275f4f0deb26de0cb5e5f8b45ffcd/src/Certificate/CertificateType.php#L113-L118
elkuku/crowdin-api
src/Package.php
Package.getBasePath
protected function getBasePath(string $action) : string { return sprintf( 'project/%s/%s?key=%s', $this->getProjectId(), $action, $this->getApiKey() ); }
php
protected function getBasePath(string $action) : string { return sprintf( 'project/%s/%s?key=%s', $this->getProjectId(), $action, $this->getApiKey() ); }
[ "protected", "function", "getBasePath", "(", "string", "$", "action", ")", ":", "string", "{", "return", "sprintf", "(", "'project/%s/%s?key=%s'", ",", "$", "this", "->", "getProjectId", "(", ")", ",", "$", "action", ",", "$", "this", "->", "getApiKey", "(...
Get the base path for the command including an action. @param string $action The action to perform. @return string
[ "Get", "the", "base", "path", "for", "the", "command", "including", "an", "action", "." ]
train
https://github.com/elkuku/crowdin-api/blob/690f00eed8f91a875b3f288d319750d6d8ae0453/src/Package.php#L89-L97
refinery29/piston
src/ApiResponse.php
ApiResponse.setCustomResult
public function setCustomResult(CustomResult $customResult) { $this->checksForCustomObject(); if (\count($this->responseBody->getMembers()) > 0) { throw new \Exception(self::ERROR_CANNOT_USE_CUSTOM_AND_OTHER_RESOURCES); } $this->responseBody->addMember($customResult->getS...
php
public function setCustomResult(CustomResult $customResult) { $this->checksForCustomObject(); if (\count($this->responseBody->getMembers()) > 0) { throw new \Exception(self::ERROR_CANNOT_USE_CUSTOM_AND_OTHER_RESOURCES); } $this->responseBody->addMember($customResult->getS...
[ "public", "function", "setCustomResult", "(", "CustomResult", "$", "customResult", ")", "{", "$", "this", "->", "checksForCustomObject", "(", ")", ";", "if", "(", "\\", "count", "(", "$", "this", "->", "responseBody", "->", "getMembers", "(", ")", ")", ">"...
@param CustomResult $customResult @throws \Exception
[ "@param", "CustomResult", "$customResult" ]
train
https://github.com/refinery29/piston/blob/75c402e814136577fa9a02479e8803aca664c865/src/ApiResponse.php#L75-L84
ryanwachtl/silverstripe-foundation-forms
code/forms/FoundationForm.php
FoundationForm.forTemplate
public function forTemplate() { $this->Fields()->bootstrapify(); $this->Actions()->bootstrapify(); Requirements::css(FOUNDATIONFORMS_DIR . '/css/foundationforms.css'); return parent::forTemplate(); }
php
public function forTemplate() { $this->Fields()->bootstrapify(); $this->Actions()->bootstrapify(); Requirements::css(FOUNDATIONFORMS_DIR . '/css/foundationforms.css'); return parent::forTemplate(); }
[ "public", "function", "forTemplate", "(", ")", "{", "$", "this", "->", "Fields", "(", ")", "->", "bootstrapify", "(", ")", ";", "$", "this", "->", "Actions", "(", ")", "->", "bootstrapify", "(", ")", ";", "Requirements", "::", "css", "(", "FOUNDATIONFO...
Includes the dependency if necessary, applies the Bootstrap templates, and renders the form HTML output @return string
[ "Includes", "the", "dependency", "if", "necessary", "applies", "the", "Bootstrap", "templates", "and", "renders", "the", "form", "HTML", "output" ]
train
https://github.com/ryanwachtl/silverstripe-foundation-forms/blob/9055449fcb895811187124d81e57b7c93948403f/code/forms/FoundationForm.php#L25-L32
drunomics/service-utils
src/Core/State/StateTrait.php
StateTrait.getState
public function getState() { if (empty($this->state)) { $this->state = \Drupal::service('state'); } return $this->state; }
php
public function getState() { if (empty($this->state)) { $this->state = \Drupal::service('state'); } return $this->state; }
[ "public", "function", "getState", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "state", ")", ")", "{", "$", "this", "->", "state", "=", "\\", "Drupal", "::", "service", "(", "'state'", ")", ";", "}", "return", "$", "this", "->", "st...
Gets the state storage. @return \Drupal\Core\State\StateInterface The state storage.
[ "Gets", "the", "state", "storage", "." ]
train
https://github.com/drunomics/service-utils/blob/56761750043132365ef4ae5d9e0cf4263459328f/src/Core/State/StateTrait.php#L38-L43
comodojo/dispatcher.framework
src/Comodojo/Dispatcher/Traits/HeadersTrait.php
HeadersTrait.get
public function get($header = null) { if (is_null($header)) { return $this->headers; } $index = $this->getIndexCaseInsensitive($header); return $index === null ? null : $this->headers[$index]; }
php
public function get($header = null) { if (is_null($header)) { return $this->headers; } $index = $this->getIndexCaseInsensitive($header); return $index === null ? null : $this->headers[$index]; }
[ "public", "function", "get", "(", "$", "header", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "header", ")", ")", "{", "return", "$", "this", "->", "headers", ";", "}", "$", "index", "=", "$", "this", "->", "getIndexCaseInsensitive", "(", ...
Get one or all header(s) If $header param is not provided, this method will return all the registered headers. Starting from (v 4.1+) this method is CASE INSENSITIVE @param string $header @return string|array|null
[ "Get", "one", "or", "all", "header", "(", "s", ")", "If", "$header", "param", "is", "not", "provided", "this", "method", "will", "return", "all", "the", "registered", "headers", "." ]
train
https://github.com/comodojo/dispatcher.framework/blob/5093297dcb7441a8d8f79cbb2429c93232e16d1c/src/Comodojo/Dispatcher/Traits/HeadersTrait.php#L40-L50
comodojo/dispatcher.framework
src/Comodojo/Dispatcher/Traits/HeadersTrait.php
HeadersTrait.getAsString
public function getAsString($header = null) { if (is_null($header)) { return array_map([$this, 'headerToString'], array_keys($this->headers), array_values($this->headers) ); } $index = $this->getIndexCaseInsensitive($header); r...
php
public function getAsString($header = null) { if (is_null($header)) { return array_map([$this, 'headerToString'], array_keys($this->headers), array_values($this->headers) ); } $index = $this->getIndexCaseInsensitive($header); r...
[ "public", "function", "getAsString", "(", "$", "header", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "header", ")", ")", "{", "return", "array_map", "(", "[", "$", "this", ",", "'headerToString'", "]", ",", "array_keys", "(", "$", "this", ...
Get one or all header(s) as a string If $header param is not provided, this method will return all the registered headers. Starting from (v 4.1+) this method is CASE INSENSITIVE @param string $header @return string|array|null
[ "Get", "one", "or", "all", "header", "(", "s", ")", "as", "a", "string", "If", "$header", "param", "is", "not", "provided", "this", "method", "will", "return", "all", "the", "registered", "headers", "." ]
train
https://github.com/comodojo/dispatcher.framework/blob/5093297dcb7441a8d8f79cbb2429c93232e16d1c/src/Comodojo/Dispatcher/Traits/HeadersTrait.php#L62-L77
comodojo/dispatcher.framework
src/Comodojo/Dispatcher/Traits/HeadersTrait.php
HeadersTrait.set
public function set($header, $value = null) { if (is_null($value)) { $header = explode(":", $header, 2); $this->headers[$header[0]] = isset($header[1]) ? trim($header[1]) : ''; } else { $this->headers[$header] = $value; } return $this; }
php
public function set($header, $value = null) { if (is_null($value)) { $header = explode(":", $header, 2); $this->headers[$header[0]] = isset($header[1]) ? trim($header[1]) : ''; } else { $this->headers[$header] = $value; } return $this; }
[ "public", "function", "set", "(", "$", "header", ",", "$", "value", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "value", ")", ")", "{", "$", "header", "=", "explode", "(", "\":\"", ",", "$", "header", ",", "2", ")", ";", "$", "this",...
Set an header If $header is an inline header and value is null, this method will split it automatically. $value can be a string or an array. In the latter case, these values will separated by a comma in the string representation of the header. @param string $header Header name or string representation @param mixed $va...
[ "Set", "an", "header", "If", "$header", "is", "an", "inline", "header", "and", "value", "is", "null", "this", "method", "will", "split", "it", "automatically", ".", "$value", "can", "be", "a", "string", "or", "an", "array", ".", "In", "the", "latter", ...
train
https://github.com/comodojo/dispatcher.framework/blob/5093297dcb7441a8d8f79cbb2429c93232e16d1c/src/Comodojo/Dispatcher/Traits/HeadersTrait.php#L104-L120
comodojo/dispatcher.framework
src/Comodojo/Dispatcher/Traits/HeadersTrait.php
HeadersTrait.delete
public function delete($header = null) { if (is_null($header)) { $this->headers = []; return true; } $index = $this->getIndexCaseInsensitive($header); if ( $index === null ) { return false; } unset($this->headers[$index]); ...
php
public function delete($header = null) { if (is_null($header)) { $this->headers = []; return true; } $index = $this->getIndexCaseInsensitive($header); if ( $index === null ) { return false; } unset($this->headers[$index]); ...
[ "public", "function", "delete", "(", "$", "header", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "header", ")", ")", "{", "$", "this", "->", "headers", "=", "[", "]", ";", "return", "true", ";", "}", "$", "index", "=", "$", "this", "-...
Delete one or all header(s) If no argument is provided, all headers will be deleted. Starting from (v 4.1+) this method is CASE INSENSITIVE @param string $header @return bool
[ "Delete", "one", "or", "all", "header", "(", "s", ")" ]
train
https://github.com/comodojo/dispatcher.framework/blob/5093297dcb7441a8d8f79cbb2429c93232e16d1c/src/Comodojo/Dispatcher/Traits/HeadersTrait.php#L132-L151
comodojo/dispatcher.framework
src/Comodojo/Dispatcher/Traits/HeadersTrait.php
HeadersTrait.merge
public function merge($headers) { foreach ($headers as $key => $value) { $this->set($key, $value); } return $this; }
php
public function merge($headers) { foreach ($headers as $key => $value) { $this->set($key, $value); } return $this; }
[ "public", "function", "merge", "(", "$", "headers", ")", "{", "foreach", "(", "$", "headers", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "this", "->", "set", "(", "$", "key", ",", "$", "value", ")", ";", "}", "return", "$", "this", ";...
Merge actual headers with an array of headers @param string $header @return self
[ "Merge", "actual", "headers", "with", "an", "array", "of", "headers" ]
train
https://github.com/comodojo/dispatcher.framework/blob/5093297dcb7441a8d8f79cbb2429c93232e16d1c/src/Comodojo/Dispatcher/Traits/HeadersTrait.php#L159-L167
braincrafted/arrayquery
src/Braincrafted/ArrayQuery/Operator/NotLikeOperator.php
NotLikeOperator.evaluate
public function evaluate($value, $matchValue) { $pattern = sprintf('/^%s$/i', preg_replace('/(^%)|(%$)/', '.*', $matchValue)); return 1 !== preg_match($pattern, $value); }
php
public function evaluate($value, $matchValue) { $pattern = sprintf('/^%s$/i', preg_replace('/(^%)|(%$)/', '.*', $matchValue)); return 1 !== preg_match($pattern, $value); }
[ "public", "function", "evaluate", "(", "$", "value", ",", "$", "matchValue", ")", "{", "$", "pattern", "=", "sprintf", "(", "'/^%s$/i'", ",", "preg_replace", "(", "'/(^%)|(%$)/'", ",", "'.*'", ",", "$", "matchValue", ")", ")", ";", "return", "1", "!==", ...
{@inheritDoc}
[ "{" ]
train
https://github.com/braincrafted/arrayquery/blob/8b0c44ee76cea796589422f52e2f7130676b9bd1/src/Braincrafted/ArrayQuery/Operator/NotLikeOperator.php#L36-L41
jan-dolata/crude-crud
src/Engine/Traits/FromModelTraitPart/CollectionTrait.php
CollectionTrait.getFiltered
public function getFiltered($page, $numRows, $sortAttr, $sortOrder, $searchAttr, $searchValue, $richFilters = []) { $query = $this->prepareQuery(); $query = $this->richFiltersOnQuery($query, $richFilters); if ($sortAttr && $sortOrder && $this->inScope($sortAttr)) { $scope = $th...
php
public function getFiltered($page, $numRows, $sortAttr, $sortOrder, $searchAttr, $searchValue, $richFilters = []) { $query = $this->prepareQuery(); $query = $this->richFiltersOnQuery($query, $richFilters); if ($sortAttr && $sortOrder && $this->inScope($sortAttr)) { $scope = $th...
[ "public", "function", "getFiltered", "(", "$", "page", ",", "$", "numRows", ",", "$", "sortAttr", ",", "$", "sortOrder", ",", "$", "searchAttr", ",", "$", "searchValue", ",", "$", "richFilters", "=", "[", "]", ")", "{", "$", "query", "=", "$", "this"...
Get filtered collection @param integer $page @param integer $numRows @param string $sortAttr @param string $sortOrder @param string $searchAttr @param string $searchValue @return Collection
[ "Get", "filtered", "collection" ]
train
https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Engine/Traits/FromModelTraitPart/CollectionTrait.php#L71-L122
jan-dolata/crude-crud
src/Engine/Traits/FromModelTraitPart/CollectionTrait.php
CollectionTrait.countFiltered
public function countFiltered($searchAttr, $searchValue, $richFilters) { $collection = $this->getFiltered(null, null, null, null, $searchAttr, $searchValue, $richFilters); return count($collection); }
php
public function countFiltered($searchAttr, $searchValue, $richFilters) { $collection = $this->getFiltered(null, null, null, null, $searchAttr, $searchValue, $richFilters); return count($collection); }
[ "public", "function", "countFiltered", "(", "$", "searchAttr", ",", "$", "searchValue", ",", "$", "richFilters", ")", "{", "$", "collection", "=", "$", "this", "->", "getFiltered", "(", "null", ",", "null", ",", "null", ",", "null", ",", "$", "searchAttr...
Count all rows with condition @param string $searchAttr @param string $searchValue @return integer
[ "Count", "all", "rows", "with", "condition" ]
train
https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Engine/Traits/FromModelTraitPart/CollectionTrait.php#L130-L134
jan-dolata/crude-crud
src/Engine/Traits/FromModelTraitPart/CollectionTrait.php
CollectionTrait.addPermissions
public function addPermissions($collection) { $newCollection = collect([]); $customActions = $this->crudeSetup->getCustomActions(); $collection->each(function ($model) use ($newCollection, $customActions) { if ($this->permissionView($model)) { $model = $this->ad...
php
public function addPermissions($collection) { $newCollection = collect([]); $customActions = $this->crudeSetup->getCustomActions(); $collection->each(function ($model) use ($newCollection, $customActions) { if ($this->permissionView($model)) { $model = $this->ad...
[ "public", "function", "addPermissions", "(", "$", "collection", ")", "{", "$", "newCollection", "=", "collect", "(", "[", "]", ")", ";", "$", "customActions", "=", "$", "this", "->", "crudeSetup", "->", "getCustomActions", "(", ")", ";", "$", "collection",...
Filter collection by permissions and add attributes canBeEdited and canBeRemoved @param Collection $collection @return Collection
[ "Filter", "collection", "by", "permissions", "and", "add", "attributes", "canBeEdited", "and", "canBeRemoved" ]
train
https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Engine/Traits/FromModelTraitPart/CollectionTrait.php#L141-L155
jan-dolata/crude-crud
src/Engine/Traits/FromModelTraitPart/CollectionTrait.php
CollectionTrait.getById
public function getById($id) { $model = $this ->prepareQuery() ->where($this->model->getTable() . '.id', $id) ->first(); if (empty($model)) return null; $model = $this->addPermissionsForModel($model); return $this->formatModel($model...
php
public function getById($id) { $model = $this ->prepareQuery() ->where($this->model->getTable() . '.id', $id) ->first(); if (empty($model)) return null; $model = $this->addPermissionsForModel($model); return $this->formatModel($model...
[ "public", "function", "getById", "(", "$", "id", ")", "{", "$", "model", "=", "$", "this", "->", "prepareQuery", "(", ")", "->", "where", "(", "$", "this", "->", "model", "->", "getTable", "(", ")", ".", "'.id'", ",", "$", "id", ")", "->", "first...
Get by id @param integer $id @return Model
[ "Get", "by", "id" ]
train
https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Engine/Traits/FromModelTraitPart/CollectionTrait.php#L184-L197
mremi/Dolist
src/Mremi/Dolist/Contact/GetContactRequest.php
GetContactRequest.toArray
public function toArray() { return array( 'AllFields' => $this->allFields, 'Interest' => $this->interest, 'LastModifiedOnly' => $this->lastModifiedOnly, 'Offset' => $this->offset, 'RequestFilter' => $this->requestFilter-...
php
public function toArray() { return array( 'AllFields' => $this->allFields, 'Interest' => $this->interest, 'LastModifiedOnly' => $this->lastModifiedOnly, 'Offset' => $this->offset, 'RequestFilter' => $this->requestFilter-...
[ "public", "function", "toArray", "(", ")", "{", "return", "array", "(", "'AllFields'", "=>", "$", "this", "->", "allFields", ",", "'Interest'", "=>", "$", "this", "->", "interest", ",", "'LastModifiedOnly'", "=>", "$", "this", "->", "lastModifiedOnly", ",", ...
Gets an array representation @return array
[ "Gets", "an", "array", "representation" ]
train
https://github.com/mremi/Dolist/blob/452c863aba12ef2965bafdb619c0278f8fc732d0/src/Mremi/Dolist/Contact/GetContactRequest.php#L184-L194
Wonail/wocenter
traits/ParseRulesTrait.php
ParseRulesTrait.parseRulesToArray
protected function parseRulesToArray($rules, $field) { $value = []; if (!empty($rules)) { // 获取所有规则 $array = preg_split('/[;\r\n]+/', trim($rules, ";\r\n")); if (!empty($array)) { foreach ($array as $key => $val) { $value[$key][...
php
protected function parseRulesToArray($rules, $field) { $value = []; if (!empty($rules)) { // 获取所有规则 $array = preg_split('/[;\r\n]+/', trim($rules, ";\r\n")); if (!empty($array)) { foreach ($array as $key => $val) { $value[$key][...
[ "protected", "function", "parseRulesToArray", "(", "$", "rules", ",", "$", "field", ")", "{", "$", "value", "=", "[", "]", ";", "if", "(", "!", "empty", "(", "$", "rules", ")", ")", "{", "// 获取所有规则", "$", "array", "=", "preg_split", "(", "'/[;\\r\\n]...
解析验证规则 @param string $rules 验证规则 e.g. required;string,max:30;string,length:1-3 @param string $field 需要验证的字段 @return array e.g. [ [$field, 'required'], [$field, 'string', 'max' => 30], [$field, 'string', 'length' => [1,3]] ]
[ "解析验证规则" ]
train
https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/traits/ParseRulesTrait.php#L26-L53
Atlantic18/CoralCoreBundle
Service/Connector/StarkConnector.php
StarkConnector.doRequest
public function doRequest($method, $uri, $data = null) { $method = strtoupper($method); if( $method != Request::GET && $method != Request::POST && $method != Request::DELETE ) { throw new ConnectorException("Invalid method [$method] for...
php
public function doRequest($method, $uri, $data = null) { $method = strtoupper($method); if( $method != Request::GET && $method != Request::POST && $method != Request::DELETE ) { throw new ConnectorException("Invalid method [$method] for...
[ "public", "function", "doRequest", "(", "$", "method", ",", "$", "uri", ",", "$", "data", "=", "null", ")", "{", "$", "method", "=", "strtoupper", "(", "$", "method", ")", ";", "if", "(", "$", "method", "!=", "Request", "::", "GET", "&&", "$", "m...
Create request to CORAL backend @param string $method Method name @param string $uri Service URI @param array $payload Data to be sent @return JsonResponse Response
[ "Create", "request", "to", "CORAL", "backend" ]
train
https://github.com/Atlantic18/CoralCoreBundle/blob/7d74ffaf51046ad13cbfc2b0b69d656a499f38ab/Service/Connector/StarkConnector.php#L44-L66
weavephp/weave
src/Dispatch/Dispatch.php
Dispatch.dispatch
public function dispatch($dispatchable, $resolutionType, $dispatchSource, Request $request, ...$rest) { return $dispatchable($request, ...$rest); }
php
public function dispatch($dispatchable, $resolutionType, $dispatchSource, Request $request, ...$rest) { return $dispatchable($request, ...$rest); }
[ "public", "function", "dispatch", "(", "$", "dispatchable", ",", "$", "resolutionType", ",", "$", "dispatchSource", ",", "Request", "$", "request", ",", "...", "$", "rest", ")", "{", "return", "$", "dispatchable", "(", "$", "request", ",", "...", "$", "r...
Call the callable, providing parameters and returning the returned value. Override this method in subclasses to easily wrap the actual dispatch callable and provide pre- and post-dispatch custom functionality. $resolutionType and $dispatchSource can help in identifying when to conditionally wrap the dispatch to handl...
[ "Call", "the", "callable", "providing", "parameters", "and", "returning", "the", "returned", "value", "." ]
train
https://github.com/weavephp/weave/blob/44183a5bcb9e3ed3754cc76aa9e0724d718caeec/src/Dispatch/Dispatch.php#L31-L34
jan-dolata/crude-crud
src/Engine/Crude.php
Crude.prepareCrudeSetup
public function prepareCrudeSetup() { if (method_exists($this, 'prepareModelCrudeSetup')) return $this->prepareModelCrudeSetup(); $this->crudeSetup = new CrudeSetup($this->getCalledClassName(), []); return $this->crudeSetup; }
php
public function prepareCrudeSetup() { if (method_exists($this, 'prepareModelCrudeSetup')) return $this->prepareModelCrudeSetup(); $this->crudeSetup = new CrudeSetup($this->getCalledClassName(), []); return $this->crudeSetup; }
[ "public", "function", "prepareCrudeSetup", "(", ")", "{", "if", "(", "method_exists", "(", "$", "this", ",", "'prepareModelCrudeSetup'", ")", ")", "return", "$", "this", "->", "prepareModelCrudeSetup", "(", ")", ";", "$", "this", "->", "crudeSetup", "=", "ne...
Prepare default crude setup @return self
[ "Prepare", "default", "crude", "setup" ]
train
https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Engine/Crude.php#L54-L62
wizbii/pipeline
Service/Consumers.php
Consumers.get
public function get($key, $default = null) { return array_key_exists($key, $this->consumers) ? $this->consumers[$key] : $default; }
php
public function get($key, $default = null) { return array_key_exists($key, $this->consumers) ? $this->consumers[$key] : $default; }
[ "public", "function", "get", "(", "$", "key", ",", "$", "default", "=", "null", ")", "{", "return", "array_key_exists", "(", "$", "key", ",", "$", "this", "->", "consumers", ")", "?", "$", "this", "->", "consumers", "[", "$", "key", "]", ":", "$", ...
Returns a Consumer by name. @param string $key The key @param Consumer $default The default value @return Consumer
[ "Returns", "a", "Consumer", "by", "name", ".", "@param", "string", "$key", "The", "key", "@param", "Consumer", "$default", "The", "default", "value" ]
train
https://github.com/wizbii/pipeline/blob/8d22b976a53bb52abf0333b62b308ec7127cf414/Service/Consumers.php#L73-L76
arrilot/collectors
src/Collector.php
Collector.scanCollection
public function scanCollection($collection, $fields) { $fields = (array) $fields; foreach ($collection as $item) { $this->collectIdsFromItem($item, $fields); } return $this; }
php
public function scanCollection($collection, $fields) { $fields = (array) $fields; foreach ($collection as $item) { $this->collectIdsFromItem($item, $fields); } return $this; }
[ "public", "function", "scanCollection", "(", "$", "collection", ",", "$", "fields", ")", "{", "$", "fields", "=", "(", "array", ")", "$", "fields", ";", "foreach", "(", "$", "collection", "as", "$", "item", ")", "{", "$", "this", "->", "collectIdsFromI...
Add a collection source. @param $collection @param mixed $fields @return $this
[ "Add", "a", "collection", "source", "." ]
train
https://github.com/arrilot/collectors/blob/b2084462070d098f088eccea37bf800097e97807/src/Collector.php#L52-L60
arrilot/collectors
src/Collector.php
Collector.scanItem
public function scanItem($item, $fields) { $fields = (array) $fields; $this->collectIdsFromItem($item, $fields); return $this; }
php
public function scanItem($item, $fields) { $fields = (array) $fields; $this->collectIdsFromItem($item, $fields); return $this; }
[ "public", "function", "scanItem", "(", "$", "item", ",", "$", "fields", ")", "{", "$", "fields", "=", "(", "array", ")", "$", "fields", ";", "$", "this", "->", "collectIdsFromItem", "(", "$", "item", ",", "$", "fields", ")", ";", "return", "$", "th...
Add an item source. @param $item @param mixed $fields @return $this
[ "Add", "an", "item", "source", "." ]
train
https://github.com/arrilot/collectors/blob/b2084462070d098f088eccea37bf800097e97807/src/Collector.php#L69-L75
arrilot/collectors
src/Collector.php
Collector.addIds
public function addIds($ids) { foreach ($ids as $id) { if ((int) $id) { $this->ids[] = (int) $id; } } return $this; }
php
public function addIds($ids) { foreach ($ids as $id) { if ((int) $id) { $this->ids[] = (int) $id; } } return $this; }
[ "public", "function", "addIds", "(", "$", "ids", ")", "{", "foreach", "(", "$", "ids", "as", "$", "id", ")", "{", "if", "(", "(", "int", ")", "$", "id", ")", "{", "$", "this", "->", "ids", "[", "]", "=", "(", "int", ")", "$", "id", ";", "...
Add existeing ids array source. @param array $ids @return $this
[ "Add", "existeing", "ids", "array", "source", "." ]
train
https://github.com/arrilot/collectors/blob/b2084462070d098f088eccea37bf800097e97807/src/Collector.php#L83-L92
arrilot/collectors
src/Collector.php
Collector.collectIdsFromItem
protected function collectIdsFromItem($item, array $fields) { foreach ($fields as $field) { foreach ($this->collectIdsFromField($item, $field) as $id) { if ((int) $id) { $this->ids[] = (int) $id; } } } }
php
protected function collectIdsFromItem($item, array $fields) { foreach ($fields as $field) { foreach ($this->collectIdsFromField($item, $field) as $id) { if ((int) $id) { $this->ids[] = (int) $id; } } } }
[ "protected", "function", "collectIdsFromItem", "(", "$", "item", ",", "array", "$", "fields", ")", "{", "foreach", "(", "$", "fields", "as", "$", "field", ")", "{", "foreach", "(", "$", "this", "->", "collectIdsFromField", "(", "$", "item", ",", "$", "...
Collect ids from source and add them to $this->ids @param $item @param array $fields
[ "Collect", "ids", "from", "source", "and", "add", "them", "to", "$this", "-", ">", "ids" ]
train
https://github.com/arrilot/collectors/blob/b2084462070d098f088eccea37bf800097e97807/src/Collector.php#L140-L149
arrilot/collectors
src/Collector.php
Collector.collectIdsFromField
protected function collectIdsFromField($item, $field) { $ids = Arr::get($item, $field, []); return is_object($ids) && method_exists($ids, 'toArray') ? $ids->toArray() : (array) $ids; }
php
protected function collectIdsFromField($item, $field) { $ids = Arr::get($item, $field, []); return is_object($ids) && method_exists($ids, 'toArray') ? $ids->toArray() : (array) $ids; }
[ "protected", "function", "collectIdsFromField", "(", "$", "item", ",", "$", "field", ")", "{", "$", "ids", "=", "Arr", "::", "get", "(", "$", "item", ",", "$", "field", ",", "[", "]", ")", ";", "return", "is_object", "(", "$", "ids", ")", "&&", "...
Collect ids from field of item @param $item @param string $field @return array
[ "Collect", "ids", "from", "field", "of", "item" ]
train
https://github.com/arrilot/collectors/blob/b2084462070d098f088eccea37bf800097e97807/src/Collector.php#L158-L163
goblindegook/Syllables
src/Template/Loader/Post_Type_Archive.php
Post_Type_Archive._prepare_filter
protected function _prepare_filter() { $post_type = \get_queried_object(); if ( ! empty( $post_type->name ) && ! empty( $post_type->has_archive ) ) { $this->post_type = $post_type->name; } }
php
protected function _prepare_filter() { $post_type = \get_queried_object(); if ( ! empty( $post_type->name ) && ! empty( $post_type->has_archive ) ) { $this->post_type = $post_type->name; } }
[ "protected", "function", "_prepare_filter", "(", ")", "{", "$", "post_type", "=", "\\", "get_queried_object", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "post_type", "->", "name", ")", "&&", "!", "empty", "(", "$", "post_type", "->", "has_archive"...
Prepares the object when the filter is applied. @uses \get_queried_object() @codeCoverageIgnore
[ "Prepares", "the", "object", "when", "the", "filter", "is", "applied", "." ]
train
https://github.com/goblindegook/Syllables/blob/1a98cd15e37595a85b242242f88fee38c4e36acc/src/Template/Loader/Post_Type_Archive.php#L47-L53
ridvanbaluyos/mmda
src/Ridvanbaluyos/Mmda/MMDA.php
MMDA.segments
public function segments($highway = NULL) { if ($highway && isset($this->trafficData[$highway]['segments'])) { return array_keys($this->trafficData[$highway]['segments']); } return null; }
php
public function segments($highway = NULL) { if ($highway && isset($this->trafficData[$highway]['segments'])) { return array_keys($this->trafficData[$highway]['segments']); } return null; }
[ "public", "function", "segments", "(", "$", "highway", "=", "NULL", ")", "{", "if", "(", "$", "highway", "&&", "isset", "(", "$", "this", "->", "trafficData", "[", "$", "highway", "]", "[", "'segments'", "]", ")", ")", "{", "return", "array_keys", "(...
This function returns the list of segments in a given highway. @param $highway @return array|null
[ "This", "function", "returns", "the", "list", "of", "segments", "in", "a", "given", "highway", "." ]
train
https://github.com/ridvanbaluyos/mmda/blob/7aebc360b122fc4fe8d21d482341f5ebe091e7e2/src/Ridvanbaluyos/Mmda/MMDA.php#L66-L73
ridvanbaluyos/mmda
src/Ridvanbaluyos/Mmda/MMDA.php
MMDA.getTrafficData
final private function getTrafficData($feedUrl) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $feedUrl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); $xml = simplexml_load_string($response); return $this->...
php
final private function getTrafficData($feedUrl) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $feedUrl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); $xml = simplexml_load_string($response); return $this->...
[ "final", "private", "function", "getTrafficData", "(", "$", "feedUrl", ")", "{", "$", "ch", "=", "curl_init", "(", ")", ";", "curl_setopt", "(", "$", "ch", ",", "CURLOPT_URL", ",", "$", "feedUrl", ")", ";", "curl_setopt", "(", "$", "ch", ",", "CURLOPT_...
This function retrieves the traffic data from the MMDA Traffic API. @return array
[ "This", "function", "retrieves", "the", "traffic", "data", "from", "the", "MMDA", "Traffic", "API", "." ]
train
https://github.com/ridvanbaluyos/mmda/blob/7aebc360b122fc4fe8d21d482341f5ebe091e7e2/src/Ridvanbaluyos/Mmda/MMDA.php#L80-L91
ridvanbaluyos/mmda
src/Ridvanbaluyos/Mmda/MMDA.php
MMDA.parseTrafficData
final private function parseTrafficData($xml) { $traffic = []; foreach ($xml->channel->item as $item) { $item = get_object_vars($item); $title = $item['title']; $description = $item['description']; $pubDate = $item['pubDate']; $highway = ...
php
final private function parseTrafficData($xml) { $traffic = []; foreach ($xml->channel->item as $item) { $item = get_object_vars($item); $title = $item['title']; $description = $item['description']; $pubDate = $item['pubDate']; $highway = ...
[ "final", "private", "function", "parseTrafficData", "(", "$", "xml", ")", "{", "$", "traffic", "=", "[", "]", ";", "foreach", "(", "$", "xml", "->", "channel", "->", "item", "as", "$", "item", ")", "{", "$", "item", "=", "get_object_vars", "(", "$", ...
This function parses the XML response from the MMDA Traffic API into JSON. @param $xml @return array
[ "This", "function", "parses", "the", "XML", "response", "from", "the", "MMDA", "Traffic", "API", "into", "JSON", "." ]
train
https://github.com/ridvanbaluyos/mmda/blob/7aebc360b122fc4fe8d21d482341f5ebe091e7e2/src/Ridvanbaluyos/Mmda/MMDA.php#L99-L121
ridvanbaluyos/mmda
src/Ridvanbaluyos/Mmda/MMDA.php
MMDA.sanitizeTrafficData
final private function sanitizeTrafficData(Array $trafficData) { $traffic = []; foreach ($trafficData as $highway=>$segments) { $traffic[$highway] = [ 'name' => $highway, 'label' => $this->convertToTitle($highway), ]; $traffic[$high...
php
final private function sanitizeTrafficData(Array $trafficData) { $traffic = []; foreach ($trafficData as $highway=>$segments) { $traffic[$highway] = [ 'name' => $highway, 'label' => $this->convertToTitle($highway), ]; $traffic[$high...
[ "final", "private", "function", "sanitizeTrafficData", "(", "Array", "$", "trafficData", ")", "{", "$", "traffic", "=", "[", "]", ";", "foreach", "(", "$", "trafficData", "as", "$", "highway", "=>", "$", "segments", ")", "{", "$", "traffic", "[", "$", ...
This function sanitizes the traffic data and organizes them into an envelope @param array $trafficData @return array
[ "This", "function", "sanitizes", "the", "traffic", "data", "and", "organizes", "them", "into", "an", "envelope" ]
train
https://github.com/ridvanbaluyos/mmda/blob/7aebc360b122fc4fe8d21d482341f5ebe091e7e2/src/Ridvanbaluyos/Mmda/MMDA.php#L129-L152
ridvanbaluyos/mmda
src/Ridvanbaluyos/Mmda/MMDA.php
MMDA.convertToStatus
final private function convertToStatus(Array $data) { $statusMatrix = [ 'L' => 'Light', 'ML' => 'Light to Moderate', 'M' => 'Moderate', 'MH' => 'Moderate to Heavy', 'H' => 'Heavy' ]; $status = [ 'NB' => [ ...
php
final private function convertToStatus(Array $data) { $statusMatrix = [ 'L' => 'Light', 'ML' => 'Light to Moderate', 'M' => 'Moderate', 'MH' => 'Moderate to Heavy', 'H' => 'Heavy' ]; $status = [ 'NB' => [ ...
[ "final", "private", "function", "convertToStatus", "(", "Array", "$", "data", ")", "{", "$", "statusMatrix", "=", "[", "'L'", "=>", "'Light'", ",", "'ML'", "=>", "'Light to Moderate'", ",", "'M'", "=>", "'Moderate'", ",", "'MH'", "=>", "'Moderate to Heavy'", ...
This function converts traffic data status to readable format. @param array $data @return array
[ "This", "function", "converts", "traffic", "data", "status", "to", "readable", "format", "." ]
train
https://github.com/ridvanbaluyos/mmda/blob/7aebc360b122fc4fe8d21d482341f5ebe091e7e2/src/Ridvanbaluyos/Mmda/MMDA.php#L160-L184
ridvanbaluyos/mmda
src/Ridvanbaluyos/Mmda/MMDA.php
MMDA.convertToTitle
final private function convertToTitle($string) { $string2 = []; $string = str_replace(['_', 'AVE.', 'BLVD.'], [' ', 'AVENUE', 'BOULEVARD'], $string); $words = explode(' ', $string); foreach ($words as $word) { if (!in_array($word, ['EDSA', 'U.N.'])) { $wo...
php
final private function convertToTitle($string) { $string2 = []; $string = str_replace(['_', 'AVE.', 'BLVD.'], [' ', 'AVENUE', 'BOULEVARD'], $string); $words = explode(' ', $string); foreach ($words as $word) { if (!in_array($word, ['EDSA', 'U.N.'])) { $wo...
[ "final", "private", "function", "convertToTitle", "(", "$", "string", ")", "{", "$", "string2", "=", "[", "]", ";", "$", "string", "=", "str_replace", "(", "[", "'_'", ",", "'AVE.'", ",", "'BLVD.'", "]", ",", "[", "' '", ",", "'AVENUE'", ",", "'BOULE...
This function sanitizes certain abbreviations into readable format. @param $string @return string
[ "This", "function", "sanitizes", "certain", "abbreviations", "into", "readable", "format", "." ]
train
https://github.com/ridvanbaluyos/mmda/blob/7aebc360b122fc4fe8d21d482341f5ebe091e7e2/src/Ridvanbaluyos/Mmda/MMDA.php#L192-L206
chris-schmitz/L5SimpleFM
src/L5SimpleFM.php
L5SimpleFM.findByFields
public function findByFields($fieldValues) { if (empty($fieldValues)) { throw new \Exception('No field values specified'); } $this->primeCommandArray(); $this->addToCommandArray($fieldValues); $this->addToCommandArray(['-find' => null]); return $this; ...
php
public function findByFields($fieldValues) { if (empty($fieldValues)) { throw new \Exception('No field values specified'); } $this->primeCommandArray(); $this->addToCommandArray($fieldValues); $this->addToCommandArray(['-find' => null]); return $this; ...
[ "public", "function", "findByFields", "(", "$", "fieldValues", ")", "{", "if", "(", "empty", "(", "$", "fieldValues", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "'No field values specified'", ")", ";", "}", "$", "this", "->", "primeCommandArray",...
Find record(s) based on field data @param array An associative array of FieldNames => SearchValues @return object This class
[ "Find", "record", "(", "s", ")", "based", "on", "field", "data" ]
train
https://github.com/chris-schmitz/L5SimpleFM/blob/9c3250e0918184d537a46c15140f15527e833a4c/src/L5SimpleFM.php#L56-L65
chris-schmitz/L5SimpleFM
src/L5SimpleFM.php
L5SimpleFM.findByRecId
public function findByRecId($recId) { if (empty($recId)) { throw new \Exception('No record ID specified'); } $this->primeCommandArray(); $this->addToCommandArray(['-recid' => $recId]); $this->addToCommandArray(['-find' => null]); return $this; }
php
public function findByRecId($recId) { if (empty($recId)) { throw new \Exception('No record ID specified'); } $this->primeCommandArray(); $this->addToCommandArray(['-recid' => $recId]); $this->addToCommandArray(['-find' => null]); return $this; }
[ "public", "function", "findByRecId", "(", "$", "recId", ")", "{", "if", "(", "empty", "(", "$", "recId", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "'No record ID specified'", ")", ";", "}", "$", "this", "->", "primeCommandArray", "(", ")", ...
Find a record based on it's internal FileMaker record ID @param integer The internal FileMaker Record ID @return object This object
[ "Find", "a", "record", "based", "on", "it", "s", "internal", "FileMaker", "record", "ID" ]
train
https://github.com/chris-schmitz/L5SimpleFM/blob/9c3250e0918184d537a46c15140f15527e833a4c/src/L5SimpleFM.php#L72-L81
chris-schmitz/L5SimpleFM
src/L5SimpleFM.php
L5SimpleFM.createRecord
public function createRecord($data) { $this->primeCommandArray(); $this->addToCommandArray($data); $this->addToCommandArray(['-new' => null]); return $this; }
php
public function createRecord($data) { $this->primeCommandArray(); $this->addToCommandArray($data); $this->addToCommandArray(['-new' => null]); return $this; }
[ "public", "function", "createRecord", "(", "$", "data", ")", "{", "$", "this", "->", "primeCommandArray", "(", ")", ";", "$", "this", "->", "addToCommandArray", "(", "$", "data", ")", ";", "$", "this", "->", "addToCommandArray", "(", "[", "'-new'", "=>",...
Create a new record and populate it with data. @param array An associative array of FileName => Values to populate the record with @return object This object
[ "Create", "a", "new", "record", "and", "populate", "it", "with", "data", "." ]
train
https://github.com/chris-schmitz/L5SimpleFM/blob/9c3250e0918184d537a46c15140f15527e833a4c/src/L5SimpleFM.php#L88-L94
chris-schmitz/L5SimpleFM
src/L5SimpleFM.php
L5SimpleFM.updateRecord
public function updateRecord($recId, $data) { if (empty($recId)) { throw new \Exception('No record ID specified'); } $this->primeCommandArray(); $this->addToCommandArray($data); $this->addToCommandArray(['-recid' => $recId]); $this->addToCommandArray(['-ed...
php
public function updateRecord($recId, $data) { if (empty($recId)) { throw new \Exception('No record ID specified'); } $this->primeCommandArray(); $this->addToCommandArray($data); $this->addToCommandArray(['-recid' => $recId]); $this->addToCommandArray(['-ed...
[ "public", "function", "updateRecord", "(", "$", "recId", ",", "$", "data", ")", "{", "if", "(", "empty", "(", "$", "recId", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "'No record ID specified'", ")", ";", "}", "$", "this", "->", "primeComma...
Update data in an existing record per it's internal FileMaker record ID. @param integer The internal FileMaker record ID. @param array An associative array of FileName => Values to overwrite the record with Data in fields not included will not be overwritten. @return object This object
[ "Update", "data", "in", "an", "existing", "record", "per", "it", "s", "internal", "FileMaker", "record", "ID", "." ]
train
https://github.com/chris-schmitz/L5SimpleFM/blob/9c3250e0918184d537a46c15140f15527e833a4c/src/L5SimpleFM.php#L103-L113
chris-schmitz/L5SimpleFM
src/L5SimpleFM.php
L5SimpleFM.deleteRecord
public function deleteRecord($recId) { if (empty($recId)) { throw new \Exception('No record ID specified'); } $this->primeCommandArray(); $this->addToCommandArray(['-recid' => $recId]); $this->addToCommandArray(['-delete' => null]); return $this; }
php
public function deleteRecord($recId) { if (empty($recId)) { throw new \Exception('No record ID specified'); } $this->primeCommandArray(); $this->addToCommandArray(['-recid' => $recId]); $this->addToCommandArray(['-delete' => null]); return $this; }
[ "public", "function", "deleteRecord", "(", "$", "recId", ")", "{", "if", "(", "empty", "(", "$", "recId", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "'No record ID specified'", ")", ";", "}", "$", "this", "->", "primeCommandArray", "(", ")", ...
Delete a record per it's internal FileMaker record ID. @param integer The internal FileMaker record ID. @return object This object
[ "Delete", "a", "record", "per", "it", "s", "internal", "FileMaker", "record", "ID", "." ]
train
https://github.com/chris-schmitz/L5SimpleFM/blob/9c3250e0918184d537a46c15140f15527e833a4c/src/L5SimpleFM.php#L120-L129
matthiasbayer/datadog-client
src/Bayer/DataDogClient/Event.php
Event.setPriority
public function setPriority($priority) { if (!$this->isValidPriority($priority)) { throw new InvalidPriorityException('Priority must be on of Event::PRIORITY_*'); } $this->priority = $priority; return $this; }
php
public function setPriority($priority) { if (!$this->isValidPriority($priority)) { throw new InvalidPriorityException('Priority must be on of Event::PRIORITY_*'); } $this->priority = $priority; return $this; }
[ "public", "function", "setPriority", "(", "$", "priority", ")", "{", "if", "(", "!", "$", "this", "->", "isValidPriority", "(", "$", "priority", ")", ")", "{", "throw", "new", "InvalidPriorityException", "(", "'Priority must be on of Event::PRIORITY_*'", ")", ";...
@param mixed $priority @throws Event\InvalidPriorityException @return Event
[ "@param", "mixed", "$priority", "@throws", "Event", "\\", "InvalidPriorityException" ]
train
https://github.com/matthiasbayer/datadog-client/blob/e625132c34bf36f783077c9ee4ed3214633cd272/src/Bayer/DataDogClient/Event.php#L177-L184
matthiasbayer/datadog-client
src/Bayer/DataDogClient/Event.php
Event.setAlertType
public function setAlertType($type) { if (!$this->isValidType($type)) { throw new InvalidAlertTypeException('Type must be one of Event::TYPE_*'); } $this->alertType = $type; return $this; }
php
public function setAlertType($type) { if (!$this->isValidType($type)) { throw new InvalidAlertTypeException('Type must be one of Event::TYPE_*'); } $this->alertType = $type; return $this; }
[ "public", "function", "setAlertType", "(", "$", "type", ")", "{", "if", "(", "!", "$", "this", "->", "isValidType", "(", "$", "type", ")", ")", "{", "throw", "new", "InvalidAlertTypeException", "(", "'Type must be one of Event::TYPE_*'", ")", ";", "}", "$", ...
@param mixed $type @throws InvalidAlertTypeException @return Event
[ "@param", "mixed", "$type", "@throws", "InvalidAlertTypeException" ]
train
https://github.com/matthiasbayer/datadog-client/blob/e625132c34bf36f783077c9ee4ed3214633cd272/src/Bayer/DataDogClient/Event.php#L199-L206
matthiasbayer/datadog-client
src/Bayer/DataDogClient/Event.php
Event.setSourceTypeName
public function setSourceTypeName($sourceType) { if (!$this->isValidSourceType($sourceType)) { throw new InvalidSourceTypeException('SourceTyoe must be on of Event::SOURCE_*'); } $this->sourceTypeName = $sourceType; return $this; }
php
public function setSourceTypeName($sourceType) { if (!$this->isValidSourceType($sourceType)) { throw new InvalidSourceTypeException('SourceTyoe must be on of Event::SOURCE_*'); } $this->sourceTypeName = $sourceType; return $this; }
[ "public", "function", "setSourceTypeName", "(", "$", "sourceType", ")", "{", "if", "(", "!", "$", "this", "->", "isValidSourceType", "(", "$", "sourceType", ")", ")", "{", "throw", "new", "InvalidSourceTypeException", "(", "'SourceTyoe must be on of Event::SOURCE_*'...
@param mixed $sourceType @throws Event\InvalidSourceTypeException @return Event
[ "@param", "mixed", "$sourceType", "@throws", "Event", "\\", "InvalidSourceTypeException" ]
train
https://github.com/matthiasbayer/datadog-client/blob/e625132c34bf36f783077c9ee4ed3214633cd272/src/Bayer/DataDogClient/Event.php#L239-L246
100hz/hive
src/Hive/Hive.php
Hive.createDocumentManager
protected function createDocumentManager() { AnnotationDriver::registerAnnotationClasses(); $configuration = new Configuration(); $configuration->setProxyDir($this->configuration['doctrine']['proxyDir']); $configuration->setProxyNamespace($this->configuration['doctrine']['proxyNames...
php
protected function createDocumentManager() { AnnotationDriver::registerAnnotationClasses(); $configuration = new Configuration(); $configuration->setProxyDir($this->configuration['doctrine']['proxyDir']); $configuration->setProxyNamespace($this->configuration['doctrine']['proxyNames...
[ "protected", "function", "createDocumentManager", "(", ")", "{", "AnnotationDriver", "::", "registerAnnotationClasses", "(", ")", ";", "$", "configuration", "=", "new", "Configuration", "(", ")", ";", "$", "configuration", "->", "setProxyDir", "(", "$", "this", ...
Creates the doctrine document mananger for working on the database @return DocumentManager
[ "Creates", "the", "doctrine", "document", "mananger", "for", "working", "on", "the", "database" ]
train
https://github.com/100hz/hive/blob/b336b092255ce885b1ff9bf78d49693c4daf1c72/src/Hive/Hive.php#L154-L166
100hz/hive
src/Hive/Hive.php
Hive.initPromises
protected function initPromises($promisesTrait) { return $promisesTrait->findOne($this->createFindOneClosure()) ->findMany($this->createFindManyClosure()) ->renderResult($this->createRenderResultClosure()) ->allowRequest($this->createAllowRequestClosure()); }
php
protected function initPromises($promisesTrait) { return $promisesTrait->findOne($this->createFindOneClosure()) ->findMany($this->createFindManyClosure()) ->renderResult($this->createRenderResultClosure()) ->allowRequest($this->createAllowRequestClosure()); }
[ "protected", "function", "initPromises", "(", "$", "promisesTrait", ")", "{", "return", "$", "promisesTrait", "->", "findOne", "(", "$", "this", "->", "createFindOneClosure", "(", ")", ")", "->", "findMany", "(", "$", "this", "->", "createFindManyClosure", "("...
Method for initializing a PromisesTrait object with the Closures @param PromisesTrait|Hive|Resource $promisesTrait @return PromisesTrait|Hive|Resource
[ "Method", "for", "initializing", "a", "PromisesTrait", "object", "with", "the", "Closures" ]
train
https://github.com/100hz/hive/blob/b336b092255ce885b1ff9bf78d49693c4daf1c72/src/Hive/Hive.php#L174-L180
100hz/hive
src/Hive/Hive.php
Hive.setupIndexReferences
protected function setupIndexReferences($resource) { foreach ($resource->settings['actions']['IndexReferences']['uris'] as $property => $uri) { $this->setupIndex($resource, $uri, $property); } }
php
protected function setupIndexReferences($resource) { foreach ($resource->settings['actions']['IndexReferences']['uris'] as $property => $uri) { $this->setupIndex($resource, $uri, $property); } }
[ "protected", "function", "setupIndexReferences", "(", "$", "resource", ")", "{", "foreach", "(", "$", "resource", "->", "settings", "[", "'actions'", "]", "[", "'IndexReferences'", "]", "[", "'uris'", "]", "as", "$", "property", "=>", "$", "uri", ")", "{",...
@param \Hive\Resource $resource @return void
[ "@param", "\\", "Hive", "\\", "Resource", "$resource" ]
train
https://github.com/100hz/hive/blob/b336b092255ce885b1ff9bf78d49693c4daf1c72/src/Hive/Hive.php#L428-L433
100hz/hive
src/Hive/Hive.php
Hive.setupReadReference
protected function setupReadReference($resource) { foreach ($resource->settings['actions']['ReadReference']['uris'] as $property => $uri) { $this->setupRead($resource, $uri, $property); } }
php
protected function setupReadReference($resource) { foreach ($resource->settings['actions']['ReadReference']['uris'] as $property => $uri) { $this->setupRead($resource, $uri, $property); } }
[ "protected", "function", "setupReadReference", "(", "$", "resource", ")", "{", "foreach", "(", "$", "resource", "->", "settings", "[", "'actions'", "]", "[", "'ReadReference'", "]", "[", "'uris'", "]", "as", "$", "property", "=>", "$", "uri", ")", "{", "...
@param \Hive\Resource $resource @return void
[ "@param", "\\", "Hive", "\\", "Resource", "$resource" ]
train
https://github.com/100hz/hive/blob/b336b092255ce885b1ff9bf78d49693c4daf1c72/src/Hive/Hive.php#L440-L445
100hz/hive
src/Hive/Hive.php
Hive.setupCreateReference
protected function setupCreateReference($resource) { foreach ($resource->settings['actions']['CreateReference']['uris'] as $property => $uri) { $this->setupCreate($resource, $uri, $property); } }
php
protected function setupCreateReference($resource) { foreach ($resource->settings['actions']['CreateReference']['uris'] as $property => $uri) { $this->setupCreate($resource, $uri, $property); } }
[ "protected", "function", "setupCreateReference", "(", "$", "resource", ")", "{", "foreach", "(", "$", "resource", "->", "settings", "[", "'actions'", "]", "[", "'CreateReference'", "]", "[", "'uris'", "]", "as", "$", "property", "=>", "$", "uri", ")", "{",...
@param \Hive\Resource $resource @return void
[ "@param", "\\", "Hive", "\\", "Resource", "$resource" ]
train
https://github.com/100hz/hive/blob/b336b092255ce885b1ff9bf78d49693c4daf1c72/src/Hive/Hive.php#L452-L457
100hz/hive
src/Hive/Hive.php
Hive.setupUpdateReference
protected function setupUpdateReference($resource) { foreach ($resource->settings['actions']['UpdateReference']['uris'] as $property => $uri) { $this->setupUpdate($resource, $uri, $property); } }
php
protected function setupUpdateReference($resource) { foreach ($resource->settings['actions']['UpdateReference']['uris'] as $property => $uri) { $this->setupUpdate($resource, $uri, $property); } }
[ "protected", "function", "setupUpdateReference", "(", "$", "resource", ")", "{", "foreach", "(", "$", "resource", "->", "settings", "[", "'actions'", "]", "[", "'UpdateReference'", "]", "[", "'uris'", "]", "as", "$", "property", "=>", "$", "uri", ")", "{",...
@param \Hive\Resource $resource @return void
[ "@param", "\\", "Hive", "\\", "Resource", "$resource" ]
train
https://github.com/100hz/hive/blob/b336b092255ce885b1ff9bf78d49693c4daf1c72/src/Hive/Hive.php#L464-L469
100hz/hive
src/Hive/Hive.php
Hive.setupDeleteReference
protected function setupDeleteReference($resource) { foreach ($resource->settings['actions']['DeleteReference']['uris'] as $property => $uri) { $this->setupDelete($resource, $uri, $property); } }
php
protected function setupDeleteReference($resource) { foreach ($resource->settings['actions']['DeleteReference']['uris'] as $property => $uri) { $this->setupDelete($resource, $uri, $property); } }
[ "protected", "function", "setupDeleteReference", "(", "$", "resource", ")", "{", "foreach", "(", "$", "resource", "->", "settings", "[", "'actions'", "]", "[", "'DeleteReference'", "]", "[", "'uris'", "]", "as", "$", "property", "=>", "$", "uri", ")", "{",...
@param \Hive\Resource $resource @return void
[ "@param", "\\", "Hive", "\\", "Resource", "$resource" ]
train
https://github.com/100hz/hive/blob/b336b092255ce885b1ff9bf78d49693c4daf1c72/src/Hive/Hive.php#L476-L481
100hz/hive
src/Hive/Hive.php
Hive.createHttpException
protected function createHttpException($code, $message = null) { if ($code == 404) { $message = 'Entity not found'; } $exception = new HttpException($message, $code); return $exception; }
php
protected function createHttpException($code, $message = null) { if ($code == 404) { $message = 'Entity not found'; } $exception = new HttpException($message, $code); return $exception; }
[ "protected", "function", "createHttpException", "(", "$", "code", ",", "$", "message", "=", "null", ")", "{", "if", "(", "$", "code", "==", "404", ")", "{", "$", "message", "=", "'Entity not found'", ";", "}", "$", "exception", "=", "new", "HttpException...
Helper method for creating HTTP exceptions @param int $code @param string $message @return HttpException
[ "Helper", "method", "for", "creating", "HTTP", "exceptions" ]
train
https://github.com/100hz/hive/blob/b336b092255ce885b1ff9bf78d49693c4daf1c72/src/Hive/Hive.php#L769-L777
100hz/hive
src/Hive/Hive.php
Hive.resource
public function resource($className, $settings = []) { /** @var \Hive\Resource $resource */ $resource = $this->initPromises(Resource::create($className, $settings, $this)); foreach ($resource->settings['actions'] as $action => $actionSettings) { $methodName = "setup$action"; ...
php
public function resource($className, $settings = []) { /** @var \Hive\Resource $resource */ $resource = $this->initPromises(Resource::create($className, $settings, $this)); foreach ($resource->settings['actions'] as $action => $actionSettings) { $methodName = "setup$action"; ...
[ "public", "function", "resource", "(", "$", "className", ",", "$", "settings", "=", "[", "]", ")", "{", "/** @var \\Hive\\Resource $resource */", "$", "resource", "=", "$", "this", "->", "initPromises", "(", "Resource", "::", "create", "(", "$", "className", ...
The second most important method. Will create RESTful routes for MongoDB model. @param string $className @param array $settings @return PromisesTrait|Resource
[ "The", "second", "most", "important", "method", ".", "Will", "create", "RESTful", "routes", "for", "MongoDB", "model", "." ]
train
https://github.com/100hz/hive/blob/b336b092255ce885b1ff9bf78d49693c4daf1c72/src/Hive/Hive.php#L800-L813
100hz/hive
src/Hive/Hive.php
Hive.api
public function api($request = null, $response = null, $sendResponse = true) { $this->klein->respond('POST', '/authenticate', $this->authenticate); $this->klein->onHttpError($this->handleError); // see https://github.com/klein/klein.php/wiki/Sub-Directory-Installation if ($request =...
php
public function api($request = null, $response = null, $sendResponse = true) { $this->klein->respond('POST', '/authenticate', $this->authenticate); $this->klein->onHttpError($this->handleError); // see https://github.com/klein/klein.php/wiki/Sub-Directory-Installation if ($request =...
[ "public", "function", "api", "(", "$", "request", "=", "null", ",", "$", "response", "=", "null", ",", "$", "sendResponse", "=", "true", ")", "{", "$", "this", "->", "klein", "->", "respond", "(", "'POST'", ",", "'/authenticate'", ",", "$", "this", "...
The most important method. Will start the hive engine and listening for requests. @param Request $request @param AbstractResponse $response @param boolean $sendResponse @return void
[ "The", "most", "important", "method", ".", "Will", "start", "the", "hive", "engine", "and", "listening", "for", "requests", "." ]
train
https://github.com/100hz/hive/blob/b336b092255ce885b1ff9bf78d49693c4daf1c72/src/Hive/Hive.php#L825-L842
cronario/cronario
src/AbstractJob.php
AbstractJob.getParam
public function getParam($key = null, $default = null) { if (null === $key) { return $this->data[self::P_PARAMS]; } return $this->hasParam($key) ? $this->data[self::P_PARAMS][$key] : $default; }
php
public function getParam($key = null, $default = null) { if (null === $key) { return $this->data[self::P_PARAMS]; } return $this->hasParam($key) ? $this->data[self::P_PARAMS][$key] : $default; }
[ "public", "function", "getParam", "(", "$", "key", "=", "null", ",", "$", "default", "=", "null", ")", "{", "if", "(", "null", "===", "$", "key", ")", "{", "return", "$", "this", "->", "data", "[", "self", "::", "P_PARAMS", "]", ";", "}", "return...
@param null $key @param null $default @return string|int|null
[ "@param", "null", "$key", "@param", "null", "$default" ]
train
https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/AbstractJob.php#L309-L316
cronario/cronario
src/AbstractJob.php
AbstractJob.hasParam
public function hasParam($key) { return $this->hasData(self::P_PARAMS) && array_key_exists($key, (array) $this->data[self::P_PARAMS]); }
php
public function hasParam($key) { return $this->hasData(self::P_PARAMS) && array_key_exists($key, (array) $this->data[self::P_PARAMS]); }
[ "public", "function", "hasParam", "(", "$", "key", ")", "{", "return", "$", "this", "->", "hasData", "(", "self", "::", "P_PARAMS", ")", "&&", "array_key_exists", "(", "$", "key", ",", "(", "array", ")", "$", "this", "->", "data", "[", "self", "::", ...
@param $key @return bool
[ "@param", "$key" ]
train
https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/AbstractJob.php#L323-L326
cronario/cronario
src/AbstractJob.php
AbstractJob.setParam
public function setParam($key, $value) { $this->data[self::P_PARAMS][$key] = $value; return $this; }
php
public function setParam($key, $value) { $this->data[self::P_PARAMS][$key] = $value; return $this; }
[ "public", "function", "setParam", "(", "$", "key", ",", "$", "value", ")", "{", "$", "this", "->", "data", "[", "self", "::", "P_PARAMS", "]", "[", "$", "key", "]", "=", "$", "value", ";", "return", "$", "this", ";", "}" ]
@param $key @param $value @return $this
[ "@param", "$key", "@param", "$value" ]
train
https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/AbstractJob.php#L345-L350
cronario/cronario
src/AbstractJob.php
AbstractJob.setResult
public function setResult($result, $data = null) { if (null === $result) { return $this; } if (is_numeric($result)) { if ($result > 1000) { $result = ResultException::factory($result, $data); } else { $result = new static::...
php
public function setResult($result, $data = null) { if (null === $result) { return $this; } if (is_numeric($result)) { if ($result > 1000) { $result = ResultException::factory($result, $data); } else { $result = new static::...
[ "public", "function", "setResult", "(", "$", "result", ",", "$", "data", "=", "null", ")", "{", "if", "(", "null", "===", "$", "result", ")", "{", "return", "$", "this", ";", "}", "if", "(", "is_numeric", "(", "$", "result", ")", ")", "{", "if", ...
@param $result @param null $data @return ResultException|mixed @throws \Result\RuntimeException
[ "@param", "$result", "@param", "null", "$data" ]
train
https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/AbstractJob.php#L375-L406
cronario/cronario
src/AbstractJob.php
AbstractJob.setId
public function setId($id) { if ($this->hasData(self::P_ID)) { throw new JobException('Cant set id cause it is already sets!'); } return $this->setData(self::P_ID, $id); }
php
public function setId($id) { if ($this->hasData(self::P_ID)) { throw new JobException('Cant set id cause it is already sets!'); } return $this->setData(self::P_ID, $id); }
[ "public", "function", "setId", "(", "$", "id", ")", "{", "if", "(", "$", "this", "->", "hasData", "(", "self", "::", "P_ID", ")", ")", "{", "throw", "new", "JobException", "(", "'Cant set id cause it is already sets!'", ")", ";", "}", "return", "$", "thi...
@param $id @return AbstractJob @throws JobException
[ "@param", "$id" ]
train
https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/AbstractJob.php#L458-L465
cronario/cronario
src/AbstractJob.php
AbstractJob.getScheduleDelay
public function getScheduleDelay() { $value = $this->getSchedule(); if (null === $value) { return -1; } $object = CronExpression::factory($value); $format = 'Y-m-d H:i:s'; $timeFirst = strtotime($object->getNextRunDate()->format($format)); $timeS...
php
public function getScheduleDelay() { $value = $this->getSchedule(); if (null === $value) { return -1; } $object = CronExpression::factory($value); $format = 'Y-m-d H:i:s'; $timeFirst = strtotime($object->getNextRunDate()->format($format)); $timeS...
[ "public", "function", "getScheduleDelay", "(", ")", "{", "$", "value", "=", "$", "this", "->", "getSchedule", "(", ")", ";", "if", "(", "null", "===", "$", "value", ")", "{", "return", "-", "1", ";", "}", "$", "object", "=", "CronExpression", "::", ...
@return int return -1 : if schedule is not set return x >= 0 : if schedule is set
[ "@return", "int" ]
train
https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/AbstractJob.php#L638-L652
cronario/cronario
src/AbstractJob.php
AbstractJob.addDebug
public function addDebug($value) { if (!$this->isDebug()) { return $this; } return $this->addData( self::P_DEBUG, is_array($value) ? json_encode($value) : $value ); }
php
public function addDebug($value) { if (!$this->isDebug()) { return $this; } return $this->addData( self::P_DEBUG, is_array($value) ? json_encode($value) : $value ); }
[ "public", "function", "addDebug", "(", "$", "value", ")", "{", "if", "(", "!", "$", "this", "->", "isDebug", "(", ")", ")", "{", "return", "$", "this", ";", "}", "return", "$", "this", "->", "addData", "(", "self", "::", "P_DEBUG", ",", "is_array",...
@param $value @return $this|AbstractJob
[ "@param", "$value" ]
train
https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/AbstractJob.php#L832-L842
cronario/cronario
src/AbstractJob.php
AbstractJob.setCreateOn
public function setCreateOn($value) { if (!is_int($value)) { throw new JobException('Job setExpiredOn can sets only integer type!'); } return $this->setData(self::P_CREATE_ON, $value); }
php
public function setCreateOn($value) { if (!is_int($value)) { throw new JobException('Job setExpiredOn can sets only integer type!'); } return $this->setData(self::P_CREATE_ON, $value); }
[ "public", "function", "setCreateOn", "(", "$", "value", ")", "{", "if", "(", "!", "is_int", "(", "$", "value", ")", ")", "{", "throw", "new", "JobException", "(", "'Job setExpiredOn can sets only integer type!'", ")", ";", "}", "return", "$", "this", "->", ...
@param $value @return AbstractJob @throws JobException
[ "@param", "$value" ]
train
https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/AbstractJob.php#L869-L876
cronario/cronario
src/AbstractJob.php
AbstractJob.setExpiredOn
public function setExpiredOn($value) { if (!is_int($value)) { throw new JobException('Job setExpiredOn can sets only integer type!'); } return $this->setData(self::P_EXPIRED_ON, $value); }
php
public function setExpiredOn($value) { if (!is_int($value)) { throw new JobException('Job setExpiredOn can sets only integer type!'); } return $this->setData(self::P_EXPIRED_ON, $value); }
[ "public", "function", "setExpiredOn", "(", "$", "value", ")", "{", "if", "(", "!", "is_int", "(", "$", "value", ")", ")", "{", "throw", "new", "JobException", "(", "'Job setExpiredOn can sets only integer type!'", ")", ";", "}", "return", "$", "this", "->", ...
@param $value @return AbstractJob @throws JobException
[ "@param", "$value" ]
train
https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/AbstractJob.php#L892-L899
cronario/cronario
src/AbstractJob.php
AbstractJob.setDeleteOn
public function setDeleteOn($value) { if (!is_int($value)) { throw new JobException('Job setStartOn can sets only integer type!'); } return $this->setData(self::P_DELETE_ON, $value); }
php
public function setDeleteOn($value) { if (!is_int($value)) { throw new JobException('Job setStartOn can sets only integer type!'); } return $this->setData(self::P_DELETE_ON, $value); }
[ "public", "function", "setDeleteOn", "(", "$", "value", ")", "{", "if", "(", "!", "is_int", "(", "$", "value", ")", ")", "{", "throw", "new", "JobException", "(", "'Job setStartOn can sets only integer type!'", ")", ";", "}", "return", "$", "this", "->", "...
@param $value @return AbstractJob @throws JobException
[ "@param", "$value" ]
train
https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/AbstractJob.php#L915-L922
cronario/cronario
src/AbstractJob.php
AbstractJob.setStartOn
public function setStartOn($value) { if (!is_int($value)) { throw new JobException('Job setStartOn can sets only integer type!'); } return $this->setData(self::P_START_ON, $value); }
php
public function setStartOn($value) { if (!is_int($value)) { throw new JobException('Job setStartOn can sets only integer type!'); } return $this->setData(self::P_START_ON, $value); }
[ "public", "function", "setStartOn", "(", "$", "value", ")", "{", "if", "(", "!", "is_int", "(", "$", "value", ")", ")", "{", "throw", "new", "JobException", "(", "'Job setStartOn can sets only integer type!'", ")", ";", "}", "return", "$", "this", "->", "s...
@param $value @return AbstractJob @throws JobException
[ "@param", "$value" ]
train
https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/AbstractJob.php#L946-L953
cronario/cronario
src/AbstractJob.php
AbstractJob.getCallbacksByType
public function getCallbacksByType($type) { if (array_key_exists($type, $this->callbacks) && count($this->callbacks[$type]) > 0) { return $this->callbacks[$type]; } return []; }
php
public function getCallbacksByType($type) { if (array_key_exists($type, $this->callbacks) && count($this->callbacks[$type]) > 0) { return $this->callbacks[$type]; } return []; }
[ "public", "function", "getCallbacksByType", "(", "$", "type", ")", "{", "if", "(", "array_key_exists", "(", "$", "type", ",", "$", "this", "->", "callbacks", ")", "&&", "count", "(", "$", "this", "->", "callbacks", "[", "$", "type", "]", ")", ">", "0...
@param $type @return array
[ "@param", "$type" ]
train
https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/AbstractJob.php#L983-L990
cronario/cronario
src/AbstractJob.php
AbstractJob.setCallbacks
public function setCallbacks(array $callbacks = []) { foreach ($callbacks as $type => $items) { foreach ($items as $item) { $this->addCallbackJob($type, $item); } } return $this; }
php
public function setCallbacks(array $callbacks = []) { foreach ($callbacks as $type => $items) { foreach ($items as $item) { $this->addCallbackJob($type, $item); } } return $this; }
[ "public", "function", "setCallbacks", "(", "array", "$", "callbacks", "=", "[", "]", ")", "{", "foreach", "(", "$", "callbacks", "as", "$", "type", "=>", "$", "items", ")", "{", "foreach", "(", "$", "items", "as", "$", "item", ")", "{", "$", "this"...
@param array $callbacks @return $this @throws JobException
[ "@param", "array", "$callbacks" ]
train
https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/AbstractJob.php#L998-L1007
cronario/cronario
src/AbstractJob.php
AbstractJob.addCallbackJob
protected function addCallbackJob($type, $job) { if (is_object($job) && $job instanceof self) { $this->data[self::P_CALLBACKS][$type][] = serialize($job); $this->callbacks[$type][] = $job; return $this; } if (is_string($job)) { $this->data[se...
php
protected function addCallbackJob($type, $job) { if (is_object($job) && $job instanceof self) { $this->data[self::P_CALLBACKS][$type][] = serialize($job); $this->callbacks[$type][] = $job; return $this; } if (is_string($job)) { $this->data[se...
[ "protected", "function", "addCallbackJob", "(", "$", "type", ",", "$", "job", ")", "{", "if", "(", "is_object", "(", "$", "job", ")", "&&", "$", "job", "instanceof", "self", ")", "{", "$", "this", "->", "data", "[", "self", "::", "P_CALLBACKS", "]", ...
@param $type @param $job @return $this @throws JobException
[ "@param", "$type", "@param", "$job" ]
train
https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/AbstractJob.php#L1092-L1109
FrenchFrogs/framework
src/Laravel/Database/Eloquent/Model.php
Model.insertAndSetId
protected function insertAndSetId(Builder $query, $attributes) { $keyName = $this->getKeyName(); // uuid management if ($this->uuid) { $id = uuid(); $attributes[$keyName] = $id; $query->insert($attributes); // auto increment } else { ...
php
protected function insertAndSetId(Builder $query, $attributes) { $keyName = $this->getKeyName(); // uuid management if ($this->uuid) { $id = uuid(); $attributes[$keyName] = $id; $query->insert($attributes); // auto increment } else { ...
[ "protected", "function", "insertAndSetId", "(", "Builder", "$", "query", ",", "$", "attributes", ")", "{", "$", "keyName", "=", "$", "this", "->", "getKeyName", "(", ")", ";", "// uuid management", "if", "(", "$", "this", "->", "uuid", ")", "{", "$", "...
Insert the given attributes and set the ID on the model. @param \Illuminate\Database\Eloquent\Builder $query @param array $attributes @return void
[ "Insert", "the", "given", "attributes", "and", "set", "the", "ID", "on", "the", "model", "." ]
train
https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Laravel/Database/Eloquent/Model.php#L40-L56
FrenchFrogs/framework
src/Laravel/Database/Eloquent/Model.php
Model.getCasts
public function getCasts() { if ($this->incrementing && !$this->uuid){ return array_merge([ $this->getKeyName() => 'int', ], $this->casts); } return $this->casts; }
php
public function getCasts() { if ($this->incrementing && !$this->uuid){ return array_merge([ $this->getKeyName() => 'int', ], $this->casts); } return $this->casts; }
[ "public", "function", "getCasts", "(", ")", "{", "if", "(", "$", "this", "->", "incrementing", "&&", "!", "$", "this", "->", "uuid", ")", "{", "return", "array_merge", "(", "[", "$", "this", "->", "getKeyName", "(", ")", "=>", "'int'", ",", "]", ",...
Get the casts array. @return array
[ "Get", "the", "casts", "array", "." ]
train
https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Laravel/Database/Eloquent/Model.php#L64-L73
gdbots/pbjx-bundle-php
src/Command/CreateSchedulerStorageCommand.php
CreateSchedulerStorageCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $io->title('Scheduler Storage Creator'); $this->getPbjxServiceLocator()->getScheduler()->createStorage(); $io->success(sprintf('Scheduler storage created.')); }
php
protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $io->title('Scheduler Storage Creator'); $this->getPbjxServiceLocator()->getScheduler()->createStorage(); $io->success(sprintf('Scheduler storage created.')); }
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "io", "=", "new", "SymfonyStyle", "(", "$", "input", ",", "$", "output", ")", ";", "$", "io", "->", "title", "(", "'Scheduler S...
@param InputInterface $input @param OutputInterface $output @return null @throws \Exception
[ "@param", "InputInterface", "$input", "@param", "OutputInterface", "$output" ]
train
https://github.com/gdbots/pbjx-bundle-php/blob/f3c0088583879fc92f13247a0752634bd8696eac/src/Command/CreateSchedulerStorageCommand.php#L50-L57
sanpii/assetic
src/Assetic/Filter/UglifyJsFilter.php
UglifyJsFilter.filterDump
public function filterDump(AssetInterface $asset) { $commandline = $this->nodeBin ? array($this->nodeBin, $this->uglifyjsBin) : array($this->uglifyjsBin); if ($this->noCopyright) { array_push($commandline, '--no-copyright'); } if ($this->beautify...
php
public function filterDump(AssetInterface $asset) { $commandline = $this->nodeBin ? array($this->nodeBin, $this->uglifyjsBin) : array($this->uglifyjsBin); if ($this->noCopyright) { array_push($commandline, '--no-copyright'); } if ($this->beautify...
[ "public", "function", "filterDump", "(", "AssetInterface", "$", "asset", ")", "{", "$", "commandline", "=", "$", "this", "->", "nodeBin", "?", "array", "(", "$", "this", "->", "nodeBin", ",", "$", "this", "->", "uglifyjsBin", ")", ":", "array", "(", "$...
Run the asset through UglifyJs @see \Assetic\Filter\FilterInterface::filterDump()
[ "Run", "the", "asset", "through", "UglifyJs" ]
train
https://github.com/sanpii/assetic/blob/5c446eee54cc396cbbd6e252108f430e6e617c95/src/Assetic/Filter/UglifyJsFilter.php#L103-L162
esperecyan/dictionary-php
src/Dictionary.php
Dictionary.setMetadata
public function setMetadata(array $metadata) { $this->metadata = $this->validator->parseMetadata(array_filter($metadata, function ($field): bool { // 文字列型以外の (明らかに構文解析済みである) フィールドは構文解析器にかけない return is_string($field); })) + $metadata; }
php
public function setMetadata(array $metadata) { $this->metadata = $this->validator->parseMetadata(array_filter($metadata, function ($field): bool { // 文字列型以外の (明らかに構文解析済みである) フィールドは構文解析器にかけない return is_string($field); })) + $metadata; }
[ "public", "function", "setMetadata", "(", "array", "$", "metadata", ")", "{", "$", "this", "->", "metadata", "=", "$", "this", "->", "validator", "->", "parseMetadata", "(", "array_filter", "(", "$", "metadata", ",", "function", "(", "$", "field", ")", "...
メタフィールドを設定します。 @param (string|string[])[]
[ "メタフィールドを設定します。" ]
train
https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/Dictionary.php#L82-L88
esperecyan/dictionary-php
src/Dictionary.php
Dictionary.updateFilenames
protected function updateFilenames(): void { $this->files->setFlags(\FilesystemIterator::KEY_AS_FILENAME | \FilesystemIterator::CURRENT_AS_FILEINFO | \FilesystemIterator::SKIP_DOTS); $this->filenames = array_keys(iterator_to_array($this->files)); }
php
protected function updateFilenames(): void { $this->files->setFlags(\FilesystemIterator::KEY_AS_FILENAME | \FilesystemIterator::CURRENT_AS_FILEINFO | \FilesystemIterator::SKIP_DOTS); $this->filenames = array_keys(iterator_to_array($this->files)); }
[ "protected", "function", "updateFilenames", "(", ")", ":", "void", "{", "$", "this", "->", "files", "->", "setFlags", "(", "\\", "FilesystemIterator", "::", "KEY_AS_FILENAME", "|", "\\", "FilesystemIterator", "::", "CURRENT_AS_FILEINFO", "|", "\\", "FilesystemIter...
$this->files からファイル名を抽出して $this->filenames に設定します。
[ "$this", "-", ">", "files", "からファイル名を抽出して", "$this", "-", ">", "filenames", "に設定します。" ]
train
https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/Dictionary.php#L150-L156
fproject/yii2-flex
fproject/widgets/FlexWidget.php
FlexWidget.run
public function run() { if(empty($this->name)) throw new Exception(Yii::t('fproject/yii2-flex','FlexWidget.name cannot be empty.')); if(empty($this->baseUrl)) throw new Exception(Yii::t('fproject/yii2-flex','FlexWidget.baseUrl cannot be empty.')); if($this->altHtmlCon...
php
public function run() { if(empty($this->name)) throw new Exception(Yii::t('fproject/yii2-flex','FlexWidget.name cannot be empty.')); if(empty($this->baseUrl)) throw new Exception(Yii::t('fproject/yii2-flex','FlexWidget.baseUrl cannot be empty.')); if($this->altHtmlCon...
[ "public", "function", "run", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "name", ")", ")", "throw", "new", "Exception", "(", "Yii", "::", "t", "(", "'fproject/yii2-flex'", ",", "'FlexWidget.name cannot be empty.'", ")", ")", ";", "if", "("...
Renders the widget.
[ "Renders", "the", "widget", "." ]
train
https://github.com/fproject/yii2-flex/blob/661c8532484ce90592af9111df3cccf4091b10a7/fproject/widgets/FlexWidget.php#L156-L184
fproject/yii2-flex
fproject/widgets/FlexWidget.php
FlexWidget.registerClientScript
public function registerClientScript() { $view = $this->getView(); $view->registerJsFile($this->baseUrl.'/swfobject.js',['position'=>View::POS_BEGIN]); if($this->enableHistory) { $view->registerCssFile($this->baseUrl.'/history/history.css'); $view->registerJsF...
php
public function registerClientScript() { $view = $this->getView(); $view->registerJsFile($this->baseUrl.'/swfobject.js',['position'=>View::POS_BEGIN]); if($this->enableHistory) { $view->registerCssFile($this->baseUrl.'/history/history.css'); $view->registerJsF...
[ "public", "function", "registerClientScript", "(", ")", "{", "$", "view", "=", "$", "this", "->", "getView", "(", ")", ";", "$", "view", "->", "registerJsFile", "(", "$", "this", "->", "baseUrl", ".", "'/swfobject.js'", ",", "[", "'position'", "=>", "Vie...
Registers the needed CSS and JavaScript.
[ "Registers", "the", "needed", "CSS", "and", "JavaScript", "." ]
train
https://github.com/fproject/yii2-flex/blob/661c8532484ce90592af9111df3cccf4091b10a7/fproject/widgets/FlexWidget.php#L199-L212
fproject/yii2-flex
fproject/widgets/FlexWidget.php
FlexWidget.getFlashVarsAsString
public function getFlashVarsAsString() { $params=array(); foreach($this->flashVars as $k=>$v) { if(!is_string($v)) $v = json_encode($v); $params[] = $k.':"'.urlencode($v).'"'; } if(!array_key_exists('baseUrl', $this->flashVars)) ...
php
public function getFlashVarsAsString() { $params=array(); foreach($this->flashVars as $k=>$v) { if(!is_string($v)) $v = json_encode($v); $params[] = $k.':"'.urlencode($v).'"'; } if(!array_key_exists('baseUrl', $this->flashVars)) ...
[ "public", "function", "getFlashVarsAsString", "(", ")", "{", "$", "params", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "flashVars", "as", "$", "k", "=>", "$", "v", ")", "{", "if", "(", "!", "is_string", "(", "$", "v", ")", ")...
Generates the properly quoted flash parameter string. @return string the flash parameter string.
[ "Generates", "the", "properly", "quoted", "flash", "parameter", "string", "." ]
train
https://github.com/fproject/yii2-flex/blob/661c8532484ce90592af9111df3cccf4091b10a7/fproject/widgets/FlexWidget.php#L218-L241
fproject/yii2-flex
fproject/widgets/FlexWidget.php
FlexWidget.getFlexLocale
private function getFlexLocale($language) { if(!empty($language)) { $split = explode("-", $language, 2); if(count($split) == 2 && $split[1] != "") { $split[1] = strtoupper($split[1]); } else { $split = null; } } ...
php
private function getFlexLocale($language) { if(!empty($language)) { $split = explode("-", $language, 2); if(count($split) == 2 && $split[1] != "") { $split[1] = strtoupper($split[1]); } else { $split = null; } } ...
[ "private", "function", "getFlexLocale", "(", "$", "language", ")", "{", "if", "(", "!", "empty", "(", "$", "language", ")", ")", "{", "$", "split", "=", "explode", "(", "\"-\"", ",", "$", "language", ",", "2", ")", ";", "if", "(", "count", "(", "...
Returns locale with format for flex application @param string $language the app language @return string
[ "Returns", "locale", "with", "format", "for", "flex", "application" ]
train
https://github.com/fproject/yii2-flex/blob/661c8532484ce90592af9111df3cccf4091b10a7/fproject/widgets/FlexWidget.php#L248-L264
okvpn/fixture-bundle
src/Migration/UpdateDataFixturesFixture.php
UpdateDataFixturesFixture.load
public function load(ObjectManager $manager) { if (!empty($this->dataFixturesClassNames)) { $loadedAt = new \DateTime('now', new \DateTimeZone('UTC')); foreach ($this->dataFixturesClassNames as $className => $version) { $dataFixture = null; if ($versio...
php
public function load(ObjectManager $manager) { if (!empty($this->dataFixturesClassNames)) { $loadedAt = new \DateTime('now', new \DateTimeZone('UTC')); foreach ($this->dataFixturesClassNames as $className => $version) { $dataFixture = null; if ($versio...
[ "public", "function", "load", "(", "ObjectManager", "$", "manager", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "dataFixturesClassNames", ")", ")", "{", "$", "loadedAt", "=", "new", "\\", "DateTime", "(", "'now'", ",", "new", "\\", "Date...
{@inheritdoc}
[ "{" ]
train
https://github.com/okvpn/fixture-bundle/blob/243b5e4dff9773e97fa447280e929c936a5d66ae/src/Migration/UpdateDataFixturesFixture.php#L31-L54
prooph/link-app-core
src/Command/ConfigureJavascriptTicker.php
ConfigureJavascriptTicker.assertPayload
protected function assertPayload($aPayload = null) { if (! array_key_exists('enabled', $aPayload) || ! array_key_exists('interval', $aPayload)) { throw new \InvalidArgumentException('Payload does not contain a enabled or interval key'); } if (! is_bool($aPayload['enabled'])) thr...
php
protected function assertPayload($aPayload = null) { if (! array_key_exists('enabled', $aPayload) || ! array_key_exists('interval', $aPayload)) { throw new \InvalidArgumentException('Payload does not contain a enabled or interval key'); } if (! is_bool($aPayload['enabled'])) thr...
[ "protected", "function", "assertPayload", "(", "$", "aPayload", "=", "null", ")", "{", "if", "(", "!", "array_key_exists", "(", "'enabled'", ",", "$", "aPayload", ")", "||", "!", "array_key_exists", "(", "'interval'", ",", "$", "aPayload", ")", ")", "{", ...
Assert that payload contains all required information for this command @param null|array $aPayload @throws \InvalidArgumentException
[ "Assert", "that", "payload", "contains", "all", "required", "information", "for", "this", "command" ]
train
https://github.com/prooph/link-app-core/blob/835a5945dfa7be7b2cebfa6e84e757ecfd783357/src/Command/ConfigureJavascriptTicker.php#L60-L68
pageon/SlackWebhookMonolog
src/General/Url.php
Url.setUrl
private function setUrl($url) { // remove the whitespace $url = trim($url); // @see https://gist.github.com/dperini/729294 and https://mathiasbynens.be/demo/url-regex $urlValidationRegex = '_^(?:(?:https?|ftp)://)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!1...
php
private function setUrl($url) { // remove the whitespace $url = trim($url); // @see https://gist.github.com/dperini/729294 and https://mathiasbynens.be/demo/url-regex $urlValidationRegex = '_^(?:(?:https?|ftp)://)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!1...
[ "private", "function", "setUrl", "(", "$", "url", ")", "{", "// remove the whitespace", "$", "url", "=", "trim", "(", "$", "url", ")", ";", "// @see https://gist.github.com/dperini/729294 and https://mathiasbynens.be/demo/url-regex", "$", "urlValidationRegex", "=", "'_^(?...
@param string $url @throws InvalidUrlException Thrown when the url is not valid @return $this
[ "@param", "string", "$url" ]
train
https://github.com/pageon/SlackWebhookMonolog/blob/6755060ddd6429620fd4c7decbb95f05463fc36b/src/General/Url.php#L34-L47
movoin/one-swoole
src/Protocol/Providers/ExceptionHandler.php
ExceptionHandler.boot
public function boot() { register_shutdown_function(function () { $error = error_get_last(); $trace = debug_backtrace(); if (isset($error['type'])) { switch ($error['type']) { case E_ERROR: case E_PARSE: ...
php
public function boot() { register_shutdown_function(function () { $error = error_get_last(); $trace = debug_backtrace(); if (isset($error['type'])) { switch ($error['type']) { case E_ERROR: case E_PARSE: ...
[ "public", "function", "boot", "(", ")", "{", "register_shutdown_function", "(", "function", "(", ")", "{", "$", "error", "=", "error_get_last", "(", ")", ";", "$", "trace", "=", "debug_backtrace", "(", ")", ";", "if", "(", "isset", "(", "$", "error", "...
初始化环境
[ "初始化环境" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Protocol/Providers/ExceptionHandler.php#L22-L50
ua1-labs/firebug
Fire/Bug/Panel.php
Panel.renderLabel
public function renderLabel($content, $class = '', $style = '') { $styleAttr = ($style) ? ' style="' . $style . '"' : ''; $classes = ($class) ? ' ' . $class : ''; $renderLabel = ''; $renderLabel .= '<span class="fs-label' . $classes . '"' . $style . '>'; $renderLabel .= $cont...
php
public function renderLabel($content, $class = '', $style = '') { $styleAttr = ($style) ? ' style="' . $style . '"' : ''; $classes = ($class) ? ' ' . $class : ''; $renderLabel = ''; $renderLabel .= '<span class="fs-label' . $classes . '"' . $style . '>'; $renderLabel .= $cont...
[ "public", "function", "renderLabel", "(", "$", "content", ",", "$", "class", "=", "''", ",", "$", "style", "=", "''", ")", "{", "$", "styleAttr", "=", "(", "$", "style", ")", "?", "' style=\"'", ".", "$", "style", ".", "'\"'", ":", "''", ";", "$"...
Returns a label. @param string $content The content of the label @param string $class CSV list of classes you want to add @param string $style Custom styles you want added @return string HTML code for the separator
[ "Returns", "a", "label", "." ]
train
https://github.com/ua1-labs/firebug/blob/70a45b2c0bbf64978641eb07e5f3cddfc1951162/Fire/Bug/Panel.php#L90-L99
ua1-labs/firebug
Fire/Bug/Panel.php
Panel.renderSeparator
public function renderSeparator($bold = true, $class = '', $style = '') { $styleAttr = ($style) ? ' style="' . $style . '"' : ''; $classes = ($class) ? ' ' . $class : ''; if ($bold) { return '<hr class="fs-hr' . $classes . '"' . $styleAttr . '>'; } else { retu...
php
public function renderSeparator($bold = true, $class = '', $style = '') { $styleAttr = ($style) ? ' style="' . $style . '"' : ''; $classes = ($class) ? ' ' . $class : ''; if ($bold) { return '<hr class="fs-hr' . $classes . '"' . $styleAttr . '>'; } else { retu...
[ "public", "function", "renderSeparator", "(", "$", "bold", "=", "true", ",", "$", "class", "=", "''", ",", "$", "style", "=", "''", ")", "{", "$", "styleAttr", "=", "(", "$", "style", ")", "?", "' style=\"'", ".", "$", "style", ".", "'\"'", ":", ...
Returns a separator. @param boolean $bold Do you want a bold separator @param string $class CSV list of classes you want to add @param string $style Custom styles you want added @return string HTML code for the separator.
[ "Returns", "a", "separator", "." ]
train
https://github.com/ua1-labs/firebug/blob/70a45b2c0bbf64978641eb07e5f3cddfc1951162/Fire/Bug/Panel.php#L108-L117
ua1-labs/firebug
Fire/Bug/Panel.php
Panel.renderCode
public function renderCode($code, $dark = true) { $darkClass = ($dark) ? ' fs-dark' : ''; $renderCode = ''; $renderCode .= '<span class="fs-label">'; $renderCode .= '<span class="fs-pre-expand">expand</span>'; $renderCode .= ' | '; $renderCode .= '<span class="fs-pre-...
php
public function renderCode($code, $dark = true) { $darkClass = ($dark) ? ' fs-dark' : ''; $renderCode = ''; $renderCode .= '<span class="fs-label">'; $renderCode .= '<span class="fs-pre-expand">expand</span>'; $renderCode .= ' | '; $renderCode .= '<span class="fs-pre-...
[ "public", "function", "renderCode", "(", "$", "code", ",", "$", "dark", "=", "true", ")", "{", "$", "darkClass", "=", "(", "$", "dark", ")", "?", "' fs-dark'", ":", "''", ";", "$", "renderCode", "=", "''", ";", "$", "renderCode", ".=", "'<span class=...
Returns the code passed in wrapped within a <pre> tag. @param string $content The code you want to render @param boolean $dark Do you want the dark theme? @return string The HTML to render
[ "Returns", "the", "code", "passed", "in", "wrapped", "within", "a", "<pre", ">", "tag", "." ]
train
https://github.com/ua1-labs/firebug/blob/70a45b2c0bbf64978641eb07e5f3cddfc1951162/Fire/Bug/Panel.php#L125-L139
ua1-labs/firebug
Fire/Bug/Panel.php
Panel.renderJson
public function renderJson($json, $dark = true) { if (is_object($json)) { $jsonCode = json_encode($json, JSON_PRETTY_PRINT); } else if (is_array($json)) { $jsonCode = json_encode(($json) ? $json : (object) $json, JSON_PRETTY_PRINT); } else { $jsonCode = js...
php
public function renderJson($json, $dark = true) { if (is_object($json)) { $jsonCode = json_encode($json, JSON_PRETTY_PRINT); } else if (is_array($json)) { $jsonCode = json_encode(($json) ? $json : (object) $json, JSON_PRETTY_PRINT); } else { $jsonCode = js...
[ "public", "function", "renderJson", "(", "$", "json", ",", "$", "dark", "=", "true", ")", "{", "if", "(", "is_object", "(", "$", "json", ")", ")", "{", "$", "jsonCode", "=", "json_encode", "(", "$", "json", ",", "JSON_PRETTY_PRINT", ")", ";", "}", ...
Returns the JSON passed in wrapped within a <pre> tag. @param string $content The code you want to render @param boolean $dark Do you want the dark theme? @return string The HTML to render
[ "Returns", "the", "JSON", "passed", "in", "wrapped", "within", "a", "<pre", ">", "tag", "." ]
train
https://github.com/ua1-labs/firebug/blob/70a45b2c0bbf64978641eb07e5f3cddfc1951162/Fire/Bug/Panel.php#L147-L157
ua1-labs/firebug
Fire/Bug/Panel.php
Panel.renderTrace
public function renderTrace($debug_backtrace) { $renderTrace = ''; $renderTrace .= '<span class="fs-label">'; foreach ($debug_backtrace as $index => $trace) { $renderTrace .= '#' . $index . ' '; if (!empty($trace['file'])) { $renderTrace .= $trace['fil...
php
public function renderTrace($debug_backtrace) { $renderTrace = ''; $renderTrace .= '<span class="fs-label">'; foreach ($debug_backtrace as $index => $trace) { $renderTrace .= '#' . $index . ' '; if (!empty($trace['file'])) { $renderTrace .= $trace['fil...
[ "public", "function", "renderTrace", "(", "$", "debug_backtrace", ")", "{", "$", "renderTrace", "=", "''", ";", "$", "renderTrace", ".=", "'<span class=\"fs-label\">'", ";", "foreach", "(", "$", "debug_backtrace", "as", "$", "index", "=>", "$", "trace", ")", ...
Returns a rendered debug_backtrace. @param array $debug_backtrace @return string
[ "Returns", "a", "rendered", "debug_backtrace", "." ]
train
https://github.com/ua1-labs/firebug/blob/70a45b2c0bbf64978641eb07e5f3cddfc1951162/Fire/Bug/Panel.php#L164-L184
php-http/artax-adapter
src/Internal/Promise.php
Promise.then
public function then(callable $onFulfilled = null, callable $onRejected = null) { $deferred = new \Amp\Deferred(); $newPromise = new self($deferred->promise()); $onFulfilled = $onFulfilled ?? function (ResponseInterface $response) { return $response; }; $onRejec...
php
public function then(callable $onFulfilled = null, callable $onRejected = null) { $deferred = new \Amp\Deferred(); $newPromise = new self($deferred->promise()); $onFulfilled = $onFulfilled ?? function (ResponseInterface $response) { return $response; }; $onRejec...
[ "public", "function", "then", "(", "callable", "$", "onFulfilled", "=", "null", ",", "callable", "$", "onRejected", "=", "null", ")", "{", "$", "deferred", "=", "new", "\\", "Amp", "\\", "Deferred", "(", ")", ";", "$", "newPromise", "=", "new", "self",...
{@inheritdoc}
[ "{" ]
train
https://github.com/php-http/artax-adapter/blob/fee1cff8aea42bdd44586cb9a568e2d4228438c7/src/Internal/Promise.php#L61-L107
php-http/artax-adapter
src/Internal/Promise.php
Promise.wait
public function wait($unwrap = true) { try { AmpPromise\wait($this->promise); } catch (Exception $exception) { } if ($unwrap) { if (HttpPromise::REJECTED === $this->getState()) { throw $this->exception; } return $this-...
php
public function wait($unwrap = true) { try { AmpPromise\wait($this->promise); } catch (Exception $exception) { } if ($unwrap) { if (HttpPromise::REJECTED === $this->getState()) { throw $this->exception; } return $this-...
[ "public", "function", "wait", "(", "$", "unwrap", "=", "true", ")", "{", "try", "{", "AmpPromise", "\\", "wait", "(", "$", "this", "->", "promise", ")", ";", "}", "catch", "(", "Exception", "$", "exception", ")", "{", "}", "if", "(", "$", "unwrap",...
{@inheritdoc}
[ "{" ]
train
https://github.com/php-http/artax-adapter/blob/fee1cff8aea42bdd44586cb9a568e2d4228438c7/src/Internal/Promise.php#L120-L134
popovserhii/db
src/Db.php
Db.fetch
public function fetch($query) { $result = $this->query($query); return $result->fetch(\PDO::FETCH_ASSOC); }
php
public function fetch($query) { $result = $this->query($query); return $result->fetch(\PDO::FETCH_ASSOC); }
[ "public", "function", "fetch", "(", "$", "query", ")", "{", "$", "result", "=", "$", "this", "->", "query", "(", "$", "query", ")", ";", "return", "$", "result", "->", "fetch", "(", "\\", "PDO", "::", "FETCH_ASSOC", ")", ";", "}" ]
Return associate array with all data of one row in table @param $query @return mixed
[ "Return", "associate", "array", "with", "all", "data", "of", "one", "row", "in", "table" ]
train
https://github.com/popovserhii/db/blob/86a1651784eb5763ef5b974233e6356b38b66aaa/src/Db.php#L173-L178
popovserhii/db
src/Db.php
Db.fetchAssoc
public function fetchAssoc($query) { $data = []; $result = $this->query($query); $keyArray = false; while (false != ($row = $result->fetch(\PDO::FETCH_ASSOC))) { $first = 1; foreach ($row as $key => $value) { if ($first === 1) { ...
php
public function fetchAssoc($query) { $data = []; $result = $this->query($query); $keyArray = false; while (false != ($row = $result->fetch(\PDO::FETCH_ASSOC))) { $first = 1; foreach ($row as $key => $value) { if ($first === 1) { ...
[ "public", "function", "fetchAssoc", "(", "$", "query", ")", "{", "$", "data", "=", "[", "]", ";", "$", "result", "=", "$", "this", "->", "query", "(", "$", "query", ")", ";", "$", "keyArray", "=", "false", ";", "while", "(", "false", "!=", "(", ...
Returns an associative array of values from one sample. Unlike the $ this-> arAll (), the value is not added to the new array, but rather for the unique ID number of the array is set to the first value in the "SELECT first, second FROM table" @param string $query @return array $allData
[ "Returns", "an", "associative", "array", "of", "values", "from", "one", "sample", ".", "Unlike", "the", "$", "this", "-", ">", "arAll", "()", "the", "value", "is", "not", "added", "to", "the", "new", "array", "but", "rather", "for", "the", "unique", "I...
train
https://github.com/popovserhii/db/blob/86a1651784eb5763ef5b974233e6356b38b66aaa/src/Db.php#L189-L207
popovserhii/db
src/Db.php
Db.fetchOne
public function fetchOne($sql, array $parameters = []) { $statement = $this->lazyLoad()->prepare($sql, [\PDO::ATTR_CURSOR => \PDO::CURSOR_FWDONLY]); //$statement = $this->lazyLoad()->prepare($sql); $statement->execute($parameters); $result = $statement->fetch(\PDO::FETCH_ASSOC); ...
php
public function fetchOne($sql, array $parameters = []) { $statement = $this->lazyLoad()->prepare($sql, [\PDO::ATTR_CURSOR => \PDO::CURSOR_FWDONLY]); //$statement = $this->lazyLoad()->prepare($sql); $statement->execute($parameters); $result = $statement->fetch(\PDO::FETCH_ASSOC); ...
[ "public", "function", "fetchOne", "(", "$", "sql", ",", "array", "$", "parameters", "=", "[", "]", ")", "{", "$", "statement", "=", "$", "this", "->", "lazyLoad", "(", ")", "->", "prepare", "(", "$", "sql", ",", "[", "\\", "PDO", "::", "ATTR_CURSOR...
Returns the first record of the sample. If passed only the first parameter is returned SQL statement to transfer only necessary to sample data. Execute a prepared statement by passing an array of values For example: $sql = 'SELECT name, colour, calories FROM fruit WHERE calories < :calories AND colour = :colour'; $sth ...
[ "Returns", "the", "first", "record", "of", "the", "sample", ".", "If", "passed", "only", "the", "first", "parameter", "is", "returned", "SQL", "statement", "to", "transfer", "only", "necessary", "to", "sample", "data", ".", "Execute", "a", "prepared", "state...
train
https://github.com/popovserhii/db/blob/86a1651784eb5763ef5b974233e6356b38b66aaa/src/Db.php#L362-L370
popovserhii/db
src/Db.php
Db.fetchAll
public function fetchAll($sql, array $parameters = []) { $stm = $this->lazyLoad()->prepare($sql); $stm->execute($parameters); $array = $stm->fetchAll(\PDO::FETCH_ASSOC); // @see https://stackoverflow.com/a/883382/1335142 $this->numRows = $stm->rowCount(); return $arr...
php
public function fetchAll($sql, array $parameters = []) { $stm = $this->lazyLoad()->prepare($sql); $stm->execute($parameters); $array = $stm->fetchAll(\PDO::FETCH_ASSOC); // @see https://stackoverflow.com/a/883382/1335142 $this->numRows = $stm->rowCount(); return $arr...
[ "public", "function", "fetchAll", "(", "$", "sql", ",", "array", "$", "parameters", "=", "[", "]", ")", "{", "$", "stm", "=", "$", "this", "->", "lazyLoad", "(", ")", "->", "prepare", "(", "$", "sql", ")", ";", "$", "stm", "->", "execute", "(", ...
$sql = "SELECT id FROM table WHERE id = ?"; $parameters = array(524); @param string $sql @param array $parameters @return array
[ "$sql", "=", "SELECT", "id", "FROM", "table", "WHERE", "id", "=", "?", ";", "$parameters", "=", "array", "(", "524", ")", ";" ]
train
https://github.com/popovserhii/db/blob/86a1651784eb5763ef5b974233e6356b38b66aaa/src/Db.php#L380-L389
popovserhii/db
src/Db.php
Db.fetchDropDown
public function fetchDropDown($sql, array $parameters = []) { $result = $this->fetchAll($sql, $parameters); $data = []; foreach ($result as $field) { $data[array_shift($field)] = array_shift($field); } return $data; }
php
public function fetchDropDown($sql, array $parameters = []) { $result = $this->fetchAll($sql, $parameters); $data = []; foreach ($result as $field) { $data[array_shift($field)] = array_shift($field); } return $data; }
[ "public", "function", "fetchDropDown", "(", "$", "sql", ",", "array", "$", "parameters", "=", "[", "]", ")", "{", "$", "result", "=", "$", "this", "->", "fetchAll", "(", "$", "sql", ",", "$", "parameters", ")", ";", "$", "data", "=", "[", "]", ";...
Return value need for generate <select /> $sql = "SELECT id, name FROM table WHERE id = ?"; $parameters = array(524); @param $sql @param array $parameters @return array
[ "Return", "value", "need", "for", "generate", "<select", "/", ">" ]
train
https://github.com/popovserhii/db/blob/86a1651784eb5763ef5b974233e6356b38b66aaa/src/Db.php#L401-L410
popovserhii/db
src/Db.php
Db.save
public function save($table, $field, $idField = 'id') { unset($this->values); $sql = "INSERT INTO `{$table}` ( {$this->addFields($field)} ) VALUES ({$this->_addValue($field)}) ON DUPLICATE KEY UPDATE {$this->_onDuplicateKeyUpdateField($this->addFields($field), $idField)}"; $fields = array_va...
php
public function save($table, $field, $idField = 'id') { unset($this->values); $sql = "INSERT INTO `{$table}` ( {$this->addFields($field)} ) VALUES ({$this->_addValue($field)}) ON DUPLICATE KEY UPDATE {$this->_onDuplicateKeyUpdateField($this->addFields($field), $idField)}"; $fields = array_va...
[ "public", "function", "save", "(", "$", "table", ",", "$", "field", ",", "$", "idField", "=", "'id'", ")", "{", "unset", "(", "$", "this", "->", "values", ")", ";", "$", "sql", "=", "\"INSERT INTO `{$table}` ( {$this->addFields($field)} ) VALUES ({$this->_addVal...
Regular UPDATE/INSERT In the field $field transferred one-dimensional array, which keys correspond to fields in the database table, and the value of the array - according to data insertion. If UPDATE then the first value in the array $field must be a unique value field (eg: id). @param string $table @param array $fiel...
[ "Regular", "UPDATE", "/", "INSERT", "In", "the", "field", "$field", "transferred", "one", "-", "dimensional", "array", "which", "keys", "correspond", "to", "fields", "in", "the", "database", "table", "and", "the", "value", "of", "the", "array", "-", "accordi...
train
https://github.com/popovserhii/db/blob/86a1651784eb5763ef5b974233e6356b38b66aaa/src/Db.php#L423-L432
popovserhii/db
src/Db.php
Db.multipleSave
public function multipleSave($table, $fields, $idField = 'id') { unset($this->values); $sql = "INSERT INTO `{$table}` ( {$this->addFields($fields[0])} ) VALUES {$this->addValues($fields)} ON DUPLICATE KEY UPDATE {$this->_onDuplicateKeyUpdateField($this->addFields($fields[0]), $idField)};"; /...
php
public function multipleSave($table, $fields, $idField = 'id') { unset($this->values); $sql = "INSERT INTO `{$table}` ( {$this->addFields($fields[0])} ) VALUES {$this->addValues($fields)} ON DUPLICATE KEY UPDATE {$this->_onDuplicateKeyUpdateField($this->addFields($fields[0]), $idField)};"; /...
[ "public", "function", "multipleSave", "(", "$", "table", ",", "$", "fields", ",", "$", "idField", "=", "'id'", ")", "{", "unset", "(", "$", "this", "->", "values", ")", ";", "$", "sql", "=", "\"INSERT INTO `{$table}` ( {$this->addFields($fields[0])} ) VALUES {$t...
Multiple INSERT/UPDATE. In the $fields transferred multidimensional array. One item which represents the right table in the database. WARNING! Db::multipleUpdate() works only while Db::TEMPLATES_WITHOUT @param string $table Таблиця для вставки даних @param array $fields Многомірний масив даних 1 - array(0 => array('id...
[ "Multiple", "INSERT", "/", "UPDATE", ".", "In", "the", "$fields", "transferred", "multidimensional", "array", ".", "One", "item", "which", "represents", "the", "right", "table", "in", "the", "database", ".", "WARNING!", "Db", "::", "multipleUpdate", "()", "wor...
train
https://github.com/popovserhii/db/blob/86a1651784eb5763ef5b974233e6356b38b66aaa/src/Db.php#L450-L459
popovserhii/db
src/Db.php
Db._onDuplicateKeyUpdateField
private function _onDuplicateKeyUpdateField($fieldsStr, $idField) { $fields_array = explode(',', $fieldsStr); $fields = []; foreach ($fields_array as $field) { if (trim($field, '` ') == $idField) { $fields[] = " {$idField} = LAST_INSERT_ID($idField)"; ...
php
private function _onDuplicateKeyUpdateField($fieldsStr, $idField) { $fields_array = explode(',', $fieldsStr); $fields = []; foreach ($fields_array as $field) { if (trim($field, '` ') == $idField) { $fields[] = " {$idField} = LAST_INSERT_ID($idField)"; ...
[ "private", "function", "_onDuplicateKeyUpdateField", "(", "$", "fieldsStr", ",", "$", "idField", ")", "{", "$", "fields_array", "=", "explode", "(", "','", ",", "$", "fieldsStr", ")", ";", "$", "fields", "=", "[", "]", ";", "foreach", "(", "$", "fields_a...
Gets tape field names for the condition "ON DUPLICATE KEY UPDATE". Ignore the first field, as it should be unique and should not be changed. Generates set to ON DUPLICATE KEY UPDATE, the type field = VALUES (field), field2 = VALUES (field2), ...
[ "Gets", "tape", "field", "names", "for", "the", "condition", "ON", "DUPLICATE", "KEY", "UPDATE", ".", "Ignore", "the", "first", "field", "as", "it", "should", "be", "unique", "and", "should", "not", "be", "changed", ".", "Generates", "set", "to", "ON", "...
train
https://github.com/popovserhii/db/blob/86a1651784eb5763ef5b974233e6356b38b66aaa/src/Db.php#L466-L479
popovserhii/db
src/Db.php
Db.addFields
protected function addFields($fields) { $fields_array = []; foreach ($fields as $field => $value) { $fields_array[] = $field; } return '`' . implode('`, `', $fields_array) . '`'; }
php
protected function addFields($fields) { $fields_array = []; foreach ($fields as $field => $value) { $fields_array[] = $field; } return '`' . implode('`, `', $fields_array) . '`'; }
[ "protected", "function", "addFields", "(", "$", "fields", ")", "{", "$", "fields_array", "=", "[", "]", ";", "foreach", "(", "$", "fields", "as", "$", "field", "=>", "$", "value", ")", "{", "$", "fields_array", "[", "]", "=", "$", "field", ";", "}"...
Generates a set of fields that need to be updated or inserted. For the terms "INSERT INTO". @param $fields @return string
[ "Generates", "a", "set", "of", "fields", "that", "need", "to", "be", "updated", "or", "inserted", ".", "For", "the", "terms", "INSERT", "INTO", "." ]
train
https://github.com/popovserhii/db/blob/86a1651784eb5763ef5b974233e6356b38b66aaa/src/Db.php#L487-L495
popovserhii/db
src/Db.php
Db.addValues
protected function addValues($fields) { $values_array = []; foreach ($fields as $values) { $values_array[] = '(' . $this->_addValue($values) . ')'; } return implode(',', $values_array); }
php
protected function addValues($fields) { $values_array = []; foreach ($fields as $values) { $values_array[] = '(' . $this->_addValue($values) . ')'; } return implode(',', $values_array); }
[ "protected", "function", "addValues", "(", "$", "fields", ")", "{", "$", "values_array", "=", "[", "]", ";", "foreach", "(", "$", "fields", "as", "$", "values", ")", "{", "$", "values_array", "[", "]", "=", "'('", ".", "$", "this", "->", "_addValue",...
Handles multi-dimensional array of data and generates a set of groups "(1, 1), (2, 12), (3, 0.5)" @param $fields @return string
[ "Handles", "multi", "-", "dimensional", "array", "of", "data", "and", "generates", "a", "set", "of", "groups", "(", "1", "1", ")", "(", "2", "12", ")", "(", "3", "0", ".", "5", ")" ]
train
https://github.com/popovserhii/db/blob/86a1651784eb5763ef5b974233e6356b38b66aaa/src/Db.php#L503-L511
popovserhii/db
src/Db.php
Db._addValue
protected function _addValue($values) { $method = $this->getSaveMode(); $value_array = []; foreach ($values as $key => $value) { $value_array[] = $this->$method($key, $value); } return implode(',', $value_array); }
php
protected function _addValue($values) { $method = $this->getSaveMode(); $value_array = []; foreach ($values as $key => $value) { $value_array[] = $this->$method($key, $value); } return implode(',', $value_array); }
[ "protected", "function", "_addValue", "(", "$", "values", ")", "{", "$", "method", "=", "$", "this", "->", "getSaveMode", "(", ")", ";", "$", "value_array", "=", "[", "]", ";", "foreach", "(", "$", "values", "as", "$", "key", "=>", "$", "value", ")...
Handles one-dimensional array of data and generates a set for one group. @param array $values @return string
[ "Handles", "one", "-", "dimensional", "array", "of", "data", "and", "generates", "a", "set", "for", "one", "group", "." ]
train
https://github.com/popovserhii/db/blob/86a1651784eb5763ef5b974233e6356b38b66aaa/src/Db.php#L519-L528
huasituo/hstcms
src/Libraries/Fields/FieldAbs.php
FieldAbs.validate_filter
public function validate_filter(Request $request, $field, $validate, $error = []) { $fieldname = $field['fieldname']; $value = $request->get($fieldname); if($field['fieldtype'] == 'Date' || $field['fieldtype'] == 'DateTime') { $value = hst_str2time($value); } // 验证必填字段 ...
php
public function validate_filter(Request $request, $field, $validate, $error = []) { $fieldname = $field['fieldname']; $value = $request->get($fieldname); if($field['fieldtype'] == 'Date' || $field['fieldtype'] == 'DateTime') { $value = hst_str2time($value); } // 验证必填字段 ...
[ "public", "function", "validate_filter", "(", "Request", "$", "request", ",", "$", "field", ",", "$", "validate", ",", "$", "error", "=", "[", "]", ")", "{", "$", "fieldname", "=", "$", "field", "[", "'fieldname'", "]", ";", "$", "value", "=", "$", ...
验证字段输入
[ "验证字段输入" ]
train
https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Libraries/Fields/FieldAbs.php#L76-L107