id
int32 0
241k
| repo
stringlengths 6
63
| path
stringlengths 5
140
| func_name
stringlengths 3
151
| original_string
stringlengths 84
13k
| language
stringclasses 1
value | code
stringlengths 84
13k
| code_tokens
list | docstring
stringlengths 3
47.2k
| docstring_tokens
list | sha
stringlengths 40
40
| url
stringlengths 91
247
|
|---|---|---|---|---|---|---|---|---|---|---|---|
221,300
|
colinmollenhour/mongodb-php-odm
|
classes/mongo/document.php
|
Mongo_Document.as_array
|
public function as_array( $clean = FALSE )
{
if($clean === TRUE)
{
$array = $this->_object;
}
else
{
$array = array();
foreach($this->_object as $name => $value)
{
$array[$name] = isset($this->_object[$name]) ? $this->_object[$name] : NULL;
}
foreach($this->_aliases as $alias => $name)
{
if(isset($array[$name]))
{
$array[$alias] = $array[$name];
unset($array[$name]);
}
}
}
return $array;
}
|
php
|
public function as_array( $clean = FALSE )
{
if($clean === TRUE)
{
$array = $this->_object;
}
else
{
$array = array();
foreach($this->_object as $name => $value)
{
$array[$name] = isset($this->_object[$name]) ? $this->_object[$name] : NULL;
}
foreach($this->_aliases as $alias => $name)
{
if(isset($array[$name]))
{
$array[$alias] = $array[$name];
unset($array[$name]);
}
}
}
return $array;
}
|
[
"public",
"function",
"as_array",
"(",
"$",
"clean",
"=",
"FALSE",
")",
"{",
"if",
"(",
"$",
"clean",
"===",
"TRUE",
")",
"{",
"$",
"array",
"=",
"$",
"this",
"->",
"_object",
";",
"}",
"else",
"{",
"$",
"array",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"_object",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"$",
"array",
"[",
"$",
"name",
"]",
"=",
"isset",
"(",
"$",
"this",
"->",
"_object",
"[",
"$",
"name",
"]",
")",
"?",
"$",
"this",
"->",
"_object",
"[",
"$",
"name",
"]",
":",
"NULL",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"_aliases",
"as",
"$",
"alias",
"=>",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"array",
"[",
"$",
"name",
"]",
")",
")",
"{",
"$",
"array",
"[",
"$",
"alias",
"]",
"=",
"$",
"array",
"[",
"$",
"name",
"]",
";",
"unset",
"(",
"$",
"array",
"[",
"$",
"name",
"]",
")",
";",
"}",
"}",
"}",
"return",
"$",
"array",
";",
"}"
] |
Get the model data as an associative array.
@param boolean $clean retrieve values directly from _object
@return array field => value
|
[
"Get",
"the",
"model",
"data",
"as",
"an",
"associative",
"array",
"."
] |
640ce82c0ab00765168addec1bf0b996bdb4e4d1
|
https://github.com/colinmollenhour/mongodb-php-odm/blob/640ce82c0ab00765168addec1bf0b996bdb4e4d1/classes/mongo/document.php#L1139-L1163
|
221,301
|
colinmollenhour/mongodb-php-odm
|
classes/mongo/document.php
|
Mongo_Document._update_references
|
protected function _update_references()
{
foreach($this->_references as $name => $ref)
{
if(isset($this->_related_objects[$name]) && $this->_related_objects[$name] instanceof Mongo_Document)
{
$model = $this->_related_objects[$name];
$id_field = isset($ref['field']) ? $ref['field'] : "_$name";
if( ! $this->__isset($id_field) || $this->__get($id_field) != $model->_id)
{
$this->__set($id_field, $model->_id);
}
}
}
}
|
php
|
protected function _update_references()
{
foreach($this->_references as $name => $ref)
{
if(isset($this->_related_objects[$name]) && $this->_related_objects[$name] instanceof Mongo_Document)
{
$model = $this->_related_objects[$name];
$id_field = isset($ref['field']) ? $ref['field'] : "_$name";
if( ! $this->__isset($id_field) || $this->__get($id_field) != $model->_id)
{
$this->__set($id_field, $model->_id);
}
}
}
}
|
[
"protected",
"function",
"_update_references",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_references",
"as",
"$",
"name",
"=>",
"$",
"ref",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_related_objects",
"[",
"$",
"name",
"]",
")",
"&&",
"$",
"this",
"->",
"_related_objects",
"[",
"$",
"name",
"]",
"instanceof",
"Mongo_Document",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"_related_objects",
"[",
"$",
"name",
"]",
";",
"$",
"id_field",
"=",
"isset",
"(",
"$",
"ref",
"[",
"'field'",
"]",
")",
"?",
"$",
"ref",
"[",
"'field'",
"]",
":",
"\"_$name\"",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"__isset",
"(",
"$",
"id_field",
")",
"||",
"$",
"this",
"->",
"__get",
"(",
"$",
"id_field",
")",
"!=",
"$",
"model",
"->",
"_id",
")",
"{",
"$",
"this",
"->",
"__set",
"(",
"$",
"id_field",
",",
"$",
"model",
"->",
"_id",
")",
";",
"}",
"}",
"}",
"}"
] |
Updates references but does not save models to avoid infinite loops
|
[
"Updates",
"references",
"but",
"does",
"not",
"save",
"models",
"to",
"avoid",
"infinite",
"loops"
] |
640ce82c0ab00765168addec1bf0b996bdb4e4d1
|
https://github.com/colinmollenhour/mongodb-php-odm/blob/640ce82c0ab00765168addec1bf0b996bdb4e4d1/classes/mongo/document.php#L1359-L1373
|
221,302
|
colinmollenhour/mongodb-php-odm
|
classes/mongo/document.php
|
Mongo_Document.upsert
|
public function upsert($operations = array())
{
if( ! $this->_object)
{
throw new MongoException('Cannot upsert '.get_class($this).': no criteria');
}
$this->before_save(self::SAVE_UPSERT);
$operations = self::array_merge_recursive_distinct($this->_operations, $operations);
if( ! $this->collection()->update($this->_object, $operations, array('upsert' => TRUE)))
{
$err = $this->db()->lastError();
throw new MongoException('Upsert of '.get_class($this).' failed: '.$err['err']);
}
$this->_changed = $this->_operations = array();
$this->after_save(self::SAVE_UPSERT);
return $this;
}
|
php
|
public function upsert($operations = array())
{
if( ! $this->_object)
{
throw new MongoException('Cannot upsert '.get_class($this).': no criteria');
}
$this->before_save(self::SAVE_UPSERT);
$operations = self::array_merge_recursive_distinct($this->_operations, $operations);
if( ! $this->collection()->update($this->_object, $operations, array('upsert' => TRUE)))
{
$err = $this->db()->lastError();
throw new MongoException('Upsert of '.get_class($this).' failed: '.$err['err']);
}
$this->_changed = $this->_operations = array();
$this->after_save(self::SAVE_UPSERT);
return $this;
}
|
[
"public",
"function",
"upsert",
"(",
"$",
"operations",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_object",
")",
"{",
"throw",
"new",
"MongoException",
"(",
"'Cannot upsert '",
".",
"get_class",
"(",
"$",
"this",
")",
".",
"': no criteria'",
")",
";",
"}",
"$",
"this",
"->",
"before_save",
"(",
"self",
"::",
"SAVE_UPSERT",
")",
";",
"$",
"operations",
"=",
"self",
"::",
"array_merge_recursive_distinct",
"(",
"$",
"this",
"->",
"_operations",
",",
"$",
"operations",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"collection",
"(",
")",
"->",
"update",
"(",
"$",
"this",
"->",
"_object",
",",
"$",
"operations",
",",
"array",
"(",
"'upsert'",
"=>",
"TRUE",
")",
")",
")",
"{",
"$",
"err",
"=",
"$",
"this",
"->",
"db",
"(",
")",
"->",
"lastError",
"(",
")",
";",
"throw",
"new",
"MongoException",
"(",
"'Upsert of '",
".",
"get_class",
"(",
"$",
"this",
")",
".",
"' failed: '",
".",
"$",
"err",
"[",
"'err'",
"]",
")",
";",
"}",
"$",
"this",
"->",
"_changed",
"=",
"$",
"this",
"->",
"_operations",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"after_save",
"(",
"self",
"::",
"SAVE_UPSERT",
")",
";",
"return",
"$",
"this",
";",
"}"
] |
Upsert the document, does not retrieve the _id of the upserted document.
@param array $operations
@throws MongoException
@return Mongo_Document
|
[
"Upsert",
"the",
"document",
"does",
"not",
"retrieve",
"the",
"_id",
"of",
"the",
"upserted",
"document",
"."
] |
640ce82c0ab00765168addec1bf0b996bdb4e4d1
|
https://github.com/colinmollenhour/mongodb-php-odm/blob/640ce82c0ab00765168addec1bf0b996bdb4e4d1/classes/mongo/document.php#L1416-L1438
|
221,303
|
colinmollenhour/mongodb-php-odm
|
classes/mongo/document.php
|
Mongo_Document.unset_named_reference
|
public static function unset_named_reference(&$arr, $name)
{
$keys = explode('.', $name);
$data = & $arr;
foreach ($keys as $i => $key)
{
if (isset($data[$key]))
{
if ($i == count($keys) - 1)
{
unset($data[$key]);
return;
}
$data = & $data[$key];
}
else
{
return;
}
}
}
|
php
|
public static function unset_named_reference(&$arr, $name)
{
$keys = explode('.', $name);
$data = & $arr;
foreach ($keys as $i => $key)
{
if (isset($data[$key]))
{
if ($i == count($keys) - 1)
{
unset($data[$key]);
return;
}
$data = & $data[$key];
}
else
{
return;
}
}
}
|
[
"public",
"static",
"function",
"unset_named_reference",
"(",
"&",
"$",
"arr",
",",
"$",
"name",
")",
"{",
"$",
"keys",
"=",
"explode",
"(",
"'.'",
",",
"$",
"name",
")",
";",
"$",
"data",
"=",
"&",
"$",
"arr",
";",
"foreach",
"(",
"$",
"keys",
"as",
"$",
"i",
"=>",
"$",
"key",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"data",
"[",
"$",
"key",
"]",
")",
")",
"{",
"if",
"(",
"$",
"i",
"==",
"count",
"(",
"$",
"keys",
")",
"-",
"1",
")",
"{",
"unset",
"(",
"$",
"data",
"[",
"$",
"key",
"]",
")",
";",
"return",
";",
"}",
"$",
"data",
"=",
"&",
"$",
"data",
"[",
"$",
"key",
"]",
";",
"}",
"else",
"{",
"return",
";",
"}",
"}",
"}"
] |
Unsets a field using dot notation
@param array $arr Array with data
@param string $name Dot notation name
|
[
"Unsets",
"a",
"field",
"using",
"dot",
"notation"
] |
640ce82c0ab00765168addec1bf0b996bdb4e4d1
|
https://github.com/colinmollenhour/mongodb-php-odm/blob/640ce82c0ab00765168addec1bf0b996bdb4e4d1/classes/mongo/document.php#L1562-L1582
|
221,304
|
Inpassor/yii2-daemon
|
Controller.php
|
Controller._getPid
|
protected function _getPid()
{
if (!file_exists($this->_pidFile)) {
return false;
}
return (($this->_pid = file_get_contents($this->_pidFile)) && posix_kill($this->_pid, 0)) ? $this->_pid : false;
}
|
php
|
protected function _getPid()
{
if (!file_exists($this->_pidFile)) {
return false;
}
return (($this->_pid = file_get_contents($this->_pidFile)) && posix_kill($this->_pid, 0)) ? $this->_pid : false;
}
|
[
"protected",
"function",
"_getPid",
"(",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"this",
"->",
"_pidFile",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"(",
"(",
"$",
"this",
"->",
"_pid",
"=",
"file_get_contents",
"(",
"$",
"this",
"->",
"_pidFile",
")",
")",
"&&",
"posix_kill",
"(",
"$",
"this",
"->",
"_pid",
",",
"0",
")",
")",
"?",
"$",
"this",
"->",
"_pid",
":",
"false",
";",
"}"
] |
Gets the PID of the main process, false on fail.
@return bool|string
|
[
"Gets",
"the",
"PID",
"of",
"the",
"main",
"process",
"false",
"on",
"fail",
"."
] |
a8efd68efa48e74295ff359938120ac12e1fb1bf
|
https://github.com/Inpassor/yii2-daemon/blob/a8efd68efa48e74295ff359938120ac12e1fb1bf/Controller.php#L84-L90
|
221,305
|
Inpassor/yii2-daemon
|
Controller.php
|
Controller._killPid
|
protected function _killPid()
{
if (file_exists($this->_pidFile)) {
unlink($this->_pidFile);
}
if ($this->_pid) {
posix_kill($this->_pid, SIGTERM);
}
}
|
php
|
protected function _killPid()
{
if (file_exists($this->_pidFile)) {
unlink($this->_pidFile);
}
if ($this->_pid) {
posix_kill($this->_pid, SIGTERM);
}
}
|
[
"protected",
"function",
"_killPid",
"(",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"this",
"->",
"_pidFile",
")",
")",
"{",
"unlink",
"(",
"$",
"this",
"->",
"_pidFile",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"_pid",
")",
"{",
"posix_kill",
"(",
"$",
"this",
"->",
"_pid",
",",
"SIGTERM",
")",
";",
"}",
"}"
] |
Tries to kill the PID of the main process.
|
[
"Tries",
"to",
"kill",
"the",
"PID",
"of",
"the",
"main",
"process",
"."
] |
a8efd68efa48e74295ff359938120ac12e1fb1bf
|
https://github.com/Inpassor/yii2-daemon/blob/a8efd68efa48e74295ff359938120ac12e1fb1bf/Controller.php#L95-L103
|
221,306
|
Inpassor/yii2-daemon
|
Controller.php
|
Controller._getWorkers
|
protected function _getWorkers()
{
foreach ($this->workersMap as $workerUid => $workerConfig) {
if (is_string($workerConfig)) {
$workerConfig = [
'class' => $workerConfig,
];
}
if (
!isset($workerConfig['class'])
|| (isset($workerConfig['active']) && !$workerConfig['active'])
) {
continue;
}
if (
!isset($workerConfig['delay'])
|| !isset($workerConfig['maxProcesses'])
) {
$worker = new $workerConfig['class']();
if (!isset($workerConfig['delay'])) {
$workerConfig['delay'] = $worker->delay;
}
if (!isset($workerConfig['maxProcesses'])) {
$workerConfig['maxProcesses'] = $worker->maxProcesses;
}
unset($worker);
}
static::$_workersData[$workerUid] = [
'class' => $workerConfig['class'],
'maxProcesses' => $workerConfig['maxProcesses'],
'delay' => $workerConfig['delay'],
'tick' => 1,
];
static::$_workersConfig[$workerUid] = $workerConfig;
static::$workersPids[$workerUid] = [];
}
}
|
php
|
protected function _getWorkers()
{
foreach ($this->workersMap as $workerUid => $workerConfig) {
if (is_string($workerConfig)) {
$workerConfig = [
'class' => $workerConfig,
];
}
if (
!isset($workerConfig['class'])
|| (isset($workerConfig['active']) && !$workerConfig['active'])
) {
continue;
}
if (
!isset($workerConfig['delay'])
|| !isset($workerConfig['maxProcesses'])
) {
$worker = new $workerConfig['class']();
if (!isset($workerConfig['delay'])) {
$workerConfig['delay'] = $worker->delay;
}
if (!isset($workerConfig['maxProcesses'])) {
$workerConfig['maxProcesses'] = $worker->maxProcesses;
}
unset($worker);
}
static::$_workersData[$workerUid] = [
'class' => $workerConfig['class'],
'maxProcesses' => $workerConfig['maxProcesses'],
'delay' => $workerConfig['delay'],
'tick' => 1,
];
static::$_workersConfig[$workerUid] = $workerConfig;
static::$workersPids[$workerUid] = [];
}
}
|
[
"protected",
"function",
"_getWorkers",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"workersMap",
"as",
"$",
"workerUid",
"=>",
"$",
"workerConfig",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"workerConfig",
")",
")",
"{",
"$",
"workerConfig",
"=",
"[",
"'class'",
"=>",
"$",
"workerConfig",
",",
"]",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
"$",
"workerConfig",
"[",
"'class'",
"]",
")",
"||",
"(",
"isset",
"(",
"$",
"workerConfig",
"[",
"'active'",
"]",
")",
"&&",
"!",
"$",
"workerConfig",
"[",
"'active'",
"]",
")",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
"$",
"workerConfig",
"[",
"'delay'",
"]",
")",
"||",
"!",
"isset",
"(",
"$",
"workerConfig",
"[",
"'maxProcesses'",
"]",
")",
")",
"{",
"$",
"worker",
"=",
"new",
"$",
"workerConfig",
"[",
"'class'",
"]",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"workerConfig",
"[",
"'delay'",
"]",
")",
")",
"{",
"$",
"workerConfig",
"[",
"'delay'",
"]",
"=",
"$",
"worker",
"->",
"delay",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
"$",
"workerConfig",
"[",
"'maxProcesses'",
"]",
")",
")",
"{",
"$",
"workerConfig",
"[",
"'maxProcesses'",
"]",
"=",
"$",
"worker",
"->",
"maxProcesses",
";",
"}",
"unset",
"(",
"$",
"worker",
")",
";",
"}",
"static",
"::",
"$",
"_workersData",
"[",
"$",
"workerUid",
"]",
"=",
"[",
"'class'",
"=>",
"$",
"workerConfig",
"[",
"'class'",
"]",
",",
"'maxProcesses'",
"=>",
"$",
"workerConfig",
"[",
"'maxProcesses'",
"]",
",",
"'delay'",
"=>",
"$",
"workerConfig",
"[",
"'delay'",
"]",
",",
"'tick'",
"=>",
"1",
",",
"]",
";",
"static",
"::",
"$",
"_workersConfig",
"[",
"$",
"workerUid",
"]",
"=",
"$",
"workerConfig",
";",
"static",
"::",
"$",
"workersPids",
"[",
"$",
"workerUid",
"]",
"=",
"[",
"]",
";",
"}",
"}"
] |
Gets all the daemon workers.
|
[
"Gets",
"all",
"the",
"daemon",
"workers",
"."
] |
a8efd68efa48e74295ff359938120ac12e1fb1bf
|
https://github.com/Inpassor/yii2-daemon/blob/a8efd68efa48e74295ff359938120ac12e1fb1bf/Controller.php#L108-L144
|
221,307
|
Inpassor/yii2-daemon
|
Controller.php
|
Controller.signalHandler
|
public static function signalHandler($signo, $pid = null, $status = null)
{
switch ($signo) {
case SIGTERM:
case SIGINT:
static::$_stop = true;
break;
case SIGCHLD:
if (!$pid) {
$pid = pcntl_waitpid(-1, $status, WNOHANG);
}
while ($pid > 0) {
foreach (static::$workersPids as $workerUid => $workerPids) {
if (($key = array_search($pid, $workerPids)) !== false) {
unset(static::$workersPids[$workerUid][$key]);
}
}
$pid = pcntl_waitpid(-1, $status, WNOHANG);
}
break;
}
}
|
php
|
public static function signalHandler($signo, $pid = null, $status = null)
{
switch ($signo) {
case SIGTERM:
case SIGINT:
static::$_stop = true;
break;
case SIGCHLD:
if (!$pid) {
$pid = pcntl_waitpid(-1, $status, WNOHANG);
}
while ($pid > 0) {
foreach (static::$workersPids as $workerUid => $workerPids) {
if (($key = array_search($pid, $workerPids)) !== false) {
unset(static::$workersPids[$workerUid][$key]);
}
}
$pid = pcntl_waitpid(-1, $status, WNOHANG);
}
break;
}
}
|
[
"public",
"static",
"function",
"signalHandler",
"(",
"$",
"signo",
",",
"$",
"pid",
"=",
"null",
",",
"$",
"status",
"=",
"null",
")",
"{",
"switch",
"(",
"$",
"signo",
")",
"{",
"case",
"SIGTERM",
":",
"case",
"SIGINT",
":",
"static",
"::",
"$",
"_stop",
"=",
"true",
";",
"break",
";",
"case",
"SIGCHLD",
":",
"if",
"(",
"!",
"$",
"pid",
")",
"{",
"$",
"pid",
"=",
"pcntl_waitpid",
"(",
"-",
"1",
",",
"$",
"status",
",",
"WNOHANG",
")",
";",
"}",
"while",
"(",
"$",
"pid",
">",
"0",
")",
"{",
"foreach",
"(",
"static",
"::",
"$",
"workersPids",
"as",
"$",
"workerUid",
"=>",
"$",
"workerPids",
")",
"{",
"if",
"(",
"(",
"$",
"key",
"=",
"array_search",
"(",
"$",
"pid",
",",
"$",
"workerPids",
")",
")",
"!==",
"false",
")",
"{",
"unset",
"(",
"static",
"::",
"$",
"workersPids",
"[",
"$",
"workerUid",
"]",
"[",
"$",
"key",
"]",
")",
";",
"}",
"}",
"$",
"pid",
"=",
"pcntl_waitpid",
"(",
"-",
"1",
",",
"$",
"status",
",",
"WNOHANG",
")",
";",
"}",
"break",
";",
"}",
"}"
] |
PNCTL signal handler.
@param $signo
@param $pid
@param $status
|
[
"PNCTL",
"signal",
"handler",
"."
] |
a8efd68efa48e74295ff359938120ac12e1fb1bf
|
https://github.com/Inpassor/yii2-daemon/blob/a8efd68efa48e74295ff359938120ac12e1fb1bf/Controller.php#L206-L227
|
221,308
|
Inpassor/yii2-daemon
|
Controller.php
|
Controller.actionBoobs
|
public function actionBoobs()
{
if ($boobs = FileHelper::findFiles(__DIR__ . DIRECTORY_SEPARATOR . 'boobs', ['only' => ['boobs*.bin']])) {
$b = $boobs[mt_rand(0, count($boobs) - 1)];
echo gzuncompress(file_get_contents($b));
}
return static::EXIT_CODE_NORMAL;
}
|
php
|
public function actionBoobs()
{
if ($boobs = FileHelper::findFiles(__DIR__ . DIRECTORY_SEPARATOR . 'boobs', ['only' => ['boobs*.bin']])) {
$b = $boobs[mt_rand(0, count($boobs) - 1)];
echo gzuncompress(file_get_contents($b));
}
return static::EXIT_CODE_NORMAL;
}
|
[
"public",
"function",
"actionBoobs",
"(",
")",
"{",
"if",
"(",
"$",
"boobs",
"=",
"FileHelper",
"::",
"findFiles",
"(",
"__DIR__",
".",
"DIRECTORY_SEPARATOR",
".",
"'boobs'",
",",
"[",
"'only'",
"=>",
"[",
"'boobs*.bin'",
"]",
"]",
")",
")",
"{",
"$",
"b",
"=",
"$",
"boobs",
"[",
"mt_rand",
"(",
"0",
",",
"count",
"(",
"$",
"boobs",
")",
"-",
"1",
")",
"]",
";",
"echo",
"gzuncompress",
"(",
"file_get_contents",
"(",
"$",
"b",
")",
")",
";",
"}",
"return",
"static",
"::",
"EXIT_CODE_NORMAL",
";",
"}"
] |
The daemon boobs.
@return int
|
[
"The",
"daemon",
"boobs",
"."
] |
a8efd68efa48e74295ff359938120ac12e1fb1bf
|
https://github.com/Inpassor/yii2-daemon/blob/a8efd68efa48e74295ff359938120ac12e1fb1bf/Controller.php#L233-L240
|
221,309
|
Inpassor/yii2-daemon
|
Controller.php
|
Controller.actionStop
|
public function actionStop()
{
$message = 'Stopping Yii 2 Daemon ' . $this->version . '... ';
$result = static::EXIT_CODE_NORMAL;
if ($this->_getPid() !== false) {
$this->_killPid();
$message .= 'OK.';
} else {
$message .= 'Service is not running!';
$result = static::EXIT_CODE_ERROR;
}
echo $message . PHP_EOL;
$this->_log($message);
return $result;
}
|
php
|
public function actionStop()
{
$message = 'Stopping Yii 2 Daemon ' . $this->version . '... ';
$result = static::EXIT_CODE_NORMAL;
if ($this->_getPid() !== false) {
$this->_killPid();
$message .= 'OK.';
} else {
$message .= 'Service is not running!';
$result = static::EXIT_CODE_ERROR;
}
echo $message . PHP_EOL;
$this->_log($message);
return $result;
}
|
[
"public",
"function",
"actionStop",
"(",
")",
"{",
"$",
"message",
"=",
"'Stopping Yii 2 Daemon '",
".",
"$",
"this",
"->",
"version",
".",
"'... '",
";",
"$",
"result",
"=",
"static",
"::",
"EXIT_CODE_NORMAL",
";",
"if",
"(",
"$",
"this",
"->",
"_getPid",
"(",
")",
"!==",
"false",
")",
"{",
"$",
"this",
"->",
"_killPid",
"(",
")",
";",
"$",
"message",
".=",
"'OK.'",
";",
"}",
"else",
"{",
"$",
"message",
".=",
"'Service is not running!'",
";",
"$",
"result",
"=",
"static",
"::",
"EXIT_CODE_ERROR",
";",
"}",
"echo",
"$",
"message",
".",
"PHP_EOL",
";",
"$",
"this",
"->",
"_log",
"(",
"$",
"message",
")",
";",
"return",
"$",
"result",
";",
"}"
] |
The daemon stop command.
@return int
|
[
"The",
"daemon",
"stop",
"command",
"."
] |
a8efd68efa48e74295ff359938120ac12e1fb1bf
|
https://github.com/Inpassor/yii2-daemon/blob/a8efd68efa48e74295ff359938120ac12e1fb1bf/Controller.php#L352-L366
|
221,310
|
Inpassor/yii2-daemon
|
Controller.php
|
Controller.actionStatus
|
public function actionStatus()
{
if ($this->_getPid()) {
echo 'Yii 2 Daemon ' . $this->version . ' status: running.' . PHP_EOL;
return static::EXIT_CODE_NORMAL;
}
echo 'Yii 2 Daemon ' . $this->version . ' status: not running!' . PHP_EOL;
return static::EXIT_CODE_ERROR;
}
|
php
|
public function actionStatus()
{
if ($this->_getPid()) {
echo 'Yii 2 Daemon ' . $this->version . ' status: running.' . PHP_EOL;
return static::EXIT_CODE_NORMAL;
}
echo 'Yii 2 Daemon ' . $this->version . ' status: not running!' . PHP_EOL;
return static::EXIT_CODE_ERROR;
}
|
[
"public",
"function",
"actionStatus",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_getPid",
"(",
")",
")",
"{",
"echo",
"'Yii 2 Daemon '",
".",
"$",
"this",
"->",
"version",
".",
"' status: running.'",
".",
"PHP_EOL",
";",
"return",
"static",
"::",
"EXIT_CODE_NORMAL",
";",
"}",
"echo",
"'Yii 2 Daemon '",
".",
"$",
"this",
"->",
"version",
".",
"' status: not running!'",
".",
"PHP_EOL",
";",
"return",
"static",
"::",
"EXIT_CODE_ERROR",
";",
"}"
] |
The daemon status command.
@return int
|
[
"The",
"daemon",
"status",
"command",
"."
] |
a8efd68efa48e74295ff359938120ac12e1fb1bf
|
https://github.com/Inpassor/yii2-daemon/blob/a8efd68efa48e74295ff359938120ac12e1fb1bf/Controller.php#L382-L390
|
221,311
|
PHPixie/Framework
|
src/PHPixie/Framework/Processors/HTTP/Response/Exception.php
|
Exception.process
|
public function process($exception)
{
$templateName = $this->configData->getRequired('template');
$trace = $this->debug->exceptionTrace($exception);
$body = $this->template->render(
$templateName,
array(
'exception' => $exception,
'trace' => $trace,
'logger' => $this->debug->logger()
)
);
return $this->http->responses()->response($body, array(), 500);
}
|
php
|
public function process($exception)
{
$templateName = $this->configData->getRequired('template');
$trace = $this->debug->exceptionTrace($exception);
$body = $this->template->render(
$templateName,
array(
'exception' => $exception,
'trace' => $trace,
'logger' => $this->debug->logger()
)
);
return $this->http->responses()->response($body, array(), 500);
}
|
[
"public",
"function",
"process",
"(",
"$",
"exception",
")",
"{",
"$",
"templateName",
"=",
"$",
"this",
"->",
"configData",
"->",
"getRequired",
"(",
"'template'",
")",
";",
"$",
"trace",
"=",
"$",
"this",
"->",
"debug",
"->",
"exceptionTrace",
"(",
"$",
"exception",
")",
";",
"$",
"body",
"=",
"$",
"this",
"->",
"template",
"->",
"render",
"(",
"$",
"templateName",
",",
"array",
"(",
"'exception'",
"=>",
"$",
"exception",
",",
"'trace'",
"=>",
"$",
"trace",
",",
"'logger'",
"=>",
"$",
"this",
"->",
"debug",
"->",
"logger",
"(",
")",
")",
")",
";",
"return",
"$",
"this",
"->",
"http",
"->",
"responses",
"(",
")",
"->",
"response",
"(",
"$",
"body",
",",
"array",
"(",
")",
",",
"500",
")",
";",
"}"
] |
Builds a response for an exception
@param \Exception $exception
@return \PHPixie\HTTP\Responses\Response
|
[
"Builds",
"a",
"response",
"for",
"an",
"exception"
] |
f9bce1beffb09fe386e5d62d124aea042346001f
|
https://github.com/PHPixie/Framework/blob/f9bce1beffb09fe386e5d62d124aea042346001f/src/PHPixie/Framework/Processors/HTTP/Response/Exception.php#L50-L65
|
221,312
|
PHPixie/Framework
|
src/PHPixie/Framework/Processors/HTTP/ParseRoute.php
|
ParseRoute.process
|
public function process($serverRequest)
{
$match = $this->routeTranslator->match($serverRequest);
if($match !== null) {
$attributes = $match->attributes();
$attributes['routeResolverPath'] = $match->resolverPath();
foreach($attributes as $key => $value) {
$serverRequest = $serverRequest->withAttribute($key, $value);
}
}
return $serverRequest;
}
|
php
|
public function process($serverRequest)
{
$match = $this->routeTranslator->match($serverRequest);
if($match !== null) {
$attributes = $match->attributes();
$attributes['routeResolverPath'] = $match->resolverPath();
foreach($attributes as $key => $value) {
$serverRequest = $serverRequest->withAttribute($key, $value);
}
}
return $serverRequest;
}
|
[
"public",
"function",
"process",
"(",
"$",
"serverRequest",
")",
"{",
"$",
"match",
"=",
"$",
"this",
"->",
"routeTranslator",
"->",
"match",
"(",
"$",
"serverRequest",
")",
";",
"if",
"(",
"$",
"match",
"!==",
"null",
")",
"{",
"$",
"attributes",
"=",
"$",
"match",
"->",
"attributes",
"(",
")",
";",
"$",
"attributes",
"[",
"'routeResolverPath'",
"]",
"=",
"$",
"match",
"->",
"resolverPath",
"(",
")",
";",
"foreach",
"(",
"$",
"attributes",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"serverRequest",
"=",
"$",
"serverRequest",
"->",
"withAttribute",
"(",
"$",
"key",
",",
"$",
"value",
")",
";",
"}",
"}",
"return",
"$",
"serverRequest",
";",
"}"
] |
Matches routes and sets request attributes
@param ServerRequestInterface $serverRequest
@return ServerRequestInterface
|
[
"Matches",
"routes",
"and",
"sets",
"request",
"attributes"
] |
f9bce1beffb09fe386e5d62d124aea042346001f
|
https://github.com/PHPixie/Framework/blob/f9bce1beffb09fe386e5d62d124aea042346001f/src/PHPixie/Framework/Processors/HTTP/ParseRoute.php#L32-L46
|
221,313
|
mysql-workbench-schema-exporter/doctrine2-exporter
|
lib/MwbExporter/Formatter/Doctrine2/Formatter.php
|
Formatter.isOwningSide
|
public function isOwningSide($relation, &$mappedRelation)
{
$mappedRelation = $relation['reference']->getOwningTable()->getRelationToTable($relation['refTable']->getRawTableName());
// user can hint which side is the owning side (set d:owningSide on the foreign key)
if ($relation['reference']->parseComment('owningSide') === 'true') {
return true;
}
if ($mappedRelation->parseComment('owningSide') === 'true') {
return false;
}
// if no owning side is defined, use one side randomly as owning side (the one where the column id is lower)
return $relation['reference']->getLocal()->getId() < $mappedRelation->getLocal()->getId();
}
|
php
|
public function isOwningSide($relation, &$mappedRelation)
{
$mappedRelation = $relation['reference']->getOwningTable()->getRelationToTable($relation['refTable']->getRawTableName());
// user can hint which side is the owning side (set d:owningSide on the foreign key)
if ($relation['reference']->parseComment('owningSide') === 'true') {
return true;
}
if ($mappedRelation->parseComment('owningSide') === 'true') {
return false;
}
// if no owning side is defined, use one side randomly as owning side (the one where the column id is lower)
return $relation['reference']->getLocal()->getId() < $mappedRelation->getLocal()->getId();
}
|
[
"public",
"function",
"isOwningSide",
"(",
"$",
"relation",
",",
"&",
"$",
"mappedRelation",
")",
"{",
"$",
"mappedRelation",
"=",
"$",
"relation",
"[",
"'reference'",
"]",
"->",
"getOwningTable",
"(",
")",
"->",
"getRelationToTable",
"(",
"$",
"relation",
"[",
"'refTable'",
"]",
"->",
"getRawTableName",
"(",
")",
")",
";",
"// user can hint which side is the owning side (set d:owningSide on the foreign key)",
"if",
"(",
"$",
"relation",
"[",
"'reference'",
"]",
"->",
"parseComment",
"(",
"'owningSide'",
")",
"===",
"'true'",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"$",
"mappedRelation",
"->",
"parseComment",
"(",
"'owningSide'",
")",
"===",
"'true'",
")",
"{",
"return",
"false",
";",
"}",
"// if no owning side is defined, use one side randomly as owning side (the one where the column id is lower)",
"return",
"$",
"relation",
"[",
"'reference'",
"]",
"->",
"getLocal",
"(",
")",
"->",
"getId",
"(",
")",
"<",
"$",
"mappedRelation",
"->",
"getLocal",
"(",
")",
"->",
"getId",
"(",
")",
";",
"}"
] |
Get owning side of relation.
@param array $relation
@param \MwbExporter\Model\ForeignKey $mappedRelation
@return boolean
|
[
"Get",
"owning",
"side",
"of",
"relation",
"."
] |
a62b13cbf4824c05cc791034ffedf419242ba0cb
|
https://github.com/mysql-workbench-schema-exporter/doctrine2-exporter/blob/a62b13cbf4824c05cc791034ffedf419242ba0cb/lib/MwbExporter/Formatter/Doctrine2/Formatter.php#L115-L129
|
221,314
|
mysql-workbench-schema-exporter/doctrine2-exporter
|
lib/MwbExporter/Formatter/Doctrine2/Formatter.php
|
Formatter.getCascadeOption
|
public function getCascadeOption($cascadeValue)
{
$defaultCascade = $this->getRegistry()->config->get(static::CFG_DEFAULT_CASCADE);
if (empty($cascadeValue) && !empty($defaultCascade)) {
return [$defaultCascade];
}
/** @var Validator $validator */
$validator = $this->getRegistry()->validator->get(static::CFG_DEFAULT_CASCADE);
$cascadeValue = array_map('strtolower', array_map('trim', explode(',', $cascadeValue)));
$cascadeValue = array_intersect($cascadeValue, $validator->getChoices());
$cascadeValue = array_filter($cascadeValue);
if(empty($cascadeValue)) {
return null;
}
return $cascadeValue;
}
|
php
|
public function getCascadeOption($cascadeValue)
{
$defaultCascade = $this->getRegistry()->config->get(static::CFG_DEFAULT_CASCADE);
if (empty($cascadeValue) && !empty($defaultCascade)) {
return [$defaultCascade];
}
/** @var Validator $validator */
$validator = $this->getRegistry()->validator->get(static::CFG_DEFAULT_CASCADE);
$cascadeValue = array_map('strtolower', array_map('trim', explode(',', $cascadeValue)));
$cascadeValue = array_intersect($cascadeValue, $validator->getChoices());
$cascadeValue = array_filter($cascadeValue);
if(empty($cascadeValue)) {
return null;
}
return $cascadeValue;
}
|
[
"public",
"function",
"getCascadeOption",
"(",
"$",
"cascadeValue",
")",
"{",
"$",
"defaultCascade",
"=",
"$",
"this",
"->",
"getRegistry",
"(",
")",
"->",
"config",
"->",
"get",
"(",
"static",
"::",
"CFG_DEFAULT_CASCADE",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"cascadeValue",
")",
"&&",
"!",
"empty",
"(",
"$",
"defaultCascade",
")",
")",
"{",
"return",
"[",
"$",
"defaultCascade",
"]",
";",
"}",
"/** @var Validator $validator */",
"$",
"validator",
"=",
"$",
"this",
"->",
"getRegistry",
"(",
")",
"->",
"validator",
"->",
"get",
"(",
"static",
"::",
"CFG_DEFAULT_CASCADE",
")",
";",
"$",
"cascadeValue",
"=",
"array_map",
"(",
"'strtolower'",
",",
"array_map",
"(",
"'trim'",
",",
"explode",
"(",
"','",
",",
"$",
"cascadeValue",
")",
")",
")",
";",
"$",
"cascadeValue",
"=",
"array_intersect",
"(",
"$",
"cascadeValue",
",",
"$",
"validator",
"->",
"getChoices",
"(",
")",
")",
";",
"$",
"cascadeValue",
"=",
"array_filter",
"(",
"$",
"cascadeValue",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"cascadeValue",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"$",
"cascadeValue",
";",
"}"
] |
get the cascade option as array. Only returns values allowed by Doctrine.
@param $cascadeValue string cascade options separated by comma
@return array array with the values or null, if no cascade values are available
|
[
"get",
"the",
"cascade",
"option",
"as",
"array",
".",
"Only",
"returns",
"values",
"allowed",
"by",
"Doctrine",
"."
] |
a62b13cbf4824c05cc791034ffedf419242ba0cb
|
https://github.com/mysql-workbench-schema-exporter/doctrine2-exporter/blob/a62b13cbf4824c05cc791034ffedf419242ba0cb/lib/MwbExporter/Formatter/Doctrine2/Formatter.php#L137-L155
|
221,315
|
mysql-workbench-schema-exporter/doctrine2-exporter
|
lib/MwbExporter/Formatter/Doctrine2/Formatter.php
|
Formatter.getOrderOption
|
public function getOrderOption($sortValue)
{
$orders = array();
if ($sortValue = trim($sortValue)) {
$lines = array_map('trim', explode("\n", $sortValue));
foreach ($lines as $line) {
if (count($values = array_map('trim', explode(',', $line)))) {
$column = $values[0];
$order = (count($values) > 1) ? strtoupper($values[1]) : null;
if (!in_array($order, array('ASC', 'DESC'))) {
$order = 'ASC';
}
$orders[$column] = $order;
}
}
}
return $orders;
}
|
php
|
public function getOrderOption($sortValue)
{
$orders = array();
if ($sortValue = trim($sortValue)) {
$lines = array_map('trim', explode("\n", $sortValue));
foreach ($lines as $line) {
if (count($values = array_map('trim', explode(',', $line)))) {
$column = $values[0];
$order = (count($values) > 1) ? strtoupper($values[1]) : null;
if (!in_array($order, array('ASC', 'DESC'))) {
$order = 'ASC';
}
$orders[$column] = $order;
}
}
}
return $orders;
}
|
[
"public",
"function",
"getOrderOption",
"(",
"$",
"sortValue",
")",
"{",
"$",
"orders",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"sortValue",
"=",
"trim",
"(",
"$",
"sortValue",
")",
")",
"{",
"$",
"lines",
"=",
"array_map",
"(",
"'trim'",
",",
"explode",
"(",
"\"\\n\"",
",",
"$",
"sortValue",
")",
")",
";",
"foreach",
"(",
"$",
"lines",
"as",
"$",
"line",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"values",
"=",
"array_map",
"(",
"'trim'",
",",
"explode",
"(",
"','",
",",
"$",
"line",
")",
")",
")",
")",
"{",
"$",
"column",
"=",
"$",
"values",
"[",
"0",
"]",
";",
"$",
"order",
"=",
"(",
"count",
"(",
"$",
"values",
")",
">",
"1",
")",
"?",
"strtoupper",
"(",
"$",
"values",
"[",
"1",
"]",
")",
":",
"null",
";",
"if",
"(",
"!",
"in_array",
"(",
"$",
"order",
",",
"array",
"(",
"'ASC'",
",",
"'DESC'",
")",
")",
")",
"{",
"$",
"order",
"=",
"'ASC'",
";",
"}",
"$",
"orders",
"[",
"$",
"column",
"]",
"=",
"$",
"order",
";",
"}",
"}",
"}",
"return",
"$",
"orders",
";",
"}"
] |
Parse order option.
@param string $sortValue
@return array
|
[
"Parse",
"order",
"option",
"."
] |
a62b13cbf4824c05cc791034ffedf419242ba0cb
|
https://github.com/mysql-workbench-schema-exporter/doctrine2-exporter/blob/a62b13cbf4824c05cc791034ffedf419242ba0cb/lib/MwbExporter/Formatter/Doctrine2/Formatter.php#L179-L197
|
221,316
|
oleh-ozimok/php-centrifugo
|
src/Centrifugo/BatchResponse.php
|
BatchResponse.addResponse
|
public function addResponse($key, array $response)
{
$originalRequest = isset($this->request[$key]) ? $this->request[$key] : null;
$responseBody = isset($response['body']) ? $response['body'] : null;
$responseError = isset($response['error']) ? $response['error'] : null;
$responseMethod = isset($response['method']) ? $response['method'] : null;
$this->responses[$key] = new Response($originalRequest, $responseBody, $responseError, $responseMethod);
}
|
php
|
public function addResponse($key, array $response)
{
$originalRequest = isset($this->request[$key]) ? $this->request[$key] : null;
$responseBody = isset($response['body']) ? $response['body'] : null;
$responseError = isset($response['error']) ? $response['error'] : null;
$responseMethod = isset($response['method']) ? $response['method'] : null;
$this->responses[$key] = new Response($originalRequest, $responseBody, $responseError, $responseMethod);
}
|
[
"public",
"function",
"addResponse",
"(",
"$",
"key",
",",
"array",
"$",
"response",
")",
"{",
"$",
"originalRequest",
"=",
"isset",
"(",
"$",
"this",
"->",
"request",
"[",
"$",
"key",
"]",
")",
"?",
"$",
"this",
"->",
"request",
"[",
"$",
"key",
"]",
":",
"null",
";",
"$",
"responseBody",
"=",
"isset",
"(",
"$",
"response",
"[",
"'body'",
"]",
")",
"?",
"$",
"response",
"[",
"'body'",
"]",
":",
"null",
";",
"$",
"responseError",
"=",
"isset",
"(",
"$",
"response",
"[",
"'error'",
"]",
")",
"?",
"$",
"response",
"[",
"'error'",
"]",
":",
"null",
";",
"$",
"responseMethod",
"=",
"isset",
"(",
"$",
"response",
"[",
"'method'",
"]",
")",
"?",
"$",
"response",
"[",
"'method'",
"]",
":",
"null",
";",
"$",
"this",
"->",
"responses",
"[",
"$",
"key",
"]",
"=",
"new",
"Response",
"(",
"$",
"originalRequest",
",",
"$",
"responseBody",
",",
"$",
"responseError",
",",
"$",
"responseMethod",
")",
";",
"}"
] |
Add a response to the list.
@param int $key
@param array|null $response
|
[
"Add",
"a",
"response",
"to",
"the",
"list",
"."
] |
f90490407474b7f0274f339728f9b0b0e264e09d
|
https://github.com/oleh-ozimok/php-centrifugo/blob/f90490407474b7f0274f339728f9b0b0e264e09d/src/Centrifugo/BatchResponse.php#L50-L58
|
221,317
|
webcreate/vcs
|
src/Webcreate/Vcs/Svn/Svnadmin.php
|
Svnadmin.destroy
|
public function destroy($name)
{
$path = $this->getReposDir($name);
if (!is_dir($path)) {
throw new \InvalidArgumentException(sprintf('Repository path %s does not exists', $path));
}
$filesystem = new Filesystem();
$filesystem->remove($path);
}
|
php
|
public function destroy($name)
{
$path = $this->getReposDir($name);
if (!is_dir($path)) {
throw new \InvalidArgumentException(sprintf('Repository path %s does not exists', $path));
}
$filesystem = new Filesystem();
$filesystem->remove($path);
}
|
[
"public",
"function",
"destroy",
"(",
"$",
"name",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"getReposDir",
"(",
"$",
"name",
")",
";",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"path",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'Repository path %s does not exists'",
",",
"$",
"path",
")",
")",
";",
"}",
"$",
"filesystem",
"=",
"new",
"Filesystem",
"(",
")",
";",
"$",
"filesystem",
"->",
"remove",
"(",
"$",
"path",
")",
";",
"}"
] |
Destroys a specific repository
@param string $name
@throws \InvalidArgumentException
|
[
"Destroys",
"a",
"specific",
"repository"
] |
31a680f2501c4e5a599e8dd3ffbc8c0a5185c8ad
|
https://github.com/webcreate/vcs/blob/31a680f2501c4e5a599e8dd3ffbc8c0a5185c8ad/src/Webcreate/Vcs/Svn/Svnadmin.php#L75-L85
|
221,318
|
webcreate/vcs
|
src/Webcreate/Vcs/Svn/Svnadmin.php
|
Svnadmin.svnconf
|
public function svnconf($name, $svnserveFile)
{
$filesystem = new Filesystem();
$filesystem->rename($this->getReposDir($name) . '/conf/svnserve.conf', $this->getReposDir($name) . '/conf/svnserve.conf~');
$filesystem->symlink($svnserveFile, $this->getReposDir($name) . '/conf/svnserve.conf');
}
|
php
|
public function svnconf($name, $svnserveFile)
{
$filesystem = new Filesystem();
$filesystem->rename($this->getReposDir($name) . '/conf/svnserve.conf', $this->getReposDir($name) . '/conf/svnserve.conf~');
$filesystem->symlink($svnserveFile, $this->getReposDir($name) . '/conf/svnserve.conf');
}
|
[
"public",
"function",
"svnconf",
"(",
"$",
"name",
",",
"$",
"svnserveFile",
")",
"{",
"$",
"filesystem",
"=",
"new",
"Filesystem",
"(",
")",
";",
"$",
"filesystem",
"->",
"rename",
"(",
"$",
"this",
"->",
"getReposDir",
"(",
"$",
"name",
")",
".",
"'/conf/svnserve.conf'",
",",
"$",
"this",
"->",
"getReposDir",
"(",
"$",
"name",
")",
".",
"'/conf/svnserve.conf~'",
")",
";",
"$",
"filesystem",
"->",
"symlink",
"(",
"$",
"svnserveFile",
",",
"$",
"this",
"->",
"getReposDir",
"(",
"$",
"name",
")",
".",
"'/conf/svnserve.conf'",
")",
";",
"}"
] |
Creates a backup of svnserve.conf and links
a global svnserve.conf in the repository
@param string $name name of the repository
@param string $svnserveFile full path to the global svnserve.conf
@throws ProcessFailedException
@throws \RuntimeException
|
[
"Creates",
"a",
"backup",
"of",
"svnserve",
".",
"conf",
"and",
"links",
"a",
"global",
"svnserve",
".",
"conf",
"in",
"the",
"repository"
] |
31a680f2501c4e5a599e8dd3ffbc8c0a5185c8ad
|
https://github.com/webcreate/vcs/blob/31a680f2501c4e5a599e8dd3ffbc8c0a5185c8ad/src/Webcreate/Vcs/Svn/Svnadmin.php#L96-L101
|
221,319
|
webcreate/vcs
|
src/Webcreate/Vcs/Svn/Svnadmin.php
|
Svnadmin.exec
|
protected function exec($command, array $arguments = array())
{
$command = $this->bin . ' ' . $command;
$commandline = $this->cli->prepare($command, $arguments);
if ($this->cli->execute($commandline) <> 0) {
throw new ProcessFailedException($this->cli->getProcess());
} elseif ($message = $this->cli->getErrorOutput()) {
throw new \RuntimeException($message);
}
return $this->cli->getOutput();
}
|
php
|
protected function exec($command, array $arguments = array())
{
$command = $this->bin . ' ' . $command;
$commandline = $this->cli->prepare($command, $arguments);
if ($this->cli->execute($commandline) <> 0) {
throw new ProcessFailedException($this->cli->getProcess());
} elseif ($message = $this->cli->getErrorOutput()) {
throw new \RuntimeException($message);
}
return $this->cli->getOutput();
}
|
[
"protected",
"function",
"exec",
"(",
"$",
"command",
",",
"array",
"$",
"arguments",
"=",
"array",
"(",
")",
")",
"{",
"$",
"command",
"=",
"$",
"this",
"->",
"bin",
".",
"' '",
".",
"$",
"command",
";",
"$",
"commandline",
"=",
"$",
"this",
"->",
"cli",
"->",
"prepare",
"(",
"$",
"command",
",",
"$",
"arguments",
")",
";",
"if",
"(",
"$",
"this",
"->",
"cli",
"->",
"execute",
"(",
"$",
"commandline",
")",
"<>",
"0",
")",
"{",
"throw",
"new",
"ProcessFailedException",
"(",
"$",
"this",
"->",
"cli",
"->",
"getProcess",
"(",
")",
")",
";",
"}",
"elseif",
"(",
"$",
"message",
"=",
"$",
"this",
"->",
"cli",
"->",
"getErrorOutput",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"$",
"message",
")",
";",
"}",
"return",
"$",
"this",
"->",
"cli",
"->",
"getOutput",
"(",
")",
";",
"}"
] |
Executes a svnadmin command
@param string $command
@param array $arguments
@throws ProcessFailedException
@throws \RuntimeException
@return string
|
[
"Executes",
"a",
"svnadmin",
"command"
] |
31a680f2501c4e5a599e8dd3ffbc8c0a5185c8ad
|
https://github.com/webcreate/vcs/blob/31a680f2501c4e5a599e8dd3ffbc8c0a5185c8ad/src/Webcreate/Vcs/Svn/Svnadmin.php#L123-L136
|
221,320
|
Fritak/messenger-platform
|
MessengerPlatform.php
|
MessengerPlatform.sendMessage
|
public function sendMessage($recipient, $textMessage, $notificationType = MessageSend::NOTIFICATION_TYPE_REGULAR)
{
$message = new MessageSend($recipient, $textMessage, $notificationType);
return $this->gate->request(Gate::URL_MESSAGES, $message->getDataForCall());
}
|
php
|
public function sendMessage($recipient, $textMessage, $notificationType = MessageSend::NOTIFICATION_TYPE_REGULAR)
{
$message = new MessageSend($recipient, $textMessage, $notificationType);
return $this->gate->request(Gate::URL_MESSAGES, $message->getDataForCall());
}
|
[
"public",
"function",
"sendMessage",
"(",
"$",
"recipient",
",",
"$",
"textMessage",
",",
"$",
"notificationType",
"=",
"MessageSend",
"::",
"NOTIFICATION_TYPE_REGULAR",
")",
"{",
"$",
"message",
"=",
"new",
"MessageSend",
"(",
"$",
"recipient",
",",
"$",
"textMessage",
",",
"$",
"notificationType",
")",
";",
"return",
"$",
"this",
"->",
"gate",
"->",
"request",
"(",
"Gate",
"::",
"URL_MESSAGES",
",",
"$",
"message",
"->",
"getDataForCall",
"(",
")",
")",
";",
"}"
] |
Send a simple text message.
@param int $recipient This must be either:
<ul>
<li>an id that was retrieved through the Messenger entry points or through the Messenger callbacks</li>
<li>or instance of fritak\MessengerPlatform\UserRecipient</li>
</ul>
@param string $textMessage Text.
@param string $notificationType One of 3 types of notification, use constants (eg. NOTIFICATION_TYPE_REGULAR)
@return fritak\MessengerPlatform\Response
@see https://developers.facebook.com/docs/messenger-platform/send-api-reference#guidelines
|
[
"Send",
"a",
"simple",
"text",
"message",
"."
] |
689c56636036101240598d55322df974da069a22
|
https://github.com/Fritak/messenger-platform/blob/689c56636036101240598d55322df974da069a22/MessengerPlatform.php#L71-L76
|
221,321
|
Fritak/messenger-platform
|
MessengerPlatform.php
|
MessengerPlatform.sendButton
|
public function sendButton($recipient, $text, $buttons, $notificationType = MessageSend::NOTIFICATION_TYPE_REGULAR)
{
$structuredMessage = new StructuredMessage($recipient,
['text' => $text, 'buttons' => $buttons],
$notificationType,
StructuredMessage::ATTACHMENT_TYPE_TEMPLATE,
StructuredMessage::TEMPLATE_PAYLOAD_TYPE_BUTTON);
return $this->gate->request(Gate::URL_MESSAGES, $structuredMessage->getDataForCall());
}
|
php
|
public function sendButton($recipient, $text, $buttons, $notificationType = MessageSend::NOTIFICATION_TYPE_REGULAR)
{
$structuredMessage = new StructuredMessage($recipient,
['text' => $text, 'buttons' => $buttons],
$notificationType,
StructuredMessage::ATTACHMENT_TYPE_TEMPLATE,
StructuredMessage::TEMPLATE_PAYLOAD_TYPE_BUTTON);
return $this->gate->request(Gate::URL_MESSAGES, $structuredMessage->getDataForCall());
}
|
[
"public",
"function",
"sendButton",
"(",
"$",
"recipient",
",",
"$",
"text",
",",
"$",
"buttons",
",",
"$",
"notificationType",
"=",
"MessageSend",
"::",
"NOTIFICATION_TYPE_REGULAR",
")",
"{",
"$",
"structuredMessage",
"=",
"new",
"StructuredMessage",
"(",
"$",
"recipient",
",",
"[",
"'text'",
"=>",
"$",
"text",
",",
"'buttons'",
"=>",
"$",
"buttons",
"]",
",",
"$",
"notificationType",
",",
"StructuredMessage",
"::",
"ATTACHMENT_TYPE_TEMPLATE",
",",
"StructuredMessage",
"::",
"TEMPLATE_PAYLOAD_TYPE_BUTTON",
")",
";",
"return",
"$",
"this",
"->",
"gate",
"->",
"request",
"(",
"Gate",
"::",
"URL_MESSAGES",
",",
"$",
"structuredMessage",
"->",
"getDataForCall",
"(",
")",
")",
";",
"}"
] |
Send a structured Message - button template.
@param int $recipient This must be either:
<ul>
<li>an id that was retrieved through the Messenger entry points or through the Messenger callbacks</li>
<li>or instance of fritak\MessengerPlatform\UserRecipient</li>
</ul>
@param string $text Text.
@param array $buttons Array of fritak\MessengerPlatform\Button.
@param string $notificationType One of 3 types of notification, use constants (eg. NOTIFICATION_TYPE_REGULAR)
@return fritak\MessengerPlatform\Response
@see https://developers.facebook.com/docs/messenger-platform/send-api-reference#guidelines
|
[
"Send",
"a",
"structured",
"Message",
"-",
"button",
"template",
"."
] |
689c56636036101240598d55322df974da069a22
|
https://github.com/Fritak/messenger-platform/blob/689c56636036101240598d55322df974da069a22/MessengerPlatform.php#L118-L127
|
221,322
|
Fritak/messenger-platform
|
MessengerPlatform.php
|
MessengerPlatform.sendReceipt
|
public function sendReceipt($recipient, Receipt $receipt, $notificationType = MessageSend::NOTIFICATION_TYPE_REGULAR)
{
$structuredMessage = new StructuredMessage($recipient,
$receipt,
$notificationType,
StructuredMessage::ATTACHMENT_TYPE_TEMPLATE,
StructuredMessage::TEMPLATE_PAYLOAD_TYPE_RECEIPT);
return $this->gate->request(Gate::URL_MESSAGES, $structuredMessage->getDataForCall());
}
|
php
|
public function sendReceipt($recipient, Receipt $receipt, $notificationType = MessageSend::NOTIFICATION_TYPE_REGULAR)
{
$structuredMessage = new StructuredMessage($recipient,
$receipt,
$notificationType,
StructuredMessage::ATTACHMENT_TYPE_TEMPLATE,
StructuredMessage::TEMPLATE_PAYLOAD_TYPE_RECEIPT);
return $this->gate->request(Gate::URL_MESSAGES, $structuredMessage->getDataForCall());
}
|
[
"public",
"function",
"sendReceipt",
"(",
"$",
"recipient",
",",
"Receipt",
"$",
"receipt",
",",
"$",
"notificationType",
"=",
"MessageSend",
"::",
"NOTIFICATION_TYPE_REGULAR",
")",
"{",
"$",
"structuredMessage",
"=",
"new",
"StructuredMessage",
"(",
"$",
"recipient",
",",
"$",
"receipt",
",",
"$",
"notificationType",
",",
"StructuredMessage",
"::",
"ATTACHMENT_TYPE_TEMPLATE",
",",
"StructuredMessage",
"::",
"TEMPLATE_PAYLOAD_TYPE_RECEIPT",
")",
";",
"return",
"$",
"this",
"->",
"gate",
"->",
"request",
"(",
"Gate",
"::",
"URL_MESSAGES",
",",
"$",
"structuredMessage",
"->",
"getDataForCall",
"(",
")",
")",
";",
"}"
] |
Send a structured Message - receipt template.
@param int $recipient This must be either:
<ul>
<li>an id that was retrieved through the Messenger entry points or through the Messenger callbacks</li>
<li>or instance of fritak\MessengerPlatform\UserRecipient</li>
</ul>
@param Receipt $receipt
@param string $notificationType One of 3 types of notification, use constants (eg. NOTIFICATION_TYPE_REGULAR)
@return fritak\MessengerPlatform\Response
@see https://developers.facebook.com/docs/messenger-platform/send-api-reference#guidelines
|
[
"Send",
"a",
"structured",
"Message",
"-",
"receipt",
"template",
"."
] |
689c56636036101240598d55322df974da069a22
|
https://github.com/Fritak/messenger-platform/blob/689c56636036101240598d55322df974da069a22/MessengerPlatform.php#L142-L151
|
221,323
|
mysql-workbench-schema-exporter/doctrine2-exporter
|
lib/MwbExporter/Formatter/Doctrine2/Model/Column.php
|
Column.isNullableRequired
|
public function isNullableRequired($defaultValue = self::NULLABLE_DEFAULT)
{
$isNullable = !$this->isNotNull();
return $isNullable === $defaultValue ? ($this->isAlwaysNullable() ? true : false) : true;
}
|
php
|
public function isNullableRequired($defaultValue = self::NULLABLE_DEFAULT)
{
$isNullable = !$this->isNotNull();
return $isNullable === $defaultValue ? ($this->isAlwaysNullable() ? true : false) : true;
}
|
[
"public",
"function",
"isNullableRequired",
"(",
"$",
"defaultValue",
"=",
"self",
"::",
"NULLABLE_DEFAULT",
")",
"{",
"$",
"isNullable",
"=",
"!",
"$",
"this",
"->",
"isNotNull",
"(",
")",
";",
"return",
"$",
"isNullable",
"===",
"$",
"defaultValue",
"?",
"(",
"$",
"this",
"->",
"isAlwaysNullable",
"(",
")",
"?",
"true",
":",
"false",
")",
":",
"true",
";",
"}"
] |
Is nullable attribute required.
@return boolean
|
[
"Is",
"nullable",
"attribute",
"required",
"."
] |
a62b13cbf4824c05cc791034ffedf419242ba0cb
|
https://github.com/mysql-workbench-schema-exporter/doctrine2-exporter/blob/a62b13cbf4824c05cc791034ffedf419242ba0cb/lib/MwbExporter/Formatter/Doctrine2/Model/Column.php#L60-L65
|
221,324
|
mysql-workbench-schema-exporter/doctrine2-exporter
|
lib/MwbExporter/Formatter/Doctrine2/Model/Column.php
|
Column.getNullableValue
|
public function getNullableValue($defaultValue = self::NULLABLE_DEFAULT)
{
$isNullable = !$this->isNotNull();
return $isNullable === $defaultValue ? ($this->isAlwaysNullable() ? $isNullable : null) : $isNullable;
}
|
php
|
public function getNullableValue($defaultValue = self::NULLABLE_DEFAULT)
{
$isNullable = !$this->isNotNull();
return $isNullable === $defaultValue ? ($this->isAlwaysNullable() ? $isNullable : null) : $isNullable;
}
|
[
"public",
"function",
"getNullableValue",
"(",
"$",
"defaultValue",
"=",
"self",
"::",
"NULLABLE_DEFAULT",
")",
"{",
"$",
"isNullable",
"=",
"!",
"$",
"this",
"->",
"isNotNull",
"(",
")",
";",
"return",
"$",
"isNullable",
"===",
"$",
"defaultValue",
"?",
"(",
"$",
"this",
"->",
"isAlwaysNullable",
"(",
")",
"?",
"$",
"isNullable",
":",
"null",
")",
":",
"$",
"isNullable",
";",
"}"
] |
Get nullable attribute value.
@return boolean
|
[
"Get",
"nullable",
"attribute",
"value",
"."
] |
a62b13cbf4824c05cc791034ffedf419242ba0cb
|
https://github.com/mysql-workbench-schema-exporter/doctrine2-exporter/blob/a62b13cbf4824c05cc791034ffedf419242ba0cb/lib/MwbExporter/Formatter/Doctrine2/Model/Column.php#L72-L77
|
221,325
|
mysql-workbench-schema-exporter/doctrine2-exporter
|
lib/MwbExporter/Formatter/Doctrine2/Model/Column.php
|
Column.isIgnored
|
public function isIgnored()
{
// don't ignore primary key
if ($this->isPrimary) {
return false;
}
// don't ignore when configuration is not set
if (!$this->getConfig()->get(Formatter::CFG_SKIP_COLUMN_WITH_RELATION)) {
return false;
}
// don't ignore when column has no relation
if (0 === (count($this->getLocalForeignKeys()) + count($this->getForeignKeys()))) {
return false;
}
return true;
}
|
php
|
public function isIgnored()
{
// don't ignore primary key
if ($this->isPrimary) {
return false;
}
// don't ignore when configuration is not set
if (!$this->getConfig()->get(Formatter::CFG_SKIP_COLUMN_WITH_RELATION)) {
return false;
}
// don't ignore when column has no relation
if (0 === (count($this->getLocalForeignKeys()) + count($this->getForeignKeys()))) {
return false;
}
return true;
}
|
[
"public",
"function",
"isIgnored",
"(",
")",
"{",
"// don't ignore primary key",
"if",
"(",
"$",
"this",
"->",
"isPrimary",
")",
"{",
"return",
"false",
";",
"}",
"// don't ignore when configuration is not set",
"if",
"(",
"!",
"$",
"this",
"->",
"getConfig",
"(",
")",
"->",
"get",
"(",
"Formatter",
"::",
"CFG_SKIP_COLUMN_WITH_RELATION",
")",
")",
"{",
"return",
"false",
";",
"}",
"// don't ignore when column has no relation",
"if",
"(",
"0",
"===",
"(",
"count",
"(",
"$",
"this",
"->",
"getLocalForeignKeys",
"(",
")",
")",
"+",
"count",
"(",
"$",
"this",
"->",
"getForeignKeys",
"(",
")",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] |
Check if column is ignored.
@return boolean
|
[
"Check",
"if",
"column",
"is",
"ignored",
"."
] |
a62b13cbf4824c05cc791034ffedf419242ba0cb
|
https://github.com/mysql-workbench-schema-exporter/doctrine2-exporter/blob/a62b13cbf4824c05cc791034ffedf419242ba0cb/lib/MwbExporter/Formatter/Doctrine2/Model/Column.php#L84-L100
|
221,326
|
mysql-workbench-schema-exporter/doctrine2-exporter
|
lib/MwbExporter/Formatter/Doctrine2/Model/Column.php
|
Column.isBoolean
|
public function isBoolean()
{
$columnType = $this->getColumnType();
if (
DatatypeConverterInterface::USERDATATYPE_BOOL == $columnType ||
DatatypeConverterInterface::USERDATATYPE_BOOLEAN == $columnType ||
(
DatatypeConverterInterface::DATATYPE_TINYINT == $columnType &&
preg_match('/^(is|has|can)_/', $this->getColumnName())
)
) {
return true;
}
return false;
}
|
php
|
public function isBoolean()
{
$columnType = $this->getColumnType();
if (
DatatypeConverterInterface::USERDATATYPE_BOOL == $columnType ||
DatatypeConverterInterface::USERDATATYPE_BOOLEAN == $columnType ||
(
DatatypeConverterInterface::DATATYPE_TINYINT == $columnType &&
preg_match('/^(is|has|can)_/', $this->getColumnName())
)
) {
return true;
}
return false;
}
|
[
"public",
"function",
"isBoolean",
"(",
")",
"{",
"$",
"columnType",
"=",
"$",
"this",
"->",
"getColumnType",
"(",
")",
";",
"if",
"(",
"DatatypeConverterInterface",
"::",
"USERDATATYPE_BOOL",
"==",
"$",
"columnType",
"||",
"DatatypeConverterInterface",
"::",
"USERDATATYPE_BOOLEAN",
"==",
"$",
"columnType",
"||",
"(",
"DatatypeConverterInterface",
"::",
"DATATYPE_TINYINT",
"==",
"$",
"columnType",
"&&",
"preg_match",
"(",
"'/^(is|has|can)_/'",
",",
"$",
"this",
"->",
"getColumnName",
"(",
")",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] |
Check If column is boolean.
@return boolean
|
[
"Check",
"If",
"column",
"is",
"boolean",
"."
] |
a62b13cbf4824c05cc791034ffedf419242ba0cb
|
https://github.com/mysql-workbench-schema-exporter/doctrine2-exporter/blob/a62b13cbf4824c05cc791034ffedf419242ba0cb/lib/MwbExporter/Formatter/Doctrine2/Model/Column.php#L107-L123
|
221,327
|
webcreate/vcs
|
src/Webcreate/Vcs/Git/AbstractGit.php
|
AbstractGit.setCwd
|
public function setCwd($cwd)
{
$this->hasCheckout = false;
$this->hasClone = false;
$this->isTemporary = false;
if (is_null($cwd)) {
$this->cwd = sys_get_temp_dir() . '/' . uniqid('git');
// ensure the working directory exists (needed on windows)
if (!is_dir($this->cwd)) {
mkdir($this->cwd);
}
$this->isTemporary = true;
} else {
if (is_dir($cwd)) {
if (is_dir($cwd . '/.git')) {
$this->hasClone = true;
}
}
$this->cwd = $cwd;
}
return $this;
}
|
php
|
public function setCwd($cwd)
{
$this->hasCheckout = false;
$this->hasClone = false;
$this->isTemporary = false;
if (is_null($cwd)) {
$this->cwd = sys_get_temp_dir() . '/' . uniqid('git');
// ensure the working directory exists (needed on windows)
if (!is_dir($this->cwd)) {
mkdir($this->cwd);
}
$this->isTemporary = true;
} else {
if (is_dir($cwd)) {
if (is_dir($cwd . '/.git')) {
$this->hasClone = true;
}
}
$this->cwd = $cwd;
}
return $this;
}
|
[
"public",
"function",
"setCwd",
"(",
"$",
"cwd",
")",
"{",
"$",
"this",
"->",
"hasCheckout",
"=",
"false",
";",
"$",
"this",
"->",
"hasClone",
"=",
"false",
";",
"$",
"this",
"->",
"isTemporary",
"=",
"false",
";",
"if",
"(",
"is_null",
"(",
"$",
"cwd",
")",
")",
"{",
"$",
"this",
"->",
"cwd",
"=",
"sys_get_temp_dir",
"(",
")",
".",
"'/'",
".",
"uniqid",
"(",
"'git'",
")",
";",
"// ensure the working directory exists (needed on windows)",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"this",
"->",
"cwd",
")",
")",
"{",
"mkdir",
"(",
"$",
"this",
"->",
"cwd",
")",
";",
"}",
"$",
"this",
"->",
"isTemporary",
"=",
"true",
";",
"}",
"else",
"{",
"if",
"(",
"is_dir",
"(",
"$",
"cwd",
")",
")",
"{",
"if",
"(",
"is_dir",
"(",
"$",
"cwd",
".",
"'/.git'",
")",
")",
"{",
"$",
"this",
"->",
"hasClone",
"=",
"true",
";",
"}",
"}",
"$",
"this",
"->",
"cwd",
"=",
"$",
"cwd",
";",
"}",
"return",
"$",
"this",
";",
"}"
] |
Sets the current working directory
@param string $cwd
@return \Webcreate\Vcs\Git\AbstractGit
|
[
"Sets",
"the",
"current",
"working",
"directory"
] |
31a680f2501c4e5a599e8dd3ffbc8c0a5185c8ad
|
https://github.com/webcreate/vcs/blob/31a680f2501c4e5a599e8dd3ffbc8c0a5185c8ad/src/Webcreate/Vcs/Git/AbstractGit.php#L81-L106
|
221,328
|
webcreate/vcs
|
src/Webcreate/Vcs/Git/AbstractGit.php
|
AbstractGit.execute
|
protected function execute($command, array $arguments = array(), $cwd = null)
{
if (null === $cwd) {
$cwd = $this->cwd;
}
return $this->adapter->execute($command, $arguments, $cwd);
}
|
php
|
protected function execute($command, array $arguments = array(), $cwd = null)
{
if (null === $cwd) {
$cwd = $this->cwd;
}
return $this->adapter->execute($command, $arguments, $cwd);
}
|
[
"protected",
"function",
"execute",
"(",
"$",
"command",
",",
"array",
"$",
"arguments",
"=",
"array",
"(",
")",
",",
"$",
"cwd",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"cwd",
")",
"{",
"$",
"cwd",
"=",
"$",
"this",
"->",
"cwd",
";",
"}",
"return",
"$",
"this",
"->",
"adapter",
"->",
"execute",
"(",
"$",
"command",
",",
"$",
"arguments",
",",
"$",
"cwd",
")",
";",
"}"
] |
Execute GIT command
@param string $command
@param array $arguments
@param string|null $cwd
@return string
|
[
"Execute",
"GIT",
"command"
] |
31a680f2501c4e5a599e8dd3ffbc8c0a5185c8ad
|
https://github.com/webcreate/vcs/blob/31a680f2501c4e5a599e8dd3ffbc8c0a5185c8ad/src/Webcreate/Vcs/Git/AbstractGit.php#L125-L132
|
221,329
|
rubellum/Slim-Blade-View
|
src/Blade.php
|
Blade.get
|
public function get($key)
{
if (!isset($this->attributes[$key])) {
return false;
}
return $this->attributes[$key];
}
|
php
|
public function get($key)
{
if (!isset($this->attributes[$key])) {
return false;
}
return $this->attributes[$key];
}
|
[
"public",
"function",
"get",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"attributes",
"[",
"$",
"key",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->",
"attributes",
"[",
"$",
"key",
"]",
";",
"}"
] |
Retrieve an attribute
@param $key
@return mixed
|
[
"Retrieve",
"an",
"attribute"
] |
956f791a0d0c9d99dbb10de043989b11f452a7e6
|
https://github.com/rubellum/Slim-Blade-View/blob/956f791a0d0c9d99dbb10de043989b11f452a7e6/src/Blade.php#L108-L115
|
221,330
|
rubellum/Slim-Blade-View
|
src/Blade.php
|
Blade.fetch
|
public function fetch($template, array $data = [])
{
if (isset($data['template'])) {
throw new \InvalidArgumentException("Duplicate template key found");
}
$data = array_merge($this->attributes, $data);
$renderer = new \Philo\Blade\Blade($this->viewPaths, $this->cachePath, $this->events);
return $renderer->view()->make($template, $data)->render();
}
|
php
|
public function fetch($template, array $data = [])
{
if (isset($data['template'])) {
throw new \InvalidArgumentException("Duplicate template key found");
}
$data = array_merge($this->attributes, $data);
$renderer = new \Philo\Blade\Blade($this->viewPaths, $this->cachePath, $this->events);
return $renderer->view()->make($template, $data)->render();
}
|
[
"public",
"function",
"fetch",
"(",
"$",
"template",
",",
"array",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"data",
"[",
"'template'",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\"Duplicate template key found\"",
")",
";",
"}",
"$",
"data",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"attributes",
",",
"$",
"data",
")",
";",
"$",
"renderer",
"=",
"new",
"\\",
"Philo",
"\\",
"Blade",
"\\",
"Blade",
"(",
"$",
"this",
"->",
"viewPaths",
",",
"$",
"this",
"->",
"cachePath",
",",
"$",
"this",
"->",
"events",
")",
";",
"return",
"$",
"renderer",
"->",
"view",
"(",
")",
"->",
"make",
"(",
"$",
"template",
",",
"$",
"data",
")",
"->",
"render",
"(",
")",
";",
"}"
] |
Renders a template and returns the result as a string
cannot contain template as a key
throws RuntimeException if $templatePath . $template does not exist
@param $template
@param array $data
@return mixed
@throws \InvalidArgumentException
@throws \RuntimeException
|
[
"Renders",
"a",
"template",
"and",
"returns",
"the",
"result",
"as",
"a",
"string"
] |
956f791a0d0c9d99dbb10de043989b11f452a7e6
|
https://github.com/rubellum/Slim-Blade-View/blob/956f791a0d0c9d99dbb10de043989b11f452a7e6/src/Blade.php#L164-L174
|
221,331
|
mdmsoft/yii2-ar-behaviors
|
ExtendedBehavior.php
|
ExtendedBehavior.afterSave
|
public function afterSave($event)
{
foreach ($this->relationKey as $from => $to) {
$this->_relation[$to] = $this->owner[$from];
}
$this->_relation->save();
}
|
php
|
public function afterSave($event)
{
foreach ($this->relationKey as $from => $to) {
$this->_relation[$to] = $this->owner[$from];
}
$this->_relation->save();
}
|
[
"public",
"function",
"afterSave",
"(",
"$",
"event",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"relationKey",
"as",
"$",
"from",
"=>",
"$",
"to",
")",
"{",
"$",
"this",
"->",
"_relation",
"[",
"$",
"to",
"]",
"=",
"$",
"this",
"->",
"owner",
"[",
"$",
"from",
"]",
";",
"}",
"$",
"this",
"->",
"_relation",
"->",
"save",
"(",
")",
";",
"}"
] |
Execute after model saved
@param \yii\base\Event $event
|
[
"Execute",
"after",
"model",
"saved"
] |
16985ebe3fdf9cd67b0c58900adccbe816c16dc3
|
https://github.com/mdmsoft/yii2-ar-behaviors/blob/16985ebe3fdf9cd67b0c58900adccbe816c16dc3/ExtendedBehavior.php#L148-L154
|
221,332
|
webcreate/vcs
|
src/Webcreate/Vcs/Common/AbstractClient.php
|
AbstractClient.setAdapter
|
public function setAdapter(AdapterInterface $adapter)
{
$adapter->setClient($this);
$this->adapter = $adapter;
return $this;
}
|
php
|
public function setAdapter(AdapterInterface $adapter)
{
$adapter->setClient($this);
$this->adapter = $adapter;
return $this;
}
|
[
"public",
"function",
"setAdapter",
"(",
"AdapterInterface",
"$",
"adapter",
")",
"{",
"$",
"adapter",
"->",
"setClient",
"(",
"$",
"this",
")",
";",
"$",
"this",
"->",
"adapter",
"=",
"$",
"adapter",
";",
"return",
"$",
"this",
";",
"}"
] |
Sets the adapter
@param AdapterInterface $adapter
@return \Webcreate\Vcs\Common\AbstractClient
|
[
"Sets",
"the",
"adapter"
] |
31a680f2501c4e5a599e8dd3ffbc8c0a5185c8ad
|
https://github.com/webcreate/vcs/blob/31a680f2501c4e5a599e8dd3ffbc8c0a5185c8ad/src/Webcreate/Vcs/Common/AbstractClient.php#L65-L72
|
221,333
|
webcreate/vcs
|
src/Webcreate/Vcs/Common/AbstractClient.php
|
AbstractClient.dispatch
|
public function dispatch($eventName, $data = null)
{
if (!interface_exists('Symfony\Component\EventDispatcher\EventDispatcherInterface')) {
return;
}
if (null === $this->dispatcher) {
return;
}
$event = new VcsEvent($data);
$this->dispatcher->dispatch($eventName, $event);
}
|
php
|
public function dispatch($eventName, $data = null)
{
if (!interface_exists('Symfony\Component\EventDispatcher\EventDispatcherInterface')) {
return;
}
if (null === $this->dispatcher) {
return;
}
$event = new VcsEvent($data);
$this->dispatcher->dispatch($eventName, $event);
}
|
[
"public",
"function",
"dispatch",
"(",
"$",
"eventName",
",",
"$",
"data",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"interface_exists",
"(",
"'Symfony\\Component\\EventDispatcher\\EventDispatcherInterface'",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"dispatcher",
")",
"{",
"return",
";",
"}",
"$",
"event",
"=",
"new",
"VcsEvent",
"(",
"$",
"data",
")",
";",
"$",
"this",
"->",
"dispatcher",
"->",
"dispatch",
"(",
"$",
"eventName",
",",
"$",
"event",
")",
";",
"}"
] |
Dispatches an event if the event dispatcher is available
@param string $eventName
@param mixed $data
|
[
"Dispatches",
"an",
"event",
"if",
"the",
"event",
"dispatcher",
"is",
"available"
] |
31a680f2501c4e5a599e8dd3ffbc8c0a5185c8ad
|
https://github.com/webcreate/vcs/blob/31a680f2501c4e5a599e8dd3ffbc8c0a5185c8ad/src/Webcreate/Vcs/Common/AbstractClient.php#L157-L170
|
221,334
|
ekapusta/oauth2-esia
|
src/Security/Signer/OpensslCli.php
|
OpensslCli.run
|
private function run($command, $input)
{
$process = proc_open($command, [
['pipe', 'r'], // stdin
['pipe', 'w'], // stdout
['pipe', 'w'], // stderr
], $pipes);
fwrite($pipes[0], $input);
fclose($pipes[0]);
$result = stream_get_contents($pipes[1]);
fclose($pipes[1]);
$errors = stream_get_contents($pipes[2]);
fclose($pipes[2]);
$code = proc_close($process);
if (0 != $code) {
$errors = trim($errors) ?: 'unknown';
throw SignException::signFailedAsOf($errors, $code);
}
return $result;
}
|
php
|
private function run($command, $input)
{
$process = proc_open($command, [
['pipe', 'r'], // stdin
['pipe', 'w'], // stdout
['pipe', 'w'], // stderr
], $pipes);
fwrite($pipes[0], $input);
fclose($pipes[0]);
$result = stream_get_contents($pipes[1]);
fclose($pipes[1]);
$errors = stream_get_contents($pipes[2]);
fclose($pipes[2]);
$code = proc_close($process);
if (0 != $code) {
$errors = trim($errors) ?: 'unknown';
throw SignException::signFailedAsOf($errors, $code);
}
return $result;
}
|
[
"private",
"function",
"run",
"(",
"$",
"command",
",",
"$",
"input",
")",
"{",
"$",
"process",
"=",
"proc_open",
"(",
"$",
"command",
",",
"[",
"[",
"'pipe'",
",",
"'r'",
"]",
",",
"// stdin",
"[",
"'pipe'",
",",
"'w'",
"]",
",",
"// stdout",
"[",
"'pipe'",
",",
"'w'",
"]",
",",
"// stderr",
"]",
",",
"$",
"pipes",
")",
";",
"fwrite",
"(",
"$",
"pipes",
"[",
"0",
"]",
",",
"$",
"input",
")",
";",
"fclose",
"(",
"$",
"pipes",
"[",
"0",
"]",
")",
";",
"$",
"result",
"=",
"stream_get_contents",
"(",
"$",
"pipes",
"[",
"1",
"]",
")",
";",
"fclose",
"(",
"$",
"pipes",
"[",
"1",
"]",
")",
";",
"$",
"errors",
"=",
"stream_get_contents",
"(",
"$",
"pipes",
"[",
"2",
"]",
")",
";",
"fclose",
"(",
"$",
"pipes",
"[",
"2",
"]",
")",
";",
"$",
"code",
"=",
"proc_close",
"(",
"$",
"process",
")",
";",
"if",
"(",
"0",
"!=",
"$",
"code",
")",
"{",
"$",
"errors",
"=",
"trim",
"(",
"$",
"errors",
")",
"?",
":",
"'unknown'",
";",
"throw",
"SignException",
"::",
"signFailedAsOf",
"(",
"$",
"errors",
",",
"$",
"code",
")",
";",
"}",
"return",
"$",
"result",
";",
"}"
] |
Runs command with input from STDIN.
|
[
"Runs",
"command",
"with",
"input",
"from",
"STDIN",
"."
] |
621bc6138e7045b71d4eaeed465421f977a89d0c
|
https://github.com/ekapusta/oauth2-esia/blob/621bc6138e7045b71d4eaeed465421f977a89d0c/src/Security/Signer/OpensslCli.php#L42-L67
|
221,335
|
Fritak/messenger-platform
|
source/Gate.php
|
Gate.prepareData
|
protected function prepareData($data)
{
if(!is_array($data))
{
$data = [];
}
$data['access_token'] = $this->config->accessToken;
return http_build_query($data);
}
|
php
|
protected function prepareData($data)
{
if(!is_array($data))
{
$data = [];
}
$data['access_token'] = $this->config->accessToken;
return http_build_query($data);
}
|
[
"protected",
"function",
"prepareData",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"}",
"$",
"data",
"[",
"'access_token'",
"]",
"=",
"$",
"this",
"->",
"config",
"->",
"accessToken",
";",
"return",
"http_build_query",
"(",
"$",
"data",
")",
";",
"}"
] |
Prepare data for request.
@param array $data
@return string
|
[
"Prepare",
"data",
"for",
"request",
"."
] |
689c56636036101240598d55322df974da069a22
|
https://github.com/Fritak/messenger-platform/blob/689c56636036101240598d55322df974da069a22/source/Gate.php#L88-L98
|
221,336
|
execut/yii2-robots-txt
|
Generator.php
|
Generator.render
|
public function render()
{
$result = "";
$params = [];
$params['Host'] = $this->host;
$siteMap = $this->sitemap;
if (is_array($siteMap)) {
$siteMap = Url::to($siteMap, true);
}
$params['Sitemap'] = $siteMap;
foreach (array_filter($params) as $key => $value) {
$result .= "$key: $value\n";
}
foreach ($this->userAgent as $userAgent => $value) {
$result .= "User-agent: $userAgent\n";
foreach ($value as $param => $urls) {
if (is_string($urls)) {
$urls = [$urls];
}
$isWithScheme = false;
if ($param == 'Sitemap') {
$urls = [$urls];
$isWithScheme = true;
}
foreach ($urls as $url) {
if (is_array($url)) {
$url = Url::to($url, $isWithScheme);
}
$result .= "$param: $url\n";
}
}
}
return $result;
}
|
php
|
public function render()
{
$result = "";
$params = [];
$params['Host'] = $this->host;
$siteMap = $this->sitemap;
if (is_array($siteMap)) {
$siteMap = Url::to($siteMap, true);
}
$params['Sitemap'] = $siteMap;
foreach (array_filter($params) as $key => $value) {
$result .= "$key: $value\n";
}
foreach ($this->userAgent as $userAgent => $value) {
$result .= "User-agent: $userAgent\n";
foreach ($value as $param => $urls) {
if (is_string($urls)) {
$urls = [$urls];
}
$isWithScheme = false;
if ($param == 'Sitemap') {
$urls = [$urls];
$isWithScheme = true;
}
foreach ($urls as $url) {
if (is_array($url)) {
$url = Url::to($url, $isWithScheme);
}
$result .= "$param: $url\n";
}
}
}
return $result;
}
|
[
"public",
"function",
"render",
"(",
")",
"{",
"$",
"result",
"=",
"\"\"",
";",
"$",
"params",
"=",
"[",
"]",
";",
"$",
"params",
"[",
"'Host'",
"]",
"=",
"$",
"this",
"->",
"host",
";",
"$",
"siteMap",
"=",
"$",
"this",
"->",
"sitemap",
";",
"if",
"(",
"is_array",
"(",
"$",
"siteMap",
")",
")",
"{",
"$",
"siteMap",
"=",
"Url",
"::",
"to",
"(",
"$",
"siteMap",
",",
"true",
")",
";",
"}",
"$",
"params",
"[",
"'Sitemap'",
"]",
"=",
"$",
"siteMap",
";",
"foreach",
"(",
"array_filter",
"(",
"$",
"params",
")",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"result",
".=",
"\"$key: $value\\n\"",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"userAgent",
"as",
"$",
"userAgent",
"=>",
"$",
"value",
")",
"{",
"$",
"result",
".=",
"\"User-agent: $userAgent\\n\"",
";",
"foreach",
"(",
"$",
"value",
"as",
"$",
"param",
"=>",
"$",
"urls",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"urls",
")",
")",
"{",
"$",
"urls",
"=",
"[",
"$",
"urls",
"]",
";",
"}",
"$",
"isWithScheme",
"=",
"false",
";",
"if",
"(",
"$",
"param",
"==",
"'Sitemap'",
")",
"{",
"$",
"urls",
"=",
"[",
"$",
"urls",
"]",
";",
"$",
"isWithScheme",
"=",
"true",
";",
"}",
"foreach",
"(",
"$",
"urls",
"as",
"$",
"url",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"url",
")",
")",
"{",
"$",
"url",
"=",
"Url",
"::",
"to",
"(",
"$",
"url",
",",
"$",
"isWithScheme",
")",
";",
"}",
"$",
"result",
".=",
"\"$param: $url\\n\"",
";",
"}",
"}",
"}",
"return",
"$",
"result",
";",
"}"
] |
render robots.txt
@return string
|
[
"render",
"robots",
".",
"txt"
] |
efcda9e8cf8fef75a94738eb4f07f3ac21ad4619
|
https://github.com/execut/yii2-robots-txt/blob/efcda9e8cf8fef75a94738eb4f07f3ac21ad4619/Generator.php#L43-L81
|
221,337
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/Wallet.php
|
Wallet.setGenerate
|
public function setGenerate($generate, $gen_proc_limit = -1)
{
$args = [
(bool)$generate,
(int)$gen_proc_limit
];
return null === $this->rpc->query(__FUNCTION__, $args);
}
|
php
|
public function setGenerate($generate, $gen_proc_limit = -1)
{
$args = [
(bool)$generate,
(int)$gen_proc_limit
];
return null === $this->rpc->query(__FUNCTION__, $args);
}
|
[
"public",
"function",
"setGenerate",
"(",
"$",
"generate",
",",
"$",
"gen_proc_limit",
"=",
"-",
"1",
")",
"{",
"$",
"args",
"=",
"[",
"(",
"bool",
")",
"$",
"generate",
",",
"(",
"int",
")",
"$",
"gen_proc_limit",
"]",
";",
"return",
"null",
"===",
"$",
"this",
"->",
"rpc",
"->",
"query",
"(",
"__FUNCTION__",
",",
"$",
"args",
")",
";",
"}"
] |
Sets whether the wallet should generate coins
Generation is limited to $gen_proc_limit processors, -1 is unlimited.
@param bool $generate Turn coin generation on (true) or off (false)
@param int $gen_proc_limit The processor limit, or -1 for unlimited
@return bool
|
[
"Sets",
"whether",
"the",
"wallet",
"should",
"generate",
"coins"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/Wallet.php#L256-L263
|
221,338
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/Wallet.php
|
Wallet.addNode
|
public function addNode($node, $type)
{
$args = [
(string)$node,
(string)$type
];
return null === $this->rpc->query(__FUNCTION__, $args);
}
|
php
|
public function addNode($node, $type)
{
$args = [
(string)$node,
(string)$type
];
return null === $this->rpc->query(__FUNCTION__, $args);
}
|
[
"public",
"function",
"addNode",
"(",
"$",
"node",
",",
"$",
"type",
")",
"{",
"$",
"args",
"=",
"[",
"(",
"string",
")",
"$",
"node",
",",
"(",
"string",
")",
"$",
"type",
"]",
";",
"return",
"null",
"===",
"$",
"this",
"->",
"rpc",
"->",
"query",
"(",
"__FUNCTION__",
",",
"$",
"args",
")",
";",
"}"
] |
Attempts add or remove a node from the addnode list or try a connection to it once
@param string $node The node ip address and port in <ip>:<port> format (see getPeerInfo() for nodes)
@param string $type Use "add" to add a node to the list, "remove" to remove a node from the list, "onetry" to try a connection to the node once
@return bool
|
[
"Attempts",
"add",
"or",
"remove",
"a",
"node",
"from",
"the",
"addnode",
"list",
"or",
"try",
"a",
"connection",
"to",
"it",
"once"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/Wallet.php#L272-L279
|
221,339
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/Wallet.php
|
Wallet.getNodeInfo
|
public function getNodeInfo($dns, $node = null)
{
// Can't pass null as the second arg. The arg must not exist.
$args = [
(bool)$dns
];
if (null !== $node) {
$args[] = (string)$node;
}
return $this->rpc->query("getAddedNodeInfo", $args);
}
|
php
|
public function getNodeInfo($dns, $node = null)
{
// Can't pass null as the second arg. The arg must not exist.
$args = [
(bool)$dns
];
if (null !== $node) {
$args[] = (string)$node;
}
return $this->rpc->query("getAddedNodeInfo", $args);
}
|
[
"public",
"function",
"getNodeInfo",
"(",
"$",
"dns",
",",
"$",
"node",
"=",
"null",
")",
"{",
"// Can't pass null as the second arg. The arg must not exist.",
"$",
"args",
"=",
"[",
"(",
"bool",
")",
"$",
"dns",
"]",
";",
"if",
"(",
"null",
"!==",
"$",
"node",
")",
"{",
"$",
"args",
"[",
"]",
"=",
"(",
"string",
")",
"$",
"node",
";",
"}",
"return",
"$",
"this",
"->",
"rpc",
"->",
"query",
"(",
"\"getAddedNodeInfo\"",
",",
"$",
"args",
")",
";",
"}"
] |
Returns information about the given added node, or all added nodes
If dns is false, only a list of added nodes will be provided, otherwise connected information will also
be available.
**Note:** Nodes added using the addnode configuration and "onetry" nodes are not returned.
When $dns is false, returns multidimensional array, with sub-arrays containing the keys:
```
"addednode" - (string) The node ip address and port in format <ip>:<port>.
```
When $dns is true, returns a mutlidimentional array, with the sub-arrays containing the keys:
```
"addednode" - (string) The node ip address and port in format <ip>:<port>.
"connected" - (boolean) If connected.
"addresses" - (array) Array of node peers. Each sub-array contains the keys:
"address" - (string) The node ip address and port in format <ip>:<port>.
"connected" - (bool) If connected.
```
@param bool $dns If false, only a list of added nodes will be provided, otherwise connected information will also be available
@param string $node If provided, return information about this specific node, otherwise all nodes are returned
@return array
|
[
"Returns",
"information",
"about",
"the",
"given",
"added",
"node",
"or",
"all",
"added",
"nodes"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/Wallet.php#L307-L317
|
221,340
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/Wallet.php
|
Wallet.signMessage
|
public function signMessage($address, $message)
{
$args = [
(string)$address,
(string)$message
];
return $this->rpc->query(__FUNCTION__, $args);
}
|
php
|
public function signMessage($address, $message)
{
$args = [
(string)$address,
(string)$message
];
return $this->rpc->query(__FUNCTION__, $args);
}
|
[
"public",
"function",
"signMessage",
"(",
"$",
"address",
",",
"$",
"message",
")",
"{",
"$",
"args",
"=",
"[",
"(",
"string",
")",
"$",
"address",
",",
"(",
"string",
")",
"$",
"message",
"]",
";",
"return",
"$",
"this",
"->",
"rpc",
"->",
"query",
"(",
"__FUNCTION__",
",",
"$",
"args",
")",
";",
"}"
] |
Sign a message with the private key of an address
@param string $address The coin address
@param string $message The message to sign
@return string
|
[
"Sign",
"a",
"message",
"with",
"the",
"private",
"key",
"of",
"an",
"address"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/Wallet.php#L326-L333
|
221,341
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/Wallet.php
|
Wallet.signRawTransaction
|
public function signRawTransaction($hex_data, array $prevtxs = [], array $priv_keys = [], $sighashtype = "ALL")
{
$args = [
(string)$hex_data,
!empty($prevtxs) ? $prevtxs : null,
!empty($priv_keys) ? $priv_keys : null,
(string)$sighashtype
];
return $this->rpc->query(__FUNCTION__, $args);
}
|
php
|
public function signRawTransaction($hex_data, array $prevtxs = [], array $priv_keys = [], $sighashtype = "ALL")
{
$args = [
(string)$hex_data,
!empty($prevtxs) ? $prevtxs : null,
!empty($priv_keys) ? $priv_keys : null,
(string)$sighashtype
];
return $this->rpc->query(__FUNCTION__, $args);
}
|
[
"public",
"function",
"signRawTransaction",
"(",
"$",
"hex_data",
",",
"array",
"$",
"prevtxs",
"=",
"[",
"]",
",",
"array",
"$",
"priv_keys",
"=",
"[",
"]",
",",
"$",
"sighashtype",
"=",
"\"ALL\"",
")",
"{",
"$",
"args",
"=",
"[",
"(",
"string",
")",
"$",
"hex_data",
",",
"!",
"empty",
"(",
"$",
"prevtxs",
")",
"?",
"$",
"prevtxs",
":",
"null",
",",
"!",
"empty",
"(",
"$",
"priv_keys",
")",
"?",
"$",
"priv_keys",
":",
"null",
",",
"(",
"string",
")",
"$",
"sighashtype",
"]",
";",
"return",
"$",
"this",
"->",
"rpc",
"->",
"query",
"(",
"__FUNCTION__",
",",
"$",
"args",
")",
";",
"}"
] |
Adds signatures to a raw transaction and returns the resulting raw transaction
If provided, the $prev_txs argument should be a multidimensional array, with the sub-arrays having the
following keys:
```
"txid" - (string) The transaction id.
"vout" - (int) The output number.
"scriptPubKey" - (string) The script key.
"redeemScript" - (string) The redeem script.
```
Example return value:
```php
[
// The raw transaction with signature(s) (hex-encoded string).
"hex" => "010000000263f2dde1d550b081d59c09ccb3f8a83b01...",
// If transaction has a complete set of signature (0 if not).
"complete" => 1
]
```
@param string $hex_data The transaction hex string
@param array $prevtxs An array of previous dependent transaction outputs
@param array $priv_keys Array of base58-encoded private keys for signing
@param string $sighashtype The signature hash type, one of "ALL", "NONE", "SINGLE", "ALL|ANYONECANPAY", "NONE|ANYONECANPAY", "SINGLE|ANYONECANPAY"
@return array
|
[
"Adds",
"signatures",
"to",
"a",
"raw",
"transaction",
"and",
"returns",
"the",
"resulting",
"raw",
"transaction"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/Wallet.php#L364-L373
|
221,342
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/Wallet.php
|
Wallet.isSignedMessageValid
|
public function isSignedMessageValid($address, $signature, $message)
{
$args = [
(string)$address,
(string)$signature,
(string)$message
];
return $this->rpc->query("verifyMessage", $args);
}
|
php
|
public function isSignedMessageValid($address, $signature, $message)
{
$args = [
(string)$address,
(string)$signature,
(string)$message
];
return $this->rpc->query("verifyMessage", $args);
}
|
[
"public",
"function",
"isSignedMessageValid",
"(",
"$",
"address",
",",
"$",
"signature",
",",
"$",
"message",
")",
"{",
"$",
"args",
"=",
"[",
"(",
"string",
")",
"$",
"address",
",",
"(",
"string",
")",
"$",
"signature",
",",
"(",
"string",
")",
"$",
"message",
"]",
";",
"return",
"$",
"this",
"->",
"rpc",
"->",
"query",
"(",
"\"verifyMessage\"",
",",
"$",
"args",
")",
";",
"}"
] |
Verify a signed message
Returns a boolean value indicating whether the message was successfully verified.
@param string $address A coin address
@param string $signature The signature
@param string $message The message
@return bool
|
[
"Verify",
"a",
"signed",
"message"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/Wallet.php#L385-L393
|
221,343
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/Wallet.php
|
Wallet.getBalances
|
public function getBalances($include_empty = false)
{
$args = [
$this->minconf,
(bool)$include_empty
];
return $this->rpc->query("listReceivedByAddress", $args);
}
|
php
|
public function getBalances($include_empty = false)
{
$args = [
$this->minconf,
(bool)$include_empty
];
return $this->rpc->query("listReceivedByAddress", $args);
}
|
[
"public",
"function",
"getBalances",
"(",
"$",
"include_empty",
"=",
"false",
")",
"{",
"$",
"args",
"=",
"[",
"$",
"this",
"->",
"minconf",
",",
"(",
"bool",
")",
"$",
"include_empty",
"]",
";",
"return",
"$",
"this",
"->",
"rpc",
"->",
"query",
"(",
"\"listReceivedByAddress\"",
",",
"$",
"args",
")",
";",
"}"
] |
Returns balances by for every address
Returns an mutlidimentional array, which each sub-array containing the following keys:
```
"address" - (string) The receiving address.
"account" - (string) The account of the receiving address, using "" to represent the default account.
"amount" - (double) The total amount received by the address.
"confirmations" - (int) The number of confirmations of the most recent transaction included.
"txids" - (array) An array of transaction ids.
```
To get a list of accounts on the system, call getReceivedByAddress(0, true).
@param bool $include_empty Whether to include addresses that haven't received any payments
@return array
|
[
"Returns",
"balances",
"by",
"for",
"every",
"address"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/Wallet.php#L426-L433
|
221,344
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/Wallet.php
|
Wallet.getBalanceByAccount
|
public function getBalanceByAccount($account)
{
$args = [
(string)$account,
$this->minconf
];
return $this->rpc->query("getBalance", $args);
}
|
php
|
public function getBalanceByAccount($account)
{
$args = [
(string)$account,
$this->minconf
];
return $this->rpc->query("getBalance", $args);
}
|
[
"public",
"function",
"getBalanceByAccount",
"(",
"$",
"account",
")",
"{",
"$",
"args",
"=",
"[",
"(",
"string",
")",
"$",
"account",
",",
"$",
"this",
"->",
"minconf",
"]",
";",
"return",
"$",
"this",
"->",
"rpc",
"->",
"query",
"(",
"\"getBalance\"",
",",
"$",
"args",
")",
";",
"}"
] |
Returns the balance for the given account
@param string $account The account name, using "" for the default account
@return double
|
[
"Returns",
"the",
"balance",
"for",
"the",
"given",
"account"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/Wallet.php#L441-L448
|
221,345
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/Wallet.php
|
Wallet.getBalanceByAddress
|
public function getBalanceByAddress($address)
{
$args = [
(string)$address,
$this->minconf
];
return $this->rpc->query("getReceivedByAddress", $args);
}
|
php
|
public function getBalanceByAddress($address)
{
$args = [
(string)$address,
$this->minconf
];
return $this->rpc->query("getReceivedByAddress", $args);
}
|
[
"public",
"function",
"getBalanceByAddress",
"(",
"$",
"address",
")",
"{",
"$",
"args",
"=",
"[",
"(",
"string",
")",
"$",
"address",
",",
"$",
"this",
"->",
"minconf",
"]",
";",
"return",
"$",
"this",
"->",
"rpc",
"->",
"query",
"(",
"\"getReceivedByAddress\"",
",",
"$",
"args",
")",
";",
"}"
] |
Returns the balance for a given address
@param string $address The address
@return double
|
[
"Returns",
"the",
"balance",
"for",
"a",
"given",
"address"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/Wallet.php#L456-L463
|
221,346
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/Wallet.php
|
Wallet.move
|
public function move($from_account, $to_account, $amount, $comment = "")
{
$args = [
(string)$from_account,
(string)$to_account,
(double)$amount,
$this->minconf,
(string)$comment
];
return $this->rpc->query(__FUNCTION__, $args);
}
|
php
|
public function move($from_account, $to_account, $amount, $comment = "")
{
$args = [
(string)$from_account,
(string)$to_account,
(double)$amount,
$this->minconf,
(string)$comment
];
return $this->rpc->query(__FUNCTION__, $args);
}
|
[
"public",
"function",
"move",
"(",
"$",
"from_account",
",",
"$",
"to_account",
",",
"$",
"amount",
",",
"$",
"comment",
"=",
"\"\"",
")",
"{",
"$",
"args",
"=",
"[",
"(",
"string",
")",
"$",
"from_account",
",",
"(",
"string",
")",
"$",
"to_account",
",",
"(",
"double",
")",
"$",
"amount",
",",
"$",
"this",
"->",
"minconf",
",",
"(",
"string",
")",
"$",
"comment",
"]",
";",
"return",
"$",
"this",
"->",
"rpc",
"->",
"query",
"(",
"__FUNCTION__",
",",
"$",
"args",
")",
";",
"}"
] |
Move from one account in your wallet to another
@param string $from_account Name of the from account
@param string $to_account Name of the to account
@param double $amount The amount to transfer
@param string $comment Comment to record with this transaction
@return bool
|
[
"Move",
"from",
"one",
"account",
"in",
"your",
"wallet",
"to",
"another"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/Wallet.php#L474-L484
|
221,347
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/Wallet.php
|
Wallet.send
|
public function send($address, $amount, $comment = null, $comment_to = null)
{
$args = [
(string)$address,
(double)$amount,
(string)$comment,
(string)$comment_to
];
return $this->rpc->query("sendToAddress", $args);
}
|
php
|
public function send($address, $amount, $comment = null, $comment_to = null)
{
$args = [
(string)$address,
(double)$amount,
(string)$comment,
(string)$comment_to
];
return $this->rpc->query("sendToAddress", $args);
}
|
[
"public",
"function",
"send",
"(",
"$",
"address",
",",
"$",
"amount",
",",
"$",
"comment",
"=",
"null",
",",
"$",
"comment_to",
"=",
"null",
")",
"{",
"$",
"args",
"=",
"[",
"(",
"string",
")",
"$",
"address",
",",
"(",
"double",
")",
"$",
"amount",
",",
"(",
"string",
")",
"$",
"comment",
",",
"(",
"string",
")",
"$",
"comment_to",
"]",
";",
"return",
"$",
"this",
"->",
"rpc",
"->",
"query",
"(",
"\"sendToAddress\"",
",",
"$",
"args",
")",
";",
"}"
] |
Sends coins to the given address
Returns the transaction id if successful.
@param string $address Address to send to
@param double $amount The amount to send
@param string $comment Comment to record with this transaction
@param string $comment_to Comment sent to the network with the transaction
@return string
|
[
"Sends",
"coins",
"to",
"the",
"given",
"address"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/Wallet.php#L497-L506
|
221,348
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/Wallet.php
|
Wallet.sendFromAccount
|
public function sendFromAccount($account, $address, $amount, $comment = null, $comment_to = null)
{
$args = [
(string)$account,
(string)$address,
(double)$amount,
$this->minconf,
(string)$comment,
(string)$comment_to
];
return $this->rpc->query("sendFrom", $args);
}
|
php
|
public function sendFromAccount($account, $address, $amount, $comment = null, $comment_to = null)
{
$args = [
(string)$account,
(string)$address,
(double)$amount,
$this->minconf,
(string)$comment,
(string)$comment_to
];
return $this->rpc->query("sendFrom", $args);
}
|
[
"public",
"function",
"sendFromAccount",
"(",
"$",
"account",
",",
"$",
"address",
",",
"$",
"amount",
",",
"$",
"comment",
"=",
"null",
",",
"$",
"comment_to",
"=",
"null",
")",
"{",
"$",
"args",
"=",
"[",
"(",
"string",
")",
"$",
"account",
",",
"(",
"string",
")",
"$",
"address",
",",
"(",
"double",
")",
"$",
"amount",
",",
"$",
"this",
"->",
"minconf",
",",
"(",
"string",
")",
"$",
"comment",
",",
"(",
"string",
")",
"$",
"comment_to",
"]",
";",
"return",
"$",
"this",
"->",
"rpc",
"->",
"query",
"(",
"\"sendFrom\"",
",",
"$",
"args",
")",
";",
"}"
] |
Sends coins from the given account to the given address
@param string $account Name of the from account
@param string $address Address to send to
@param double $amount The amount to send
@param string $comment Comment to record with this transaction
@param string $comment_to Comment sent to the network with the transaction
@return string
|
[
"Sends",
"coins",
"from",
"the",
"given",
"account",
"to",
"the",
"given",
"address"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/Wallet.php#L518-L529
|
221,349
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/Wallet.php
|
Wallet.sendManyFromAccount
|
public function sendManyFromAccount($account, array $addresses, $comment = null)
{
$args = [
(string)$account,
$addresses,
$this->minconf,
(string)$comment
];
return $this->rpc->query("sendMany", $args);
}
|
php
|
public function sendManyFromAccount($account, array $addresses, $comment = null)
{
$args = [
(string)$account,
$addresses,
$this->minconf,
(string)$comment
];
return $this->rpc->query("sendMany", $args);
}
|
[
"public",
"function",
"sendManyFromAccount",
"(",
"$",
"account",
",",
"array",
"$",
"addresses",
",",
"$",
"comment",
"=",
"null",
")",
"{",
"$",
"args",
"=",
"[",
"(",
"string",
")",
"$",
"account",
",",
"$",
"addresses",
",",
"$",
"this",
"->",
"minconf",
",",
"(",
"string",
")",
"$",
"comment",
"]",
";",
"return",
"$",
"this",
"->",
"rpc",
"->",
"query",
"(",
"\"sendMany\"",
",",
"$",
"args",
")",
";",
"}"
] |
Sends coins to multiple addresses
@param string $account Name of the from account
@param array $addresses ["address1" => "amount1", "address2" => "amount2"]
@param string $comment A comment on this transaction
@return array
|
[
"Sends",
"coins",
"to",
"multiple",
"addresses"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/Wallet.php#L539-L548
|
221,350
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/Wallet.php
|
Wallet.getAccounts
|
public function getAccounts()
{
$accounts = [];
$groups = $this->rpc->query("listAccounts", [0]);
foreach($groups as $account => $balance) {
$accounts[] = $account;
}
return $accounts;
}
|
php
|
public function getAccounts()
{
$accounts = [];
$groups = $this->rpc->query("listAccounts", [0]);
foreach($groups as $account => $balance) {
$accounts[] = $account;
}
return $accounts;
}
|
[
"public",
"function",
"getAccounts",
"(",
")",
"{",
"$",
"accounts",
"=",
"[",
"]",
";",
"$",
"groups",
"=",
"$",
"this",
"->",
"rpc",
"->",
"query",
"(",
"\"listAccounts\"",
",",
"[",
"0",
"]",
")",
";",
"foreach",
"(",
"$",
"groups",
"as",
"$",
"account",
"=>",
"$",
"balance",
")",
"{",
"$",
"accounts",
"[",
"]",
"=",
"$",
"account",
";",
"}",
"return",
"$",
"accounts",
";",
"}"
] |
Returns the wallet accounts
Example return value:
```php
[
"",
"Paper1",
"Mining"
]
```
@return array
|
[
"Returns",
"the",
"wallet",
"accounts"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/Wallet.php#L564-L573
|
221,351
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/Wallet.php
|
Wallet.setAccount
|
public function setAccount($address, $account)
{
$args = [
(string)$address,
(string)$account
];
return null === $this->rpc->query(__FUNCTION__, $args);
}
|
php
|
public function setAccount($address, $account)
{
$args = [
(string)$address,
(string)$account
];
return null === $this->rpc->query(__FUNCTION__, $args);
}
|
[
"public",
"function",
"setAccount",
"(",
"$",
"address",
",",
"$",
"account",
")",
"{",
"$",
"args",
"=",
"[",
"(",
"string",
")",
"$",
"address",
",",
"(",
"string",
")",
"$",
"account",
"]",
";",
"return",
"null",
"===",
"$",
"this",
"->",
"rpc",
"->",
"query",
"(",
"__FUNCTION__",
",",
"$",
"args",
")",
";",
"}"
] |
Sets the account associated with the given address
Assigning address that is already assigned to the same account will create a new address associated with
that account.
@param string $address A coin address from the wallet
@param string $account Name of the account
@return bool
|
[
"Sets",
"the",
"account",
"associated",
"with",
"the",
"given",
"address"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/Wallet.php#L585-L592
|
221,352
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/Wallet.php
|
Wallet.getAccountByAddress
|
public function getAccountByAddress($address)
{
$args = [
(string)$address
];
$account = $this->rpc->query("getAccount", $args);
return !empty($account) ? $account : null;
}
|
php
|
public function getAccountByAddress($address)
{
$args = [
(string)$address
];
$account = $this->rpc->query("getAccount", $args);
return !empty($account) ? $account : null;
}
|
[
"public",
"function",
"getAccountByAddress",
"(",
"$",
"address",
")",
"{",
"$",
"args",
"=",
"[",
"(",
"string",
")",
"$",
"address",
"]",
";",
"$",
"account",
"=",
"$",
"this",
"->",
"rpc",
"->",
"query",
"(",
"\"getAccount\"",
",",
"$",
"args",
")",
";",
"return",
"!",
"empty",
"(",
"$",
"account",
")",
"?",
"$",
"account",
":",
"null",
";",
"}"
] |
Returns the account associated with the given address
Returns null when an account does not exist for the given address.
@param string $address The address for account lookup
@return string|null
|
[
"Returns",
"the",
"account",
"associated",
"with",
"the",
"given",
"address"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/Wallet.php#L602-L610
|
221,353
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/Wallet.php
|
Wallet.getAddresses
|
public function getAddresses()
{
$addresses = [];
$groups = $this->rpc->query("listAddressGroupings");
foreach($groups as $group) {
foreach($group as $info) {
$addresses[] = $info[0];
}
}
return $addresses;
}
|
php
|
public function getAddresses()
{
$addresses = [];
$groups = $this->rpc->query("listAddressGroupings");
foreach($groups as $group) {
foreach($group as $info) {
$addresses[] = $info[0];
}
}
return $addresses;
}
|
[
"public",
"function",
"getAddresses",
"(",
")",
"{",
"$",
"addresses",
"=",
"[",
"]",
";",
"$",
"groups",
"=",
"$",
"this",
"->",
"rpc",
"->",
"query",
"(",
"\"listAddressGroupings\"",
")",
";",
"foreach",
"(",
"$",
"groups",
"as",
"$",
"group",
")",
"{",
"foreach",
"(",
"$",
"group",
"as",
"$",
"info",
")",
"{",
"$",
"addresses",
"[",
"]",
"=",
"$",
"info",
"[",
"0",
"]",
";",
"}",
"}",
"return",
"$",
"addresses",
";",
"}"
] |
Returns the wallet addresses
Example return value:
```php
[
"1Headz2mYtpBRo6KFaaUEtcm5Kce6BZRJM",
"1JBKAM8W9jEnuGNvPRFjtpmeDGvfQx6PLU",
"19tjsa4nBeAtn48kcmW9Gg2wRFtm24GRG2"
]
```
@return array
|
[
"Returns",
"the",
"wallet",
"addresses"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/Wallet.php#L626-L637
|
221,354
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/Wallet.php
|
Wallet.getAddressesByAccount
|
public function getAddressesByAccount($account)
{
$args = [
(string)$account
];
return $this->rpc->query(__FUNCTION__, $args);
}
|
php
|
public function getAddressesByAccount($account)
{
$args = [
(string)$account
];
return $this->rpc->query(__FUNCTION__, $args);
}
|
[
"public",
"function",
"getAddressesByAccount",
"(",
"$",
"account",
")",
"{",
"$",
"args",
"=",
"[",
"(",
"string",
")",
"$",
"account",
"]",
";",
"return",
"$",
"this",
"->",
"rpc",
"->",
"query",
"(",
"__FUNCTION__",
",",
"$",
"args",
")",
";",
"}"
] |
Returns the addresses for the given account
@param string $account The account name, using "" to represent the default account
@return array
|
[
"Returns",
"the",
"addresses",
"for",
"the",
"given",
"account"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/Wallet.php#L662-L668
|
221,355
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/Wallet.php
|
Wallet.getRawChangeAddress
|
public function getRawChangeAddress($account)
{
$args = [
(string)$account
];
return $this->rpc->query(__FUNCTION__, $args);
}
|
php
|
public function getRawChangeAddress($account)
{
$args = [
(string)$account
];
return $this->rpc->query(__FUNCTION__, $args);
}
|
[
"public",
"function",
"getRawChangeAddress",
"(",
"$",
"account",
")",
"{",
"$",
"args",
"=",
"[",
"(",
"string",
")",
"$",
"account",
"]",
";",
"return",
"$",
"this",
"->",
"rpc",
"->",
"query",
"(",
"__FUNCTION__",
",",
"$",
"args",
")",
";",
"}"
] |
Returns a new address for receiving change
This is for use with raw transactions, NOT normal use.
@param string $account Name of the account, using "" to represent the default account
@return string
|
[
"Returns",
"a",
"new",
"address",
"for",
"receiving",
"change"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/Wallet.php#L678-L684
|
221,356
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/Wallet.php
|
Wallet.getNewAddress
|
public function getNewAddress($account)
{
$args = [
(string)$account
];
return $this->rpc->query(__FUNCTION__, $args);
}
|
php
|
public function getNewAddress($account)
{
$args = [
(string)$account
];
return $this->rpc->query(__FUNCTION__, $args);
}
|
[
"public",
"function",
"getNewAddress",
"(",
"$",
"account",
")",
"{",
"$",
"args",
"=",
"[",
"(",
"string",
")",
"$",
"account",
"]",
";",
"return",
"$",
"this",
"->",
"rpc",
"->",
"query",
"(",
"__FUNCTION__",
",",
"$",
"args",
")",
";",
"}"
] |
Returns a new address for receiving payments
If $account is specified (recommended), it is added to the address book so payments received with the address
will be credited to $account.
@param string $account The account name for the address to be linked to, using "" to represent the default account
@return string
|
[
"Returns",
"a",
"new",
"address",
"for",
"receiving",
"payments"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/Wallet.php#L695-L701
|
221,357
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/Wallet.php
|
Wallet.getNewMultiSignatureAddress
|
public function getNewMultiSignatureAddress($nrequired, array $keys)
{
$args = [
(int)$nrequired,
$keys
];
return $this->rpc->query("createMultiSig", $args);
}
|
php
|
public function getNewMultiSignatureAddress($nrequired, array $keys)
{
$args = [
(int)$nrequired,
$keys
];
return $this->rpc->query("createMultiSig", $args);
}
|
[
"public",
"function",
"getNewMultiSignatureAddress",
"(",
"$",
"nrequired",
",",
"array",
"$",
"keys",
")",
"{",
"$",
"args",
"=",
"[",
"(",
"int",
")",
"$",
"nrequired",
",",
"$",
"keys",
"]",
";",
"return",
"$",
"this",
"->",
"rpc",
"->",
"query",
"(",
"\"createMultiSig\"",
",",
"$",
"args",
")",
";",
"}"
] |
Returns a new multi-signature address
Returns an array with the following keys:
```
"address" - (string) The multi-signature address
"redeemScript" - (string) The redeem script
```
@param int $nrequired Number of keys needed to redeem
@param array $keys Array of public keys
@return array
|
[
"Returns",
"a",
"new",
"multi",
"-",
"signature",
"address"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/Wallet.php#L743-L750
|
221,358
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/Wallet.php
|
Wallet.addMultiSignatureAddress
|
public function addMultiSignatureAddress($nrequired, array $keys, $account = null)
{
// Can't use null for $account. Must be left out of the args completely when not specified.
$args = [
(int)$nrequired,
$keys
];
if (null !== $account) {
$args[] = (string)$account;
}
return $this->rpc->query("addMultiSigAddress", $args);
}
|
php
|
public function addMultiSignatureAddress($nrequired, array $keys, $account = null)
{
// Can't use null for $account. Must be left out of the args completely when not specified.
$args = [
(int)$nrequired,
$keys
];
if (null !== $account) {
$args[] = (string)$account;
}
return $this->rpc->query("addMultiSigAddress", $args);
}
|
[
"public",
"function",
"addMultiSignatureAddress",
"(",
"$",
"nrequired",
",",
"array",
"$",
"keys",
",",
"$",
"account",
"=",
"null",
")",
"{",
"// Can't use null for $account. Must be left out of the args completely when not specified.",
"$",
"args",
"=",
"[",
"(",
"int",
")",
"$",
"nrequired",
",",
"$",
"keys",
"]",
";",
"if",
"(",
"null",
"!==",
"$",
"account",
")",
"{",
"$",
"args",
"[",
"]",
"=",
"(",
"string",
")",
"$",
"account",
";",
"}",
"return",
"$",
"this",
"->",
"rpc",
"->",
"query",
"(",
"\"addMultiSigAddress\"",
",",
"$",
"args",
")",
";",
"}"
] |
Add a nrequired-to-sign multisignature address to the wallet
Each key is a address or hex-encoded public key. If $account is specified, assign address to $account.
Returns the the multi-signature address.
@param int $nrequired Number of keys needed to redeem
@param array $keys Array of public keys
@param string $account Name of account which receives the address
@return string
|
[
"Add",
"a",
"nrequired",
"-",
"to",
"-",
"sign",
"multisignature",
"address",
"to",
"the",
"wallet"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/Wallet.php#L764-L775
|
221,359
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/Wallet.php
|
Wallet.getPrivateKeyByAddress
|
public function getPrivateKeyByAddress($address)
{
$args = [
(string)$address
];
$priv_key = null;
try {
$priv_key = $this->rpc->query("dumpPrivKey", $args);
} catch (Exceptions\RPCException $e) {
if ($e->getCode() != RPCErrorCodes::WALLET_ERROR) {
throw $e;
}
}
return $priv_key;
}
|
php
|
public function getPrivateKeyByAddress($address)
{
$args = [
(string)$address
];
$priv_key = null;
try {
$priv_key = $this->rpc->query("dumpPrivKey", $args);
} catch (Exceptions\RPCException $e) {
if ($e->getCode() != RPCErrorCodes::WALLET_ERROR) {
throw $e;
}
}
return $priv_key;
}
|
[
"public",
"function",
"getPrivateKeyByAddress",
"(",
"$",
"address",
")",
"{",
"$",
"args",
"=",
"[",
"(",
"string",
")",
"$",
"address",
"]",
";",
"$",
"priv_key",
"=",
"null",
";",
"try",
"{",
"$",
"priv_key",
"=",
"$",
"this",
"->",
"rpc",
"->",
"query",
"(",
"\"dumpPrivKey\"",
",",
"$",
"args",
")",
";",
"}",
"catch",
"(",
"Exceptions",
"\\",
"RPCException",
"$",
"e",
")",
"{",
"if",
"(",
"$",
"e",
"->",
"getCode",
"(",
")",
"!=",
"RPCErrorCodes",
"::",
"WALLET_ERROR",
")",
"{",
"throw",
"$",
"e",
";",
"}",
"}",
"return",
"$",
"priv_key",
";",
"}"
] |
Returns the private key for the given address
Returns null when the address does not belong to any wallet account.
@param string $address The address for the private key
@return string
@throws Exceptions\RPCException
|
[
"Returns",
"the",
"private",
"key",
"for",
"the",
"given",
"address"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/Wallet.php#L786-L802
|
221,360
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/Wallet.php
|
Wallet.addPrivateKey
|
public function addPrivateKey($priv_key, $label, $rescan = true)
{
$args = [
(string)$priv_key,
(string)$label,
(bool)$rescan
];
return null === $this->rpc->query("importPrivKey", $args);
}
|
php
|
public function addPrivateKey($priv_key, $label, $rescan = true)
{
$args = [
(string)$priv_key,
(string)$label,
(bool)$rescan
];
return null === $this->rpc->query("importPrivKey", $args);
}
|
[
"public",
"function",
"addPrivateKey",
"(",
"$",
"priv_key",
",",
"$",
"label",
",",
"$",
"rescan",
"=",
"true",
")",
"{",
"$",
"args",
"=",
"[",
"(",
"string",
")",
"$",
"priv_key",
",",
"(",
"string",
")",
"$",
"label",
",",
"(",
"bool",
")",
"$",
"rescan",
"]",
";",
"return",
"null",
"===",
"$",
"this",
"->",
"rpc",
"->",
"query",
"(",
"\"importPrivKey\"",
",",
"$",
"args",
")",
";",
"}"
] |
Adds a private key to the wallet
Rescanning may take a while looking for existing transactions, and may even freeze up the wallet.
@param string $priv_key The private key
@param string $label An optional label
@param bool $rescan Whether to rescan the wallet for transactions
@return bool
|
[
"Adds",
"a",
"private",
"key",
"to",
"the",
"wallet"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/Wallet.php#L814-L822
|
221,361
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/Wallet.php
|
Wallet.getBlock
|
public function getBlock($hash, $verbose = true)
{
$args = [
(string)$hash,
(bool)$verbose
];
return $this->rpc->query(__FUNCTION__, $args);
}
|
php
|
public function getBlock($hash, $verbose = true)
{
$args = [
(string)$hash,
(bool)$verbose
];
return $this->rpc->query(__FUNCTION__, $args);
}
|
[
"public",
"function",
"getBlock",
"(",
"$",
"hash",
",",
"$",
"verbose",
"=",
"true",
")",
"{",
"$",
"args",
"=",
"[",
"(",
"string",
")",
"$",
"hash",
",",
"(",
"bool",
")",
"$",
"verbose",
"]",
";",
"return",
"$",
"this",
"->",
"rpc",
"->",
"query",
"(",
"__FUNCTION__",
",",
"$",
"args",
")",
";",
"}"
] |
Returns information about the block with the given hash
When $verbose is set to false, this method returns the serialized and hex-encoded block data.
When $verbose is set to true, the return value will be an array with the following keys:
```
"hash" - (string) The block hash (same as provided).
"confirmations" - (int) The number of confirmations.
"size" - (int) The block size.
"height" - (int) The block height or index.
"version" - (int) The block version.
"merkleroot" - (string) The merkle root.
"tx" - (array) The transaction ids.
"time" - (int) The block time in seconds since epoch (Jan 1 1970 GMT).
"nonce" - (double) The nonce.
"bits" - (string) The bits.
"difficulty" - (double) The difficulty.
"previousblockhash" - (string) The hash of the previous block.
"nextblockhash" - (string) The hash of the next block.
```
@param string $hash The block hash
@param bool $verbose True for an array, false for the hex encoded data
@return array|string
|
[
"Returns",
"information",
"about",
"the",
"block",
"with",
"the",
"given",
"hash"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/Wallet.php#L850-L857
|
221,362
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/Wallet.php
|
Wallet.getTransaction
|
public function getTransaction($txid)
{
$args = [
(string)$txid
];
return $this->rpc->query(__FUNCTION__, $args);
}
|
php
|
public function getTransaction($txid)
{
$args = [
(string)$txid
];
return $this->rpc->query(__FUNCTION__, $args);
}
|
[
"public",
"function",
"getTransaction",
"(",
"$",
"txid",
")",
"{",
"$",
"args",
"=",
"[",
"(",
"string",
")",
"$",
"txid",
"]",
";",
"return",
"$",
"this",
"->",
"rpc",
"->",
"query",
"(",
"__FUNCTION__",
",",
"$",
"args",
")",
";",
"}"
] |
Returns detailed information about in-wallet transaction
This method cannot be used to get information about non-wallet transactions. Use getRawTransaction() for
non-wallet transactions.
The returned array will contain the following keys:
```
"amount" - (double) The transaction amount.
"fee" - (double) The transaction fee.
"confirmations" - (int) The number of confirmations.
"blockhash" - (string) The block hash.
"blockindex" - (int) The block index.
"blocktime" - (int) The time in seconds since epoch (1 Jan 1970 GMT).
"txid" - (string) The transaction id.
"time" - (int) The transaction time in seconds since epoch (1 Jan 1970 GMT).
"timereceived" - (int) The time received in seconds since epoch (1 Jan 1970 GMT).
"details" - (array) The transaction details. Each array contains the following keys:
"account" - (string) The account name involved in the transaction, using "" to represent the default account.
"address" - (string) The address involved in the transaction.
"category" - (string) The category, either "send" or "receive".
"amount" - (double) The amount.
"fee" - (double) The transaction fee.
```
@param string $txid The transaction id
@return array
|
[
"Returns",
"detailed",
"information",
"about",
"in",
"-",
"wallet",
"transaction"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/Wallet.php#L941-L947
|
221,363
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/Wallet.php
|
Wallet.getRawTransaction
|
public function getRawTransaction($txid, $verbose = 0)
{
$args = [
(string)$txid,
(int)$verbose
];
return $this->rpc->query(__FUNCTION__, $args);
}
|
php
|
public function getRawTransaction($txid, $verbose = 0)
{
$args = [
(string)$txid,
(int)$verbose
];
return $this->rpc->query(__FUNCTION__, $args);
}
|
[
"public",
"function",
"getRawTransaction",
"(",
"$",
"txid",
",",
"$",
"verbose",
"=",
"0",
")",
"{",
"$",
"args",
"=",
"[",
"(",
"string",
")",
"$",
"txid",
",",
"(",
"int",
")",
"$",
"verbose",
"]",
";",
"return",
"$",
"this",
"->",
"rpc",
"->",
"query",
"(",
"__FUNCTION__",
",",
"$",
"args",
")",
";",
"}"
] |
Returns raw transaction representation for given transaction id
Returns the raw transaction data as a string when $verbose is 0. Use decodeRawTransaction() to convert the
transaction data into an array.
Returns an array with the following keys when $verbose is 1.
```
"hex" - (string) The serialized, hex-encoded data.
"txid" - (string) The transaction id.
"version" - (int) The version.
"locktime" - (int) The lock time.
"vin" - (array) An array with the following keys:
"txid" - (string) The transaction id.
"vout" - (int) The vout index.
"scriptSig" - (array) The script, an array with keys:
"asm" - (string) Script in asm format.
"hex" - (string) Script in hex format.
"sequence" - (int) The script sequence number.
"vout" - (array) An array with the following keys:
"value" - (double) The amount sent.
"n" - (int) The index.
"scriptPubKey" - (array) An array with the following keys:
"asm" - (string) The script in asm format.
"hex" - (string) The script in hex format.
"reqSigs" - (int) The number of required sigs.
"type" - (string) The type, eg 'pubkeyhash'.
"addresses" - (array) An array of addresses.
"blockhash" - (string) The block hash.
"confirmations" - (int) The number of confirmations.
"time" - (int) The transaction time in seconds since epoch (Jan 1 1970 GMT).
"blocktime" - (int) The block time in seconds since epoch (Jan 1 1970 GMT).
```
@param string $txid The transaction id
@param int $verbose If 0, return a string, other return a json object
@return array
|
[
"Returns",
"raw",
"transaction",
"representation",
"for",
"given",
"transaction",
"id"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/Wallet.php#L1035-L1042
|
221,364
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/Wallet.php
|
Wallet.getTransactionOut
|
public function getTransactionOut($txid, $n, $include_mem_pool = true)
{
$args = [
(string)$txid,
(int)$n,
(bool)$include_mem_pool
];
return $this->rpc->query("getTxOut", $args);
}
|
php
|
public function getTransactionOut($txid, $n, $include_mem_pool = true)
{
$args = [
(string)$txid,
(int)$n,
(bool)$include_mem_pool
];
return $this->rpc->query("getTxOut", $args);
}
|
[
"public",
"function",
"getTransactionOut",
"(",
"$",
"txid",
",",
"$",
"n",
",",
"$",
"include_mem_pool",
"=",
"true",
")",
"{",
"$",
"args",
"=",
"[",
"(",
"string",
")",
"$",
"txid",
",",
"(",
"int",
")",
"$",
"n",
",",
"(",
"bool",
")",
"$",
"include_mem_pool",
"]",
";",
"return",
"$",
"this",
"->",
"rpc",
"->",
"query",
"(",
"\"getTxOut\"",
",",
"$",
"args",
")",
";",
"}"
] |
Returns details about an unspent transaction output
Returns an array with the following keys:
```
"bestblock" - (string) The block hash.
"confirmations" - (int) The number of confirmations.
"value" - (double) The transaction value.
"scriptPubKey" - (array) The script, an array with the following keys:
"asm" - (string) The code in asm format.
"hex" - (string) The code in hex format.
"regSigs" - (int) Number of required signatures.
"type" - (string) The type, eg "pubkeyhash".
"addresses" - (array) An array of addresses.
"version" - (int) The version.
"coinbase" - (bool) Coinbase transaction or not.
```
@param string $txid The transaction id
@param int $n The vout value
@param bool $include_mem_pool Whether to included the mem pool
@return array
|
[
"Returns",
"details",
"about",
"an",
"unspent",
"transaction",
"output"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/Wallet.php#L1067-L1075
|
221,365
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/Wallet.php
|
Wallet.setLockUnspent
|
public function setLockUnspent($unlock, array $objs = [])
{
$args = [
(bool)$unlock,
$objs
];
return $this->rpc->query("lockUnspent", $args);
}
|
php
|
public function setLockUnspent($unlock, array $objs = [])
{
$args = [
(bool)$unlock,
$objs
];
return $this->rpc->query("lockUnspent", $args);
}
|
[
"public",
"function",
"setLockUnspent",
"(",
"$",
"unlock",
",",
"array",
"$",
"objs",
"=",
"[",
"]",
")",
"{",
"$",
"args",
"=",
"[",
"(",
"bool",
")",
"$",
"unlock",
",",
"$",
"objs",
"]",
";",
"return",
"$",
"this",
"->",
"rpc",
"->",
"query",
"(",
"\"lockUnspent\"",
",",
"$",
"args",
")",
";",
"}"
] |
Updates list of temporarily unspendable outputs
Temporarily lock (true) or unlock (false) specified transaction outputs.
@param bool $unlock Whether to unlock (true) or lock (false) the specified transactions
@param array $objs An array of objects. Each object has "txid" (string) and "vout" (numeric)
@return bool
|
[
"Updates",
"list",
"of",
"temporarily",
"unspendable",
"outputs"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/Wallet.php#L1148-L1155
|
221,366
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/Wallet.php
|
Wallet.getBlockTemplate
|
public function getBlockTemplate(array $capabilities = [], $mode = null)
{
$params = new \stdClass();
$params->capabilities = $capabilities;
if (null !== $mode) {
$params->mode = $mode;
}
$args = [
$params
];
return $this->rpc->query(__FUNCTION__, $args);
}
|
php
|
public function getBlockTemplate(array $capabilities = [], $mode = null)
{
$params = new \stdClass();
$params->capabilities = $capabilities;
if (null !== $mode) {
$params->mode = $mode;
}
$args = [
$params
];
return $this->rpc->query(__FUNCTION__, $args);
}
|
[
"public",
"function",
"getBlockTemplate",
"(",
"array",
"$",
"capabilities",
"=",
"[",
"]",
",",
"$",
"mode",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"new",
"\\",
"stdClass",
"(",
")",
";",
"$",
"params",
"->",
"capabilities",
"=",
"$",
"capabilities",
";",
"if",
"(",
"null",
"!==",
"$",
"mode",
")",
"{",
"$",
"params",
"->",
"mode",
"=",
"$",
"mode",
";",
"}",
"$",
"args",
"=",
"[",
"$",
"params",
"]",
";",
"return",
"$",
"this",
"->",
"rpc",
"->",
"query",
"(",
"__FUNCTION__",
",",
"$",
"args",
")",
";",
"}"
] |
Returns data needed to construct a block to work on
If the $mode argument is set, that is used to explicitly select between the default "template"
request or a "proposal".
The returned array contains the following keys:
```
"version" - (int) The block version.
"previousblockhash" - (string) The hash of current highest block.
"transactions" - (array) Array of non-coinbase transactions which should be included in the block. Each contains the following keys:
"data" - (string) Transaction data encoded in hexadecimal (byte-for-byte).
"hash" - (string) Hash/id encoded in little-endian hexadecimal.
"depends" - (array) Array of numbers.
"fee" - (int) Difference in value between transaction inputs and outputs (in Satoshis); for coinbase transactions, this is a negative Number of the total collected block fees (ie, not including the block subsidy); if key is not present, fee is unknown and clients MUST NOT assume there isn't one.
"sigops" - (int) Total number of SigOps, as counted for purposes of block limits; if key is not present, sigop count is unknown and clients MUST NOT assume there aren't any.
"required" - (boolean) If provided and true, this transaction must be in the final block.
"coinbaseaux" - (array) Array of data that should be included in the coinbase's scriptSig content. Contains the following key:
"flags" - (string) The data to include.
"coinbasevalue" - (double) Maximum allowable input to coinbase transaction, including the generation award and transaction fees (in Satoshis).
"coinbasetxn" - (array) Information for coinbase transaction.
"target" - (string) The hash target.
"mintime" - (int) The minimum timestamp appropriate for next block time in seconds since epoch (Jan 1 1970 GMT).
"mutable" - (array) List of ways the block template may be changed. Contains the following keys:
"value" - (string) A way the block template may be changed, e.g. 'time', 'transactions', 'prevblock'.
"noncerange" - (string) A range of valid nonces.
"sigoplimit" - (int) Limit of sigops in blocks.
"sizelimit" - (int) Limit of block size.
"curtime" - (int) Current timestamp in seconds since epoch (Jan 1 1970 GMT).
"bits" - (string) Compressed target of next block.
"height" - (int) The height of the next block.
```
@see https://en.bitcoin.it/wiki/BIP_0022
@param array $capabilities An array of supported features, "longpoll", "coinbasetxn", "coinbasevalue", "proposal", "serverlist", "workid"
@param string|null $mode This must be set to "template" or omitted
@return array
|
[
"Returns",
"data",
"needed",
"to",
"construct",
"a",
"block",
"to",
"work",
"on"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/Wallet.php#L1195-L1206
|
221,367
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/Wallet.php
|
Wallet.getWork
|
public function getWork($data = null)
{
// No arguments should be sent when $data is null.
if (null === $data) {
$args = [];
} else {
$args = [
(string)$data
];
}
return $this->rpc->query(__FUNCTION__, $args);
}
|
php
|
public function getWork($data = null)
{
// No arguments should be sent when $data is null.
if (null === $data) {
$args = [];
} else {
$args = [
(string)$data
];
}
return $this->rpc->query(__FUNCTION__, $args);
}
|
[
"public",
"function",
"getWork",
"(",
"$",
"data",
"=",
"null",
")",
"{",
"// No arguments should be sent when $data is null.",
"if",
"(",
"null",
"===",
"$",
"data",
")",
"{",
"$",
"args",
"=",
"[",
"]",
";",
"}",
"else",
"{",
"$",
"args",
"=",
"[",
"(",
"string",
")",
"$",
"data",
"]",
";",
"}",
"return",
"$",
"this",
"->",
"rpc",
"->",
"query",
"(",
"__FUNCTION__",
",",
"$",
"args",
")",
";",
"}"
] |
Returns work data, or works on existing data
Returns formatted hash data to work on if $data is not specified. Tries to solve the block if $data is provided,
and returns a boolean value indicating success or failure.
When $data is not specified, the return value will be an array with the following keys:
```
"midstate" - (string) The precomputed hash state after hashing the first half of the data (DEPRECATED).
"data" - (string) The serialized block data.
"hash1" - (string) The formatted hash buffer for second hash (DEPRECATED).
"target" - (string) The little endian hash target.
```
@param string $data The hex-encoded data to solve
@return array|bool
|
[
"Returns",
"work",
"data",
"or",
"works",
"on",
"existing",
"data"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/Wallet.php#L1225-L1236
|
221,368
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/Wallet.php
|
Wallet.createRawTransaction
|
public function createRawTransaction(array $transactions, array $addresses)
{
$args = [
$transactions,
$addresses
];
return $this->rpc->query(__FUNCTION__, $args);
}
|
php
|
public function createRawTransaction(array $transactions, array $addresses)
{
$args = [
$transactions,
$addresses
];
return $this->rpc->query(__FUNCTION__, $args);
}
|
[
"public",
"function",
"createRawTransaction",
"(",
"array",
"$",
"transactions",
",",
"array",
"$",
"addresses",
")",
"{",
"$",
"args",
"=",
"[",
"$",
"transactions",
",",
"$",
"addresses",
"]",
";",
"return",
"$",
"this",
"->",
"rpc",
"->",
"query",
"(",
"__FUNCTION__",
",",
"$",
"args",
")",
";",
"}"
] |
Returns a hex-encoded raw transaction spending the given inputs and sending to the given addresses
The $transactions argument is a multidimensional array, which each value being an array with the following keys:
```
"txid" - (string) The transaction id.
"vout" - (int) The output number.
```
The $addresses argument is an associative array using addresses for keys, and amounts to send to the address
as values. For example:
```php
[
"1Headz2mYtpBRo6KFaaUEtcm5Kce6BZRJM" => 0.5,
"1FVCaRTKQtpxeE4gypz69NvDkyZUd7Y3SJ" => 0.08
]
```
**Note:** This method only creates the raw transaction data. The transaction's inputs are not signed, and it is not
stored in the wallet or transmitted to the network.
Example:
```php
$transactions = [
[
"txid" => "7de4c9a1e715a9aaf6f8573ce16f8bc3c06f927826e2d0c39424e1524eccda89",
"vout" => 1
],
[
"tdid" => "d2e611dcb3348c315dadeaa959cff662328f124e3a3e80fe8f33056bac95b9fe",
"vout" => 2
]
];
$addresses = [
"1Headz2mYtpBRo6KFaaUEtcm5Kce6BZRJM" => 0.5,
"13P4LpjYyBvWt283DffjsHpoFWFprr9dVq" => 0.08
];
$raw = $api->createRawTransaction($transactions, $addresses);
```
@param array $transactions The transactions
@param array $addresses Array using addresses for keys, and amounts for values
@return array
|
[
"Returns",
"a",
"hex",
"-",
"encoded",
"raw",
"transaction",
"spending",
"the",
"given",
"inputs",
"and",
"sending",
"to",
"the",
"given",
"addresses"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/Wallet.php#L1318-L1325
|
221,369
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/Wallet.php
|
Wallet.decodeRawTransaction
|
public function decodeRawTransaction($hex_string)
{
$args = [
(string)$hex_string
];
return $this->rpc->query(__FUNCTION__, $args);
}
|
php
|
public function decodeRawTransaction($hex_string)
{
$args = [
(string)$hex_string
];
return $this->rpc->query(__FUNCTION__, $args);
}
|
[
"public",
"function",
"decodeRawTransaction",
"(",
"$",
"hex_string",
")",
"{",
"$",
"args",
"=",
"[",
"(",
"string",
")",
"$",
"hex_string",
"]",
";",
"return",
"$",
"this",
"->",
"rpc",
"->",
"query",
"(",
"__FUNCTION__",
",",
"$",
"args",
")",
";",
"}"
] |
Decodes a raw serialized transaction
Given a serialized, hex-encoded transaction, the method decodes it, and returns an array of the transaction
information.
Returns an array with the following keys:
```
"hex" - (string) The serialized, hex-encoded data.
"txid" - (string) The transaction id.
"version" - (int) The version.
"locktime" - (int) The lock time.
"vin" - (array) An array with the following keys:
"txid" - (string) The transaction id.
"vout" - (int) The vout index.
"scriptSig" - (array) The script, an array with keys:
"asm" - (string) Script in asm format.
"hex" - (string) Script in hex format.
"sequence" - (int) The script sequence number.
"vout" - (array) An array with the following keys:
"value" - (double) The amount sent.
"n" - (int) The index.
"scriptPubKey" - (array) An array with the following keys:
"asm" - (string) The script in asm format.
"hex" - (string) The script in hex format.
"reqSigs" - (int) The number of required sigs.
"type" - (string) The type, eg 'pubkeyhash'.
"addresses" - (array) An array of addresses.
"blockhash" - (string) The block hash.
"confirmations" - (int) The number of confirmations.
"time" - (int) The transaction time in seconds since epoch (Jan 1 1970 GMT).
"blocktime" - (int) The block time in seconds since epoch (Jan 1 1970 GMT).
```
@param string $hex_string The serialized, hex-encoded transaction data
@return array
|
[
"Decodes",
"a",
"raw",
"serialized",
"transaction"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/Wallet.php#L1364-L1370
|
221,370
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/Wallet.php
|
Wallet.encrypt
|
public function encrypt($pass_phrase)
{
$args = [
(string)$pass_phrase
];
return null === $this->rpc->query("encryptWallet", $args);
}
|
php
|
public function encrypt($pass_phrase)
{
$args = [
(string)$pass_phrase
];
return null === $this->rpc->query("encryptWallet", $args);
}
|
[
"public",
"function",
"encrypt",
"(",
"$",
"pass_phrase",
")",
"{",
"$",
"args",
"=",
"[",
"(",
"string",
")",
"$",
"pass_phrase",
"]",
";",
"return",
"null",
"===",
"$",
"this",
"->",
"rpc",
"->",
"query",
"(",
"\"encryptWallet\"",
",",
"$",
"args",
")",
";",
"}"
] |
Encrypts the wallet with the given pass phrase
After this, any calls that interact with private keys such as sending or signing will require the passphrase to
be set prior the making these calls. Use the unlock() for this, and then lock().
**Note:** This will shutdown the server.
@param string $pass_phrase The pass phrase to encrypt the wallet with. It must be at least 1 character, but should be long
@return bool
|
[
"Encrypts",
"the",
"wallet",
"with",
"the",
"given",
"pass",
"phrase"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/Wallet.php#L1383-L1389
|
221,371
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/Wallet.php
|
Wallet.changePassPhrase
|
public function changePassPhrase($old_passphrase, $new_passphrase)
{
$args = [
(string)$old_passphrase,
(string)$new_passphrase
];
return null === $this->rpc->query("walletPassPhraseChange", $args);
}
|
php
|
public function changePassPhrase($old_passphrase, $new_passphrase)
{
$args = [
(string)$old_passphrase,
(string)$new_passphrase
];
return null === $this->rpc->query("walletPassPhraseChange", $args);
}
|
[
"public",
"function",
"changePassPhrase",
"(",
"$",
"old_passphrase",
",",
"$",
"new_passphrase",
")",
"{",
"$",
"args",
"=",
"[",
"(",
"string",
")",
"$",
"old_passphrase",
",",
"(",
"string",
")",
"$",
"new_passphrase",
"]",
";",
"return",
"null",
"===",
"$",
"this",
"->",
"rpc",
"->",
"query",
"(",
"\"walletPassPhraseChange\"",
",",
"$",
"args",
")",
";",
"}"
] |
Updates the wallet passphrase
@param string $old_passphrase The old pass phrase
@param string $new_passphrase The new pass phrase
@return array
|
[
"Updates",
"the",
"wallet",
"passphrase"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/Wallet.php#L1437-L1444
|
221,372
|
mysql-workbench-schema-exporter/doctrine2-exporter
|
lib/MwbExporter/Formatter/Doctrine2/Annotation/Model/Table.php
|
Table.addPrefix
|
public function addPrefix($annotation = null)
{
if (null === $this->ormPrefix) {
$this->ormPrefix = '@'.$this->getConfig()->get(Formatter::CFG_ANNOTATION_PREFIX);
}
return $this->ormPrefix.($annotation ? $annotation : '');
}
|
php
|
public function addPrefix($annotation = null)
{
if (null === $this->ormPrefix) {
$this->ormPrefix = '@'.$this->getConfig()->get(Formatter::CFG_ANNOTATION_PREFIX);
}
return $this->ormPrefix.($annotation ? $annotation : '');
}
|
[
"public",
"function",
"addPrefix",
"(",
"$",
"annotation",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"ormPrefix",
")",
"{",
"$",
"this",
"->",
"ormPrefix",
"=",
"'@'",
".",
"$",
"this",
"->",
"getConfig",
"(",
")",
"->",
"get",
"(",
"Formatter",
"::",
"CFG_ANNOTATION_PREFIX",
")",
";",
"}",
"return",
"$",
"this",
"->",
"ormPrefix",
".",
"(",
"$",
"annotation",
"?",
"$",
"annotation",
":",
"''",
")",
";",
"}"
] |
Get annotation prefix.
@param string $annotation Annotation type
@return string
|
[
"Get",
"annotation",
"prefix",
"."
] |
a62b13cbf4824c05cc791034ffedf419242ba0cb
|
https://github.com/mysql-workbench-schema-exporter/doctrine2-exporter/blob/a62b13cbf4824c05cc791034ffedf419242ba0cb/lib/MwbExporter/Formatter/Doctrine2/Annotation/Model/Table.php#L78-L85
|
221,373
|
mysql-workbench-schema-exporter/doctrine2-exporter
|
lib/MwbExporter/Formatter/Doctrine2/Annotation/Model/Table.php
|
Table.quoteIdentifier
|
public function quoteIdentifier($value)
{
$quote = false;
switch ($this->getConfig()->get(Formatter::CFG_QUOTE_IDENTIFIER_STRATEGY)) {
case Formatter::QUOTE_IDENTIFIER_AUTO:
$quote = ReservedWords::isReserved($value);
break;
case Formatter::QUOTE_IDENTIFIER_ALWAYS:
$quote = true;
break;
}
return $quote ? '`'.$value.'`' : $value;
}
|
php
|
public function quoteIdentifier($value)
{
$quote = false;
switch ($this->getConfig()->get(Formatter::CFG_QUOTE_IDENTIFIER_STRATEGY)) {
case Formatter::QUOTE_IDENTIFIER_AUTO:
$quote = ReservedWords::isReserved($value);
break;
case Formatter::QUOTE_IDENTIFIER_ALWAYS:
$quote = true;
break;
}
return $quote ? '`'.$value.'`' : $value;
}
|
[
"public",
"function",
"quoteIdentifier",
"(",
"$",
"value",
")",
"{",
"$",
"quote",
"=",
"false",
";",
"switch",
"(",
"$",
"this",
"->",
"getConfig",
"(",
")",
"->",
"get",
"(",
"Formatter",
"::",
"CFG_QUOTE_IDENTIFIER_STRATEGY",
")",
")",
"{",
"case",
"Formatter",
"::",
"QUOTE_IDENTIFIER_AUTO",
":",
"$",
"quote",
"=",
"ReservedWords",
"::",
"isReserved",
"(",
"$",
"value",
")",
";",
"break",
";",
"case",
"Formatter",
"::",
"QUOTE_IDENTIFIER_ALWAYS",
":",
"$",
"quote",
"=",
"true",
";",
"break",
";",
"}",
"return",
"$",
"quote",
"?",
"'`'",
".",
"$",
"value",
".",
"'`'",
":",
"$",
"value",
";",
"}"
] |
Quote identifier if necessary.
@param string $value The identifier to quote
@return string
|
[
"Quote",
"identifier",
"if",
"necessary",
"."
] |
a62b13cbf4824c05cc791034ffedf419242ba0cb
|
https://github.com/mysql-workbench-schema-exporter/doctrine2-exporter/blob/a62b13cbf4824c05cc791034ffedf419242ba0cb/lib/MwbExporter/Formatter/Doctrine2/Annotation/Model/Table.php#L93-L107
|
221,374
|
mysql-workbench-schema-exporter/doctrine2-exporter
|
lib/MwbExporter/Formatter/Doctrine2/Annotation/Model/Table.php
|
Table.getAnnotation
|
public function getAnnotation($annotation, $content = null, $options = array())
{
return new Annotation($this->addPrefix($annotation), $content, $options);
}
|
php
|
public function getAnnotation($annotation, $content = null, $options = array())
{
return new Annotation($this->addPrefix($annotation), $content, $options);
}
|
[
"public",
"function",
"getAnnotation",
"(",
"$",
"annotation",
",",
"$",
"content",
"=",
"null",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"return",
"new",
"Annotation",
"(",
"$",
"this",
"->",
"addPrefix",
"(",
"$",
"annotation",
")",
",",
"$",
"content",
",",
"$",
"options",
")",
";",
"}"
] |
Get annotation object.
@param string $annotation The annotation name
@param mixed $content The annotation content
@param array $options The annotation options
@return \MwbExporter\Object\Annotation
|
[
"Get",
"annotation",
"object",
"."
] |
a62b13cbf4824c05cc791034ffedf419242ba0cb
|
https://github.com/mysql-workbench-schema-exporter/doctrine2-exporter/blob/a62b13cbf4824c05cc791034ffedf419242ba0cb/lib/MwbExporter/Formatter/Doctrine2/Annotation/Model/Table.php#L117-L120
|
221,375
|
mysql-workbench-schema-exporter/doctrine2-exporter
|
lib/MwbExporter/Formatter/Doctrine2/Annotation/Model/Table.php
|
Table.getIndexesAnnotation
|
protected function getIndexesAnnotation($type = 'Index')
{
$indices = array();
foreach ($this->getTableIndices() as $index) {
switch (true) {
case $type === 'Index' && $index->isIndex():
case $type === 'UniqueConstraint' && $index->isUnique():
$columns = array();
foreach ($index->getColumns() as $column) {
$columns[] = $this->quoteIdentifier($column->getColumnName());
}
$indices[] = $this->getAnnotation($type, array('name' => $index->getName(), 'columns' => $columns));
break;
default:
break;
}
}
return count($indices) ? $indices : null;
}
|
php
|
protected function getIndexesAnnotation($type = 'Index')
{
$indices = array();
foreach ($this->getTableIndices() as $index) {
switch (true) {
case $type === 'Index' && $index->isIndex():
case $type === 'UniqueConstraint' && $index->isUnique():
$columns = array();
foreach ($index->getColumns() as $column) {
$columns[] = $this->quoteIdentifier($column->getColumnName());
}
$indices[] = $this->getAnnotation($type, array('name' => $index->getName(), 'columns' => $columns));
break;
default:
break;
}
}
return count($indices) ? $indices : null;
}
|
[
"protected",
"function",
"getIndexesAnnotation",
"(",
"$",
"type",
"=",
"'Index'",
")",
"{",
"$",
"indices",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getTableIndices",
"(",
")",
"as",
"$",
"index",
")",
"{",
"switch",
"(",
"true",
")",
"{",
"case",
"$",
"type",
"===",
"'Index'",
"&&",
"$",
"index",
"->",
"isIndex",
"(",
")",
":",
"case",
"$",
"type",
"===",
"'UniqueConstraint'",
"&&",
"$",
"index",
"->",
"isUnique",
"(",
")",
":",
"$",
"columns",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"index",
"->",
"getColumns",
"(",
")",
"as",
"$",
"column",
")",
"{",
"$",
"columns",
"[",
"]",
"=",
"$",
"this",
"->",
"quoteIdentifier",
"(",
"$",
"column",
"->",
"getColumnName",
"(",
")",
")",
";",
"}",
"$",
"indices",
"[",
"]",
"=",
"$",
"this",
"->",
"getAnnotation",
"(",
"$",
"type",
",",
"array",
"(",
"'name'",
"=>",
"$",
"index",
"->",
"getName",
"(",
")",
",",
"'columns'",
"=>",
"$",
"columns",
")",
")",
";",
"break",
";",
"default",
":",
"break",
";",
"}",
"}",
"return",
"count",
"(",
"$",
"indices",
")",
"?",
"$",
"indices",
":",
"null",
";",
"}"
] |
Get indexes annotation.
@param string $type Index annotation type, Index or UniqueConstraint
@return array|null
|
[
"Get",
"indexes",
"annotation",
"."
] |
a62b13cbf4824c05cc791034ffedf419242ba0cb
|
https://github.com/mysql-workbench-schema-exporter/doctrine2-exporter/blob/a62b13cbf4824c05cc791034ffedf419242ba0cb/lib/MwbExporter/Formatter/Doctrine2/Annotation/Model/Table.php#L128-L148
|
221,376
|
mysql-workbench-schema-exporter/doctrine2-exporter
|
lib/MwbExporter/Formatter/Doctrine2/Annotation/Model/Table.php
|
Table.getJoinAnnotation
|
public function getJoinAnnotation($joinType, $entity, $mappedBy = null, $inversedBy = null)
{
return $this->getAnnotation($joinType, array('targetEntity' => $entity, 'mappedBy' => $mappedBy, 'inversedBy' => $inversedBy));
}
|
php
|
public function getJoinAnnotation($joinType, $entity, $mappedBy = null, $inversedBy = null)
{
return $this->getAnnotation($joinType, array('targetEntity' => $entity, 'mappedBy' => $mappedBy, 'inversedBy' => $inversedBy));
}
|
[
"public",
"function",
"getJoinAnnotation",
"(",
"$",
"joinType",
",",
"$",
"entity",
",",
"$",
"mappedBy",
"=",
"null",
",",
"$",
"inversedBy",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"getAnnotation",
"(",
"$",
"joinType",
",",
"array",
"(",
"'targetEntity'",
"=>",
"$",
"entity",
",",
"'mappedBy'",
"=>",
"$",
"mappedBy",
",",
"'inversedBy'",
"=>",
"$",
"inversedBy",
")",
")",
";",
"}"
] |
Get join annotation.
@param string $joinType Join type
@param string $entity Entity name
@param string $mappedBy Column mapping
@param string $inversedBy Reverse column mapping
@return \MwbExporter\Object\Annotation
|
[
"Get",
"join",
"annotation",
"."
] |
a62b13cbf4824c05cc791034ffedf419242ba0cb
|
https://github.com/mysql-workbench-schema-exporter/doctrine2-exporter/blob/a62b13cbf4824c05cc791034ffedf419242ba0cb/lib/MwbExporter/Formatter/Doctrine2/Annotation/Model/Table.php#L159-L162
|
221,377
|
mysql-workbench-schema-exporter/doctrine2-exporter
|
lib/MwbExporter/Formatter/Doctrine2/Annotation/Model/Table.php
|
Table.getClassFileName
|
protected function getClassFileName($base = false)
{
return ($base ? $this->getTableFileName(null, array('%entity%' => 'Base'.DIRECTORY_SEPARATOR.'Base'.$this->getModelName())) : $this->getTableFileName());
}
|
php
|
protected function getClassFileName($base = false)
{
return ($base ? $this->getTableFileName(null, array('%entity%' => 'Base'.DIRECTORY_SEPARATOR.'Base'.$this->getModelName())) : $this->getTableFileName());
}
|
[
"protected",
"function",
"getClassFileName",
"(",
"$",
"base",
"=",
"false",
")",
"{",
"return",
"(",
"$",
"base",
"?",
"$",
"this",
"->",
"getTableFileName",
"(",
"null",
",",
"array",
"(",
"'%entity%'",
"=>",
"'Base'",
".",
"DIRECTORY_SEPARATOR",
".",
"'Base'",
".",
"$",
"this",
"->",
"getModelName",
"(",
")",
")",
")",
":",
"$",
"this",
"->",
"getTableFileName",
"(",
")",
")",
";",
"}"
] |
Get the generated class name.
@param bool $base
@return string
|
[
"Get",
"the",
"generated",
"class",
"name",
"."
] |
a62b13cbf4824c05cc791034ffedf419242ba0cb
|
https://github.com/mysql-workbench-schema-exporter/doctrine2-exporter/blob/a62b13cbf4824c05cc791034ffedf419242ba0cb/lib/MwbExporter/Formatter/Doctrine2/Annotation/Model/Table.php#L357-L360
|
221,378
|
mysql-workbench-schema-exporter/doctrine2-exporter
|
lib/MwbExporter/Formatter/Doctrine2/Annotation/Model/Table.php
|
Table.getUsedClasses
|
protected function getUsedClasses()
{
$uses = array();
if ($orm = $this->getOrmUse()) {
$uses[] = $orm;
}
if (count($this->getTableM2MRelations()) || count($this->getAllLocalForeignKeys())) {
$uses[] = $this->getCollectionClass();
}
return $uses;
}
|
php
|
protected function getUsedClasses()
{
$uses = array();
if ($orm = $this->getOrmUse()) {
$uses[] = $orm;
}
if (count($this->getTableM2MRelations()) || count($this->getAllLocalForeignKeys())) {
$uses[] = $this->getCollectionClass();
}
return $uses;
}
|
[
"protected",
"function",
"getUsedClasses",
"(",
")",
"{",
"$",
"uses",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"orm",
"=",
"$",
"this",
"->",
"getOrmUse",
"(",
")",
")",
"{",
"$",
"uses",
"[",
"]",
"=",
"$",
"orm",
";",
"}",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"getTableM2MRelations",
"(",
")",
")",
"||",
"count",
"(",
"$",
"this",
"->",
"getAllLocalForeignKeys",
"(",
")",
")",
")",
"{",
"$",
"uses",
"[",
"]",
"=",
"$",
"this",
"->",
"getCollectionClass",
"(",
")",
";",
"}",
"return",
"$",
"uses",
";",
"}"
] |
Get used classes.
@return array
|
[
"Get",
"used",
"classes",
"."
] |
a62b13cbf4824c05cc791034ffedf419242ba0cb
|
https://github.com/mysql-workbench-schema-exporter/doctrine2-exporter/blob/a62b13cbf4824c05cc791034ffedf419242ba0cb/lib/MwbExporter/Formatter/Doctrine2/Annotation/Model/Table.php#L429-L440
|
221,379
|
webcreate/vcs
|
src/Webcreate/Vcs/Common/Adapter/CliAdapter.php
|
CliAdapter.parse
|
protected function parse($command, array $arguments = array(), $output)
{
if (null !== $this->parser) {
return $this->parser->parse($command, $arguments, $output);
}
return $output;
}
|
php
|
protected function parse($command, array $arguments = array(), $output)
{
if (null !== $this->parser) {
return $this->parser->parse($command, $arguments, $output);
}
return $output;
}
|
[
"protected",
"function",
"parse",
"(",
"$",
"command",
",",
"array",
"$",
"arguments",
"=",
"array",
"(",
")",
",",
"$",
"output",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"parser",
")",
"{",
"return",
"$",
"this",
"->",
"parser",
"->",
"parse",
"(",
"$",
"command",
",",
"$",
"arguments",
",",
"$",
"output",
")",
";",
"}",
"return",
"$",
"output",
";",
"}"
] |
Delegate output to output parser when a parser is set,
otherwise returns the raw output
@param string $command
@param array $arguments
@param string $output
@return mixed
|
[
"Delegate",
"output",
"to",
"output",
"parser",
"when",
"a",
"parser",
"is",
"set",
"otherwise",
"returns",
"the",
"raw",
"output"
] |
31a680f2501c4e5a599e8dd3ffbc8c0a5185c8ad
|
https://github.com/webcreate/vcs/blob/31a680f2501c4e5a599e8dd3ffbc8c0a5185c8ad/src/Webcreate/Vcs/Common/Adapter/CliAdapter.php#L192-L199
|
221,380
|
mysql-workbench-schema-exporter/doctrine2-exporter
|
lib/MwbExporter/Formatter/Doctrine2/Yaml/Model/Table.php
|
Table.getJoins
|
protected function getJoins(ForeignKey $fkey, $owningSide = true)
{
$joins = array();
$lcols = $owningSide ? $fkey->getForeigns() : $fkey->getLocals();
$fcols = $owningSide ? $fkey->getLocals() : $fkey->getForeigns();
$onDelete = $this->getFormatter()->getDeleteRule($fkey->getParameters()->get('deleteRule'));
for ($i = 0; $i < count($lcols); $i++) {
$joins[] = array(
'name' => $lcols[$i]->getColumnName(),
'referencedColumnName' => $fcols[$i]->getColumnName(),
'nullable' => $lcols[$i]->getNullableValue(),
'onDelete' => $onDelete,
);
}
return count($joins) > 1 ? array('joinColumns' => $this->convertJoinColumns($joins)) : array('joinColumn' => $joins[0]);
}
|
php
|
protected function getJoins(ForeignKey $fkey, $owningSide = true)
{
$joins = array();
$lcols = $owningSide ? $fkey->getForeigns() : $fkey->getLocals();
$fcols = $owningSide ? $fkey->getLocals() : $fkey->getForeigns();
$onDelete = $this->getFormatter()->getDeleteRule($fkey->getParameters()->get('deleteRule'));
for ($i = 0; $i < count($lcols); $i++) {
$joins[] = array(
'name' => $lcols[$i]->getColumnName(),
'referencedColumnName' => $fcols[$i]->getColumnName(),
'nullable' => $lcols[$i]->getNullableValue(),
'onDelete' => $onDelete,
);
}
return count($joins) > 1 ? array('joinColumns' => $this->convertJoinColumns($joins)) : array('joinColumn' => $joins[0]);
}
|
[
"protected",
"function",
"getJoins",
"(",
"ForeignKey",
"$",
"fkey",
",",
"$",
"owningSide",
"=",
"true",
")",
"{",
"$",
"joins",
"=",
"array",
"(",
")",
";",
"$",
"lcols",
"=",
"$",
"owningSide",
"?",
"$",
"fkey",
"->",
"getForeigns",
"(",
")",
":",
"$",
"fkey",
"->",
"getLocals",
"(",
")",
";",
"$",
"fcols",
"=",
"$",
"owningSide",
"?",
"$",
"fkey",
"->",
"getLocals",
"(",
")",
":",
"$",
"fkey",
"->",
"getForeigns",
"(",
")",
";",
"$",
"onDelete",
"=",
"$",
"this",
"->",
"getFormatter",
"(",
")",
"->",
"getDeleteRule",
"(",
"$",
"fkey",
"->",
"getParameters",
"(",
")",
"->",
"get",
"(",
"'deleteRule'",
")",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"count",
"(",
"$",
"lcols",
")",
";",
"$",
"i",
"++",
")",
"{",
"$",
"joins",
"[",
"]",
"=",
"array",
"(",
"'name'",
"=>",
"$",
"lcols",
"[",
"$",
"i",
"]",
"->",
"getColumnName",
"(",
")",
",",
"'referencedColumnName'",
"=>",
"$",
"fcols",
"[",
"$",
"i",
"]",
"->",
"getColumnName",
"(",
")",
",",
"'nullable'",
"=>",
"$",
"lcols",
"[",
"$",
"i",
"]",
"->",
"getNullableValue",
"(",
")",
",",
"'onDelete'",
"=>",
"$",
"onDelete",
",",
")",
";",
"}",
"return",
"count",
"(",
"$",
"joins",
")",
">",
"1",
"?",
"array",
"(",
"'joinColumns'",
"=>",
"$",
"this",
"->",
"convertJoinColumns",
"(",
"$",
"joins",
")",
")",
":",
"array",
"(",
"'joinColumn'",
"=>",
"$",
"joins",
"[",
"0",
"]",
")",
";",
"}"
] |
Get foreign key join descriptor.
@param \MwbExporter\Model\ForeignKey $fkey Foreign key
@param string $owningSide Is join for owning side or vice versa
@return array
|
[
"Get",
"foreign",
"key",
"join",
"descriptor",
"."
] |
a62b13cbf4824c05cc791034ffedf419242ba0cb
|
https://github.com/mysql-workbench-schema-exporter/doctrine2-exporter/blob/a62b13cbf4824c05cc791034ffedf419242ba0cb/lib/MwbExporter/Formatter/Doctrine2/Yaml/Model/Table.php#L322-L338
|
221,381
|
webcreate/vcs
|
src/Webcreate/Vcs/Git.php
|
Git.checkout
|
public function checkout($dest = null)
{
$temporary = $this->isTemporary;
if (true === is_null($dest)) {
$realdest = $this->cwd;
} else {
$realdest = $dest;
}
$head = $this->getHead();
$branch = $head->getName();
$this->dispatch(VcsEvents::PRE_CHECKOUT, new CheckoutEventData($head, $realdest));
if (false === $this->hasClone || false === is_null($dest)) {
$this->cloneRepository($dest);
} else {
$this->fetch();
$result = $this->execute('checkout', array((string) $branch));
}
$this->hasCheckout = true;
$result = $this->pull('origin', $branch);
$this->dispatch(VcsEvents::POST_CHECKOUT, new CheckoutEventData($head, $realdest));
}
|
php
|
public function checkout($dest = null)
{
$temporary = $this->isTemporary;
if (true === is_null($dest)) {
$realdest = $this->cwd;
} else {
$realdest = $dest;
}
$head = $this->getHead();
$branch = $head->getName();
$this->dispatch(VcsEvents::PRE_CHECKOUT, new CheckoutEventData($head, $realdest));
if (false === $this->hasClone || false === is_null($dest)) {
$this->cloneRepository($dest);
} else {
$this->fetch();
$result = $this->execute('checkout', array((string) $branch));
}
$this->hasCheckout = true;
$result = $this->pull('origin', $branch);
$this->dispatch(VcsEvents::POST_CHECKOUT, new CheckoutEventData($head, $realdest));
}
|
[
"public",
"function",
"checkout",
"(",
"$",
"dest",
"=",
"null",
")",
"{",
"$",
"temporary",
"=",
"$",
"this",
"->",
"isTemporary",
";",
"if",
"(",
"true",
"===",
"is_null",
"(",
"$",
"dest",
")",
")",
"{",
"$",
"realdest",
"=",
"$",
"this",
"->",
"cwd",
";",
"}",
"else",
"{",
"$",
"realdest",
"=",
"$",
"dest",
";",
"}",
"$",
"head",
"=",
"$",
"this",
"->",
"getHead",
"(",
")",
";",
"$",
"branch",
"=",
"$",
"head",
"->",
"getName",
"(",
")",
";",
"$",
"this",
"->",
"dispatch",
"(",
"VcsEvents",
"::",
"PRE_CHECKOUT",
",",
"new",
"CheckoutEventData",
"(",
"$",
"head",
",",
"$",
"realdest",
")",
")",
";",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"hasClone",
"||",
"false",
"===",
"is_null",
"(",
"$",
"dest",
")",
")",
"{",
"$",
"this",
"->",
"cloneRepository",
"(",
"$",
"dest",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"fetch",
"(",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"execute",
"(",
"'checkout'",
",",
"array",
"(",
"(",
"string",
")",
"$",
"branch",
")",
")",
";",
"}",
"$",
"this",
"->",
"hasCheckout",
"=",
"true",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"pull",
"(",
"'origin'",
",",
"$",
"branch",
")",
";",
"$",
"this",
"->",
"dispatch",
"(",
"VcsEvents",
"::",
"POST_CHECKOUT",
",",
"new",
"CheckoutEventData",
"(",
"$",
"head",
",",
"$",
"realdest",
")",
")",
";",
"}"
] |
Perform a clone operation
@param string|null $dest
|
[
"Perform",
"a",
"clone",
"operation"
] |
31a680f2501c4e5a599e8dd3ffbc8c0a5185c8ad
|
https://github.com/webcreate/vcs/blob/31a680f2501c4e5a599e8dd3ffbc8c0a5185c8ad/src/Webcreate/Vcs/Git.php#L71-L99
|
221,382
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/RPCPool.php
|
RPCPool.get
|
public function get()
{
$rpc = null;
if ($this->count > 0) {
$rpc = $this->items[$this->index];
if (++$this->index > $this->count - 1) {
$this->index = 0;
}
}
return $rpc;
}
|
php
|
public function get()
{
$rpc = null;
if ($this->count > 0) {
$rpc = $this->items[$this->index];
if (++$this->index > $this->count - 1) {
$this->index = 0;
}
}
return $rpc;
}
|
[
"public",
"function",
"get",
"(",
")",
"{",
"$",
"rpc",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"count",
">",
"0",
")",
"{",
"$",
"rpc",
"=",
"$",
"this",
"->",
"items",
"[",
"$",
"this",
"->",
"index",
"]",
";",
"if",
"(",
"++",
"$",
"this",
"->",
"index",
">",
"$",
"this",
"->",
"count",
"-",
"1",
")",
"{",
"$",
"this",
"->",
"index",
"=",
"0",
";",
"}",
"}",
"return",
"$",
"rpc",
";",
"}"
] |
Returns an JsonRPCInterface instance from the pool
Returns null when there are no servers in the pool.
@return JsonRPCInterface|null
|
[
"Returns",
"an",
"JsonRPCInterface",
"instance",
"from",
"the",
"pool"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/RPCPool.php#L75-L86
|
221,383
|
mdmsoft/yii2-ar-behaviors
|
RelationBehavior.php
|
RelationBehavior.hasRelatedErrors
|
public function hasRelatedErrors($relationName = null)
{
if ($relationName === null) {
foreach ($this->_relatedErrors as $errors) {
if (!empty($errors)) {
return true;
}
}
return false;
} else {
return !empty($this->_relatedErrors[$relationName]);
}
}
|
php
|
public function hasRelatedErrors($relationName = null)
{
if ($relationName === null) {
foreach ($this->_relatedErrors as $errors) {
if (!empty($errors)) {
return true;
}
}
return false;
} else {
return !empty($this->_relatedErrors[$relationName]);
}
}
|
[
"public",
"function",
"hasRelatedErrors",
"(",
"$",
"relationName",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"relationName",
"===",
"null",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_relatedErrors",
"as",
"$",
"errors",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"errors",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}",
"else",
"{",
"return",
"!",
"empty",
"(",
"$",
"this",
"->",
"_relatedErrors",
"[",
"$",
"relationName",
"]",
")",
";",
"}",
"}"
] |
Check if relation has error.
@param string $relationName
@return boolean
|
[
"Check",
"if",
"relation",
"has",
"error",
"."
] |
16985ebe3fdf9cd67b0c58900adccbe816c16dc3
|
https://github.com/mdmsoft/yii2-ar-behaviors/blob/16985ebe3fdf9cd67b0c58900adccbe816c16dc3/RelationBehavior.php#L355-L367
|
221,384
|
mysql-workbench-schema-exporter/doctrine2-exporter
|
lib/MwbExporter/Formatter/Doctrine2/Model/Table.php
|
Table.getEntityNamespace
|
public function getEntityNamespace()
{
$namespace = '';
if (($bundleNamespace = $this->parseComment('bundleNamespace')) || ($bundleNamespace = $this->getConfig()->get(Formatter::CFG_BUNDLE_NAMESPACE))) {
$namespace = $bundleNamespace.'\\';
}
if ($entityNamespace = $this->getConfig()->get(Formatter::CFG_ENTITY_NAMESPACE)) {
$namespace .= $entityNamespace;
} else {
$namespace .= 'Entity';
}
return $namespace;
}
|
php
|
public function getEntityNamespace()
{
$namespace = '';
if (($bundleNamespace = $this->parseComment('bundleNamespace')) || ($bundleNamespace = $this->getConfig()->get(Formatter::CFG_BUNDLE_NAMESPACE))) {
$namespace = $bundleNamespace.'\\';
}
if ($entityNamespace = $this->getConfig()->get(Formatter::CFG_ENTITY_NAMESPACE)) {
$namespace .= $entityNamespace;
} else {
$namespace .= 'Entity';
}
return $namespace;
}
|
[
"public",
"function",
"getEntityNamespace",
"(",
")",
"{",
"$",
"namespace",
"=",
"''",
";",
"if",
"(",
"(",
"$",
"bundleNamespace",
"=",
"$",
"this",
"->",
"parseComment",
"(",
"'bundleNamespace'",
")",
")",
"||",
"(",
"$",
"bundleNamespace",
"=",
"$",
"this",
"->",
"getConfig",
"(",
")",
"->",
"get",
"(",
"Formatter",
"::",
"CFG_BUNDLE_NAMESPACE",
")",
")",
")",
"{",
"$",
"namespace",
"=",
"$",
"bundleNamespace",
".",
"'\\\\'",
";",
"}",
"if",
"(",
"$",
"entityNamespace",
"=",
"$",
"this",
"->",
"getConfig",
"(",
")",
"->",
"get",
"(",
"Formatter",
"::",
"CFG_ENTITY_NAMESPACE",
")",
")",
"{",
"$",
"namespace",
".=",
"$",
"entityNamespace",
";",
"}",
"else",
"{",
"$",
"namespace",
".=",
"'Entity'",
";",
"}",
"return",
"$",
"namespace",
";",
"}"
] |
Get the entity namespace.
@return string
|
[
"Get",
"the",
"entity",
"namespace",
"."
] |
a62b13cbf4824c05cc791034ffedf419242ba0cb
|
https://github.com/mysql-workbench-schema-exporter/doctrine2-exporter/blob/a62b13cbf4824c05cc791034ffedf419242ba0cb/lib/MwbExporter/Formatter/Doctrine2/Model/Table.php#L40-L53
|
221,385
|
mysql-workbench-schema-exporter/doctrine2-exporter
|
lib/MwbExporter/Formatter/Doctrine2/Model/Table.php
|
Table.getNamespace
|
public function getNamespace($class = null, $absolute = true, $base = false)
{
return sprintf(
'%s%s\%s',
$absolute ? '\\' : '',
$base ? $this->getBaseEntityNamespace() : $this->getEntityNamespace(),
null === $class ? $this->getModelName() : $class
);
}
|
php
|
public function getNamespace($class = null, $absolute = true, $base = false)
{
return sprintf(
'%s%s\%s',
$absolute ? '\\' : '',
$base ? $this->getBaseEntityNamespace() : $this->getEntityNamespace(),
null === $class ? $this->getModelName() : $class
);
}
|
[
"public",
"function",
"getNamespace",
"(",
"$",
"class",
"=",
"null",
",",
"$",
"absolute",
"=",
"true",
",",
"$",
"base",
"=",
"false",
")",
"{",
"return",
"sprintf",
"(",
"'%s%s\\%s'",
",",
"$",
"absolute",
"?",
"'\\\\'",
":",
"''",
",",
"$",
"base",
"?",
"$",
"this",
"->",
"getBaseEntityNamespace",
"(",
")",
":",
"$",
"this",
"->",
"getEntityNamespace",
"(",
")",
",",
"null",
"===",
"$",
"class",
"?",
"$",
"this",
"->",
"getModelName",
"(",
")",
":",
"$",
"class",
")",
";",
"}"
] |
Get namespace of a class.
@param string $class The class name
@return string
|
[
"Get",
"namespace",
"of",
"a",
"class",
"."
] |
a62b13cbf4824c05cc791034ffedf419242ba0cb
|
https://github.com/mysql-workbench-schema-exporter/doctrine2-exporter/blob/a62b13cbf4824c05cc791034ffedf419242ba0cb/lib/MwbExporter/Formatter/Doctrine2/Model/Table.php#L76-L84
|
221,386
|
mysql-workbench-schema-exporter/doctrine2-exporter
|
lib/MwbExporter/Formatter/Doctrine2/Model/Table.php
|
Table.getModelNameAsFQCN
|
public function getModelNameAsFQCN($referenceNamespace = null)
{
$namespace = $this->getEntityNamespace();
$fqcn = ($namespace == $referenceNamespace) ? false : true;
return $fqcn ? $namespace.'\\'.$this->getModelName() : $this->getModelName();
}
|
php
|
public function getModelNameAsFQCN($referenceNamespace = null)
{
$namespace = $this->getEntityNamespace();
$fqcn = ($namespace == $referenceNamespace) ? false : true;
return $fqcn ? $namespace.'\\'.$this->getModelName() : $this->getModelName();
}
|
[
"public",
"function",
"getModelNameAsFQCN",
"(",
"$",
"referenceNamespace",
"=",
"null",
")",
"{",
"$",
"namespace",
"=",
"$",
"this",
"->",
"getEntityNamespace",
"(",
")",
";",
"$",
"fqcn",
"=",
"(",
"$",
"namespace",
"==",
"$",
"referenceNamespace",
")",
"?",
"false",
":",
"true",
";",
"return",
"$",
"fqcn",
"?",
"$",
"namespace",
".",
"'\\\\'",
".",
"$",
"this",
"->",
"getModelName",
"(",
")",
":",
"$",
"this",
"->",
"getModelName",
"(",
")",
";",
"}"
] |
Get Model Name in FQCN format. If reference namespace is suplied and the entity namespace
is equal then relative model name returned instead.
@param string $referenceNamespace The reference namespace
@return string
|
[
"Get",
"Model",
"Name",
"in",
"FQCN",
"format",
".",
"If",
"reference",
"namespace",
"is",
"suplied",
"and",
"the",
"entity",
"namespace",
"is",
"equal",
"then",
"relative",
"model",
"name",
"returned",
"instead",
"."
] |
a62b13cbf4824c05cc791034ffedf419242ba0cb
|
https://github.com/mysql-workbench-schema-exporter/doctrine2-exporter/blob/a62b13cbf4824c05cc791034ffedf419242ba0cb/lib/MwbExporter/Formatter/Doctrine2/Model/Table.php#L93-L99
|
221,387
|
mysql-workbench-schema-exporter/doctrine2-exporter
|
lib/MwbExporter/Formatter/Doctrine2/Model/Table.php
|
Table.getLifecycleCallbacks
|
public function getLifecycleCallbacks()
{
$result = array();
if ($lifecycleCallbacks = trim($this->parseComment('lifecycleCallbacks'))) {
foreach (explode("\n", $lifecycleCallbacks) as $callback) {
list($method, $handler) = explode(':', $callback, 2);
$method = lcfirst(trim($method));
if (!in_array($method, array('postLoad', 'prePersist', 'postPersist', 'preRemove', 'postRemove', 'preUpdate', 'postUpdate'))) {
continue;
}
if (!isset($result[$method])) {
$result[$method] = array();
}
$result[$method][] = trim($handler);
}
}
return $result;
}
|
php
|
public function getLifecycleCallbacks()
{
$result = array();
if ($lifecycleCallbacks = trim($this->parseComment('lifecycleCallbacks'))) {
foreach (explode("\n", $lifecycleCallbacks) as $callback) {
list($method, $handler) = explode(':', $callback, 2);
$method = lcfirst(trim($method));
if (!in_array($method, array('postLoad', 'prePersist', 'postPersist', 'preRemove', 'postRemove', 'preUpdate', 'postUpdate'))) {
continue;
}
if (!isset($result[$method])) {
$result[$method] = array();
}
$result[$method][] = trim($handler);
}
}
return $result;
}
|
[
"public",
"function",
"getLifecycleCallbacks",
"(",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"lifecycleCallbacks",
"=",
"trim",
"(",
"$",
"this",
"->",
"parseComment",
"(",
"'lifecycleCallbacks'",
")",
")",
")",
"{",
"foreach",
"(",
"explode",
"(",
"\"\\n\"",
",",
"$",
"lifecycleCallbacks",
")",
"as",
"$",
"callback",
")",
"{",
"list",
"(",
"$",
"method",
",",
"$",
"handler",
")",
"=",
"explode",
"(",
"':'",
",",
"$",
"callback",
",",
"2",
")",
";",
"$",
"method",
"=",
"lcfirst",
"(",
"trim",
"(",
"$",
"method",
")",
")",
";",
"if",
"(",
"!",
"in_array",
"(",
"$",
"method",
",",
"array",
"(",
"'postLoad'",
",",
"'prePersist'",
",",
"'postPersist'",
",",
"'preRemove'",
",",
"'postRemove'",
",",
"'preUpdate'",
",",
"'postUpdate'",
")",
")",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
"$",
"result",
"[",
"$",
"method",
"]",
")",
")",
"{",
"$",
"result",
"[",
"$",
"method",
"]",
"=",
"array",
"(",
")",
";",
"}",
"$",
"result",
"[",
"$",
"method",
"]",
"[",
"]",
"=",
"trim",
"(",
"$",
"handler",
")",
";",
"}",
"}",
"return",
"$",
"result",
";",
"}"
] |
Get lifecycleCallbacks.
@return array
|
[
"Get",
"lifecycleCallbacks",
"."
] |
a62b13cbf4824c05cc791034ffedf419242ba0cb
|
https://github.com/mysql-workbench-schema-exporter/doctrine2-exporter/blob/a62b13cbf4824c05cc791034ffedf419242ba0cb/lib/MwbExporter/Formatter/Doctrine2/Model/Table.php#L106-L124
|
221,388
|
mysql-workbench-schema-exporter/doctrine2-exporter
|
lib/MwbExporter/Formatter/Doctrine2/Model/Table.php
|
Table.getRelatedVarName
|
public function getRelatedVarName($name, $related = null, $plural = false)
{
/**
* if $name does not match the current ModelName (in case a relation column), check if the table comment includes the `relatedNames` tag
* and parse that to see if for $name was provided a custom value
*/
$nameFromCommentTag = '';
$relatedNames = trim($this->parseComment('relatedNames'));
if ('' !== $relatedNames) {
foreach (explode("\n", $relatedNames) as $relationMap) {
list($toChange, $replacement) = explode(':', $relationMap, 2);
if ($name === $toChange) {
$nameFromCommentTag = $replacement;
break;
}
}
}
if ($nameFromCommentTag) {
$name = $nameFromCommentTag;
}
else {
$name = $related ? strtr($this->getConfig()->get(Formatter::CFG_RELATED_VAR_NAME_FORMAT), array('%name%' => $name, '%related%' => $related)) : $name;
}
return $plural ? Inflector::pluralize($name) : $name;
}
|
php
|
public function getRelatedVarName($name, $related = null, $plural = false)
{
/**
* if $name does not match the current ModelName (in case a relation column), check if the table comment includes the `relatedNames` tag
* and parse that to see if for $name was provided a custom value
*/
$nameFromCommentTag = '';
$relatedNames = trim($this->parseComment('relatedNames'));
if ('' !== $relatedNames) {
foreach (explode("\n", $relatedNames) as $relationMap) {
list($toChange, $replacement) = explode(':', $relationMap, 2);
if ($name === $toChange) {
$nameFromCommentTag = $replacement;
break;
}
}
}
if ($nameFromCommentTag) {
$name = $nameFromCommentTag;
}
else {
$name = $related ? strtr($this->getConfig()->get(Formatter::CFG_RELATED_VAR_NAME_FORMAT), array('%name%' => $name, '%related%' => $related)) : $name;
}
return $plural ? Inflector::pluralize($name) : $name;
}
|
[
"public",
"function",
"getRelatedVarName",
"(",
"$",
"name",
",",
"$",
"related",
"=",
"null",
",",
"$",
"plural",
"=",
"false",
")",
"{",
"/**\n * if $name does not match the current ModelName (in case a relation column), check if the table comment includes the `relatedNames` tag\n * and parse that to see if for $name was provided a custom value\n */",
"$",
"nameFromCommentTag",
"=",
"''",
";",
"$",
"relatedNames",
"=",
"trim",
"(",
"$",
"this",
"->",
"parseComment",
"(",
"'relatedNames'",
")",
")",
";",
"if",
"(",
"''",
"!==",
"$",
"relatedNames",
")",
"{",
"foreach",
"(",
"explode",
"(",
"\"\\n\"",
",",
"$",
"relatedNames",
")",
"as",
"$",
"relationMap",
")",
"{",
"list",
"(",
"$",
"toChange",
",",
"$",
"replacement",
")",
"=",
"explode",
"(",
"':'",
",",
"$",
"relationMap",
",",
"2",
")",
";",
"if",
"(",
"$",
"name",
"===",
"$",
"toChange",
")",
"{",
"$",
"nameFromCommentTag",
"=",
"$",
"replacement",
";",
"break",
";",
"}",
"}",
"}",
"if",
"(",
"$",
"nameFromCommentTag",
")",
"{",
"$",
"name",
"=",
"$",
"nameFromCommentTag",
";",
"}",
"else",
"{",
"$",
"name",
"=",
"$",
"related",
"?",
"strtr",
"(",
"$",
"this",
"->",
"getConfig",
"(",
")",
"->",
"get",
"(",
"Formatter",
"::",
"CFG_RELATED_VAR_NAME_FORMAT",
")",
",",
"array",
"(",
"'%name%'",
"=>",
"$",
"name",
",",
"'%related%'",
"=>",
"$",
"related",
")",
")",
":",
"$",
"name",
";",
"}",
"return",
"$",
"plural",
"?",
"Inflector",
"::",
"pluralize",
"(",
"$",
"name",
")",
":",
"$",
"name",
";",
"}"
] |
Get identifier name formatting.
@param string $name Identifier name
@param string $related Related name
@param string $plural Return plural form
@return string
|
[
"Get",
"identifier",
"name",
"formatting",
"."
] |
a62b13cbf4824c05cc791034ffedf419242ba0cb
|
https://github.com/mysql-workbench-schema-exporter/doctrine2-exporter/blob/a62b13cbf4824c05cc791034ffedf419242ba0cb/lib/MwbExporter/Formatter/Doctrine2/Model/Table.php#L134-L161
|
221,389
|
webcreate/vcs
|
src/Webcreate/Vcs/Svn.php
|
Svn.add
|
public function add($path)
{
if (null === $this->wc) {
throw new \RuntimeException('Working copy not initialized, have you tried checkout()?');
}
return $this->wc->add($path);
}
|
php
|
public function add($path)
{
if (null === $this->wc) {
throw new \RuntimeException('Working copy not initialized, have you tried checkout()?');
}
return $this->wc->add($path);
}
|
[
"public",
"function",
"add",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"wc",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'Working copy not initialized, have you tried checkout()?'",
")",
";",
"}",
"return",
"$",
"this",
"->",
"wc",
"->",
"add",
"(",
"$",
"path",
")",
";",
"}"
] |
Add to version control
@param string $path
@throws \RuntimeException
@return string
|
[
"Add",
"to",
"version",
"control"
] |
31a680f2501c4e5a599e8dd3ffbc8c0a5185c8ad
|
https://github.com/webcreate/vcs/blob/31a680f2501c4e5a599e8dd3ffbc8c0a5185c8ad/src/Webcreate/Vcs/Svn.php#L55-L62
|
221,390
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/JsonRPC.php
|
JsonRPC.exec
|
protected function exec($query)
{
if (!$query) {
throw new Exceptions\RPCException("Empty query.");
}
$url = sprintf("http://%s:%d", $this->conf["host"], $this->conf["port"]);
$web = $this->getWebClient();
$web->setMethod(HttpMethods::POST);
$web->addHeader("Content-Type", "application/json");
$web->setBasicAuth($this->conf["user"], $this->conf["pass"]);
$web->setData($query);
$response = $web->request($url);
$status_code = $response->getCode();
if (isset(self::$exceptions[$status_code])) {
$error = $this->getResponseError($response, $status_code);
throw new self::$exceptions[$status_code](
$error["message"],
$error["code"]
);
}
return $response;
}
|
php
|
protected function exec($query)
{
if (!$query) {
throw new Exceptions\RPCException("Empty query.");
}
$url = sprintf("http://%s:%d", $this->conf["host"], $this->conf["port"]);
$web = $this->getWebClient();
$web->setMethod(HttpMethods::POST);
$web->addHeader("Content-Type", "application/json");
$web->setBasicAuth($this->conf["user"], $this->conf["pass"]);
$web->setData($query);
$response = $web->request($url);
$status_code = $response->getCode();
if (isset(self::$exceptions[$status_code])) {
$error = $this->getResponseError($response, $status_code);
throw new self::$exceptions[$status_code](
$error["message"],
$error["code"]
);
}
return $response;
}
|
[
"protected",
"function",
"exec",
"(",
"$",
"query",
")",
"{",
"if",
"(",
"!",
"$",
"query",
")",
"{",
"throw",
"new",
"Exceptions",
"\\",
"RPCException",
"(",
"\"Empty query.\"",
")",
";",
"}",
"$",
"url",
"=",
"sprintf",
"(",
"\"http://%s:%d\"",
",",
"$",
"this",
"->",
"conf",
"[",
"\"host\"",
"]",
",",
"$",
"this",
"->",
"conf",
"[",
"\"port\"",
"]",
")",
";",
"$",
"web",
"=",
"$",
"this",
"->",
"getWebClient",
"(",
")",
";",
"$",
"web",
"->",
"setMethod",
"(",
"HttpMethods",
"::",
"POST",
")",
";",
"$",
"web",
"->",
"addHeader",
"(",
"\"Content-Type\"",
",",
"\"application/json\"",
")",
";",
"$",
"web",
"->",
"setBasicAuth",
"(",
"$",
"this",
"->",
"conf",
"[",
"\"user\"",
"]",
",",
"$",
"this",
"->",
"conf",
"[",
"\"pass\"",
"]",
")",
";",
"$",
"web",
"->",
"setData",
"(",
"$",
"query",
")",
";",
"$",
"response",
"=",
"$",
"web",
"->",
"request",
"(",
"$",
"url",
")",
";",
"$",
"status_code",
"=",
"$",
"response",
"->",
"getCode",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"exceptions",
"[",
"$",
"status_code",
"]",
")",
")",
"{",
"$",
"error",
"=",
"$",
"this",
"->",
"getResponseError",
"(",
"$",
"response",
",",
"$",
"status_code",
")",
";",
"throw",
"new",
"self",
"::",
"$",
"exceptions",
"[",
"$",
"status_code",
"]",
"(",
"$",
"error",
"[",
"\"message\"",
"]",
",",
"$",
"error",
"[",
"\"code\"",
"]",
")",
";",
"}",
"return",
"$",
"response",
";",
"}"
] |
Sends the query string to the server and returns the response
@param string $query The query string to send
@return WebResponse
@throws Exceptions\RPCException
|
[
"Sends",
"the",
"query",
"string",
"to",
"the",
"server",
"and",
"returns",
"the",
"response"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/JsonRPC.php#L186-L210
|
221,391
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/JsonRPC.php
|
JsonRPC.getResponseError
|
protected function getResponseError(WebResponse $response)
{
$error = [
"message" => "",
"code" => 0
];
$response_text = $response->getBody();
$obj = json_decode($response_text, true);
if (!$obj) {
if (stripos($response_text, "<H1>401 Unauthorized.</H1>") !== false) {
$error["message"] = "Unauthorized";
$error["code"] = RPCErrorCodes::WALLET_PASSPHRASE_INCORRECT;
} else if (strpos($response_text, "<?xml") !== false) {
$xml = simplexml_load_string($response_text);
if ($xml && isset($xml->body->p[0])) {
$error["message"] = trim((string)$xml->body->p[0]);
$error["message"] = preg_replace("/[\\n\\r]/", "", $error["message"]);
$error["message"] = preg_replace("/\\s{2,}/", " ", $error["message"]);
$error["code"] = $response->getCode();
} else {
$error["message"] = $response_text;
$error["code"] = $response->getCode();
}
}
} else if (!empty($obj["error"])) {
$error = $obj["error"];
}
return $error;
}
|
php
|
protected function getResponseError(WebResponse $response)
{
$error = [
"message" => "",
"code" => 0
];
$response_text = $response->getBody();
$obj = json_decode($response_text, true);
if (!$obj) {
if (stripos($response_text, "<H1>401 Unauthorized.</H1>") !== false) {
$error["message"] = "Unauthorized";
$error["code"] = RPCErrorCodes::WALLET_PASSPHRASE_INCORRECT;
} else if (strpos($response_text, "<?xml") !== false) {
$xml = simplexml_load_string($response_text);
if ($xml && isset($xml->body->p[0])) {
$error["message"] = trim((string)$xml->body->p[0]);
$error["message"] = preg_replace("/[\\n\\r]/", "", $error["message"]);
$error["message"] = preg_replace("/\\s{2,}/", " ", $error["message"]);
$error["code"] = $response->getCode();
} else {
$error["message"] = $response_text;
$error["code"] = $response->getCode();
}
}
} else if (!empty($obj["error"])) {
$error = $obj["error"];
}
return $error;
}
|
[
"protected",
"function",
"getResponseError",
"(",
"WebResponse",
"$",
"response",
")",
"{",
"$",
"error",
"=",
"[",
"\"message\"",
"=>",
"\"\"",
",",
"\"code\"",
"=>",
"0",
"]",
";",
"$",
"response_text",
"=",
"$",
"response",
"->",
"getBody",
"(",
")",
";",
"$",
"obj",
"=",
"json_decode",
"(",
"$",
"response_text",
",",
"true",
")",
";",
"if",
"(",
"!",
"$",
"obj",
")",
"{",
"if",
"(",
"stripos",
"(",
"$",
"response_text",
",",
"\"<H1>401 Unauthorized.</H1>\"",
")",
"!==",
"false",
")",
"{",
"$",
"error",
"[",
"\"message\"",
"]",
"=",
"\"Unauthorized\"",
";",
"$",
"error",
"[",
"\"code\"",
"]",
"=",
"RPCErrorCodes",
"::",
"WALLET_PASSPHRASE_INCORRECT",
";",
"}",
"else",
"if",
"(",
"strpos",
"(",
"$",
"response_text",
",",
"\"<?xml\"",
")",
"!==",
"false",
")",
"{",
"$",
"xml",
"=",
"simplexml_load_string",
"(",
"$",
"response_text",
")",
";",
"if",
"(",
"$",
"xml",
"&&",
"isset",
"(",
"$",
"xml",
"->",
"body",
"->",
"p",
"[",
"0",
"]",
")",
")",
"{",
"$",
"error",
"[",
"\"message\"",
"]",
"=",
"trim",
"(",
"(",
"string",
")",
"$",
"xml",
"->",
"body",
"->",
"p",
"[",
"0",
"]",
")",
";",
"$",
"error",
"[",
"\"message\"",
"]",
"=",
"preg_replace",
"(",
"\"/[\\\\n\\\\r]/\"",
",",
"\"\"",
",",
"$",
"error",
"[",
"\"message\"",
"]",
")",
";",
"$",
"error",
"[",
"\"message\"",
"]",
"=",
"preg_replace",
"(",
"\"/\\\\s{2,}/\"",
",",
"\" \"",
",",
"$",
"error",
"[",
"\"message\"",
"]",
")",
";",
"$",
"error",
"[",
"\"code\"",
"]",
"=",
"$",
"response",
"->",
"getCode",
"(",
")",
";",
"}",
"else",
"{",
"$",
"error",
"[",
"\"message\"",
"]",
"=",
"$",
"response_text",
";",
"$",
"error",
"[",
"\"code\"",
"]",
"=",
"$",
"response",
"->",
"getCode",
"(",
")",
";",
"}",
"}",
"}",
"else",
"if",
"(",
"!",
"empty",
"(",
"$",
"obj",
"[",
"\"error\"",
"]",
")",
")",
"{",
"$",
"error",
"=",
"$",
"obj",
"[",
"\"error\"",
"]",
";",
"}",
"return",
"$",
"error",
";",
"}"
] |
Creates an array of error information based on the server response
The Bitcoin api is a real mess. For some errors the server responds with a json encoded string.
For other errors an html string is returned, but the format of the html varies depending on
the error. Some of the html is well formatted, and can be parsed with SimpleXML, and other html
strings are not well formatted.
This method attempts to parse the various error responses, and returns an array with the keys:
```
"message" - (string) A message describing the error
"code" - (int) An error code
```
Returns `["message" => "", "code" => 0]` when there is no error.
@param WebResponse $response The server response
@return array
|
[
"Creates",
"an",
"array",
"of",
"error",
"information",
"based",
"on",
"the",
"server",
"response"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/JsonRPC.php#L231-L261
|
221,392
|
headzoo/bitcoin-wallet-api
|
src/Headzoo/Bitcoin/Wallet/Api/JsonRPC.php
|
JsonRPC.getNonceValue
|
protected function getNonceValue()
{
if (null === $this->nonce) {
$this->nonce = new Nonce();
}
return $this->nonce->generate();
}
|
php
|
protected function getNonceValue()
{
if (null === $this->nonce) {
$this->nonce = new Nonce();
}
return $this->nonce->generate();
}
|
[
"protected",
"function",
"getNonceValue",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"nonce",
")",
"{",
"$",
"this",
"->",
"nonce",
"=",
"new",
"Nonce",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"nonce",
"->",
"generate",
"(",
")",
";",
"}"
] |
Generates and returns a nonce value for use as a request id
@return string
|
[
"Generates",
"and",
"returns",
"a",
"nonce",
"value",
"for",
"use",
"as",
"a",
"request",
"id"
] |
f9bbec54be581356f36b5084b50037845a6d00c3
|
https://github.com/headzoo/bitcoin-wallet-api/blob/f9bbec54be581356f36b5084b50037845a6d00c3/src/Headzoo/Bitcoin/Wallet/Api/JsonRPC.php#L268-L274
|
221,393
|
webcreate/vcs
|
src/Webcreate/Vcs/Svn/WorkingCopy.php
|
WorkingCopy.add
|
public function add($path)
{
if (!file_exists($this->cwd . '/' . $path)) {
throw new NotFoundException(sprintf('Path %s not found', $this->cwd . '/' . $path));
}
$result = $this->status($path);
foreach ($result as $fileInfo) {
if ($fileInfo->getStatus() === Status::UNVERSIONED) {
$this->svn->execute('add', array($fileInfo->getPathname()), $this->cwd);
}
}
}
|
php
|
public function add($path)
{
if (!file_exists($this->cwd . '/' . $path)) {
throw new NotFoundException(sprintf('Path %s not found', $this->cwd . '/' . $path));
}
$result = $this->status($path);
foreach ($result as $fileInfo) {
if ($fileInfo->getStatus() === Status::UNVERSIONED) {
$this->svn->execute('add', array($fileInfo->getPathname()), $this->cwd);
}
}
}
|
[
"public",
"function",
"add",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"this",
"->",
"cwd",
".",
"'/'",
".",
"$",
"path",
")",
")",
"{",
"throw",
"new",
"NotFoundException",
"(",
"sprintf",
"(",
"'Path %s not found'",
",",
"$",
"this",
"->",
"cwd",
".",
"'/'",
".",
"$",
"path",
")",
")",
";",
"}",
"$",
"result",
"=",
"$",
"this",
"->",
"status",
"(",
"$",
"path",
")",
";",
"foreach",
"(",
"$",
"result",
"as",
"$",
"fileInfo",
")",
"{",
"if",
"(",
"$",
"fileInfo",
"->",
"getStatus",
"(",
")",
"===",
"Status",
"::",
"UNVERSIONED",
")",
"{",
"$",
"this",
"->",
"svn",
"->",
"execute",
"(",
"'add'",
",",
"array",
"(",
"$",
"fileInfo",
"->",
"getPathname",
"(",
")",
")",
",",
"$",
"this",
"->",
"cwd",
")",
";",
"}",
"}",
"}"
] |
Add file or directory to Svn
@param string $path
@throws NotFoundException
|
[
"Add",
"file",
"or",
"directory",
"to",
"Svn"
] |
31a680f2501c4e5a599e8dd3ffbc8c0a5185c8ad
|
https://github.com/webcreate/vcs/blob/31a680f2501c4e5a599e8dd3ffbc8c0a5185c8ad/src/Webcreate/Vcs/Svn/WorkingCopy.php#L63-L76
|
221,394
|
webcreate/vcs
|
src/Webcreate/Vcs/Svn/WorkingCopy.php
|
WorkingCopy.status
|
public function status($path = null)
{
$args = array();
if (null !== $path) {
$args[] = $path;
}
return $this->svn->execute('status', $args, $this->cwd);
}
|
php
|
public function status($path = null)
{
$args = array();
if (null !== $path) {
$args[] = $path;
}
return $this->svn->execute('status', $args, $this->cwd);
}
|
[
"public",
"function",
"status",
"(",
"$",
"path",
"=",
"null",
")",
"{",
"$",
"args",
"=",
"array",
"(",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"path",
")",
"{",
"$",
"args",
"[",
"]",
"=",
"$",
"path",
";",
"}",
"return",
"$",
"this",
"->",
"svn",
"->",
"execute",
"(",
"'status'",
",",
"$",
"args",
",",
"$",
"this",
"->",
"cwd",
")",
";",
"}"
] |
Get the status of the working copy
@param string $path
@return \Webcreate\Vcs\Common\VcsFileInfo[]
|
[
"Get",
"the",
"status",
"of",
"the",
"working",
"copy"
] |
31a680f2501c4e5a599e8dd3ffbc8c0a5185c8ad
|
https://github.com/webcreate/vcs/blob/31a680f2501c4e5a599e8dd3ffbc8c0a5185c8ad/src/Webcreate/Vcs/Svn/WorkingCopy.php#L95-L103
|
221,395
|
webcreate/vcs
|
src/Webcreate/Vcs/Git/Parser/CliParser.php
|
CliParser.parseLogOutput
|
public function parseLogOutput($output, array $arguments = array())
{
if (!isset($arguments['--pretty=']) || Git::PRETTY_FORMAT !== $arguments['--pretty=']) {
// non pretty results are not supported
return $output;
}
$xml = '<log>' . $output . '</log>';
$sxml = simplexml_load_string($xml);
$retval = array();
foreach ($sxml->logentry as $entry) {
$revision = (string) $entry->commit;
$date = (string) $entry->date;
$author = (string) $entry->author;
$message = (string) $entry->msg;
$retval[] = new Commit($revision, new \DateTime($date), $author, trim($message));
}
return $retval;
}
|
php
|
public function parseLogOutput($output, array $arguments = array())
{
if (!isset($arguments['--pretty=']) || Git::PRETTY_FORMAT !== $arguments['--pretty=']) {
// non pretty results are not supported
return $output;
}
$xml = '<log>' . $output . '</log>';
$sxml = simplexml_load_string($xml);
$retval = array();
foreach ($sxml->logentry as $entry) {
$revision = (string) $entry->commit;
$date = (string) $entry->date;
$author = (string) $entry->author;
$message = (string) $entry->msg;
$retval[] = new Commit($revision, new \DateTime($date), $author, trim($message));
}
return $retval;
}
|
[
"public",
"function",
"parseLogOutput",
"(",
"$",
"output",
",",
"array",
"$",
"arguments",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"arguments",
"[",
"'--pretty='",
"]",
")",
"||",
"Git",
"::",
"PRETTY_FORMAT",
"!==",
"$",
"arguments",
"[",
"'--pretty='",
"]",
")",
"{",
"// non pretty results are not supported",
"return",
"$",
"output",
";",
"}",
"$",
"xml",
"=",
"'<log>'",
".",
"$",
"output",
".",
"'</log>'",
";",
"$",
"sxml",
"=",
"simplexml_load_string",
"(",
"$",
"xml",
")",
";",
"$",
"retval",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"sxml",
"->",
"logentry",
"as",
"$",
"entry",
")",
"{",
"$",
"revision",
"=",
"(",
"string",
")",
"$",
"entry",
"->",
"commit",
";",
"$",
"date",
"=",
"(",
"string",
")",
"$",
"entry",
"->",
"date",
";",
"$",
"author",
"=",
"(",
"string",
")",
"$",
"entry",
"->",
"author",
";",
"$",
"message",
"=",
"(",
"string",
")",
"$",
"entry",
"->",
"msg",
";",
"$",
"retval",
"[",
"]",
"=",
"new",
"Commit",
"(",
"$",
"revision",
",",
"new",
"\\",
"DateTime",
"(",
"$",
"date",
")",
",",
"$",
"author",
",",
"trim",
"(",
"$",
"message",
")",
")",
";",
"}",
"return",
"$",
"retval",
";",
"}"
] |
Parses the log command output to Commit objects
@param string $output
@param array $arguments
@return string|\Webcreate\Vcs\Common\Commit[]
|
[
"Parses",
"the",
"log",
"command",
"output",
"to",
"Commit",
"objects"
] |
31a680f2501c4e5a599e8dd3ffbc8c0a5185c8ad
|
https://github.com/webcreate/vcs/blob/31a680f2501c4e5a599e8dd3ffbc8c0a5185c8ad/src/Webcreate/Vcs/Git/Parser/CliParser.php#L77-L99
|
221,396
|
webcreate/vcs
|
src/Webcreate/Vcs/Git/Parser/CliParser.php
|
CliParser.parseStatusOutput
|
public function parseStatusOutput($output, array $arguments = array())
{
if (!isset($arguments['--porcelain']) || false === $arguments['--porcelain']) {
// non porcelain results are not supported
return $output;
}
if ('' === trim($output)) {
return array();
}
$lines = explode("\n", rtrim($output));
$retval = array();
foreach ($lines as $line) {
if (preg_match('/([A-Z\?\s])([A-Z\?\s])\s(.*)( -> (.*))?/', $line, $matches)) {
list($fullmatch, $x, $y, $file) = $matches;
$file = new VcsFileInfo($file, $this->getClient()->getHead());
$file->setStatus($x);
$retval[] = $file;
} else {
throw new \Exception('Unable to parse line "'. $line . '"');
}
}
return $retval;
}
|
php
|
public function parseStatusOutput($output, array $arguments = array())
{
if (!isset($arguments['--porcelain']) || false === $arguments['--porcelain']) {
// non porcelain results are not supported
return $output;
}
if ('' === trim($output)) {
return array();
}
$lines = explode("\n", rtrim($output));
$retval = array();
foreach ($lines as $line) {
if (preg_match('/([A-Z\?\s])([A-Z\?\s])\s(.*)( -> (.*))?/', $line, $matches)) {
list($fullmatch, $x, $y, $file) = $matches;
$file = new VcsFileInfo($file, $this->getClient()->getHead());
$file->setStatus($x);
$retval[] = $file;
} else {
throw new \Exception('Unable to parse line "'. $line . '"');
}
}
return $retval;
}
|
[
"public",
"function",
"parseStatusOutput",
"(",
"$",
"output",
",",
"array",
"$",
"arguments",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"arguments",
"[",
"'--porcelain'",
"]",
")",
"||",
"false",
"===",
"$",
"arguments",
"[",
"'--porcelain'",
"]",
")",
"{",
"// non porcelain results are not supported",
"return",
"$",
"output",
";",
"}",
"if",
"(",
"''",
"===",
"trim",
"(",
"$",
"output",
")",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"$",
"lines",
"=",
"explode",
"(",
"\"\\n\"",
",",
"rtrim",
"(",
"$",
"output",
")",
")",
";",
"$",
"retval",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"lines",
"as",
"$",
"line",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'/([A-Z\\?\\s])([A-Z\\?\\s])\\s(.*)( -> (.*))?/'",
",",
"$",
"line",
",",
"$",
"matches",
")",
")",
"{",
"list",
"(",
"$",
"fullmatch",
",",
"$",
"x",
",",
"$",
"y",
",",
"$",
"file",
")",
"=",
"$",
"matches",
";",
"$",
"file",
"=",
"new",
"VcsFileInfo",
"(",
"$",
"file",
",",
"$",
"this",
"->",
"getClient",
"(",
")",
"->",
"getHead",
"(",
")",
")",
";",
"$",
"file",
"->",
"setStatus",
"(",
"$",
"x",
")",
";",
"$",
"retval",
"[",
"]",
"=",
"$",
"file",
";",
"}",
"else",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'Unable to parse line \"'",
".",
"$",
"line",
".",
"'\"'",
")",
";",
"}",
"}",
"return",
"$",
"retval",
";",
"}"
] |
Parse the status command output to FileInfo objects
@param string $output
@param array $arguments
@throws \Exception
@return string|\Webcreate\Vcs\Common\FileInfo[]
|
[
"Parse",
"the",
"status",
"command",
"output",
"to",
"FileInfo",
"objects"
] |
31a680f2501c4e5a599e8dd3ffbc8c0a5185c8ad
|
https://github.com/webcreate/vcs/blob/31a680f2501c4e5a599e8dd3ffbc8c0a5185c8ad/src/Webcreate/Vcs/Git/Parser/CliParser.php#L109-L137
|
221,397
|
webcreate/vcs
|
src/Webcreate/Vcs/Git/Parser/CliParser.php
|
CliParser.parseDiffOutput
|
public function parseDiffOutput($output, array $arguments = array())
{
if (!isset($arguments['--name-status']) || false === $arguments['--name-status']) {
// non name-status results are not supported
return $output;
}
$lines = explode("\n", rtrim($output));
$retval = array();
foreach ($lines as $line) {
if (preg_match('/([ACDMRTUXB])(\d*)\s+(.*)?/', $line, $matches)) {
list($fullmatch, $status, $number, $filename) = $matches;
if ($number && preg_match('/(.*\s)+(.*)/', $filename, $filenameMatches)) {
list($fullmatch, $originalName, $filename) = $filenameMatches;
}
$file = new VcsFileInfo($filename, $this->getClient()->getHead());
$file->setStatus($status);
$retval[] = $file;
} else {
throw new \Exception('Unable to parse line "'. $line . '"');
}
}
return $retval;
}
|
php
|
public function parseDiffOutput($output, array $arguments = array())
{
if (!isset($arguments['--name-status']) || false === $arguments['--name-status']) {
// non name-status results are not supported
return $output;
}
$lines = explode("\n", rtrim($output));
$retval = array();
foreach ($lines as $line) {
if (preg_match('/([ACDMRTUXB])(\d*)\s+(.*)?/', $line, $matches)) {
list($fullmatch, $status, $number, $filename) = $matches;
if ($number && preg_match('/(.*\s)+(.*)/', $filename, $filenameMatches)) {
list($fullmatch, $originalName, $filename) = $filenameMatches;
}
$file = new VcsFileInfo($filename, $this->getClient()->getHead());
$file->setStatus($status);
$retval[] = $file;
} else {
throw new \Exception('Unable to parse line "'. $line . '"');
}
}
return $retval;
}
|
[
"public",
"function",
"parseDiffOutput",
"(",
"$",
"output",
",",
"array",
"$",
"arguments",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"arguments",
"[",
"'--name-status'",
"]",
")",
"||",
"false",
"===",
"$",
"arguments",
"[",
"'--name-status'",
"]",
")",
"{",
"// non name-status results are not supported",
"return",
"$",
"output",
";",
"}",
"$",
"lines",
"=",
"explode",
"(",
"\"\\n\"",
",",
"rtrim",
"(",
"$",
"output",
")",
")",
";",
"$",
"retval",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"lines",
"as",
"$",
"line",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'/([ACDMRTUXB])(\\d*)\\s+(.*)?/'",
",",
"$",
"line",
",",
"$",
"matches",
")",
")",
"{",
"list",
"(",
"$",
"fullmatch",
",",
"$",
"status",
",",
"$",
"number",
",",
"$",
"filename",
")",
"=",
"$",
"matches",
";",
"if",
"(",
"$",
"number",
"&&",
"preg_match",
"(",
"'/(.*\\s)+(.*)/'",
",",
"$",
"filename",
",",
"$",
"filenameMatches",
")",
")",
"{",
"list",
"(",
"$",
"fullmatch",
",",
"$",
"originalName",
",",
"$",
"filename",
")",
"=",
"$",
"filenameMatches",
";",
"}",
"$",
"file",
"=",
"new",
"VcsFileInfo",
"(",
"$",
"filename",
",",
"$",
"this",
"->",
"getClient",
"(",
")",
"->",
"getHead",
"(",
")",
")",
";",
"$",
"file",
"->",
"setStatus",
"(",
"$",
"status",
")",
";",
"$",
"retval",
"[",
"]",
"=",
"$",
"file",
";",
"}",
"else",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'Unable to parse line \"'",
".",
"$",
"line",
".",
"'\"'",
")",
";",
"}",
"}",
"return",
"$",
"retval",
";",
"}"
] |
Parse the diff command output to FileInfo objects
@param string $output
@param array $arguments
@throws \Exception
@return string|\Webcreate\Vcs\Common\VcsFileInfo[]
|
[
"Parse",
"the",
"diff",
"command",
"output",
"to",
"FileInfo",
"objects"
] |
31a680f2501c4e5a599e8dd3ffbc8c0a5185c8ad
|
https://github.com/webcreate/vcs/blob/31a680f2501c4e5a599e8dd3ffbc8c0a5185c8ad/src/Webcreate/Vcs/Git/Parser/CliParser.php#L147-L175
|
221,398
|
Fritak/messenger-platform
|
source/WelcomeMessage.php
|
WelcomeMessage.addNext
|
public function addNext($text, $template = null)
{
if(!empty($text))
{
$this->callToActions = ['message' => ['text' => $text]];
}
if(!empty($template))
{
if($template instanceof StructuredMessage)
{
$this->callToActions = ['message' => [$template->getDataForCall(FALSE)]];
}
else
{
throw new MessengerPlatformException('Template for welcome message is not StructuredMessage.', 4);
}
}
}
|
php
|
public function addNext($text, $template = null)
{
if(!empty($text))
{
$this->callToActions = ['message' => ['text' => $text]];
}
if(!empty($template))
{
if($template instanceof StructuredMessage)
{
$this->callToActions = ['message' => [$template->getDataForCall(FALSE)]];
}
else
{
throw new MessengerPlatformException('Template for welcome message is not StructuredMessage.', 4);
}
}
}
|
[
"public",
"function",
"addNext",
"(",
"$",
"text",
",",
"$",
"template",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"text",
")",
")",
"{",
"$",
"this",
"->",
"callToActions",
"=",
"[",
"'message'",
"=>",
"[",
"'text'",
"=>",
"$",
"text",
"]",
"]",
";",
"}",
"if",
"(",
"!",
"empty",
"(",
"$",
"template",
")",
")",
"{",
"if",
"(",
"$",
"template",
"instanceof",
"StructuredMessage",
")",
"{",
"$",
"this",
"->",
"callToActions",
"=",
"[",
"'message'",
"=>",
"[",
"$",
"template",
"->",
"getDataForCall",
"(",
"FALSE",
")",
"]",
"]",
";",
"}",
"else",
"{",
"throw",
"new",
"MessengerPlatformException",
"(",
"'Template for welcome message is not StructuredMessage.'",
",",
"4",
")",
";",
"}",
"}",
"}"
] |
You can set the welcome message to be text or Structured Message.
@param string $text
@param StructuredMessage $template Structured Message
|
[
"You",
"can",
"set",
"the",
"welcome",
"message",
"to",
"be",
"text",
"or",
"Structured",
"Message",
"."
] |
689c56636036101240598d55322df974da069a22
|
https://github.com/Fritak/messenger-platform/blob/689c56636036101240598d55322df974da069a22/source/WelcomeMessage.php#L28-L46
|
221,399
|
mysql-workbench-schema-exporter/doctrine2-exporter
|
lib/MwbExporter/Formatter/Doctrine2/ZF2InputFilterAnnotation/Model/Table.php
|
Table.writePopulate
|
public function writePopulate(WriterInterface $writer)
{
$writer
->write('/**')
->write(' * Populate entity with the given data.')
->write(' * The set* method will be used to set the data.')
->write(' *')
->write(' * @param array $data')
->write(' * @return boolean')
->write(' */')
->write('public function populate(array $data = array())')
->write('{')
->indent()
->write('foreach ($data as $field => $value) {')
->indent()
->write('$setter = sprintf(\'set%s\', ucfirst(')
->indent()
->write('str_replace(\' \', \'\', ucwords(str_replace(\'_\', \' \', $field)))')
->outdent()
->write('));')
->write('if (method_exists($this, $setter)) {')
->indent()
->write('$this->{$setter}($value);')
->outdent()
->write('}')
->outdent()
->write('}')
->write('')
->write('return true;')
->outdent()
->write('}')
->write('')
;
return $this;
}
|
php
|
public function writePopulate(WriterInterface $writer)
{
$writer
->write('/**')
->write(' * Populate entity with the given data.')
->write(' * The set* method will be used to set the data.')
->write(' *')
->write(' * @param array $data')
->write(' * @return boolean')
->write(' */')
->write('public function populate(array $data = array())')
->write('{')
->indent()
->write('foreach ($data as $field => $value) {')
->indent()
->write('$setter = sprintf(\'set%s\', ucfirst(')
->indent()
->write('str_replace(\' \', \'\', ucwords(str_replace(\'_\', \' \', $field)))')
->outdent()
->write('));')
->write('if (method_exists($this, $setter)) {')
->indent()
->write('$this->{$setter}($value);')
->outdent()
->write('}')
->outdent()
->write('}')
->write('')
->write('return true;')
->outdent()
->write('}')
->write('')
;
return $this;
}
|
[
"public",
"function",
"writePopulate",
"(",
"WriterInterface",
"$",
"writer",
")",
"{",
"$",
"writer",
"->",
"write",
"(",
"'/**'",
")",
"->",
"write",
"(",
"' * Populate entity with the given data.'",
")",
"->",
"write",
"(",
"' * The set* method will be used to set the data.'",
")",
"->",
"write",
"(",
"' *'",
")",
"->",
"write",
"(",
"' * @param array $data'",
")",
"->",
"write",
"(",
"' * @return boolean'",
")",
"->",
"write",
"(",
"' */'",
")",
"->",
"write",
"(",
"'public function populate(array $data = array())'",
")",
"->",
"write",
"(",
"'{'",
")",
"->",
"indent",
"(",
")",
"->",
"write",
"(",
"'foreach ($data as $field => $value) {'",
")",
"->",
"indent",
"(",
")",
"->",
"write",
"(",
"'$setter = sprintf(\\'set%s\\', ucfirst('",
")",
"->",
"indent",
"(",
")",
"->",
"write",
"(",
"'str_replace(\\' \\', \\'\\', ucwords(str_replace(\\'_\\', \\' \\', $field)))'",
")",
"->",
"outdent",
"(",
")",
"->",
"write",
"(",
"'));'",
")",
"->",
"write",
"(",
"'if (method_exists($this, $setter)) {'",
")",
"->",
"indent",
"(",
")",
"->",
"write",
"(",
"'$this->{$setter}($value);'",
")",
"->",
"outdent",
"(",
")",
"->",
"write",
"(",
"'}'",
")",
"->",
"outdent",
"(",
")",
"->",
"write",
"(",
"'}'",
")",
"->",
"write",
"(",
"''",
")",
"->",
"write",
"(",
"'return true;'",
")",
"->",
"outdent",
"(",
")",
"->",
"write",
"(",
"'}'",
")",
"->",
"write",
"(",
"''",
")",
";",
"return",
"$",
"this",
";",
"}"
] |
Write entity populate method.
@see \Zend\Stdlib\Hydrator\ArraySerializable::extract()
@param \MwbExporter\Writer\WriterInterface $writer
@return \MwbExporter\Formatter\Doctrine2\AnnotationZF2InputFilter\Model\Table
|
[
"Write",
"entity",
"populate",
"method",
"."
] |
a62b13cbf4824c05cc791034ffedf419242ba0cb
|
https://github.com/mysql-workbench-schema-exporter/doctrine2-exporter/blob/a62b13cbf4824c05cc791034ffedf419242ba0cb/lib/MwbExporter/Formatter/Doctrine2/ZF2InputFilterAnnotation/Model/Table.php#L253-L288
|
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.