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
sequencelengths 15
672k
| func_documentation_string
stringlengths 1
47.2k
| func_documentation_tokens
sequencelengths 1
3.92k
| split_name
stringclasses 1
value | func_code_url
stringlengths 85
339
|
---|---|---|---|---|---|---|---|---|---|---|
yuncms/framework | src/admin/models/OAuth2ClientSearch.php | OAuth2ClientSearch.search | public function search($params)
{
$query = OAuth2Client::find()->orderBy(['client_id' => SORT_DESC]);
// add conditions that should always apply here
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return $dataProvider;
}
// grid filtering conditions
$query->andFilterWhere([
'client_id' => $this->client_id,
'user_id' => $this->user_id
]);
$query->andFilterWhere(['like', 'client_secret', $this->client_secret])
->andFilterWhere(['like', 'redirect_uri', $this->redirect_uri])
->andFilterWhere(['like', 'grant_type', $this->grant_type])
->andFilterWhere(['like', 'scope', $this->scope])
->andFilterWhere(['like', 'name', $this->name])
->andFilterWhere(['like', 'domain', $this->domain])
->andFilterWhere(['like', 'provider', $this->provider])
->andFilterWhere(['like', 'icp', $this->icp])
->andFilterWhere(['like', 'registration_ip', $this->registration_ip]);
return $dataProvider;
} | php | public function search($params)
{
$query = OAuth2Client::find()->orderBy(['client_id' => SORT_DESC]);
// add conditions that should always apply here
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return $dataProvider;
}
// grid filtering conditions
$query->andFilterWhere([
'client_id' => $this->client_id,
'user_id' => $this->user_id
]);
$query->andFilterWhere(['like', 'client_secret', $this->client_secret])
->andFilterWhere(['like', 'redirect_uri', $this->redirect_uri])
->andFilterWhere(['like', 'grant_type', $this->grant_type])
->andFilterWhere(['like', 'scope', $this->scope])
->andFilterWhere(['like', 'name', $this->name])
->andFilterWhere(['like', 'domain', $this->domain])
->andFilterWhere(['like', 'provider', $this->provider])
->andFilterWhere(['like', 'icp', $this->icp])
->andFilterWhere(['like', 'registration_ip', $this->registration_ip]);
return $dataProvider;
} | [
"public",
"function",
"search",
"(",
"$",
"params",
")",
"{",
"$",
"query",
"=",
"OAuth2Client",
"::",
"find",
"(",
")",
"->",
"orderBy",
"(",
"[",
"'client_id'",
"=>",
"SORT_DESC",
"]",
")",
";",
"// add conditions that should always apply here",
"$",
"dataProvider",
"=",
"new",
"ActiveDataProvider",
"(",
"[",
"'query'",
"=>",
"$",
"query",
",",
"]",
")",
";",
"$",
"this",
"->",
"load",
"(",
"$",
"params",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"validate",
"(",
")",
")",
"{",
"// uncomment the following line if you do not want to return any records when validation fails",
"// $query->where('0=1');",
"return",
"$",
"dataProvider",
";",
"}",
"// grid filtering conditions",
"$",
"query",
"->",
"andFilterWhere",
"(",
"[",
"'client_id'",
"=>",
"$",
"this",
"->",
"client_id",
",",
"'user_id'",
"=>",
"$",
"this",
"->",
"user_id",
"]",
")",
";",
"$",
"query",
"->",
"andFilterWhere",
"(",
"[",
"'like'",
",",
"'client_secret'",
",",
"$",
"this",
"->",
"client_secret",
"]",
")",
"->",
"andFilterWhere",
"(",
"[",
"'like'",
",",
"'redirect_uri'",
",",
"$",
"this",
"->",
"redirect_uri",
"]",
")",
"->",
"andFilterWhere",
"(",
"[",
"'like'",
",",
"'grant_type'",
",",
"$",
"this",
"->",
"grant_type",
"]",
")",
"->",
"andFilterWhere",
"(",
"[",
"'like'",
",",
"'scope'",
",",
"$",
"this",
"->",
"scope",
"]",
")",
"->",
"andFilterWhere",
"(",
"[",
"'like'",
",",
"'name'",
",",
"$",
"this",
"->",
"name",
"]",
")",
"->",
"andFilterWhere",
"(",
"[",
"'like'",
",",
"'domain'",
",",
"$",
"this",
"->",
"domain",
"]",
")",
"->",
"andFilterWhere",
"(",
"[",
"'like'",
",",
"'provider'",
",",
"$",
"this",
"->",
"provider",
"]",
")",
"->",
"andFilterWhere",
"(",
"[",
"'like'",
",",
"'icp'",
",",
"$",
"this",
"->",
"icp",
"]",
")",
"->",
"andFilterWhere",
"(",
"[",
"'like'",
",",
"'registration_ip'",
",",
"$",
"this",
"->",
"registration_ip",
"]",
")",
";",
"return",
"$",
"dataProvider",
";",
"}"
] | Creates data provider instance with search query applied
@param array $params
@return ActiveDataProvider | [
"Creates",
"data",
"provider",
"instance",
"with",
"search",
"query",
"applied"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/admin/models/OAuth2ClientSearch.php#L41-L76 |
GrafiteInc/Mission-Control-Package | src/Analyzers/TrafficAnalyzer.php | TrafficAnalyzer.getLogCollection | public function getLogCollection($now, $then)
{
if (!file_exists($this->fileName)) {
throw new Exception("Access log file is not present - no traffic to report.", 1);
}
$collection = [];
$lines = file($this->fileName, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
foreach ($lines as $line) {
$collection[] = $this->parser->parse($line);
}
$logs = collect($collection);
return $logs->where('stamp', '<=', $now)
->where('stamp', '>=', $then);
} | php | public function getLogCollection($now, $then)
{
if (!file_exists($this->fileName)) {
throw new Exception("Access log file is not present - no traffic to report.", 1);
}
$collection = [];
$lines = file($this->fileName, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
foreach ($lines as $line) {
$collection[] = $this->parser->parse($line);
}
$logs = collect($collection);
return $logs->where('stamp', '<=', $now)
->where('stamp', '>=', $then);
} | [
"public",
"function",
"getLogCollection",
"(",
"$",
"now",
",",
"$",
"then",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"this",
"->",
"fileName",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"\"Access log file is not present - no traffic to report.\"",
",",
"1",
")",
";",
"}",
"$",
"collection",
"=",
"[",
"]",
";",
"$",
"lines",
"=",
"file",
"(",
"$",
"this",
"->",
"fileName",
",",
"FILE_IGNORE_NEW_LINES",
"|",
"FILE_SKIP_EMPTY_LINES",
")",
";",
"foreach",
"(",
"$",
"lines",
"as",
"$",
"line",
")",
"{",
"$",
"collection",
"[",
"]",
"=",
"$",
"this",
"->",
"parser",
"->",
"parse",
"(",
"$",
"line",
")",
";",
"}",
"$",
"logs",
"=",
"collect",
"(",
"$",
"collection",
")",
";",
"return",
"$",
"logs",
"->",
"where",
"(",
"'stamp'",
",",
"'<='",
",",
"$",
"now",
")",
"->",
"where",
"(",
"'stamp'",
",",
"'>='",
",",
"$",
"then",
")",
";",
"}"
] | Get the log collection based on time
@param int $now
@param int $then
@return Illuminate\Support\Collection | [
"Get",
"the",
"log",
"collection",
"based",
"on",
"time"
] | train | https://github.com/GrafiteInc/Mission-Control-Package/blob/4e85f0b729329783b34e35d90abba2807899ff58/src/Analyzers/TrafficAnalyzer.php#L42-L59 |
GrafiteInc/Mission-Control-Package | src/Analyzers/TrafficAnalyzer.php | TrafficAnalyzer.processLogStats | public function processLogStats($collection)
{
$validLogs = $collection->filter(function ($line) {
return $this->validateLine($line);
});
$sentBytes = $validLogs->pluck('sentBytes');
$stats = [
'hits' => $validLogs->count(),
'total_data_sent' => $sentBytes->sum(),
'most_common_method' => $this->sortByField('requestMethod', $validLogs),
'most_common_url' => $this->sortByField('URL', $validLogs),
'most_common_user_agent' => $this->sortByField('HeaderUserAgent', $validLogs),
];
return $stats;
} | php | public function processLogStats($collection)
{
$validLogs = $collection->filter(function ($line) {
return $this->validateLine($line);
});
$sentBytes = $validLogs->pluck('sentBytes');
$stats = [
'hits' => $validLogs->count(),
'total_data_sent' => $sentBytes->sum(),
'most_common_method' => $this->sortByField('requestMethod', $validLogs),
'most_common_url' => $this->sortByField('URL', $validLogs),
'most_common_user_agent' => $this->sortByField('HeaderUserAgent', $validLogs),
];
return $stats;
} | [
"public",
"function",
"processLogStats",
"(",
"$",
"collection",
")",
"{",
"$",
"validLogs",
"=",
"$",
"collection",
"->",
"filter",
"(",
"function",
"(",
"$",
"line",
")",
"{",
"return",
"$",
"this",
"->",
"validateLine",
"(",
"$",
"line",
")",
";",
"}",
")",
";",
"$",
"sentBytes",
"=",
"$",
"validLogs",
"->",
"pluck",
"(",
"'sentBytes'",
")",
";",
"$",
"stats",
"=",
"[",
"'hits'",
"=>",
"$",
"validLogs",
"->",
"count",
"(",
")",
",",
"'total_data_sent'",
"=>",
"$",
"sentBytes",
"->",
"sum",
"(",
")",
",",
"'most_common_method'",
"=>",
"$",
"this",
"->",
"sortByField",
"(",
"'requestMethod'",
",",
"$",
"validLogs",
")",
",",
"'most_common_url'",
"=>",
"$",
"this",
"->",
"sortByField",
"(",
"'URL'",
",",
"$",
"validLogs",
")",
",",
"'most_common_user_agent'",
"=>",
"$",
"this",
"->",
"sortByField",
"(",
"'HeaderUserAgent'",
",",
"$",
"validLogs",
")",
",",
"]",
";",
"return",
"$",
"stats",
";",
"}"
] | Process the log stats
@param Collection $collection
@return array | [
"Process",
"the",
"log",
"stats"
] | train | https://github.com/GrafiteInc/Mission-Control-Package/blob/4e85f0b729329783b34e35d90abba2807899ff58/src/Analyzers/TrafficAnalyzer.php#L68-L85 |
GrafiteInc/Mission-Control-Package | src/Analyzers/TrafficAnalyzer.php | TrafficAnalyzer.sortByField | public function sortByField($field, $collection)
{
if ($collection->isEmpty()) {
return 'N/A';
}
return $collection->groupBy($field)->sortByDesc(function ($logs) {
return count($logs);
})->first()->pluck($field)->first();
} | php | public function sortByField($field, $collection)
{
if ($collection->isEmpty()) {
return 'N/A';
}
return $collection->groupBy($field)->sortByDesc(function ($logs) {
return count($logs);
})->first()->pluck($field)->first();
} | [
"public",
"function",
"sortByField",
"(",
"$",
"field",
",",
"$",
"collection",
")",
"{",
"if",
"(",
"$",
"collection",
"->",
"isEmpty",
"(",
")",
")",
"{",
"return",
"'N/A'",
";",
"}",
"return",
"$",
"collection",
"->",
"groupBy",
"(",
"$",
"field",
")",
"->",
"sortByDesc",
"(",
"function",
"(",
"$",
"logs",
")",
"{",
"return",
"count",
"(",
"$",
"logs",
")",
";",
"}",
")",
"->",
"first",
"(",
")",
"->",
"pluck",
"(",
"$",
"field",
")",
"->",
"first",
"(",
")",
";",
"}"
] | Sort data by field
@param string $field
@param Collection $collection
@return Collection | [
"Sort",
"data",
"by",
"field"
] | train | https://github.com/GrafiteInc/Mission-Control-Package/blob/4e85f0b729329783b34e35d90abba2807899ff58/src/Analyzers/TrafficAnalyzer.php#L95-L104 |
GrafiteInc/Mission-Control-Package | src/Analyzers/TrafficAnalyzer.php | TrafficAnalyzer.validateLine | public function validateLine($line)
{
$invalidExtensions = [
'.jpg',
'.js',
'.css',
'.sass',
'.scss',
'.png',
'.svg',
'.ico',
'.jpeg',
'.gif',
'.mp4',
];
foreach ($invalidExtensions as $needle) {
if (stristr($line->URL, $needle)) {
return false;
}
}
if ($line->HeaderUserAgent === 'MissionControlAgent') {
return false;
}
return true;
} | php | public function validateLine($line)
{
$invalidExtensions = [
'.jpg',
'.js',
'.css',
'.sass',
'.scss',
'.png',
'.svg',
'.ico',
'.jpeg',
'.gif',
'.mp4',
];
foreach ($invalidExtensions as $needle) {
if (stristr($line->URL, $needle)) {
return false;
}
}
if ($line->HeaderUserAgent === 'MissionControlAgent') {
return false;
}
return true;
} | [
"public",
"function",
"validateLine",
"(",
"$",
"line",
")",
"{",
"$",
"invalidExtensions",
"=",
"[",
"'.jpg'",
",",
"'.js'",
",",
"'.css'",
",",
"'.sass'",
",",
"'.scss'",
",",
"'.png'",
",",
"'.svg'",
",",
"'.ico'",
",",
"'.jpeg'",
",",
"'.gif'",
",",
"'.mp4'",
",",
"]",
";",
"foreach",
"(",
"$",
"invalidExtensions",
"as",
"$",
"needle",
")",
"{",
"if",
"(",
"stristr",
"(",
"$",
"line",
"->",
"URL",
",",
"$",
"needle",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"if",
"(",
"$",
"line",
"->",
"HeaderUserAgent",
"===",
"'MissionControlAgent'",
")",
"{",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] | Line object from logs
@param object $line
@return bool | [
"Line",
"object",
"from",
"logs"
] | train | https://github.com/GrafiteInc/Mission-Control-Package/blob/4e85f0b729329783b34e35d90abba2807899ff58/src/Analyzers/TrafficAnalyzer.php#L113-L140 |
lode/fem | src/response.php | response.send_status | public static function send_status($code) {
if (!isset(static::$status_messages[$code])) {
$code = self::STATUS_INTERNAL_SERVER_ERROR;
}
http_response_code($code);
} | php | public static function send_status($code) {
if (!isset(static::$status_messages[$code])) {
$code = self::STATUS_INTERNAL_SERVER_ERROR;
}
http_response_code($code);
} | [
"public",
"static",
"function",
"send_status",
"(",
"$",
"code",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"static",
"::",
"$",
"status_messages",
"[",
"$",
"code",
"]",
")",
")",
"{",
"$",
"code",
"=",
"self",
"::",
"STATUS_INTERNAL_SERVER_ERROR",
";",
"}",
"http_response_code",
"(",
"$",
"code",
")",
";",
"}"
] | send a status code to the browser
@param int $code
@return void | [
"send",
"a",
"status",
"code",
"to",
"the",
"browser"
] | train | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/response.php#L48-L54 |
lode/fem | src/response.php | response.get_status_message | public static function get_status_message($code) {
if (!isset(static::$status_messages[$code])) {
$code = self::STATUS_INTERNAL_SERVER_ERROR;
}
$message = static::$status_messages[$code];
return $message;
} | php | public static function get_status_message($code) {
if (!isset(static::$status_messages[$code])) {
$code = self::STATUS_INTERNAL_SERVER_ERROR;
}
$message = static::$status_messages[$code];
return $message;
} | [
"public",
"static",
"function",
"get_status_message",
"(",
"$",
"code",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"static",
"::",
"$",
"status_messages",
"[",
"$",
"code",
"]",
")",
")",
"{",
"$",
"code",
"=",
"self",
"::",
"STATUS_INTERNAL_SERVER_ERROR",
";",
"}",
"$",
"message",
"=",
"static",
"::",
"$",
"status_messages",
"[",
"$",
"code",
"]",
";",
"return",
"$",
"message",
";",
"}"
] | get the describing message of the status code
@param int $code i.e. 404
@return string i.e. 'Not found' | [
"get",
"the",
"describing",
"message",
"of",
"the",
"status",
"code"
] | train | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/response.php#L62-L69 |
lode/fem | src/response.php | response.download | public static function download($output, $content_type='text/plain', $filename=null) {
$filename_postfix = ($filename) ? '; filename="'.$filename.'"' : '';
// force download
header('Content-Type: '.$content_type.'; charset=utf-8');
header('Content-Disposition: attachment'.$filename_postfix);
// write to browser
echo $output;
} | php | public static function download($output, $content_type='text/plain', $filename=null) {
$filename_postfix = ($filename) ? '; filename="'.$filename.'"' : '';
// force download
header('Content-Type: '.$content_type.'; charset=utf-8');
header('Content-Disposition: attachment'.$filename_postfix);
// write to browser
echo $output;
} | [
"public",
"static",
"function",
"download",
"(",
"$",
"output",
",",
"$",
"content_type",
"=",
"'text/plain'",
",",
"$",
"filename",
"=",
"null",
")",
"{",
"$",
"filename_postfix",
"=",
"(",
"$",
"filename",
")",
"?",
"'; filename=\"'",
".",
"$",
"filename",
".",
"'\"'",
":",
"''",
";",
"// force download",
"header",
"(",
"'Content-Type: '",
".",
"$",
"content_type",
".",
"'; charset=utf-8'",
")",
";",
"header",
"(",
"'Content-Disposition: attachment'",
".",
"$",
"filename_postfix",
")",
";",
"// write to browser",
"echo",
"$",
"output",
";",
"}"
] | force the user to download certain output
@param string $output
@param string $content_type optional, defaults to 'text/plain'
@param string $filename optional, suggested filename when saving downloaded content
@return void | [
"force",
"the",
"user",
"to",
"download",
"certain",
"output"
] | train | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/response.php#L79-L88 |
praxisnetau/silverware-spam-guard | src/Extensions/FormExtension.php | FormExtension.enableSpamProtection | public function enableSpamProtection($args = [])
{
// Obtain Spam Guard Instance:
if ($guard = $this->getSpamGuardInstance($args)) {
// Define Field Name and Title:
$name = isset($args['name']) ? $args['name'] : $guard->getDefaultName();
$title = isset($args['title']) ? $args['title'] : $guard->getDefaultTitle();
// Obtain Spam Guard Form Field:
if ($field = $guard->getFormField($name, $title)) {
// Link Field with Form:
$field->setForm($this->owner);
// Add Field to Form:
if (isset($args['insertBefore'])) {
// Insert Before Specified Field:
$this->owner->Fields()->insertBefore($field, $args['insertBefore']);
} elseif (isset($args['insertAfter'])) {
// Insert After Specified Field:
$this->owner->Fields()->insertAfter($field, $args['insertAfter']);
} else {
// Push Field to End of List:
$this->owner->Fields()->push($field);
}
}
}
// Answer Extended Form:
return $this->owner;
} | php | public function enableSpamProtection($args = [])
{
// Obtain Spam Guard Instance:
if ($guard = $this->getSpamGuardInstance($args)) {
// Define Field Name and Title:
$name = isset($args['name']) ? $args['name'] : $guard->getDefaultName();
$title = isset($args['title']) ? $args['title'] : $guard->getDefaultTitle();
// Obtain Spam Guard Form Field:
if ($field = $guard->getFormField($name, $title)) {
// Link Field with Form:
$field->setForm($this->owner);
// Add Field to Form:
if (isset($args['insertBefore'])) {
// Insert Before Specified Field:
$this->owner->Fields()->insertBefore($field, $args['insertBefore']);
} elseif (isset($args['insertAfter'])) {
// Insert After Specified Field:
$this->owner->Fields()->insertAfter($field, $args['insertAfter']);
} else {
// Push Field to End of List:
$this->owner->Fields()->push($field);
}
}
}
// Answer Extended Form:
return $this->owner;
} | [
"public",
"function",
"enableSpamProtection",
"(",
"$",
"args",
"=",
"[",
"]",
")",
"{",
"// Obtain Spam Guard Instance:",
"if",
"(",
"$",
"guard",
"=",
"$",
"this",
"->",
"getSpamGuardInstance",
"(",
"$",
"args",
")",
")",
"{",
"// Define Field Name and Title:",
"$",
"name",
"=",
"isset",
"(",
"$",
"args",
"[",
"'name'",
"]",
")",
"?",
"$",
"args",
"[",
"'name'",
"]",
":",
"$",
"guard",
"->",
"getDefaultName",
"(",
")",
";",
"$",
"title",
"=",
"isset",
"(",
"$",
"args",
"[",
"'title'",
"]",
")",
"?",
"$",
"args",
"[",
"'title'",
"]",
":",
"$",
"guard",
"->",
"getDefaultTitle",
"(",
")",
";",
"// Obtain Spam Guard Form Field:",
"if",
"(",
"$",
"field",
"=",
"$",
"guard",
"->",
"getFormField",
"(",
"$",
"name",
",",
"$",
"title",
")",
")",
"{",
"// Link Field with Form:",
"$",
"field",
"->",
"setForm",
"(",
"$",
"this",
"->",
"owner",
")",
";",
"// Add Field to Form:",
"if",
"(",
"isset",
"(",
"$",
"args",
"[",
"'insertBefore'",
"]",
")",
")",
"{",
"// Insert Before Specified Field:",
"$",
"this",
"->",
"owner",
"->",
"Fields",
"(",
")",
"->",
"insertBefore",
"(",
"$",
"field",
",",
"$",
"args",
"[",
"'insertBefore'",
"]",
")",
";",
"}",
"elseif",
"(",
"isset",
"(",
"$",
"args",
"[",
"'insertAfter'",
"]",
")",
")",
"{",
"// Insert After Specified Field:",
"$",
"this",
"->",
"owner",
"->",
"Fields",
"(",
")",
"->",
"insertAfter",
"(",
"$",
"field",
",",
"$",
"args",
"[",
"'insertAfter'",
"]",
")",
";",
"}",
"else",
"{",
"// Push Field to End of List:",
"$",
"this",
"->",
"owner",
"->",
"Fields",
"(",
")",
"->",
"push",
"(",
"$",
"field",
")",
";",
"}",
"}",
"}",
"// Answer Extended Form:",
"return",
"$",
"this",
"->",
"owner",
";",
"}"
] | Enables spam guard protection for the extended form.
@param array $args
@return Form | [
"Enables",
"spam",
"guard",
"protection",
"for",
"the",
"extended",
"form",
"."
] | train | https://github.com/praxisnetau/silverware-spam-guard/blob/c5f8836a09141bd675173892a1e3d8c8cc8c1886/src/Extensions/FormExtension.php#L41-L89 |
ClanCats/Core | src/bundles/Database/Query/Select.php | Query_Select.fields | public function fields( $fields )
{
if ( !is_array( $fields ) && !is_null( $fields ) )
{
$fields = array( $fields );
}
// do nothing if we get nothing
if ( empty( $fields ) || $fields == array( '*' ) )
{
$this->fields = array(); return $this;
}
$this->fields = $fields;
// return self so we can continue running the next function
return $this;
} | php | public function fields( $fields )
{
if ( !is_array( $fields ) && !is_null( $fields ) )
{
$fields = array( $fields );
}
// do nothing if we get nothing
if ( empty( $fields ) || $fields == array( '*' ) )
{
$this->fields = array(); return $this;
}
$this->fields = $fields;
// return self so we can continue running the next function
return $this;
} | [
"public",
"function",
"fields",
"(",
"$",
"fields",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"fields",
")",
"&&",
"!",
"is_null",
"(",
"$",
"fields",
")",
")",
"{",
"$",
"fields",
"=",
"array",
"(",
"$",
"fields",
")",
";",
"}",
"// do nothing if we get nothing",
"if",
"(",
"empty",
"(",
"$",
"fields",
")",
"||",
"$",
"fields",
"==",
"array",
"(",
"'*'",
")",
")",
"{",
"$",
"this",
"->",
"fields",
"=",
"array",
"(",
")",
";",
"return",
"$",
"this",
";",
"}",
"$",
"this",
"->",
"fields",
"=",
"$",
"fields",
";",
"// return self so we can continue running the next function",
"return",
"$",
"this",
";",
"}"
] | Set the select fields
@param array $values
@return self | [
"Set",
"the",
"select",
"fields"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Query/Select.php#L87-L104 |
ClanCats/Core | src/bundles/Database/Query/Select.php | Query_Select.add_fields | public function add_fields( $fields )
{
if ( !is_array( $fields ) )
{
$fields = array( $fields );
}
// merge the new values with the existing ones.
$this->fields = array_merge( $this->fields, $fields );
// return self so we can continue running the next function
return $this;
} | php | public function add_fields( $fields )
{
if ( !is_array( $fields ) )
{
$fields = array( $fields );
}
// merge the new values with the existing ones.
$this->fields = array_merge( $this->fields, $fields );
// return self so we can continue running the next function
return $this;
} | [
"public",
"function",
"add_fields",
"(",
"$",
"fields",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"fields",
")",
")",
"{",
"$",
"fields",
"=",
"array",
"(",
"$",
"fields",
")",
";",
"}",
"// merge the new values with the existing ones.",
"$",
"this",
"->",
"fields",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"fields",
",",
"$",
"fields",
")",
";",
"// return self so we can continue running the next function",
"return",
"$",
"this",
";",
"}"
] | Add select fields
@param array $values
@return self | [
"Add",
"select",
"fields"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Query/Select.php#L112-L124 |
ClanCats/Core | src/bundles/Database/Query/Select.php | Query_Select.order_by | public function order_by( $cols, $order = 'asc' )
{
if ( !is_array( $cols ) )
{
$this->orders[] = array( $cols, $order ); return $this;
}
else
{
foreach( $cols as $key => $col )
{
if ( is_numeric( $key ) )
{
$this->orders[] = array( $col, $order );
}
else
{
$this->orders[] = array( $key, $col );
}
}
}
return $this;
} | php | public function order_by( $cols, $order = 'asc' )
{
if ( !is_array( $cols ) )
{
$this->orders[] = array( $cols, $order ); return $this;
}
else
{
foreach( $cols as $key => $col )
{
if ( is_numeric( $key ) )
{
$this->orders[] = array( $col, $order );
}
else
{
$this->orders[] = array( $key, $col );
}
}
}
return $this;
} | [
"public",
"function",
"order_by",
"(",
"$",
"cols",
",",
"$",
"order",
"=",
"'asc'",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"cols",
")",
")",
"{",
"$",
"this",
"->",
"orders",
"[",
"]",
"=",
"array",
"(",
"$",
"cols",
",",
"$",
"order",
")",
";",
"return",
"$",
"this",
";",
"}",
"else",
"{",
"foreach",
"(",
"$",
"cols",
"as",
"$",
"key",
"=>",
"$",
"col",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"key",
")",
")",
"{",
"$",
"this",
"->",
"orders",
"[",
"]",
"=",
"array",
"(",
"$",
"col",
",",
"$",
"order",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"orders",
"[",
"]",
"=",
"array",
"(",
"$",
"key",
",",
"$",
"col",
")",
";",
"}",
"}",
"}",
"return",
"$",
"this",
";",
"}"
] | Set the order parameters
@param mixed $cols
@param string $order
@return self | [
"Set",
"the",
"order",
"parameters"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Query/Select.php#L133-L155 |
ClanCats/Core | src/bundles/Database/Query/Select.php | Query_Select.group_by | public function group_by( $key )
{
if ( !is_array( $key ) )
{
$key = array( $key );
}
foreach( $key as $group_key )
{
$this->groups[] = $group_key;
}
return $this;
} | php | public function group_by( $key )
{
if ( !is_array( $key ) )
{
$key = array( $key );
}
foreach( $key as $group_key )
{
$this->groups[] = $group_key;
}
return $this;
} | [
"public",
"function",
"group_by",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"key",
")",
")",
"{",
"$",
"key",
"=",
"array",
"(",
"$",
"key",
")",
";",
"}",
"foreach",
"(",
"$",
"key",
"as",
"$",
"group_key",
")",
"{",
"$",
"this",
"->",
"groups",
"[",
"]",
"=",
"$",
"group_key",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | Add group by stuff
@param mixed $key By passing an array you can add multiple groups
@return self | [
"Add",
"group",
"by",
"stuff"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Query/Select.php#L163-L176 |
ClanCats/Core | src/bundles/Database/Query/Select.php | Query_Select.forward_key | public function forward_key( $key = true )
{
if ( $key === false )
{
$this->forward_key = false;
}
elseif ( $key === true )
{
$this->forward_key = \ClanCats::$config->get( 'database.default_primary_key', 'id' );
}
else
{
$this->forward_key = $key;
}
return $this;
} | php | public function forward_key( $key = true )
{
if ( $key === false )
{
$this->forward_key = false;
}
elseif ( $key === true )
{
$this->forward_key = \ClanCats::$config->get( 'database.default_primary_key', 'id' );
}
else
{
$this->forward_key = $key;
}
return $this;
} | [
"public",
"function",
"forward_key",
"(",
"$",
"key",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"key",
"===",
"false",
")",
"{",
"$",
"this",
"->",
"forward_key",
"=",
"false",
";",
"}",
"elseif",
"(",
"$",
"key",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"forward_key",
"=",
"\\",
"ClanCats",
"::",
"$",
"config",
"->",
"get",
"(",
"'database.default_primary_key'",
",",
"'id'",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"forward_key",
"=",
"$",
"key",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | Forward a result value as array key
@param string|bool $key
@return self | [
"Forward",
"a",
"result",
"value",
"as",
"array",
"key"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Query/Select.php#L184-L200 |
ClanCats/Core | src/bundles/Database/Query/Select.php | Query_Select.group_result | public function group_result( $key )
{
if ( $key === false )
{
$this->group_result = false;
}
else
{
$this->group_result = $key;
}
return $this;
} | php | public function group_result( $key )
{
if ( $key === false )
{
$this->group_result = false;
}
else
{
$this->group_result = $key;
}
return $this;
} | [
"public",
"function",
"group_result",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"$",
"key",
"===",
"false",
")",
"{",
"$",
"this",
"->",
"group_result",
"=",
"false",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"group_result",
"=",
"$",
"key",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | Group results by a column
example:
array(
'name' => 'John', 'age' => 18,
),
array(
'name' => 'Jeff', 'age' => 32,
),
array(
'name' => 'Jenny', 'age' => 18,
),
To:
'18' => array(
array( 'name' => 'John', 'age' => 18 ),
array( 'name' => 'Jenny', 'age' => 18 ),
),
'32' => array(
array( 'name' => 'Jeff', 'age' => 32 ),
),
@param string|bool $key
@return self | [
"Group",
"results",
"by",
"a",
"column"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Query/Select.php#L227-L239 |
ClanCats/Core | src/bundles/Database/Query/Select.php | Query_Select.run | public function run( $handler = null )
{
if ( !is_null( $handler ) )
{
$this->handler( $handler );
}
// if there is a special fetch handler defined pass him all the
// needed parameters and retrive the results
if ( !is_null( $this->fetch_handler ) )
{
$results = call_user_func_array( $this->fetch_handler, array(
&$this
));
}
// otherwise simply do the default select fetch
else
{
$results = $this->handler->fetch( $this->build(), $this->handler->builder()->parameters, $this->fetch_arguments );
}
// In case we should forward a key means using a value
// from every result as array key.
if ( $this->forward_key !== false )
{
$raw_results = $results;
$results = array();
if ( in_array( 'assoc', $this->fetch_arguments ) )
{
foreach( $raw_results as $result )
{
$results[$result[$this->forward_key]] = $result;
}
}
else
{
foreach( $raw_results as $result )
{
$results[$result->{$this->forward_key}] = $result;
}
}
}
// Group the results by a value
if ( $this->group_result !== false )
{
$raw_results = $results;
$results = array();
if ( in_array( 'assoc', $this->fetch_arguments ) )
{
foreach( $raw_results as $key => $result )
{
$results[$result[$this->group_result]][$key] = $result;
}
}
else
{
foreach( $raw_results as $key => $result )
{
$results[$result->{$this->group_result}][$key] = $result;
}
}
}
// when the limit is 1 we are going to return the
// result directly
if ( $this->limit === 1 )
{
return reset( $results );
}
return $results;
} | php | public function run( $handler = null )
{
if ( !is_null( $handler ) )
{
$this->handler( $handler );
}
// if there is a special fetch handler defined pass him all the
// needed parameters and retrive the results
if ( !is_null( $this->fetch_handler ) )
{
$results = call_user_func_array( $this->fetch_handler, array(
&$this
));
}
// otherwise simply do the default select fetch
else
{
$results = $this->handler->fetch( $this->build(), $this->handler->builder()->parameters, $this->fetch_arguments );
}
// In case we should forward a key means using a value
// from every result as array key.
if ( $this->forward_key !== false )
{
$raw_results = $results;
$results = array();
if ( in_array( 'assoc', $this->fetch_arguments ) )
{
foreach( $raw_results as $result )
{
$results[$result[$this->forward_key]] = $result;
}
}
else
{
foreach( $raw_results as $result )
{
$results[$result->{$this->forward_key}] = $result;
}
}
}
// Group the results by a value
if ( $this->group_result !== false )
{
$raw_results = $results;
$results = array();
if ( in_array( 'assoc', $this->fetch_arguments ) )
{
foreach( $raw_results as $key => $result )
{
$results[$result[$this->group_result]][$key] = $result;
}
}
else
{
foreach( $raw_results as $key => $result )
{
$results[$result->{$this->group_result}][$key] = $result;
}
}
}
// when the limit is 1 we are going to return the
// result directly
if ( $this->limit === 1 )
{
return reset( $results );
}
return $results;
} | [
"public",
"function",
"run",
"(",
"$",
"handler",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"handler",
")",
")",
"{",
"$",
"this",
"->",
"handler",
"(",
"$",
"handler",
")",
";",
"}",
"// if there is a special fetch handler defined pass him all the ",
"// needed parameters and retrive the results",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"fetch_handler",
")",
")",
"{",
"$",
"results",
"=",
"call_user_func_array",
"(",
"$",
"this",
"->",
"fetch_handler",
",",
"array",
"(",
"&",
"$",
"this",
")",
")",
";",
"}",
"// otherwise simply do the default select fetch",
"else",
"{",
"$",
"results",
"=",
"$",
"this",
"->",
"handler",
"->",
"fetch",
"(",
"$",
"this",
"->",
"build",
"(",
")",
",",
"$",
"this",
"->",
"handler",
"->",
"builder",
"(",
")",
"->",
"parameters",
",",
"$",
"this",
"->",
"fetch_arguments",
")",
";",
"}",
"// In case we should forward a key means using a value",
"// from every result as array key.",
"if",
"(",
"$",
"this",
"->",
"forward_key",
"!==",
"false",
")",
"{",
"$",
"raw_results",
"=",
"$",
"results",
";",
"$",
"results",
"=",
"array",
"(",
")",
";",
"if",
"(",
"in_array",
"(",
"'assoc'",
",",
"$",
"this",
"->",
"fetch_arguments",
")",
")",
"{",
"foreach",
"(",
"$",
"raw_results",
"as",
"$",
"result",
")",
"{",
"$",
"results",
"[",
"$",
"result",
"[",
"$",
"this",
"->",
"forward_key",
"]",
"]",
"=",
"$",
"result",
";",
"}",
"}",
"else",
"{",
"foreach",
"(",
"$",
"raw_results",
"as",
"$",
"result",
")",
"{",
"$",
"results",
"[",
"$",
"result",
"->",
"{",
"$",
"this",
"->",
"forward_key",
"}",
"]",
"=",
"$",
"result",
";",
"}",
"}",
"}",
"// Group the results by a value",
"if",
"(",
"$",
"this",
"->",
"group_result",
"!==",
"false",
")",
"{",
"$",
"raw_results",
"=",
"$",
"results",
";",
"$",
"results",
"=",
"array",
"(",
")",
";",
"if",
"(",
"in_array",
"(",
"'assoc'",
",",
"$",
"this",
"->",
"fetch_arguments",
")",
")",
"{",
"foreach",
"(",
"$",
"raw_results",
"as",
"$",
"key",
"=>",
"$",
"result",
")",
"{",
"$",
"results",
"[",
"$",
"result",
"[",
"$",
"this",
"->",
"group_result",
"]",
"]",
"[",
"$",
"key",
"]",
"=",
"$",
"result",
";",
"}",
"}",
"else",
"{",
"foreach",
"(",
"$",
"raw_results",
"as",
"$",
"key",
"=>",
"$",
"result",
")",
"{",
"$",
"results",
"[",
"$",
"result",
"->",
"{",
"$",
"this",
"->",
"group_result",
"}",
"]",
"[",
"$",
"key",
"]",
"=",
"$",
"result",
";",
"}",
"}",
"}",
"// when the limit is 1 we are going to return the ",
"// result directly",
"if",
"(",
"$",
"this",
"->",
"limit",
"===",
"1",
")",
"{",
"return",
"reset",
"(",
"$",
"results",
")",
";",
"}",
"return",
"$",
"results",
";",
"}"
] | Build and execute the current query
This wil run the local build function and pass the parameters
from the builder object in the handler
@param string $handler
@return mixed | [
"Build",
"and",
"execute",
"the",
"current",
"query",
"This",
"wil",
"run",
"the",
"local",
"build",
"function",
"and",
"pass",
"the",
"parameters",
"from",
"the",
"builder",
"object",
"in",
"the",
"handler"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Query/Select.php#L275-L349 |
ClanCats/Core | src/bundles/Database/Query/Select.php | Query_Select.find | public function find( $id, $key = null, $name = null )
{
if ( is_null( $key ) )
{
$key = Query::$_default_key;
}
return $this->where( $key, $id )->one( $name );
} | php | public function find( $id, $key = null, $name = null )
{
if ( is_null( $key ) )
{
$key = Query::$_default_key;
}
return $this->where( $key, $id )->one( $name );
} | [
"public",
"function",
"find",
"(",
"$",
"id",
",",
"$",
"key",
"=",
"null",
",",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"key",
")",
")",
"{",
"$",
"key",
"=",
"Query",
"::",
"$",
"_default_key",
";",
"}",
"return",
"$",
"this",
"->",
"where",
"(",
"$",
"key",
",",
"$",
"id",
")",
"->",
"one",
"(",
"$",
"name",
")",
";",
"}"
] | Find something, means select one record by key
@param int $id
@param string $key
@param string $name
@return mixed | [
"Find",
"something",
"means",
"select",
"one",
"record",
"by",
"key"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Query/Select.php#L370-L378 |
ClanCats/Core | src/bundles/Database/Query/Select.php | Query_Select.first | public function first( $key = null, $name = null )
{
if ( is_null( $key ) )
{
$key = Query::$_default_key;
}
return $this->order_by( $key, 'asc' )->one( $name );
} | php | public function first( $key = null, $name = null )
{
if ( is_null( $key ) )
{
$key = Query::$_default_key;
}
return $this->order_by( $key, 'asc' )->one( $name );
} | [
"public",
"function",
"first",
"(",
"$",
"key",
"=",
"null",
",",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"key",
")",
")",
"{",
"$",
"key",
"=",
"Query",
"::",
"$",
"_default_key",
";",
"}",
"return",
"$",
"this",
"->",
"order_by",
"(",
"$",
"key",
",",
"'asc'",
")",
"->",
"one",
"(",
"$",
"name",
")",
";",
"}"
] | Get the first result by key
@param string $key
@param string $name
@return mixed | [
"Get",
"the",
"first",
"result",
"by",
"key"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Query/Select.php#L387-L395 |
ClanCats/Core | src/bundles/Database/Query/Select.php | Query_Select.column | public function column( $column, $name = null )
{
return $this->fields( $column )->one( $name )->$column;
} | php | public function column( $column, $name = null )
{
return $this->fields( $column )->one( $name )->$column;
} | [
"public",
"function",
"column",
"(",
"$",
"column",
",",
"$",
"name",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"fields",
"(",
"$",
"column",
")",
"->",
"one",
"(",
"$",
"name",
")",
"->",
"$",
"column",
";",
"}"
] | Just get a single value from the db
@param string $column
@param string $name
@return mixed | [
"Just",
"get",
"a",
"single",
"value",
"from",
"the",
"db"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Query/Select.php#L421-L424 |
dreamfactorysoftware/df-file | src/Components/SupportsFiles.php | SupportsFiles.getConfig | public static function getConfig($id, $local_config = null, $protect = true)
{
$config = parent::getConfig($id, $local_config, $protect);
/** @var FilePublicPath $pathConfig */
if (!empty($pathConfig = FilePublicPath::find($id))) {
$config = array_merge($config, $pathConfig->toArray());
}
return $config;
} | php | public static function getConfig($id, $local_config = null, $protect = true)
{
$config = parent::getConfig($id, $local_config, $protect);
/** @var FilePublicPath $pathConfig */
if (!empty($pathConfig = FilePublicPath::find($id))) {
$config = array_merge($config, $pathConfig->toArray());
}
return $config;
} | [
"public",
"static",
"function",
"getConfig",
"(",
"$",
"id",
",",
"$",
"local_config",
"=",
"null",
",",
"$",
"protect",
"=",
"true",
")",
"{",
"$",
"config",
"=",
"parent",
"::",
"getConfig",
"(",
"$",
"id",
",",
"$",
"local_config",
",",
"$",
"protect",
")",
";",
"/** @var FilePublicPath $pathConfig */",
"if",
"(",
"!",
"empty",
"(",
"$",
"pathConfig",
"=",
"FilePublicPath",
"::",
"find",
"(",
"$",
"id",
")",
")",
")",
"{",
"$",
"config",
"=",
"array_merge",
"(",
"$",
"config",
",",
"$",
"pathConfig",
"->",
"toArray",
"(",
")",
")",
";",
"}",
"return",
"$",
"config",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/dreamfactorysoftware/df-file/blob/e78aaec3e1d6585b5e7fe9b7646af4b1180ecd66/src/Components/SupportsFiles.php#L11-L21 |
dreamfactorysoftware/df-file | src/Components/SupportsFiles.php | SupportsFiles.setConfig | public static function setConfig($id, $config, $local_config = null)
{
$result = parent::setConfig($id, $config, $local_config);
$resultPath = FilePublicPath::setConfig($id, $config, $local_config);
if ($resultPath) {
$result = array_merge((array)$result, (array)$resultPath);
}
return $result;
} | php | public static function setConfig($id, $config, $local_config = null)
{
$result = parent::setConfig($id, $config, $local_config);
$resultPath = FilePublicPath::setConfig($id, $config, $local_config);
if ($resultPath) {
$result = array_merge((array)$result, (array)$resultPath);
}
return $result;
} | [
"public",
"static",
"function",
"setConfig",
"(",
"$",
"id",
",",
"$",
"config",
",",
"$",
"local_config",
"=",
"null",
")",
"{",
"$",
"result",
"=",
"parent",
"::",
"setConfig",
"(",
"$",
"id",
",",
"$",
"config",
",",
"$",
"local_config",
")",
";",
"$",
"resultPath",
"=",
"FilePublicPath",
"::",
"setConfig",
"(",
"$",
"id",
",",
"$",
"config",
",",
"$",
"local_config",
")",
";",
"if",
"(",
"$",
"resultPath",
")",
"{",
"$",
"result",
"=",
"array_merge",
"(",
"(",
"array",
")",
"$",
"result",
",",
"(",
"array",
")",
"$",
"resultPath",
")",
";",
"}",
"return",
"$",
"result",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/dreamfactorysoftware/df-file/blob/e78aaec3e1d6585b5e7fe9b7646af4b1180ecd66/src/Components/SupportsFiles.php#L26-L36 |
dreamfactorysoftware/df-file | src/Components/SupportsFiles.php | SupportsFiles.storeConfig | public static function storeConfig($id, $config)
{
parent::storeConfig($id, $config);
FilePublicPath::storeConfig($id, $config);
} | php | public static function storeConfig($id, $config)
{
parent::storeConfig($id, $config);
FilePublicPath::storeConfig($id, $config);
} | [
"public",
"static",
"function",
"storeConfig",
"(",
"$",
"id",
",",
"$",
"config",
")",
"{",
"parent",
"::",
"storeConfig",
"(",
"$",
"id",
",",
"$",
"config",
")",
";",
"FilePublicPath",
"::",
"storeConfig",
"(",
"$",
"id",
",",
"$",
"config",
")",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/dreamfactorysoftware/df-file/blob/e78aaec3e1d6585b5e7fe9b7646af4b1180ecd66/src/Components/SupportsFiles.php#L41-L46 |
dreamfactorysoftware/df-file | src/Components/SupportsFiles.php | SupportsFiles.getConfigSchema | public static function getConfigSchema()
{
$out = (array)parent::getConfigSchema();
$pathSchema = (array)FilePublicPath::getConfigSchema();
return array_merge($out, $pathSchema);
} | php | public static function getConfigSchema()
{
$out = (array)parent::getConfigSchema();
$pathSchema = (array)FilePublicPath::getConfigSchema();
return array_merge($out, $pathSchema);
} | [
"public",
"static",
"function",
"getConfigSchema",
"(",
")",
"{",
"$",
"out",
"=",
"(",
"array",
")",
"parent",
"::",
"getConfigSchema",
"(",
")",
";",
"$",
"pathSchema",
"=",
"(",
"array",
")",
"FilePublicPath",
"::",
"getConfigSchema",
"(",
")",
";",
"return",
"array_merge",
"(",
"$",
"out",
",",
"$",
"pathSchema",
")",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/dreamfactorysoftware/df-file/blob/e78aaec3e1d6585b5e7fe9b7646af4b1180ecd66/src/Components/SupportsFiles.php#L51-L57 |
yuncms/framework | src/user/models/UserSearch.php | UserSearch.search | public function search($params)
{
$query = User::find();
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
if (!($this->load($params) && $this->validate())) {
return $dataProvider;
}
$query->andFilterWhere(['like', 'nickname', $this->nickname]);
return $dataProvider;
} | php | public function search($params)
{
$query = User::find();
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
if (!($this->load($params) && $this->validate())) {
return $dataProvider;
}
$query->andFilterWhere(['like', 'nickname', $this->nickname]);
return $dataProvider;
} | [
"public",
"function",
"search",
"(",
"$",
"params",
")",
"{",
"$",
"query",
"=",
"User",
"::",
"find",
"(",
")",
";",
"$",
"dataProvider",
"=",
"new",
"ActiveDataProvider",
"(",
"[",
"'query'",
"=>",
"$",
"query",
",",
"]",
")",
";",
"if",
"(",
"!",
"(",
"$",
"this",
"->",
"load",
"(",
"$",
"params",
")",
"&&",
"$",
"this",
"->",
"validate",
"(",
")",
")",
")",
"{",
"return",
"$",
"dataProvider",
";",
"}",
"$",
"query",
"->",
"andFilterWhere",
"(",
"[",
"'like'",
",",
"'nickname'",
",",
"$",
"this",
"->",
"nickname",
"]",
")",
";",
"return",
"$",
"dataProvider",
";",
"}"
] | @param $params
@return ActiveDataProvider | [
"@param",
"$params"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/user/models/UserSearch.php#L37-L48 |
bosha/PTel | src/PTel.php | PTel.connect | public function connect($host, $port = null, $timeout = null) {
$port = (empty($port)) ? 23 : $port;
$timeout = (empty($timeout)) ? 1 : $timeout;
if (!filter_var($host, FILTER_VALIDATE_IP)) {
$ip = gethostbyname($host);
if ($ip !== $host) {
$host = $ip;
} else {
throw new TelnetException('Could not resolve IP-address');
}
}
$this->_sock = @fsockopen($host, $port, $errno, $errstr, $timeout);
if (!$this->_sock) {
throw new SocketClientException('Failed to connect to '.$host.":".$port.'!');
}
stream_set_timeout($this->_sock, 0, $this->_timeout);
stream_set_blocking($this->_sock, $this->_blocking);
if ($this->negotiation_enabled) {
$topts = TEL_IAC.TEL_DO.TEL_GA. // DO Go ahead
TEL_IAC.TEL_WILL.TEL_TTYPE. // WILL Terminal type
TEL_IAC.TEL_WILL.TEL_NAWS. // WILL Negotiate about window size
TEL_IAC.TEL_WILL.TEL_TSPEED. // WILL Terminal speed
TEL_IAC.TEL_WILL.TEL_RFLOW. // WILL Remote flow control
TEL_IAC.TEL_WILL.TEL_LINEMODE. // WILL Linemode
TEL_IAC.TEL_WILL.TEL_NEWENV. // WILL New environment
TEL_IAC.TEL_DO.TEL_STATUS. // DO Status
TEL_IAC.TEL_WILL.TEL_XDISPLOC; // WILL X Display location
$this->send($topts, false);
}
return $this;
} | php | public function connect($host, $port = null, $timeout = null) {
$port = (empty($port)) ? 23 : $port;
$timeout = (empty($timeout)) ? 1 : $timeout;
if (!filter_var($host, FILTER_VALIDATE_IP)) {
$ip = gethostbyname($host);
if ($ip !== $host) {
$host = $ip;
} else {
throw new TelnetException('Could not resolve IP-address');
}
}
$this->_sock = @fsockopen($host, $port, $errno, $errstr, $timeout);
if (!$this->_sock) {
throw new SocketClientException('Failed to connect to '.$host.":".$port.'!');
}
stream_set_timeout($this->_sock, 0, $this->_timeout);
stream_set_blocking($this->_sock, $this->_blocking);
if ($this->negotiation_enabled) {
$topts = TEL_IAC.TEL_DO.TEL_GA. // DO Go ahead
TEL_IAC.TEL_WILL.TEL_TTYPE. // WILL Terminal type
TEL_IAC.TEL_WILL.TEL_NAWS. // WILL Negotiate about window size
TEL_IAC.TEL_WILL.TEL_TSPEED. // WILL Terminal speed
TEL_IAC.TEL_WILL.TEL_RFLOW. // WILL Remote flow control
TEL_IAC.TEL_WILL.TEL_LINEMODE. // WILL Linemode
TEL_IAC.TEL_WILL.TEL_NEWENV. // WILL New environment
TEL_IAC.TEL_DO.TEL_STATUS. // DO Status
TEL_IAC.TEL_WILL.TEL_XDISPLOC; // WILL X Display location
$this->send($topts, false);
}
return $this;
} | [
"public",
"function",
"connect",
"(",
"$",
"host",
",",
"$",
"port",
"=",
"null",
",",
"$",
"timeout",
"=",
"null",
")",
"{",
"$",
"port",
"=",
"(",
"empty",
"(",
"$",
"port",
")",
")",
"?",
"23",
":",
"$",
"port",
";",
"$",
"timeout",
"=",
"(",
"empty",
"(",
"$",
"timeout",
")",
")",
"?",
"1",
":",
"$",
"timeout",
";",
"if",
"(",
"!",
"filter_var",
"(",
"$",
"host",
",",
"FILTER_VALIDATE_IP",
")",
")",
"{",
"$",
"ip",
"=",
"gethostbyname",
"(",
"$",
"host",
")",
";",
"if",
"(",
"$",
"ip",
"!==",
"$",
"host",
")",
"{",
"$",
"host",
"=",
"$",
"ip",
";",
"}",
"else",
"{",
"throw",
"new",
"TelnetException",
"(",
"'Could not resolve IP-address'",
")",
";",
"}",
"}",
"$",
"this",
"->",
"_sock",
"=",
"@",
"fsockopen",
"(",
"$",
"host",
",",
"$",
"port",
",",
"$",
"errno",
",",
"$",
"errstr",
",",
"$",
"timeout",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"_sock",
")",
"{",
"throw",
"new",
"SocketClientException",
"(",
"'Failed to connect to '",
".",
"$",
"host",
".",
"\":\"",
".",
"$",
"port",
".",
"'!'",
")",
";",
"}",
"stream_set_timeout",
"(",
"$",
"this",
"->",
"_sock",
",",
"0",
",",
"$",
"this",
"->",
"_timeout",
")",
";",
"stream_set_blocking",
"(",
"$",
"this",
"->",
"_sock",
",",
"$",
"this",
"->",
"_blocking",
")",
";",
"if",
"(",
"$",
"this",
"->",
"negotiation_enabled",
")",
"{",
"$",
"topts",
"=",
"TEL_IAC",
".",
"TEL_DO",
".",
"TEL_GA",
".",
"// DO Go ahead",
"TEL_IAC",
".",
"TEL_WILL",
".",
"TEL_TTYPE",
".",
"// WILL Terminal type",
"TEL_IAC",
".",
"TEL_WILL",
".",
"TEL_NAWS",
".",
"// WILL Negotiate about window size",
"TEL_IAC",
".",
"TEL_WILL",
".",
"TEL_TSPEED",
".",
"// WILL Terminal speed",
"TEL_IAC",
".",
"TEL_WILL",
".",
"TEL_RFLOW",
".",
"// WILL Remote flow control",
"TEL_IAC",
".",
"TEL_WILL",
".",
"TEL_LINEMODE",
".",
"// WILL Linemode",
"TEL_IAC",
".",
"TEL_WILL",
".",
"TEL_NEWENV",
".",
"// WILL New environment",
"TEL_IAC",
".",
"TEL_DO",
".",
"TEL_STATUS",
".",
"// DO Status",
"TEL_IAC",
".",
"TEL_WILL",
".",
"TEL_XDISPLOC",
";",
"// WILL X Display location",
"$",
"this",
"->",
"send",
"(",
"$",
"topts",
",",
"false",
")",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | Connect to given host/port
@param $host string IP-Address or host to connect
@param $port int Port
@param $timeout int Connection timeout
@throws SocketClientException On socket connection error
@throws TelnetException On error while resolving IP-address
@return $this Current class instance | [
"Connect",
"to",
"given",
"host",
"/",
"port"
] | train | https://github.com/bosha/PTel/blob/049d72f8faaf6c2548353e715e06ad1f28c756b5/src/PTel.php#L130-L168 |
bosha/PTel | src/PTel.php | PTel.login | public function login($user, $pass, $maxtimeout = 10) {
try {
$this->expect('((U|u)ser|(L|l)ogin)((N|n)ame|)(:|)', $user);
$this->expect('(P|p)ass((W|w)ord|)(:|)', $pass);
} catch (TelnetException $e) {
throw new TelnetException('Could not find password request. Login failed.');
}
$timestart = time();
$buff = '';
while (true) {
$buff = $this->recvLine();
$timerun = time() - $timestart;
if (preg_match("/(fail|wrong|incorrect|failed)/i", $buff)) {
throw new TelnetException("Username or password wrong! Login failed");
}
if (preg_match("/(#|>|\$)/", $buff)) {
break;
}
if ($timerun >= $maxtimeout) {
throw new TelnetException("Could not get reply from device. Login failed.");
}
}
$this->recvAll();
$lines = explode("\n", $this->getBuffer());
$prompt = array_slice($lines, -1);
$this->prompt = $prompt[0];
return $this;
} | php | public function login($user, $pass, $maxtimeout = 10) {
try {
$this->expect('((U|u)ser|(L|l)ogin)((N|n)ame|)(:|)', $user);
$this->expect('(P|p)ass((W|w)ord|)(:|)', $pass);
} catch (TelnetException $e) {
throw new TelnetException('Could not find password request. Login failed.');
}
$timestart = time();
$buff = '';
while (true) {
$buff = $this->recvLine();
$timerun = time() - $timestart;
if (preg_match("/(fail|wrong|incorrect|failed)/i", $buff)) {
throw new TelnetException("Username or password wrong! Login failed");
}
if (preg_match("/(#|>|\$)/", $buff)) {
break;
}
if ($timerun >= $maxtimeout) {
throw new TelnetException("Could not get reply from device. Login failed.");
}
}
$this->recvAll();
$lines = explode("\n", $this->getBuffer());
$prompt = array_slice($lines, -1);
$this->prompt = $prompt[0];
return $this;
} | [
"public",
"function",
"login",
"(",
"$",
"user",
",",
"$",
"pass",
",",
"$",
"maxtimeout",
"=",
"10",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"expect",
"(",
"'((U|u)ser|(L|l)ogin)((N|n)ame|)(:|)'",
",",
"$",
"user",
")",
";",
"$",
"this",
"->",
"expect",
"(",
"'(P|p)ass((W|w)ord|)(:|)'",
",",
"$",
"pass",
")",
";",
"}",
"catch",
"(",
"TelnetException",
"$",
"e",
")",
"{",
"throw",
"new",
"TelnetException",
"(",
"'Could not find password request. Login failed.'",
")",
";",
"}",
"$",
"timestart",
"=",
"time",
"(",
")",
";",
"$",
"buff",
"=",
"''",
";",
"while",
"(",
"true",
")",
"{",
"$",
"buff",
"=",
"$",
"this",
"->",
"recvLine",
"(",
")",
";",
"$",
"timerun",
"=",
"time",
"(",
")",
"-",
"$",
"timestart",
";",
"if",
"(",
"preg_match",
"(",
"\"/(fail|wrong|incorrect|failed)/i\"",
",",
"$",
"buff",
")",
")",
"{",
"throw",
"new",
"TelnetException",
"(",
"\"Username or password wrong! Login failed\"",
")",
";",
"}",
"if",
"(",
"preg_match",
"(",
"\"/(#|>|\\$)/\"",
",",
"$",
"buff",
")",
")",
"{",
"break",
";",
"}",
"if",
"(",
"$",
"timerun",
">=",
"$",
"maxtimeout",
")",
"{",
"throw",
"new",
"TelnetException",
"(",
"\"Could not get reply from device. Login failed.\"",
")",
";",
"}",
"}",
"$",
"this",
"->",
"recvAll",
"(",
")",
";",
"$",
"lines",
"=",
"explode",
"(",
"\"\\n\"",
",",
"$",
"this",
"->",
"getBuffer",
"(",
")",
")",
";",
"$",
"prompt",
"=",
"array_slice",
"(",
"$",
"lines",
",",
"-",
"1",
")",
";",
"$",
"this",
"->",
"prompt",
"=",
"$",
"prompt",
"[",
"0",
"]",
";",
"return",
"$",
"this",
";",
"}"
] | Login to device.
@param string $user Username
@param string $pass Password
@throws TelnetException On wrong username/password
@throws SocketClientException On socket communication error
@return $this Current instance on success | [
"Login",
"to",
"device",
"."
] | train | https://github.com/bosha/PTel/blob/049d72f8faaf6c2548353e715e06ad1f28c756b5/src/PTel.php#L180-L212 |
bosha/PTel | src/PTel.php | PTel.send | public function send($data, $newline = true) {
if (!$this->_sock) { throw new SocketClientException("Connection unexpectedly closed!"); }
if ($newline) { $data = $data.$this->retcarriage; }
if (! $wr = fwrite($this->_sock, $data)) {
throw new SocketClientException('Error while sending data!');
}
return $wr;
} | php | public function send($data, $newline = true) {
if (!$this->_sock) { throw new SocketClientException("Connection unexpectedly closed!"); }
if ($newline) { $data = $data.$this->retcarriage; }
if (! $wr = fwrite($this->_sock, $data)) {
throw new SocketClientException('Error while sending data!');
}
return $wr;
} | [
"public",
"function",
"send",
"(",
"$",
"data",
",",
"$",
"newline",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_sock",
")",
"{",
"throw",
"new",
"SocketClientException",
"(",
"\"Connection unexpectedly closed!\"",
")",
";",
"}",
"if",
"(",
"$",
"newline",
")",
"{",
"$",
"data",
"=",
"$",
"data",
".",
"$",
"this",
"->",
"retcarriage",
";",
"}",
"if",
"(",
"!",
"$",
"wr",
"=",
"fwrite",
"(",
"$",
"this",
"->",
"_sock",
",",
"$",
"data",
")",
")",
"{",
"throw",
"new",
"SocketClientException",
"(",
"'Error while sending data!'",
")",
";",
"}",
"return",
"$",
"wr",
";",
"}"
] | Send data to socket
@param $data mixed Can be anything: string, int, hex, binary
@param $newline bool Determines send or not carriage return
@throws SocketClientException On socket communication error
@return int Bytes written | [
"Send",
"data",
"to",
"socket"
] | train | https://github.com/bosha/PTel/blob/049d72f8faaf6c2548353e715e06ad1f28c756b5/src/PTel.php#L224-L231 |
bosha/PTel | src/PTel.php | PTel.recvChr | public function recvChr() {
if (!$this->_sock) { throw new SocketClientException("Connection gone!"); }
$char = fgetc($this->_sock);
if ($this->stream_eof()) { return false; }
if ($char === TEL_IAC && $this->negotiation_enabled) {
$this->_negotiate(fgetc($this->_sock));
return "";
}
$this->_buff .= $char;
return $char;
} | php | public function recvChr() {
if (!$this->_sock) { throw new SocketClientException("Connection gone!"); }
$char = fgetc($this->_sock);
if ($this->stream_eof()) { return false; }
if ($char === TEL_IAC && $this->negotiation_enabled) {
$this->_negotiate(fgetc($this->_sock));
return "";
}
$this->_buff .= $char;
return $char;
} | [
"public",
"function",
"recvChr",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_sock",
")",
"{",
"throw",
"new",
"SocketClientException",
"(",
"\"Connection gone!\"",
")",
";",
"}",
"$",
"char",
"=",
"fgetc",
"(",
"$",
"this",
"->",
"_sock",
")",
";",
"if",
"(",
"$",
"this",
"->",
"stream_eof",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"char",
"===",
"TEL_IAC",
"&&",
"$",
"this",
"->",
"negotiation_enabled",
")",
"{",
"$",
"this",
"->",
"_negotiate",
"(",
"fgetc",
"(",
"$",
"this",
"->",
"_sock",
")",
")",
";",
"return",
"\"\"",
";",
"}",
"$",
"this",
"->",
"_buff",
".=",
"$",
"char",
";",
"return",
"$",
"char",
";",
"}"
] | Get char from socket or call negotiation method if found telnet
negotiaton command.
@throws SocketClientException On socket communication error
@return char Char from socket connection | [
"Get",
"char",
"from",
"socket",
"or",
"call",
"negotiation",
"method",
"if",
"found",
"telnet",
"negotiaton",
"command",
"."
] | train | https://github.com/bosha/PTel/blob/049d72f8faaf6c2548353e715e06ad1f28c756b5/src/PTel.php#L240-L250 |
bosha/PTel | src/PTel.php | PTel.recvLine | public function recvLine($delimiter = "\n") {
$str = '';
while (!$this->stream_eof()) {
$char = $this->recvChr();
$str .= $char;
if ($char === false) { return $str; }
if (strpos($str, $delimiter) !== false) { return $str; }
}
return $str;
} | php | public function recvLine($delimiter = "\n") {
$str = '';
while (!$this->stream_eof()) {
$char = $this->recvChr();
$str .= $char;
if ($char === false) { return $str; }
if (strpos($str, $delimiter) !== false) { return $str; }
}
return $str;
} | [
"public",
"function",
"recvLine",
"(",
"$",
"delimiter",
"=",
"\"\\n\"",
")",
"{",
"$",
"str",
"=",
"''",
";",
"while",
"(",
"!",
"$",
"this",
"->",
"stream_eof",
"(",
")",
")",
"{",
"$",
"char",
"=",
"$",
"this",
"->",
"recvChr",
"(",
")",
";",
"$",
"str",
".=",
"$",
"char",
";",
"if",
"(",
"$",
"char",
"===",
"false",
")",
"{",
"return",
"$",
"str",
";",
"}",
"if",
"(",
"strpos",
"(",
"$",
"str",
",",
"$",
"delimiter",
")",
"!==",
"false",
")",
"{",
"return",
"$",
"str",
";",
"}",
"}",
"return",
"$",
"str",
";",
"}"
] | Receive line from connection
@param string $delimiter Line delimiter
@throws SocketClientException On socket communication error
@return string String from socket connection | [
"Receive",
"line",
"from",
"connection"
] | train | https://github.com/bosha/PTel/blob/049d72f8faaf6c2548353e715e06ad1f28c756b5/src/PTel.php#L260-L269 |
bosha/PTel | src/PTel.php | PTel.find | public function find($str) {
while ($line = $this->recvLine()) {
if (preg_match("/{$str}/", $line, $matches)) {
return $matches[0];
}
}
return false;
} | php | public function find($str) {
while ($line = $this->recvLine()) {
if (preg_match("/{$str}/", $line, $matches)) {
return $matches[0];
}
}
return false;
} | [
"public",
"function",
"find",
"(",
"$",
"str",
")",
"{",
"while",
"(",
"$",
"line",
"=",
"$",
"this",
"->",
"recvLine",
"(",
")",
")",
"{",
"if",
"(",
"preg_match",
"(",
"\"/{$str}/\"",
",",
"$",
"line",
",",
"$",
"matches",
")",
")",
"{",
"return",
"$",
"matches",
"[",
"0",
"]",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | Search for given string/regexp in stream output
@param string $str String or regexp for search
@throws SocketClientException On socket communication error
@return string|bool Line with search match, or false if not found/timeout | [
"Search",
"for",
"given",
"string",
"/",
"regexp",
"in",
"stream",
"output"
] | train | https://github.com/bosha/PTel/blob/049d72f8faaf6c2548353e715e06ad1f28c756b5/src/PTel.php#L293-L300 |
bosha/PTel | src/PTel.php | PTel.findAll | public function findAll($str) {
$this->recvAll();
$output_as_array = explode($this->retcarriage, $this->getBuffer());
foreach ($output_as_array as $line) {
if (preg_match("/{$str}/", $line, $matches)) {
return $matches[0];
}
}
return false;
} | php | public function findAll($str) {
$this->recvAll();
$output_as_array = explode($this->retcarriage, $this->getBuffer());
foreach ($output_as_array as $line) {
if (preg_match("/{$str}/", $line, $matches)) {
return $matches[0];
}
}
return false;
} | [
"public",
"function",
"findAll",
"(",
"$",
"str",
")",
"{",
"$",
"this",
"->",
"recvAll",
"(",
")",
";",
"$",
"output_as_array",
"=",
"explode",
"(",
"$",
"this",
"->",
"retcarriage",
",",
"$",
"this",
"->",
"getBuffer",
"(",
")",
")",
";",
"foreach",
"(",
"$",
"output_as_array",
"as",
"$",
"line",
")",
"{",
"if",
"(",
"preg_match",
"(",
"\"/{$str}/\"",
",",
"$",
"line",
",",
"$",
"matches",
")",
")",
"{",
"return",
"$",
"matches",
"[",
"0",
"]",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | Receive all data, and search through global buffer
@param string $str String to search (regex supported)
@return bool|string False if not found, string contains search | [
"Receive",
"all",
"data",
"and",
"search",
"through",
"global",
"buffer"
] | train | https://github.com/bosha/PTel/blob/049d72f8faaf6c2548353e715e06ad1f28c756b5/src/PTel.php#L309-L318 |
bosha/PTel | src/PTel.php | PTel.expect | public function expect($str, $cmd, $newline = true, $maxtimeout = 10) {
if ($this->waitFor($str, $maxtimeout)) {
$this->send($cmd, $newline);
return true;
}
} | php | public function expect($str, $cmd, $newline = true, $maxtimeout = 10) {
if ($this->waitFor($str, $maxtimeout)) {
$this->send($cmd, $newline);
return true;
}
} | [
"public",
"function",
"expect",
"(",
"$",
"str",
",",
"$",
"cmd",
",",
"$",
"newline",
"=",
"true",
",",
"$",
"maxtimeout",
"=",
"10",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"waitFor",
"(",
"$",
"str",
",",
"$",
"maxtimeout",
")",
")",
"{",
"$",
"this",
"->",
"send",
"(",
"$",
"cmd",
",",
"$",
"newline",
")",
";",
"return",
"true",
";",
"}",
"}"
] | Search for given occurance and send given command if found
@param string $str String/regexp for search
@param string $cmd Command to send
@param bool $newline Send new line character
@param int $maxtimeout Maximum timeout for waiting sought string
@throws SocketClientException On socket communication error
@throws TelnetException If wait timeout is reached
@return bool True on search and send success, false otherwise | [
"Search",
"for",
"given",
"occurance",
"and",
"send",
"given",
"command",
"if",
"found"
] | train | https://github.com/bosha/PTel/blob/049d72f8faaf6c2548353e715e06ad1f28c756b5/src/PTel.php#L332-L337 |
bosha/PTel | src/PTel.php | PTel.getMetaData | public function getMetaData($param) {
if (!$this->_sock) { throw new SocketClientException("Connection gone!"); }
$info = stream_get_meta_data($this->_sock);
return $info[$param];
} | php | public function getMetaData($param) {
if (!$this->_sock) { throw new SocketClientException("Connection gone!"); }
$info = stream_get_meta_data($this->_sock);
return $info[$param];
} | [
"public",
"function",
"getMetaData",
"(",
"$",
"param",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_sock",
")",
"{",
"throw",
"new",
"SocketClientException",
"(",
"\"Connection gone!\"",
")",
";",
"}",
"$",
"info",
"=",
"stream_get_meta_data",
"(",
"$",
"this",
"->",
"_sock",
")",
";",
"return",
"$",
"info",
"[",
"$",
"param",
"]",
";",
"}"
] | Return stream meta data parameter
@param $param string Parameter name
@throws SocketClientException On socket communication error
@return mixed Value of parameter | [
"Return",
"stream",
"meta",
"data",
"parameter"
] | train | https://github.com/bosha/PTel/blob/049d72f8faaf6c2548353e715e06ad1f28c756b5/src/PTel.php#L374-L378 |
bosha/PTel | src/PTel.php | PTel._negotiate | private function _negotiate($char) {
switch ($char) {
case TEL_DO:
$this->_negotiateDo(fgetc($this->_sock));
break;
case TEL_WILL:
$this->_negotiateWill(fgetc($this->_sock));
break;
}
} | php | private function _negotiate($char) {
switch ($char) {
case TEL_DO:
$this->_negotiateDo(fgetc($this->_sock));
break;
case TEL_WILL:
$this->_negotiateWill(fgetc($this->_sock));
break;
}
} | [
"private",
"function",
"_negotiate",
"(",
"$",
"char",
")",
"{",
"switch",
"(",
"$",
"char",
")",
"{",
"case",
"TEL_DO",
":",
"$",
"this",
"->",
"_negotiateDo",
"(",
"fgetc",
"(",
"$",
"this",
"->",
"_sock",
")",
")",
";",
"break",
";",
"case",
"TEL_WILL",
":",
"$",
"this",
"->",
"_negotiateWill",
"(",
"fgetc",
"(",
"$",
"this",
"->",
"_sock",
")",
")",
";",
"break",
";",
"}",
"}"
] | Telnet negotiation method. Run appropriate method based on type of
received command (DO or WILL)
@param $char binary Binary representation of command char | [
"Telnet",
"negotiation",
"method",
".",
"Run",
"appropriate",
"method",
"based",
"on",
"type",
"of",
"received",
"command",
"(",
"DO",
"or",
"WILL",
")"
] | train | https://github.com/bosha/PTel/blob/049d72f8faaf6c2548353e715e06ad1f28c756b5/src/PTel.php#L403-L412 |
bosha/PTel | src/PTel.php | PTel._negotiateDo | private function _negotiateDo($cmd) {
switch ($cmd) {
case TEL_TTYPE: // Send terminal type
$term = (binary) $this->terminal_type;
return $this->send(TEL_IAC.TEL_SUB.TEL_TTYPE.TEL_BIN.$term.
TEL_IAC.TEL_SUBEND,false);
case TEL_XDISPLOC: // Send display location
$hostname = (binary) php_uname('n').':0.0';
return $this->send(TEL_IAC.TEL_SUB.TEL_XDISPLOC.TEL_BIN.$hostname.
TEL_IAC.TEL_SUBEND, false);
case TEL_NEWENV: // Send new environment name
$env = (binary) 'DISPLAY ' . php_uname('n'). ':0.0';
return $this->send(TEL_IAC.TEL_SUB.TEL_NEWENV.TEL_BIN.$env.
TEL_IAC.TEL_SUBEND, false);
case TEL_TSPEED: // Send terminal speed
$tspeed = (binary) $this->terminal_speed_in . ','. $this->terminal_speed_out;
return $this->send(TEL_IAC.TEL_SUB.TEL_TSPEED.TEL_BIN.$tspeed.
TEL_IAC.TEL_SUBEND, false);
case TEL_NAWS: // Negotiate about window size
$null = chr(0);
$height = chr($this->window_size_height);
$width = chr($this->window_size_width);
return $this->send(TEL_IAC.TEL_SUB.TEL_NAWS.$null.$width.$null.$height.
TEL_IAC.TEL_SUBEND, false);
case TEL_GA:
break;
case TEL_ECHO: // This is workaround for some strange thing
return $this->send(TEL_IAC.TEL_WONT.TEL_ECHO, false);
default: // In case we didn't implement - tell that we will don't
// use this option
return $this->send(TEL_IAC.TEL_DONT.$cmd, false);
}
} | php | private function _negotiateDo($cmd) {
switch ($cmd) {
case TEL_TTYPE: // Send terminal type
$term = (binary) $this->terminal_type;
return $this->send(TEL_IAC.TEL_SUB.TEL_TTYPE.TEL_BIN.$term.
TEL_IAC.TEL_SUBEND,false);
case TEL_XDISPLOC: // Send display location
$hostname = (binary) php_uname('n').':0.0';
return $this->send(TEL_IAC.TEL_SUB.TEL_XDISPLOC.TEL_BIN.$hostname.
TEL_IAC.TEL_SUBEND, false);
case TEL_NEWENV: // Send new environment name
$env = (binary) 'DISPLAY ' . php_uname('n'). ':0.0';
return $this->send(TEL_IAC.TEL_SUB.TEL_NEWENV.TEL_BIN.$env.
TEL_IAC.TEL_SUBEND, false);
case TEL_TSPEED: // Send terminal speed
$tspeed = (binary) $this->terminal_speed_in . ','. $this->terminal_speed_out;
return $this->send(TEL_IAC.TEL_SUB.TEL_TSPEED.TEL_BIN.$tspeed.
TEL_IAC.TEL_SUBEND, false);
case TEL_NAWS: // Negotiate about window size
$null = chr(0);
$height = chr($this->window_size_height);
$width = chr($this->window_size_width);
return $this->send(TEL_IAC.TEL_SUB.TEL_NAWS.$null.$width.$null.$height.
TEL_IAC.TEL_SUBEND, false);
case TEL_GA:
break;
case TEL_ECHO: // This is workaround for some strange thing
return $this->send(TEL_IAC.TEL_WONT.TEL_ECHO, false);
default: // In case we didn't implement - tell that we will don't
// use this option
return $this->send(TEL_IAC.TEL_DONT.$cmd, false);
}
} | [
"private",
"function",
"_negotiateDo",
"(",
"$",
"cmd",
")",
"{",
"switch",
"(",
"$",
"cmd",
")",
"{",
"case",
"TEL_TTYPE",
":",
"// Send terminal type",
"$",
"term",
"=",
"(",
"binary",
")",
"$",
"this",
"->",
"terminal_type",
";",
"return",
"$",
"this",
"->",
"send",
"(",
"TEL_IAC",
".",
"TEL_SUB",
".",
"TEL_TTYPE",
".",
"TEL_BIN",
".",
"$",
"term",
".",
"TEL_IAC",
".",
"TEL_SUBEND",
",",
"false",
")",
";",
"case",
"TEL_XDISPLOC",
":",
"// Send display location",
"$",
"hostname",
"=",
"(",
"binary",
")",
"php_uname",
"(",
"'n'",
")",
".",
"':0.0'",
";",
"return",
"$",
"this",
"->",
"send",
"(",
"TEL_IAC",
".",
"TEL_SUB",
".",
"TEL_XDISPLOC",
".",
"TEL_BIN",
".",
"$",
"hostname",
".",
"TEL_IAC",
".",
"TEL_SUBEND",
",",
"false",
")",
";",
"case",
"TEL_NEWENV",
":",
"// Send new environment name",
"$",
"env",
"=",
"(",
"binary",
")",
"'DISPLAY '",
".",
"php_uname",
"(",
"'n'",
")",
".",
"':0.0'",
";",
"return",
"$",
"this",
"->",
"send",
"(",
"TEL_IAC",
".",
"TEL_SUB",
".",
"TEL_NEWENV",
".",
"TEL_BIN",
".",
"$",
"env",
".",
"TEL_IAC",
".",
"TEL_SUBEND",
",",
"false",
")",
";",
"case",
"TEL_TSPEED",
":",
"// Send terminal speed",
"$",
"tspeed",
"=",
"(",
"binary",
")",
"$",
"this",
"->",
"terminal_speed_in",
".",
"','",
".",
"$",
"this",
"->",
"terminal_speed_out",
";",
"return",
"$",
"this",
"->",
"send",
"(",
"TEL_IAC",
".",
"TEL_SUB",
".",
"TEL_TSPEED",
".",
"TEL_BIN",
".",
"$",
"tspeed",
".",
"TEL_IAC",
".",
"TEL_SUBEND",
",",
"false",
")",
";",
"case",
"TEL_NAWS",
":",
"// Negotiate about window size",
"$",
"null",
"=",
"chr",
"(",
"0",
")",
";",
"$",
"height",
"=",
"chr",
"(",
"$",
"this",
"->",
"window_size_height",
")",
";",
"$",
"width",
"=",
"chr",
"(",
"$",
"this",
"->",
"window_size_width",
")",
";",
"return",
"$",
"this",
"->",
"send",
"(",
"TEL_IAC",
".",
"TEL_SUB",
".",
"TEL_NAWS",
".",
"$",
"null",
".",
"$",
"width",
".",
"$",
"null",
".",
"$",
"height",
".",
"TEL_IAC",
".",
"TEL_SUBEND",
",",
"false",
")",
";",
"case",
"TEL_GA",
":",
"break",
";",
"case",
"TEL_ECHO",
":",
"// This is workaround for some strange thing",
"return",
"$",
"this",
"->",
"send",
"(",
"TEL_IAC",
".",
"TEL_WONT",
".",
"TEL_ECHO",
",",
"false",
")",
";",
"default",
":",
"// In case we didn't implement - tell that we will don't",
"// use this option",
"return",
"$",
"this",
"->",
"send",
"(",
"TEL_IAC",
".",
"TEL_DONT",
".",
"$",
"cmd",
",",
"false",
")",
";",
"}",
"}"
] | Telnet DO negotiaion
@param char $cmd Binary representation of command char
@throws SocketClientException On socket communication error
@return int Bytes written | [
"Telnet",
"DO",
"negotiaion"
] | train | https://github.com/bosha/PTel/blob/049d72f8faaf6c2548353e715e06ad1f28c756b5/src/PTel.php#L422-L454 |
bosha/PTel | src/PTel.php | PTel._negotiateWill | private function _negotiateWill($cmd) {
switch ($cmd) {
case TEL_GA:
break;
case TEL_ECHO:
break;
default:
return $this->send(TEL_IAC.TEL_WONT.$cmd, false);
}
} | php | private function _negotiateWill($cmd) {
switch ($cmd) {
case TEL_GA:
break;
case TEL_ECHO:
break;
default:
return $this->send(TEL_IAC.TEL_WONT.$cmd, false);
}
} | [
"private",
"function",
"_negotiateWill",
"(",
"$",
"cmd",
")",
"{",
"switch",
"(",
"$",
"cmd",
")",
"{",
"case",
"TEL_GA",
":",
"break",
";",
"case",
"TEL_ECHO",
":",
"break",
";",
"default",
":",
"return",
"$",
"this",
"->",
"send",
"(",
"TEL_IAC",
".",
"TEL_WONT",
".",
"$",
"cmd",
",",
"false",
")",
";",
"}",
"}"
] | Telnet WILL negotiaion
@param char $cmd Binary representation of command char
@throws SocketClientException On socket communication error
@return int Bytes written | [
"Telnet",
"WILL",
"negotiaion"
] | train | https://github.com/bosha/PTel/blob/049d72f8faaf6c2548353e715e06ad1f28c756b5/src/PTel.php#L464-L473 |
bosha/PTel | src/PTel.php | PTel.waitReply | public function waitReply($timeout = 10) {
$timestart = time();
while (true) {
$char = $this->recvChr();
$timerun = time() - $timestart;
if ($timerun >= $timeout) {
return false;
}
if(!empty($char)) {
return true;
}
}
return false;
} | php | public function waitReply($timeout = 10) {
$timestart = time();
while (true) {
$char = $this->recvChr();
$timerun = time() - $timestart;
if ($timerun >= $timeout) {
return false;
}
if(!empty($char)) {
return true;
}
}
return false;
} | [
"public",
"function",
"waitReply",
"(",
"$",
"timeout",
"=",
"10",
")",
"{",
"$",
"timestart",
"=",
"time",
"(",
")",
";",
"while",
"(",
"true",
")",
"{",
"$",
"char",
"=",
"$",
"this",
"->",
"recvChr",
"(",
")",
";",
"$",
"timerun",
"=",
"time",
"(",
")",
"-",
"$",
"timestart",
";",
"if",
"(",
"$",
"timerun",
">=",
"$",
"timeout",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"empty",
"(",
"$",
"char",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | Wait for reply from socket
@param int $timeout Max timeout to wait reply
@throws SocketClientException On socket communication error
@return bool True if found reply, false if timeout reached | [
"Wait",
"for",
"reply",
"from",
"socket"
] | train | https://github.com/bosha/PTel/blob/049d72f8faaf6c2548353e715e06ad1f28c756b5/src/PTel.php#L483-L496 |
bosha/PTel | src/PTel.php | PTel.waitFor | public function waitFor($str, $maxtimeout = 10) {
$timestart = time();
$buff = '';
while (true) {
$buff .= $this->recvChr();
$timerun = time() - $timestart;
if (preg_match("/$str/", $buff, $matches)) {
return true;
}
if ($timerun >= $maxtimeout) {
throw new TelnetException("Could not find occurance [ $str ] within timeout");
}
}
return false;
} | php | public function waitFor($str, $maxtimeout = 10) {
$timestart = time();
$buff = '';
while (true) {
$buff .= $this->recvChr();
$timerun = time() - $timestart;
if (preg_match("/$str/", $buff, $matches)) {
return true;
}
if ($timerun >= $maxtimeout) {
throw new TelnetException("Could not find occurance [ $str ] within timeout");
}
}
return false;
} | [
"public",
"function",
"waitFor",
"(",
"$",
"str",
",",
"$",
"maxtimeout",
"=",
"10",
")",
"{",
"$",
"timestart",
"=",
"time",
"(",
")",
";",
"$",
"buff",
"=",
"''",
";",
"while",
"(",
"true",
")",
"{",
"$",
"buff",
".=",
"$",
"this",
"->",
"recvChr",
"(",
")",
";",
"$",
"timerun",
"=",
"time",
"(",
")",
"-",
"$",
"timestart",
";",
"if",
"(",
"preg_match",
"(",
"\"/$str/\"",
",",
"$",
"buff",
",",
"$",
"matches",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"$",
"timerun",
">=",
"$",
"maxtimeout",
")",
"{",
"throw",
"new",
"TelnetException",
"(",
"\"Could not find occurance [ $str ] within timeout\"",
")",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | Wait for specified message from socket till timeout
@param string $str String to wait
@param int $maxtimeout Maximum timeout to wait
@throws SocketClientException On socket communication error
@throws TelnetException If maxtimeout reached
@return bool True if found | [
"Wait",
"for",
"specified",
"message",
"from",
"socket",
"till",
"timeout"
] | train | https://github.com/bosha/PTel/blob/049d72f8faaf6c2548353e715e06ad1f28c756b5/src/PTel.php#L508-L524 |
bosha/PTel | src/PTel.php | PTel.getOutputOf | public function getOutputOf($cmd, $newline = true, $maxtimeout = 10) {
$return = array();
$this->recvAll();
$this->send($cmd, $newline);
$timestart = time();
while (true) {
$buff = $this->recvLine();
$timerun = time() - $timestart;
if (strpos($buff, $this->prompt) !== false) {
break;
}
if (preg_match("/$this->page_delimiter/i", $buff)) {
$this->send(" ", false);
$timestart = time();
continue;
}
if ($timerun >= $maxtimeout) {
throw new TelnetException("Timeout reached while waiting to execute command: [ $cmd ]");
}
$return[] = $buff;
}
$newret = array_slice($return, 1, -1);
$newret = implode("\r", $newret);
return $newret;
} | php | public function getOutputOf($cmd, $newline = true, $maxtimeout = 10) {
$return = array();
$this->recvAll();
$this->send($cmd, $newline);
$timestart = time();
while (true) {
$buff = $this->recvLine();
$timerun = time() - $timestart;
if (strpos($buff, $this->prompt) !== false) {
break;
}
if (preg_match("/$this->page_delimiter/i", $buff)) {
$this->send(" ", false);
$timestart = time();
continue;
}
if ($timerun >= $maxtimeout) {
throw new TelnetException("Timeout reached while waiting to execute command: [ $cmd ]");
}
$return[] = $buff;
}
$newret = array_slice($return, 1, -1);
$newret = implode("\r", $newret);
return $newret;
} | [
"public",
"function",
"getOutputOf",
"(",
"$",
"cmd",
",",
"$",
"newline",
"=",
"true",
",",
"$",
"maxtimeout",
"=",
"10",
")",
"{",
"$",
"return",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"recvAll",
"(",
")",
";",
"$",
"this",
"->",
"send",
"(",
"$",
"cmd",
",",
"$",
"newline",
")",
";",
"$",
"timestart",
"=",
"time",
"(",
")",
";",
"while",
"(",
"true",
")",
"{",
"$",
"buff",
"=",
"$",
"this",
"->",
"recvLine",
"(",
")",
";",
"$",
"timerun",
"=",
"time",
"(",
")",
"-",
"$",
"timestart",
";",
"if",
"(",
"strpos",
"(",
"$",
"buff",
",",
"$",
"this",
"->",
"prompt",
")",
"!==",
"false",
")",
"{",
"break",
";",
"}",
"if",
"(",
"preg_match",
"(",
"\"/$this->page_delimiter/i\"",
",",
"$",
"buff",
")",
")",
"{",
"$",
"this",
"->",
"send",
"(",
"\" \"",
",",
"false",
")",
";",
"$",
"timestart",
"=",
"time",
"(",
")",
";",
"continue",
";",
"}",
"if",
"(",
"$",
"timerun",
">=",
"$",
"maxtimeout",
")",
"{",
"throw",
"new",
"TelnetException",
"(",
"\"Timeout reached while waiting to execute command: [ $cmd ]\"",
")",
";",
"}",
"$",
"return",
"[",
"]",
"=",
"$",
"buff",
";",
"}",
"$",
"newret",
"=",
"array_slice",
"(",
"$",
"return",
",",
"1",
",",
"-",
"1",
")",
";",
"$",
"newret",
"=",
"implode",
"(",
"\"\\r\"",
",",
"$",
"newret",
")",
";",
"return",
"$",
"newret",
";",
"}"
] | Get only output of running command
@param string $cmd Command to execute
@param bool $newline Add new line character, or not
@param int $maxtimeout Maximum timeout to wait command execution
@throws SocketClientException On socket communication error
@throws TelnetException If maximum timeout reached
@return string Result of command | [
"Get",
"only",
"output",
"of",
"running",
"command"
] | train | https://github.com/bosha/PTel/blob/049d72f8faaf6c2548353e715e06ad1f28c756b5/src/PTel.php#L538-L565 |
bosha/PTel | src/PTel.php | PTel.setTermSpeed | public function setTermSpeed($in, $out) {
$this->terminal_speed_in = $in;
$this->terminal_speed_out = $out;
return $this;
} | php | public function setTermSpeed($in, $out) {
$this->terminal_speed_in = $in;
$this->terminal_speed_out = $out;
return $this;
} | [
"public",
"function",
"setTermSpeed",
"(",
"$",
"in",
",",
"$",
"out",
")",
"{",
"$",
"this",
"->",
"terminal_speed_in",
"=",
"$",
"in",
";",
"$",
"this",
"->",
"terminal_speed_out",
"=",
"$",
"out",
";",
"return",
"$",
"this",
";",
"}"
] | Setting terminal speed
@param string $in String with inbound terminal speed
@param string $out String with outbound terminal speed
@return $this Instance of current class | [
"Setting",
"terminal",
"speed"
] | train | https://github.com/bosha/PTel/blob/049d72f8faaf6c2548353e715e06ad1f28c756b5/src/PTel.php#L587-L592 |
bosha/PTel | src/PTel.php | PTel.setWindowSize | public function setWindowSize($height, $width) {
if (!is_int($height) || !is_int($width)) {
throw new TelnetException("Wrong windows height or width used. Should valid integer.");
}
if ($height < 1 || $width < 1 || $height === 255 || $width === 255) {
throw new TelnetException("Window size can't be negative or 255");
}
$this->winsize_height = $height;
$this->winsize_widht = $width;
return $this;
} | php | public function setWindowSize($height, $width) {
if (!is_int($height) || !is_int($width)) {
throw new TelnetException("Wrong windows height or width used. Should valid integer.");
}
if ($height < 1 || $width < 1 || $height === 255 || $width === 255) {
throw new TelnetException("Window size can't be negative or 255");
}
$this->winsize_height = $height;
$this->winsize_widht = $width;
return $this;
} | [
"public",
"function",
"setWindowSize",
"(",
"$",
"height",
",",
"$",
"width",
")",
"{",
"if",
"(",
"!",
"is_int",
"(",
"$",
"height",
")",
"||",
"!",
"is_int",
"(",
"$",
"width",
")",
")",
"{",
"throw",
"new",
"TelnetException",
"(",
"\"Wrong windows height or width used. Should valid integer.\"",
")",
";",
"}",
"if",
"(",
"$",
"height",
"<",
"1",
"||",
"$",
"width",
"<",
"1",
"||",
"$",
"height",
"===",
"255",
"||",
"$",
"width",
"===",
"255",
")",
"{",
"throw",
"new",
"TelnetException",
"(",
"\"Window size can't be negative or 255\"",
")",
";",
"}",
"$",
"this",
"->",
"winsize_height",
"=",
"$",
"height",
";",
"$",
"this",
"->",
"winsize_widht",
"=",
"$",
"width",
";",
"return",
"$",
"this",
";",
"}"
] | Window size used while negotiating
@param int $height Window height
@param int $width Window width
@throws TelnetException On wrong parameter specified
@throws SocketClientException On socket communication error
@return $this Instance of current class | [
"Window",
"size",
"used",
"while",
"negotiating"
] | train | https://github.com/bosha/PTel/blob/049d72f8faaf6c2548353e715e06ad1f28c756b5/src/PTel.php#L605-L618 |
bosha/PTel | src/PTel.php | PTel.disconnect | public function disconnect() {
if ($this->_sock) {
fclose($this->_sock);
$this->_sock = null;
}
return $this;
} | php | public function disconnect() {
if ($this->_sock) {
fclose($this->_sock);
$this->_sock = null;
}
return $this;
} | [
"public",
"function",
"disconnect",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_sock",
")",
"{",
"fclose",
"(",
"$",
"this",
"->",
"_sock",
")",
";",
"$",
"this",
"->",
"_sock",
"=",
"null",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | Closing socket
@return $this Current class instance | [
"Closing",
"socket"
] | train | https://github.com/bosha/PTel/blob/049d72f8faaf6c2548353e715e06ad1f28c756b5/src/PTel.php#L654-L660 |
parsnick/steak | src/Console/StatusCommand.php | StatusCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$config = $this->container['config'];
$table = new Table($output);
$table
->setRows([
['<b>Build status</b>'],
[' Last build time', $this->formatLastBuildStatus()],
[' Last source modified', $this->getSourceLastModifiedTime()->diffForHumans()],
[''],
['<b>Sources</b>'],
[' Directory', $this->formatDirectoryState($config['source.directory'])],
[' Git repository', $this->getSourceRepo()],
[''],
['<b>Builds</b>'],
[' Output directory', $this->formatDirectoryState($config['build.directory'])],
[' Pipeline', implode(" | ", $config['build.pipeline'])],
[''],
['<b>Deployment</b>'],
[' Pushes to', $this->getDeploymentRepo()],
[''],
['<b>Gulp</b>'],
[' Binary', $config['gulp.bin']],
[' Gulpfile', $config['source.directory'] . DIRECTORY_SEPARATOR . $config['gulp.file']],
[''],
['<b>Server</b>'],
[' Relative URL', $config['serve.subdirectory']],
[''],
['<b>Extensions</b>'],
[' Bootstrap classes', $config['bootstrap'] ?: '(none)']
])
;
$table->render();
} | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$config = $this->container['config'];
$table = new Table($output);
$table
->setRows([
['<b>Build status</b>'],
[' Last build time', $this->formatLastBuildStatus()],
[' Last source modified', $this->getSourceLastModifiedTime()->diffForHumans()],
[''],
['<b>Sources</b>'],
[' Directory', $this->formatDirectoryState($config['source.directory'])],
[' Git repository', $this->getSourceRepo()],
[''],
['<b>Builds</b>'],
[' Output directory', $this->formatDirectoryState($config['build.directory'])],
[' Pipeline', implode(" | ", $config['build.pipeline'])],
[''],
['<b>Deployment</b>'],
[' Pushes to', $this->getDeploymentRepo()],
[''],
['<b>Gulp</b>'],
[' Binary', $config['gulp.bin']],
[' Gulpfile', $config['source.directory'] . DIRECTORY_SEPARATOR . $config['gulp.file']],
[''],
['<b>Server</b>'],
[' Relative URL', $config['serve.subdirectory']],
[''],
['<b>Extensions</b>'],
[' Bootstrap classes', $config['bootstrap'] ?: '(none)']
])
;
$table->render();
} | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"container",
"[",
"'config'",
"]",
";",
"$",
"table",
"=",
"new",
"Table",
"(",
"$",
"output",
")",
";",
"$",
"table",
"->",
"setRows",
"(",
"[",
"[",
"'<b>Build status</b>'",
"]",
",",
"[",
"' Last build time'",
",",
"$",
"this",
"->",
"formatLastBuildStatus",
"(",
")",
"]",
",",
"[",
"' Last source modified'",
",",
"$",
"this",
"->",
"getSourceLastModifiedTime",
"(",
")",
"->",
"diffForHumans",
"(",
")",
"]",
",",
"[",
"''",
"]",
",",
"[",
"'<b>Sources</b>'",
"]",
",",
"[",
"' Directory'",
",",
"$",
"this",
"->",
"formatDirectoryState",
"(",
"$",
"config",
"[",
"'source.directory'",
"]",
")",
"]",
",",
"[",
"' Git repository'",
",",
"$",
"this",
"->",
"getSourceRepo",
"(",
")",
"]",
",",
"[",
"''",
"]",
",",
"[",
"'<b>Builds</b>'",
"]",
",",
"[",
"' Output directory'",
",",
"$",
"this",
"->",
"formatDirectoryState",
"(",
"$",
"config",
"[",
"'build.directory'",
"]",
")",
"]",
",",
"[",
"' Pipeline'",
",",
"implode",
"(",
"\" | \"",
",",
"$",
"config",
"[",
"'build.pipeline'",
"]",
")",
"]",
",",
"[",
"''",
"]",
",",
"[",
"'<b>Deployment</b>'",
"]",
",",
"[",
"' Pushes to'",
",",
"$",
"this",
"->",
"getDeploymentRepo",
"(",
")",
"]",
",",
"[",
"''",
"]",
",",
"[",
"'<b>Gulp</b>'",
"]",
",",
"[",
"' Binary'",
",",
"$",
"config",
"[",
"'gulp.bin'",
"]",
"]",
",",
"[",
"' Gulpfile'",
",",
"$",
"config",
"[",
"'source.directory'",
"]",
".",
"DIRECTORY_SEPARATOR",
".",
"$",
"config",
"[",
"'gulp.file'",
"]",
"]",
",",
"[",
"''",
"]",
",",
"[",
"'<b>Server</b>'",
"]",
",",
"[",
"' Relative URL'",
",",
"$",
"config",
"[",
"'serve.subdirectory'",
"]",
"]",
",",
"[",
"''",
"]",
",",
"[",
"'<b>Extensions</b>'",
"]",
",",
"[",
"' Bootstrap classes'",
",",
"$",
"config",
"[",
"'bootstrap'",
"]",
"?",
":",
"'(none)'",
"]",
"]",
")",
";",
"$",
"table",
"->",
"render",
"(",
")",
";",
"}"
] | Execute the command.
@param InputInterface $input
@param OutputInterface $output
@return void | [
"Execute",
"the",
"command",
"."
] | train | https://github.com/parsnick/steak/blob/461869189a640938438187330f6c50aca97c5ccc/src/Console/StatusCommand.php#L37-L72 |
dunkelfrosch/phpcoverfish | src/PHPCoverFish/Common/CoverFishMessageError.php | CoverFishMessageError.getErrorStreamTemplate | public function getErrorStreamTemplate(CoverFishMapping $coverMapping, $noAnsiColors = false)
{
$coverLine = null;
switch ($this->getMessageCode()) {
case self::PHPUNIT_REFLECTION_CLASS_NOT_FOUND:
$coverLine = sprintf('@covers %s::%s', $coverMapping->getClassFQN(), $coverMapping->getMethod());
if (!$noAnsiColors) {
$coverLine = Color::tplNormalColor('@covers ');
$coverLine .= Color::tplMarkFailure($coverMapping->getClassFQN());
$coverLine .= Color::tplYellowColor('::' . $coverMapping->getMethod());
}
if (null === $coverMapping->getMethod()) {
$coverLine = str_replace('::', null, $coverLine);
}
break;
case self::PHPUNIT_REFLECTION_METHOD_NOT_FOUND:
$coverLine = sprintf('@covers %s::%s', $coverMapping->getClassFQN(), $coverMapping->getMethod());
if (!$noAnsiColors) {
$coverLine = Color::tplNormalColor('@covers ');
$coverLine .= Color::tplYellowColor($coverMapping->getClassFQN() . '::');
$coverLine .= Color::tplMarkFailure($coverMapping->getMethod());
}
break;
case self::PHPUNIT_REFLECTION_CLASS_NOT_DEFINED:
$coverLine = sprintf('@covers %s', $coverMapping->getClassFQN());
if (!$noAnsiColors) {
$coverLine = Color::tplNormalColor('@covers ');
$coverLine .= Color::tplMarkFailure($coverMapping->getClassFQN());
}
break;
case self::PHPUNIT_REFLECTION_NO_PUBLIC_METHODS_FOUND:
case self::PHPUNIT_REFLECTION_NO_PROTECTED_METHODS_FOUND:
case self::PHPUNIT_REFLECTION_NO_PRIVATE_METHODS_FOUND:
case self::PHPUNIT_REFLECTION_NO_NOT_PUBLIC_METHODS_FOUND:
case self::PHPUNIT_REFLECTION_NO_NOT_PROTECTED_METHODS_FOUND:
case self::PHPUNIT_REFLECTION_NO_NOT_PRIVATE_METHODS_FOUND:
$coverLine = sprintf('@covers %s::<%s>', $coverMapping->getClassFQN(), $coverMapping->getAccessor());
if (!$noAnsiColors) {
$coverLine = Color::tplNormalColor('@covers ');
$coverLine .= Color::tplYellowColor($coverMapping->getClassFQN() . '::<');
$coverLine .= Color::tplMarkFailure($coverMapping->getAccessor());
$coverLine .= Color::tplYellowColor('>');
}
break;
case self::PHPUNIT_VALIDATOR_MISSING_DEFAULT_COVER_CLASS_PROBLEM:
$coverLine = sprintf('@covers %s', $coverMapping->getClass());
if (!$noAnsiColors) {
$coverLine = Color::tplNormalColor('@covers ');
$coverLine .= Color::tplMarkFailure($coverMapping->getClass());
}
break;
case self::PHPUNIT_VALIDATOR_PROBLEM:
break;
default:
break;
}
return $coverLine;
} | php | public function getErrorStreamTemplate(CoverFishMapping $coverMapping, $noAnsiColors = false)
{
$coverLine = null;
switch ($this->getMessageCode()) {
case self::PHPUNIT_REFLECTION_CLASS_NOT_FOUND:
$coverLine = sprintf('@covers %s::%s', $coverMapping->getClassFQN(), $coverMapping->getMethod());
if (!$noAnsiColors) {
$coverLine = Color::tplNormalColor('@covers ');
$coverLine .= Color::tplMarkFailure($coverMapping->getClassFQN());
$coverLine .= Color::tplYellowColor('::' . $coverMapping->getMethod());
}
if (null === $coverMapping->getMethod()) {
$coverLine = str_replace('::', null, $coverLine);
}
break;
case self::PHPUNIT_REFLECTION_METHOD_NOT_FOUND:
$coverLine = sprintf('@covers %s::%s', $coverMapping->getClassFQN(), $coverMapping->getMethod());
if (!$noAnsiColors) {
$coverLine = Color::tplNormalColor('@covers ');
$coverLine .= Color::tplYellowColor($coverMapping->getClassFQN() . '::');
$coverLine .= Color::tplMarkFailure($coverMapping->getMethod());
}
break;
case self::PHPUNIT_REFLECTION_CLASS_NOT_DEFINED:
$coverLine = sprintf('@covers %s', $coverMapping->getClassFQN());
if (!$noAnsiColors) {
$coverLine = Color::tplNormalColor('@covers ');
$coverLine .= Color::tplMarkFailure($coverMapping->getClassFQN());
}
break;
case self::PHPUNIT_REFLECTION_NO_PUBLIC_METHODS_FOUND:
case self::PHPUNIT_REFLECTION_NO_PROTECTED_METHODS_FOUND:
case self::PHPUNIT_REFLECTION_NO_PRIVATE_METHODS_FOUND:
case self::PHPUNIT_REFLECTION_NO_NOT_PUBLIC_METHODS_FOUND:
case self::PHPUNIT_REFLECTION_NO_NOT_PROTECTED_METHODS_FOUND:
case self::PHPUNIT_REFLECTION_NO_NOT_PRIVATE_METHODS_FOUND:
$coverLine = sprintf('@covers %s::<%s>', $coverMapping->getClassFQN(), $coverMapping->getAccessor());
if (!$noAnsiColors) {
$coverLine = Color::tplNormalColor('@covers ');
$coverLine .= Color::tplYellowColor($coverMapping->getClassFQN() . '::<');
$coverLine .= Color::tplMarkFailure($coverMapping->getAccessor());
$coverLine .= Color::tplYellowColor('>');
}
break;
case self::PHPUNIT_VALIDATOR_MISSING_DEFAULT_COVER_CLASS_PROBLEM:
$coverLine = sprintf('@covers %s', $coverMapping->getClass());
if (!$noAnsiColors) {
$coverLine = Color::tplNormalColor('@covers ');
$coverLine .= Color::tplMarkFailure($coverMapping->getClass());
}
break;
case self::PHPUNIT_VALIDATOR_PROBLEM:
break;
default:
break;
}
return $coverLine;
} | [
"public",
"function",
"getErrorStreamTemplate",
"(",
"CoverFishMapping",
"$",
"coverMapping",
",",
"$",
"noAnsiColors",
"=",
"false",
")",
"{",
"$",
"coverLine",
"=",
"null",
";",
"switch",
"(",
"$",
"this",
"->",
"getMessageCode",
"(",
")",
")",
"{",
"case",
"self",
"::",
"PHPUNIT_REFLECTION_CLASS_NOT_FOUND",
":",
"$",
"coverLine",
"=",
"sprintf",
"(",
"'@covers %s::%s'",
",",
"$",
"coverMapping",
"->",
"getClassFQN",
"(",
")",
",",
"$",
"coverMapping",
"->",
"getMethod",
"(",
")",
")",
";",
"if",
"(",
"!",
"$",
"noAnsiColors",
")",
"{",
"$",
"coverLine",
"=",
"Color",
"::",
"tplNormalColor",
"(",
"'@covers '",
")",
";",
"$",
"coverLine",
".=",
"Color",
"::",
"tplMarkFailure",
"(",
"$",
"coverMapping",
"->",
"getClassFQN",
"(",
")",
")",
";",
"$",
"coverLine",
".=",
"Color",
"::",
"tplYellowColor",
"(",
"'::'",
".",
"$",
"coverMapping",
"->",
"getMethod",
"(",
")",
")",
";",
"}",
"if",
"(",
"null",
"===",
"$",
"coverMapping",
"->",
"getMethod",
"(",
")",
")",
"{",
"$",
"coverLine",
"=",
"str_replace",
"(",
"'::'",
",",
"null",
",",
"$",
"coverLine",
")",
";",
"}",
"break",
";",
"case",
"self",
"::",
"PHPUNIT_REFLECTION_METHOD_NOT_FOUND",
":",
"$",
"coverLine",
"=",
"sprintf",
"(",
"'@covers %s::%s'",
",",
"$",
"coverMapping",
"->",
"getClassFQN",
"(",
")",
",",
"$",
"coverMapping",
"->",
"getMethod",
"(",
")",
")",
";",
"if",
"(",
"!",
"$",
"noAnsiColors",
")",
"{",
"$",
"coverLine",
"=",
"Color",
"::",
"tplNormalColor",
"(",
"'@covers '",
")",
";",
"$",
"coverLine",
".=",
"Color",
"::",
"tplYellowColor",
"(",
"$",
"coverMapping",
"->",
"getClassFQN",
"(",
")",
".",
"'::'",
")",
";",
"$",
"coverLine",
".=",
"Color",
"::",
"tplMarkFailure",
"(",
"$",
"coverMapping",
"->",
"getMethod",
"(",
")",
")",
";",
"}",
"break",
";",
"case",
"self",
"::",
"PHPUNIT_REFLECTION_CLASS_NOT_DEFINED",
":",
"$",
"coverLine",
"=",
"sprintf",
"(",
"'@covers %s'",
",",
"$",
"coverMapping",
"->",
"getClassFQN",
"(",
")",
")",
";",
"if",
"(",
"!",
"$",
"noAnsiColors",
")",
"{",
"$",
"coverLine",
"=",
"Color",
"::",
"tplNormalColor",
"(",
"'@covers '",
")",
";",
"$",
"coverLine",
".=",
"Color",
"::",
"tplMarkFailure",
"(",
"$",
"coverMapping",
"->",
"getClassFQN",
"(",
")",
")",
";",
"}",
"break",
";",
"case",
"self",
"::",
"PHPUNIT_REFLECTION_NO_PUBLIC_METHODS_FOUND",
":",
"case",
"self",
"::",
"PHPUNIT_REFLECTION_NO_PROTECTED_METHODS_FOUND",
":",
"case",
"self",
"::",
"PHPUNIT_REFLECTION_NO_PRIVATE_METHODS_FOUND",
":",
"case",
"self",
"::",
"PHPUNIT_REFLECTION_NO_NOT_PUBLIC_METHODS_FOUND",
":",
"case",
"self",
"::",
"PHPUNIT_REFLECTION_NO_NOT_PROTECTED_METHODS_FOUND",
":",
"case",
"self",
"::",
"PHPUNIT_REFLECTION_NO_NOT_PRIVATE_METHODS_FOUND",
":",
"$",
"coverLine",
"=",
"sprintf",
"(",
"'@covers %s::<%s>'",
",",
"$",
"coverMapping",
"->",
"getClassFQN",
"(",
")",
",",
"$",
"coverMapping",
"->",
"getAccessor",
"(",
")",
")",
";",
"if",
"(",
"!",
"$",
"noAnsiColors",
")",
"{",
"$",
"coverLine",
"=",
"Color",
"::",
"tplNormalColor",
"(",
"'@covers '",
")",
";",
"$",
"coverLine",
".=",
"Color",
"::",
"tplYellowColor",
"(",
"$",
"coverMapping",
"->",
"getClassFQN",
"(",
")",
".",
"'::<'",
")",
";",
"$",
"coverLine",
".=",
"Color",
"::",
"tplMarkFailure",
"(",
"$",
"coverMapping",
"->",
"getAccessor",
"(",
")",
")",
";",
"$",
"coverLine",
".=",
"Color",
"::",
"tplYellowColor",
"(",
"'>'",
")",
";",
"}",
"break",
";",
"case",
"self",
"::",
"PHPUNIT_VALIDATOR_MISSING_DEFAULT_COVER_CLASS_PROBLEM",
":",
"$",
"coverLine",
"=",
"sprintf",
"(",
"'@covers %s'",
",",
"$",
"coverMapping",
"->",
"getClass",
"(",
")",
")",
";",
"if",
"(",
"!",
"$",
"noAnsiColors",
")",
"{",
"$",
"coverLine",
"=",
"Color",
"::",
"tplNormalColor",
"(",
"'@covers '",
")",
";",
"$",
"coverLine",
".=",
"Color",
"::",
"tplMarkFailure",
"(",
"$",
"coverMapping",
"->",
"getClass",
"(",
")",
")",
";",
"}",
"break",
";",
"case",
"self",
"::",
"PHPUNIT_VALIDATOR_PROBLEM",
":",
"break",
";",
"default",
":",
"break",
";",
"}",
"return",
"$",
"coverLine",
";",
"}"
] | @param CoverFishMapping $coverMapping
@param bool|false $noAnsiColors
@return null|string | [
"@param",
"CoverFishMapping",
"$coverMapping",
"@param",
"bool|false",
"$noAnsiColors"
] | train | https://github.com/dunkelfrosch/phpcoverfish/blob/779bd399ec8f4cadb3b7854200695c5eb3f5a8ad/src/PHPCoverFish/Common/CoverFishMessageError.php#L66-L136 |
afrittella/back-project | src/app/Http/Controllers/Auth/RegisterController.php | RegisterController.showRegistrationForm | public function showRegistrationForm()
{
//if registration is closed, deny access
if (!config('back-project.registration_open')) {
abort(403, trans('back-project::base.registration_closed'));
}
$this->data['title'] = trans('back-project::base.register'); // set the page title
return view('back-project::auth.register', $this->data);
} | php | public function showRegistrationForm()
{
//if registration is closed, deny access
if (!config('back-project.registration_open')) {
abort(403, trans('back-project::base.registration_closed'));
}
$this->data['title'] = trans('back-project::base.register'); // set the page title
return view('back-project::auth.register', $this->data);
} | [
"public",
"function",
"showRegistrationForm",
"(",
")",
"{",
"//if registration is closed, deny access",
"if",
"(",
"!",
"config",
"(",
"'back-project.registration_open'",
")",
")",
"{",
"abort",
"(",
"403",
",",
"trans",
"(",
"'back-project::base.registration_closed'",
")",
")",
";",
"}",
"$",
"this",
"->",
"data",
"[",
"'title'",
"]",
"=",
"trans",
"(",
"'back-project::base.register'",
")",
";",
"// set the page title",
"return",
"view",
"(",
"'back-project::auth.register'",
",",
"$",
"this",
"->",
"data",
")",
";",
"}"
] | Show the application registration form.
@return \Illuminate\Http\Response | [
"Show",
"the",
"application",
"registration",
"form",
"."
] | train | https://github.com/afrittella/back-project/blob/e1aa2e3ee03d453033f75a4b16f073c60b5f32d1/src/app/Http/Controllers/Auth/RegisterController.php#L38-L46 |
afrittella/back-project | src/app/Http/Controllers/Auth/RegisterController.php | RegisterController.register | public function register(Request $request, Users $users)
{
// if registration is closed, deny access
if (!config('back-project.registration_open')) {
abort(403, trans('back-project::base.registration_closed'));
}
$this->validator($request->all())->validate();
//$this->guard()->login($this->create($request->all()));
$user = $users->create($request->all());
event(new Registered($user->id));
if ($users->getModel()->count() == 1) {
$user->assignRole('administrator');
} else {
$user->assignRole('user');
}
Alert::add('success', trans('back-project::base.registration_email'))->flash();
return redirect(route('login'));
} | php | public function register(Request $request, Users $users)
{
// if registration is closed, deny access
if (!config('back-project.registration_open')) {
abort(403, trans('back-project::base.registration_closed'));
}
$this->validator($request->all())->validate();
//$this->guard()->login($this->create($request->all()));
$user = $users->create($request->all());
event(new Registered($user->id));
if ($users->getModel()->count() == 1) {
$user->assignRole('administrator');
} else {
$user->assignRole('user');
}
Alert::add('success', trans('back-project::base.registration_email'))->flash();
return redirect(route('login'));
} | [
"public",
"function",
"register",
"(",
"Request",
"$",
"request",
",",
"Users",
"$",
"users",
")",
"{",
"// if registration is closed, deny access",
"if",
"(",
"!",
"config",
"(",
"'back-project.registration_open'",
")",
")",
"{",
"abort",
"(",
"403",
",",
"trans",
"(",
"'back-project::base.registration_closed'",
")",
")",
";",
"}",
"$",
"this",
"->",
"validator",
"(",
"$",
"request",
"->",
"all",
"(",
")",
")",
"->",
"validate",
"(",
")",
";",
"//$this->guard()->login($this->create($request->all()));",
"$",
"user",
"=",
"$",
"users",
"->",
"create",
"(",
"$",
"request",
"->",
"all",
"(",
")",
")",
";",
"event",
"(",
"new",
"Registered",
"(",
"$",
"user",
"->",
"id",
")",
")",
";",
"if",
"(",
"$",
"users",
"->",
"getModel",
"(",
")",
"->",
"count",
"(",
")",
"==",
"1",
")",
"{",
"$",
"user",
"->",
"assignRole",
"(",
"'administrator'",
")",
";",
"}",
"else",
"{",
"$",
"user",
"->",
"assignRole",
"(",
"'user'",
")",
";",
"}",
"Alert",
"::",
"add",
"(",
"'success'",
",",
"trans",
"(",
"'back-project::base.registration_email'",
")",
")",
"->",
"flash",
"(",
")",
";",
"return",
"redirect",
"(",
"route",
"(",
"'login'",
")",
")",
";",
"}"
] | Handle a registration request for the application.
@param \Illuminate\Http\Request $request
@return \Illuminate\Http\RedirectResponse | [
"Handle",
"a",
"registration",
"request",
"for",
"the",
"application",
"."
] | train | https://github.com/afrittella/back-project/blob/e1aa2e3ee03d453033f75a4b16f073c60b5f32d1/src/app/Http/Controllers/Auth/RegisterController.php#L55-L76 |
steeffeen/FancyManiaLinks | FML/XmlRpc/TMUIProperties.php | TMUIProperties.setLiveInfoPosition | public function setLiveInfoPosition($positionX, $positionY, $positionZ = null)
{
$this->setPositionProperty($this->liveInfoProperties, $positionX, $positionY, $positionZ);
return $this;
} | php | public function setLiveInfoPosition($positionX, $positionY, $positionZ = null)
{
$this->setPositionProperty($this->liveInfoProperties, $positionX, $positionY, $positionZ);
return $this;
} | [
"public",
"function",
"setLiveInfoPosition",
"(",
"$",
"positionX",
",",
"$",
"positionY",
",",
"$",
"positionZ",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"setPositionProperty",
"(",
"$",
"this",
"->",
"liveInfoProperties",
",",
"$",
"positionX",
",",
"$",
"positionY",
",",
"$",
"positionZ",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Set the live info position
@api
@param float $positionX X position
@param float $positionY Y position
@param float $positionZ (optional) Z position (Z-index)
@return static | [
"Set",
"the",
"live",
"info",
"position"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/XmlRpc/TMUIProperties.php#L124-L128 |
steeffeen/FancyManiaLinks | FML/XmlRpc/TMUIProperties.php | TMUIProperties.setSpectatorInfoPosition | public function setSpectatorInfoPosition($positionX, $positionY, $positionZ = null)
{
$this->setPositionProperty($this->spectatorInfoProperties, $positionX, $positionY, $positionZ);
return $this;
} | php | public function setSpectatorInfoPosition($positionX, $positionY, $positionZ = null)
{
$this->setPositionProperty($this->spectatorInfoProperties, $positionX, $positionY, $positionZ);
return $this;
} | [
"public",
"function",
"setSpectatorInfoPosition",
"(",
"$",
"positionX",
",",
"$",
"positionY",
",",
"$",
"positionZ",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"setPositionProperty",
"(",
"$",
"this",
"->",
"spectatorInfoProperties",
",",
"$",
"positionX",
",",
"$",
"positionY",
",",
"$",
"positionZ",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Set the spectator info position
@api
@param float $positionX X position
@param float $positionY Y position
@param float $positionZ (optional) Z position (Z-index)
@return static | [
"Set",
"the",
"spectator",
"info",
"position"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/XmlRpc/TMUIProperties.php#L174-L178 |
steeffeen/FancyManiaLinks | FML/XmlRpc/TMUIProperties.php | TMUIProperties.setCheckpointListPosition | public function setCheckpointListPosition($positionX, $positionY, $positionZ = null)
{
$this->setPositionProperty($this->checkpointListProperties, $positionX, $positionY, $positionZ);
return $this;
} | php | public function setCheckpointListPosition($positionX, $positionY, $positionZ = null)
{
$this->setPositionProperty($this->checkpointListProperties, $positionX, $positionY, $positionZ);
return $this;
} | [
"public",
"function",
"setCheckpointListPosition",
"(",
"$",
"positionX",
",",
"$",
"positionY",
",",
"$",
"positionZ",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"setPositionProperty",
"(",
"$",
"this",
"->",
"checkpointListProperties",
",",
"$",
"positionX",
",",
"$",
"positionY",
",",
"$",
"positionZ",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Set the checkpoint list position
@api
@param float $positionX X position
@param float $positionY Y position
@param float $positionZ (optional) Z position (Z-index)
@return static | [
"Set",
"the",
"checkpoint",
"list",
"position"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/XmlRpc/TMUIProperties.php#L248-L252 |
steeffeen/FancyManiaLinks | FML/XmlRpc/TMUIProperties.php | TMUIProperties.setRoundScoresPosition | public function setRoundScoresPosition($positionX, $positionY, $positionZ = null)
{
$this->setPositionProperty($this->roundScoresProperties, $positionX, $positionY, $positionZ);
return $this;
} | php | public function setRoundScoresPosition($positionX, $positionY, $positionZ = null)
{
$this->setPositionProperty($this->roundScoresProperties, $positionX, $positionY, $positionZ);
return $this;
} | [
"public",
"function",
"setRoundScoresPosition",
"(",
"$",
"positionX",
",",
"$",
"positionY",
",",
"$",
"positionZ",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"setPositionProperty",
"(",
"$",
"this",
"->",
"roundScoresProperties",
",",
"$",
"positionX",
",",
"$",
"positionY",
",",
"$",
"positionZ",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Set the round scores position
@api
@param float $positionX X position
@param float $positionY Y position
@param float $positionZ (optional) Z position (Z-index)
@return static | [
"Set",
"the",
"round",
"scores",
"position"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/XmlRpc/TMUIProperties.php#L298-L302 |
steeffeen/FancyManiaLinks | FML/XmlRpc/TMUIProperties.php | TMUIProperties.setChronoPosition | public function setChronoPosition($positionX, $positionY, $positionZ = null)
{
$this->setPositionProperty($this->chronoProperties, $positionX, $positionY, $positionZ);
return $this;
} | php | public function setChronoPosition($positionX, $positionY, $positionZ = null)
{
$this->setPositionProperty($this->chronoProperties, $positionX, $positionY, $positionZ);
return $this;
} | [
"public",
"function",
"setChronoPosition",
"(",
"$",
"positionX",
",",
"$",
"positionY",
",",
"$",
"positionZ",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"setPositionProperty",
"(",
"$",
"this",
"->",
"chronoProperties",
",",
"$",
"positionX",
",",
"$",
"positionY",
",",
"$",
"positionZ",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Set the chrono position
@api
@param float $positionX X position
@param float $positionY Y position
@param float $positionZ (optional) Z position (Z-index)
@return static | [
"Set",
"the",
"chrono",
"position"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/XmlRpc/TMUIProperties.php#L348-L352 |
steeffeen/FancyManiaLinks | FML/XmlRpc/TMUIProperties.php | TMUIProperties.setSpeedAndDistancePosition | public function setSpeedAndDistancePosition($positionX, $positionY, $positionZ = null)
{
$this->setPositionProperty($this->speedAndDistanceProperties, $positionX, $positionY, $positionZ);
return $this;
} | php | public function setSpeedAndDistancePosition($positionX, $positionY, $positionZ = null)
{
$this->setPositionProperty($this->speedAndDistanceProperties, $positionX, $positionY, $positionZ);
return $this;
} | [
"public",
"function",
"setSpeedAndDistancePosition",
"(",
"$",
"positionX",
",",
"$",
"positionY",
",",
"$",
"positionZ",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"setPositionProperty",
"(",
"$",
"this",
"->",
"speedAndDistanceProperties",
",",
"$",
"positionX",
",",
"$",
"positionY",
",",
"$",
"positionZ",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Set the speed and distance position
@api
@param float $positionX X position
@param float $positionY Y position
@param float $positionZ (optional) Z position (Z-index)
@return static | [
"Set",
"the",
"speed",
"and",
"distance",
"position"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/XmlRpc/TMUIProperties.php#L398-L402 |
steeffeen/FancyManiaLinks | FML/XmlRpc/TMUIProperties.php | TMUIProperties.setPersonalBestAndRankPosition | public function setPersonalBestAndRankPosition($positionX, $positionY, $positionZ = null)
{
$this->setPositionProperty($this->personalBestAndRankProperties, $positionX, $positionY, $positionZ);
return $this;
} | php | public function setPersonalBestAndRankPosition($positionX, $positionY, $positionZ = null)
{
$this->setPositionProperty($this->personalBestAndRankProperties, $positionX, $positionY, $positionZ);
return $this;
} | [
"public",
"function",
"setPersonalBestAndRankPosition",
"(",
"$",
"positionX",
",",
"$",
"positionY",
",",
"$",
"positionZ",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"setPositionProperty",
"(",
"$",
"this",
"->",
"personalBestAndRankProperties",
",",
"$",
"positionX",
",",
"$",
"positionY",
",",
"$",
"positionZ",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Set the personal best and rank position
@api
@param float $positionX X position
@param float $positionY Y position
@param float $positionZ (optional) Z position (Z-index)
@return static | [
"Set",
"the",
"personal",
"best",
"and",
"rank",
"position"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/XmlRpc/TMUIProperties.php#L448-L452 |
steeffeen/FancyManiaLinks | FML/XmlRpc/TMUIProperties.php | TMUIProperties.setPositionPosition | public function setPositionPosition($positionX, $positionY, $positionZ = null)
{
$this->setPositionProperty($this->positionProperties, $positionX, $positionY, $positionZ);
return $this;
} | php | public function setPositionPosition($positionX, $positionY, $positionZ = null)
{
$this->setPositionProperty($this->positionProperties, $positionX, $positionY, $positionZ);
return $this;
} | [
"public",
"function",
"setPositionPosition",
"(",
"$",
"positionX",
",",
"$",
"positionY",
",",
"$",
"positionZ",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"setPositionProperty",
"(",
"$",
"this",
"->",
"positionProperties",
",",
"$",
"positionX",
",",
"$",
"positionY",
",",
"$",
"positionZ",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Set the position position
@api
@param float $positionX X position
@param float $positionY Y position
@param float $positionZ (optional) Z position (Z-index)
@return static | [
"Set",
"the",
"position",
"position"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/XmlRpc/TMUIProperties.php#L498-L502 |
steeffeen/FancyManiaLinks | FML/XmlRpc/TMUIProperties.php | TMUIProperties.setCheckpointTimePosition | public function setCheckpointTimePosition($positionX, $positionY, $positionZ = null)
{
$this->setPositionProperty($this->checkpointTimeProperties, $positionX, $positionY, $positionZ);
return $this;
} | php | public function setCheckpointTimePosition($positionX, $positionY, $positionZ = null)
{
$this->setPositionProperty($this->checkpointTimeProperties, $positionX, $positionY, $positionZ);
return $this;
} | [
"public",
"function",
"setCheckpointTimePosition",
"(",
"$",
"positionX",
",",
"$",
"positionY",
",",
"$",
"positionZ",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"setPositionProperty",
"(",
"$",
"this",
"->",
"checkpointTimeProperties",
",",
"$",
"positionX",
",",
"$",
"positionY",
",",
"$",
"positionZ",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Set the checkpoint time position
@api
@param float $positionX X position
@param float $positionY Y position
@param float $positionZ (optional) Z position (Z-index)
@return static | [
"Set",
"the",
"checkpoint",
"time",
"position"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/XmlRpc/TMUIProperties.php#L548-L552 |
steeffeen/FancyManiaLinks | FML/XmlRpc/TMUIProperties.php | TMUIProperties.setWarmUpPosition | public function setWarmUpPosition($positionX, $positionY, $positionZ = null)
{
$this->setPositionProperty($this->warmUpProperties, $positionX, $positionY, $positionZ);
return $this;
} | php | public function setWarmUpPosition($positionX, $positionY, $positionZ = null)
{
$this->setPositionProperty($this->warmUpProperties, $positionX, $positionY, $positionZ);
return $this;
} | [
"public",
"function",
"setWarmUpPosition",
"(",
"$",
"positionX",
",",
"$",
"positionY",
",",
"$",
"positionZ",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"setPositionProperty",
"(",
"$",
"this",
"->",
"warmUpProperties",
",",
"$",
"positionX",
",",
"$",
"positionY",
",",
"$",
"positionZ",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Set the warm-up position
@api
@param float $positionX X position
@param float $positionY Y position
@param float $positionZ (optional) Z position (Z-index)
@return static | [
"Set",
"the",
"warm",
"-",
"up",
"position"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/XmlRpc/TMUIProperties.php#L598-L602 |
steeffeen/FancyManiaLinks | FML/XmlRpc/TMUIProperties.php | TMUIProperties.setMultiLapInfoPosition | public function setMultiLapInfoPosition($positionX, $positionY, $positionZ = null)
{
$this->setPositionProperty($this->multiLapInfoProperties, $positionX, $positionY, $positionZ);
return $this;
} | php | public function setMultiLapInfoPosition($positionX, $positionY, $positionZ = null)
{
$this->setPositionProperty($this->multiLapInfoProperties, $positionX, $positionY, $positionZ);
return $this;
} | [
"public",
"function",
"setMultiLapInfoPosition",
"(",
"$",
"positionX",
",",
"$",
"positionY",
",",
"$",
"positionZ",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"setPositionProperty",
"(",
"$",
"this",
"->",
"multiLapInfoProperties",
",",
"$",
"positionX",
",",
"$",
"positionY",
",",
"$",
"positionZ",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Set the multi-lap info position
@api
@param float $positionX X position
@param float $positionY Y position
@param float $positionZ (optional) Z position (Z-index)
@return static | [
"Set",
"the",
"multi",
"-",
"lap",
"info",
"position"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/XmlRpc/TMUIProperties.php#L648-L652 |
steeffeen/FancyManiaLinks | FML/XmlRpc/TMUIProperties.php | TMUIProperties.setCheckpointRankingPosition | public function setCheckpointRankingPosition($positionX, $positionY, $positionZ = null)
{
$this->setPositionProperty($this->checkpointRankingProperties, $positionX, $positionY, $positionZ);
return $this;
} | php | public function setCheckpointRankingPosition($positionX, $positionY, $positionZ = null)
{
$this->setPositionProperty($this->checkpointRankingProperties, $positionX, $positionY, $positionZ);
return $this;
} | [
"public",
"function",
"setCheckpointRankingPosition",
"(",
"$",
"positionX",
",",
"$",
"positionY",
",",
"$",
"positionZ",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"setPositionProperty",
"(",
"$",
"this",
"->",
"checkpointRankingProperties",
",",
"$",
"positionX",
",",
"$",
"positionY",
",",
"$",
"positionZ",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Set the checkpoint ranking position
@api
@param float $positionX X position
@param float $positionY Y position
@param float $positionZ (optional) Z position (Z-index)
@return static | [
"Set",
"the",
"checkpoint",
"ranking",
"position"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/XmlRpc/TMUIProperties.php#L698-L702 |
scrutinizer-ci/rabbitmq | src/Scrutinizer/RabbitMQ/Rpc/RpcClient.php | RpcClient.invoke | public function invoke($queueName, $payload, $resultType, $timeout = 10)
{
$rs = $this->invokeAll(array(array($queueName, $payload, $resultType)), $timeout);
if ($rs[0] instanceof RpcError) {
throw new RpcErrorException($rs[0]);
}
return $rs[0];
} | php | public function invoke($queueName, $payload, $resultType, $timeout = 10)
{
$rs = $this->invokeAll(array(array($queueName, $payload, $resultType)), $timeout);
if ($rs[0] instanceof RpcError) {
throw new RpcErrorException($rs[0]);
}
return $rs[0];
} | [
"public",
"function",
"invoke",
"(",
"$",
"queueName",
",",
"$",
"payload",
",",
"$",
"resultType",
",",
"$",
"timeout",
"=",
"10",
")",
"{",
"$",
"rs",
"=",
"$",
"this",
"->",
"invokeAll",
"(",
"array",
"(",
"array",
"(",
"$",
"queueName",
",",
"$",
"payload",
",",
"$",
"resultType",
")",
")",
",",
"$",
"timeout",
")",
";",
"if",
"(",
"$",
"rs",
"[",
"0",
"]",
"instanceof",
"RpcError",
")",
"{",
"throw",
"new",
"RpcErrorException",
"(",
"$",
"rs",
"[",
"0",
"]",
")",
";",
"}",
"return",
"$",
"rs",
"[",
"0",
"]",
";",
"}"
] | Invokes a single remote command and returns the result of the invocation.
The remote command is invoked synchronously.
@param $queueName
@param $payload
@param $resultType
@throws RpcErrorException when a remote error occurs
@return mixed | [
"Invokes",
"a",
"single",
"remote",
"command",
"and",
"returns",
"the",
"result",
"of",
"the",
"invocation",
"."
] | train | https://github.com/scrutinizer-ci/rabbitmq/blob/5603f7901de2ad352086287f8d2c65bbae5170d5/src/Scrutinizer/RabbitMQ/Rpc/RpcClient.php#L93-L101 |
lemonphp/event | src/EventDispatcherTrait.php | EventDispatcherTrait.dispatch | public function dispatch($event)
{
if (!($event instanceof Event)) {
$event = new Event($event);
}
if ($listeners = $this->getListeners($event->getEventType())) {
$this->doDispatch($listeners, $event);
}
return $event;
} | php | public function dispatch($event)
{
if (!($event instanceof Event)) {
$event = new Event($event);
}
if ($listeners = $this->getListeners($event->getEventType())) {
$this->doDispatch($listeners, $event);
}
return $event;
} | [
"public",
"function",
"dispatch",
"(",
"$",
"event",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"event",
"instanceof",
"Event",
")",
")",
"{",
"$",
"event",
"=",
"new",
"Event",
"(",
"$",
"event",
")",
";",
"}",
"if",
"(",
"$",
"listeners",
"=",
"$",
"this",
"->",
"getListeners",
"(",
"$",
"event",
"->",
"getEventType",
"(",
")",
")",
")",
"{",
"$",
"this",
"->",
"doDispatch",
"(",
"$",
"listeners",
",",
"$",
"event",
")",
";",
"}",
"return",
"$",
"event",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/lemonphp/event/blob/57d9ffcc551febca967068668dd9f005d989d94b/src/EventDispatcherTrait.php#L31-L42 |
lemonphp/event | src/EventDispatcherTrait.php | EventDispatcherTrait.addListener | public function addListener($eventType, $listener, $priority = 0)
{
$this->listeners[$eventType][$priority][] = $listener;
unset($this->sorted[$eventType]);
} | php | public function addListener($eventType, $listener, $priority = 0)
{
$this->listeners[$eventType][$priority][] = $listener;
unset($this->sorted[$eventType]);
} | [
"public",
"function",
"addListener",
"(",
"$",
"eventType",
",",
"$",
"listener",
",",
"$",
"priority",
"=",
"0",
")",
"{",
"$",
"this",
"->",
"listeners",
"[",
"$",
"eventType",
"]",
"[",
"$",
"priority",
"]",
"[",
"]",
"=",
"$",
"listener",
";",
"unset",
"(",
"$",
"this",
"->",
"sorted",
"[",
"$",
"eventType",
"]",
")",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/lemonphp/event/blob/57d9ffcc551febca967068668dd9f005d989d94b/src/EventDispatcherTrait.php#L47-L51 |
lemonphp/event | src/EventDispatcherTrait.php | EventDispatcherTrait.removeListener | public function removeListener($eventType, $listener)
{
if (!isset($this->listeners[$eventType])) {
return;
}
foreach ($this->listeners[$eventType] as $priority => $listeners) {
if (false !== ($key = array_search($listener, $listeners, true))) {
unset($this->listeners[$eventType][$priority][$key], $this->sorted[$eventType]);
}
}
} | php | public function removeListener($eventType, $listener)
{
if (!isset($this->listeners[$eventType])) {
return;
}
foreach ($this->listeners[$eventType] as $priority => $listeners) {
if (false !== ($key = array_search($listener, $listeners, true))) {
unset($this->listeners[$eventType][$priority][$key], $this->sorted[$eventType]);
}
}
} | [
"public",
"function",
"removeListener",
"(",
"$",
"eventType",
",",
"$",
"listener",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"listeners",
"[",
"$",
"eventType",
"]",
")",
")",
"{",
"return",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"listeners",
"[",
"$",
"eventType",
"]",
"as",
"$",
"priority",
"=>",
"$",
"listeners",
")",
"{",
"if",
"(",
"false",
"!==",
"(",
"$",
"key",
"=",
"array_search",
"(",
"$",
"listener",
",",
"$",
"listeners",
",",
"true",
")",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"listeners",
"[",
"$",
"eventType",
"]",
"[",
"$",
"priority",
"]",
"[",
"$",
"key",
"]",
",",
"$",
"this",
"->",
"sorted",
"[",
"$",
"eventType",
"]",
")",
";",
"}",
"}",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/lemonphp/event/blob/57d9ffcc551febca967068668dd9f005d989d94b/src/EventDispatcherTrait.php#L56-L67 |
lemonphp/event | src/EventDispatcherTrait.php | EventDispatcherTrait.removeAllListeners | public function removeAllListeners($eventType = null)
{
if (null !== $eventType) {
unset($this->listeners[$eventType], $this->sorted[$eventType]);
} else {
$this->listeners = [];
$this->sorted = [];
}
} | php | public function removeAllListeners($eventType = null)
{
if (null !== $eventType) {
unset($this->listeners[$eventType], $this->sorted[$eventType]);
} else {
$this->listeners = [];
$this->sorted = [];
}
} | [
"public",
"function",
"removeAllListeners",
"(",
"$",
"eventType",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"eventType",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"listeners",
"[",
"$",
"eventType",
"]",
",",
"$",
"this",
"->",
"sorted",
"[",
"$",
"eventType",
"]",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"listeners",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"sorted",
"=",
"[",
"]",
";",
"}",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/lemonphp/event/blob/57d9ffcc551febca967068668dd9f005d989d94b/src/EventDispatcherTrait.php#L72-L80 |
lemonphp/event | src/EventDispatcherTrait.php | EventDispatcherTrait.getListeners | public function getListeners($eventType = null)
{
if (null !== $eventType) {
if (!isset($this->listeners[$eventType])) {
return [];
}
if (!isset($this->sorted[$eventType])) {
$this->sortListeners($eventType);
}
return $this->sorted[$eventType];
}
foreach ($this->listeners as $eventType => $eventListeners) {
if (!isset($this->sorted[$eventType])) {
$this->sortListeners($eventType);
}
}
return array_filter($this->sorted);
} | php | public function getListeners($eventType = null)
{
if (null !== $eventType) {
if (!isset($this->listeners[$eventType])) {
return [];
}
if (!isset($this->sorted[$eventType])) {
$this->sortListeners($eventType);
}
return $this->sorted[$eventType];
}
foreach ($this->listeners as $eventType => $eventListeners) {
if (!isset($this->sorted[$eventType])) {
$this->sortListeners($eventType);
}
}
return array_filter($this->sorted);
} | [
"public",
"function",
"getListeners",
"(",
"$",
"eventType",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"eventType",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"listeners",
"[",
"$",
"eventType",
"]",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"sorted",
"[",
"$",
"eventType",
"]",
")",
")",
"{",
"$",
"this",
"->",
"sortListeners",
"(",
"$",
"eventType",
")",
";",
"}",
"return",
"$",
"this",
"->",
"sorted",
"[",
"$",
"eventType",
"]",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"listeners",
"as",
"$",
"eventType",
"=>",
"$",
"eventListeners",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"sorted",
"[",
"$",
"eventType",
"]",
")",
")",
"{",
"$",
"this",
"->",
"sortListeners",
"(",
"$",
"eventType",
")",
";",
"}",
"}",
"return",
"array_filter",
"(",
"$",
"this",
"->",
"sorted",
")",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/lemonphp/event/blob/57d9ffcc551febca967068668dd9f005d989d94b/src/EventDispatcherTrait.php#L85-L106 |
lemonphp/event | src/EventDispatcherTrait.php | EventDispatcherTrait.getListenerPriority | public function getListenerPriority($eventType, $listener)
{
if (isset($this->listeners[$eventType])) {
foreach ($this->listeners[$eventType] as $priority => $listeners) {
if (false !== ($key = array_search($listener, $listeners, true))) {
return $priority;
}
}
}
return null;
} | php | public function getListenerPriority($eventType, $listener)
{
if (isset($this->listeners[$eventType])) {
foreach ($this->listeners[$eventType] as $priority => $listeners) {
if (false !== ($key = array_search($listener, $listeners, true))) {
return $priority;
}
}
}
return null;
} | [
"public",
"function",
"getListenerPriority",
"(",
"$",
"eventType",
",",
"$",
"listener",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"listeners",
"[",
"$",
"eventType",
"]",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"listeners",
"[",
"$",
"eventType",
"]",
"as",
"$",
"priority",
"=>",
"$",
"listeners",
")",
"{",
"if",
"(",
"false",
"!==",
"(",
"$",
"key",
"=",
"array_search",
"(",
"$",
"listener",
",",
"$",
"listeners",
",",
"true",
")",
")",
")",
"{",
"return",
"$",
"priority",
";",
"}",
"}",
"}",
"return",
"null",
";",
"}"
] | Gets the listener priority for a specific event.
Returns null if the event or the listener does not exist.
@param string $eventType The name of the event
@param callable $listener The listener
@return int|null The event listener priority | [
"Gets",
"the",
"listener",
"priority",
"for",
"a",
"specific",
"event",
"."
] | train | https://github.com/lemonphp/event/blob/57d9ffcc551febca967068668dd9f005d989d94b/src/EventDispatcherTrait.php#L126-L137 |
lemonphp/event | src/EventDispatcherTrait.php | EventDispatcherTrait.addSubscriber | public function addSubscriber(EventSubscriberInterface $subscriber)
{
foreach ($subscriber->getSubscribedEvents() as $eventType => $params) {
if (is_string($params)) {
$this->addListener($eventType, [$subscriber, $params]);
} elseif (is_string($params[0])) {
$this->addListener($eventType, [$subscriber, $params[0]], isset($params[1]) ? intval($params[1]) : 0);
} else {
foreach ($params as $listener) {
$this->addListener(
$eventType,
[$subscriber, $listener[0]],
isset($listener[1]) ? intval($listener[1]) : 0
);
}
}
}
} | php | public function addSubscriber(EventSubscriberInterface $subscriber)
{
foreach ($subscriber->getSubscribedEvents() as $eventType => $params) {
if (is_string($params)) {
$this->addListener($eventType, [$subscriber, $params]);
} elseif (is_string($params[0])) {
$this->addListener($eventType, [$subscriber, $params[0]], isset($params[1]) ? intval($params[1]) : 0);
} else {
foreach ($params as $listener) {
$this->addListener(
$eventType,
[$subscriber, $listener[0]],
isset($listener[1]) ? intval($listener[1]) : 0
);
}
}
}
} | [
"public",
"function",
"addSubscriber",
"(",
"EventSubscriberInterface",
"$",
"subscriber",
")",
"{",
"foreach",
"(",
"$",
"subscriber",
"->",
"getSubscribedEvents",
"(",
")",
"as",
"$",
"eventType",
"=>",
"$",
"params",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"params",
")",
")",
"{",
"$",
"this",
"->",
"addListener",
"(",
"$",
"eventType",
",",
"[",
"$",
"subscriber",
",",
"$",
"params",
"]",
")",
";",
"}",
"elseif",
"(",
"is_string",
"(",
"$",
"params",
"[",
"0",
"]",
")",
")",
"{",
"$",
"this",
"->",
"addListener",
"(",
"$",
"eventType",
",",
"[",
"$",
"subscriber",
",",
"$",
"params",
"[",
"0",
"]",
"]",
",",
"isset",
"(",
"$",
"params",
"[",
"1",
"]",
")",
"?",
"intval",
"(",
"$",
"params",
"[",
"1",
"]",
")",
":",
"0",
")",
";",
"}",
"else",
"{",
"foreach",
"(",
"$",
"params",
"as",
"$",
"listener",
")",
"{",
"$",
"this",
"->",
"addListener",
"(",
"$",
"eventType",
",",
"[",
"$",
"subscriber",
",",
"$",
"listener",
"[",
"0",
"]",
"]",
",",
"isset",
"(",
"$",
"listener",
"[",
"1",
"]",
")",
"?",
"intval",
"(",
"$",
"listener",
"[",
"1",
"]",
")",
":",
"0",
")",
";",
"}",
"}",
"}",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/lemonphp/event/blob/57d9ffcc551febca967068668dd9f005d989d94b/src/EventDispatcherTrait.php#L142-L159 |
lemonphp/event | src/EventDispatcherTrait.php | EventDispatcherTrait.sortListeners | protected function sortListeners($eventType)
{
krsort($this->listeners[$eventType]);
$this->sorted[$eventType] = call_user_func_array('array_merge', $this->listeners[$eventType]);
} | php | protected function sortListeners($eventType)
{
krsort($this->listeners[$eventType]);
$this->sorted[$eventType] = call_user_func_array('array_merge', $this->listeners[$eventType]);
} | [
"protected",
"function",
"sortListeners",
"(",
"$",
"eventType",
")",
"{",
"krsort",
"(",
"$",
"this",
"->",
"listeners",
"[",
"$",
"eventType",
"]",
")",
";",
"$",
"this",
"->",
"sorted",
"[",
"$",
"eventType",
"]",
"=",
"call_user_func_array",
"(",
"'array_merge'",
",",
"$",
"this",
"->",
"listeners",
"[",
"$",
"eventType",
"]",
")",
";",
"}"
] | Sorts the internal list of listeners for the given event by priority.
@param string $eventType The name of the event. | [
"Sorts",
"the",
"internal",
"list",
"of",
"listeners",
"for",
"the",
"given",
"event",
"by",
"priority",
"."
] | train | https://github.com/lemonphp/event/blob/57d9ffcc551febca967068668dd9f005d989d94b/src/EventDispatcherTrait.php#L201-L205 |
webforge-labs/psc-cms | lib/Psc/Code/Generate/GProperty.php | GProperty.php | public function php($baseIndent = 0) {
$php = $this->phpDocBlock($baseIndent);
$php .= str_repeat(' ',$baseIndent);
$ms = array(
self::MODIFIER_PUBLIC => 'public',
self::MODIFIER_PRIVATE => 'private',
self::MODIFIER_PROTECTED => 'protected',
self::MODIFIER_STATIC => 'static',
// self::MODIFIER_FINAL => 'final' // kein final für properties?
);
foreach ($ms as $const => $modifier) {
if (($const & $this->modifiers) == $const)
$php .= $modifier.' ';
}
$php .= '$'.$this->name;
if ($this->hasDefaultValue() && $this->getDefaultValue() !== NULL) {
$php .= ' = '.$this->exportPropertyValue($this->getDefaultValue());
}
return $php;
} | php | public function php($baseIndent = 0) {
$php = $this->phpDocBlock($baseIndent);
$php .= str_repeat(' ',$baseIndent);
$ms = array(
self::MODIFIER_PUBLIC => 'public',
self::MODIFIER_PRIVATE => 'private',
self::MODIFIER_PROTECTED => 'protected',
self::MODIFIER_STATIC => 'static',
// self::MODIFIER_FINAL => 'final' // kein final für properties?
);
foreach ($ms as $const => $modifier) {
if (($const & $this->modifiers) == $const)
$php .= $modifier.' ';
}
$php .= '$'.$this->name;
if ($this->hasDefaultValue() && $this->getDefaultValue() !== NULL) {
$php .= ' = '.$this->exportPropertyValue($this->getDefaultValue());
}
return $php;
} | [
"public",
"function",
"php",
"(",
"$",
"baseIndent",
"=",
"0",
")",
"{",
"$",
"php",
"=",
"$",
"this",
"->",
"phpDocBlock",
"(",
"$",
"baseIndent",
")",
";",
"$",
"php",
".=",
"str_repeat",
"(",
"' '",
",",
"$",
"baseIndent",
")",
";",
"$",
"ms",
"=",
"array",
"(",
"self",
"::",
"MODIFIER_PUBLIC",
"=>",
"'public'",
",",
"self",
"::",
"MODIFIER_PRIVATE",
"=>",
"'private'",
",",
"self",
"::",
"MODIFIER_PROTECTED",
"=>",
"'protected'",
",",
"self",
"::",
"MODIFIER_STATIC",
"=>",
"'static'",
",",
"// self::MODIFIER_FINAL => 'final' // kein final für properties?",
")",
";",
"foreach",
"(",
"$",
"ms",
"as",
"$",
"const",
"=>",
"$",
"modifier",
")",
"{",
"if",
"(",
"(",
"$",
"const",
"&",
"$",
"this",
"->",
"modifiers",
")",
"==",
"$",
"const",
")",
"$",
"php",
".=",
"$",
"modifier",
".",
"' '",
";",
"}",
"$",
"php",
".=",
"'$'",
".",
"$",
"this",
"->",
"name",
";",
"if",
"(",
"$",
"this",
"->",
"hasDefaultValue",
"(",
")",
"&&",
"$",
"this",
"->",
"getDefaultValue",
"(",
")",
"!==",
"NULL",
")",
"{",
"$",
"php",
".=",
"' = '",
".",
"$",
"this",
"->",
"exportPropertyValue",
"(",
"$",
"this",
"->",
"getDefaultValue",
"(",
")",
")",
";",
"}",
"return",
"$",
"php",
";",
"}"
] | Gibt den PHP Code für das Property zurück
Nach dem ; ist kein LF | [
"Gibt",
"den",
"PHP",
"Code",
"für",
"das",
"Property",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Code/Generate/GProperty.php#L57-L81 |
webforge-labs/psc-cms | lib/Psc/Code/Generate/GProperty.php | GProperty.reflectorFactory | public static function reflectorFactory(Reflector $reflector) {
$args = func_get_args();
$g = new static($args[1]);
$g->elevate($args[0]);
return $g;
} | php | public static function reflectorFactory(Reflector $reflector) {
$args = func_get_args();
$g = new static($args[1]);
$g->elevate($args[0]);
return $g;
} | [
"public",
"static",
"function",
"reflectorFactory",
"(",
"Reflector",
"$",
"reflector",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"$",
"g",
"=",
"new",
"static",
"(",
"$",
"args",
"[",
"1",
"]",
")",
";",
"$",
"g",
"->",
"elevate",
"(",
"$",
"args",
"[",
"0",
"]",
")",
";",
"return",
"$",
"g",
";",
"}"
] | Erstellt ein neues GProperty
der zweite Parameter ist wichtig
@param Reflector $reflector
@param GClass $gClass | [
"Erstellt",
"ein",
"neues",
"GProperty"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Code/Generate/GProperty.php#L126-L131 |
mle86/php-wq | src/WQ/SignalSafeWorkProcessor.php | SignalSafeWorkProcessor.installSignalHandler | public static function installSignalHandler(array $signals = [\SIGTERM, \SIGINT])
{
$lastSignal =& self::$lastSignal;
$alive =& self::$alive;
$fnHandler = function (int $signo) use (&$lastSignal, &$alive) {
$lastSignal = $signo;
$alive = false;
};
foreach ($signals as $signo) {
pcntl_signal($signo, $fnHandler);
}
} | php | public static function installSignalHandler(array $signals = [\SIGTERM, \SIGINT])
{
$lastSignal =& self::$lastSignal;
$alive =& self::$alive;
$fnHandler = function (int $signo) use (&$lastSignal, &$alive) {
$lastSignal = $signo;
$alive = false;
};
foreach ($signals as $signo) {
pcntl_signal($signo, $fnHandler);
}
} | [
"public",
"static",
"function",
"installSignalHandler",
"(",
"array",
"$",
"signals",
"=",
"[",
"\\",
"SIGTERM",
",",
"\\",
"SIGINT",
"]",
")",
"{",
"$",
"lastSignal",
"=",
"&",
"self",
"::",
"$",
"lastSignal",
";",
"$",
"alive",
"=",
"&",
"self",
"::",
"$",
"alive",
";",
"$",
"fnHandler",
"=",
"function",
"(",
"int",
"$",
"signo",
")",
"use",
"(",
"&",
"$",
"lastSignal",
",",
"&",
"$",
"alive",
")",
"{",
"$",
"lastSignal",
"=",
"$",
"signo",
";",
"$",
"alive",
"=",
"false",
";",
"}",
";",
"foreach",
"(",
"$",
"signals",
"as",
"$",
"signo",
")",
"{",
"pcntl_signal",
"(",
"$",
"signo",
",",
"$",
"fnHandler",
")",
";",
"}",
"}"
] | Installs a signal handler that will clear the {@see isAlive()} flag.
The registered signals will not immediately terminate the program anymore,
giving the job handler callback enough time to finish their execution.
If {@see isAlive()} is false
after {@see processNextJob()} returns,
you should {@see exit} the program.
@param int[] $signals An array of signal numbers for which to install the signal handler.
By default, the signal handler is installed
for <tt>SIGTERM</tt> and <tt>SIGINT</tt>,
two signals commonly used to cleanly stop running processes. | [
"Installs",
"a",
"signal",
"handler",
"that",
"will",
"clear",
"the",
"{",
"@see",
"isAlive",
"()",
"}",
"flag",
"."
] | train | https://github.com/mle86/php-wq/blob/e1ca1dcfd3d40edb0085f6dfa83d90db74253de4/src/WQ/SignalSafeWorkProcessor.php#L56-L69 |
askupasoftware/amarkal | Form/Updater.php | Updater.update | public function update( array $old_instance = array() )
{
$this->old_instance = $old_instance;
$this->update_components( $this->components );
return $this->final_instance;
} | php | public function update( array $old_instance = array() )
{
$this->old_instance = $old_instance;
$this->update_components( $this->components );
return $this->final_instance;
} | [
"public",
"function",
"update",
"(",
"array",
"$",
"old_instance",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"old_instance",
"=",
"$",
"old_instance",
";",
"$",
"this",
"->",
"update_components",
"(",
"$",
"this",
"->",
"components",
")",
";",
"return",
"$",
"this",
"->",
"final_instance",
";",
"}"
] | Get the updated component values (validated, filtered or ignored).
Loops through each component and acts according to its type:
- Disableable components are ignored if they are disabled.
- Validatable components are validated using their validation function.
If the new value is invalid, the old value will be used.
- Filterable components are filtered using their filter function.
- Non-value components are skipped altogether.
Each component is also set with its new value.
@param array $old_instance The old component values array.
@return array The updated values array. | [
"Get",
"the",
"updated",
"component",
"values",
"(",
"validated",
"filtered",
"or",
"ignored",
")",
"."
] | train | https://github.com/askupasoftware/amarkal/blob/fe8283e2d6847ef697abec832da7ee741a85058c/Form/Updater.php#L84-L89 |
askupasoftware/amarkal | Form/Updater.php | Updater.reset | public function reset( array $names = array() )
{
if( array() == $names )
{
// Unset new instance to force reset
$this->new_instance = array();
return $this->update();
}
else
{
foreach( $this->components as $c )
{
if( in_array($c->get_name(), $names) )
{
$this->new_instance[$c->get_name()] = $c->get_default_value();
}
}
return $this->update();
}
} | php | public function reset( array $names = array() )
{
if( array() == $names )
{
// Unset new instance to force reset
$this->new_instance = array();
return $this->update();
}
else
{
foreach( $this->components as $c )
{
if( in_array($c->get_name(), $names) )
{
$this->new_instance[$c->get_name()] = $c->get_default_value();
}
}
return $this->update();
}
} | [
"public",
"function",
"reset",
"(",
"array",
"$",
"names",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"array",
"(",
")",
"==",
"$",
"names",
")",
"{",
"// Unset new instance to force reset",
"$",
"this",
"->",
"new_instance",
"=",
"array",
"(",
")",
";",
"return",
"$",
"this",
"->",
"update",
"(",
")",
";",
"}",
"else",
"{",
"foreach",
"(",
"$",
"this",
"->",
"components",
"as",
"$",
"c",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"c",
"->",
"get_name",
"(",
")",
",",
"$",
"names",
")",
")",
"{",
"$",
"this",
"->",
"new_instance",
"[",
"$",
"c",
"->",
"get_name",
"(",
")",
"]",
"=",
"$",
"c",
"->",
"get_default_value",
"(",
")",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"update",
"(",
")",
";",
"}",
"}"
] | Reset all fields to their default values.
@param array $names List of component names to be set to their defaults. If no names are specified, all components will be reset
@return array The updated values array. | [
"Reset",
"all",
"fields",
"to",
"their",
"default",
"values",
"."
] | train | https://github.com/askupasoftware/amarkal/blob/fe8283e2d6847ef697abec832da7ee741a85058c/Form/Updater.php#L97-L116 |
askupasoftware/amarkal | Form/Updater.php | Updater.update_components | private function update_components( $components )
{
foreach ( $components as $component )
{
// Update each component in the composite collection
if ( $component instanceof UI\Components\Composite )
{
$this->update_components( $component->components );
}
// Update individual fields, as well as the composite parent field.
if ( $component instanceof UI\ValueComponentInterface )
{
$this->update_component( $component );
}
}
} | php | private function update_components( $components )
{
foreach ( $components as $component )
{
// Update each component in the composite collection
if ( $component instanceof UI\Components\Composite )
{
$this->update_components( $component->components );
}
// Update individual fields, as well as the composite parent field.
if ( $component instanceof UI\ValueComponentInterface )
{
$this->update_component( $component );
}
}
} | [
"private",
"function",
"update_components",
"(",
"$",
"components",
")",
"{",
"foreach",
"(",
"$",
"components",
"as",
"$",
"component",
")",
"{",
"// Update each component in the composite collection",
"if",
"(",
"$",
"component",
"instanceof",
"UI",
"\\",
"Components",
"\\",
"Composite",
")",
"{",
"$",
"this",
"->",
"update_components",
"(",
"$",
"component",
"->",
"components",
")",
";",
"}",
"// Update individual fields, as well as the composite parent field.",
"if",
"(",
"$",
"component",
"instanceof",
"UI",
"\\",
"ValueComponentInterface",
")",
"{",
"$",
"this",
"->",
"update_component",
"(",
"$",
"component",
")",
";",
"}",
"}",
"}"
] | Update the given list of components.
Recursively calls itself fpr composite components.
@param UI\AbstractComponent $components | [
"Update",
"the",
"given",
"list",
"of",
"components",
".",
"Recursively",
"calls",
"itself",
"fpr",
"composite",
"components",
"."
] | train | https://github.com/askupasoftware/amarkal/blob/fe8283e2d6847ef697abec832da7ee741a85058c/Form/Updater.php#L124-L140 |
askupasoftware/amarkal | Form/Updater.php | Updater.update_component | private function update_component( UI\ValueComponentInterface $component )
{
$comp_name = $component->get_name();
// Use default values if:
// 1. There is no old value (this is the first initiation of the form)
// and no new instance (this is not a form submission), or
// 2. This field is disabled
if( (
!isset( $this->old_instance[$comp_name] ) &&
!isset( $this->new_instance[$comp_name] )
) || (
$component instanceof UI\DisableableComponentInterface &&
true == $component->is_disabled()
) )
{
$this->update_default( $component );
return;
}
// No form submission
if( !isset( $this->new_instance[$comp_name] ) )
{
$this->update_value( $component, $this->old_instance[$comp_name] );
return;
}
$this->update_value( $component, $this->new_instance[$comp_name] );
// Apply user-defined filter
if( $component instanceof UI\FilterableComponentInterface )
{
$this->update_filterable( $component );
}
// Validate value
if( $component instanceof UI\ValidatableComponentInterface )
{
$this->update_validatable( $component );
}
} | php | private function update_component( UI\ValueComponentInterface $component )
{
$comp_name = $component->get_name();
// Use default values if:
// 1. There is no old value (this is the first initiation of the form)
// and no new instance (this is not a form submission), or
// 2. This field is disabled
if( (
!isset( $this->old_instance[$comp_name] ) &&
!isset( $this->new_instance[$comp_name] )
) || (
$component instanceof UI\DisableableComponentInterface &&
true == $component->is_disabled()
) )
{
$this->update_default( $component );
return;
}
// No form submission
if( !isset( $this->new_instance[$comp_name] ) )
{
$this->update_value( $component, $this->old_instance[$comp_name] );
return;
}
$this->update_value( $component, $this->new_instance[$comp_name] );
// Apply user-defined filter
if( $component instanceof UI\FilterableComponentInterface )
{
$this->update_filterable( $component );
}
// Validate value
if( $component instanceof UI\ValidatableComponentInterface )
{
$this->update_validatable( $component );
}
} | [
"private",
"function",
"update_component",
"(",
"UI",
"\\",
"ValueComponentInterface",
"$",
"component",
")",
"{",
"$",
"comp_name",
"=",
"$",
"component",
"->",
"get_name",
"(",
")",
";",
"// Use default values if:",
"// 1. There is no old value (this is the first initiation of the form)",
"// and no new instance (this is not a form submission), or",
"// 2. This field is disabled",
"if",
"(",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"old_instance",
"[",
"$",
"comp_name",
"]",
")",
"&&",
"!",
"isset",
"(",
"$",
"this",
"->",
"new_instance",
"[",
"$",
"comp_name",
"]",
")",
")",
"||",
"(",
"$",
"component",
"instanceof",
"UI",
"\\",
"DisableableComponentInterface",
"&&",
"true",
"==",
"$",
"component",
"->",
"is_disabled",
"(",
")",
")",
")",
"{",
"$",
"this",
"->",
"update_default",
"(",
"$",
"component",
")",
";",
"return",
";",
"}",
"// No form submission",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"new_instance",
"[",
"$",
"comp_name",
"]",
")",
")",
"{",
"$",
"this",
"->",
"update_value",
"(",
"$",
"component",
",",
"$",
"this",
"->",
"old_instance",
"[",
"$",
"comp_name",
"]",
")",
";",
"return",
";",
"}",
"$",
"this",
"->",
"update_value",
"(",
"$",
"component",
",",
"$",
"this",
"->",
"new_instance",
"[",
"$",
"comp_name",
"]",
")",
";",
"// Apply user-defined filter",
"if",
"(",
"$",
"component",
"instanceof",
"UI",
"\\",
"FilterableComponentInterface",
")",
"{",
"$",
"this",
"->",
"update_filterable",
"(",
"$",
"component",
")",
";",
"}",
"// Validate value",
"if",
"(",
"$",
"component",
"instanceof",
"UI",
"\\",
"ValidatableComponentInterface",
")",
"{",
"$",
"this",
"->",
"update_validatable",
"(",
"$",
"component",
")",
";",
"}",
"}"
] | Update the component's value with the new value.
NOTE: this function also updates the $final_instance
array.
@param ValueComponentInterface $component The component to validate.
@param type $new_instance The new component values array.
@param type $old_instance The old component values array. | [
"Update",
"the",
"component",
"s",
"value",
"with",
"the",
"new",
"value",
".",
"NOTE",
":",
"this",
"function",
"also",
"updates",
"the",
"$final_instance",
"array",
"."
] | train | https://github.com/askupasoftware/amarkal/blob/fe8283e2d6847ef697abec832da7ee741a85058c/Form/Updater.php#L151-L191 |
askupasoftware/amarkal | Form/Updater.php | Updater.update_value | private function update_value( $component, $value )
{
$component->set_value( $value );
$this->final_instance[$component->get_name()] = $value;
} | php | private function update_value( $component, $value )
{
$component->set_value( $value );
$this->final_instance[$component->get_name()] = $value;
} | [
"private",
"function",
"update_value",
"(",
"$",
"component",
",",
"$",
"value",
")",
"{",
"$",
"component",
"->",
"set_value",
"(",
"$",
"value",
")",
";",
"$",
"this",
"->",
"final_instance",
"[",
"$",
"component",
"->",
"get_name",
"(",
")",
"]",
"=",
"$",
"value",
";",
"}"
] | Update the component's value and the final instance with the
given value.
@param UI\AbstractComponent $component
@param string $value | [
"Update",
"the",
"component",
"s",
"value",
"and",
"the",
"final",
"instance",
"with",
"the",
"given",
"value",
"."
] | train | https://github.com/askupasoftware/amarkal/blob/fe8283e2d6847ef697abec832da7ee741a85058c/Form/Updater.php#L200-L204 |
askupasoftware/amarkal | Form/Updater.php | Updater.update_filterable | private function update_filterable( UI\FilterableComponentInterface $component )
{
$this->update_value(
$component,
$component->apply_filter( $this->new_instance[$component->get_name()] )
);
} | php | private function update_filterable( UI\FilterableComponentInterface $component )
{
$this->update_value(
$component,
$component->apply_filter( $this->new_instance[$component->get_name()] )
);
} | [
"private",
"function",
"update_filterable",
"(",
"UI",
"\\",
"FilterableComponentInterface",
"$",
"component",
")",
"{",
"$",
"this",
"->",
"update_value",
"(",
"$",
"component",
",",
"$",
"component",
"->",
"apply_filter",
"(",
"$",
"this",
"->",
"new_instance",
"[",
"$",
"component",
"->",
"get_name",
"(",
")",
"]",
")",
")",
";",
"}"
] | Filter the component's value using its filter function.
@param UI\FilterableComponentInterface $component | [
"Filter",
"the",
"component",
"s",
"value",
"using",
"its",
"filter",
"function",
"."
] | train | https://github.com/askupasoftware/amarkal/blob/fe8283e2d6847ef697abec832da7ee741a85058c/Form/Updater.php#L224-L230 |
askupasoftware/amarkal | Form/Updater.php | Updater.update_validatable | private function update_validatable( UI\ValidatableComponentInterface $component )
{
$name = $component->get_name();
$error = '';
// Invalid input, use old instance or default value
if ( !$component->validate( $this->new_instance[$name], $error ) )
{
$this->update_value(
$component,
$this->old_instance[$name]
);
$this->errors[$name] = $error;
$component->set_validity($component::INVALID);
}
} | php | private function update_validatable( UI\ValidatableComponentInterface $component )
{
$name = $component->get_name();
$error = '';
// Invalid input, use old instance or default value
if ( !$component->validate( $this->new_instance[$name], $error ) )
{
$this->update_value(
$component,
$this->old_instance[$name]
);
$this->errors[$name] = $error;
$component->set_validity($component::INVALID);
}
} | [
"private",
"function",
"update_validatable",
"(",
"UI",
"\\",
"ValidatableComponentInterface",
"$",
"component",
")",
"{",
"$",
"name",
"=",
"$",
"component",
"->",
"get_name",
"(",
")",
";",
"$",
"error",
"=",
"''",
";",
"// Invalid input, use old instance or default value",
"if",
"(",
"!",
"$",
"component",
"->",
"validate",
"(",
"$",
"this",
"->",
"new_instance",
"[",
"$",
"name",
"]",
",",
"$",
"error",
")",
")",
"{",
"$",
"this",
"->",
"update_value",
"(",
"$",
"component",
",",
"$",
"this",
"->",
"old_instance",
"[",
"$",
"name",
"]",
")",
";",
"$",
"this",
"->",
"errors",
"[",
"$",
"name",
"]",
"=",
"$",
"error",
";",
"$",
"component",
"->",
"set_validity",
"(",
"$",
"component",
"::",
"INVALID",
")",
";",
"}",
"}"
] | Validate the component's value using its validation function.
If the value is invalid, the old value is used, and an error message is
saved into the errors array as component_name => error_message.
@param ValidatableComponentInterface $component The component to validate. | [
"Validate",
"the",
"component",
"s",
"value",
"using",
"its",
"validation",
"function",
"."
] | train | https://github.com/askupasoftware/amarkal/blob/fe8283e2d6847ef697abec832da7ee741a85058c/Form/Updater.php#L240-L255 |
PortaText/php-sdk | src/PortaText/Command/Api/Trunks.php | Trunks.getEndpoint | protected function getEndpoint($method)
{
$endpoint = "trunks";
$trunkId = $this->getArgument("id");
if (!is_null($trunkId)) {
$endpoint .= "/$trunkId";
$this->delArgument("id");
}
return $endpoint;
} | php | protected function getEndpoint($method)
{
$endpoint = "trunks";
$trunkId = $this->getArgument("id");
if (!is_null($trunkId)) {
$endpoint .= "/$trunkId";
$this->delArgument("id");
}
return $endpoint;
} | [
"protected",
"function",
"getEndpoint",
"(",
"$",
"method",
")",
"{",
"$",
"endpoint",
"=",
"\"trunks\"",
";",
"$",
"trunkId",
"=",
"$",
"this",
"->",
"getArgument",
"(",
"\"id\"",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"trunkId",
")",
")",
"{",
"$",
"endpoint",
".=",
"\"/$trunkId\"",
";",
"$",
"this",
"->",
"delArgument",
"(",
"\"id\"",
")",
";",
"}",
"return",
"$",
"endpoint",
";",
"}"
] | Returns a string with the endpoint for the given command.
@param string $method Method for this command.
@return string | [
"Returns",
"a",
"string",
"with",
"the",
"endpoint",
"for",
"the",
"given",
"command",
"."
] | train | https://github.com/PortaText/php-sdk/blob/dbe04ef043db5b251953f9de57aa4d0f1785dfcc/src/PortaText/Command/Api/Trunks.php#L64-L73 |
forxer/tao | src/Tao/Support/StopWords.php | StopWords.get | public function get($locale = 'en')
{
if (isset($this->stopwords[$locale])) {
return $this->stopwords[$locale];
}
$this->stopwords[$locale] = [];
$filename = $this->path . '/' . $locale . '.php';
if (file_exists($filename)) {
$this->stopwords[$locale] = require $filename;
}
return $this->stopwords[$locale];
} | php | public function get($locale = 'en')
{
if (isset($this->stopwords[$locale])) {
return $this->stopwords[$locale];
}
$this->stopwords[$locale] = [];
$filename = $this->path . '/' . $locale . '.php';
if (file_exists($filename)) {
$this->stopwords[$locale] = require $filename;
}
return $this->stopwords[$locale];
} | [
"public",
"function",
"get",
"(",
"$",
"locale",
"=",
"'en'",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"stopwords",
"[",
"$",
"locale",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"stopwords",
"[",
"$",
"locale",
"]",
";",
"}",
"$",
"this",
"->",
"stopwords",
"[",
"$",
"locale",
"]",
"=",
"[",
"]",
";",
"$",
"filename",
"=",
"$",
"this",
"->",
"path",
".",
"'/'",
".",
"$",
"locale",
".",
"'.php'",
";",
"if",
"(",
"file_exists",
"(",
"$",
"filename",
")",
")",
"{",
"$",
"this",
"->",
"stopwords",
"[",
"$",
"locale",
"]",
"=",
"require",
"$",
"filename",
";",
"}",
"return",
"$",
"this",
"->",
"stopwords",
"[",
"$",
"locale",
"]",
";",
"}"
] | Return stop word list for given locale.
@param string $locale
@return array | [
"Return",
"stop",
"word",
"list",
"for",
"given",
"locale",
"."
] | train | https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Support/StopWords.php#L25-L40 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseRolePeer.php | BaseRolePeer.getFieldNames | public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, RolePeer::$fieldNames)) {
throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
}
return RolePeer::$fieldNames[$type];
} | php | public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, RolePeer::$fieldNames)) {
throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
}
return RolePeer::$fieldNames[$type];
} | [
"public",
"static",
"function",
"getFieldNames",
"(",
"$",
"type",
"=",
"BasePeer",
"::",
"TYPE_PHPNAME",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"type",
",",
"RolePeer",
"::",
"$",
"fieldNames",
")",
")",
"{",
"throw",
"new",
"PropelException",
"(",
"'Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. '",
".",
"$",
"type",
".",
"' was given.'",
")",
";",
"}",
"return",
"RolePeer",
"::",
"$",
"fieldNames",
"[",
"$",
"type",
"]",
";",
"}"
] | Returns an array of field names.
@param string $type The type of fieldnames to return:
One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
@return array A list of field names
@throws PropelException - if the type is not valid. | [
"Returns",
"an",
"array",
"of",
"field",
"names",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseRolePeer.php#L122-L129 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseRolePeer.php | BaseRolePeer.addSelectColumns | public static function addSelectColumns(Criteria $criteria, $alias = null)
{
if (null === $alias) {
$criteria->addSelectColumn(RolePeer::ID);
$criteria->addSelectColumn(RolePeer::NAME);
$criteria->addSelectColumn(RolePeer::ROLE);
} else {
$criteria->addSelectColumn($alias . '.id');
$criteria->addSelectColumn($alias . '.name');
$criteria->addSelectColumn($alias . '.role');
}
} | php | public static function addSelectColumns(Criteria $criteria, $alias = null)
{
if (null === $alias) {
$criteria->addSelectColumn(RolePeer::ID);
$criteria->addSelectColumn(RolePeer::NAME);
$criteria->addSelectColumn(RolePeer::ROLE);
} else {
$criteria->addSelectColumn($alias . '.id');
$criteria->addSelectColumn($alias . '.name');
$criteria->addSelectColumn($alias . '.role');
}
} | [
"public",
"static",
"function",
"addSelectColumns",
"(",
"Criteria",
"$",
"criteria",
",",
"$",
"alias",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"alias",
")",
"{",
"$",
"criteria",
"->",
"addSelectColumn",
"(",
"RolePeer",
"::",
"ID",
")",
";",
"$",
"criteria",
"->",
"addSelectColumn",
"(",
"RolePeer",
"::",
"NAME",
")",
";",
"$",
"criteria",
"->",
"addSelectColumn",
"(",
"RolePeer",
"::",
"ROLE",
")",
";",
"}",
"else",
"{",
"$",
"criteria",
"->",
"addSelectColumn",
"(",
"$",
"alias",
".",
"'.id'",
")",
";",
"$",
"criteria",
"->",
"addSelectColumn",
"(",
"$",
"alias",
".",
"'.name'",
")",
";",
"$",
"criteria",
"->",
"addSelectColumn",
"(",
"$",
"alias",
".",
"'.role'",
")",
";",
"}",
"}"
] | Add all the columns needed to create a new object.
Note: any columns that were marked with lazyLoad="true" in the
XML schema will not be added to the select list and only loaded
on demand.
@param Criteria $criteria object containing the columns to add.
@param string $alias optional table alias
@throws PropelException Any exceptions caught during processing will be
rethrown wrapped into a PropelException. | [
"Add",
"all",
"the",
"columns",
"needed",
"to",
"create",
"a",
"new",
"object",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseRolePeer.php#L160-L171 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseRolePeer.php | BaseRolePeer.getInstanceFromPool | public static function getInstanceFromPool($key)
{
if (Propel::isInstancePoolingEnabled()) {
if (isset(RolePeer::$instances[$key])) {
return RolePeer::$instances[$key];
}
}
return null; // just to be explicit
} | php | public static function getInstanceFromPool($key)
{
if (Propel::isInstancePoolingEnabled()) {
if (isset(RolePeer::$instances[$key])) {
return RolePeer::$instances[$key];
}
}
return null; // just to be explicit
} | [
"public",
"static",
"function",
"getInstanceFromPool",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"Propel",
"::",
"isInstancePoolingEnabled",
"(",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"RolePeer",
"::",
"$",
"instances",
"[",
"$",
"key",
"]",
")",
")",
"{",
"return",
"RolePeer",
"::",
"$",
"instances",
"[",
"$",
"key",
"]",
";",
"}",
"}",
"return",
"null",
";",
"// just to be explicit",
"}"
] | Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
For tables with a single-column primary key, that simple pkey value will be returned. For tables with
a multi-column primary key, a serialize()d version of the primary key will be returned.
@param string $key The key (@see getPrimaryKeyHash()) for this instance.
@return Role Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
@see getPrimaryKeyHash() | [
"Retrieves",
"a",
"string",
"version",
"of",
"the",
"primary",
"key",
"from",
"the",
"DB",
"resultset",
"row",
"that",
"can",
"be",
"used",
"to",
"uniquely",
"identify",
"a",
"row",
"in",
"this",
"table",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseRolePeer.php#L342-L351 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseRolePeer.php | BaseRolePeer.buildTableMap | public static function buildTableMap()
{
$dbMap = Propel::getDatabaseMap(BaseRolePeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseRolePeer::TABLE_NAME)) {
$dbMap->addTableObject(new \Slashworks\BackendBundle\Model\map\RoleTableMap());
}
} | php | public static function buildTableMap()
{
$dbMap = Propel::getDatabaseMap(BaseRolePeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseRolePeer::TABLE_NAME)) {
$dbMap->addTableObject(new \Slashworks\BackendBundle\Model\map\RoleTableMap());
}
} | [
"public",
"static",
"function",
"buildTableMap",
"(",
")",
"{",
"$",
"dbMap",
"=",
"Propel",
"::",
"getDatabaseMap",
"(",
"BaseRolePeer",
"::",
"DATABASE_NAME",
")",
";",
"if",
"(",
"!",
"$",
"dbMap",
"->",
"hasTable",
"(",
"BaseRolePeer",
"::",
"TABLE_NAME",
")",
")",
"{",
"$",
"dbMap",
"->",
"addTableObject",
"(",
"new",
"\\",
"Slashworks",
"\\",
"BackendBundle",
"\\",
"Model",
"\\",
"map",
"\\",
"RoleTableMap",
"(",
")",
")",
";",
"}",
"}"
] | Add a TableMap instance to the database for this peer class. | [
"Add",
"a",
"TableMap",
"instance",
"to",
"the",
"database",
"for",
"this",
"peer",
"class",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseRolePeer.php#L488-L494 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseRolePeer.php | BaseRolePeer.doInsert | public static function doInsert($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(RolePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} else {
$criteria = $values->buildCriteria(); // build Criteria from Role object
}
if ($criteria->containsKey(RolePeer::ID) && $criteria->keyContainsValue(RolePeer::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.RolePeer::ID.')');
}
// Set the correct dbName
$criteria->setDbName(RolePeer::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
$con->beginTransaction();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
return $pk;
} | php | public static function doInsert($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(RolePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} else {
$criteria = $values->buildCriteria(); // build Criteria from Role object
}
if ($criteria->containsKey(RolePeer::ID) && $criteria->keyContainsValue(RolePeer::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.RolePeer::ID.')');
}
// Set the correct dbName
$criteria->setDbName(RolePeer::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
$con->beginTransaction();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
return $pk;
} | [
"public",
"static",
"function",
"doInsert",
"(",
"$",
"values",
",",
"PropelPDO",
"$",
"con",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"con",
"===",
"null",
")",
"{",
"$",
"con",
"=",
"Propel",
"::",
"getConnection",
"(",
"RolePeer",
"::",
"DATABASE_NAME",
",",
"Propel",
"::",
"CONNECTION_WRITE",
")",
";",
"}",
"if",
"(",
"$",
"values",
"instanceof",
"Criteria",
")",
"{",
"$",
"criteria",
"=",
"clone",
"$",
"values",
";",
"// rename for clarity",
"}",
"else",
"{",
"$",
"criteria",
"=",
"$",
"values",
"->",
"buildCriteria",
"(",
")",
";",
"// build Criteria from Role object",
"}",
"if",
"(",
"$",
"criteria",
"->",
"containsKey",
"(",
"RolePeer",
"::",
"ID",
")",
"&&",
"$",
"criteria",
"->",
"keyContainsValue",
"(",
"RolePeer",
"::",
"ID",
")",
")",
"{",
"throw",
"new",
"PropelException",
"(",
"'Cannot insert a value for auto-increment primary key ('",
".",
"RolePeer",
"::",
"ID",
".",
"')'",
")",
";",
"}",
"// Set the correct dbName",
"$",
"criteria",
"->",
"setDbName",
"(",
"RolePeer",
"::",
"DATABASE_NAME",
")",
";",
"try",
"{",
"// use transaction because $criteria could contain info",
"// for more than one table (I guess, conceivably)",
"$",
"con",
"->",
"beginTransaction",
"(",
")",
";",
"$",
"pk",
"=",
"BasePeer",
"::",
"doInsert",
"(",
"$",
"criteria",
",",
"$",
"con",
")",
";",
"$",
"con",
"->",
"commit",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")",
"{",
"$",
"con",
"->",
"rollBack",
"(",
")",
";",
"throw",
"$",
"e",
";",
"}",
"return",
"$",
"pk",
";",
"}"
] | Performs an INSERT on the database, given a Role or Criteria object.
@param mixed $values Criteria or Role object containing data that is used to create the INSERT statement.
@param PropelPDO $con the PropelPDO connection to use
@return mixed The new primary key.
@throws PropelException Any exceptions caught during processing will be
rethrown wrapped into a PropelException. | [
"Performs",
"an",
"INSERT",
"on",
"the",
"database",
"given",
"a",
"Role",
"or",
"Criteria",
"object",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseRolePeer.php#L516-L548 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseRolePeer.php | BaseRolePeer.doOnDeleteCascade | protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con)
{
// initialize var to track total num of affected rows
$affectedRows = 0;
// first find the objects that are implicated by the $criteria
$objects = RolePeer::doSelect($criteria, $con);
foreach ($objects as $obj) {
// delete related UserRole objects
$criteria = new Criteria(UserRolePeer::DATABASE_NAME);
$criteria->add(UserRolePeer::ROLE_ID, $obj->getId());
$affectedRows += UserRolePeer::doDelete($criteria, $con);
}
return $affectedRows;
} | php | protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con)
{
// initialize var to track total num of affected rows
$affectedRows = 0;
// first find the objects that are implicated by the $criteria
$objects = RolePeer::doSelect($criteria, $con);
foreach ($objects as $obj) {
// delete related UserRole objects
$criteria = new Criteria(UserRolePeer::DATABASE_NAME);
$criteria->add(UserRolePeer::ROLE_ID, $obj->getId());
$affectedRows += UserRolePeer::doDelete($criteria, $con);
}
return $affectedRows;
} | [
"protected",
"static",
"function",
"doOnDeleteCascade",
"(",
"Criteria",
"$",
"criteria",
",",
"PropelPDO",
"$",
"con",
")",
"{",
"// initialize var to track total num of affected rows",
"$",
"affectedRows",
"=",
"0",
";",
"// first find the objects that are implicated by the $criteria",
"$",
"objects",
"=",
"RolePeer",
"::",
"doSelect",
"(",
"$",
"criteria",
",",
"$",
"con",
")",
";",
"foreach",
"(",
"$",
"objects",
"as",
"$",
"obj",
")",
"{",
"// delete related UserRole objects",
"$",
"criteria",
"=",
"new",
"Criteria",
"(",
"UserRolePeer",
"::",
"DATABASE_NAME",
")",
";",
"$",
"criteria",
"->",
"add",
"(",
"UserRolePeer",
"::",
"ROLE_ID",
",",
"$",
"obj",
"->",
"getId",
"(",
")",
")",
";",
"$",
"affectedRows",
"+=",
"UserRolePeer",
"::",
"doDelete",
"(",
"$",
"criteria",
",",
"$",
"con",
")",
";",
"}",
"return",
"$",
"affectedRows",
";",
"}"
] | This is a method for emulating ON DELETE CASCADE for DBs that don't support this
feature (like MySQL or SQLite).
This method is not very speedy because it must perform a query first to get
the implicated records and then perform the deletes by calling those Peer classes.
This method should be used within a transaction if possible.
@param Criteria $criteria
@param PropelPDO $con
@return int The number of affected rows (if supported by underlying database driver). | [
"This",
"is",
"a",
"method",
"for",
"emulating",
"ON",
"DELETE",
"CASCADE",
"for",
"DBs",
"that",
"don",
"t",
"support",
"this",
"feature",
"(",
"like",
"MySQL",
"or",
"SQLite",
")",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseRolePeer.php#L701-L719 |
flipboxstudio/orm-manager | src/Flipbox/OrmManager/Consoles/ModelDetail.php | ModelDetail.handle | public function handle()
{
$model = $this->argument('model');
if ($this->manager->isModelExists($model)) {
return $this->showDetail($this->manager->getModel($model));
}
$this->error("Model {$model} is not found");
} | php | public function handle()
{
$model = $this->argument('model');
if ($this->manager->isModelExists($model)) {
return $this->showDetail($this->manager->getModel($model));
}
$this->error("Model {$model} is not found");
} | [
"public",
"function",
"handle",
"(",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"argument",
"(",
"'model'",
")",
";",
"if",
"(",
"$",
"this",
"->",
"manager",
"->",
"isModelExists",
"(",
"$",
"model",
")",
")",
"{",
"return",
"$",
"this",
"->",
"showDetail",
"(",
"$",
"this",
"->",
"manager",
"->",
"getModel",
"(",
"$",
"model",
")",
")",
";",
"}",
"$",
"this",
"->",
"error",
"(",
"\"Model {$model} is not found\"",
")",
";",
"}"
] | Execute the console command.
@return mixed | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/flipboxstudio/orm-manager/blob/4288426517f53d05177b8729c4ba94c5beca9a98/src/Flipbox/OrmManager/Consoles/ModelDetail.php#L60-L69 |
flipboxstudio/orm-manager | src/Flipbox/OrmManager/Consoles/ModelDetail.php | ModelDetail.showDetail | protected function showDetail(Model $model)
{
$name = $this->manager->getClassName($model);
$this->title("Summary of Model {$name} :");
$summary = $this->manager->getModelSummary($name);
$rows = [];
foreach ($summary as $key => $value) {
if (is_bool($value)) {
$value = $value ? 'yes' : 'no';
}
$valueText = $this->paintString($value, 'brown');
$rows[] = [$key, $valueText];
}
$this->table(['Key', 'Value'], $rows);
$this->showDatabaseFields($model);
$this->showRelatoins($model);
$this->showModifier($model);
} | php | protected function showDetail(Model $model)
{
$name = $this->manager->getClassName($model);
$this->title("Summary of Model {$name} :");
$summary = $this->manager->getModelSummary($name);
$rows = [];
foreach ($summary as $key => $value) {
if (is_bool($value)) {
$value = $value ? 'yes' : 'no';
}
$valueText = $this->paintString($value, 'brown');
$rows[] = [$key, $valueText];
}
$this->table(['Key', 'Value'], $rows);
$this->showDatabaseFields($model);
$this->showRelatoins($model);
$this->showModifier($model);
} | [
"protected",
"function",
"showDetail",
"(",
"Model",
"$",
"model",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"manager",
"->",
"getClassName",
"(",
"$",
"model",
")",
";",
"$",
"this",
"->",
"title",
"(",
"\"Summary of Model {$name} :\"",
")",
";",
"$",
"summary",
"=",
"$",
"this",
"->",
"manager",
"->",
"getModelSummary",
"(",
"$",
"name",
")",
";",
"$",
"rows",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"summary",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"is_bool",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"$",
"value",
"?",
"'yes'",
":",
"'no'",
";",
"}",
"$",
"valueText",
"=",
"$",
"this",
"->",
"paintString",
"(",
"$",
"value",
",",
"'brown'",
")",
";",
"$",
"rows",
"[",
"]",
"=",
"[",
"$",
"key",
",",
"$",
"valueText",
"]",
";",
"}",
"$",
"this",
"->",
"table",
"(",
"[",
"'Key'",
",",
"'Value'",
"]",
",",
"$",
"rows",
")",
";",
"$",
"this",
"->",
"showDatabaseFields",
"(",
"$",
"model",
")",
";",
"$",
"this",
"->",
"showRelatoins",
"(",
"$",
"model",
")",
";",
"$",
"this",
"->",
"showModifier",
"(",
"$",
"model",
")",
";",
"}"
] | show detail of model
@param Model $model
@return void | [
"show",
"detail",
"of",
"model"
] | train | https://github.com/flipboxstudio/orm-manager/blob/4288426517f53d05177b8729c4ba94c5beca9a98/src/Flipbox/OrmManager/Consoles/ModelDetail.php#L77-L101 |
flipboxstudio/orm-manager | src/Flipbox/OrmManager/Consoles/ModelDetail.php | ModelDetail.showDatabaseFields | protected function showDatabaseFields(Model $model)
{
$this->title("Table {$model->getTable()} :");
if ( ! $this->db->isConnected()) {
$this->warn("Not Connected to databse, please check your connection config\r");
} else {
$fields = $this->db->getFields($model->getTable());
$headers = ['name', 'type', 'null', 'length', 'unsigned', 'autoincrement', 'primary_key', 'foreign_key'];
$this->table($headers, $fields->toArray());
}
} | php | protected function showDatabaseFields(Model $model)
{
$this->title("Table {$model->getTable()} :");
if ( ! $this->db->isConnected()) {
$this->warn("Not Connected to databse, please check your connection config\r");
} else {
$fields = $this->db->getFields($model->getTable());
$headers = ['name', 'type', 'null', 'length', 'unsigned', 'autoincrement', 'primary_key', 'foreign_key'];
$this->table($headers, $fields->toArray());
}
} | [
"protected",
"function",
"showDatabaseFields",
"(",
"Model",
"$",
"model",
")",
"{",
"$",
"this",
"->",
"title",
"(",
"\"Table {$model->getTable()} :\"",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"db",
"->",
"isConnected",
"(",
")",
")",
"{",
"$",
"this",
"->",
"warn",
"(",
"\"Not Connected to databse, please check your connection config\\r\"",
")",
";",
"}",
"else",
"{",
"$",
"fields",
"=",
"$",
"this",
"->",
"db",
"->",
"getFields",
"(",
"$",
"model",
"->",
"getTable",
"(",
")",
")",
";",
"$",
"headers",
"=",
"[",
"'name'",
",",
"'type'",
",",
"'null'",
",",
"'length'",
",",
"'unsigned'",
",",
"'autoincrement'",
",",
"'primary_key'",
",",
"'foreign_key'",
"]",
";",
"$",
"this",
"->",
"table",
"(",
"$",
"headers",
",",
"$",
"fields",
"->",
"toArray",
"(",
")",
")",
";",
"}",
"}"
] | show database fileds
@param Model $model
@return void | [
"show",
"database",
"fileds"
] | train | https://github.com/flipboxstudio/orm-manager/blob/4288426517f53d05177b8729c4ba94c5beca9a98/src/Flipbox/OrmManager/Consoles/ModelDetail.php#L109-L121 |
flipboxstudio/orm-manager | src/Flipbox/OrmManager/Consoles/ModelDetail.php | ModelDetail.showRelatoins | protected function showRelatoins(Model $model)
{
$name = $this->manager->getClassName($model);
$this->title("Relations of Model {$name}: ");
$relations = $this->manager->getRelations($model);
$tbody = [];
foreach ($relations as $relation) {
$relationName = $this->manager->getClassName($relation);
$related = $relation->getRelated() ?:null;
$tbody[] = [
$this->paintString($relationName, 'brown'),
$related ? $this->manager->getClassName($related) : '',
];
}
$this->table(['relation', 'model'], $tbody);
} | php | protected function showRelatoins(Model $model)
{
$name = $this->manager->getClassName($model);
$this->title("Relations of Model {$name}: ");
$relations = $this->manager->getRelations($model);
$tbody = [];
foreach ($relations as $relation) {
$relationName = $this->manager->getClassName($relation);
$related = $relation->getRelated() ?:null;
$tbody[] = [
$this->paintString($relationName, 'brown'),
$related ? $this->manager->getClassName($related) : '',
];
}
$this->table(['relation', 'model'], $tbody);
} | [
"protected",
"function",
"showRelatoins",
"(",
"Model",
"$",
"model",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"manager",
"->",
"getClassName",
"(",
"$",
"model",
")",
";",
"$",
"this",
"->",
"title",
"(",
"\"Relations of Model {$name}: \"",
")",
";",
"$",
"relations",
"=",
"$",
"this",
"->",
"manager",
"->",
"getRelations",
"(",
"$",
"model",
")",
";",
"$",
"tbody",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"relations",
"as",
"$",
"relation",
")",
"{",
"$",
"relationName",
"=",
"$",
"this",
"->",
"manager",
"->",
"getClassName",
"(",
"$",
"relation",
")",
";",
"$",
"related",
"=",
"$",
"relation",
"->",
"getRelated",
"(",
")",
"?",
":",
"null",
";",
"$",
"tbody",
"[",
"]",
"=",
"[",
"$",
"this",
"->",
"paintString",
"(",
"$",
"relationName",
",",
"'brown'",
")",
",",
"$",
"related",
"?",
"$",
"this",
"->",
"manager",
"->",
"getClassName",
"(",
"$",
"related",
")",
":",
"''",
",",
"]",
";",
"}",
"$",
"this",
"->",
"table",
"(",
"[",
"'relation'",
",",
"'model'",
"]",
",",
"$",
"tbody",
")",
";",
"}"
] | show relations of model
@param Model $model
@return void | [
"show",
"relations",
"of",
"model"
] | train | https://github.com/flipboxstudio/orm-manager/blob/4288426517f53d05177b8729c4ba94c5beca9a98/src/Flipbox/OrmManager/Consoles/ModelDetail.php#L129-L149 |
flipboxstudio/orm-manager | src/Flipbox/OrmManager/Consoles/ModelDetail.php | ModelDetail.showModifier | protected function showModifier(Model $model)
{
$name = $this->manager->getClassName($model);
$this->title("Modifier of Model {$name}: ");
$modifiers = [
'mutators' => $this->manager->getMutators($model),
'accessors' => $this->manager->getAccessors($model),
'scopes' => $this->manager->getScopes($model),
];
$rows = [];
foreach (max($modifiers) as $modifier) {
foreach (['mutator', 'accessor', 'scope'] as $type) {
$$type = '';
$types = &$modifiers[Str::plural($type)];
if ($types->count() > 0) {
$$type = $this->paintString($types->first()->getName(), 'brown');
unset($types[0]);
}
}
$rows[] = [$mutator, $accessor, $scope];
}
$headers = ['mutator', 'accessor', 'scope'];
$this->table($headers, $rows);
} | php | protected function showModifier(Model $model)
{
$name = $this->manager->getClassName($model);
$this->title("Modifier of Model {$name}: ");
$modifiers = [
'mutators' => $this->manager->getMutators($model),
'accessors' => $this->manager->getAccessors($model),
'scopes' => $this->manager->getScopes($model),
];
$rows = [];
foreach (max($modifiers) as $modifier) {
foreach (['mutator', 'accessor', 'scope'] as $type) {
$$type = '';
$types = &$modifiers[Str::plural($type)];
if ($types->count() > 0) {
$$type = $this->paintString($types->first()->getName(), 'brown');
unset($types[0]);
}
}
$rows[] = [$mutator, $accessor, $scope];
}
$headers = ['mutator', 'accessor', 'scope'];
$this->table($headers, $rows);
} | [
"protected",
"function",
"showModifier",
"(",
"Model",
"$",
"model",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"manager",
"->",
"getClassName",
"(",
"$",
"model",
")",
";",
"$",
"this",
"->",
"title",
"(",
"\"Modifier of Model {$name}: \"",
")",
";",
"$",
"modifiers",
"=",
"[",
"'mutators'",
"=>",
"$",
"this",
"->",
"manager",
"->",
"getMutators",
"(",
"$",
"model",
")",
",",
"'accessors'",
"=>",
"$",
"this",
"->",
"manager",
"->",
"getAccessors",
"(",
"$",
"model",
")",
",",
"'scopes'",
"=>",
"$",
"this",
"->",
"manager",
"->",
"getScopes",
"(",
"$",
"model",
")",
",",
"]",
";",
"$",
"rows",
"=",
"[",
"]",
";",
"foreach",
"(",
"max",
"(",
"$",
"modifiers",
")",
"as",
"$",
"modifier",
")",
"{",
"foreach",
"(",
"[",
"'mutator'",
",",
"'accessor'",
",",
"'scope'",
"]",
"as",
"$",
"type",
")",
"{",
"$",
"$",
"type",
"=",
"''",
";",
"$",
"types",
"=",
"&",
"$",
"modifiers",
"[",
"Str",
"::",
"plural",
"(",
"$",
"type",
")",
"]",
";",
"if",
"(",
"$",
"types",
"->",
"count",
"(",
")",
">",
"0",
")",
"{",
"$",
"$",
"type",
"=",
"$",
"this",
"->",
"paintString",
"(",
"$",
"types",
"->",
"first",
"(",
")",
"->",
"getName",
"(",
")",
",",
"'brown'",
")",
";",
"unset",
"(",
"$",
"types",
"[",
"0",
"]",
")",
";",
"}",
"}",
"$",
"rows",
"[",
"]",
"=",
"[",
"$",
"mutator",
",",
"$",
"accessor",
",",
"$",
"scope",
"]",
";",
"}",
"$",
"headers",
"=",
"[",
"'mutator'",
",",
"'accessor'",
",",
"'scope'",
"]",
";",
"$",
"this",
"->",
"table",
"(",
"$",
"headers",
",",
"$",
"rows",
")",
";",
"}"
] | show model modifier
@param Model $model
@return void | [
"show",
"model",
"modifier"
] | train | https://github.com/flipboxstudio/orm-manager/blob/4288426517f53d05177b8729c4ba94c5beca9a98/src/Flipbox/OrmManager/Consoles/ModelDetail.php#L157-L189 |
koriym/Koriym.Psr4List | src/Psr4List.php | Psr4List.invoke | private function invoke($prefix, $path)
{
foreach ($this->files($path) as $item) {
/** @var $item \SplFileInfo */
$file = $item->getPathname();
$namePath = str_replace('/', '\\' , substr(substr($file, strlen($path) + 1), 0, -4));
$class = $prefix . '\\' . $namePath;
if (! class_exists($class)) {
continue;
}
yield [$class, $file];
}
} | php | private function invoke($prefix, $path)
{
foreach ($this->files($path) as $item) {
/** @var $item \SplFileInfo */
$file = $item->getPathname();
$namePath = str_replace('/', '\\' , substr(substr($file, strlen($path) + 1), 0, -4));
$class = $prefix . '\\' . $namePath;
if (! class_exists($class)) {
continue;
}
yield [$class, $file];
}
} | [
"private",
"function",
"invoke",
"(",
"$",
"prefix",
",",
"$",
"path",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"files",
"(",
"$",
"path",
")",
"as",
"$",
"item",
")",
"{",
"/** @var $item \\SplFileInfo */",
"$",
"file",
"=",
"$",
"item",
"->",
"getPathname",
"(",
")",
";",
"$",
"namePath",
"=",
"str_replace",
"(",
"'/'",
",",
"'\\\\'",
",",
"substr",
"(",
"substr",
"(",
"$",
"file",
",",
"strlen",
"(",
"$",
"path",
")",
"+",
"1",
")",
",",
"0",
",",
"-",
"4",
")",
")",
";",
"$",
"class",
"=",
"$",
"prefix",
".",
"'\\\\'",
".",
"$",
"namePath",
";",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"class",
")",
")",
"{",
"continue",
";",
"}",
"yield",
"[",
"$",
"class",
",",
"$",
"file",
"]",
";",
"}",
"}"
] | @param string $prefix
@param string $path
@return \Generator | [
"@param",
"string",
"$prefix",
"@param",
"string",
"$path"
] | train | https://github.com/koriym/Koriym.Psr4List/blob/4f267aa6de4e37cfa84f4d9447f2936e8c79870a/src/Psr4List.php#L28-L41 |
nicklaw5/larapi | src/Larapi.php | Larapi.badRequest | public function badRequest($msg = '', $errorCode = null, $headers = [])
{
return $this->getErrorResponse($msg, $errorCode, self::HTTP_BAD_REQUEST, $headers);
} | php | public function badRequest($msg = '', $errorCode = null, $headers = [])
{
return $this->getErrorResponse($msg, $errorCode, self::HTTP_BAD_REQUEST, $headers);
} | [
"public",
"function",
"badRequest",
"(",
"$",
"msg",
"=",
"''",
",",
"$",
"errorCode",
"=",
"null",
",",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"getErrorResponse",
"(",
"$",
"msg",
",",
"$",
"errorCode",
",",
"self",
"::",
"HTTP_BAD_REQUEST",
",",
"$",
"headers",
")",
";",
"}"
] | Returns 400 Bad Request Response
@param string $msg
@param int $errorCode
@param array $headers
@return json | [
"Returns",
"400",
"Bad",
"Request",
"Response"
] | train | https://github.com/nicklaw5/larapi/blob/fb3493118bb9c6ce01567230c09e8402ac148d0e/src/Larapi.php#L110-L113 |
nicklaw5/larapi | src/Larapi.php | Larapi.unauthorized | public function unauthorized($msg = '', $errorCode = null, $headers = [])
{
return $this->getErrorResponse($msg, $errorCode, self::HTTP_UNAUTHORIZED, $headers);
} | php | public function unauthorized($msg = '', $errorCode = null, $headers = [])
{
return $this->getErrorResponse($msg, $errorCode, self::HTTP_UNAUTHORIZED, $headers);
} | [
"public",
"function",
"unauthorized",
"(",
"$",
"msg",
"=",
"''",
",",
"$",
"errorCode",
"=",
"null",
",",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"getErrorResponse",
"(",
"$",
"msg",
",",
"$",
"errorCode",
",",
"self",
"::",
"HTTP_UNAUTHORIZED",
",",
"$",
"headers",
")",
";",
"}"
] | Returns 401 Unauthorized Response
@param string $msg
@param int $errorCode
@param array $headers
@return json | [
"Returns",
"401",
"Unauthorized",
"Response"
] | train | https://github.com/nicklaw5/larapi/blob/fb3493118bb9c6ce01567230c09e8402ac148d0e/src/Larapi.php#L123-L126 |
nicklaw5/larapi | src/Larapi.php | Larapi.forbidden | public function forbidden($msg = '', $errorCode = null, $headers = [])
{
return $this->getErrorResponse($msg, $errorCode, self::HTTP_FORBIDDEN, $headers);
} | php | public function forbidden($msg = '', $errorCode = null, $headers = [])
{
return $this->getErrorResponse($msg, $errorCode, self::HTTP_FORBIDDEN, $headers);
} | [
"public",
"function",
"forbidden",
"(",
"$",
"msg",
"=",
"''",
",",
"$",
"errorCode",
"=",
"null",
",",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"getErrorResponse",
"(",
"$",
"msg",
",",
"$",
"errorCode",
",",
"self",
"::",
"HTTP_FORBIDDEN",
",",
"$",
"headers",
")",
";",
"}"
] | Returns 403 Forbidden Response
@param string $msg
@param int $errorCode
@param array $headers
@return json | [
"Returns",
"403",
"Forbidden",
"Response"
] | train | https://github.com/nicklaw5/larapi/blob/fb3493118bb9c6ce01567230c09e8402ac148d0e/src/Larapi.php#L136-L139 |
nicklaw5/larapi | src/Larapi.php | Larapi.notFound | public function notFound($msg = '', $errorCode = null, $headers = [])
{
return $this->getErrorResponse($msg, $errorCode, self::HTTP_NOT_FOUND, $headers);
} | php | public function notFound($msg = '', $errorCode = null, $headers = [])
{
return $this->getErrorResponse($msg, $errorCode, self::HTTP_NOT_FOUND, $headers);
} | [
"public",
"function",
"notFound",
"(",
"$",
"msg",
"=",
"''",
",",
"$",
"errorCode",
"=",
"null",
",",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"getErrorResponse",
"(",
"$",
"msg",
",",
"$",
"errorCode",
",",
"self",
"::",
"HTTP_NOT_FOUND",
",",
"$",
"headers",
")",
";",
"}"
] | Returns 404 Not Found HTTP Response
@param string $msg
@param int $errorCode
@param array $headers
@return json | [
"Returns",
"404",
"Not",
"Found",
"HTTP",
"Response"
] | train | https://github.com/nicklaw5/larapi/blob/fb3493118bb9c6ce01567230c09e8402ac148d0e/src/Larapi.php#L149-L152 |
nicklaw5/larapi | src/Larapi.php | Larapi.methodNotAllowed | public function methodNotAllowed($msg = '', $errorCode = null, $headers = [])
{
return $this->getErrorResponse($msg, $errorCode, self::HTTP_METHOD_NOT_ALLOWED, $headers);
} | php | public function methodNotAllowed($msg = '', $errorCode = null, $headers = [])
{
return $this->getErrorResponse($msg, $errorCode, self::HTTP_METHOD_NOT_ALLOWED, $headers);
} | [
"public",
"function",
"methodNotAllowed",
"(",
"$",
"msg",
"=",
"''",
",",
"$",
"errorCode",
"=",
"null",
",",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"getErrorResponse",
"(",
"$",
"msg",
",",
"$",
"errorCode",
",",
"self",
"::",
"HTTP_METHOD_NOT_ALLOWED",
",",
"$",
"headers",
")",
";",
"}"
] | Returns 405 Method Not Allowed Response
@param string $msg
@param int $errorCode
@param array $headers
@return json | [
"Returns",
"405",
"Method",
"Not",
"Allowed",
"Response"
] | train | https://github.com/nicklaw5/larapi/blob/fb3493118bb9c6ce01567230c09e8402ac148d0e/src/Larapi.php#L162-L165 |
nicklaw5/larapi | src/Larapi.php | Larapi.conflict | public function conflict($msg = '', $errorCode = null, $headers = [])
{
return $this->getErrorResponse($msg, $errorCode, self::HTTP_CONFLICT, $headers);
} | php | public function conflict($msg = '', $errorCode = null, $headers = [])
{
return $this->getErrorResponse($msg, $errorCode, self::HTTP_CONFLICT, $headers);
} | [
"public",
"function",
"conflict",
"(",
"$",
"msg",
"=",
"''",
",",
"$",
"errorCode",
"=",
"null",
",",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"getErrorResponse",
"(",
"$",
"msg",
",",
"$",
"errorCode",
",",
"self",
"::",
"HTTP_CONFLICT",
",",
"$",
"headers",
")",
";",
"}"
] | Returns 409 Conflict Response
@param string $msg
@param int $errorCode
@param array $headers
@return json | [
"Returns",
"409",
"Conflict",
"Response"
] | train | https://github.com/nicklaw5/larapi/blob/fb3493118bb9c6ce01567230c09e8402ac148d0e/src/Larapi.php#L175-L178 |
nicklaw5/larapi | src/Larapi.php | Larapi.unprocessableEntity | public function unprocessableEntity($msg = '', $errorCode = null, $headers = [])
{
return $this->getErrorResponse($msg, $errorCode, self::HTTP_UNPROCESSABLE_ENTITY, $headers);
} | php | public function unprocessableEntity($msg = '', $errorCode = null, $headers = [])
{
return $this->getErrorResponse($msg, $errorCode, self::HTTP_UNPROCESSABLE_ENTITY, $headers);
} | [
"public",
"function",
"unprocessableEntity",
"(",
"$",
"msg",
"=",
"''",
",",
"$",
"errorCode",
"=",
"null",
",",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"getErrorResponse",
"(",
"$",
"msg",
",",
"$",
"errorCode",
",",
"self",
"::",
"HTTP_UNPROCESSABLE_ENTITY",
",",
"$",
"headers",
")",
";",
"}"
] | Returns 422 Unprocessable Entity
@param string $msg
@param int $errorCode
@param array $headers
@return json | [
"Returns",
"422",
"Unprocessable",
"Entity"
] | train | https://github.com/nicklaw5/larapi/blob/fb3493118bb9c6ce01567230c09e8402ac148d0e/src/Larapi.php#L188-L191 |
nicklaw5/larapi | src/Larapi.php | Larapi.internalError | public function internalError($msg = '', $errorCode = null, $headers = [])
{
return $this->getErrorResponse($msg, $errorCode, self::HTTP_INTERNAL_SERVER_ERROR, $headers);
} | php | public function internalError($msg = '', $errorCode = null, $headers = [])
{
return $this->getErrorResponse($msg, $errorCode, self::HTTP_INTERNAL_SERVER_ERROR, $headers);
} | [
"public",
"function",
"internalError",
"(",
"$",
"msg",
"=",
"''",
",",
"$",
"errorCode",
"=",
"null",
",",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"getErrorResponse",
"(",
"$",
"msg",
",",
"$",
"errorCode",
",",
"self",
"::",
"HTTP_INTERNAL_SERVER_ERROR",
",",
"$",
"headers",
")",
";",
"}"
] | Returns 500 Internal Server HTTP Response
@param string $msg
@param int $errorCode
@param array $headers
@return json | [
"Returns",
"500",
"Internal",
"Server",
"HTTP",
"Response"
] | train | https://github.com/nicklaw5/larapi/blob/fb3493118bb9c6ce01567230c09e8402ac148d0e/src/Larapi.php#L201-L204 |
nicklaw5/larapi | src/Larapi.php | Larapi.notImplemented | public function notImplemented($msg = '', $errorCode = null, $headers = [])
{
return $this->getErrorResponse($msg, $errorCode, self::HTTP_NOT_IMPLEMENTED, $headers);
} | php | public function notImplemented($msg = '', $errorCode = null, $headers = [])
{
return $this->getErrorResponse($msg, $errorCode, self::HTTP_NOT_IMPLEMENTED, $headers);
} | [
"public",
"function",
"notImplemented",
"(",
"$",
"msg",
"=",
"''",
",",
"$",
"errorCode",
"=",
"null",
",",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"getErrorResponse",
"(",
"$",
"msg",
",",
"$",
"errorCode",
",",
"self",
"::",
"HTTP_NOT_IMPLEMENTED",
",",
"$",
"headers",
")",
";",
"}"
] | Returns 501 Not Implemented HTTP Response
@param string $msg
@param int $errorCode
@param array $headers
@return json | [
"Returns",
"501",
"Not",
"Implemented",
"HTTP",
"Response"
] | train | https://github.com/nicklaw5/larapi/blob/fb3493118bb9c6ce01567230c09e8402ac148d0e/src/Larapi.php#L214-L217 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.