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 |
|---|---|---|---|---|---|---|---|---|---|---|
meta-tech/pws-auth | src/MetaTech/Util/Tool.php | Tool.concat | public static function concat($sep, $list)
{
$value = array_shift($list);
foreach ($list as $item) {
$value .= $sep . $item;
}
return $value;
} | php | public static function concat($sep, $list)
{
$value = array_shift($list);
foreach ($list as $item) {
$value .= $sep . $item;
}
return $value;
} | [
"public",
"static",
"function",
"concat",
"(",
"$",
"sep",
",",
"$",
"list",
")",
"{",
"$",
"value",
"=",
"array_shift",
"(",
"$",
"list",
")",
";",
"foreach",
"(",
"$",
"list",
"as",
"$",
"item",
")",
"{",
"$",
"value",
".=",
"$",
"sep",
".",
... | /*!
concatenate various items in $list separate with specifyed separator $sep
@method concat
@public
@param str $sep the used separator to concatenate items in $list
@param [str] $list the list of items to concatenate
@return str | [
"/",
"*",
"!",
"concatenate",
"various",
"items",
"in",
"$list",
"separate",
"with",
"specifyed",
"separator",
"$sep"
] | train | https://github.com/meta-tech/pws-auth/blob/6ba2727cf82470ffbda65925b077fadcd64a77ee/src/MetaTech/Util/Tool.php#L84-L91 |
meta-tech/pws-auth | src/MetaTech/Util/Tool.php | Tool.compact | public static function compact($source, $fields)
{
$data = array();
foreach ($fields as $field) {
if (isset($source[$field])) $data[$field] = $source[$field];
}
return $data;
} | php | public static function compact($source, $fields)
{
$data = array();
foreach ($fields as $field) {
if (isset($source[$field])) $data[$field] = $source[$field];
}
return $data;
} | [
"public",
"static",
"function",
"compact",
"(",
"$",
"source",
",",
"$",
"fields",
")",
"{",
"$",
"data",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"field",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"source",
"[",
"$",
... | /*!
desc
@method compact
@public
@param [str] $source
@param [str] $fields
@return str | [
"/",
"*",
"!",
"desc"
] | train | https://github.com/meta-tech/pws-auth/blob/6ba2727cf82470ffbda65925b077fadcd64a77ee/src/MetaTech/Util/Tool.php#L102-L109 |
NuclearCMS/Hierarchy | src/NodeBag.php | NodeBag.getOrFind | public function getOrFind($id, $published = true)
{
$node = $this->get($id);
if (is_null($node))
{
$node = $published ?
PublishedNode::find($id) :
Node::find($id);
$this->put($id, $node);
}
return $node;
} | php | public function getOrFind($id, $published = true)
{
$node = $this->get($id);
if (is_null($node))
{
$node = $published ?
PublishedNode::find($id) :
Node::find($id);
$this->put($id, $node);
}
return $node;
} | [
"public",
"function",
"getOrFind",
"(",
"$",
"id",
",",
"$",
"published",
"=",
"true",
")",
"{",
"$",
"node",
"=",
"$",
"this",
"->",
"get",
"(",
"$",
"id",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"node",
")",
")",
"{",
"$",
"node",
"=",
"$... | Gets or finds the node and sets by id
@param int $id
@param bool $published
@return Node | [
"Gets",
"or",
"finds",
"the",
"node",
"and",
"sets",
"by",
"id"
] | train | https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/NodeBag.php#L18-L32 |
hametuha/wpametu | src/WPametu/DB/Model.php | Model.get | public function get($id, $ignore_cache = false){
if( empty($this->primary_key) ){
return null;
}
$row = $this->where("{$this->table}.{$this->primary_key} = %d", $id)->get_row('', $ignore_cache);
if( $row && $this->result_class ){
return new $this->result_class($ro... | php | public function get($id, $ignore_cache = false){
if( empty($this->primary_key) ){
return null;
}
$row = $this->where("{$this->table}.{$this->primary_key} = %d", $id)->get_row('', $ignore_cache);
if( $row && $this->result_class ){
return new $this->result_class($ro... | [
"public",
"function",
"get",
"(",
"$",
"id",
",",
"$",
"ignore_cache",
"=",
"false",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"primary_key",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"row",
"=",
"$",
"this",
"->",
"where",
"(",... | Get object with primary key
@param int $id
@param bool $ignore_cache
@return mixed|null | [
"Get",
"object",
"with",
"primary",
"key"
] | train | https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/DB/Model.php#L69-L79 |
hametuha/wpametu | src/WPametu/DB/Model.php | Model.get_var | public function get_var($query = ''){
if( !$query ){
$query = $this->build_query();
}
$this->clear();
return $this->db->get_var($query);
} | php | public function get_var($query = ''){
if( !$query ){
$query = $this->build_query();
}
$this->clear();
return $this->db->get_var($query);
} | [
"public",
"function",
"get_var",
"(",
"$",
"query",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"$",
"query",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"build_query",
"(",
")",
";",
"}",
"$",
"this",
"->",
"clear",
"(",
")",
";",
"return",
"$",
... | Get var
@param string $query
@return null|string | [
"Get",
"var"
] | train | https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/DB/Model.php#L100-L106 |
hametuha/wpametu | src/WPametu/DB/Model.php | Model.get_col | public function get_col($x = 0, $query = ''){
if( !$query ){
$query = $this->build_query();
}
$this->clear();
return $this->db->get_col($query, $x);
} | php | public function get_col($x = 0, $query = ''){
if( !$query ){
$query = $this->build_query();
}
$this->clear();
return $this->db->get_col($query, $x);
} | [
"public",
"function",
"get_col",
"(",
"$",
"x",
"=",
"0",
",",
"$",
"query",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"$",
"query",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"build_query",
"(",
")",
";",
"}",
"$",
"this",
"->",
"clear",
"("... | Returns specified column as array
@param int $x
@param string $query
@return array | [
"Returns",
"specified",
"column",
"as",
"array"
] | train | https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/DB/Model.php#L115-L121 |
hametuha/wpametu | src/WPametu/DB/Model.php | Model.get_row | public function get_row($query = '', $ignore_cache = false){
if( empty($query) ){
$query = $this->build_query();
$this->clear();
}
if( $this->cache_exist($query) && !$ignore_cache ){
return $this->get_cache($query);
}else{
return $this->db-... | php | public function get_row($query = '', $ignore_cache = false){
if( empty($query) ){
$query = $this->build_query();
$this->clear();
}
if( $this->cache_exist($query) && !$ignore_cache ){
return $this->get_cache($query);
}else{
return $this->db-... | [
"public",
"function",
"get_row",
"(",
"$",
"query",
"=",
"''",
",",
"$",
"ignore_cache",
"=",
"false",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"query",
")",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"build_query",
"(",
")",
";",
"$",
"this"... | Returns row object
@param string $query
@param bool $ignore_cache
@return mixed|null | [
"Returns",
"row",
"object"
] | train | https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/DB/Model.php#L130-L140 |
hametuha/wpametu | src/WPametu/DB/Model.php | Model.result | public function result($query = '', $ignore_cache = false){
$result = $this->raw_result($query, $ignore_cache);
if( $result && $this->has_result_class() ){
$new_results = [];
foreach($result as $key => $obj){
$new_results[$key] = new $this->result_class($obj);
... | php | public function result($query = '', $ignore_cache = false){
$result = $this->raw_result($query, $ignore_cache);
if( $result && $this->has_result_class() ){
$new_results = [];
foreach($result as $key => $obj){
$new_results[$key] = new $this->result_class($obj);
... | [
"public",
"function",
"result",
"(",
"$",
"query",
"=",
"''",
",",
"$",
"ignore_cache",
"=",
"false",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"raw_result",
"(",
"$",
"query",
",",
"$",
"ignore_cache",
")",
";",
"if",
"(",
"$",
"result",
"&... | Get results
@param string $query
@param bool $ignore_cache
@return array|mixed|null | [
"Get",
"results"
] | train | https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/DB/Model.php#L149-L160 |
hametuha/wpametu | src/WPametu/DB/Model.php | Model.insert | protected function insert(array $values, array $place_holders = [], $table = ''){
if( empty($table) ){
extract($this->get_default_values($values, $table, $place_holders));
}
return $this->db->insert($table, $values, $place_holders);
} | php | protected function insert(array $values, array $place_holders = [], $table = ''){
if( empty($table) ){
extract($this->get_default_values($values, $table, $place_holders));
}
return $this->db->insert($table, $values, $place_holders);
} | [
"protected",
"function",
"insert",
"(",
"array",
"$",
"values",
",",
"array",
"$",
"place_holders",
"=",
"[",
"]",
",",
"$",
"table",
"=",
"''",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"table",
")",
")",
"{",
"extract",
"(",
"$",
"this",
"->",
"g... | Insert row
@param array $values Array with 'column' => 'value'
@param array $place_holders Array of '%s', '%d', '%f'
@param string $table
@return false|int number of rows or false on failure | [
"Insert",
"row"
] | train | https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/DB/Model.php#L196-L201 |
hametuha/wpametu | src/WPametu/DB/Model.php | Model.update | protected function update(array $values, array $wheres = [], array $place_holders = [], array $where_format = [], $table = ''){
if( empty($table) ){
extract($this->get_default_values($values, $table, $place_holders));
}
if( empty($where_format) && !empty($this->default_placeholder) )... | php | protected function update(array $values, array $wheres = [], array $place_holders = [], array $where_format = [], $table = ''){
if( empty($table) ){
extract($this->get_default_values($values, $table, $place_holders));
}
if( empty($where_format) && !empty($this->default_placeholder) )... | [
"protected",
"function",
"update",
"(",
"array",
"$",
"values",
",",
"array",
"$",
"wheres",
"=",
"[",
"]",
",",
"array",
"$",
"place_holders",
"=",
"[",
"]",
",",
"array",
"$",
"where_format",
"=",
"[",
"]",
",",
"$",
"table",
"=",
"''",
")",
"{",... | Update table
@param array $values
@param array $wheres ['column' => 'value'] format.
@param array $place_holders
@param array $where_format
@param string $table
@return false|int | [
"Update",
"table"
] | train | https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/DB/Model.php#L213-L225 |
hametuha/wpametu | src/WPametu/DB/Model.php | Model.get_default_values | protected function get_default_values(array $values = [], $table = '', array $place_holders = [] ){
if( empty($table) ){
$table = $this->table;
}
if( $table == $this->table ){
// Overwrite place holder
if( $this->default_placeholder ){
$default... | php | protected function get_default_values(array $values = [], $table = '', array $place_holders = [] ){
if( empty($table) ){
$table = $this->table;
}
if( $table == $this->table ){
// Overwrite place holder
if( $this->default_placeholder ){
$default... | [
"protected",
"function",
"get_default_values",
"(",
"array",
"$",
"values",
"=",
"[",
"]",
",",
"$",
"table",
"=",
"''",
",",
"array",
"$",
"place_holders",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"table",
")",
")",
"{",
"$",
"table"... | Get default value
@param array $values
@param string $table
@param array $place_holders
@return array | [
"Get",
"default",
"value"
] | train | https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/DB/Model.php#L235-L259 |
hametuha/wpametu | src/WPametu/DB/Model.php | Model.delete_where | protected function delete_where(array $wheres, $table_name = ''){
if( empty($table_name) ){
$table_name = $this->table;
}
if( !empty($wheres) ){
$where_clause = [];
foreach( $wheres as $condition ){
if( count($condition) != 4 ){
... | php | protected function delete_where(array $wheres, $table_name = ''){
if( empty($table_name) ){
$table_name = $this->table;
}
if( !empty($wheres) ){
$where_clause = [];
foreach( $wheres as $condition ){
if( count($condition) != 4 ){
... | [
"protected",
"function",
"delete_where",
"(",
"array",
"$",
"wheres",
",",
"$",
"table_name",
"=",
"''",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"table_name",
")",
")",
"{",
"$",
"table_name",
"=",
"$",
"this",
"->",
"table",
";",
"}",
"if",
"(",
"... | Delete record
@param array $wheres
@param string $table_name If not specified, <code>$this->table</code> will be used.
@return false|int
@throws \Exception | [
"Delete",
"record"
] | train | https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/DB/Model.php#L269-L296 |
gedex/php-janrain-api | lib/Janrain/Api/Capture/Clients.php | Clients.clearWhitelist | public function clearWhitelist($clientId = null)
{
$params = array();
if ($clientId) {
$params['for_client_id'] = $clientId;
}
return $this->post('clients/clear_whitelist', $params);
} | php | public function clearWhitelist($clientId = null)
{
$params = array();
if ($clientId) {
$params['for_client_id'] = $clientId;
}
return $this->post('clients/clear_whitelist', $params);
} | [
"public",
"function",
"clearWhitelist",
"(",
"$",
"clientId",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"clientId",
")",
"{",
"$",
"params",
"[",
"'for_client_id'",
"]",
"=",
"$",
"clientId",
";",
"}",
"return... | Clear the IP whitelist for a target client, resetting it to the default
value that allows all IP addresses. Only the 'owner' client may make this
API call. The default whitelist is `["0.0.0.0/0"]`, which means that all IP
addresses are allowed.
@param string $clientId The `client_id` whose whitelist will be cleared. I... | [
"Clear",
"the",
"IP",
"whitelist",
"for",
"a",
"target",
"client",
"resetting",
"it",
"to",
"the",
"default",
"value",
"that",
"allows",
"all",
"IP",
"addresses",
".",
"Only",
"the",
"owner",
"client",
"may",
"make",
"this",
"API",
"call",
".",
"The",
"d... | train | https://github.com/gedex/php-janrain-api/blob/6283f68454e0ad5211ac620f1d337df38cd49597/lib/Janrain/Api/Capture/Clients.php#L42-L50 |
gedex/php-janrain-api | lib/Janrain/Api/Capture/Clients.php | Clients.getList | public function getList(array $hasFeatures = array())
{
$params = array();
if (!empty($hasFeatures)) {
$params['features'] = json_encode(array_values($hasFeatures));
}
return $this->post('clients/list', $params);
} | php | public function getList(array $hasFeatures = array())
{
$params = array();
if (!empty($hasFeatures)) {
$params['features'] = json_encode(array_values($hasFeatures));
}
return $this->post('clients/list', $params);
} | [
"public",
"function",
"getList",
"(",
"array",
"$",
"hasFeatures",
"=",
"array",
"(",
")",
")",
"{",
"$",
"params",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"hasFeatures",
")",
")",
"{",
"$",
"params",
"[",
"'features'",
"]",... | Since `list` is reserved keyword in PHP.
Get a list of the clients in your Capture application, optionally filtered
by client feature. Only the 'owner' client can make this API call.
@param array $hasFeatures Array features names; only clients which have at
least one of the features in the array will be
displayed | [
"Since",
"list",
"is",
"reserved",
"keyword",
"in",
"PHP",
"."
] | train | https://github.com/gedex/php-janrain-api/blob/6283f68454e0ad5211ac620f1d337df38cd49597/lib/Janrain/Api/Capture/Clients.php#L75-L83 |
gedex/php-janrain-api | lib/Janrain/Api/Capture/Clients.php | Clients.setDescription | public function setDescription($clientId, $description)
{
$params = array(
'for_client_id' => $clientId,
'description' => $description,
);
// If empty, description is set for the owner client.
if (!$params['for_client_id']) {
unset($params['for_client_id']);
}
return $this->post('clients/set_d... | php | public function setDescription($clientId, $description)
{
$params = array(
'for_client_id' => $clientId,
'description' => $description,
);
// If empty, description is set for the owner client.
if (!$params['for_client_id']) {
unset($params['for_client_id']);
}
return $this->post('clients/set_d... | [
"public",
"function",
"setDescription",
"(",
"$",
"clientId",
",",
"$",
"description",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"'for_client_id'",
"=>",
"$",
"clientId",
",",
"'description'",
"=>",
"$",
"description",
",",
")",
";",
"// If empty, descriptio... | Change the description of a client. This can also be thought of as the
'name' of the client. This API call may only be made by the owner client.
@param string $clientId The client id of the client having it's
description changed
@param string $description The new description for the target client | [
"Change",
"the",
"description",
"of",
"a",
"client",
".",
"This",
"can",
"also",
"be",
"thought",
"of",
"as",
"the",
"name",
"of",
"the",
"client",
".",
"This",
"API",
"call",
"may",
"only",
"be",
"made",
"by",
"the",
"owner",
"client",
"."
] | train | https://github.com/gedex/php-janrain-api/blob/6283f68454e0ad5211ac620f1d337df38cd49597/lib/Janrain/Api/Capture/Clients.php#L119-L132 |
gedex/php-janrain-api | lib/Janrain/Api/Capture/Clients.php | Clients.setFeatures | public function setFeatures($clientId, array $features)
{
$params = array(
'for_client_id' => $clientId,
'features' => json_encode($features),
);
// If empty, features are set for the owner client.
if (!$params['for_client_id']) {
unset($params['for_client_id']);
}
return $this->post('clien... | php | public function setFeatures($clientId, array $features)
{
$params = array(
'for_client_id' => $clientId,
'features' => json_encode($features),
);
// If empty, features are set for the owner client.
if (!$params['for_client_id']) {
unset($params['for_client_id']);
}
return $this->post('clien... | [
"public",
"function",
"setFeatures",
"(",
"$",
"clientId",
",",
"array",
"$",
"features",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"'for_client_id'",
"=>",
"$",
"clientId",
",",
"'features'",
"=>",
"json_encode",
"(",
"$",
"features",
")",
",",
")",
"... | Change the features that a target client has by overwriting the old feature
list. This API call may only be made by the 'owner' client. The owner client
may not remove the 'owner' feature from itself.
@param string $clientId The client id for which to set features
@param array $features Array of feature names to assi... | [
"Change",
"the",
"features",
"that",
"a",
"target",
"client",
"has",
"by",
"overwriting",
"the",
"old",
"feature",
"list",
".",
"This",
"API",
"call",
"may",
"only",
"be",
"made",
"by",
"the",
"owner",
"client",
".",
"The",
"owner",
"client",
"may",
"not... | train | https://github.com/gedex/php-janrain-api/blob/6283f68454e0ad5211ac620f1d337df38cd49597/lib/Janrain/Api/Capture/Clients.php#L142-L155 |
gedex/php-janrain-api | lib/Janrain/Api/Capture/Clients.php | Clients.setWhiteList | public function setWhiteList($clientId, array $addresses)
{
$params = array(
'for_client_id' => $clientId,
'whitelist' => json_encode($addresses),
);
// If empty, features are set for the owner client.
if (!$params['for_client_id']) {
unset($params['for_client_id']);
}
return $this->post('cl... | php | public function setWhiteList($clientId, array $addresses)
{
$params = array(
'for_client_id' => $clientId,
'whitelist' => json_encode($addresses),
);
// If empty, features are set for the owner client.
if (!$params['for_client_id']) {
unset($params['for_client_id']);
}
return $this->post('cl... | [
"public",
"function",
"setWhiteList",
"(",
"$",
"clientId",
",",
"array",
"$",
"addresses",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"'for_client_id'",
"=>",
"$",
"clientId",
",",
"'whitelist'",
"=>",
"json_encode",
"(",
"$",
"addresses",
")",
",",
")",... | Change the IP whitelist for a target client, overwriting the previous whitelist.
@param string $clientId Client ID
@param array $addresses Array of CIDR addresses | [
"Change",
"the",
"IP",
"whitelist",
"for",
"a",
"target",
"client",
"overwriting",
"the",
"previous",
"whitelist",
"."
] | train | https://github.com/gedex/php-janrain-api/blob/6283f68454e0ad5211ac620f1d337df38cd49597/lib/Janrain/Api/Capture/Clients.php#L163-L176 |
blast-project/BaseEntitiesBundle | src/Loggable/Mapping/Event/Adapter/ORM.php | ORM.getNewVersion | public function getNewVersion($meta, $object)
{
$em = $this->getObjectManager();
$objectMeta = $em->getClassMetadata(get_class($object));
$identifierField = $this->getSingleIdentifierFieldName($objectMeta);
$objectId = $objectMeta->getReflectionProperty($identifierField)->getValue($o... | php | public function getNewVersion($meta, $object)
{
$em = $this->getObjectManager();
$objectMeta = $em->getClassMetadata(get_class($object));
$identifierField = $this->getSingleIdentifierFieldName($objectMeta);
$objectId = $objectMeta->getReflectionProperty($identifierField)->getValue($o... | [
"public",
"function",
"getNewVersion",
"(",
"$",
"meta",
",",
"$",
"object",
")",
"{",
"$",
"em",
"=",
"$",
"this",
"->",
"getObjectManager",
"(",
")",
";",
"$",
"objectMeta",
"=",
"$",
"em",
"->",
"getClassMetadata",
"(",
"get_class",
"(",
"$",
"objec... | {@inheritdoc} | [
"{"
] | train | https://github.com/blast-project/BaseEntitiesBundle/blob/abd06891fc38922225ab7e4fcb437a286ba2c0c4/src/Loggable/Mapping/Event/Adapter/ORM.php#L46-L64 |
heidelpay/PhpDoc | src/phpDocumentor/Command/Helper/LoggerHelper.php | LoggerHelper.connectOutputToLogging | public function connectOutputToLogging(OutputInterface $output, $command)
{
static $alreadyConnected = false;
$helper = $this;
// ignore any second or later invocations of this method
if ($alreadyConnected) {
return;
}
/** @var Dispatcher $eventDispatche... | php | public function connectOutputToLogging(OutputInterface $output, $command)
{
static $alreadyConnected = false;
$helper = $this;
// ignore any second or later invocations of this method
if ($alreadyConnected) {
return;
}
/** @var Dispatcher $eventDispatche... | [
"public",
"function",
"connectOutputToLogging",
"(",
"OutputInterface",
"$",
"output",
",",
"$",
"command",
")",
"{",
"static",
"$",
"alreadyConnected",
"=",
"false",
";",
"$",
"helper",
"=",
"$",
"this",
";",
"// ignore any second or later invocations of this method"... | Connect the logging events to the output object of Symfony Console.
@param OutputInterface $output
@param Command $command
@return void | [
"Connect",
"the",
"logging",
"events",
"to",
"the",
"output",
"object",
"of",
"Symfony",
"Console",
"."
] | train | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Command/Helper/LoggerHelper.php#L64-L92 |
heidelpay/PhpDoc | src/phpDocumentor/Command/Helper/LoggerHelper.php | LoggerHelper.logEvent | public function logEvent(OutputInterface $output, LogEvent $event, Command $command)
{
$numericErrors = array(
LogLevel::DEBUG => 0,
LogLevel::NOTICE => 1,
LogLevel::INFO => 2,
LogLevel::WARNING => 3,
LogLevel::ERROR => 4,
... | php | public function logEvent(OutputInterface $output, LogEvent $event, Command $command)
{
$numericErrors = array(
LogLevel::DEBUG => 0,
LogLevel::NOTICE => 1,
LogLevel::INFO => 2,
LogLevel::WARNING => 3,
LogLevel::ERROR => 4,
... | [
"public",
"function",
"logEvent",
"(",
"OutputInterface",
"$",
"output",
",",
"LogEvent",
"$",
"event",
",",
"Command",
"$",
"command",
")",
"{",
"$",
"numericErrors",
"=",
"array",
"(",
"LogLevel",
"::",
"DEBUG",
"=>",
"0",
",",
"LogLevel",
"::",
"NOTICE"... | Logs an event with the output.
This method will also colorize the message based on priority and withhold
certain logging in case of verbosity or not.
@param OutputInterface $output
@param LogEvent $event
@param Command $command
@return void | [
"Logs",
"an",
"event",
"with",
"the",
"output",
"."
] | train | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Command/Helper/LoggerHelper.php#L106-L142 |
codezero-be/curl | src/Request.php | Request.get | public function get($url, array $data = [], array $headers = [])
{
$url = $this->optionParser->parseUrl($url, $data);
$this->unsetOption(CURLOPT_POST);
$this->setOptions([
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPGET => true
]);
return $this->sen... | php | public function get($url, array $data = [], array $headers = [])
{
$url = $this->optionParser->parseUrl($url, $data);
$this->unsetOption(CURLOPT_POST);
$this->setOptions([
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPGET => true
]);
return $this->sen... | [
"public",
"function",
"get",
"(",
"$",
"url",
",",
"array",
"$",
"data",
"=",
"[",
"]",
",",
"array",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"optionParser",
"->",
"parseUrl",
"(",
"$",
"url",
",",
"$",
"dat... | Send GET request
@param string $url
@param array $data
@param array $headers
@return Response | [
"Send",
"GET",
"request"
] | train | https://github.com/codezero-be/curl/blob/c1385479886662b6276c18dd9140df529959d95c/src/Request.php#L58-L70 |
codezero-be/curl | src/Request.php | Request.post | public function post($url, array $data = [], array $headers = [])
{
$this->unsetOption(CURLOPT_HTTPGET);
$this->setOptions([
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POST => true
]);
return $this->send($url, $data, $headers);
} | php | public function post($url, array $data = [], array $headers = [])
{
$this->unsetOption(CURLOPT_HTTPGET);
$this->setOptions([
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POST => true
]);
return $this->send($url, $data, $headers);
} | [
"public",
"function",
"post",
"(",
"$",
"url",
",",
"array",
"$",
"data",
"=",
"[",
"]",
",",
"array",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"unsetOption",
"(",
"CURLOPT_HTTPGET",
")",
";",
"$",
"this",
"->",
"setOptions",
"("... | Send POST request
@param string $url
@param array $data
@param array $headers
@return Response | [
"Send",
"POST",
"request"
] | train | https://github.com/codezero-be/curl/blob/c1385479886662b6276c18dd9140df529959d95c/src/Request.php#L81-L91 |
codezero-be/curl | src/Request.php | Request.put | public function put($url, array $data = [], array $headers = [])
{
$this->unsetOptions([CURLOPT_HTTPGET, CURLOPT_POST]);
$this->setOption(CURLOPT_CUSTOMREQUEST, 'PUT');
return $this->send($url, $data, $headers);
} | php | public function put($url, array $data = [], array $headers = [])
{
$this->unsetOptions([CURLOPT_HTTPGET, CURLOPT_POST]);
$this->setOption(CURLOPT_CUSTOMREQUEST, 'PUT');
return $this->send($url, $data, $headers);
} | [
"public",
"function",
"put",
"(",
"$",
"url",
",",
"array",
"$",
"data",
"=",
"[",
"]",
",",
"array",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"unsetOptions",
"(",
"[",
"CURLOPT_HTTPGET",
",",
"CURLOPT_POST",
"]",
")",
";",
"$",
... | Send PUT request
@param string $url
@param array $data
@param array $headers
@return Response | [
"Send",
"PUT",
"request"
] | train | https://github.com/codezero-be/curl/blob/c1385479886662b6276c18dd9140df529959d95c/src/Request.php#L102-L109 |
codezero-be/curl | src/Request.php | Request.setDefaultOptions | private function setDefaultOptions()
{
$this->setOptions([
CURLOPT_SSL_VERIFYPEER => true,
CURLOPT_HEADER => false,
CURLOPT_RETURNTRANSFER => true, //=> return response instead of boolean
CURLOPT_FAILONERROR => false //=> also return an error when there is a h... | php | private function setDefaultOptions()
{
$this->setOptions([
CURLOPT_SSL_VERIFYPEER => true,
CURLOPT_HEADER => false,
CURLOPT_RETURNTRANSFER => true, //=> return response instead of boolean
CURLOPT_FAILONERROR => false //=> also return an error when there is a h... | [
"private",
"function",
"setDefaultOptions",
"(",
")",
"{",
"$",
"this",
"->",
"setOptions",
"(",
"[",
"CURLOPT_SSL_VERIFYPEER",
"=>",
"true",
",",
"CURLOPT_HEADER",
"=>",
"false",
",",
"CURLOPT_RETURNTRANSFER",
"=>",
"true",
",",
"//=> return response instead of boole... | Set default cURL options
@return void | [
"Set",
"default",
"cURL",
"options"
] | train | https://github.com/codezero-be/curl/blob/c1385479886662b6276c18dd9140df529959d95c/src/Request.php#L265-L273 |
codezero-be/curl | src/Request.php | Request.setData | private function setData(array $data)
{
if ( ! empty($data))
{
$this->setOption(CURLOPT_POSTFIELDS, $this->optionParser->parseData($data));
}
else
{
$this->unsetOption(CURLOPT_POSTFIELDS);
}
} | php | private function setData(array $data)
{
if ( ! empty($data))
{
$this->setOption(CURLOPT_POSTFIELDS, $this->optionParser->parseData($data));
}
else
{
$this->unsetOption(CURLOPT_POSTFIELDS);
}
} | [
"private",
"function",
"setData",
"(",
"array",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"data",
")",
")",
"{",
"$",
"this",
"->",
"setOption",
"(",
"CURLOPT_POSTFIELDS",
",",
"$",
"this",
"->",
"optionParser",
"->",
"parseData",
"(",
... | Set request post fields
@param array $data
@return void | [
"Set",
"request",
"post",
"fields"
] | train | https://github.com/codezero-be/curl/blob/c1385479886662b6276c18dd9140df529959d95c/src/Request.php#L294-L304 |
codezero-be/curl | src/Request.php | Request.setHeaders | private function setHeaders(array $headers)
{
if ( ! empty($headers))
{
$this->setOption(CURLOPT_HTTPHEADER, $this->optionParser->parseHeaders($headers));
}
else
{
$this->unsetOption(CURLOPT_HTTPHEADER);
}
} | php | private function setHeaders(array $headers)
{
if ( ! empty($headers))
{
$this->setOption(CURLOPT_HTTPHEADER, $this->optionParser->parseHeaders($headers));
}
else
{
$this->unsetOption(CURLOPT_HTTPHEADER);
}
} | [
"private",
"function",
"setHeaders",
"(",
"array",
"$",
"headers",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"headers",
")",
")",
"{",
"$",
"this",
"->",
"setOption",
"(",
"CURLOPT_HTTPHEADER",
",",
"$",
"this",
"->",
"optionParser",
"->",
"parseHeade... | Set request headers
@param array $headers
@return void | [
"Set",
"request",
"headers"
] | train | https://github.com/codezero-be/curl/blob/c1385479886662b6276c18dd9140df529959d95c/src/Request.php#L313-L323 |
codezero-be/curl | src/Request.php | Request.send | private function send($url, array $data = [], array $headers = [])
{
// Set incoming parameters as cURL options
$this->setUrl($url);
$this->setData($data);
$this->setHeaders($headers);
return $this->executeCurlRequest();
} | php | private function send($url, array $data = [], array $headers = [])
{
// Set incoming parameters as cURL options
$this->setUrl($url);
$this->setData($data);
$this->setHeaders($headers);
return $this->executeCurlRequest();
} | [
"private",
"function",
"send",
"(",
"$",
"url",
",",
"array",
"$",
"data",
"=",
"[",
"]",
",",
"array",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"// Set incoming parameters as cURL options",
"$",
"this",
"->",
"setUrl",
"(",
"$",
"url",
")",
";",
"$",
... | Send a request
@param string $url
@param array $data
@param array $headers
@return Response
@throws RequestException | [
"Send",
"a",
"request"
] | train | https://github.com/codezero-be/curl/blob/c1385479886662b6276c18dd9140df529959d95c/src/Request.php#L335-L343 |
codezero-be/curl | src/Request.php | Request.executeCurlRequest | private function executeCurlRequest()
{
// Send the request and capture the response
$rawResponse = $this->curl->sendRequest($this->options);
// Fetch additional information about the request
$responseInfo = $this->curl->getRequestInfo();
if ( ! is_array($responseInfo))
... | php | private function executeCurlRequest()
{
// Send the request and capture the response
$rawResponse = $this->curl->sendRequest($this->options);
// Fetch additional information about the request
$responseInfo = $this->curl->getRequestInfo();
if ( ! is_array($responseInfo))
... | [
"private",
"function",
"executeCurlRequest",
"(",
")",
"{",
"// Send the request and capture the response",
"$",
"rawResponse",
"=",
"$",
"this",
"->",
"curl",
"->",
"sendRequest",
"(",
"$",
"this",
"->",
"options",
")",
";",
"// Fetch additional information about the r... | Execute the cURL request
@return Response
@throws RequestException | [
"Execute",
"the",
"cURL",
"request"
] | train | https://github.com/codezero-be/curl/blob/c1385479886662b6276c18dd9140df529959d95c/src/Request.php#L351-L379 |
php-lug/lug | src/Component/Grid/Column/Type/Formatter/NumberFormatter.php | NumberFormatter.format | public function format($value, array $options = [])
{
if (!is_numeric($value)) {
throw new InvalidTypeException(sprintf(
'The number formatter expects a numeric value, got "%s".',
is_object($value) ? get_class($value) : gettype($value)
));
}
... | php | public function format($value, array $options = [])
{
if (!is_numeric($value)) {
throw new InvalidTypeException(sprintf(
'The number formatter expects a numeric value, got "%s".',
is_object($value) ? get_class($value) : gettype($value)
));
}
... | [
"public",
"function",
"format",
"(",
"$",
"value",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"InvalidTypeException",
"(",
"sprintf",
"(",
"'The number formatter ... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Component/Grid/Column/Type/Formatter/NumberFormatter.php#L38-L57 |
juskiewicz/Geolocation | src/Http/Exception/InvalidServerResponse.php | InvalidServerResponse.create | public static function create(string $query, int $code = 0) : self
{
return new self(sprintf('Server returned an invalid response (%d) for query "%s". We could not parse it.', $code, $query));
} | php | public static function create(string $query, int $code = 0) : self
{
return new self(sprintf('Server returned an invalid response (%d) for query "%s". We could not parse it.', $code, $query));
} | [
"public",
"static",
"function",
"create",
"(",
"string",
"$",
"query",
",",
"int",
"$",
"code",
"=",
"0",
")",
":",
"self",
"{",
"return",
"new",
"self",
"(",
"sprintf",
"(",
"'Server returned an invalid response (%d) for query \"%s\". We could not parse it.'",
",",... | @param string $query
@param int $code
@return InvalidServerResponse | [
"@param",
"string",
"$query",
"@param",
"int",
"$code"
] | train | https://github.com/juskiewicz/Geolocation/blob/5d3cd393961b92bdfbe2dfe631fbfb62c72dc36d/src/Http/Exception/InvalidServerResponse.php#L13-L16 |
Duffleman/json-client | src/JSONClient.php | JSONClient.get | public function get($url, $query = [], $headers = [])
{
$headers = array_merge($this->global_headers, $headers);
return $this->request('GET', $url, [], $query, $headers);
} | php | public function get($url, $query = [], $headers = [])
{
$headers = array_merge($this->global_headers, $headers);
return $this->request('GET', $url, [], $query, $headers);
} | [
"public",
"function",
"get",
"(",
"$",
"url",
",",
"$",
"query",
"=",
"[",
"]",
",",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"$",
"headers",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"global_headers",
",",
"$",
"headers",
")",
";",
"return",
"... | Special method for GET because we never pass in a body.
@param string $url
@param array $query
@param array $headers
@return Collections\Generic|\Illuminate\Support\Collection|void | [
"Special",
"method",
"for",
"GET",
"because",
"we",
"never",
"pass",
"in",
"a",
"body",
"."
] | train | https://github.com/Duffleman/json-client/blob/83432875a000e79243424a1e8676acb9969d0c18/src/JSONClient.php#L85-L90 |
Duffleman/json-client | src/JSONClient.php | JSONClient.request | public function request($method, $url, $body = [], $query = [], $headers = [])
{
list($body, $query, $headers) = $this->setupVariables($body, $query, $headers);
if (!empty($body)) {
$body = encode($body);
$headers['Content-Type'] = 'application/json';
} else {
... | php | public function request($method, $url, $body = [], $query = [], $headers = [])
{
list($body, $query, $headers) = $this->setupVariables($body, $query, $headers);
if (!empty($body)) {
$body = encode($body);
$headers['Content-Type'] = 'application/json';
} else {
... | [
"public",
"function",
"request",
"(",
"$",
"method",
",",
"$",
"url",
",",
"$",
"body",
"=",
"[",
"]",
",",
"$",
"query",
"=",
"[",
"]",
",",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"list",
"(",
"$",
"body",
",",
"$",
"query",
",",
"$",
"h... | The main meaty request method, handles
all outgoing requests and deals with responses.
@param string $method
@param string $url
@param array $body
@param array $query
@param array $headers
@throws JSONError
@throws JSONLibraryException
@return Collections\Generic|\Illuminate\Support\Collection|null|void | [
"The",
"main",
"meaty",
"request",
"method",
"handles",
"all",
"outgoing",
"requests",
"and",
"deals",
"with",
"responses",
"."
] | train | https://github.com/Duffleman/json-client/blob/83432875a000e79243424a1e8676acb9969d0c18/src/JSONClient.php#L107-L151 |
Duffleman/json-client | src/JSONClient.php | JSONClient.requestAsync | public function requestAsync($method, $url, $body = [], $query = [], $headers = [])
{
if (!empty($body)) {
$body = encode($body);
$headers['Content-Type'] = 'application/json';
} else {
$body = null;
}
$headers = array_merge($this->global_headers,... | php | public function requestAsync($method, $url, $body = [], $query = [], $headers = [])
{
if (!empty($body)) {
$body = encode($body);
$headers['Content-Type'] = 'application/json';
} else {
$body = null;
}
$headers = array_merge($this->global_headers,... | [
"public",
"function",
"requestAsync",
"(",
"$",
"method",
",",
"$",
"url",
",",
"$",
"body",
"=",
"[",
"]",
",",
"$",
"query",
"=",
"[",
"]",
",",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"body",
")",
")",
... | Return a promise for async requests.
@param string $method
@param string $url
@param array $body
@param array $query
@param array $headers
@return \GuzzleHttp\Promise\PromiseInterface | [
"Return",
"a",
"promise",
"for",
"async",
"requests",
"."
] | train | https://github.com/Duffleman/json-client/blob/83432875a000e79243424a1e8676acb9969d0c18/src/JSONClient.php#L164-L180 |
Duffleman/json-client | src/JSONClient.php | JSONClient.handleError | public static function handleError(BadResponseException $exception)
{
$response_body = (string) $exception->getResponse()->getBody();
$array_body = decode($response_body);
$code = $exception->getResponse()->getStatusCode();
$lookForKeys = ['message', 'code', 'error'];
fore... | php | public static function handleError(BadResponseException $exception)
{
$response_body = (string) $exception->getResponse()->getBody();
$array_body = decode($response_body);
$code = $exception->getResponse()->getStatusCode();
$lookForKeys = ['message', 'code', 'error'];
fore... | [
"public",
"static",
"function",
"handleError",
"(",
"BadResponseException",
"$",
"exception",
")",
"{",
"$",
"response_body",
"=",
"(",
"string",
")",
"$",
"exception",
"->",
"getResponse",
"(",
")",
"->",
"getBody",
"(",
")",
";",
"$",
"array_body",
"=",
... | Handles the error for us, just a bit of code abstraction.
@param BadResponseException $exception
@throws JSONError | [
"Handles",
"the",
"error",
"for",
"us",
"just",
"a",
"bit",
"of",
"code",
"abstraction",
"."
] | train | https://github.com/Duffleman/json-client/blob/83432875a000e79243424a1e8676acb9969d0c18/src/JSONClient.php#L189-L209 |
Duffleman/json-client | src/JSONClient.php | JSONClient.mode | public function mode($mode)
{
$acceptable_modes = [-1, 0, 1, 2];
if (!in_array($mode, $acceptable_modes)) {
throw new JSONLibraryException('bad_mode_set');
}
$this->mode = $mode;
return $this;
} | php | public function mode($mode)
{
$acceptable_modes = [-1, 0, 1, 2];
if (!in_array($mode, $acceptable_modes)) {
throw new JSONLibraryException('bad_mode_set');
}
$this->mode = $mode;
return $this;
} | [
"public",
"function",
"mode",
"(",
"$",
"mode",
")",
"{",
"$",
"acceptable_modes",
"=",
"[",
"-",
"1",
",",
"0",
",",
"1",
",",
"2",
"]",
";",
"if",
"(",
"!",
"in_array",
"(",
"$",
"mode",
",",
"$",
"acceptable_modes",
")",
")",
"{",
"throw",
"... | Set the mode fluently.
@param int $mode
@throws JSONLibraryException
@return $this | [
"Set",
"the",
"mode",
"fluently",
"."
] | train | https://github.com/Duffleman/json-client/blob/83432875a000e79243424a1e8676acb9969d0c18/src/JSONClient.php#L220-L229 |
Duffleman/json-client | src/JSONClient.php | JSONClient.setupVariables | private function setupVariables($body, $query, $headers)
{
if (is_null($headers)) {
$headers = [];
}
if (is_null($query)) {
$query = [];
}
if (is_null($body)) {
$body = [];
}
return [$body, $query, $headers];
} | php | private function setupVariables($body, $query, $headers)
{
if (is_null($headers)) {
$headers = [];
}
if (is_null($query)) {
$query = [];
}
if (is_null($body)) {
$body = [];
}
return [$body, $query, $headers];
} | [
"private",
"function",
"setupVariables",
"(",
"$",
"body",
",",
"$",
"query",
",",
"$",
"headers",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"headers",
")",
")",
"{",
"$",
"headers",
"=",
"[",
"]",
";",
"}",
"if",
"(",
"is_null",
"(",
"$",
"query... | Setup empty arrays if null given.
@param $body
@param $query
@param $headers
@return array | [
"Setup",
"empty",
"arrays",
"if",
"null",
"given",
"."
] | train | https://github.com/Duffleman/json-client/blob/83432875a000e79243424a1e8676acb9969d0c18/src/JSONClient.php#L280-L293 |
heidelpay/PhpDoc | src/phpDocumentor/Bootstrap.php | Bootstrap.initialize | public function initialize()
{
$vendorPath = $this->findVendorPath();
$autoloader = $this->createAutoloader($vendorPath);
return new Application($autoloader, array('composer.vendor_path' => $vendorPath));
} | php | public function initialize()
{
$vendorPath = $this->findVendorPath();
$autoloader = $this->createAutoloader($vendorPath);
return new Application($autoloader, array('composer.vendor_path' => $vendorPath));
} | [
"public",
"function",
"initialize",
"(",
")",
"{",
"$",
"vendorPath",
"=",
"$",
"this",
"->",
"findVendorPath",
"(",
")",
";",
"$",
"autoloader",
"=",
"$",
"this",
"->",
"createAutoloader",
"(",
"$",
"vendorPath",
")",
";",
"return",
"new",
"Application",
... | Convenience method that does the complete initialization for phpDocumentor.
@return Application | [
"Convenience",
"method",
"that",
"does",
"the",
"complete",
"initialization",
"for",
"phpDocumentor",
"."
] | train | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Bootstrap.php#L56-L63 |
heidelpay/PhpDoc | src/phpDocumentor/Bootstrap.php | Bootstrap.registerProfiler | public function registerProfiler()
{
// check whether xhprof is loaded
$profile = (bool) (getenv('PHPDOC_PROFILE') === 'on');
$xhguiPath = getenv('XHGUI_PATH');
if ($profile && $xhguiPath && extension_loaded('xhprof')) {
echo 'PROFILING ENABLED' . PHP_EOL;
inc... | php | public function registerProfiler()
{
// check whether xhprof is loaded
$profile = (bool) (getenv('PHPDOC_PROFILE') === 'on');
$xhguiPath = getenv('XHGUI_PATH');
if ($profile && $xhguiPath && extension_loaded('xhprof')) {
echo 'PROFILING ENABLED' . PHP_EOL;
inc... | [
"public",
"function",
"registerProfiler",
"(",
")",
"{",
"// check whether xhprof is loaded",
"$",
"profile",
"=",
"(",
"bool",
")",
"(",
"getenv",
"(",
"'PHPDOC_PROFILE'",
")",
"===",
"'on'",
")",
";",
"$",
"xhguiPath",
"=",
"getenv",
"(",
"'XHGUI_PATH'",
")"... | Sets up XHProf so that we can profile phpDocumentor using XHGUI.
@return self | [
"Sets",
"up",
"XHProf",
"so",
"that",
"we",
"can",
"profile",
"phpDocumentor",
"using",
"XHGUI",
"."
] | train | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Bootstrap.php#L70-L81 |
heidelpay/PhpDoc | src/phpDocumentor/Bootstrap.php | Bootstrap.createAutoloader | public function createAutoloader($vendorDir = null)
{
if (! $vendorDir) {
$vendorDir = __DIR__ . '/../../vendor';
}
$autoloader_location = $vendorDir . '/autoload.php';
if (! file_exists($autoloader_location) || ! is_readable($autoloader_location)) {
throw ne... | php | public function createAutoloader($vendorDir = null)
{
if (! $vendorDir) {
$vendorDir = __DIR__ . '/../../vendor';
}
$autoloader_location = $vendorDir . '/autoload.php';
if (! file_exists($autoloader_location) || ! is_readable($autoloader_location)) {
throw ne... | [
"public",
"function",
"createAutoloader",
"(",
"$",
"vendorDir",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"vendorDir",
")",
"{",
"$",
"vendorDir",
"=",
"__DIR__",
".",
"'/../../vendor'",
";",
"}",
"$",
"autoloader_location",
"=",
"$",
"vendorDir",
".",
... | Initializes and returns the autoloader.
@param string|null $vendorDir A path (either absolute or relative to the current working directory) leading to
the vendor folder where composer installed the dependencies.
@throws \RuntimeException if no autoloader could be found.
@return ClassLoader | [
"Initializes",
"and",
"returns",
"the",
"autoloader",
"."
] | train | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Bootstrap.php#L93-L111 |
heidelpay/PhpDoc | src/phpDocumentor/Bootstrap.php | Bootstrap.findVendorPath | public function findVendorPath($baseDir = __DIR__)
{
// default installation
$vendorDir = $baseDir . '/../../vendor';
// Composerised installation, vendor/phpdocumentor/phpdocumentor/src/phpDocumentor is __DIR__
$rootFolderWhenInstalledWithComposer = $baseDir . '/../../../../../';
... | php | public function findVendorPath($baseDir = __DIR__)
{
// default installation
$vendorDir = $baseDir . '/../../vendor';
// Composerised installation, vendor/phpdocumentor/phpdocumentor/src/phpDocumentor is __DIR__
$rootFolderWhenInstalledWithComposer = $baseDir . '/../../../../../';
... | [
"public",
"function",
"findVendorPath",
"(",
"$",
"baseDir",
"=",
"__DIR__",
")",
"{",
"// default installation",
"$",
"vendorDir",
"=",
"$",
"baseDir",
".",
"'/../../vendor'",
";",
"// Composerised installation, vendor/phpdocumentor/phpdocumentor/src/phpDocumentor is __DIR__",... | Attempts to find the location of the vendor folder.
This method tries to check for a composer.json in a directory 5 levels below the folder of this Bootstrap file.
This is the expected location if phpDocumentor is installed using composer because the current directory for
this file is expected to be 'vendor/phpdocumen... | [
"Attempts",
"to",
"find",
"the",
"location",
"of",
"the",
"vendor",
"folder",
"."
] | train | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Bootstrap.php#L132-L146 |
heidelpay/PhpDoc | src/phpDocumentor/Bootstrap.php | Bootstrap.getCustomVendorPathFromComposer | protected function getCustomVendorPathFromComposer($composerConfigurationPath)
{
$composerFile = file_get_contents($composerConfigurationPath);
$composerJson = json_decode($composerFile, true);
return isset($composerJson['config']['vendor-dir']) ? $composerJson['config']['vendor-dir'] : 've... | php | protected function getCustomVendorPathFromComposer($composerConfigurationPath)
{
$composerFile = file_get_contents($composerConfigurationPath);
$composerJson = json_decode($composerFile, true);
return isset($composerJson['config']['vendor-dir']) ? $composerJson['config']['vendor-dir'] : 've... | [
"protected",
"function",
"getCustomVendorPathFromComposer",
"(",
"$",
"composerConfigurationPath",
")",
"{",
"$",
"composerFile",
"=",
"file_get_contents",
"(",
"$",
"composerConfigurationPath",
")",
";",
"$",
"composerJson",
"=",
"json_decode",
"(",
"$",
"composerFile"... | Retrieves the custom vendor-dir from the given composer.json or returns 'vendor'.
@param string $composerConfigurationPath the path pointing to the composer.json
@return string | [
"Retrieves",
"the",
"custom",
"vendor",
"-",
"dir",
"from",
"the",
"given",
"composer",
".",
"json",
"or",
"returns",
"vendor",
"."
] | train | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Bootstrap.php#L155-L161 |
technote-space/wordpress-plugin-base | src/classes/models/lib/device.php | Device.is_robot | public function is_robot( $cache = true ) {
if ( $cache && isset( $this->_is_robot ) ) {
return $this->_is_robot;
}
$this->_is_robot = $this->apply_filters( 'pre_check_bot', null );
if ( is_bool( $this->_is_robot ) ) {
return $this->_is_robot;
}
$bot_list = explode( ',', $this->apply_filters( 'bot_l... | php | public function is_robot( $cache = true ) {
if ( $cache && isset( $this->_is_robot ) ) {
return $this->_is_robot;
}
$this->_is_robot = $this->apply_filters( 'pre_check_bot', null );
if ( is_bool( $this->_is_robot ) ) {
return $this->_is_robot;
}
$bot_list = explode( ',', $this->apply_filters( 'bot_l... | [
"public",
"function",
"is_robot",
"(",
"$",
"cache",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"cache",
"&&",
"isset",
"(",
"$",
"this",
"->",
"_is_robot",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_is_robot",
";",
"}",
"$",
"this",
"->",
"_is_robo... | @param bool $cache
@return bool | [
"@param",
"bool",
"$cache"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/device.php#L62-L111 |
everest-php/framework | src/Social/FacebookAuth.php | FacebookAuth.collectResponse | public static function collectResponse(){
self::init();
$fb = self::$fbInstance;
$helper = $fb->getRedirectLoginHelper();
try {
$accessToken = $helper->getAccessToken();
} catch(FacebookResponseException $e) {
echo 'Graph returned an error: ' . $e->getMes... | php | public static function collectResponse(){
self::init();
$fb = self::$fbInstance;
$helper = $fb->getRedirectLoginHelper();
try {
$accessToken = $helper->getAccessToken();
} catch(FacebookResponseException $e) {
echo 'Graph returned an error: ' . $e->getMes... | [
"public",
"static",
"function",
"collectResponse",
"(",
")",
"{",
"self",
"::",
"init",
"(",
")",
";",
"$",
"fb",
"=",
"self",
"::",
"$",
"fbInstance",
";",
"$",
"helper",
"=",
"$",
"fb",
"->",
"getRedirectLoginHelper",
"(",
")",
";",
"try",
"{",
"$"... | Part 2: When Authorise Response comes back from facebook | [
"Part",
"2",
":",
"When",
"Authorise",
"Response",
"comes",
"back",
"from",
"facebook"
] | train | https://github.com/everest-php/framework/blob/f5c402dd7dbd7622074d2aa4835bcee133f398a7/src/Social/FacebookAuth.php#L67-L89 |
songshenzong/log | src/LaravelDebugbar.php | LaravelDebugbar.boot | public function boot()
{
if ($this->booted) {
return;
}
/** @var \Songshenzong\Log\LaravelDebugbar $debugbar */
$debugbar = $this;
/** @var Application $app */
$app = $this->app;
// Set custom error handler
set_error_handler([$this, 'ha... | php | public function boot()
{
if ($this->booted) {
return;
}
/** @var \Songshenzong\Log\LaravelDebugbar $debugbar */
$debugbar = $this;
/** @var Application $app */
$app = $this->app;
// Set custom error handler
set_error_handler([$this, 'ha... | [
"public",
"function",
"boot",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"booted",
")",
"{",
"return",
";",
"}",
"/** @var \\Songshenzong\\Log\\LaravelDebugbar $debugbar */",
"$",
"debugbar",
"=",
"$",
"this",
";",
"/** @var Application $app */",
"$",
"app",
"... | Boot (add collectors, renderer and listener) | [
"Boot",
"(",
"add",
"collectors",
"renderer",
"and",
"listener",
")"
] | train | https://github.com/songshenzong/log/blob/b1e01f7994da47737866eabf82367490eab17c46/src/LaravelDebugbar.php#L125-L517 |
songshenzong/log | src/LaravelDebugbar.php | LaravelDebugbar.startMeasure | public function startMeasure($name, $label = null)
{
if ($this->hasCollector('time')) {
/** @var \Songshenzong\Log\DataCollector\TimeDataCollector $collector */
$collector = $this->getCollector('time');
$collector->startMeasure($name, $label);
}
} | php | public function startMeasure($name, $label = null)
{
if ($this->hasCollector('time')) {
/** @var \Songshenzong\Log\DataCollector\TimeDataCollector $collector */
$collector = $this->getCollector('time');
$collector->startMeasure($name, $label);
}
} | [
"public",
"function",
"startMeasure",
"(",
"$",
"name",
",",
"$",
"label",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasCollector",
"(",
"'time'",
")",
")",
"{",
"/** @var \\Songshenzong\\Log\\DataCollector\\TimeDataCollector $collector */",
"$",
"coll... | Starts a measure
@param string $name Internal name, used to stop the measure
@param string $label Public name
@throws DebugBarException | [
"Starts",
"a",
"measure"
] | train | https://github.com/songshenzong/log/blob/b1e01f7994da47737866eabf82367490eab17c46/src/LaravelDebugbar.php#L559-L566 |
songshenzong/log | src/LaravelDebugbar.php | LaravelDebugbar.stopMeasure | public function stopMeasure($name)
{
if ($this->hasCollector('time')) {
/** @var \Songshenzong\Log\DataCollector\TimeDataCollector $collector */
$collector = $this->getCollector('time');
try {
$collector->stopMeasure($name);
} catch (\Exception... | php | public function stopMeasure($name)
{
if ($this->hasCollector('time')) {
/** @var \Songshenzong\Log\DataCollector\TimeDataCollector $collector */
$collector = $this->getCollector('time');
try {
$collector->stopMeasure($name);
} catch (\Exception... | [
"public",
"function",
"stopMeasure",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasCollector",
"(",
"'time'",
")",
")",
"{",
"/** @var \\Songshenzong\\Log\\DataCollector\\TimeDataCollector $collector */",
"$",
"collector",
"=",
"$",
"this",
"->",
"... | Stops a measure
@param string $name
@throws DebugBarException | [
"Stops",
"a",
"measure"
] | train | https://github.com/songshenzong/log/blob/b1e01f7994da47737866eabf82367490eab17c46/src/LaravelDebugbar.php#L575-L586 |
songshenzong/log | src/LaravelDebugbar.php | LaravelDebugbar.modifyResponse | public function modifyResponse(Request $request, Response $response)
{
if ($this->isCollect() === false) {
return;
}
// if ($this -> created) {
// return;
// }
$app = $this->app;
if ($app->runningInConsole() || !$this->isEnabled() || $this-... | php | public function modifyResponse(Request $request, Response $response)
{
if ($this->isCollect() === false) {
return;
}
// if ($this -> created) {
// return;
// }
$app = $this->app;
if ($app->runningInConsole() || !$this->isEnabled() || $this-... | [
"public",
"function",
"modifyResponse",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isCollect",
"(",
")",
"===",
"false",
")",
"{",
"return",
";",
"}",
"// if ($this -> created) {",
"// retur... | Modify the response and inject (or data in headers)
@param \Symfony\Component\HttpFoundation\Request $request
@param \Symfony\Component\HttpFoundation\Response $response
@return Response
@throws DebugBarException | [
"Modify",
"the",
"response",
"and",
"inject",
"(",
"or",
"data",
"in",
"headers",
")"
] | train | https://github.com/songshenzong/log/blob/b1e01f7994da47737866eabf82367490eab17c46/src/LaravelDebugbar.php#L627-L724 |
songshenzong/log | src/LaravelDebugbar.php | LaravelDebugbar.collect | public function collect()
{
$request = app('request');
$this->meta = [
'time' => microtime(true),
'method' => $request->getMethod(),
'uri' => $request->getRequestUri(),
'ip' => $request->getClientIp(),
];
foreach ($this->coll... | php | public function collect()
{
$request = app('request');
$this->meta = [
'time' => microtime(true),
'method' => $request->getMethod(),
'uri' => $request->getRequestUri(),
'ip' => $request->getClientIp(),
];
foreach ($this->coll... | [
"public",
"function",
"collect",
"(",
")",
"{",
"$",
"request",
"=",
"app",
"(",
"'request'",
")",
";",
"$",
"this",
"->",
"meta",
"=",
"[",
"'time'",
"=>",
"microtime",
"(",
"true",
")",
",",
"'method'",
"=>",
"$",
"request",
"->",
"getMethod",
"(",... | Collects the data from the collectors
@return array | [
"Collects",
"the",
"data",
"from",
"the",
"collectors"
] | train | https://github.com/songshenzong/log/blob/b1e01f7994da47737866eabf82367490eab17c46/src/LaravelDebugbar.php#L759-L789 |
songshenzong/log | src/LaravelDebugbar.php | LaravelDebugbar.collectConsole | public function collectConsole()
{
if (!$this->isEnabled()) {
return;
}
$this->meta = [
'time' => microtime(true),
'method' => 'CLI',
'uri' => isset($_SERVER['argv']) ? implode(' ', $_SERVER['argv']) : null,
'ip' => isset... | php | public function collectConsole()
{
if (!$this->isEnabled()) {
return;
}
$this->meta = [
'time' => microtime(true),
'method' => 'CLI',
'uri' => isset($_SERVER['argv']) ? implode(' ', $_SERVER['argv']) : null,
'ip' => isset... | [
"public",
"function",
"collectConsole",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isEnabled",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"meta",
"=",
"[",
"'time'",
"=>",
"microtime",
"(",
"true",
")",
",",
"'method'",
"=>"... | Collect data in a CLI request
@return array | [
"Collect",
"data",
"in",
"a",
"CLI",
"request"
] | train | https://github.com/songshenzong/log/blob/b1e01f7994da47737866eabf82367490eab17c46/src/LaravelDebugbar.php#L797-L830 |
songshenzong/log | src/LaravelDebugbar.php | LaravelDebugbar.json | public function json($status_code, $message, $data = null)
{
return response()->json([
'status_code' => $status_code,
'message' => $message,
'data' => $data,
... | php | public function json($status_code, $message, $data = null)
{
return response()->json([
'status_code' => $status_code,
'message' => $message,
'data' => $data,
... | [
"public",
"function",
"json",
"(",
"$",
"status_code",
",",
"$",
"message",
",",
"$",
"data",
"=",
"null",
")",
"{",
"return",
"response",
"(",
")",
"->",
"json",
"(",
"[",
"'status_code'",
"=>",
"$",
"status_code",
",",
"'message'",
"=>",
"$",
"messag... | Basic Json method.
@param $status_code
@param $message
@param null $data
@return mixed | [
"Basic",
"Json",
"method",
"."
] | train | https://github.com/songshenzong/log/blob/b1e01f7994da47737866eabf82367490eab17c46/src/LaravelDebugbar.php#L969-L977 |
old-town/workflow-designer-server | src/View/WorkflowDescriptorApiModel.php | WorkflowDescriptorApiModel.__isset | public function __isset($name)
{
$variables = $this->getVariables();
$method = 'get' . ucfirst($name);
$flag = method_exists($variables, $method);
return $flag;
} | php | public function __isset($name)
{
$variables = $this->getVariables();
$method = 'get' . ucfirst($name);
$flag = method_exists($variables, $method);
return $flag;
} | [
"public",
"function",
"__isset",
"(",
"$",
"name",
")",
"{",
"$",
"variables",
"=",
"$",
"this",
"->",
"getVariables",
"(",
")",
";",
"$",
"method",
"=",
"'get'",
".",
"ucfirst",
"(",
"$",
"name",
")",
";",
"$",
"flag",
"=",
"method_exists",
"(",
"... | Property overloading: do we have the requested variable value?
@param string $name
@return bool | [
"Property",
"overloading",
":",
"do",
"we",
"have",
"the",
"requested",
"variable",
"value?"
] | train | https://github.com/old-town/workflow-designer-server/blob/6389c5a515861cc8e0b769f1ca7be12c6b78c611/src/View/WorkflowDescriptorApiModel.php#L68-L76 |
tequila/mongodb-odm | src/BulkWriteBuilderFactory.php | BulkWriteBuilderFactory.getBulkWriteBuilder | public function getBulkWriteBuilder(DocumentManager $documentManager, string $collectionName)
{
if (!array_key_exists($collectionName, $this->builders)) {
$this->builders[$collectionName] = new BulkWriteBuilder($documentManager, $collectionName);
}
return $this->builders[$collec... | php | public function getBulkWriteBuilder(DocumentManager $documentManager, string $collectionName)
{
if (!array_key_exists($collectionName, $this->builders)) {
$this->builders[$collectionName] = new BulkWriteBuilder($documentManager, $collectionName);
}
return $this->builders[$collec... | [
"public",
"function",
"getBulkWriteBuilder",
"(",
"DocumentManager",
"$",
"documentManager",
",",
"string",
"$",
"collectionName",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"collectionName",
",",
"$",
"this",
"->",
"builders",
")",
")",
"{",
"$",... | @param DocumentManager $documentManager
@param string $collectionName
@return BulkWriteBuilder | [
"@param",
"DocumentManager",
"$documentManager",
"@param",
"string",
"$collectionName"
] | train | https://github.com/tequila/mongodb-odm/blob/501d58529bbcb23ad7839680462f62d5c3466d23/src/BulkWriteBuilderFactory.php#L18-L25 |
novaway/open-graph | src/Metadata/Driver/YamlDriver.php | YamlDriver.loadMetadataFromFile | protected function loadMetadataFromFile(\ReflectionClass $class, $file)
{
$name = $class->name;
$config = Yaml::parse(file_get_contents($file));
if (!isset($config[$name])) {
throw new \RuntimeException(sprintf('Expected metadata for class %s to be defined in %s.', $class->name,... | php | protected function loadMetadataFromFile(\ReflectionClass $class, $file)
{
$name = $class->name;
$config = Yaml::parse(file_get_contents($file));
if (!isset($config[$name])) {
throw new \RuntimeException(sprintf('Expected metadata for class %s to be defined in %s.', $class->name,... | [
"protected",
"function",
"loadMetadataFromFile",
"(",
"\\",
"ReflectionClass",
"$",
"class",
",",
"$",
"file",
")",
"{",
"$",
"name",
"=",
"$",
"class",
"->",
"name",
";",
"$",
"config",
"=",
"Yaml",
"::",
"parse",
"(",
"file_get_contents",
"(",
"$",
"fi... | {@inheritdoc} | [
"{"
] | train | https://github.com/novaway/open-graph/blob/19817bee4b91cf26ca3fe44883ad58b32328e464/src/Metadata/Driver/YamlDriver.php#L18-L35 |
novaway/open-graph | src/Metadata/Driver/YamlDriver.php | YamlDriver.parseNamespaces | protected function parseNamespaces(ClassMetadata $metadata, $config)
{
if (!isset($config['namespaces'])) {
return;
}
if (!is_array($config)) {
throw new \RuntimeException(sprintf('Invalid YAML configuration for "%s" : "namespaces" property need to be an array.', $me... | php | protected function parseNamespaces(ClassMetadata $metadata, $config)
{
if (!isset($config['namespaces'])) {
return;
}
if (!is_array($config)) {
throw new \RuntimeException(sprintf('Invalid YAML configuration for "%s" : "namespaces" property need to be an array.', $me... | [
"protected",
"function",
"parseNamespaces",
"(",
"ClassMetadata",
"$",
"metadata",
",",
"$",
"config",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"config",
"[",
"'namespaces'",
"]",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"is_array",
"(",
... | Parse namespaces configuration
@param ClassMetadata $metadata
@param mixed $config | [
"Parse",
"namespaces",
"configuration"
] | train | https://github.com/novaway/open-graph/blob/19817bee4b91cf26ca3fe44883ad58b32328e464/src/Metadata/Driver/YamlDriver.php#L51-L67 |
novaway/open-graph | src/Metadata/Driver/YamlDriver.php | YamlDriver.parseNodes | protected function parseNodes(\ReflectionClass $class, ClassMetadata $metadata, $config)
{
if (!isset($config['nodes'])) {
return;
}
if (!is_array($config)) {
throw new \RuntimeException(sprintf('Invalid YAML configuration for "%s" : "properties" property need to be ... | php | protected function parseNodes(\ReflectionClass $class, ClassMetadata $metadata, $config)
{
if (!isset($config['nodes'])) {
return;
}
if (!is_array($config)) {
throw new \RuntimeException(sprintf('Invalid YAML configuration for "%s" : "properties" property need to be ... | [
"protected",
"function",
"parseNodes",
"(",
"\\",
"ReflectionClass",
"$",
"class",
",",
"ClassMetadata",
"$",
"metadata",
",",
"$",
"config",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"config",
"[",
"'nodes'",
"]",
")",
")",
"{",
"return",
";",
"}",... | Parse OpenGraph node properties
@param \ReflectionClass $class
@param ClassMetadata $metadata
@param mixed $config | [
"Parse",
"OpenGraph",
"node",
"properties"
] | train | https://github.com/novaway/open-graph/blob/19817bee4b91cf26ca3fe44883ad58b32328e464/src/Metadata/Driver/YamlDriver.php#L76-L106 |
42mate/towel | src/Towel/Towel.php | Towel.getApps | static public function getApps() {
static $applications = array();
if (!empty($applications)) {
return $applications;
}
$appsDir = APP_ROOT_DIR . '/Application';
$content = scandir($appsDir);
foreach ($content as $item) {
if (is_dir($appsDir . '/' . $item) && $item != '.' && $item... | php | static public function getApps() {
static $applications = array();
if (!empty($applications)) {
return $applications;
}
$appsDir = APP_ROOT_DIR . '/Application';
$content = scandir($appsDir);
foreach ($content as $item) {
if (is_dir($appsDir . '/' . $item) && $item != '.' && $item... | [
"static",
"public",
"function",
"getApps",
"(",
")",
"{",
"static",
"$",
"applications",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"applications",
")",
")",
"{",
"return",
"$",
"applications",
";",
"}",
"$",
"appsDir",
"=",
"APP... | Gets Available applications
return Array : Applications names. | [
"Gets",
"Available",
"applications"
] | train | https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/Towel.php#L12-L37 |
ronaldborla/chikka | src/Borla/Chikka/Models/Config.php | Config.setShortcodeAttribute | protected function setShortcodeAttribute($value) {
// Extract numerics only
$shortcode = Utilities::extractNumerics($value);
// If shortcode doesn't begin with 29290
if (substr($shortcode, 0, 5) != '29290') {
// Throw error
throw new InvalidConfig('Shortcode must start with `29290`. `' . $sh... | php | protected function setShortcodeAttribute($value) {
// Extract numerics only
$shortcode = Utilities::extractNumerics($value);
// If shortcode doesn't begin with 29290
if (substr($shortcode, 0, 5) != '29290') {
// Throw error
throw new InvalidConfig('Shortcode must start with `29290`. `' . $sh... | [
"protected",
"function",
"setShortcodeAttribute",
"(",
"$",
"value",
")",
"{",
"// Extract numerics only",
"$",
"shortcode",
"=",
"Utilities",
"::",
"extractNumerics",
"(",
"$",
"value",
")",
";",
"// If shortcode doesn't begin with 29290",
"if",
"(",
"substr",
"(",
... | When setting shortcode | [
"When",
"setting",
"shortcode"
] | train | https://github.com/ronaldborla/chikka/blob/446987706f81d5a0efbc8bd6b7d3b259d0527719/src/Borla/Chikka/Models/Config.php#L40-L50 |
zicht/z | src/Zicht/Tool/Util.php | Util.toPhp | public static function toPhp($var)
{
switch (gettype($var)) {
case 'array':
$skipKeys = (range(0, count($var) - 1) === array_keys($var));
$ret = 'array(';
$i = 0;
foreach ($var as $key => $value) {
if ($i++ > 0) ... | php | public static function toPhp($var)
{
switch (gettype($var)) {
case 'array':
$skipKeys = (range(0, count($var) - 1) === array_keys($var));
$ret = 'array(';
$i = 0;
foreach ($var as $key => $value) {
if ($i++ > 0) ... | [
"public",
"static",
"function",
"toPhp",
"(",
"$",
"var",
")",
"{",
"switch",
"(",
"gettype",
"(",
"$",
"var",
")",
")",
"{",
"case",
"'array'",
":",
"$",
"skipKeys",
"=",
"(",
"range",
"(",
"0",
",",
"count",
"(",
"$",
"var",
")",
"-",
"1",
")... | A wrapper for var_export, having list-style arrays (0-indexed incremental keys) compile without the keys in
the code.
@param mixed $var
@return string | [
"A",
"wrapper",
"for",
"var_export",
"having",
"list",
"-",
"style",
"arrays",
"(",
"0",
"-",
"indexed",
"incremental",
"keys",
")",
"compile",
"without",
"the",
"keys",
"in",
"the",
"code",
"."
] | train | https://github.com/zicht/z/blob/6a1731dad20b018555a96b726a61d4bf8ec8c886/src/Zicht/Tool/Util.php#L24-L46 |
InactiveProjects/limoncello-illuminate | app/Database/Models/Role.php | Role.getRoleId | public static function getRoleId($role)
{
$map = [
self::ENUM_ROLE_ADMIN => self::ENUM_ROLE_ADMIN_ID,
self::ENUM_ROLE_USER => self::ENUM_ROLE_USER_ID,
];
// do not check if key exist deliberately. If wrong role is given it will cause an error.
return $map[$r... | php | public static function getRoleId($role)
{
$map = [
self::ENUM_ROLE_ADMIN => self::ENUM_ROLE_ADMIN_ID,
self::ENUM_ROLE_USER => self::ENUM_ROLE_USER_ID,
];
// do not check if key exist deliberately. If wrong role is given it will cause an error.
return $map[$r... | [
"public",
"static",
"function",
"getRoleId",
"(",
"$",
"role",
")",
"{",
"$",
"map",
"=",
"[",
"self",
"::",
"ENUM_ROLE_ADMIN",
"=>",
"self",
"::",
"ENUM_ROLE_ADMIN_ID",
",",
"self",
"::",
"ENUM_ROLE_USER",
"=>",
"self",
"::",
"ENUM_ROLE_USER_ID",
",",
"]",
... | @param string $role
@return int | [
"@param",
"string",
"$role"
] | train | https://github.com/InactiveProjects/limoncello-illuminate/blob/cae6fc26190efcf090495a5c3582c10fa2430897/app/Database/Models/Role.php#L68-L77 |
tylernathanreed/flash | src/FlashServiceProvider.php | FlashServiceProvider.boot | public function boot()
{
$path = __DIR__ . '/../resources/views';
$this->loadViewsFrom($path, 'flash');
$this->publishes([
$path => base_path('resources/views/vendor/flash'),
], 'flash');
} | php | public function boot()
{
$path = __DIR__ . '/../resources/views';
$this->loadViewsFrom($path, 'flash');
$this->publishes([
$path => base_path('resources/views/vendor/flash'),
], 'flash');
} | [
"public",
"function",
"boot",
"(",
")",
"{",
"$",
"path",
"=",
"__DIR__",
".",
"'/../resources/views'",
";",
"$",
"this",
"->",
"loadViewsFrom",
"(",
"$",
"path",
",",
"'flash'",
")",
";",
"$",
"this",
"->",
"publishes",
"(",
"[",
"$",
"path",
"=>",
... | Perform post-registration booting of services.
@return void | [
"Perform",
"post",
"-",
"registration",
"booting",
"of",
"services",
"."
] | train | https://github.com/tylernathanreed/flash/blob/6ca4b361493e7e48e3c3cf6b1ed95f8a1b2b724c/src/FlashServiceProvider.php#L41-L50 |
inhere/php-librarys | src/Traits/FixedEventStaticTrait.php | FixedEventStaticTrait.fire | public static function fire($event, array $args = [])
{
if (!isset(self::$events[$event])) {
return false;
}
// call event handlers of the event.
foreach ((array)self::$eventHandlers[$event] as $cb) {
// return FALSE to stop go on handle.
if (fals... | php | public static function fire($event, array $args = [])
{
if (!isset(self::$events[$event])) {
return false;
}
// call event handlers of the event.
foreach ((array)self::$eventHandlers[$event] as $cb) {
// return FALSE to stop go on handle.
if (fals... | [
"public",
"static",
"function",
"fire",
"(",
"$",
"event",
",",
"array",
"$",
"args",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"events",
"[",
"$",
"event",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"// ca... | trigger event
@param $event
@param array $args
@return bool | [
"trigger",
"event"
] | train | https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/Traits/FixedEventStaticTrait.php#L74-L94 |
inhere/php-librarys | src/Traits/FixedEventStaticTrait.php | FixedEventStaticTrait.off | public static function off($event)
{
if (self::hasEvent($event)) {
unset(self::$events[$event], self::$eventHandlers[$event]);
return true;
}
return false;
} | php | public static function off($event)
{
if (self::hasEvent($event)) {
unset(self::$events[$event], self::$eventHandlers[$event]);
return true;
}
return false;
} | [
"public",
"static",
"function",
"off",
"(",
"$",
"event",
")",
"{",
"if",
"(",
"self",
"::",
"hasEvent",
"(",
"$",
"event",
")",
")",
"{",
"unset",
"(",
"self",
"::",
"$",
"events",
"[",
"$",
"event",
"]",
",",
"self",
"::",
"$",
"eventHandlers",
... | remove event and it's handlers
@param $event
@return bool | [
"remove",
"event",
"and",
"it",
"s",
"handlers"
] | train | https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/Traits/FixedEventStaticTrait.php#L101-L110 |
wplibs/rules | src/Operator/In.php | In.evaluate | public function evaluate( Context $context ) {
/**
* Extracts variables.
*
* @var \Ruler\Variable $left
* @var \Ruler\Variable $right
*/
list( $left, $right ) = $this->getOperands();
$left = $left->prepareValue( $context )->getValue();
$right = $right->prepareValue( $context )->getValue();
r... | php | public function evaluate( Context $context ) {
/**
* Extracts variables.
*
* @var \Ruler\Variable $left
* @var \Ruler\Variable $right
*/
list( $left, $right ) = $this->getOperands();
$left = $left->prepareValue( $context )->getValue();
$right = $right->prepareValue( $context )->getValue();
r... | [
"public",
"function",
"evaluate",
"(",
"Context",
"$",
"context",
")",
"{",
"/**\n\t\t * Extracts variables.\n\t\t *\n\t\t * @var \\Ruler\\Variable $left\n\t\t * @var \\Ruler\\Variable $right\n\t\t */",
"list",
"(",
"$",
"left",
",",
"$",
"right",
")",
"=",
"$",
"this",
"->... | Evaluate the operands.
@param Context $context Context with which to evaluate this Proposition.
@return boolean | [
"Evaluate",
"the",
"operands",
"."
] | train | https://github.com/wplibs/rules/blob/29b4495e2ae87349fd64fcd844f3ba96cc268e3d/src/Operator/In.php#L16-L29 |
zhouyl/mellivora | Mellivora/Config/Ini.php | Ini.parseIniString | protected function parseIniString($path, $value)
{
$value = $this->cast($value);
$pos = strpos($path, '.');
if ($pos === false) {
return [$path => $value];
}
$key = substr($path, 0, $pos);
$path = substr($path, $pos + 1);
return [$key => $thi... | php | protected function parseIniString($path, $value)
{
$value = $this->cast($value);
$pos = strpos($path, '.');
if ($pos === false) {
return [$path => $value];
}
$key = substr($path, 0, $pos);
$path = substr($path, $pos + 1);
return [$key => $thi... | [
"protected",
"function",
"parseIniString",
"(",
"$",
"path",
",",
"$",
"value",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"cast",
"(",
"$",
"value",
")",
";",
"$",
"pos",
"=",
"strpos",
"(",
"$",
"path",
",",
"'.'",
")",
";",
"if",
"(",
"... | 将 ini 的 . 分隔符构建的数据,解析为多维数组
<code>
$this->parseIniString("path.hello.world", "value for last key");
// result
[
"path" => [
"hello" => [
"world" => "value for last key",
],
],
];
</code>
@param mixed $path
@param mixed $value | [
"将",
"ini",
"的",
".",
"分隔符构建的数据,解析为多维数组"
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Config/Ini.php#L67-L80 |
zhouyl/mellivora | Mellivora/Config/Ini.php | Ini.cast | protected function cast($ini)
{
if (is_array($ini)) {
foreach ($ini as $key => $val) {
$ini[$key] = $this->cast($val);
}
}
if (is_string($ini)) {
if (in_array(strtolower($ini), ['true', 'yes', 'on'])) {
return true;
... | php | protected function cast($ini)
{
if (is_array($ini)) {
foreach ($ini as $key => $val) {
$ini[$key] = $this->cast($val);
}
}
if (is_string($ini)) {
if (in_array(strtolower($ini), ['true', 'yes', 'on'])) {
return true;
... | [
"protected",
"function",
"cast",
"(",
"$",
"ini",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"ini",
")",
")",
"{",
"foreach",
"(",
"$",
"ini",
"as",
"$",
"key",
"=>",
"$",
"val",
")",
"{",
"$",
"ini",
"[",
"$",
"key",
"]",
"=",
"$",
"this",
... | php 对 ini 的解释有不到位的地方,部分值转换需要手动处理
@param mixed $ini
@return mixed | [
"php",
"对",
"ini",
"的解释有不到位的地方,部分值转换需要手动处理"
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Config/Ini.php#L89-L117 |
SergioMadness/query-builder | src/adapters/MySQL/SelectBuilder.php | SelectBuilder.buildOrder | protected function buildOrder()
{
$result = '';
$orders = (array) $this->getOrder();
foreach ($orders as $field => $direction) {
if ($result != '') {
$result.=',';
}
$result.=$field.' '.($direction === SORT_DESC ? 'DESC' : 'ASC');
... | php | protected function buildOrder()
{
$result = '';
$orders = (array) $this->getOrder();
foreach ($orders as $field => $direction) {
if ($result != '') {
$result.=',';
}
$result.=$field.' '.($direction === SORT_DESC ? 'DESC' : 'ASC');
... | [
"protected",
"function",
"buildOrder",
"(",
")",
"{",
"$",
"result",
"=",
"''",
";",
"$",
"orders",
"=",
"(",
"array",
")",
"$",
"this",
"->",
"getOrder",
"(",
")",
";",
"foreach",
"(",
"$",
"orders",
"as",
"$",
"field",
"=>",
"$",
"direction",
")"... | Build order
@return string | [
"Build",
"order"
] | train | https://github.com/SergioMadness/query-builder/blob/95b7a46bba4c4d369101c6f0d37f133fecb3956d/src/adapters/MySQL/SelectBuilder.php#L172-L188 |
jetfirephp/http | src/Request.php | Request.isEmptyString | protected function isEmptyString($key)
{
$value = $this->input($key);
$boolOrArray = is_bool($value) || is_array($value);
return ! $boolOrArray && trim((string) $value) === '';
} | php | protected function isEmptyString($key)
{
$value = $this->input($key);
$boolOrArray = is_bool($value) || is_array($value);
return ! $boolOrArray && trim((string) $value) === '';
} | [
"protected",
"function",
"isEmptyString",
"(",
"$",
"key",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"input",
"(",
"$",
"key",
")",
";",
"$",
"boolOrArray",
"=",
"is_bool",
"(",
"$",
"value",
")",
"||",
"is_array",
"(",
"$",
"value",
")",
";"... | Determine if the given input key is an empty string for "has".
@param string $key
@return bool | [
"Determine",
"if",
"the",
"given",
"input",
"key",
"is",
"an",
"empty",
"string",
"for",
"has",
"."
] | train | https://github.com/jetfirephp/http/blob/b00cfd930edb48621d694cdb91fd1e931ad3f529/src/Request.php#L197-L202 |
jetfirephp/http | src/Request.php | Request.flash | public function flash($filter = null, $keys = [])
{
$flash = (! is_null($filter)) ? $this->$filter($keys) : $this->all();
$this->session()->getFlashBag()->set($flash);
} | php | public function flash($filter = null, $keys = [])
{
$flash = (! is_null($filter)) ? $this->$filter($keys) : $this->all();
$this->session()->getFlashBag()->set($flash);
} | [
"public",
"function",
"flash",
"(",
"$",
"filter",
"=",
"null",
",",
"$",
"keys",
"=",
"[",
"]",
")",
"{",
"$",
"flash",
"=",
"(",
"!",
"is_null",
"(",
"$",
"filter",
")",
")",
"?",
"$",
"this",
"->",
"$",
"filter",
"(",
"$",
"keys",
")",
":"... | Flash the input for the current request to the session.
@param string $filter
@param array $keys
@return void | [
"Flash",
"the",
"input",
"for",
"the",
"current",
"request",
"to",
"the",
"session",
"."
] | train | https://github.com/jetfirephp/http/blob/b00cfd930edb48621d694cdb91fd1e931ad3f529/src/Request.php#L314-L318 |
jetfirephp/http | src/Request.php | Request.json | public function json($key = null, $default = null)
{
if (! isset($this->json)) {
$this->json = new ParameterBag((array) json_decode($this->getContent(), true));
}
if (is_null($key)) {
return $this->json;
}
return $this->json->get($key,$default)... | php | public function json($key = null, $default = null)
{
if (! isset($this->json)) {
$this->json = new ParameterBag((array) json_decode($this->getContent(), true));
}
if (is_null($key)) {
return $this->json;
}
return $this->json->get($key,$default)... | [
"public",
"function",
"json",
"(",
"$",
"key",
"=",
"null",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"json",
")",
")",
"{",
"$",
"this",
"->",
"json",
"=",
"new",
"ParameterBag",
"(",
"(",
"ar... | Get the JSON payload for the request.
@param string $key
@param mixed $default
@return mixed | [
"Get",
"the",
"JSON",
"payload",
"for",
"the",
"request",
"."
] | train | https://github.com/jetfirephp/http/blob/b00cfd930edb48621d694cdb91fd1e931ad3f529/src/Request.php#L393-L402 |
jetfirephp/http | src/Request.php | Request.wantsJson | public function wantsJson()
{
$acceptable = $this->getAcceptableContentTypes();
return (isset($acceptable[0]) && (strpos($acceptable[0], '/json') !== false || strpos($acceptable[0], '+json') !== false));
} | php | public function wantsJson()
{
$acceptable = $this->getAcceptableContentTypes();
return (isset($acceptable[0]) && (strpos($acceptable[0], '/json') !== false || strpos($acceptable[0], '+json') !== false));
} | [
"public",
"function",
"wantsJson",
"(",
")",
"{",
"$",
"acceptable",
"=",
"$",
"this",
"->",
"getAcceptableContentTypes",
"(",
")",
";",
"return",
"(",
"isset",
"(",
"$",
"acceptable",
"[",
"0",
"]",
")",
"&&",
"(",
"strpos",
"(",
"$",
"acceptable",
"[... | Determine if the current request is asking for JSON in return.
@return bool | [
"Determine",
"if",
"the",
"current",
"request",
"is",
"asking",
"for",
"JSON",
"in",
"return",
"."
] | train | https://github.com/jetfirephp/http/blob/b00cfd930edb48621d694cdb91fd1e931ad3f529/src/Request.php#L447-L451 |
jetfirephp/http | src/Request.php | Request.input | public function input($key = null, $default = null)
{
$input = array_merge($this->getInputSource()->all(),$this->query->all());
return isset($input[$key])?$input[$key]:$default;
} | php | public function input($key = null, $default = null)
{
$input = array_merge($this->getInputSource()->all(),$this->query->all());
return isset($input[$key])?$input[$key]:$default;
} | [
"public",
"function",
"input",
"(",
"$",
"key",
"=",
"null",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"input",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"getInputSource",
"(",
")",
"->",
"all",
"(",
")",
",",
"$",
"this",
"->",
"query",
... | Retrieve an input item from the request.
@param string $key
@param string|array|null $default
@return string|array | [
"Retrieve",
"an",
"input",
"item",
"from",
"the",
"request",
"."
] | train | https://github.com/jetfirephp/http/blob/b00cfd930edb48621d694cdb91fd1e931ad3f529/src/Request.php#L519-L523 |
jetfirephp/http | src/Request.php | Request.except | public function except($keys)
{
$keys = is_array($keys) ? $keys : func_get_args();
$results = [];
$inputs = $this->all();
foreach ($inputs as $key => $input) {
if(!in_array($key,$keys))
$results[$key] = $input[$key];
}
return $resu... | php | public function except($keys)
{
$keys = is_array($keys) ? $keys : func_get_args();
$results = [];
$inputs = $this->all();
foreach ($inputs as $key => $input) {
if(!in_array($key,$keys))
$results[$key] = $input[$key];
}
return $resu... | [
"public",
"function",
"except",
"(",
"$",
"keys",
")",
"{",
"$",
"keys",
"=",
"is_array",
"(",
"$",
"keys",
")",
"?",
"$",
"keys",
":",
"func_get_args",
"(",
")",
";",
"$",
"results",
"=",
"[",
"]",
";",
"$",
"inputs",
"=",
"$",
"this",
"->",
"... | Get all of the input except for a specified array of items.
@param array|mixed $keys
@return array | [
"Get",
"all",
"of",
"the",
"input",
"except",
"for",
"a",
"specified",
"array",
"of",
"items",
"."
] | train | https://github.com/jetfirephp/http/blob/b00cfd930edb48621d694cdb91fd1e931ad3f529/src/Request.php#L546-L556 |
InactiveProjects/limoncello-illuminate | app/Database/Factories/CommentFactory.php | CommentFactory.getRandomPost | private function getRandomPost()
{
if ($this->posts === null) {
$this->posts = Post::all();
}
return $this->posts->random();
} | php | private function getRandomPost()
{
if ($this->posts === null) {
$this->posts = Post::all();
}
return $this->posts->random();
} | [
"private",
"function",
"getRandomPost",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"posts",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"posts",
"=",
"Post",
"::",
"all",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"posts",
"->",
"random",
... | @return Post
@SuppressWarnings(PHPMD.StaticAccess) | [
"@return",
"Post"
] | train | https://github.com/InactiveProjects/limoncello-illuminate/blob/cae6fc26190efcf090495a5c3582c10fa2430897/app/Database/Factories/CommentFactory.php#L37-L44 |
Root-XS/SudoBible | src/SudoBiblePassage.php | SudoBiblePassage.getReference | public function getReference($bAbbreviate = false)
{
$oFirstVerse = $this->getFirstVerse();
$oLastVerse = $this->getLastVerse();
// John 3
$strRef = ($bAbbreviate ? $oFirstVerse->book_abbr : $oFirstVerse->book_name)
. ' ' . $oFirstVerse->chapter;
if (!$this->isFullChapter()) {
// John 3:16
$strRe... | php | public function getReference($bAbbreviate = false)
{
$oFirstVerse = $this->getFirstVerse();
$oLastVerse = $this->getLastVerse();
// John 3
$strRef = ($bAbbreviate ? $oFirstVerse->book_abbr : $oFirstVerse->book_name)
. ' ' . $oFirstVerse->chapter;
if (!$this->isFullChapter()) {
// John 3:16
$strRe... | [
"public",
"function",
"getReference",
"(",
"$",
"bAbbreviate",
"=",
"false",
")",
"{",
"$",
"oFirstVerse",
"=",
"$",
"this",
"->",
"getFirstVerse",
"(",
")",
";",
"$",
"oLastVerse",
"=",
"$",
"this",
"->",
"getLastVerse",
"(",
")",
";",
"// John 3",
"$",... | Get the reference location, like "John 3:16"
@param bool $bAbbreviate Use the book's abbreviation instead of full name?
@return string | [
"Get",
"the",
"reference",
"location",
"like",
"John",
"3",
":",
"16"
] | train | https://github.com/Root-XS/SudoBible/blob/562462e92e1b2c019bdd48ed83414502ca0bdb0c/src/SudoBiblePassage.php#L165-L207 |
Root-XS/SudoBible | src/SudoBiblePassage.php | SudoBiblePassage.nextVerse | public function nextVerse()
{
if ($this->isEmpty())
throw new Exception(__METHOD__ . ': Can\'t find next - current passage is invalid.');
$oLastVerse = $this->getLastVerse();
return $this->oBible->nextVerse(
$oLastVerse->book_id,
$oLastVerse->chapter,
$oLastVerse->verse
);
} | php | public function nextVerse()
{
if ($this->isEmpty())
throw new Exception(__METHOD__ . ': Can\'t find next - current passage is invalid.');
$oLastVerse = $this->getLastVerse();
return $this->oBible->nextVerse(
$oLastVerse->book_id,
$oLastVerse->chapter,
$oLastVerse->verse
);
} | [
"public",
"function",
"nextVerse",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isEmpty",
"(",
")",
")",
"throw",
"new",
"Exception",
"(",
"__METHOD__",
".",
"': Can\\'t find next - current passage is invalid.'",
")",
";",
"$",
"oLastVerse",
"=",
"$",
"this",... | Return the next Bible verse after the current passage.
@return SudoBiblePassage | [
"Return",
"the",
"next",
"Bible",
"verse",
"after",
"the",
"current",
"passage",
"."
] | train | https://github.com/Root-XS/SudoBible/blob/562462e92e1b2c019bdd48ed83414502ca0bdb0c/src/SudoBiblePassage.php#L214-L225 |
gruzilla/hydra | src/Hydra/Workers/MappedSerialWorker.php | MappedSerialWorker.run | public function run(JobInterface $job)
{
parent::run($job);
if (!($job instanceof MappedJob)) {
return $this;
}
$job->setResult(
$this->mapper->map(
$job->getEntityRepository(),
$job->getMappedClass(),
$job->g... | php | public function run(JobInterface $job)
{
parent::run($job);
if (!($job instanceof MappedJob)) {
return $this;
}
$job->setResult(
$this->mapper->map(
$job->getEntityRepository(),
$job->getMappedClass(),
$job->g... | [
"public",
"function",
"run",
"(",
"JobInterface",
"$",
"job",
")",
"{",
"parent",
"::",
"run",
"(",
"$",
"job",
")",
";",
"if",
"(",
"!",
"(",
"$",
"job",
"instanceof",
"MappedJob",
")",
")",
"{",
"return",
"$",
"this",
";",
"}",
"$",
"job",
"->"... | runs the parent job and then maps the result
@param JobInterface $job the job to execute
@return self | [
"runs",
"the",
"parent",
"job",
"and",
"then",
"maps",
"the",
"result"
] | train | https://github.com/gruzilla/hydra/blob/47f381cc48e1a26bfe2e211d8dcb54c787ea0478/src/Hydra/Workers/MappedSerialWorker.php#L28-L47 |
heidelpay/PhpDoc | src/phpDocumentor/Plugin/Scrybe/Converter/RestructuredText/ToHtml.php | ToHtml.discover | protected function discover()
{
/** @var File $file */
foreach ($this->fileset as $file) {
$rst = new Document($this, $file);
$rst->options->xhtmlVisitor = 'phpDocumentor\Plugin\Scrybe\Converter\RestructuredText\Visitors\Discover';
if ($this->getLogger()) {
... | php | protected function discover()
{
/** @var File $file */
foreach ($this->fileset as $file) {
$rst = new Document($this, $file);
$rst->options->xhtmlVisitor = 'phpDocumentor\Plugin\Scrybe\Converter\RestructuredText\Visitors\Discover';
if ($this->getLogger()) {
... | [
"protected",
"function",
"discover",
"(",
")",
"{",
"/** @var File $file */",
"foreach",
"(",
"$",
"this",
"->",
"fileset",
"as",
"$",
"file",
")",
"{",
"$",
"rst",
"=",
"new",
"Document",
"(",
"$",
"this",
",",
"$",
"file",
")",
";",
"$",
"rst",
"->... | Discovers the data that is spanning all files.
This method tries to find any data that needs to be collected before the actual creation and substitution
phase begins.
Examples of data that needs to be collected during an initial phase is a table of contents, list of document
titles for references, assets and more.
@... | [
"Discovers",
"the",
"data",
"that",
"is",
"spanning",
"all",
"files",
"."
] | train | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Plugin/Scrybe/Converter/RestructuredText/ToHtml.php#L42-L59 |
heidelpay/PhpDoc | src/phpDocumentor/Plugin/Scrybe/Converter/RestructuredText/ToHtml.php | ToHtml.create | protected function create(TemplateInterface $template)
{
$result = array();
/** @var File $file */
foreach ($this->fileset as $file) {
$rst = new Document($this, $file);
$destination = $this->getDestinationFilenameRelativeToProjectRoot($file);
$this->setD... | php | protected function create(TemplateInterface $template)
{
$result = array();
/** @var File $file */
foreach ($this->fileset as $file) {
$rst = new Document($this, $file);
$destination = $this->getDestinationFilenameRelativeToProjectRoot($file);
$this->setD... | [
"protected",
"function",
"create",
"(",
"TemplateInterface",
"$",
"template",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"/** @var File $file */",
"foreach",
"(",
"$",
"this",
"->",
"fileset",
"as",
"$",
"file",
")",
"{",
"$",
"rst",
"=",
"new... | Converts the input files into one or more output files in the intended format.
This method reads the files, converts them into the correct format and returns the contents of the conversion.
The template is provided using the $template parameter and is used to decorate the individual files. It can be
obtained using th... | [
"Converts",
"the",
"input",
"files",
"into",
"one",
"or",
"more",
"output",
"files",
"in",
"the",
"intended",
"format",
"."
] | train | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Plugin/Scrybe/Converter/RestructuredText/ToHtml.php#L75-L102 |
heidelpay/PhpDoc | src/phpDocumentor/Plugin/Scrybe/Converter/RestructuredText/ToHtml.php | ToHtml.setDestinationRoot | protected function setDestinationRoot($destination)
{
$this->options['root'] = dirname($destination) != '.'
? implode('/', array_fill(0, count(explode('/', dirname($destination))), '..')) . '/'
: './';
} | php | protected function setDestinationRoot($destination)
{
$this->options['root'] = dirname($destination) != '.'
? implode('/', array_fill(0, count(explode('/', dirname($destination))), '..')) . '/'
: './';
} | [
"protected",
"function",
"setDestinationRoot",
"(",
"$",
"destination",
")",
"{",
"$",
"this",
"->",
"options",
"[",
"'root'",
"]",
"=",
"dirname",
"(",
"$",
"destination",
")",
"!=",
"'.'",
"?",
"implode",
"(",
"'/'",
",",
"array_fill",
"(",
"0",
",",
... | Sets the relative path to the root of the generated contents.
Basically this method takes the depth of the given destination and replaces it with `..` unless the destination
directory name is `.`.
@param string $destination The destination path relative to the target folder.
@see $options for where the 'root' variab... | [
"Sets",
"the",
"relative",
"path",
"to",
"the",
"root",
"of",
"the",
"generated",
"contents",
"."
] | train | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Plugin/Scrybe/Converter/RestructuredText/ToHtml.php#L116-L121 |
interactivesolutions/honeycomb-core | src/providers/HCRollbarServiceProvider.php | HCRollbarServiceProvider.boot | public function boot()
{
$app = $this->app;
// Listen to log messages.
$app['log']->listen(function ($level, $message, $context) use ($app) {
$app['rollbar.handler']->log($level, $message, $context);
});
} | php | public function boot()
{
$app = $this->app;
// Listen to log messages.
$app['log']->listen(function ($level, $message, $context) use ($app) {
$app['rollbar.handler']->log($level, $message, $context);
});
} | [
"public",
"function",
"boot",
"(",
")",
"{",
"$",
"app",
"=",
"$",
"this",
"->",
"app",
";",
"// Listen to log messages.",
"$",
"app",
"[",
"'log'",
"]",
"->",
"listen",
"(",
"function",
"(",
"$",
"level",
",",
"$",
"message",
",",
"$",
"context",
")... | Bootstrap the application events.
@return void | [
"Bootstrap",
"the",
"application",
"events",
"."
] | train | https://github.com/interactivesolutions/honeycomb-core/blob/06b8d88bb285e73a1a286e60411ca5f41863f39f/src/providers/HCRollbarServiceProvider.php#L23-L31 |
interactivesolutions/honeycomb-core | src/providers/HCRollbarServiceProvider.php | HCRollbarServiceProvider.register | public function register()
{
$app = $this->app;
$this->app['rollbar.client'] = $this->app->share(function ($app) {
$config = $app['config']->get('services.rollbar');
Rollbar::$instance = $rollbar = new RollbarNotifier($config);
return $rollbar;
});
... | php | public function register()
{
$app = $this->app;
$this->app['rollbar.client'] = $this->app->share(function ($app) {
$config = $app['config']->get('services.rollbar');
Rollbar::$instance = $rollbar = new RollbarNotifier($config);
return $rollbar;
});
... | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"app",
"=",
"$",
"this",
"->",
"app",
";",
"$",
"this",
"->",
"app",
"[",
"'rollbar.client'",
"]",
"=",
"$",
"this",
"->",
"app",
"->",
"share",
"(",
"function",
"(",
"$",
"app",
")",
"{",
"$"... | Register the service provider.
@return void | [
"Register",
"the",
"service",
"provider",
"."
] | train | https://github.com/interactivesolutions/honeycomb-core/blob/06b8d88bb285e73a1a286e60411ca5f41863f39f/src/providers/HCRollbarServiceProvider.php#L38-L75 |
interactivesolutions/honeycomb-core | src/models/traits/Encryptable.php | Encryptable.setAttribute | public function setAttribute(string $key, string $value)
{
if ($this->valid($key, $value)) {
$value = encrypt($value);
}
return parent::setAttribute($key, $value);
} | php | public function setAttribute(string $key, string $value)
{
if ($this->valid($key, $value)) {
$value = encrypt($value);
}
return parent::setAttribute($key, $value);
} | [
"public",
"function",
"setAttribute",
"(",
"string",
"$",
"key",
",",
"string",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"valid",
"(",
"$",
"key",
",",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"encrypt",
"(",
"$",
"value",
")"... | Encrypt field value before inserting into database
@param string $key
@param string $value
@return mixed | [
"Encrypt",
"field",
"value",
"before",
"inserting",
"into",
"database"
] | train | https://github.com/interactivesolutions/honeycomb-core/blob/06b8d88bb285e73a1a286e60411ca5f41863f39f/src/models/traits/Encryptable.php#L21-L28 |
interactivesolutions/honeycomb-core | src/models/traits/Encryptable.php | Encryptable.getAttribute | public function getAttribute(string $key)
{
$value = parent::getAttribute($key);
if ($this->valid($key, $value)) {
return decrypt($value);
}
return $value;
} | php | public function getAttribute(string $key)
{
$value = parent::getAttribute($key);
if ($this->valid($key, $value)) {
return decrypt($value);
}
return $value;
} | [
"public",
"function",
"getAttribute",
"(",
"string",
"$",
"key",
")",
"{",
"$",
"value",
"=",
"parent",
"::",
"getAttribute",
"(",
"$",
"key",
")",
";",
"if",
"(",
"$",
"this",
"->",
"valid",
"(",
"$",
"key",
",",
"$",
"value",
")",
")",
"{",
"re... | Get decrypted field values after getting from database
@param string $key
@return mixed | [
"Get",
"decrypted",
"field",
"values",
"after",
"getting",
"from",
"database"
] | train | https://github.com/interactivesolutions/honeycomb-core/blob/06b8d88bb285e73a1a286e60411ca5f41863f39f/src/models/traits/Encryptable.php#L36-L45 |
interactivesolutions/honeycomb-core | src/models/traits/Encryptable.php | Encryptable.attributesToArray | public function attributesToArray()
{
$attributes = parent::attributesToArray();
foreach ($attributes as $key => $value) {
if ($this->valid($key, $value)) {
$attributes[$key] = decrypt($value);
}
}
return $attributes;
} | php | public function attributesToArray()
{
$attributes = parent::attributesToArray();
foreach ($attributes as $key => $value) {
if ($this->valid($key, $value)) {
$attributes[$key] = decrypt($value);
}
}
return $attributes;
} | [
"public",
"function",
"attributesToArray",
"(",
")",
"{",
"$",
"attributes",
"=",
"parent",
"::",
"attributesToArray",
"(",
")",
";",
"foreach",
"(",
"$",
"attributes",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"vali... | Decrypt given attributes
@return mixed | [
"Decrypt",
"given",
"attributes"
] | train | https://github.com/interactivesolutions/honeycomb-core/blob/06b8d88bb285e73a1a286e60411ca5f41863f39f/src/models/traits/Encryptable.php#L52-L63 |
interactivesolutions/honeycomb-core | src/models/traits/Encryptable.php | Encryptable.valid | protected function valid(string $key, string $value)
{
return in_array($key, $this->encryptable) && !is_null($value) && !empty($value);
} | php | protected function valid(string $key, string $value)
{
return in_array($key, $this->encryptable) && !is_null($value) && !empty($value);
} | [
"protected",
"function",
"valid",
"(",
"string",
"$",
"key",
",",
"string",
"$",
"value",
")",
"{",
"return",
"in_array",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"encryptable",
")",
"&&",
"!",
"is_null",
"(",
"$",
"value",
")",
"&&",
"!",
"empty",
... | Check if key and value is valid and able to crypt or decrypt
@param string $key
@param string $value
@return bool | [
"Check",
"if",
"key",
"and",
"value",
"is",
"valid",
"and",
"able",
"to",
"crypt",
"or",
"decrypt"
] | train | https://github.com/interactivesolutions/honeycomb-core/blob/06b8d88bb285e73a1a286e60411ca5f41863f39f/src/models/traits/Encryptable.php#L72-L75 |
expectation-php/expect | src/Expect.php | Expect.configure | public static function configure(Configurator $configurator = null)
{
$useConfigurator = $configurator;
if ($useConfigurator === null) {
$useConfigurator = new DefaultConfigurator();
}
self::$contextFactory = $useConfigurator->configure();
} | php | public static function configure(Configurator $configurator = null)
{
$useConfigurator = $configurator;
if ($useConfigurator === null) {
$useConfigurator = new DefaultConfigurator();
}
self::$contextFactory = $useConfigurator->configure();
} | [
"public",
"static",
"function",
"configure",
"(",
"Configurator",
"$",
"configurator",
"=",
"null",
")",
"{",
"$",
"useConfigurator",
"=",
"$",
"configurator",
";",
"if",
"(",
"$",
"useConfigurator",
"===",
"null",
")",
"{",
"$",
"useConfigurator",
"=",
"new... | {@inheritdoc} | [
"{"
] | train | https://github.com/expectation-php/expect/blob/1a32c5af37f3dc8dabe4e8eedeeb21aea16ce139/src/Expect.php#L31-L39 |
hametuha/wpametu | src/WPametu/Utility/CronBase.php | CronBase.register_cron | public function register_cron() {
if ( ! wp_next_scheduled( $this->event ) ) {
wp_schedule_event( $this->start_at(), $this->schedule, $this->event, $this->args() );
}
add_action( $this->event, [ $this, 'process' ] );
} | php | public function register_cron() {
if ( ! wp_next_scheduled( $this->event ) ) {
wp_schedule_event( $this->start_at(), $this->schedule, $this->event, $this->args() );
}
add_action( $this->event, [ $this, 'process' ] );
} | [
"public",
"function",
"register_cron",
"(",
")",
"{",
"if",
"(",
"!",
"wp_next_scheduled",
"(",
"$",
"this",
"->",
"event",
")",
")",
"{",
"wp_schedule_event",
"(",
"$",
"this",
"->",
"start_at",
"(",
")",
",",
"$",
"this",
"->",
"schedule",
",",
"$",
... | Register cron event | [
"Register",
"cron",
"event"
] | train | https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/Utility/CronBase.php#L63-L68 |
php-lug/lug | src/Bundle/GridBundle/Form/Type/Filter/AbstractFilterType.php | AbstractFilterType.configureOptions | public function configureOptions(OptionsResolver $resolver)
{
$resolver
->setDefaults([
'label' => function (Options $options) {
return $options['filter']->getLabel();
},
'label_prefix' => function (Options $options) {
... | php | public function configureOptions(OptionsResolver $resolver)
{
$resolver
->setDefaults([
'label' => function (Options $options) {
return $options['filter']->getLabel();
},
'label_prefix' => function (Options $options) {
... | [
"public",
"function",
"configureOptions",
"(",
"OptionsResolver",
"$",
"resolver",
")",
"{",
"$",
"resolver",
"->",
"setDefaults",
"(",
"[",
"'label'",
"=>",
"function",
"(",
"Options",
"$",
"options",
")",
"{",
"return",
"$",
"options",
"[",
"'filter'",
"]"... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Bundle/GridBundle/Form/Type/Filter/AbstractFilterType.php#L27-L40 |
stk2k/net-driver | src/Util/CharsetUtil.php | CharsetUtil.convertEncoding | public static function convertEncoding( $str, $html_charset, $to_encoding = 'UTF-8' )
{
if (empty($html_charset)){
return $str;
}
$php_encoding = self::getPhpEncoding($html_charset);
$from_encoding = $php_encoding ? $php_encoding : 'auto';
$str = ( $from_encodin... | php | public static function convertEncoding( $str, $html_charset, $to_encoding = 'UTF-8' )
{
if (empty($html_charset)){
return $str;
}
$php_encoding = self::getPhpEncoding($html_charset);
$from_encoding = $php_encoding ? $php_encoding : 'auto';
$str = ( $from_encodin... | [
"public",
"static",
"function",
"convertEncoding",
"(",
"$",
"str",
",",
"$",
"html_charset",
",",
"$",
"to_encoding",
"=",
"'UTF-8'",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"html_charset",
")",
")",
"{",
"return",
"$",
"str",
";",
"}",
"$",
"php_enco... | Convert encoding
@param string $str
@param string $html_charset
@param string $to_encoding
@return string | [
"Convert",
"encoding"
] | train | https://github.com/stk2k/net-driver/blob/75e0bc1a95ba430dd9ed9e69f6a0a5dd8f2e7b1c/src/Util/CharsetUtil.php#L13-L25 |
stk2k/net-driver | src/Util/CharsetUtil.php | CharsetUtil.detectCharset | public static function detectCharset( $body, $content_type, $default_charset )
{
// get character encoding from Content-Type header
preg_match( '@([\w/+]+)(;\s+charset=(\S+))?@i', $content_type, $matches );
$charset = isset($matches[3]) ? $matches[3] : $default_charset;
$php_encodin... | php | public static function detectCharset( $body, $content_type, $default_charset )
{
// get character encoding from Content-Type header
preg_match( '@([\w/+]+)(;\s+charset=(\S+))?@i', $content_type, $matches );
$charset = isset($matches[3]) ? $matches[3] : $default_charset;
$php_encodin... | [
"public",
"static",
"function",
"detectCharset",
"(",
"$",
"body",
",",
"$",
"content_type",
",",
"$",
"default_charset",
")",
"{",
"// get character encoding from Content-Type header",
"preg_match",
"(",
"'@([\\w/+]+)(;\\s+charset=(\\S+))?@i'",
",",
"$",
"content_type",
... | detect charset
@param string $body
@param string $content_type
@param string $default_charset
@return string | [
"detect",
"charset"
] | train | https://github.com/stk2k/net-driver/blob/75e0bc1a95ba430dd9ed9e69f6a0a5dd8f2e7b1c/src/Util/CharsetUtil.php#L36-L78 |
stk2k/net-driver | src/Util/CharsetUtil.php | CharsetUtil.getPhpEncoding | private static function getPhpEncoding( $html_charset )
{
$php_encoding = null;
switch( strtolower($html_charset) ){
case 'sjis':
case 'sjis-win':
case 'shift_jis':
case 'shift-jis':
case 'ms_kanji':
case 'csshiftjis':
... | php | private static function getPhpEncoding( $html_charset )
{
$php_encoding = null;
switch( strtolower($html_charset) ){
case 'sjis':
case 'sjis-win':
case 'shift_jis':
case 'shift-jis':
case 'ms_kanji':
case 'csshiftjis':
... | [
"private",
"static",
"function",
"getPhpEncoding",
"(",
"$",
"html_charset",
")",
"{",
"$",
"php_encoding",
"=",
"null",
";",
"switch",
"(",
"strtolower",
"(",
"$",
"html_charset",
")",
")",
"{",
"case",
"'sjis'",
":",
"case",
"'sjis-win'",
":",
"case",
"'... | Get PHP character encoding
@param $html_charset
@return string | [
"Get",
"PHP",
"character",
"encoding"
] | train | https://github.com/stk2k/net-driver/blob/75e0bc1a95ba430dd9ed9e69f6a0a5dd8f2e7b1c/src/Util/CharsetUtil.php#L87-L132 |
jasny/controller | src/Controller/CheckRequest.php | CheckRequest.getLocalReferer | public function getLocalReferer()
{
$request = $this->getRequest();
$referer = $request->getHeaderLine('HTTP_REFERER');
$host = $request->getHeaderLine('HTTP_HOST');
return $referer && parse_url($referer, PHP_URL_HOST) === $host ? $referer : '';
} | php | public function getLocalReferer()
{
$request = $this->getRequest();
$referer = $request->getHeaderLine('HTTP_REFERER');
$host = $request->getHeaderLine('HTTP_HOST');
return $referer && parse_url($referer, PHP_URL_HOST) === $host ? $referer : '';
} | [
"public",
"function",
"getLocalReferer",
"(",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
";",
"$",
"referer",
"=",
"$",
"request",
"->",
"getHeaderLine",
"(",
"'HTTP_REFERER'",
")",
";",
"$",
"host",
"=",
"$",
"request",
... | Returns the HTTP referer if it is on the current host
@return string | [
"Returns",
"the",
"HTTP",
"referer",
"if",
"it",
"is",
"on",
"the",
"current",
"host"
] | train | https://github.com/jasny/controller/blob/28edf64343f1d8218c166c0c570128e1ee6153d8/src/Controller/CheckRequest.php#L78-L85 |
endorphin-studio/browser-detector-data | src/Storage/YamlStorage.php | YamlStorage.getConfig | public function getConfig(): array
{
if (empty($this->config)) {
$yamlParser = new Parser();
$files = $this->getFileNames();
$config = [];
foreach ($files as $file) {
$fileConfig = $yamlParser->parseFile($file);
$config = \array... | php | public function getConfig(): array
{
if (empty($this->config)) {
$yamlParser = new Parser();
$files = $this->getFileNames();
$config = [];
foreach ($files as $file) {
$fileConfig = $yamlParser->parseFile($file);
$config = \array... | [
"public",
"function",
"getConfig",
"(",
")",
":",
"array",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"config",
")",
")",
"{",
"$",
"yamlParser",
"=",
"new",
"Parser",
"(",
")",
";",
"$",
"files",
"=",
"$",
"this",
"->",
"getFileNames",
"(",
... | Get array of Data (patterns and etc.)
@return array array of data | [
"Get",
"array",
"of",
"Data",
"(",
"patterns",
"and",
"etc",
".",
")"
] | train | https://github.com/endorphin-studio/browser-detector-data/blob/cb1ace9f52f9677616c89f3b80c5148936d47b82/src/Storage/YamlStorage.php#L27-L40 |
yawik/composer-plugin | src/Plugin.php | Plugin.getApplication | public function getApplication()
{
if (!is_object($this->application)) {
$this->application = Application::init();
}
return $this->application;
} | php | public function getApplication()
{
if (!is_object($this->application)) {
$this->application = Application::init();
}
return $this->application;
} | [
"public",
"function",
"getApplication",
"(",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"this",
"->",
"application",
")",
")",
"{",
"$",
"this",
"->",
"application",
"=",
"Application",
"::",
"init",
"(",
")",
";",
"}",
"return",
"$",
"this",
"... | Get Yawik Application to use
@return Application|\Zend\Mvc\Application | [
"Get",
"Yawik",
"Application",
"to",
"use"
] | train | https://github.com/yawik/composer-plugin/blob/d3a45d2ab342fc0eb21e1126e8637fb7752464e4/src/Plugin.php#L127-L133 |
shabbyrobe/amiss | src/Sql/Query/Criteria.php | Criteria.setParams | public function setParams(array $args)
{
// the class name / meta has already been eaten from the args by this point
if (!isset($args[1]) && is_array($args[0])) {
// Array criteria: func(..., ['where'=>'', 'params'=>'']);
$this->populate($args[0]);
}
elseif (!is... | php | public function setParams(array $args)
{
// the class name / meta has already been eaten from the args by this point
if (!isset($args[1]) && is_array($args[0])) {
// Array criteria: func(..., ['where'=>'', 'params'=>'']);
$this->populate($args[0]);
}
elseif (!is... | [
"public",
"function",
"setParams",
"(",
"array",
"$",
"args",
")",
"{",
"// the class name / meta has already been eaten from the args by this point",
"if",
"(",
"!",
"isset",
"(",
"$",
"args",
"[",
"1",
"]",
")",
"&&",
"is_array",
"(",
"$",
"args",
"[",
"0",
... | Allows functions to have different query syntaxes:
func(..., 'pants=? AND foo=?', ['pants', 'foo'])
func(..., 'pants=:pants AND foo=:foo', array('pants'=>'pants', 'foo'=>'foo'))
func(..., array('where'=>'pants=:pants AND foo=:foo', 'params'=>array('pants'=>'pants', 'foo'=>'foo'))) | [
"Allows",
"functions",
"to",
"have",
"different",
"query",
"syntaxes",
":",
"func",
"(",
"...",
"pants",
"=",
"?",
"AND",
"foo",
"=",
"?",
"[",
"pants",
"foo",
"]",
")",
"func",
"(",
"...",
"pants",
"=",
":",
"pants",
"AND",
"foo",
"=",
":",
"foo",... | train | https://github.com/shabbyrobe/amiss/blob/ba261f0d1f985ed36e9fd2903ac0df86c5b9498d/src/Sql/Query/Criteria.php#L37-L60 |
fortis/silex-graphite | src/Graphite/Silex/Provider/GraphiteServiceProvider.php | GraphiteServiceProvider.register | public function register(Container $app)
{
$app['graphite'] = function (Application $app) {
$client = new GraphiteClient($app['graphite.options']);
return $client;
};
} | php | public function register(Container $app)
{
$app['graphite'] = function (Application $app) {
$client = new GraphiteClient($app['graphite.options']);
return $client;
};
} | [
"public",
"function",
"register",
"(",
"Container",
"$",
"app",
")",
"{",
"$",
"app",
"[",
"'graphite'",
"]",
"=",
"function",
"(",
"Application",
"$",
"app",
")",
"{",
"$",
"client",
"=",
"new",
"GraphiteClient",
"(",
"$",
"app",
"[",
"'graphite.options... | {@inheritdoc} | [
"{"
] | train | https://github.com/fortis/silex-graphite/blob/1faf4b53531c62d19b281b736a1dda326e127c7f/src/Graphite/Silex/Provider/GraphiteServiceProvider.php#L22-L28 |
vaibhavpandeyvpz/sandesh | src/Stream.php | Stream.getMetadata | public function getMetadata($key = null)
{
$metadata = stream_get_meta_data($this->resource);
if ($key) {
$metadata = isset($metadata[$key]) ? $metadata[$key] : null;
}
return $metadata;
} | php | public function getMetadata($key = null)
{
$metadata = stream_get_meta_data($this->resource);
if ($key) {
$metadata = isset($metadata[$key]) ? $metadata[$key] : null;
}
return $metadata;
} | [
"public",
"function",
"getMetadata",
"(",
"$",
"key",
"=",
"null",
")",
"{",
"$",
"metadata",
"=",
"stream_get_meta_data",
"(",
"$",
"this",
"->",
"resource",
")",
";",
"if",
"(",
"$",
"key",
")",
"{",
"$",
"metadata",
"=",
"isset",
"(",
"$",
"metada... | {@inheritdoc} | [
"{"
] | train | https://github.com/vaibhavpandeyvpz/sandesh/blob/bea2d06c7cac099ed82da973c922859de4158de0/src/Stream.php#L113-L120 |
vaibhavpandeyvpz/sandesh | src/Stream.php | Stream.getSize | public function getSize()
{
$stats = fstat($this->resource);
return isset($stats['size']) ? (int)$stats['size'] : null;
} | php | public function getSize()
{
$stats = fstat($this->resource);
return isset($stats['size']) ? (int)$stats['size'] : null;
} | [
"public",
"function",
"getSize",
"(",
")",
"{",
"$",
"stats",
"=",
"fstat",
"(",
"$",
"this",
"->",
"resource",
")",
";",
"return",
"isset",
"(",
"$",
"stats",
"[",
"'size'",
"]",
")",
"?",
"(",
"int",
")",
"$",
"stats",
"[",
"'size'",
"]",
":",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/vaibhavpandeyvpz/sandesh/blob/bea2d06c7cac099ed82da973c922859de4158de0/src/Stream.php#L125-L129 |
vaibhavpandeyvpz/sandesh | src/Stream.php | Stream.isReadable | public function isReadable()
{
if (!isset($this->resource)) {
return false;
}
$mode = $this->getMetadata('mode');
return strstr($mode, 'r') || strstr($mode, '+');
} | php | public function isReadable()
{
if (!isset($this->resource)) {
return false;
}
$mode = $this->getMetadata('mode');
return strstr($mode, 'r') || strstr($mode, '+');
} | [
"public",
"function",
"isReadable",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"resource",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"mode",
"=",
"$",
"this",
"->",
"getMetadata",
"(",
"'mode'",
")",
";",
"return",
"strs... | {@inheritdoc} | [
"{"
] | train | https://github.com/vaibhavpandeyvpz/sandesh/blob/bea2d06c7cac099ed82da973c922859de4158de0/src/Stream.php#L134-L141 |
vaibhavpandeyvpz/sandesh | src/Stream.php | Stream.isWritable | public function isWritable()
{
if (!isset($this->resource)) {
return false;
}
$mode = $this->getMetadata('mode');
return strstr($mode, 'x')
|| strstr($mode, 'w')
|| strstr($mode, 'c')
|| strstr($mode, 'a')
|| strstr($mode, '... | php | public function isWritable()
{
if (!isset($this->resource)) {
return false;
}
$mode = $this->getMetadata('mode');
return strstr($mode, 'x')
|| strstr($mode, 'w')
|| strstr($mode, 'c')
|| strstr($mode, 'a')
|| strstr($mode, '... | [
"public",
"function",
"isWritable",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"resource",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"mode",
"=",
"$",
"this",
"->",
"getMetadata",
"(",
"'mode'",
")",
";",
"return",
"strs... | {@inheritdoc} | [
"{"
] | train | https://github.com/vaibhavpandeyvpz/sandesh/blob/bea2d06c7cac099ed82da973c922859de4158de0/src/Stream.php#L157-L168 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.