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 |
|---|---|---|---|---|---|---|---|---|---|---|
jukylin/jaeger-php | src/Jaeger/Span.php | Span.addBaggageItem | public function addBaggageItem($key, $value){
$this->log([
'event' => 'baggage',
'key' => $key,
'value' => $value,
]);
return $this->spanContext->withBaggageItem($key, $value);
} | php | public function addBaggageItem($key, $value){
$this->log([
'event' => 'baggage',
'key' => $key,
'value' => $value,
]);
return $this->spanContext->withBaggageItem($key, $value);
} | [
"public",
"function",
"addBaggageItem",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"[",
"'event'",
"=>",
"'baggage'",
",",
"'key'",
"=>",
"$",
"key",
",",
"'value'",
"=>",
"$",
"value",
",",
"]",
")",
";",
"return"... | Adds a baggage item to the SpanContext which is immutable so it is required to use SpanContext::withBaggageItem
to get a new one.
@param string $key
@param string $value
@throws SpanAlreadyFinished if the span is already finished | [
"Adds",
"a",
"baggage",
"item",
"to",
"the",
"SpanContext",
"which",
"is",
"immutable",
"so",
"it",
"is",
"required",
"to",
"use",
"SpanContext",
"::",
"withBaggageItem",
"to",
"get",
"a",
"new",
"one",
"."
] | train | https://github.com/jukylin/jaeger-php/blob/ec503218121d87db26dfd0aa350895fd732de38a/src/Jaeger/Span.php#L99-L106 |
jukylin/jaeger-php | src/Jaeger/Config.php | Config.initTrace | public function initTrace($serverName, $agentHostPort = ''){
if(self::$disabled){
return NoopTracer::create();
}
if($serverName == ''){
throw new \Exception("serverName require");
}
if(isset(self::$tracer[$serverName]) && !empty(self::$tracer[$serverNam... | php | public function initTrace($serverName, $agentHostPort = ''){
if(self::$disabled){
return NoopTracer::create();
}
if($serverName == ''){
throw new \Exception("serverName require");
}
if(isset(self::$tracer[$serverName]) && !empty(self::$tracer[$serverNam... | [
"public",
"function",
"initTrace",
"(",
"$",
"serverName",
",",
"$",
"agentHostPort",
"=",
"''",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"disabled",
")",
"{",
"return",
"NoopTracer",
"::",
"create",
"(",
")",
";",
"}",
"if",
"(",
"$",
"serverName",
"... | init jaeger and set GlobalTracer, return can use flush buffers
@param $serviceName
@param string $agentHostPort
@return Jaeger|null
@throws \Exception | [
"init",
"jaeger",
"and",
"set",
"GlobalTracer",
"return",
"can",
"use",
"flush",
"buffers"
] | train | https://github.com/jukylin/jaeger-php/blob/ec503218121d87db26dfd0aa350895fd732de38a/src/Jaeger/Config.php#L64-L109 |
jukylin/jaeger-php | src/Jaeger/Transport/TransportUdp.php | TransportUdp.append | public function append(Jaeger $jaeger){
if($jaeger->process == null){
$this->buildAndCalcSizeOfProcessThrift($jaeger);
}
foreach($jaeger->spans as $span){
$spanThrift = (new JaegerThriftSpan())->buildJaegerSpanThrift($span);
$agentSpan = Span::getInstance(... | php | public function append(Jaeger $jaeger){
if($jaeger->process == null){
$this->buildAndCalcSizeOfProcessThrift($jaeger);
}
foreach($jaeger->spans as $span){
$spanThrift = (new JaegerThriftSpan())->buildJaegerSpanThrift($span);
$agentSpan = Span::getInstance(... | [
"public",
"function",
"append",
"(",
"Jaeger",
"$",
"jaeger",
")",
"{",
"if",
"(",
"$",
"jaeger",
"->",
"process",
"==",
"null",
")",
"{",
"$",
"this",
"->",
"buildAndCalcSizeOfProcessThrift",
"(",
"$",
"jaeger",
")",
";",
"}",
"foreach",
"(",
"$",
"ja... | 收集将要发送的追踪信息
@param Jaeger $jaeger
@return bool | [
"收集将要发送的追踪信息"
] | train | https://github.com/jukylin/jaeger-php/blob/ec503218121d87db26dfd0aa350895fd732de38a/src/Jaeger/Transport/TransportUdp.php#L65-L101 |
jukylin/jaeger-php | src/Jaeger/Transport/TransportUdp.php | TransportUdp.getAndCalcSizeOfSerializedThrift | private function getAndCalcSizeOfSerializedThrift(TStruct $ts, &$serializedThrift){
$ts->write($this->thriftProtocol);
$serThriftStrlen = $this->tran->available();
//获取后buf清空
$serializedThrift['wrote'] = $this->tran->read(Constants\UDP_PACKET_MAX_LENGTH);
return $serThriftStrle... | php | private function getAndCalcSizeOfSerializedThrift(TStruct $ts, &$serializedThrift){
$ts->write($this->thriftProtocol);
$serThriftStrlen = $this->tran->available();
//获取后buf清空
$serializedThrift['wrote'] = $this->tran->read(Constants\UDP_PACKET_MAX_LENGTH);
return $serThriftStrle... | [
"private",
"function",
"getAndCalcSizeOfSerializedThrift",
"(",
"TStruct",
"$",
"ts",
",",
"&",
"$",
"serializedThrift",
")",
"{",
"$",
"ts",
"->",
"write",
"(",
"$",
"this",
"->",
"thriftProtocol",
")",
";",
"$",
"serThriftStrlen",
"=",
"$",
"this",
"->",
... | 获取序列化后的thrift和计算序列化后的thrift字符长度
@param TStruct $ts
@param $serializedThrift
@return mixed | [
"获取序列化后的thrift和计算序列化后的thrift字符长度"
] | train | https://github.com/jukylin/jaeger-php/blob/ec503218121d87db26dfd0aa350895fd732de38a/src/Jaeger/Transport/TransportUdp.php#L116-L124 |
jukylin/jaeger-php | src/Jaeger/UdpClient.php | UdpClient.emitBatch | public function emitBatch($batch){
$buildThrift = (new AgentClient())->buildThrift($batch);
if(isset($buildThrift['len']) && $buildThrift['len'] && $this->isOpen()) {
$len = $buildThrift['len'];
$enitThrift = $buildThrift['thriftStr'];
$res = socket_sendto($this->sock... | php | public function emitBatch($batch){
$buildThrift = (new AgentClient())->buildThrift($batch);
if(isset($buildThrift['len']) && $buildThrift['len'] && $this->isOpen()) {
$len = $buildThrift['len'];
$enitThrift = $buildThrift['thriftStr'];
$res = socket_sendto($this->sock... | [
"public",
"function",
"emitBatch",
"(",
"$",
"batch",
")",
"{",
"$",
"buildThrift",
"=",
"(",
"new",
"AgentClient",
"(",
")",
")",
"->",
"buildThrift",
"(",
"$",
"batch",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"buildThrift",
"[",
"'len'",
"]",
")",
... | 发送数据
@param $batch
@return bool | [
"发送数据"
] | train | https://github.com/jukylin/jaeger-php/blob/ec503218121d87db26dfd0aa350895fd732de38a/src/Jaeger/UdpClient.php#L40-L54 |
freshbitsweb/laratables | src/RecordsTransformer.php | RecordsTransformer.transformRecords | public function transformRecords($records)
{
if (method_exists($this->class, 'laratablesModifyCollection')) {
$records = $this->class::laratablesModifyCollection($records)->values();
}
return $records->map(function ($item) {
return $this->transformRecord($item);
... | php | public function transformRecords($records)
{
if (method_exists($this->class, 'laratablesModifyCollection')) {
$records = $this->class::laratablesModifyCollection($records)->values();
}
return $records->map(function ($item) {
return $this->transformRecord($item);
... | [
"public",
"function",
"transformRecords",
"(",
"$",
"records",
")",
"{",
"if",
"(",
"method_exists",
"(",
"$",
"this",
"->",
"class",
",",
"'laratablesModifyCollection'",
")",
")",
"{",
"$",
"records",
"=",
"$",
"this",
"->",
"class",
"::",
"laratablesModify... | Transforms each record for Datatables display.
@param \Illuminate\Support\Collection Records of the table
@return \Illuminate\Support\Collection Records of the table | [
"Transforms",
"each",
"record",
"for",
"Datatables",
"display",
"."
] | train | https://github.com/freshbitsweb/laratables/blob/9e027495a090ad5acdfd49db6b91552a89d9e799/src/RecordsTransformer.php#L37-L46 |
freshbitsweb/laratables | src/RecordsTransformer.php | RecordsTransformer.transformRecord | protected function transformRecord($record)
{
$columnNames = $this->columnManager->getRequestedColumnNames();
$columnNames->transform(function ($item) use ($record) {
return $this->getColumnValue($item, $record);
});
$datatableParameters = $this->getDatatableParameters($... | php | protected function transformRecord($record)
{
$columnNames = $this->columnManager->getRequestedColumnNames();
$columnNames->transform(function ($item) use ($record) {
return $this->getColumnValue($item, $record);
});
$datatableParameters = $this->getDatatableParameters($... | [
"protected",
"function",
"transformRecord",
"(",
"$",
"record",
")",
"{",
"$",
"columnNames",
"=",
"$",
"this",
"->",
"columnManager",
"->",
"getRequestedColumnNames",
"(",
")",
";",
"$",
"columnNames",
"->",
"transform",
"(",
"function",
"(",
"$",
"item",
"... | Transform the record data for Datatables display.
@param \Illuminate\Database\Eloquent\Model Eloquent object
@return \Illuminate\Database\Eloquent\Model Eloquent object | [
"Transform",
"the",
"record",
"data",
"for",
"Datatables",
"display",
"."
] | train | https://github.com/freshbitsweb/laratables/blob/9e027495a090ad5acdfd49db6b91552a89d9e799/src/RecordsTransformer.php#L55-L65 |
freshbitsweb/laratables | src/RecordsTransformer.php | RecordsTransformer.getColumnValue | protected function getColumnValue($columnName, $record)
{
// Set custom column value from the class static method
if ($methodName = $this->columnManager->isCustomColumn($columnName)) {
return $this->class::$methodName($record);
}
if ($methodName = $this->customisesColumn... | php | protected function getColumnValue($columnName, $record)
{
// Set custom column value from the class static method
if ($methodName = $this->columnManager->isCustomColumn($columnName)) {
return $this->class::$methodName($record);
}
if ($methodName = $this->customisesColumn... | [
"protected",
"function",
"getColumnValue",
"(",
"$",
"columnName",
",",
"$",
"record",
")",
"{",
"// Set custom column value from the class static method",
"if",
"(",
"$",
"methodName",
"=",
"$",
"this",
"->",
"columnManager",
"->",
"isCustomColumn",
"(",
"$",
"colu... | Retuns column value to be displayed in datatables.
@param mixed Column value from database
@param \Illuminate\Database\Eloquent\Model Eloquent object
@return string | [
"Retuns",
"column",
"value",
"to",
"be",
"displayed",
"in",
"datatables",
"."
] | train | https://github.com/freshbitsweb/laratables/blob/9e027495a090ad5acdfd49db6b91552a89d9e799/src/RecordsTransformer.php#L75-L95 |
freshbitsweb/laratables | src/RecordsTransformer.php | RecordsTransformer.customisesColumnValue | protected function customisesColumnValue($columnName)
{
$methodName = camel_case('laratables_'.$columnName);
if (method_exists($this->class, $methodName)) {
return $methodName;
}
return false;
} | php | protected function customisesColumnValue($columnName)
{
$methodName = camel_case('laratables_'.$columnName);
if (method_exists($this->class, $methodName)) {
return $methodName;
}
return false;
} | [
"protected",
"function",
"customisesColumnValue",
"(",
"$",
"columnName",
")",
"{",
"$",
"methodName",
"=",
"camel_case",
"(",
"'laratables_'",
".",
"$",
"columnName",
")",
";",
"if",
"(",
"method_exists",
"(",
"$",
"this",
"->",
"class",
",",
"$",
"methodNa... | Decides whether there is a custom method on the class for the specified column. Returns method name if yes.
@param string Name of the column
@return bool|string | [
"Decides",
"whether",
"there",
"is",
"a",
"custom",
"method",
"on",
"the",
"class",
"for",
"the",
"specified",
"column",
".",
"Returns",
"method",
"name",
"if",
"yes",
"."
] | train | https://github.com/freshbitsweb/laratables/blob/9e027495a090ad5acdfd49db6b91552a89d9e799/src/RecordsTransformer.php#L104-L113 |
freshbitsweb/laratables | src/RecordsTransformer.php | RecordsTransformer.getRelationColumnValue | protected function getRelationColumnValue($columnName, $record)
{
list($relationName, $relationColumnName) = getRelationDetails($columnName);
if ($methodName = $this->customisesColumnValue($relationName.'_'.$relationColumnName)) {
return $record->$methodName();
}
if ($r... | php | protected function getRelationColumnValue($columnName, $record)
{
list($relationName, $relationColumnName) = getRelationDetails($columnName);
if ($methodName = $this->customisesColumnValue($relationName.'_'.$relationColumnName)) {
return $record->$methodName();
}
if ($r... | [
"protected",
"function",
"getRelationColumnValue",
"(",
"$",
"columnName",
",",
"$",
"record",
")",
"{",
"list",
"(",
"$",
"relationName",
",",
"$",
"relationColumnName",
")",
"=",
"getRelationDetails",
"(",
"$",
"columnName",
")",
";",
"if",
"(",
"$",
"meth... | Returns the value of relation table column.
@param string Name of the column
@param \Illuminate\Database\Eloquent\Model Eloquent object
@return string | [
"Returns",
"the",
"value",
"of",
"relation",
"table",
"column",
"."
] | train | https://github.com/freshbitsweb/laratables/blob/9e027495a090ad5acdfd49db6b91552a89d9e799/src/RecordsTransformer.php#L123-L136 |
freshbitsweb/laratables | src/RecordsTransformer.php | RecordsTransformer.isCarbonInstance | protected function isCarbonInstance($columnValue)
{
return is_object($columnValue) &&
(
$columnValue instanceof \Carbon\Carbon ||
$columnValue instanceof \Illuminate\Support\Carbon
)
;
} | php | protected function isCarbonInstance($columnValue)
{
return is_object($columnValue) &&
(
$columnValue instanceof \Carbon\Carbon ||
$columnValue instanceof \Illuminate\Support\Carbon
)
;
} | [
"protected",
"function",
"isCarbonInstance",
"(",
"$",
"columnValue",
")",
"{",
"return",
"is_object",
"(",
"$",
"columnValue",
")",
"&&",
"(",
"$",
"columnValue",
"instanceof",
"\\",
"Carbon",
"\\",
"Carbon",
"||",
"$",
"columnValue",
"instanceof",
"\\",
"Ill... | Decides whether provided column value is a carbon date instance.
@param mixed Column value
@return bool | [
"Decides",
"whether",
"provided",
"column",
"value",
"is",
"a",
"carbon",
"date",
"instance",
"."
] | train | https://github.com/freshbitsweb/laratables/blob/9e027495a090ad5acdfd49db6b91552a89d9e799/src/RecordsTransformer.php#L145-L153 |
freshbitsweb/laratables | src/RecordsTransformer.php | RecordsTransformer.getDatatableParameters | public function getDatatableParameters($record)
{
$datatableParameters = [
'DT_RowId' => config('laratables.row_id_prefix').$record->{$record->getKeyName()},
];
if (method_exists($this->class, 'laratablesRowClass')) {
$datatableParameters['DT_RowClass'] = $record->la... | php | public function getDatatableParameters($record)
{
$datatableParameters = [
'DT_RowId' => config('laratables.row_id_prefix').$record->{$record->getKeyName()},
];
if (method_exists($this->class, 'laratablesRowClass')) {
$datatableParameters['DT_RowClass'] = $record->la... | [
"public",
"function",
"getDatatableParameters",
"(",
"$",
"record",
")",
"{",
"$",
"datatableParameters",
"=",
"[",
"'DT_RowId'",
"=>",
"config",
"(",
"'laratables.row_id_prefix'",
")",
".",
"$",
"record",
"->",
"{",
"$",
"record",
"->",
"getKeyName",
"(",
")"... | Returns the datatable specific parameters for the record.
@param \Illuminate\Database\Eloquent\Model Eloquent object
@return array | [
"Returns",
"the",
"datatable",
"specific",
"parameters",
"for",
"the",
"record",
"."
] | train | https://github.com/freshbitsweb/laratables/blob/9e027495a090ad5acdfd49db6b91552a89d9e799/src/RecordsTransformer.php#L162-L177 |
freshbitsweb/laratables | src/Laratables.php | Laratables.recordsOf | public static function recordsOf($model, $classOrCallable = null)
{
$instance = new static(...self::prepareProperties($model, $classOrCallable));
$instance->applyFiltersTo();
$records = $instance->fetchRecords();
$records = $instance->recordsTransformer->transformRecords($records)... | php | public static function recordsOf($model, $classOrCallable = null)
{
$instance = new static(...self::prepareProperties($model, $classOrCallable));
$instance->applyFiltersTo();
$records = $instance->fetchRecords();
$records = $instance->recordsTransformer->transformRecords($records)... | [
"public",
"static",
"function",
"recordsOf",
"(",
"$",
"model",
",",
"$",
"classOrCallable",
"=",
"null",
")",
"{",
"$",
"instance",
"=",
"new",
"static",
"(",
"...",
"self",
"::",
"prepareProperties",
"(",
"$",
"model",
",",
"$",
"classOrCallable",
")",
... | Accepts datatables ajax request and returns table data.
@param Model to query for
@param mixed Class/Callable to customize query/data/logic (optional)
@return array Table data | [
"Accepts",
"datatables",
"ajax",
"request",
"and",
"returns",
"table",
"data",
"."
] | train | https://github.com/freshbitsweb/laratables/blob/9e027495a090ad5acdfd49db6b91552a89d9e799/src/Laratables.php#L48-L59 |
freshbitsweb/laratables | src/Laratables.php | Laratables.prepareProperties | private static function prepareProperties($model, $classOrCallable)
{
$callable = null;
$class = $model;
if (is_object($classOrCallable) && $classOrCallable instanceof \Closure) {
$callable = $classOrCallable;
} elseif (is_string($classOrCallable)) {
$class =... | php | private static function prepareProperties($model, $classOrCallable)
{
$callable = null;
$class = $model;
if (is_object($classOrCallable) && $classOrCallable instanceof \Closure) {
$callable = $classOrCallable;
} elseif (is_string($classOrCallable)) {
$class =... | [
"private",
"static",
"function",
"prepareProperties",
"(",
"$",
"model",
",",
"$",
"classOrCallable",
")",
"{",
"$",
"callable",
"=",
"null",
";",
"$",
"class",
"=",
"$",
"model",
";",
"if",
"(",
"is_object",
"(",
"$",
"classOrCallable",
")",
"&&",
"$",
... | Prepares the model, class, and callable for the instance.
@param Model to query for
@param mixed Class/Callable to customize query/data/logic (optional)
@return array Model, class, and callable | [
"Prepares",
"the",
"model",
"class",
"and",
"callable",
"for",
"the",
"instance",
"."
] | train | https://github.com/freshbitsweb/laratables/blob/9e027495a090ad5acdfd49db6b91552a89d9e799/src/Laratables.php#L69-L81 |
freshbitsweb/laratables | src/Laratables.php | Laratables.applyFiltersTo | protected function applyFiltersTo()
{
$searchValue = request('search')['value'];
if ($searchValue) {
$this->queryHandler->applyFilters($this->columnManager->getSearchColumns(), $searchValue);
}
} | php | protected function applyFiltersTo()
{
$searchValue = request('search')['value'];
if ($searchValue) {
$this->queryHandler->applyFilters($this->columnManager->getSearchColumns(), $searchValue);
}
} | [
"protected",
"function",
"applyFiltersTo",
"(",
")",
"{",
"$",
"searchValue",
"=",
"request",
"(",
"'search'",
")",
"[",
"'value'",
"]",
";",
"if",
"(",
"$",
"searchValue",
")",
"{",
"$",
"this",
"->",
"queryHandler",
"->",
"applyFilters",
"(",
"$",
"thi... | Applies conditions to the query if search is performed in datatables.
@return void | [
"Applies",
"conditions",
"to",
"the",
"query",
"if",
"search",
"is",
"performed",
"in",
"datatables",
"."
] | train | https://github.com/freshbitsweb/laratables/blob/9e027495a090ad5acdfd49db6b91552a89d9e799/src/Laratables.php#L88-L95 |
freshbitsweb/laratables | src/Laratables.php | Laratables.fetchRecords | protected function fetchRecords()
{
$query = $this->queryHandler->getQuery();
$orderByValue = $this->columnManager->getOrderBy();
$orderByStatement = is_array($orderByValue) ? 'orderBy' : 'orderByRaw';
$orderByValue = Arr::wrap($orderByValue);
return $query->with($this->col... | php | protected function fetchRecords()
{
$query = $this->queryHandler->getQuery();
$orderByValue = $this->columnManager->getOrderBy();
$orderByStatement = is_array($orderByValue) ? 'orderBy' : 'orderByRaw';
$orderByValue = Arr::wrap($orderByValue);
return $query->with($this->col... | [
"protected",
"function",
"fetchRecords",
"(",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"queryHandler",
"->",
"getQuery",
"(",
")",
";",
"$",
"orderByValue",
"=",
"$",
"this",
"->",
"columnManager",
"->",
"getOrderBy",
"(",
")",
";",
"$",
"orderByS... | Fetches records from the database.
@return \Illuminate\Support\Collection Records of the table | [
"Fetches",
"records",
"from",
"the",
"database",
"."
] | train | https://github.com/freshbitsweb/laratables/blob/9e027495a090ad5acdfd49db6b91552a89d9e799/src/Laratables.php#L102-L115 |
freshbitsweb/laratables | src/Laratables.php | Laratables.tableData | protected function tableData($records)
{
return [
'draw' => request('draw') + 1,
'recordsTotal' => $this->queryHandler->getRecordsCount(),
'recordsFiltered' => $this->queryHandler->getFilteredCount(),
'data' => $records->toArray(),
... | php | protected function tableData($records)
{
return [
'draw' => request('draw') + 1,
'recordsTotal' => $this->queryHandler->getRecordsCount(),
'recordsFiltered' => $this->queryHandler->getFilteredCount(),
'data' => $records->toArray(),
... | [
"protected",
"function",
"tableData",
"(",
"$",
"records",
")",
"{",
"return",
"[",
"'draw'",
"=>",
"request",
"(",
"'draw'",
")",
"+",
"1",
",",
"'recordsTotal'",
"=>",
"$",
"this",
"->",
"queryHandler",
"->",
"getRecordsCount",
"(",
")",
",",
"'recordsFi... | Prepares and returns data for the datatables.
@param \Illuminate\Support\Collection Records of the table
@return array | [
"Prepares",
"and",
"returns",
"data",
"for",
"the",
"datatables",
"."
] | train | https://github.com/freshbitsweb/laratables/blob/9e027495a090ad5acdfd49db6b91552a89d9e799/src/Laratables.php#L124-L132 |
freshbitsweb/laratables | src/RelationshipsManager.php | RelationshipsManager.addRelation | public function addRelation($columnName)
{
$relationName = getRelationName($columnName);
if (
! array_key_exists($relationName, $this->relations) &&
! in_array($relationName, $this->relations)
) {
$methodName = camel_case('laratables_'.$relationName.'rela... | php | public function addRelation($columnName)
{
$relationName = getRelationName($columnName);
if (
! array_key_exists($relationName, $this->relations) &&
! in_array($relationName, $this->relations)
) {
$methodName = camel_case('laratables_'.$relationName.'rela... | [
"public",
"function",
"addRelation",
"(",
"$",
"columnName",
")",
"{",
"$",
"relationName",
"=",
"getRelationName",
"(",
"$",
"columnName",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"relationName",
",",
"$",
"this",
"->",
"relations",
")",
"&... | Adds the relation to be loaded with the query.
@param string Name of the column
@return void | [
"Adds",
"the",
"relation",
"to",
"be",
"loaded",
"with",
"the",
"query",
"."
] | train | https://github.com/freshbitsweb/laratables/blob/9e027495a090ad5acdfd49db6b91552a89d9e799/src/RelationshipsManager.php#L43-L60 |
freshbitsweb/laratables | src/RelationshipsManager.php | RelationshipsManager.decideRelationColumns | protected function decideRelationColumns($relationName)
{
// https://stackoverflow.com/a/25472778/3113599
$relationType = (new \ReflectionClass($this->modelObject->$relationName()))->getShortName();
$selectColumns = [];
switch ($relationType) {
case 'BelongsTo':
... | php | protected function decideRelationColumns($relationName)
{
// https://stackoverflow.com/a/25472778/3113599
$relationType = (new \ReflectionClass($this->modelObject->$relationName()))->getShortName();
$selectColumns = [];
switch ($relationType) {
case 'BelongsTo':
... | [
"protected",
"function",
"decideRelationColumns",
"(",
"$",
"relationName",
")",
"{",
"// https://stackoverflow.com/a/25472778/3113599",
"$",
"relationType",
"=",
"(",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"this",
"->",
"modelObject",
"->",
"$",
"relationName",
"(... | Decides the columns to be used based on the relationship.
@param string Name of the relation
@return array | [
"Decides",
"the",
"columns",
"to",
"be",
"used",
"based",
"on",
"the",
"relationship",
"."
] | train | https://github.com/freshbitsweb/laratables/blob/9e027495a090ad5acdfd49db6b91552a89d9e799/src/RelationshipsManager.php#L83-L106 |
freshbitsweb/laratables | src/FilterAgent.php | FilterAgent.applyFiltersTo | public static function applyFiltersTo($class, $query, $searchColumns, $searchValue)
{
self::$class = $class;
return $query->where(function ($query) use ($searchColumns, $searchValue) {
foreach ($searchColumns as $columnName) {
$query = self::applyFilter($query, $columnNa... | php | public static function applyFiltersTo($class, $query, $searchColumns, $searchValue)
{
self::$class = $class;
return $query->where(function ($query) use ($searchColumns, $searchValue) {
foreach ($searchColumns as $columnName) {
$query = self::applyFilter($query, $columnNa... | [
"public",
"static",
"function",
"applyFiltersTo",
"(",
"$",
"class",
",",
"$",
"query",
",",
"$",
"searchColumns",
",",
"$",
"searchValue",
")",
"{",
"self",
"::",
"$",
"class",
"=",
"$",
"class",
";",
"return",
"$",
"query",
"->",
"where",
"(",
"funct... | Applies where conditions to the query according to search value.
@param Class to customize query/data/logic
@param \Illuminate\Database\Query\Builder Query object
@param array Columns to be searched
@param string Search value
@return \Illuminate\Database\Query\Builder Query object | [
"Applies",
"where",
"conditions",
"to",
"the",
"query",
"according",
"to",
"search",
"value",
"."
] | train | https://github.com/freshbitsweb/laratables/blob/9e027495a090ad5acdfd49db6b91552a89d9e799/src/FilterAgent.php#L22-L31 |
freshbitsweb/laratables | src/FilterAgent.php | FilterAgent.applyFilter | protected static function applyFilter($query, $column, $searchValue)
{
if ($methodName = self::hasCustomSearch($column)) {
return self::$class::$methodName($query, $searchValue);
}
if (isRelationColumn($column)) {
return self::applyRelationFilter($query, $column, $se... | php | protected static function applyFilter($query, $column, $searchValue)
{
if ($methodName = self::hasCustomSearch($column)) {
return self::$class::$methodName($query, $searchValue);
}
if (isRelationColumn($column)) {
return self::applyRelationFilter($query, $column, $se... | [
"protected",
"static",
"function",
"applyFilter",
"(",
"$",
"query",
",",
"$",
"column",
",",
"$",
"searchValue",
")",
"{",
"if",
"(",
"$",
"methodName",
"=",
"self",
"::",
"hasCustomSearch",
"(",
"$",
"column",
")",
")",
"{",
"return",
"self",
"::",
"... | Applies filter condition for the table column.
@param \Freshbitsweb\Laratables\QueryHandler Query object
@param string Column name
@param string Search string
@return \Freshbitsweb\Laratables\QueryHandler Query object | [
"Applies",
"filter",
"condition",
"for",
"the",
"table",
"column",
"."
] | train | https://github.com/freshbitsweb/laratables/blob/9e027495a090ad5acdfd49db6b91552a89d9e799/src/FilterAgent.php#L42-L55 |
freshbitsweb/laratables | src/FilterAgent.php | FilterAgent.hasCustomSearch | protected static function hasCustomSearch($columnName)
{
$methodName = camel_case('laratables_search_'.$columnName);
if (method_exists(self::$class, $methodName)) {
return $methodName;
}
return false;
} | php | protected static function hasCustomSearch($columnName)
{
$methodName = camel_case('laratables_search_'.$columnName);
if (method_exists(self::$class, $methodName)) {
return $methodName;
}
return false;
} | [
"protected",
"static",
"function",
"hasCustomSearch",
"(",
"$",
"columnName",
")",
"{",
"$",
"methodName",
"=",
"camel_case",
"(",
"'laratables_search_'",
".",
"$",
"columnName",
")",
";",
"if",
"(",
"method_exists",
"(",
"self",
"::",
"$",
"class",
",",
"$"... | Decides whether column has custom search method defined in the model and returns method name if yes.
@param string Name of the column
@return bool|string | [
"Decides",
"whether",
"column",
"has",
"custom",
"search",
"method",
"defined",
"in",
"the",
"model",
"and",
"returns",
"method",
"name",
"if",
"yes",
"."
] | train | https://github.com/freshbitsweb/laratables/blob/9e027495a090ad5acdfd49db6b91552a89d9e799/src/FilterAgent.php#L64-L73 |
freshbitsweb/laratables | src/FilterAgent.php | FilterAgent.applyRelationFilter | protected static function applyRelationFilter($query, $column, $searchValue)
{
if ($methodName = self::hasCustomSearch(str_replace('.', '_', $column))) {
return self::$class::$methodName($query, $searchValue);
}
list($relationName, $relationColumnName) = getRelationDetails($colu... | php | protected static function applyRelationFilter($query, $column, $searchValue)
{
if ($methodName = self::hasCustomSearch(str_replace('.', '_', $column))) {
return self::$class::$methodName($query, $searchValue);
}
list($relationName, $relationColumnName) = getRelationDetails($colu... | [
"protected",
"static",
"function",
"applyRelationFilter",
"(",
"$",
"query",
",",
"$",
"column",
",",
"$",
"searchValue",
")",
"{",
"if",
"(",
"$",
"methodName",
"=",
"self",
"::",
"hasCustomSearch",
"(",
"str_replace",
"(",
"'.'",
",",
"'_'",
",",
"$",
... | Applies filter condition for the relation column.
@param \Freshbitsweb\Laratables\QueryHandler Query object
@param string Column name
@param string Search string
@return \Freshbitsweb\Laratables\QueryHandler Query object | [
"Applies",
"filter",
"condition",
"for",
"the",
"relation",
"column",
"."
] | train | https://github.com/freshbitsweb/laratables/blob/9e027495a090ad5acdfd49db6b91552a89d9e799/src/FilterAgent.php#L84-L96 |
freshbitsweb/laratables | src/ColumnManager.php | ColumnManager.initializeProperties | protected function initializeProperties($model, $class)
{
$this->class = $class;
$this->modelObject = new $model();
$this->primaryColumn = $this->modelObject->getKeyName();
$requestData = collect(request()->all());
$this->requestedColumns = collect($requestData->get('columns... | php | protected function initializeProperties($model, $class)
{
$this->class = $class;
$this->modelObject = new $model();
$this->primaryColumn = $this->modelObject->getKeyName();
$requestData = collect(request()->all());
$this->requestedColumns = collect($requestData->get('columns... | [
"protected",
"function",
"initializeProperties",
"(",
"$",
"model",
",",
"$",
"class",
")",
"{",
"$",
"this",
"->",
"class",
"=",
"$",
"class",
";",
"$",
"this",
"->",
"modelObject",
"=",
"new",
"$",
"model",
"(",
")",
";",
"$",
"this",
"->",
"primar... | Initializes class properties.
@param \Illuminate\Database\Eloquent\Model The model to work on
@param Class to customize query/data/logic
@return void | [
"Initializes",
"class",
"properties",
"."
] | train | https://github.com/freshbitsweb/laratables/blob/9e027495a090ad5acdfd49db6b91552a89d9e799/src/ColumnManager.php#L69-L77 |
freshbitsweb/laratables | src/ColumnManager.php | ColumnManager.setColumnProperties | protected function setColumnProperties()
{
// First of all, add the id (or any other primary key), if not available
if (! $this->requestedColumns->contains('name', $this->primaryColumn)) {
$this->selectColumns[] = $this->primaryColumn;
}
$this->requestedColumns->each(fun... | php | protected function setColumnProperties()
{
// First of all, add the id (or any other primary key), if not available
if (! $this->requestedColumns->contains('name', $this->primaryColumn)) {
$this->selectColumns[] = $this->primaryColumn;
}
$this->requestedColumns->each(fun... | [
"protected",
"function",
"setColumnProperties",
"(",
")",
"{",
"// First of all, add the id (or any other primary key), if not available",
"if",
"(",
"!",
"$",
"this",
"->",
"requestedColumns",
"->",
"contains",
"(",
"'name'",
",",
"$",
"this",
"->",
"primaryColumn",
")... | Set column properties from the request data.
@return void | [
"Set",
"column",
"properties",
"from",
"the",
"request",
"data",
"."
] | train | https://github.com/freshbitsweb/laratables/blob/9e027495a090ad5acdfd49db6b91552a89d9e799/src/ColumnManager.php#L84-L94 |
freshbitsweb/laratables | src/ColumnManager.php | ColumnManager.setColumnPropertiesFor | protected function setColumnPropertiesFor($column)
{
$columnName = $column['name'];
if ($column['searchable'] == 'true' && ! in_array($columnName, config('laratables.non_searchable_columns'))) {
$this->searchColumns[] = $columnName;
}
if ($this->isCustomColumn($columnNa... | php | protected function setColumnPropertiesFor($column)
{
$columnName = $column['name'];
if ($column['searchable'] == 'true' && ! in_array($columnName, config('laratables.non_searchable_columns'))) {
$this->searchColumns[] = $columnName;
}
if ($this->isCustomColumn($columnNa... | [
"protected",
"function",
"setColumnPropertiesFor",
"(",
"$",
"column",
")",
"{",
"$",
"columnName",
"=",
"$",
"column",
"[",
"'name'",
"]",
";",
"if",
"(",
"$",
"column",
"[",
"'searchable'",
"]",
"==",
"'true'",
"&&",
"!",
"in_array",
"(",
"$",
"columnN... | Set column properties from the specified column data.
@param array column details
@return void | [
"Set",
"column",
"properties",
"from",
"the",
"specified",
"column",
"data",
"."
] | train | https://github.com/freshbitsweb/laratables/blob/9e027495a090ad5acdfd49db6b91552a89d9e799/src/ColumnManager.php#L103-L126 |
freshbitsweb/laratables | src/ColumnManager.php | ColumnManager.isCustomColumn | public function isCustomColumn($columnName)
{
$columnName = str_replace('.', '_', $columnName);
$methodName = camel_case('laratables_custom_'.$columnName);
if (method_exists($this->class, $methodName)) {
return $methodName;
}
return false;
} | php | public function isCustomColumn($columnName)
{
$columnName = str_replace('.', '_', $columnName);
$methodName = camel_case('laratables_custom_'.$columnName);
if (method_exists($this->class, $methodName)) {
return $methodName;
}
return false;
} | [
"public",
"function",
"isCustomColumn",
"(",
"$",
"columnName",
")",
"{",
"$",
"columnName",
"=",
"str_replace",
"(",
"'.'",
",",
"'_'",
",",
"$",
"columnName",
")",
";",
"$",
"methodName",
"=",
"camel_case",
"(",
"'laratables_custom_'",
".",
"$",
"columnNam... | Decides wether specified column name is custom column. Returns method name if yes.
@param string Name of the column
@return bool|string | [
"Decides",
"wether",
"specified",
"column",
"name",
"is",
"custom",
"column",
".",
"Returns",
"method",
"name",
"if",
"yes",
"."
] | train | https://github.com/freshbitsweb/laratables/blob/9e027495a090ad5acdfd49db6b91552a89d9e799/src/ColumnManager.php#L135-L145 |
freshbitsweb/laratables | src/ColumnManager.php | ColumnManager.getOrderBy | public function getOrderBy()
{
$orderColumn = $this->getOrderColumn();
if (is_array($orderColumn)) {
// An order by raw statement
return $orderColumn[0];
}
$selectedColumnNames = $this->getSelectColumns();
if (! in_array($orderColumn, $selectedColum... | php | public function getOrderBy()
{
$orderColumn = $this->getOrderColumn();
if (is_array($orderColumn)) {
// An order by raw statement
return $orderColumn[0];
}
$selectedColumnNames = $this->getSelectColumns();
if (! in_array($orderColumn, $selectedColum... | [
"public",
"function",
"getOrderBy",
"(",
")",
"{",
"$",
"orderColumn",
"=",
"$",
"this",
"->",
"getOrderColumn",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"orderColumn",
")",
")",
"{",
"// An order by raw statement",
"return",
"$",
"orderColumn",
"[",
... | Returns the values for order by clause of the query.
@throws IncorrectOrderColumn
@return array | [
"Returns",
"the",
"values",
"for",
"order",
"by",
"clause",
"of",
"the",
"query",
"."
] | train | https://github.com/freshbitsweb/laratables/blob/9e027495a090ad5acdfd49db6b91552a89d9e799/src/ColumnManager.php#L178-L196 |
freshbitsweb/laratables | src/ColumnManager.php | ColumnManager.getOrderColumn | public function getOrderColumn()
{
$requestedColumnNames = $this->getRequestedColumnNames()->toArray();
$order = request('order');
$orderColumn = $requestedColumnNames[$order[0]['column']];
if ($methodName = $this->hasCustomOrdering($orderColumn)) {
$orderColumn = $thi... | php | public function getOrderColumn()
{
$requestedColumnNames = $this->getRequestedColumnNames()->toArray();
$order = request('order');
$orderColumn = $requestedColumnNames[$order[0]['column']];
if ($methodName = $this->hasCustomOrdering($orderColumn)) {
$orderColumn = $thi... | [
"public",
"function",
"getOrderColumn",
"(",
")",
"{",
"$",
"requestedColumnNames",
"=",
"$",
"this",
"->",
"getRequestedColumnNames",
"(",
")",
"->",
"toArray",
"(",
")",
";",
"$",
"order",
"=",
"request",
"(",
"'order'",
")",
";",
"$",
"orderColumn",
"="... | Returns the name of the column for ordering.
@return string | [
"Returns",
"the",
"name",
"of",
"the",
"column",
"for",
"ordering",
"."
] | train | https://github.com/freshbitsweb/laratables/blob/9e027495a090ad5acdfd49db6b91552a89d9e799/src/ColumnManager.php#L203-L219 |
freshbitsweb/laratables | src/ColumnManager.php | ColumnManager.hasCustomOrdering | public function hasCustomOrdering($orderColumn)
{
$methodName = camel_case('laratables_order_'.$orderColumn);
if (method_exists($this->class, $methodName)) {
return $methodName;
}
return false;
} | php | public function hasCustomOrdering($orderColumn)
{
$methodName = camel_case('laratables_order_'.$orderColumn);
if (method_exists($this->class, $methodName)) {
return $methodName;
}
return false;
} | [
"public",
"function",
"hasCustomOrdering",
"(",
"$",
"orderColumn",
")",
"{",
"$",
"methodName",
"=",
"camel_case",
"(",
"'laratables_order_'",
".",
"$",
"orderColumn",
")",
";",
"if",
"(",
"method_exists",
"(",
"$",
"this",
"->",
"class",
",",
"$",
"methodN... | Decides weather there is a custom ordering for the specified column name. Returns method name if yes.
@param string Name of the column
@return bool|string | [
"Decides",
"weather",
"there",
"is",
"a",
"custom",
"ordering",
"for",
"the",
"specified",
"column",
"name",
".",
"Returns",
"method",
"name",
"if",
"yes",
"."
] | train | https://github.com/freshbitsweb/laratables/blob/9e027495a090ad5acdfd49db6b91552a89d9e799/src/ColumnManager.php#L228-L237 |
freshbitsweb/laratables | src/ColumnManager.php | ColumnManager.hasCustomRawOrdering | public function hasCustomRawOrdering($orderColumn)
{
$methodName = camel_case('laratables_order_raw_'.$orderColumn);
if (method_exists($this->class, $methodName)) {
return $methodName;
}
return false;
} | php | public function hasCustomRawOrdering($orderColumn)
{
$methodName = camel_case('laratables_order_raw_'.$orderColumn);
if (method_exists($this->class, $methodName)) {
return $methodName;
}
return false;
} | [
"public",
"function",
"hasCustomRawOrdering",
"(",
"$",
"orderColumn",
")",
"{",
"$",
"methodName",
"=",
"camel_case",
"(",
"'laratables_order_raw_'",
".",
"$",
"orderColumn",
")",
";",
"if",
"(",
"method_exists",
"(",
"$",
"this",
"->",
"class",
",",
"$",
"... | Decides weather there is a custom raw ordering for the specified column name. Returns method name if yes.
@param string Name of the column
@return bool|string | [
"Decides",
"weather",
"there",
"is",
"a",
"custom",
"raw",
"ordering",
"for",
"the",
"specified",
"column",
"name",
".",
"Returns",
"method",
"name",
"if",
"yes",
"."
] | train | https://github.com/freshbitsweb/laratables/blob/9e027495a090ad5acdfd49db6b91552a89d9e799/src/ColumnManager.php#L246-L255 |
freshbitsweb/laratables | src/QueryHandler.php | QueryHandler.setQuery | protected function setQuery($model, $class)
{
$this->query = new $model();
if (method_exists($class, 'laratablesQueryConditions')) {
$this->query = $class::laratablesQueryConditions($this->query);
}
} | php | protected function setQuery($model, $class)
{
$this->query = new $model();
if (method_exists($class, 'laratablesQueryConditions')) {
$this->query = $class::laratablesQueryConditions($this->query);
}
} | [
"protected",
"function",
"setQuery",
"(",
"$",
"model",
",",
"$",
"class",
")",
"{",
"$",
"this",
"->",
"query",
"=",
"new",
"$",
"model",
"(",
")",
";",
"if",
"(",
"method_exists",
"(",
"$",
"class",
",",
"'laratablesQueryConditions'",
")",
")",
"{",
... | Initialises Query object.
@param \Illuminate\Database\Eloquent\Model The model to work on
@param Class to customize query/data/logic
@return void | [
"Initialises",
"Query",
"object",
"."
] | train | https://github.com/freshbitsweb/laratables/blob/9e027495a090ad5acdfd49db6b91552a89d9e799/src/QueryHandler.php#L57-L64 |
freshbitsweb/laratables | src/QueryHandler.php | QueryHandler.applyFilters | public function applyFilters($searchColumns, $searchValue)
{
$this->query = FilterAgent::applyFiltersTo($this->class, $this->query, $searchColumns, $searchValue);
$this->filteredCount = $this->query->count();
} | php | public function applyFilters($searchColumns, $searchValue)
{
$this->query = FilterAgent::applyFiltersTo($this->class, $this->query, $searchColumns, $searchValue);
$this->filteredCount = $this->query->count();
} | [
"public",
"function",
"applyFilters",
"(",
"$",
"searchColumns",
",",
"$",
"searchValue",
")",
"{",
"$",
"this",
"->",
"query",
"=",
"FilterAgent",
"::",
"applyFiltersTo",
"(",
"$",
"this",
"->",
"class",
",",
"$",
"this",
"->",
"query",
",",
"$",
"searc... | Applies where conditions to the query according to search value.
@param array Columns to be searched
@param string Search value
@return void | [
"Applies",
"where",
"conditions",
"to",
"the",
"query",
"according",
"to",
"search",
"value",
"."
] | train | https://github.com/freshbitsweb/laratables/blob/9e027495a090ad5acdfd49db6b91552a89d9e799/src/QueryHandler.php#L74-L78 |
wikimedia/composer-merge-plugin | src/Logger.php | Logger.log | protected function log($message)
{
if (method_exists($this->inputOutput, 'writeError')) {
$this->inputOutput->writeError($message);
} else {
// @codeCoverageIgnoreStart
// Backwards compatiblity for Composer before cb336a5
$this->inputOutput->write($me... | php | protected function log($message)
{
if (method_exists($this->inputOutput, 'writeError')) {
$this->inputOutput->writeError($message);
} else {
// @codeCoverageIgnoreStart
// Backwards compatiblity for Composer before cb336a5
$this->inputOutput->write($me... | [
"protected",
"function",
"log",
"(",
"$",
"message",
")",
"{",
"if",
"(",
"method_exists",
"(",
"$",
"this",
"->",
"inputOutput",
",",
"'writeError'",
")",
")",
"{",
"$",
"this",
"->",
"inputOutput",
"->",
"writeError",
"(",
"$",
"message",
")",
";",
"... | Write a message
@param string $message | [
"Write",
"a",
"message"
] | train | https://github.com/wikimedia/composer-merge-plugin/blob/73e4ed4fa66167823cb9bfc65fdd5fd6019722b6/src/Logger.php#L90-L100 |
wikimedia/composer-merge-plugin | src/Merge/PluginState.php | PluginState.loadSettings | public function loadSettings()
{
$extra = $this->composer->getPackage()->getExtra();
$config = array_merge(
array(
'include' => array(),
'require' => array(),
'recurse' => true,
'replace' => false,
'ignore-du... | php | public function loadSettings()
{
$extra = $this->composer->getPackage()->getExtra();
$config = array_merge(
array(
'include' => array(),
'require' => array(),
'recurse' => true,
'replace' => false,
'ignore-du... | [
"public",
"function",
"loadSettings",
"(",
")",
"{",
"$",
"extra",
"=",
"$",
"this",
"->",
"composer",
"->",
"getPackage",
"(",
")",
"->",
"getExtra",
"(",
")",
";",
"$",
"config",
"=",
"array_merge",
"(",
"array",
"(",
"'include'",
"=>",
"array",
"(",... | Load plugin settings | [
"Load",
"plugin",
"settings"
] | train | https://github.com/wikimedia/composer-merge-plugin/blob/73e4ed4fa66167823cb9bfc65fdd5fd6019722b6/src/Merge/PluginState.php#L138-L167 |
wikimedia/composer-merge-plugin | src/MergePlugin.php | MergePlugin.activate | public function activate(Composer $composer, IOInterface $io)
{
$this->composer = $composer;
$this->state = new PluginState($this->composer);
$this->logger = new Logger('merge-plugin', $io);
} | php | public function activate(Composer $composer, IOInterface $io)
{
$this->composer = $composer;
$this->state = new PluginState($this->composer);
$this->logger = new Logger('merge-plugin', $io);
} | [
"public",
"function",
"activate",
"(",
"Composer",
"$",
"composer",
",",
"IOInterface",
"$",
"io",
")",
"{",
"$",
"this",
"->",
"composer",
"=",
"$",
"composer",
";",
"$",
"this",
"->",
"state",
"=",
"new",
"PluginState",
"(",
"$",
"this",
"->",
"compo... | {@inheritdoc} | [
"{"
] | train | https://github.com/wikimedia/composer-merge-plugin/blob/73e4ed4fa66167823cb9bfc65fdd5fd6019722b6/src/MergePlugin.php#L132-L137 |
wikimedia/composer-merge-plugin | src/MergePlugin.php | MergePlugin.onInstallUpdateOrDump | public function onInstallUpdateOrDump(ScriptEvent $event)
{
$this->state->loadSettings();
$this->state->setDevMode($event->isDevMode());
$this->mergeFiles($this->state->getIncludes(), false);
$this->mergeFiles($this->state->getRequires(), true);
if ($event->getName() === Scr... | php | public function onInstallUpdateOrDump(ScriptEvent $event)
{
$this->state->loadSettings();
$this->state->setDevMode($event->isDevMode());
$this->mergeFiles($this->state->getIncludes(), false);
$this->mergeFiles($this->state->getRequires(), true);
if ($event->getName() === Scr... | [
"public",
"function",
"onInstallUpdateOrDump",
"(",
"ScriptEvent",
"$",
"event",
")",
"{",
"$",
"this",
"->",
"state",
"->",
"loadSettings",
"(",
")",
";",
"$",
"this",
"->",
"state",
"->",
"setDevMode",
"(",
"$",
"event",
"->",
"isDevMode",
"(",
")",
")... | Handle an event callback for an install, update or dump command by
checking for "merge-plugin" in the "extra" data and merging package
contents if found.
@param ScriptEvent $event | [
"Handle",
"an",
"event",
"callback",
"for",
"an",
"install",
"update",
"or",
"dump",
"command",
"by",
"checking",
"for",
"merge",
"-",
"plugin",
"in",
"the",
"extra",
"data",
"and",
"merging",
"package",
"contents",
"if",
"found",
"."
] | train | https://github.com/wikimedia/composer-merge-plugin/blob/73e4ed4fa66167823cb9bfc65fdd5fd6019722b6/src/MergePlugin.php#L190-L204 |
wikimedia/composer-merge-plugin | src/MergePlugin.php | MergePlugin.mergeFiles | protected function mergeFiles(array $patterns, $required = false)
{
$root = $this->composer->getPackage();
$files = array_map(
function ($files, $pattern) use ($required) {
if ($required && !$files) {
throw new MissingFileException(
... | php | protected function mergeFiles(array $patterns, $required = false)
{
$root = $this->composer->getPackage();
$files = array_map(
function ($files, $pattern) use ($required) {
if ($required && !$files) {
throw new MissingFileException(
... | [
"protected",
"function",
"mergeFiles",
"(",
"array",
"$",
"patterns",
",",
"$",
"required",
"=",
"false",
")",
"{",
"$",
"root",
"=",
"$",
"this",
"->",
"composer",
"->",
"getPackage",
"(",
")",
";",
"$",
"files",
"=",
"array_map",
"(",
"function",
"("... | Find configuration files matching the configured glob patterns and
merge their contents with the master package.
@param array $patterns List of files/glob patterns
@param bool $required Are the patterns required to match files?
@throws MissingFileException when required and a pattern returns no
results | [
"Find",
"configuration",
"files",
"matching",
"the",
"configured",
"glob",
"patterns",
"and",
"merge",
"their",
"contents",
"with",
"the",
"master",
"package",
"."
] | train | https://github.com/wikimedia/composer-merge-plugin/blob/73e4ed4fa66167823cb9bfc65fdd5fd6019722b6/src/MergePlugin.php#L215-L235 |
wikimedia/composer-merge-plugin | src/MergePlugin.php | MergePlugin.mergeFile | protected function mergeFile(RootPackageInterface $root, $path)
{
if (isset($this->loaded[$path]) ||
(isset($this->loadedNoDev[$path]) && !$this->state->isDevMode())
) {
$this->logger->debug(
"Already merged <comment>$path</comment> completely"
);
... | php | protected function mergeFile(RootPackageInterface $root, $path)
{
if (isset($this->loaded[$path]) ||
(isset($this->loadedNoDev[$path]) && !$this->state->isDevMode())
) {
$this->logger->debug(
"Already merged <comment>$path</comment> completely"
);
... | [
"protected",
"function",
"mergeFile",
"(",
"RootPackageInterface",
"$",
"root",
",",
"$",
"path",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"loaded",
"[",
"$",
"path",
"]",
")",
"||",
"(",
"isset",
"(",
"$",
"this",
"->",
"loadedNoDev",
"... | Read a JSON file and merge its contents
@param RootPackageInterface $root
@param string $path | [
"Read",
"a",
"JSON",
"file",
"and",
"merge",
"its",
"contents"
] | train | https://github.com/wikimedia/composer-merge-plugin/blob/73e4ed4fa66167823cb9bfc65fdd5fd6019722b6/src/MergePlugin.php#L243-L276 |
wikimedia/composer-merge-plugin | src/MergePlugin.php | MergePlugin.onDependencySolve | public function onDependencySolve(InstallerEvent $event)
{
$request = $event->getRequest();
foreach ($this->state->getDuplicateLinks('require') as $link) {
$this->logger->info(
"Adding dependency <comment>{$link}</comment>"
);
$request->install($li... | php | public function onDependencySolve(InstallerEvent $event)
{
$request = $event->getRequest();
foreach ($this->state->getDuplicateLinks('require') as $link) {
$this->logger->info(
"Adding dependency <comment>{$link}</comment>"
);
$request->install($li... | [
"public",
"function",
"onDependencySolve",
"(",
"InstallerEvent",
"$",
"event",
")",
"{",
"$",
"request",
"=",
"$",
"event",
"->",
"getRequest",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"state",
"->",
"getDuplicateLinks",
"(",
"'require'",
")",
"a... | Handle an event callback for pre-dependency solving phase of an install
or update by adding any duplicate package dependencies found during
initial merge processing to the request that will be processed by the
dependency solver.
@param InstallerEvent $event | [
"Handle",
"an",
"event",
"callback",
"for",
"pre",
"-",
"dependency",
"solving",
"phase",
"of",
"an",
"install",
"or",
"update",
"by",
"adding",
"any",
"duplicate",
"package",
"dependencies",
"found",
"during",
"initial",
"merge",
"processing",
"to",
"the",
"r... | train | https://github.com/wikimedia/composer-merge-plugin/blob/73e4ed4fa66167823cb9bfc65fdd5fd6019722b6/src/MergePlugin.php#L286-L308 |
wikimedia/composer-merge-plugin | src/MergePlugin.php | MergePlugin.onPostPackageInstall | public function onPostPackageInstall(PackageEvent $event)
{
$op = $event->getOperation();
if ($op instanceof InstallOperation) {
$package = $op->getPackage()->getName();
if ($package === self::PACKAGE_NAME) {
$this->logger->info('composer-merge-plugin installe... | php | public function onPostPackageInstall(PackageEvent $event)
{
$op = $event->getOperation();
if ($op instanceof InstallOperation) {
$package = $op->getPackage()->getName();
if ($package === self::PACKAGE_NAME) {
$this->logger->info('composer-merge-plugin installe... | [
"public",
"function",
"onPostPackageInstall",
"(",
"PackageEvent",
"$",
"event",
")",
"{",
"$",
"op",
"=",
"$",
"event",
"->",
"getOperation",
"(",
")",
";",
"if",
"(",
"$",
"op",
"instanceof",
"InstallOperation",
")",
"{",
"$",
"package",
"=",
"$",
"op"... | Handle an event callback following installation of a new package by
checking to see if the package that was installed was our plugin.
@param PackageEvent $event | [
"Handle",
"an",
"event",
"callback",
"following",
"installation",
"of",
"a",
"new",
"package",
"by",
"checking",
"to",
"see",
"if",
"the",
"package",
"that",
"was",
"installed",
"was",
"our",
"plugin",
"."
] | train | https://github.com/wikimedia/composer-merge-plugin/blob/73e4ed4fa66167823cb9bfc65fdd5fd6019722b6/src/MergePlugin.php#L316-L329 |
wikimedia/composer-merge-plugin | src/MergePlugin.php | MergePlugin.onPostInstallOrUpdate | public function onPostInstallOrUpdate(ScriptEvent $event)
{
// @codeCoverageIgnoreStart
if ($this->state->isFirstInstall()) {
$this->state->setFirstInstall(false);
$this->logger->info(
'<comment>' .
'Running additional update to apply merge set... | php | public function onPostInstallOrUpdate(ScriptEvent $event)
{
// @codeCoverageIgnoreStart
if ($this->state->isFirstInstall()) {
$this->state->setFirstInstall(false);
$this->logger->info(
'<comment>' .
'Running additional update to apply merge set... | [
"public",
"function",
"onPostInstallOrUpdate",
"(",
"ScriptEvent",
"$",
"event",
")",
"{",
"// @codeCoverageIgnoreStart",
"if",
"(",
"$",
"this",
"->",
"state",
"->",
"isFirstInstall",
"(",
")",
")",
"{",
"$",
"this",
"->",
"state",
"->",
"setFirstInstall",
"(... | Handle an event callback following an install or update command. If our
plugin was installed during the run then trigger an update command to
process any merge-patterns in the current config.
@param ScriptEvent $event | [
"Handle",
"an",
"event",
"callback",
"following",
"an",
"install",
"or",
"update",
"command",
".",
"If",
"our",
"plugin",
"was",
"installed",
"during",
"the",
"run",
"then",
"trigger",
"an",
"update",
"command",
"to",
"process",
"any",
"merge",
"-",
"pattern... | train | https://github.com/wikimedia/composer-merge-plugin/blob/73e4ed4fa66167823cb9bfc65fdd5fd6019722b6/src/MergePlugin.php#L338-L379 |
wikimedia/composer-merge-plugin | src/Merge/ExtraPackage.php | ExtraPackage.readPackageJson | protected function readPackageJson($path)
{
$file = new JsonFile($path);
$json = $file->read();
if (!isset($json['name'])) {
$json['name'] = 'merge-plugin/' .
strtr($path, DIRECTORY_SEPARATOR, '-');
}
if (!isset($json['version'])) {
$js... | php | protected function readPackageJson($path)
{
$file = new JsonFile($path);
$json = $file->read();
if (!isset($json['name'])) {
$json['name'] = 'merge-plugin/' .
strtr($path, DIRECTORY_SEPARATOR, '-');
}
if (!isset($json['version'])) {
$js... | [
"protected",
"function",
"readPackageJson",
"(",
"$",
"path",
")",
"{",
"$",
"file",
"=",
"new",
"JsonFile",
"(",
"$",
"path",
")",
";",
"$",
"json",
"=",
"$",
"file",
"->",
"read",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"json",
"[",
... | Read the contents of a composer.json style file into an array.
The package contents are fixed up to be usable to create a Package
object by providing dummy "name" and "version" values if they have not
been provided in the file. This is consistent with the default root
package loading behavior of Composer.
@param stri... | [
"Read",
"the",
"contents",
"of",
"a",
"composer",
".",
"json",
"style",
"file",
"into",
"an",
"array",
"."
] | train | https://github.com/wikimedia/composer-merge-plugin/blob/73e4ed4fa66167823cb9bfc65fdd5fd6019722b6/src/Merge/ExtraPackage.php#L114-L126 |
wikimedia/composer-merge-plugin | src/Merge/ExtraPackage.php | ExtraPackage.mergeInto | public function mergeInto(RootPackageInterface $root, PluginState $state)
{
$this->prependRepositories($root);
$this->mergeRequires('require', $root, $state);
$this->mergePackageLinks('conflict', $root);
$this->mergePackageLinks('replace', $root);
$this->mergePackageLinks('... | php | public function mergeInto(RootPackageInterface $root, PluginState $state)
{
$this->prependRepositories($root);
$this->mergeRequires('require', $root, $state);
$this->mergePackageLinks('conflict', $root);
$this->mergePackageLinks('replace', $root);
$this->mergePackageLinks('... | [
"public",
"function",
"mergeInto",
"(",
"RootPackageInterface",
"$",
"root",
",",
"PluginState",
"$",
"state",
")",
"{",
"$",
"this",
"->",
"prependRepositories",
"(",
"$",
"root",
")",
";",
"$",
"this",
"->",
"mergeRequires",
"(",
"'require'",
",",
"$",
"... | Merge this package into a RootPackageInterface
@param RootPackageInterface $root
@param PluginState $state | [
"Merge",
"this",
"package",
"into",
"a",
"RootPackageInterface"
] | train | https://github.com/wikimedia/composer-merge-plugin/blob/73e4ed4fa66167823cb9bfc65fdd5fd6019722b6/src/Merge/ExtraPackage.php#L153-L176 |
wikimedia/composer-merge-plugin | src/Merge/ExtraPackage.php | ExtraPackage.mergeDevInto | public function mergeDevInto(RootPackageInterface $root, PluginState $state)
{
$this->mergeRequires('require-dev', $root, $state);
$this->mergeAutoload('devAutoload', $root);
$this->mergeReferences($root);
} | php | public function mergeDevInto(RootPackageInterface $root, PluginState $state)
{
$this->mergeRequires('require-dev', $root, $state);
$this->mergeAutoload('devAutoload', $root);
$this->mergeReferences($root);
} | [
"public",
"function",
"mergeDevInto",
"(",
"RootPackageInterface",
"$",
"root",
",",
"PluginState",
"$",
"state",
")",
"{",
"$",
"this",
"->",
"mergeRequires",
"(",
"'require-dev'",
",",
"$",
"root",
",",
"$",
"state",
")",
";",
"$",
"this",
"->",
"mergeAu... | Merge just the dev portion into a RootPackageInterface
@param RootPackageInterface $root
@param PluginState $state | [
"Merge",
"just",
"the",
"dev",
"portion",
"into",
"a",
"RootPackageInterface"
] | train | https://github.com/wikimedia/composer-merge-plugin/blob/73e4ed4fa66167823cb9bfc65fdd5fd6019722b6/src/Merge/ExtraPackage.php#L184-L189 |
wikimedia/composer-merge-plugin | src/Merge/ExtraPackage.php | ExtraPackage.prependRepositories | protected function prependRepositories(RootPackageInterface $root)
{
if (!isset($this->json['repositories'])) {
return;
}
$repoManager = $this->composer->getRepositoryManager();
$newRepos = array();
foreach ($this->json['repositories'] as $repoJson) {
... | php | protected function prependRepositories(RootPackageInterface $root)
{
if (!isset($this->json['repositories'])) {
return;
}
$repoManager = $this->composer->getRepositoryManager();
$newRepos = array();
foreach ($this->json['repositories'] as $repoJson) {
... | [
"protected",
"function",
"prependRepositories",
"(",
"RootPackageInterface",
"$",
"root",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"json",
"[",
"'repositories'",
"]",
")",
")",
"{",
"return",
";",
"}",
"$",
"repoManager",
"=",
"$",
"thi... | Add a collection of repositories described by the given configuration
to the given package and the global repository manager.
@param RootPackageInterface $root | [
"Add",
"a",
"collection",
"of",
"repositories",
"described",
"by",
"the",
"given",
"configuration",
"to",
"the",
"given",
"package",
"and",
"the",
"global",
"repository",
"manager",
"."
] | train | https://github.com/wikimedia/composer-merge-plugin/blob/73e4ed4fa66167823cb9bfc65fdd5fd6019722b6/src/Merge/ExtraPackage.php#L197-L223 |
wikimedia/composer-merge-plugin | src/Merge/ExtraPackage.php | ExtraPackage.mergeRequires | protected function mergeRequires(
$type,
RootPackageInterface $root,
PluginState $state
) {
$linkType = BasePackage::$supportedLinkTypes[$type];
$getter = 'get' . ucfirst($linkType['method']);
$setter = 'set' . ucfirst($linkType['method']);
$requires = $this-... | php | protected function mergeRequires(
$type,
RootPackageInterface $root,
PluginState $state
) {
$linkType = BasePackage::$supportedLinkTypes[$type];
$getter = 'get' . ucfirst($linkType['method']);
$setter = 'set' . ucfirst($linkType['method']);
$requires = $this-... | [
"protected",
"function",
"mergeRequires",
"(",
"$",
"type",
",",
"RootPackageInterface",
"$",
"root",
",",
"PluginState",
"$",
"state",
")",
"{",
"$",
"linkType",
"=",
"BasePackage",
"::",
"$",
"supportedLinkTypes",
"[",
"$",
"type",
"]",
";",
"$",
"getter",... | Merge require or require-dev into a RootPackageInterface
@param string $type 'require' or 'require-dev'
@param RootPackageInterface $root
@param PluginState $state | [
"Merge",
"require",
"or",
"require",
"-",
"dev",
"into",
"a",
"RootPackageInterface"
] | train | https://github.com/wikimedia/composer-merge-plugin/blob/73e4ed4fa66167823cb9bfc65fdd5fd6019722b6/src/Merge/ExtraPackage.php#L232-L260 |
wikimedia/composer-merge-plugin | src/Merge/ExtraPackage.php | ExtraPackage.mergeOrDefer | protected function mergeOrDefer(
$type,
array $origin,
array $merge,
$state
) {
if ($state->ignoreDuplicateLinks() && $state->replaceDuplicateLinks()) {
$this->logger->warning("Both replace and ignore-duplicates are true. These are mutually exclusive.");
... | php | protected function mergeOrDefer(
$type,
array $origin,
array $merge,
$state
) {
if ($state->ignoreDuplicateLinks() && $state->replaceDuplicateLinks()) {
$this->logger->warning("Both replace and ignore-duplicates are true. These are mutually exclusive.");
... | [
"protected",
"function",
"mergeOrDefer",
"(",
"$",
"type",
",",
"array",
"$",
"origin",
",",
"array",
"$",
"merge",
",",
"$",
"state",
")",
"{",
"if",
"(",
"$",
"state",
"->",
"ignoreDuplicateLinks",
"(",
")",
"&&",
"$",
"state",
"->",
"replaceDuplicateL... | Merge two collections of package links and collect duplicates for
subsequent processing.
@param string $type 'require' or 'require-dev'
@param array $origin Primary collection
@param array $merge Additional collection
@param PluginState $state
@return array Merged collection | [
"Merge",
"two",
"collections",
"of",
"package",
"links",
"and",
"collect",
"duplicates",
"for",
"subsequent",
"processing",
"."
] | train | https://github.com/wikimedia/composer-merge-plugin/blob/73e4ed4fa66167823cb9bfc65fdd5fd6019722b6/src/Merge/ExtraPackage.php#L272-L301 |
wikimedia/composer-merge-plugin | src/Merge/ExtraPackage.php | ExtraPackage.mergeAutoload | protected function mergeAutoload($type, RootPackageInterface $root)
{
$getter = 'get' . ucfirst($type);
$setter = 'set' . ucfirst($type);
$autoload = $this->package->{$getter}();
if (empty($autoload)) {
return;
}
$unwrapped = self::unwrapIfNeeded($root, ... | php | protected function mergeAutoload($type, RootPackageInterface $root)
{
$getter = 'get' . ucfirst($type);
$setter = 'set' . ucfirst($type);
$autoload = $this->package->{$getter}();
if (empty($autoload)) {
return;
}
$unwrapped = self::unwrapIfNeeded($root, ... | [
"protected",
"function",
"mergeAutoload",
"(",
"$",
"type",
",",
"RootPackageInterface",
"$",
"root",
")",
"{",
"$",
"getter",
"=",
"'get'",
".",
"ucfirst",
"(",
"$",
"type",
")",
";",
"$",
"setter",
"=",
"'set'",
".",
"ucfirst",
"(",
"$",
"type",
")",... | Merge autoload or autoload-dev into a RootPackageInterface
@param string $type 'autoload' or 'devAutoload'
@param RootPackageInterface $root | [
"Merge",
"autoload",
"or",
"autoload",
"-",
"dev",
"into",
"a",
"RootPackageInterface"
] | train | https://github.com/wikimedia/composer-merge-plugin/blob/73e4ed4fa66167823cb9bfc65fdd5fd6019722b6/src/Merge/ExtraPackage.php#L309-L324 |
wikimedia/composer-merge-plugin | src/Merge/ExtraPackage.php | ExtraPackage.fixRelativePaths | protected function fixRelativePaths(array $paths)
{
$base = dirname($this->path);
$base = ($base === '.') ? '' : "{$base}/";
array_walk_recursive(
$paths,
function (&$path) use ($base) {
$path = "{$base}{$path}";
}
);
retur... | php | protected function fixRelativePaths(array $paths)
{
$base = dirname($this->path);
$base = ($base === '.') ? '' : "{$base}/";
array_walk_recursive(
$paths,
function (&$path) use ($base) {
$path = "{$base}{$path}";
}
);
retur... | [
"protected",
"function",
"fixRelativePaths",
"(",
"array",
"$",
"paths",
")",
"{",
"$",
"base",
"=",
"dirname",
"(",
"$",
"this",
"->",
"path",
")",
";",
"$",
"base",
"=",
"(",
"$",
"base",
"===",
"'.'",
")",
"?",
"''",
":",
"\"{$base}/\"",
";",
"a... | Fix a collection of paths that are relative to this package to be
relative to the base package.
@param array $paths
@return array | [
"Fix",
"a",
"collection",
"of",
"paths",
"that",
"are",
"relative",
"to",
"this",
"package",
"to",
"be",
"relative",
"to",
"the",
"base",
"package",
"."
] | train | https://github.com/wikimedia/composer-merge-plugin/blob/73e4ed4fa66167823cb9bfc65fdd5fd6019722b6/src/Merge/ExtraPackage.php#L333-L345 |
wikimedia/composer-merge-plugin | src/Merge/ExtraPackage.php | ExtraPackage.mergeStabilityFlags | protected function mergeStabilityFlags(
RootPackageInterface $root,
array $requires
) {
$flags = $root->getStabilityFlags();
$sf = new StabilityFlags($flags, $root->getMinimumStability());
$unwrapped = self::unwrapIfNeeded($root, 'setStabilityFlags');
$unwrapped->set... | php | protected function mergeStabilityFlags(
RootPackageInterface $root,
array $requires
) {
$flags = $root->getStabilityFlags();
$sf = new StabilityFlags($flags, $root->getMinimumStability());
$unwrapped = self::unwrapIfNeeded($root, 'setStabilityFlags');
$unwrapped->set... | [
"protected",
"function",
"mergeStabilityFlags",
"(",
"RootPackageInterface",
"$",
"root",
",",
"array",
"$",
"requires",
")",
"{",
"$",
"flags",
"=",
"$",
"root",
"->",
"getStabilityFlags",
"(",
")",
";",
"$",
"sf",
"=",
"new",
"StabilityFlags",
"(",
"$",
... | Extract and merge stability flags from the given collection of
requires and merge them into a RootPackageInterface
@param RootPackageInterface $root
@param array $requires | [
"Extract",
"and",
"merge",
"stability",
"flags",
"from",
"the",
"given",
"collection",
"of",
"requires",
"and",
"merge",
"them",
"into",
"a",
"RootPackageInterface"
] | train | https://github.com/wikimedia/composer-merge-plugin/blob/73e4ed4fa66167823cb9bfc65fdd5fd6019722b6/src/Merge/ExtraPackage.php#L354-L366 |
wikimedia/composer-merge-plugin | src/Merge/ExtraPackage.php | ExtraPackage.mergePackageLinks | protected function mergePackageLinks($type, RootPackageInterface $root)
{
$linkType = BasePackage::$supportedLinkTypes[$type];
$getter = 'get' . ucfirst($linkType['method']);
$setter = 'set' . ucfirst($linkType['method']);
$links = $this->package->{$getter}();
if (!empty($li... | php | protected function mergePackageLinks($type, RootPackageInterface $root)
{
$linkType = BasePackage::$supportedLinkTypes[$type];
$getter = 'get' . ucfirst($linkType['method']);
$setter = 'set' . ucfirst($linkType['method']);
$links = $this->package->{$getter}();
if (!empty($li... | [
"protected",
"function",
"mergePackageLinks",
"(",
"$",
"type",
",",
"RootPackageInterface",
"$",
"root",
")",
"{",
"$",
"linkType",
"=",
"BasePackage",
"::",
"$",
"supportedLinkTypes",
"[",
"$",
"type",
"]",
";",
"$",
"getter",
"=",
"'get'",
".",
"ucfirst",... | Merge package links of the given type into a RootPackageInterface
@param string $type 'conflict', 'replace' or 'provide'
@param RootPackageInterface $root | [
"Merge",
"package",
"links",
"of",
"the",
"given",
"type",
"into",
"a",
"RootPackageInterface"
] | train | https://github.com/wikimedia/composer-merge-plugin/blob/73e4ed4fa66167823cb9bfc65fdd5fd6019722b6/src/Merge/ExtraPackage.php#L374-L396 |
wikimedia/composer-merge-plugin | src/Merge/ExtraPackage.php | ExtraPackage.mergeSuggests | protected function mergeSuggests(RootPackageInterface $root)
{
$suggests = $this->package->getSuggests();
if (!empty($suggests)) {
$unwrapped = self::unwrapIfNeeded($root, 'setSuggests');
$unwrapped->setSuggests(array_merge(
$root->getSuggests(),
... | php | protected function mergeSuggests(RootPackageInterface $root)
{
$suggests = $this->package->getSuggests();
if (!empty($suggests)) {
$unwrapped = self::unwrapIfNeeded($root, 'setSuggests');
$unwrapped->setSuggests(array_merge(
$root->getSuggests(),
... | [
"protected",
"function",
"mergeSuggests",
"(",
"RootPackageInterface",
"$",
"root",
")",
"{",
"$",
"suggests",
"=",
"$",
"this",
"->",
"package",
"->",
"getSuggests",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"suggests",
")",
")",
"{",
"$",
"un... | Merge suggested packages into a RootPackageInterface
@param RootPackageInterface $root | [
"Merge",
"suggested",
"packages",
"into",
"a",
"RootPackageInterface"
] | train | https://github.com/wikimedia/composer-merge-plugin/blob/73e4ed4fa66167823cb9bfc65fdd5fd6019722b6/src/Merge/ExtraPackage.php#L403-L413 |
wikimedia/composer-merge-plugin | src/Merge/ExtraPackage.php | ExtraPackage.mergeExtra | public function mergeExtra(RootPackageInterface $root, PluginState $state)
{
$extra = $this->package->getExtra();
unset($extra['merge-plugin']);
if (!$state->shouldMergeExtra() || empty($extra)) {
return;
}
$rootExtra = $root->getExtra();
$unwrapped = sel... | php | public function mergeExtra(RootPackageInterface $root, PluginState $state)
{
$extra = $this->package->getExtra();
unset($extra['merge-plugin']);
if (!$state->shouldMergeExtra() || empty($extra)) {
return;
}
$rootExtra = $root->getExtra();
$unwrapped = sel... | [
"public",
"function",
"mergeExtra",
"(",
"RootPackageInterface",
"$",
"root",
",",
"PluginState",
"$",
"state",
")",
"{",
"$",
"extra",
"=",
"$",
"this",
"->",
"package",
"->",
"getExtra",
"(",
")",
";",
"unset",
"(",
"$",
"extra",
"[",
"'merge-plugin'",
... | Merge extra config into a RootPackageInterface
@param RootPackageInterface $root
@param PluginState $state | [
"Merge",
"extra",
"config",
"into",
"a",
"RootPackageInterface"
] | train | https://github.com/wikimedia/composer-merge-plugin/blob/73e4ed4fa66167823cb9bfc65fdd5fd6019722b6/src/Merge/ExtraPackage.php#L421-L452 |
wikimedia/composer-merge-plugin | src/Merge/ExtraPackage.php | ExtraPackage.mergeScripts | public function mergeScripts(RootPackageInterface $root, PluginState $state)
{
$scripts = $this->package->getScripts();
if (!$state->shouldMergeScripts() || empty($scripts)) {
return;
}
$rootScripts = $root->getScripts();
$unwrapped = self::unwrapIfNeeded($root, ... | php | public function mergeScripts(RootPackageInterface $root, PluginState $state)
{
$scripts = $this->package->getScripts();
if (!$state->shouldMergeScripts() || empty($scripts)) {
return;
}
$rootScripts = $root->getScripts();
$unwrapped = self::unwrapIfNeeded($root, ... | [
"public",
"function",
"mergeScripts",
"(",
"RootPackageInterface",
"$",
"root",
",",
"PluginState",
"$",
"state",
")",
"{",
"$",
"scripts",
"=",
"$",
"this",
"->",
"package",
"->",
"getScripts",
"(",
")",
";",
"if",
"(",
"!",
"$",
"state",
"->",
"shouldM... | Merge scripts config into a RootPackageInterface
@param RootPackageInterface $root
@param PluginState $state | [
"Merge",
"scripts",
"config",
"into",
"a",
"RootPackageInterface"
] | train | https://github.com/wikimedia/composer-merge-plugin/blob/73e4ed4fa66167823cb9bfc65fdd5fd6019722b6/src/Merge/ExtraPackage.php#L460-L479 |
wikimedia/composer-merge-plugin | src/Merge/ExtraPackage.php | ExtraPackage.mergeExtraArray | public static function mergeExtraArray($mergeDeep, $array1, $array2)
{
if ($mergeDeep) {
return NestedArray::mergeDeep($array1, $array2);
}
return array_merge($array1, $array2);
} | php | public static function mergeExtraArray($mergeDeep, $array1, $array2)
{
if ($mergeDeep) {
return NestedArray::mergeDeep($array1, $array2);
}
return array_merge($array1, $array2);
} | [
"public",
"static",
"function",
"mergeExtraArray",
"(",
"$",
"mergeDeep",
",",
"$",
"array1",
",",
"$",
"array2",
")",
"{",
"if",
"(",
"$",
"mergeDeep",
")",
"{",
"return",
"NestedArray",
"::",
"mergeDeep",
"(",
"$",
"array1",
",",
"$",
"array2",
")",
... | Merges two arrays either via arrayMergeDeep or via array_merge.
@param bool $mergeDeep
@param array $array1
@param array $array2
@return array | [
"Merges",
"two",
"arrays",
"either",
"via",
"arrayMergeDeep",
"or",
"via",
"array_merge",
"."
] | train | https://github.com/wikimedia/composer-merge-plugin/blob/73e4ed4fa66167823cb9bfc65fdd5fd6019722b6/src/Merge/ExtraPackage.php#L489-L496 |
wikimedia/composer-merge-plugin | src/Merge/ExtraPackage.php | ExtraPackage.replaceSelfVersionDependencies | protected function replaceSelfVersionDependencies(
$type,
array $links,
RootPackageInterface $root
) {
$linkType = BasePackage::$supportedLinkTypes[$type];
$version = $root->getVersion();
$prettyVersion = $root->getPrettyVersion();
$vp = $this->versionParser;
... | php | protected function replaceSelfVersionDependencies(
$type,
array $links,
RootPackageInterface $root
) {
$linkType = BasePackage::$supportedLinkTypes[$type];
$version = $root->getVersion();
$prettyVersion = $root->getPrettyVersion();
$vp = $this->versionParser;
... | [
"protected",
"function",
"replaceSelfVersionDependencies",
"(",
"$",
"type",
",",
"array",
"$",
"links",
",",
"RootPackageInterface",
"$",
"root",
")",
"{",
"$",
"linkType",
"=",
"BasePackage",
"::",
"$",
"supportedLinkTypes",
"[",
"$",
"type",
"]",
";",
"$",
... | Update Links with a 'self.version' constraint with the root package's
version.
@param string $type Link type
@param array $links
@param RootPackageInterface $root
@return array | [
"Update",
"Links",
"with",
"a",
"self",
".",
"version",
"constraint",
"with",
"the",
"root",
"package",
"s",
"version",
"."
] | train | https://github.com/wikimedia/composer-merge-plugin/blob/73e4ed4fa66167823cb9bfc65fdd5fd6019722b6/src/Merge/ExtraPackage.php#L507-L547 |
wikimedia/composer-merge-plugin | src/Merge/ExtraPackage.php | ExtraPackage.unwrapIfNeeded | public static function unwrapIfNeeded(
RootPackageInterface $root,
$method = 'setExtra'
) {
// @codeCoverageIgnoreStart
if ($root instanceof RootAliasPackage &&
!method_exists($root, $method)
) {
// Unwrap and return the aliased RootPackage.
... | php | public static function unwrapIfNeeded(
RootPackageInterface $root,
$method = 'setExtra'
) {
// @codeCoverageIgnoreStart
if ($root instanceof RootAliasPackage &&
!method_exists($root, $method)
) {
// Unwrap and return the aliased RootPackage.
... | [
"public",
"static",
"function",
"unwrapIfNeeded",
"(",
"RootPackageInterface",
"$",
"root",
",",
"$",
"method",
"=",
"'setExtra'",
")",
"{",
"// @codeCoverageIgnoreStart",
"if",
"(",
"$",
"root",
"instanceof",
"RootAliasPackage",
"&&",
"!",
"method_exists",
"(",
"... | Get a full featured Package from a RootPackageInterface.
In Composer versions before 599ad77 the RootPackageInterface only
defines a sub-set of operations needed by composer-merge-plugin and
RootAliasPackage only implemented those methods defined by the
interface. Most of the unimplemented methods in RootAliasPackage ... | [
"Get",
"a",
"full",
"featured",
"Package",
"from",
"a",
"RootPackageInterface",
"."
] | train | https://github.com/wikimedia/composer-merge-plugin/blob/73e4ed4fa66167823cb9bfc65fdd5fd6019722b6/src/Merge/ExtraPackage.php#L566-L579 |
wikimedia/composer-merge-plugin | src/Merge/ExtraPackage.php | ExtraPackage.mergeReferences | protected function mergeReferences(RootPackageInterface $root)
{
// Merge source reference information for merged packages.
// @see RootPackageLoader::load
$references = array();
$unwrapped = $this->unwrapIfNeeded($root, 'setReferences');
foreach (array('require', 'require-de... | php | protected function mergeReferences(RootPackageInterface $root)
{
// Merge source reference information for merged packages.
// @see RootPackageLoader::load
$references = array();
$unwrapped = $this->unwrapIfNeeded($root, 'setReferences');
foreach (array('require', 'require-de... | [
"protected",
"function",
"mergeReferences",
"(",
"RootPackageInterface",
"$",
"root",
")",
"{",
"// Merge source reference information for merged packages.",
"// @see RootPackageLoader::load",
"$",
"references",
"=",
"array",
"(",
")",
";",
"$",
"unwrapped",
"=",
"$",
"th... | Update the root packages reference information.
@param RootPackageInterface $root | [
"Update",
"the",
"root",
"packages",
"reference",
"information",
"."
] | train | https://github.com/wikimedia/composer-merge-plugin/blob/73e4ed4fa66167823cb9bfc65fdd5fd6019722b6/src/Merge/ExtraPackage.php#L586-L602 |
wikimedia/composer-merge-plugin | src/Merge/StabilityFlags.php | StabilityFlags.getStabilityInt | protected function getStabilityInt($name)
{
$name = VersionParser::normalizeStability($name);
return isset(BasePackage::$stabilities[$name]) ?
BasePackage::$stabilities[$name] :
BasePackage::STABILITY_STABLE;
} | php | protected function getStabilityInt($name)
{
$name = VersionParser::normalizeStability($name);
return isset(BasePackage::$stabilities[$name]) ?
BasePackage::$stabilities[$name] :
BasePackage::STABILITY_STABLE;
} | [
"protected",
"function",
"getStabilityInt",
"(",
"$",
"name",
")",
"{",
"$",
"name",
"=",
"VersionParser",
"::",
"normalizeStability",
"(",
"$",
"name",
")",
";",
"return",
"isset",
"(",
"BasePackage",
"::",
"$",
"stabilities",
"[",
"$",
"name",
"]",
")",
... | Get the stability value for a given string.
@param string $name Stability name
@return int Stability value | [
"Get",
"the",
"stability",
"value",
"for",
"a",
"given",
"string",
"."
] | train | https://github.com/wikimedia/composer-merge-plugin/blob/73e4ed4fa66167823cb9bfc65fdd5fd6019722b6/src/Merge/StabilityFlags.php#L60-L66 |
wikimedia/composer-merge-plugin | src/Merge/StabilityFlags.php | StabilityFlags.extractAll | public function extractAll(array $requires)
{
$flags = array();
foreach ($requires as $name => $link) {
$name = strtolower($name);
$version = $link->getPrettyConstraint();
$stability = $this->getExplicitStability($version);
if ($stability === null) ... | php | public function extractAll(array $requires)
{
$flags = array();
foreach ($requires as $name => $link) {
$name = strtolower($name);
$version = $link->getPrettyConstraint();
$stability = $this->getExplicitStability($version);
if ($stability === null) ... | [
"public",
"function",
"extractAll",
"(",
"array",
"$",
"requires",
")",
"{",
"$",
"flags",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"requires",
"as",
"$",
"name",
"=>",
"$",
"link",
")",
"{",
"$",
"name",
"=",
"strtolower",
"(",
"$",
"name... | Extract and merge stability flags from the given collection of
requires with another collection of stability flags.
@param array $requires New package name => link mappings
@return array Unified package name => stability mappings | [
"Extract",
"and",
"merge",
"stability",
"flags",
"from",
"the",
"given",
"collection",
"of",
"requires",
"with",
"another",
"collection",
"of",
"stability",
"flags",
"."
] | train | https://github.com/wikimedia/composer-merge-plugin/blob/73e4ed4fa66167823cb9bfc65fdd5fd6019722b6/src/Merge/StabilityFlags.php#L75-L96 |
wikimedia/composer-merge-plugin | src/Merge/StabilityFlags.php | StabilityFlags.getExplicitStability | protected function getExplicitStability($version)
{
$found = null;
$constraints = $this->splitConstraints($version);
foreach ($constraints as $constraint) {
if (preg_match($this->explicitStabilityRe, $constraint, $match)) {
$stability = $this->getStabilityInt($mat... | php | protected function getExplicitStability($version)
{
$found = null;
$constraints = $this->splitConstraints($version);
foreach ($constraints as $constraint) {
if (preg_match($this->explicitStabilityRe, $constraint, $match)) {
$stability = $this->getStabilityInt($mat... | [
"protected",
"function",
"getExplicitStability",
"(",
"$",
"version",
")",
"{",
"$",
"found",
"=",
"null",
";",
"$",
"constraints",
"=",
"$",
"this",
"->",
"splitConstraints",
"(",
"$",
"version",
")",
";",
"foreach",
"(",
"$",
"constraints",
"as",
"$",
... | Extract the most unstable explicit stability (eg '@dev') from a version
specification.
@param string $version
@return int|null Stability or null if no explict stability found | [
"Extract",
"the",
"most",
"unstable",
"explicit",
"stability",
"(",
"eg",
"@dev",
")",
"from",
"a",
"version",
"specification",
"."
] | train | https://github.com/wikimedia/composer-merge-plugin/blob/73e4ed4fa66167823cb9bfc65fdd5fd6019722b6/src/Merge/StabilityFlags.php#L106-L117 |
wikimedia/composer-merge-plugin | src/Merge/StabilityFlags.php | StabilityFlags.getCurrentStability | protected function getCurrentStability($name)
{
return isset($this->stabilityFlags[$name]) ?
$this->stabilityFlags[$name] : null;
} | php | protected function getCurrentStability($name)
{
return isset($this->stabilityFlags[$name]) ?
$this->stabilityFlags[$name] : null;
} | [
"protected",
"function",
"getCurrentStability",
"(",
"$",
"name",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"stabilityFlags",
"[",
"$",
"name",
"]",
")",
"?",
"$",
"this",
"->",
"stabilityFlags",
"[",
"$",
"name",
"]",
":",
"null",
";",
"}"
... | Get the current stability of a given package.
@param string $name
@return int|null Stability of null if not set | [
"Get",
"the",
"current",
"stability",
"of",
"a",
"given",
"package",
"."
] | train | https://github.com/wikimedia/composer-merge-plugin/blob/73e4ed4fa66167823cb9bfc65fdd5fd6019722b6/src/Merge/StabilityFlags.php#L175-L179 |
spatie/opening-hours | src/OpeningHours.php | OpeningHours.mergeOverlappingRanges | public static function mergeOverlappingRanges(array $data)
{
$result = [];
$ranges = [];
foreach ($data as $key => $value) {
$value = is_array($value)
? static::mergeOverlappingRanges($value)
: (is_string($value) ? TimeRange::fromString($value) : $... | php | public static function mergeOverlappingRanges(array $data)
{
$result = [];
$ranges = [];
foreach ($data as $key => $value) {
$value = is_array($value)
? static::mergeOverlappingRanges($value)
: (is_string($value) ? TimeRange::fromString($value) : $... | [
"public",
"static",
"function",
"mergeOverlappingRanges",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"ranges",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
... | @param array $data
@return array | [
"@param",
"array",
"$data"
] | train | https://github.com/spatie/opening-hours/blob/b6b141ac1749514e09bca26de87afeb10a4b53c4/src/OpeningHours.php#L55-L94 |
spatie/opening-hours | src/OpeningHoursForDay.php | OpeningHoursForDay.openingHoursFilter | public function openingHoursFilter(array $filters)
{
foreach ($this->openingHours as $timeRange) {
foreach ($filters as $filter) {
if ($result = $filter($timeRange)) {
reset($timeRange);
return $result;
}
}
... | php | public function openingHoursFilter(array $filters)
{
foreach ($this->openingHours as $timeRange) {
foreach ($filters as $filter) {
if ($result = $filter($timeRange)) {
reset($timeRange);
return $result;
}
}
... | [
"public",
"function",
"openingHoursFilter",
"(",
"array",
"$",
"filters",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"openingHours",
"as",
"$",
"timeRange",
")",
"{",
"foreach",
"(",
"$",
"filters",
"as",
"$",
"filter",
")",
"{",
"if",
"(",
"$",
"res... | @param callable[] $filters
@return Time|bool | [
"@param",
"callable",
"[]",
"$filters"
] | train | https://github.com/spatie/opening-hours/blob/b6b141ac1749514e09bca26de87afeb10a4b53c4/src/OpeningHoursForDay.php#L61-L74 |
spatie/opening-hours | src/OpeningHoursForDay.php | OpeningHoursForDay.nextOpen | public function nextOpen(Time $time)
{
return $this->openingHoursFilter([
function ($timeRange) use ($time) {
return $this->findNextOpenInFreeTime($time, $timeRange);
},
]);
} | php | public function nextOpen(Time $time)
{
return $this->openingHoursFilter([
function ($timeRange) use ($time) {
return $this->findNextOpenInFreeTime($time, $timeRange);
},
]);
} | [
"public",
"function",
"nextOpen",
"(",
"Time",
"$",
"time",
")",
"{",
"return",
"$",
"this",
"->",
"openingHoursFilter",
"(",
"[",
"function",
"(",
"$",
"timeRange",
")",
"use",
"(",
"$",
"time",
")",
"{",
"return",
"$",
"this",
"->",
"findNextOpenInFree... | @param Time $time
@return bool|Time | [
"@param",
"Time",
"$time"
] | train | https://github.com/spatie/opening-hours/blob/b6b141ac1749514e09bca26de87afeb10a4b53c4/src/OpeningHoursForDay.php#L81-L88 |
spatie/opening-hours | src/OpeningHoursForDay.php | OpeningHoursForDay.nextClose | public function nextClose(Time $time)
{
return $this->openingHoursFilter([
function ($timeRange) use ($time) {
return $this->findNextCloseInWorkingHours($time, $timeRange);
},
function ($timeRange) use ($time) {
return $this->findNextCloseI... | php | public function nextClose(Time $time)
{
return $this->openingHoursFilter([
function ($timeRange) use ($time) {
return $this->findNextCloseInWorkingHours($time, $timeRange);
},
function ($timeRange) use ($time) {
return $this->findNextCloseI... | [
"public",
"function",
"nextClose",
"(",
"Time",
"$",
"time",
")",
"{",
"return",
"$",
"this",
"->",
"openingHoursFilter",
"(",
"[",
"function",
"(",
"$",
"timeRange",
")",
"use",
"(",
"$",
"time",
")",
"{",
"return",
"$",
"this",
"->",
"findNextCloseInWo... | @param Time $time
@return bool|Time | [
"@param",
"Time",
"$time"
] | train | https://github.com/spatie/opening-hours/blob/b6b141ac1749514e09bca26de87afeb10a4b53c4/src/OpeningHoursForDay.php#L95-L105 |
nategood/httpful | examples/override.php | SimpleCsvHandler.serialize | public function serialize($payload)
{
$serialized = '';
foreach ($payload as $line) {
$serialized .= '"' . implode('","', $line) . '"' . "\n";
}
return $serialized;
} | php | public function serialize($payload)
{
$serialized = '';
foreach ($payload as $line) {
$serialized .= '"' . implode('","', $line) . '"' . "\n";
}
return $serialized;
} | [
"public",
"function",
"serialize",
"(",
"$",
"payload",
")",
"{",
"$",
"serialized",
"=",
"''",
";",
"foreach",
"(",
"$",
"payload",
"as",
"$",
"line",
")",
"{",
"$",
"serialized",
".=",
"'\"'",
".",
"implode",
"(",
"'\",\"'",
",",
"$",
"line",
")",
... | Takes a two dimensional array and turns it
into a serialized string to include as the
body of a request
@param mixed $payload
@return string | [
"Takes",
"a",
"two",
"dimensional",
"array",
"and",
"turns",
"it",
"into",
"a",
"serialized",
"string",
"to",
"include",
"as",
"the",
"body",
"of",
"a",
"request"
] | train | https://github.com/nategood/httpful/blob/a29ca5ce347bca69b13a5b8d68b2e43af32e9706/examples/override.php#L34-L41 |
nategood/httpful | src/Httpful/Bootstrap.php | Bootstrap.registerHandlers | public static function registerHandlers()
{
if (self::$registered === true) {
return;
}
// @todo check a conf file to load from that instead of
// hardcoding into the library?
$handlers = array(
\Httpful\Mime::JSON => new \Httpful\Handlers\JsonHandler... | php | public static function registerHandlers()
{
if (self::$registered === true) {
return;
}
// @todo check a conf file to load from that instead of
// hardcoding into the library?
$handlers = array(
\Httpful\Mime::JSON => new \Httpful\Handlers\JsonHandler... | [
"public",
"static",
"function",
"registerHandlers",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"registered",
"===",
"true",
")",
"{",
"return",
";",
"}",
"// @todo check a conf file to load from that instead of",
"// hardcoding into the library?",
"$",
"handlers",
"... | Register default mime handlers. Is idempotent. | [
"Register",
"default",
"mime",
"handlers",
".",
"Is",
"idempotent",
"."
] | train | https://github.com/nategood/httpful/blob/a29ca5ce347bca69b13a5b8d68b2e43af32e9706/src/Httpful/Bootstrap.php#L73-L96 |
nategood/httpful | src/Httpful/Request.php | Request.followRedirects | public function followRedirects($follow = true)
{
$this->max_redirects = $follow === true ? self::MAX_REDIRECTS_DEFAULT : max(0, $follow);
$this->follow_redirects = (bool) $follow;
return $this;
} | php | public function followRedirects($follow = true)
{
$this->max_redirects = $follow === true ? self::MAX_REDIRECTS_DEFAULT : max(0, $follow);
$this->follow_redirects = (bool) $follow;
return $this;
} | [
"public",
"function",
"followRedirects",
"(",
"$",
"follow",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"max_redirects",
"=",
"$",
"follow",
"===",
"true",
"?",
"self",
"::",
"MAX_REDIRECTS_DEFAULT",
":",
"max",
"(",
"0",
",",
"$",
"follow",
")",
";",
"... | If the response is a 301 or 302 redirect, automatically
send off another request to that location
@param bool|int $follow follow or not to follow or maximal number of redirects
@return Request | [
"If",
"the",
"response",
"is",
"a",
"301",
"or",
"302",
"redirect",
"automatically",
"send",
"off",
"another",
"request",
"to",
"that",
"location"
] | train | https://github.com/nategood/httpful/blob/a29ca5ce347bca69b13a5b8d68b2e43af32e9706/src/Httpful/Request.php#L201-L206 |
nategood/httpful | src/Httpful/Request.php | Request.send | public function send()
{
if (!$this->hasBeenInitialized())
$this->_curlPrep();
$result = curl_exec($this->_ch);
$response = $this->buildResponse($result);
curl_close($this->_ch);
unset($this->_ch);
return $response;
} | php | public function send()
{
if (!$this->hasBeenInitialized())
$this->_curlPrep();
$result = curl_exec($this->_ch);
$response = $this->buildResponse($result);
curl_close($this->_ch);
unset($this->_ch);
return $response;
} | [
"public",
"function",
"send",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasBeenInitialized",
"(",
")",
")",
"$",
"this",
"->",
"_curlPrep",
"(",
")",
";",
"$",
"result",
"=",
"curl_exec",
"(",
"$",
"this",
"->",
"_ch",
")",
";",
"$",
"re... | Actually send off the request, and parse the response
@return Response with parsed results
@throws ConnectionErrorException when unable to parse or communicate w server | [
"Actually",
"send",
"off",
"the",
"request",
"and",
"parse",
"the",
"response"
] | train | https://github.com/nategood/httpful/blob/a29ca5ce347bca69b13a5b8d68b2e43af32e9706/src/Httpful/Request.php#L222-L235 |
nategood/httpful | src/Httpful/Request.php | Request.basicAuth | public function basicAuth($username, $password)
{
$this->username = $username;
$this->password = $password;
return $this;
} | php | public function basicAuth($username, $password)
{
$this->username = $username;
$this->password = $password;
return $this;
} | [
"public",
"function",
"basicAuth",
"(",
"$",
"username",
",",
"$",
"password",
")",
"{",
"$",
"this",
"->",
"username",
"=",
"$",
"username",
";",
"$",
"this",
"->",
"password",
"=",
"$",
"password",
";",
"return",
"$",
"this",
";",
"}"
] | User Basic Auth.
Only use when over SSL/TSL/HTTPS.
@param string $username
@param string $password
@return Request | [
"User",
"Basic",
"Auth",
".",
"Only",
"use",
"when",
"over",
"SSL",
"/",
"TSL",
"/",
"HTTPS",
"."
] | train | https://github.com/nategood/httpful/blob/a29ca5ce347bca69b13a5b8d68b2e43af32e9706/src/Httpful/Request.php#L260-L265 |
nategood/httpful | src/Httpful/Request.php | Request.digestAuth | public function digestAuth($username, $password)
{
$this->addOnCurlOption(CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
return $this->basicAuth($username, $password);
} | php | public function digestAuth($username, $password)
{
$this->addOnCurlOption(CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
return $this->basicAuth($username, $password);
} | [
"public",
"function",
"digestAuth",
"(",
"$",
"username",
",",
"$",
"password",
")",
"{",
"$",
"this",
"->",
"addOnCurlOption",
"(",
"CURLOPT_HTTPAUTH",
",",
"CURLAUTH_DIGEST",
")",
";",
"return",
"$",
"this",
"->",
"basicAuth",
"(",
"$",
"username",
",",
... | User Digest Auth.
@param string $username
@param string $password
@return Request | [
"User",
"Digest",
"Auth",
"."
] | train | https://github.com/nategood/httpful/blob/a29ca5ce347bca69b13a5b8d68b2e43af32e9706/src/Httpful/Request.php#L295-L299 |
nategood/httpful | src/Httpful/Request.php | Request.clientSideCert | public function clientSideCert($cert, $key, $passphrase = null, $encoding = 'PEM')
{
$this->client_cert = $cert;
$this->client_key = $key;
$this->client_passphrase = $passphrase;
$this->client_encoding = $encoding;
return $this;
} | php | public function clientSideCert($cert, $key, $passphrase = null, $encoding = 'PEM')
{
$this->client_cert = $cert;
$this->client_key = $key;
$this->client_passphrase = $passphrase;
$this->client_encoding = $encoding;
return $this;
} | [
"public",
"function",
"clientSideCert",
"(",
"$",
"cert",
",",
"$",
"key",
",",
"$",
"passphrase",
"=",
"null",
",",
"$",
"encoding",
"=",
"'PEM'",
")",
"{",
"$",
"this",
"->",
"client_cert",
"=",
"$",
"cert",
";",
"$",
"this",
"->",
"client_key",
"=... | Use Client Side Cert Authentication
@param string $key file path to client key
@param string $cert file path to client cert
@param string $passphrase for client key
@param string $encoding default PEM
@return Request | [
"Use",
"Client",
"Side",
"Cert",
"Authentication"
] | train | https://github.com/nategood/httpful/blob/a29ca5ce347bca69b13a5b8d68b2e43af32e9706/src/Httpful/Request.php#L323-L331 |
nategood/httpful | src/Httpful/Request.php | Request.body | public function body($payload, $mimeType = null)
{
$this->mime($mimeType);
$this->payload = $payload;
// Iserntentially don't call _serializePayload yet. Wait until
// we actually send off the request to convert payload to string.
// At that time, the `serialized_payload` is... | php | public function body($payload, $mimeType = null)
{
$this->mime($mimeType);
$this->payload = $payload;
// Iserntentially don't call _serializePayload yet. Wait until
// we actually send off the request to convert payload to string.
// At that time, the `serialized_payload` is... | [
"public",
"function",
"body",
"(",
"$",
"payload",
",",
"$",
"mimeType",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"mime",
"(",
"$",
"mimeType",
")",
";",
"$",
"this",
"->",
"payload",
"=",
"$",
"payload",
";",
"// Iserntentially don't call _serializePaylo... | Set the body of the request
@param mixed $payload
@param string $mimeType currently, sets the sends AND expects mime type although this
behavior may change in the next minor release (as it is a potential breaking change).
@return Request | [
"Set",
"the",
"body",
"of",
"the",
"request"
] | train | https://github.com/nategood/httpful/blob/a29ca5ce347bca69b13a5b8d68b2e43af32e9706/src/Httpful/Request.php#L345-L353 |
nategood/httpful | src/Httpful/Request.php | Request.mime | public function mime($mime)
{
if (empty($mime)) return $this;
$this->content_type = $this->expected_type = Mime::getFullMime($mime);
if ($this->isUpload()) {
$this->neverSerializePayload();
}
return $this;
} | php | public function mime($mime)
{
if (empty($mime)) return $this;
$this->content_type = $this->expected_type = Mime::getFullMime($mime);
if ($this->isUpload()) {
$this->neverSerializePayload();
}
return $this;
} | [
"public",
"function",
"mime",
"(",
"$",
"mime",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"mime",
")",
")",
"return",
"$",
"this",
";",
"$",
"this",
"->",
"content_type",
"=",
"$",
"this",
"->",
"expected_type",
"=",
"Mime",
"::",
"getFullMime",
"(",
... | Helper function to set the Content type and Expected as same in
one swoop
@param string $mime mime type to use for content type and expected return type
@return Request | [
"Helper",
"function",
"to",
"set",
"the",
"Content",
"type",
"and",
"Expected",
"as",
"same",
"in",
"one",
"swoop"
] | train | https://github.com/nategood/httpful/blob/a29ca5ce347bca69b13a5b8d68b2e43af32e9706/src/Httpful/Request.php#L361-L369 |
nategood/httpful | src/Httpful/Request.php | Request.useProxy | public function useProxy($proxy_host, $proxy_port = 80, $auth_type = null, $auth_username = null, $auth_password = null, $proxy_type = Proxy::HTTP)
{
$this->addOnCurlOption(CURLOPT_PROXY, "{$proxy_host}:{$proxy_port}");
$this->addOnCurlOption(CURLOPT_PROXYTYPE, $proxy_type);
if (in_array($au... | php | public function useProxy($proxy_host, $proxy_port = 80, $auth_type = null, $auth_username = null, $auth_password = null, $proxy_type = Proxy::HTTP)
{
$this->addOnCurlOption(CURLOPT_PROXY, "{$proxy_host}:{$proxy_port}");
$this->addOnCurlOption(CURLOPT_PROXYTYPE, $proxy_type);
if (in_array($au... | [
"public",
"function",
"useProxy",
"(",
"$",
"proxy_host",
",",
"$",
"proxy_port",
"=",
"80",
",",
"$",
"auth_type",
"=",
"null",
",",
"$",
"auth_username",
"=",
"null",
",",
"$",
"auth_password",
"=",
"null",
",",
"$",
"proxy_type",
"=",
"Proxy",
"::",
... | Use proxy configuration
@param string $proxy_host Hostname or address of the proxy
@param int $proxy_port Port of the proxy. Default 80
@param string $auth_type Authentication type or null. Accepted values are CURLAUTH_BASIC, CURLAUTH_NTLM. Default null, no authentication
@param string $auth_username Authentication use... | [
"Use",
"proxy",
"configuration"
] | train | https://github.com/nategood/httpful/blob/a29ca5ce347bca69b13a5b8d68b2e43af32e9706/src/Httpful/Request.php#L480-L489 |
nategood/httpful | src/Httpful/Request.php | Request.useSocks4Proxy | public function useSocks4Proxy($proxy_host, $proxy_port = 80, $auth_type = null, $auth_username = null, $auth_password = null)
{
return $this->useProxy($proxy_host, $proxy_port, $auth_type, $auth_username, $auth_password, Proxy::SOCKS4);
} | php | public function useSocks4Proxy($proxy_host, $proxy_port = 80, $auth_type = null, $auth_username = null, $auth_password = null)
{
return $this->useProxy($proxy_host, $proxy_port, $auth_type, $auth_username, $auth_password, Proxy::SOCKS4);
} | [
"public",
"function",
"useSocks4Proxy",
"(",
"$",
"proxy_host",
",",
"$",
"proxy_port",
"=",
"80",
",",
"$",
"auth_type",
"=",
"null",
",",
"$",
"auth_username",
"=",
"null",
",",
"$",
"auth_password",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
... | Shortcut for useProxy to configure SOCKS 4 proxy
@see Request::useProxy
@return Request | [
"Shortcut",
"for",
"useProxy",
"to",
"configure",
"SOCKS",
"4",
"proxy"
] | train | https://github.com/nategood/httpful/blob/a29ca5ce347bca69b13a5b8d68b2e43af32e9706/src/Httpful/Request.php#L496-L499 |
nategood/httpful | src/Httpful/Request.php | Request.useSocks5Proxy | public function useSocks5Proxy($proxy_host, $proxy_port = 80, $auth_type = null, $auth_username = null, $auth_password = null)
{
return $this->useProxy($proxy_host, $proxy_port, $auth_type, $auth_username, $auth_password, Proxy::SOCKS5);
} | php | public function useSocks5Proxy($proxy_host, $proxy_port = 80, $auth_type = null, $auth_username = null, $auth_password = null)
{
return $this->useProxy($proxy_host, $proxy_port, $auth_type, $auth_username, $auth_password, Proxy::SOCKS5);
} | [
"public",
"function",
"useSocks5Proxy",
"(",
"$",
"proxy_host",
",",
"$",
"proxy_port",
"=",
"80",
",",
"$",
"auth_type",
"=",
"null",
",",
"$",
"auth_username",
"=",
"null",
",",
"$",
"auth_password",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
... | Shortcut for useProxy to configure SOCKS 5 proxy
@see Request::useProxy
@return Request | [
"Shortcut",
"for",
"useProxy",
"to",
"configure",
"SOCKS",
"5",
"proxy"
] | train | https://github.com/nategood/httpful/blob/a29ca5ce347bca69b13a5b8d68b2e43af32e9706/src/Httpful/Request.php#L506-L509 |
nategood/httpful | src/Httpful/Request.php | Request.registerPayloadSerializer | public function registerPayloadSerializer($mime, \Closure $callback)
{
$this->payload_serializers[Mime::getFullMime($mime)] = $callback;
return $this;
} | php | public function registerPayloadSerializer($mime, \Closure $callback)
{
$this->payload_serializers[Mime::getFullMime($mime)] = $callback;
return $this;
} | [
"public",
"function",
"registerPayloadSerializer",
"(",
"$",
"mime",
",",
"\\",
"Closure",
"$",
"callback",
")",
"{",
"$",
"this",
"->",
"payload_serializers",
"[",
"Mime",
"::",
"getFullMime",
"(",
"$",
"mime",
")",
"]",
"=",
"$",
"callback",
";",
"return... | Register a callback that will be used to serialize the payload
for a particular mime type. When using "*" for the mime
type, it will use that parser for all responses regardless of the mime
type. If a custom '*' and 'application/json' exist, the custom
'application/json' would take precedence over the '*' callback.
... | [
"Register",
"a",
"callback",
"that",
"will",
"be",
"used",
"to",
"serialize",
"the",
"payload",
"for",
"a",
"particular",
"mime",
"type",
".",
"When",
"using",
"*",
"for",
"the",
"mime",
"type",
"it",
"will",
"use",
"that",
"parser",
"for",
"all",
"respo... | train | https://github.com/nategood/httpful/blob/a29ca5ce347bca69b13a5b8d68b2e43af32e9706/src/Httpful/Request.php#L700-L704 |
nategood/httpful | src/Httpful/Request.php | Request._setDefaults | private function _setDefaults()
{
if (!isset(self::$_template))
self::_initializeDefaults();
foreach (self::$_template as $k=>$v) {
if ($k[0] != '_')
$this->$k = $v;
}
return $this;
} | php | private function _setDefaults()
{
if (!isset(self::$_template))
self::_initializeDefaults();
foreach (self::$_template as $k=>$v) {
if ($k[0] != '_')
$this->$k = $v;
}
return $this;
} | [
"private",
"function",
"_setDefaults",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"_template",
")",
")",
"self",
"::",
"_initializeDefaults",
"(",
")",
";",
"foreach",
"(",
"self",
"::",
"$",
"_template",
"as",
"$",
"k",
"=>",
"$... | Set the defaults on a newly instantiated object
Doesn't copy variables prefixed with _
@return Request | [
"Set",
"the",
"defaults",
"on",
"a",
"newly",
"instantiated",
"object",
"Doesn",
"t",
"copy",
"variables",
"prefixed",
"with",
"_"
] | train | https://github.com/nategood/httpful/blob/a29ca5ce347bca69b13a5b8d68b2e43af32e9706/src/Httpful/Request.php#L806-L815 |
nategood/httpful | src/Httpful/Request.php | Request.init | public static function init($method = null, $mime = null)
{
// Setup our handlers, can call it here as it's idempotent
Bootstrap::init();
// Setup the default template if need be
if (!isset(self::$_template))
self::_initializeDefaults();
$request = new Request()... | php | public static function init($method = null, $mime = null)
{
// Setup our handlers, can call it here as it's idempotent
Bootstrap::init();
// Setup the default template if need be
if (!isset(self::$_template))
self::_initializeDefaults();
$request = new Request()... | [
"public",
"static",
"function",
"init",
"(",
"$",
"method",
"=",
"null",
",",
"$",
"mime",
"=",
"null",
")",
"{",
"// Setup our handlers, can call it here as it's idempotent",
"Bootstrap",
"::",
"init",
"(",
")",
";",
"// Setup the default template if need be",
"if",
... | Factory style constructor works nicer for chaining. This
should also really only be used internally. The Request::get,
Request::post syntax is preferred as it is more readable.
@param string $method Http Method
@param string $mime Mime Type to Use
@return Request | [
"Factory",
"style",
"constructor",
"works",
"nicer",
"for",
"chaining",
".",
"This",
"should",
"also",
"really",
"only",
"be",
"used",
"internally",
".",
"The",
"Request",
"::",
"get",
"Request",
"::",
"post",
"syntax",
"is",
"preferred",
"as",
"it",
"is",
... | train | https://github.com/nategood/httpful/blob/a29ca5ce347bca69b13a5b8d68b2e43af32e9706/src/Httpful/Request.php#L836-L851 |
nategood/httpful | src/Httpful/Request.php | Request._curlPrep | public function _curlPrep()
{
// Check for required stuff
if (!isset($this->uri))
throw new \Exception('Attempting to send a request before defining a URI endpoint.');
if (isset($this->payload)) {
$this->serialized_payload = $this->_serializePayload($this->payload);
... | php | public function _curlPrep()
{
// Check for required stuff
if (!isset($this->uri))
throw new \Exception('Attempting to send a request before defining a URI endpoint.');
if (isset($this->payload)) {
$this->serialized_payload = $this->_serializePayload($this->payload);
... | [
"public",
"function",
"_curlPrep",
"(",
")",
"{",
"// Check for required stuff",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"uri",
")",
")",
"throw",
"new",
"\\",
"Exception",
"(",
"'Attempting to send a request before defining a URI endpoint.'",
")",
";",
"... | Does the heavy lifting. Uses de facto HTTP
library cURL to set up the HTTP request.
Note: It does NOT actually send the request
@return Request
@throws \Exception | [
"Does",
"the",
"heavy",
"lifting",
".",
"Uses",
"de",
"facto",
"HTTP",
"library",
"cURL",
"to",
"set",
"up",
"the",
"HTTP",
"request",
".",
"Note",
":",
"It",
"does",
"NOT",
"actually",
"send",
"the",
"request"
] | train | https://github.com/nategood/httpful/blob/a29ca5ce347bca69b13a5b8d68b2e43af32e9706/src/Httpful/Request.php#L860-L989 |
nategood/httpful | src/Httpful/Request.php | Request.buildResponse | public function buildResponse($result) {
if ($result === false) {
if ($curlErrorNumber = curl_errno($this->_ch)) {
$curlErrorString = curl_error($this->_ch);
$this->_error($curlErrorString);
$exception = new ConnectionErrorException('Unable to connect... | php | public function buildResponse($result) {
if ($result === false) {
if ($curlErrorNumber = curl_errno($this->_ch)) {
$curlErrorString = curl_error($this->_ch);
$this->_error($curlErrorString);
$exception = new ConnectionErrorException('Unable to connect... | [
"public",
"function",
"buildResponse",
"(",
"$",
"result",
")",
"{",
"if",
"(",
"$",
"result",
"===",
"false",
")",
"{",
"if",
"(",
"$",
"curlErrorNumber",
"=",
"curl_errno",
"(",
"$",
"this",
"->",
"_ch",
")",
")",
"{",
"$",
"curlErrorString",
"=",
... | Takes a curl result and generates a Response from it
@return Response | [
"Takes",
"a",
"curl",
"result",
"and",
"generates",
"a",
"Response",
"from",
"it"
] | train | https://github.com/nategood/httpful/blob/a29ca5ce347bca69b13a5b8d68b2e43af32e9706/src/Httpful/Request.php#L1054-L1087 |
nategood/httpful | src/Httpful/Request.php | Request._serializePayload | private function _serializePayload($payload)
{
if (empty($payload) || $this->serialize_payload_method === self::SERIALIZE_PAYLOAD_NEVER)
return $payload;
// When we are in "smart" mode, don't serialize strings/scalars, assume they are already serialized
if ($this->serialize_payl... | php | private function _serializePayload($payload)
{
if (empty($payload) || $this->serialize_payload_method === self::SERIALIZE_PAYLOAD_NEVER)
return $payload;
// When we are in "smart" mode, don't serialize strings/scalars, assume they are already serialized
if ($this->serialize_payl... | [
"private",
"function",
"_serializePayload",
"(",
"$",
"payload",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"payload",
")",
"||",
"$",
"this",
"->",
"serialize_payload_method",
"===",
"self",
"::",
"SERIALIZE_PAYLOAD_NEVER",
")",
"return",
"$",
"payload",
";",
... | Turn payload from structured data into
a string based on the current Mime type.
This uses the auto_serialize option to determine
it's course of action. See serialize method for more.
Renamed from _detectPayload to _serializePayload as of
2012-02-15.
Added in support for custom payload serializers.
The serialize_paylo... | [
"Turn",
"payload",
"from",
"structured",
"data",
"into",
"a",
"string",
"based",
"on",
"the",
"current",
"Mime",
"type",
".",
"This",
"uses",
"the",
"auto_serialize",
"option",
"to",
"determine",
"it",
"s",
"course",
"of",
"action",
".",
"See",
"serialize",
... | train | https://github.com/nategood/httpful/blob/a29ca5ce347bca69b13a5b8d68b2e43af32e9706/src/Httpful/Request.php#L1117-L1133 |
nategood/httpful | src/Httpful/Request.php | Request.get | public static function get($uri, $mime = null)
{
return self::init(Http::GET)->uri($uri)->mime($mime);
} | php | public static function get($uri, $mime = null)
{
return self::init(Http::GET)->uri($uri)->mime($mime);
} | [
"public",
"static",
"function",
"get",
"(",
"$",
"uri",
",",
"$",
"mime",
"=",
"null",
")",
"{",
"return",
"self",
"::",
"init",
"(",
"Http",
"::",
"GET",
")",
"->",
"uri",
"(",
"$",
"uri",
")",
"->",
"mime",
"(",
"$",
"mime",
")",
";",
"}"
] | HTTP Method Get
@param string $uri optional uri to use
@param string $mime expected
@return Request | [
"HTTP",
"Method",
"Get"
] | train | https://github.com/nategood/httpful/blob/a29ca5ce347bca69b13a5b8d68b2e43af32e9706/src/Httpful/Request.php#L1141-L1144 |
nategood/httpful | src/Httpful/Request.php | Request.post | public static function post($uri, $payload = null, $mime = null)
{
return self::init(Http::POST)->uri($uri)->body($payload, $mime);
} | php | public static function post($uri, $payload = null, $mime = null)
{
return self::init(Http::POST)->uri($uri)->body($payload, $mime);
} | [
"public",
"static",
"function",
"post",
"(",
"$",
"uri",
",",
"$",
"payload",
"=",
"null",
",",
"$",
"mime",
"=",
"null",
")",
"{",
"return",
"self",
"::",
"init",
"(",
"Http",
"::",
"POST",
")",
"->",
"uri",
"(",
"$",
"uri",
")",
"->",
"body",
... | HTTP Method Post
@param string $uri optional uri to use
@param string $payload data to send in body of request
@param string $mime MIME to use for Content-Type
@return Request | [
"HTTP",
"Method",
"Post"
] | train | https://github.com/nategood/httpful/blob/a29ca5ce347bca69b13a5b8d68b2e43af32e9706/src/Httpful/Request.php#L1166-L1169 |
nategood/httpful | src/Httpful/Request.php | Request.put | public static function put($uri, $payload = null, $mime = null)
{
return self::init(Http::PUT)->uri($uri)->body($payload, $mime);
} | php | public static function put($uri, $payload = null, $mime = null)
{
return self::init(Http::PUT)->uri($uri)->body($payload, $mime);
} | [
"public",
"static",
"function",
"put",
"(",
"$",
"uri",
",",
"$",
"payload",
"=",
"null",
",",
"$",
"mime",
"=",
"null",
")",
"{",
"return",
"self",
"::",
"init",
"(",
"Http",
"::",
"PUT",
")",
"->",
"uri",
"(",
"$",
"uri",
")",
"->",
"body",
"... | HTTP Method Put
@param string $uri optional uri to use
@param string $payload data to send in body of request
@param string $mime MIME to use for Content-Type
@return Request | [
"HTTP",
"Method",
"Put"
] | train | https://github.com/nategood/httpful/blob/a29ca5ce347bca69b13a5b8d68b2e43af32e9706/src/Httpful/Request.php#L1178-L1181 |
nategood/httpful | src/Httpful/Request.php | Request.patch | public static function patch($uri, $payload = null, $mime = null)
{
return self::init(Http::PATCH)->uri($uri)->body($payload, $mime);
} | php | public static function patch($uri, $payload = null, $mime = null)
{
return self::init(Http::PATCH)->uri($uri)->body($payload, $mime);
} | [
"public",
"static",
"function",
"patch",
"(",
"$",
"uri",
",",
"$",
"payload",
"=",
"null",
",",
"$",
"mime",
"=",
"null",
")",
"{",
"return",
"self",
"::",
"init",
"(",
"Http",
"::",
"PATCH",
")",
"->",
"uri",
"(",
"$",
"uri",
")",
"->",
"body",... | HTTP Method Patch
@param string $uri optional uri to use
@param string $payload data to send in body of request
@param string $mime MIME to use for Content-Type
@return Request | [
"HTTP",
"Method",
"Patch"
] | train | https://github.com/nategood/httpful/blob/a29ca5ce347bca69b13a5b8d68b2e43af32e9706/src/Httpful/Request.php#L1190-L1193 |
nategood/httpful | src/Httpful/Request.php | Request.delete | public static function delete($uri, $mime = null)
{
return self::init(Http::DELETE)->uri($uri)->mime($mime);
} | php | public static function delete($uri, $mime = null)
{
return self::init(Http::DELETE)->uri($uri)->mime($mime);
} | [
"public",
"static",
"function",
"delete",
"(",
"$",
"uri",
",",
"$",
"mime",
"=",
"null",
")",
"{",
"return",
"self",
"::",
"init",
"(",
"Http",
"::",
"DELETE",
")",
"->",
"uri",
"(",
"$",
"uri",
")",
"->",
"mime",
"(",
"$",
"mime",
")",
";",
"... | HTTP Method Delete
@param string $uri optional uri to use
@return Request | [
"HTTP",
"Method",
"Delete"
] | train | https://github.com/nategood/httpful/blob/a29ca5ce347bca69b13a5b8d68b2e43af32e9706/src/Httpful/Request.php#L1200-L1203 |
nategood/httpful | src/Httpful/Response.php | Response._parse | public function _parse($body)
{
// If the user decided to forgo the automatic
// smart parsing, short circuit.
if (!$this->request->auto_parse) {
return $body;
}
// If provided, use custom parsing callback
if (isset($this->request->parse_callback)) {
... | php | public function _parse($body)
{
// If the user decided to forgo the automatic
// smart parsing, short circuit.
if (!$this->request->auto_parse) {
return $body;
}
// If provided, use custom parsing callback
if (isset($this->request->parse_callback)) {
... | [
"public",
"function",
"_parse",
"(",
"$",
"body",
")",
"{",
"// If the user decided to forgo the automatic",
"// smart parsing, short circuit.",
"if",
"(",
"!",
"$",
"this",
"->",
"request",
"->",
"auto_parse",
")",
"{",
"return",
"$",
"body",
";",
"}",
"// If pro... | Parse the response into a clean data structure
(most often an associative array) based on the expected
Mime type.
@param string Http response body
@return array|string|object the response parse accordingly | [
"Parse",
"the",
"response",
"into",
"a",
"clean",
"data",
"structure",
"(",
"most",
"often",
"an",
"associative",
"array",
")",
"based",
"on",
"the",
"expected",
"Mime",
"type",
"."
] | train | https://github.com/nategood/httpful/blob/a29ca5ce347bca69b13a5b8d68b2e43af32e9706/src/Httpful/Response.php#L82-L108 |
nategood/httpful | src/Httpful/Response.php | Response._interpretHeaders | public function _interpretHeaders()
{
// Parse the Content-Type and charset
$content_type = isset($this->headers['Content-Type']) ? $this->headers['Content-Type'] : '';
$content_type = explode(';', $content_type);
$this->content_type = $content_type[0];
if (count($content_ty... | php | public function _interpretHeaders()
{
// Parse the Content-Type and charset
$content_type = isset($this->headers['Content-Type']) ? $this->headers['Content-Type'] : '';
$content_type = explode(';', $content_type);
$this->content_type = $content_type[0];
if (count($content_ty... | [
"public",
"function",
"_interpretHeaders",
"(",
")",
"{",
"// Parse the Content-Type and charset",
"$",
"content_type",
"=",
"isset",
"(",
"$",
"this",
"->",
"headers",
"[",
"'Content-Type'",
"]",
")",
"?",
"$",
"this",
"->",
"headers",
"[",
"'Content-Type'",
"]... | After we've parse the headers, let's clean things
up a bit and treat some headers specially | [
"After",
"we",
"ve",
"parse",
"the",
"headers",
"let",
"s",
"clean",
"things",
"up",
"a",
"bit",
"and",
"treat",
"some",
"headers",
"specially"
] | train | https://github.com/nategood/httpful/blob/a29ca5ce347bca69b13a5b8d68b2e43af32e9706/src/Httpful/Response.php#L136-L169 |
nategood/httpful | src/Httpful/Mime.php | Mime.getFullMime | public static function getFullMime($short_name)
{
return array_key_exists($short_name, self::$mimes) ? self::$mimes[$short_name] : $short_name;
} | php | public static function getFullMime($short_name)
{
return array_key_exists($short_name, self::$mimes) ? self::$mimes[$short_name] : $short_name;
} | [
"public",
"static",
"function",
"getFullMime",
"(",
"$",
"short_name",
")",
"{",
"return",
"array_key_exists",
"(",
"$",
"short_name",
",",
"self",
"::",
"$",
"mimes",
")",
"?",
"self",
"::",
"$",
"mimes",
"[",
"$",
"short_name",
"]",
":",
"$",
"short_na... | Get the full Mime Type name from a "short name".
Returns the short if no mapping was found.
@param string $short_name common name for mime type (e.g. json)
@return string full mime type (e.g. application/json) | [
"Get",
"the",
"full",
"Mime",
"Type",
"name",
"from",
"a",
"short",
"name",
".",
"Returns",
"the",
"short",
"if",
"no",
"mapping",
"was",
"found",
"."
] | train | https://github.com/nategood/httpful/blob/a29ca5ce347bca69b13a5b8d68b2e43af32e9706/src/Httpful/Mime.php#L47-L50 |
spatie/laravel-google-calendar | src/GoogleCalendar.php | GoogleCalendar.listEvents | public function listEvents(Carbon $startDateTime = null, Carbon $endDateTime = null, array $queryParameters = []): array
{
$parameters = [
'singleEvents' => true,
'orderBy' => 'startTime',
];
if (is_null($startDateTime)) {
$startDateTime = Carbon::now()->... | php | public function listEvents(Carbon $startDateTime = null, Carbon $endDateTime = null, array $queryParameters = []): array
{
$parameters = [
'singleEvents' => true,
'orderBy' => 'startTime',
];
if (is_null($startDateTime)) {
$startDateTime = Carbon::now()->... | [
"public",
"function",
"listEvents",
"(",
"Carbon",
"$",
"startDateTime",
"=",
"null",
",",
"Carbon",
"$",
"endDateTime",
"=",
"null",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
")",
":",
"array",
"{",
"$",
"parameters",
"=",
"[",
"'singleEvents'"... | /*
@link https://developers.google.com/google-apps/calendar/v3/reference/events/list | [
"/",
"*"
] | train | https://github.com/spatie/laravel-google-calendar/blob/d4bdf555c4c57cdc75148e88787fdf280dd6a1e7/src/GoogleCalendar.php#L33-L58 |
spatie/laravel-google-calendar | src/GoogleCalendar.php | GoogleCalendar.insertEvent | public function insertEvent($event, $optParams = []): Google_Service_Calendar_Event
{
if ($event instanceof Event) {
$event = $event->googleEvent;
}
return $this->calendarService->events->insert($this->calendarId, $event, $optParams);
} | php | public function insertEvent($event, $optParams = []): Google_Service_Calendar_Event
{
if ($event instanceof Event) {
$event = $event->googleEvent;
}
return $this->calendarService->events->insert($this->calendarId, $event, $optParams);
} | [
"public",
"function",
"insertEvent",
"(",
"$",
"event",
",",
"$",
"optParams",
"=",
"[",
"]",
")",
":",
"Google_Service_Calendar_Event",
"{",
"if",
"(",
"$",
"event",
"instanceof",
"Event",
")",
"{",
"$",
"event",
"=",
"$",
"event",
"->",
"googleEvent",
... | /*
@link https://developers.google.com/google-apps/calendar/v3/reference/events/insert | [
"/",
"*"
] | train | https://github.com/spatie/laravel-google-calendar/blob/d4bdf555c4c57cdc75148e88787fdf280dd6a1e7/src/GoogleCalendar.php#L68-L75 |
spatie/laravel-google-calendar | src/Event.php | Event.createFromGoogleCalendarEvent | public static function createFromGoogleCalendarEvent(Google_Service_Calendar_Event $googleEvent, $calendarId)
{
$event = new static;
$event->googleEvent = $googleEvent;
$event->calendarId = $calendarId;
return $event;
} | php | public static function createFromGoogleCalendarEvent(Google_Service_Calendar_Event $googleEvent, $calendarId)
{
$event = new static;
$event->googleEvent = $googleEvent;
$event->calendarId = $calendarId;
return $event;
} | [
"public",
"static",
"function",
"createFromGoogleCalendarEvent",
"(",
"Google_Service_Calendar_Event",
"$",
"googleEvent",
",",
"$",
"calendarId",
")",
"{",
"$",
"event",
"=",
"new",
"static",
";",
"$",
"event",
"->",
"googleEvent",
"=",
"$",
"googleEvent",
";",
... | @param \Google_Service_Calendar_Event $googleEvent
@param $calendarId
@return static | [
"@param",
"\\",
"Google_Service_Calendar_Event",
"$googleEvent",
"@param",
"$calendarId"
] | train | https://github.com/spatie/laravel-google-calendar/blob/d4bdf555c4c57cdc75148e88787fdf280dd6a1e7/src/Event.php#L34-L42 |
spatie/laravel-google-calendar | src/Event.php | Event.create | public static function create(array $properties, string $calendarId = null, $optParams = [])
{
$event = new static;
$event->calendarId = static::getGoogleCalendar($calendarId)->getCalendarId();
foreach ($properties as $name => $value) {
$event->$name = $value;
}
... | php | public static function create(array $properties, string $calendarId = null, $optParams = [])
{
$event = new static;
$event->calendarId = static::getGoogleCalendar($calendarId)->getCalendarId();
foreach ($properties as $name => $value) {
$event->$name = $value;
}
... | [
"public",
"static",
"function",
"create",
"(",
"array",
"$",
"properties",
",",
"string",
"$",
"calendarId",
"=",
"null",
",",
"$",
"optParams",
"=",
"[",
"]",
")",
"{",
"$",
"event",
"=",
"new",
"static",
";",
"$",
"event",
"->",
"calendarId",
"=",
... | @param array $properties
@param string|null $calendarId
@return mixed | [
"@param",
"array",
"$properties",
"@param",
"string|null",
"$calendarId"
] | train | https://github.com/spatie/laravel-google-calendar/blob/d4bdf555c4c57cdc75148e88787fdf280dd6a1e7/src/Event.php#L50-L61 |
yiisoft/yii2-authclient | src/OAuth1.php | OAuth1.fetchRequestToken | public function fetchRequestToken(array $params = [])
{
$this->setAccessToken(null);
$defaultParams = [
'oauth_consumer_key' => $this->consumerKey,
'oauth_callback' => $this->getReturnUrl(),
//'xoauth_displayname' => Yii::$app->name,
];
if (!empty(... | php | public function fetchRequestToken(array $params = [])
{
$this->setAccessToken(null);
$defaultParams = [
'oauth_consumer_key' => $this->consumerKey,
'oauth_callback' => $this->getReturnUrl(),
//'xoauth_displayname' => Yii::$app->name,
];
if (!empty(... | [
"public",
"function",
"fetchRequestToken",
"(",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"setAccessToken",
"(",
"null",
")",
";",
"$",
"defaultParams",
"=",
"[",
"'oauth_consumer_key'",
"=>",
"$",
"this",
"->",
"consumerKey",
","... | Fetches the OAuth request token.
@param array $params additional request params.
@return OAuthToken request token. | [
"Fetches",
"the",
"OAuth",
"request",
"token",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OAuth1.php#L84-L111 |
yiisoft/yii2-authclient | src/OAuth1.php | OAuth1.buildAuthUrl | public function buildAuthUrl(OAuthToken $requestToken = null, array $params = [])
{
if (!is_object($requestToken)) {
$requestToken = $this->getState('requestToken');
if (!is_object($requestToken)) {
throw new InvalidParamException('Request token is required to build a... | php | public function buildAuthUrl(OAuthToken $requestToken = null, array $params = [])
{
if (!is_object($requestToken)) {
$requestToken = $this->getState('requestToken');
if (!is_object($requestToken)) {
throw new InvalidParamException('Request token is required to build a... | [
"public",
"function",
"buildAuthUrl",
"(",
"OAuthToken",
"$",
"requestToken",
"=",
"null",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"requestToken",
")",
")",
"{",
"$",
"requestToken",
"=",
"$",
"this"... | Composes user authorization URL.
@param OAuthToken $requestToken OAuth request token.
@param array $params additional request params.
@return string authorize URL
@throws InvalidParamException on failure. | [
"Composes",
"user",
"authorization",
"URL",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OAuth1.php#L120-L131 |
yiisoft/yii2-authclient | src/OAuth1.php | OAuth1.fetchAccessToken | public function fetchAccessToken($oauthToken = null, OAuthToken $requestToken = null, $oauthVerifier = null, array $params = [])
{
$incomingRequest = Yii::$app->getRequest();
if ($oauthToken === null) {
$oauthToken = $incomingRequest->get('oauth_token', $incomingRequest->post('oauth_tok... | php | public function fetchAccessToken($oauthToken = null, OAuthToken $requestToken = null, $oauthVerifier = null, array $params = [])
{
$incomingRequest = Yii::$app->getRequest();
if ($oauthToken === null) {
$oauthToken = $incomingRequest->get('oauth_token', $incomingRequest->post('oauth_tok... | [
"public",
"function",
"fetchAccessToken",
"(",
"$",
"oauthToken",
"=",
"null",
",",
"OAuthToken",
"$",
"requestToken",
"=",
"null",
",",
"$",
"oauthVerifier",
"=",
"null",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"incomingRequest",
"=",
... | Fetches OAuth access token.
@param string $oauthToken OAuth token returned with redirection back to client.
@param OAuthToken $requestToken OAuth request token.
@param string $oauthVerifier OAuth verifier.
@param array $params additional request params.
@return OAuthToken OAuth access token.
@throws InvalidParamExcepti... | [
"Fetches",
"OAuth",
"access",
"token",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OAuth1.php#L143-L190 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.