repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
raoul2000/yii2-twbsmaxlength-widget | TwbsMaxlength.php | TwbsMaxlength.registerClientScript | public function registerClientScript()
{
$view = $this->getView();
TwbsMaxlengthAsset::register($view);
$options = empty($this->clientOptions) ? "{}" : Json::encode($this->clientOptions);
if( isset($this->selector)) {
$js = "jQuery(\"{$this->selector}\").maxlength(" . $options . ")";
} else {
$js = "j... | php | public function registerClientScript()
{
$view = $this->getView();
TwbsMaxlengthAsset::register($view);
$options = empty($this->clientOptions) ? "{}" : Json::encode($this->clientOptions);
if( isset($this->selector)) {
$js = "jQuery(\"{$this->selector}\").maxlength(" . $options . ")";
} else {
$js = "j... | [
"public",
"function",
"registerClientScript",
"(",
")",
"{",
"$",
"view",
"=",
"$",
"this",
"->",
"getView",
"(",
")",
";",
"TwbsMaxlengthAsset",
"::",
"register",
"(",
"$",
"view",
")",
";",
"$",
"options",
"=",
"empty",
"(",
"$",
"this",
"->",
"clien... | Generates and registers javascript to start the plugin. | [
"Generates",
"and",
"registers",
"javascript",
"to",
"start",
"the",
"plugin",
"."
] | train | https://github.com/raoul2000/yii2-twbsmaxlength-widget/blob/87ba6bf179a8db398bff0aaee6701a1e6dfc8b3b/TwbsMaxlength.php#L128-L140 |
raoul2000/yii2-twbsmaxlength-widget | TwbsMaxlength.php | TwbsMaxlength.apply | public static function apply($field, $clientOptions, $render = true)
{
if ( isset($field->inputOptions['maxlength'])) {
$maxLength = $field->inputOptions['maxlength'];
} else {
$maxLength = static::getMaxLength($field->model, Html::getAttributeName($field->attribute));
}
if ( ! empty($maxLength) ) {
$... | php | public static function apply($field, $clientOptions, $render = true)
{
if ( isset($field->inputOptions['maxlength'])) {
$maxLength = $field->inputOptions['maxlength'];
} else {
$maxLength = static::getMaxLength($field->model, Html::getAttributeName($field->attribute));
}
if ( ! empty($maxLength) ) {
$... | [
"public",
"static",
"function",
"apply",
"(",
"$",
"field",
",",
"$",
"clientOptions",
",",
"$",
"render",
"=",
"true",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"field",
"->",
"inputOptions",
"[",
"'maxlength'",
"]",
")",
")",
"{",
"$",
"maxLength",
"... | Add the maxlength attribute to an ActiveField.
The plugin requires that the max number of characters is specified as the HTML5 attribute "maxlength". This
method adds this attribute if it is not already defined into the HTML attributes of an ActiveField. The
value is retrieved from the StringValidator settings that is... | [
"Add",
"the",
"maxlength",
"attribute",
"to",
"an",
"ActiveField",
"."
] | train | https://github.com/raoul2000/yii2-twbsmaxlength-widget/blob/87ba6bf179a8db398bff0aaee6701a1e6dfc8b3b/TwbsMaxlength.php#L161-L180 |
raoul2000/yii2-twbsmaxlength-widget | TwbsMaxlength.php | TwbsMaxlength.getMaxLength | public static function getMaxLength($model, $attribute, $defaultValue = null)
{
$maxLength = null;
foreach ($model->getActiveValidators($attribute) as $validator) {
if ( $validator instanceof yii\validators\StringValidator) {
$maxLength = $validator->max;
break;
}
}
return $maxLength !== null ? $... | php | public static function getMaxLength($model, $attribute, $defaultValue = null)
{
$maxLength = null;
foreach ($model->getActiveValidators($attribute) as $validator) {
if ( $validator instanceof yii\validators\StringValidator) {
$maxLength = $validator->max;
break;
}
}
return $maxLength !== null ? $... | [
"public",
"static",
"function",
"getMaxLength",
"(",
"$",
"model",
",",
"$",
"attribute",
",",
"$",
"defaultValue",
"=",
"null",
")",
"{",
"$",
"maxLength",
"=",
"null",
";",
"foreach",
"(",
"$",
"model",
"->",
"getActiveValidators",
"(",
"$",
"attribute",... | Find the maxlength parameter for an attribute's model.
This method searches for a yii\validators\StringValidator among all the active validators (based on the current
model scenario). If it founds one, it returns the max length parameter value. If no such value can be found because it is not
defined or because no Stri... | [
"Find",
"the",
"maxlength",
"parameter",
"for",
"an",
"attribute",
"s",
"model",
"."
] | train | https://github.com/raoul2000/yii2-twbsmaxlength-widget/blob/87ba6bf179a8db398bff0aaee6701a1e6dfc8b3b/TwbsMaxlength.php#L194-L204 |
link0/profiler | src/Link0/Profiler/ProfileFactory.php | ProfileFactory.create | public function create($profileData = array(), $applicationData = array(), $serverData = array())
{
$profile = Profile::create();
$profile->setProfileData($profileData);
$profile->setApplicationData($applicationData);
$profile->setServerData($serverData);
return $profile;
... | php | public function create($profileData = array(), $applicationData = array(), $serverData = array())
{
$profile = Profile::create();
$profile->setProfileData($profileData);
$profile->setApplicationData($applicationData);
$profile->setServerData($serverData);
return $profile;
... | [
"public",
"function",
"create",
"(",
"$",
"profileData",
"=",
"array",
"(",
")",
",",
"$",
"applicationData",
"=",
"array",
"(",
")",
",",
"$",
"serverData",
"=",
"array",
"(",
")",
")",
"{",
"$",
"profile",
"=",
"Profile",
"::",
"create",
"(",
")",
... | @param array $profileData
@param array $applicationData OPTIONAL
@param array $serverData OPTIONAL
@return ProfileInterface | [
"@param",
"array",
"$profileData",
"@param",
"array",
"$applicationData",
"OPTIONAL",
"@param",
"array",
"$serverData",
"OPTIONAL"
] | train | https://github.com/link0/profiler/blob/0573073ff029743734de747619ab65ab2476052d/src/Link0/Profiler/ProfileFactory.php#L24-L32 |
acasademont/wurfl | WURFL/Xml/Utils.php | WURFL_Xml_Utils.getZippedFile | private static function getZippedFile($filename)
{
if (!self::zipModuleLoaded()) {
throw new WURFL_WURFLException("The ZipArchive extension is not loaded. Load the extension or use the flat wurfl.xml file");
}
$tmpDir = WURFL_FileUtils::getTempDir();
$zip = new ZipArchive... | php | private static function getZippedFile($filename)
{
if (!self::zipModuleLoaded()) {
throw new WURFL_WURFLException("The ZipArchive extension is not loaded. Load the extension or use the flat wurfl.xml file");
}
$tmpDir = WURFL_FileUtils::getTempDir();
$zip = new ZipArchive... | [
"private",
"static",
"function",
"getZippedFile",
"(",
"$",
"filename",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"zipModuleLoaded",
"(",
")",
")",
"{",
"throw",
"new",
"WURFL_WURFLException",
"(",
"\"The ZipArchive extension is not loaded. Load the extension or use the f... | Returns a XML Resource filename for the uncompressed contents of the provided zipped $filename
@param string $filename of zipped XML data
@throws WURFL_WURFLException ZipArchive extension is not loaded or the ZIP file is corrupt
@return string Full filename and path of extracted XML file | [
"Returns",
"a",
"XML",
"Resource",
"filename",
"for",
"the",
"uncompressed",
"contents",
"of",
"the",
"provided",
"zipped",
"$filename"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/Xml/Utils.php#L52-L74 |
tokenly/bitcoin-payer | src/Tokenly/BitcoinPayer/Provider/BitcoinPayerServiceProvider.php | BitcoinPayerServiceProvider.register | public function register()
{
$this->bindConfig();
$this->app->bind('Nbobtc\Bitcoind\Bitcoind', function($app) {
$bitcoind_client = $app->make('Nbobtc\Bitcoind\Client');
$bitcoind = new Bitcoind($bitcoind_client);
return $bitcoind;
});
$this->app-... | php | public function register()
{
$this->bindConfig();
$this->app->bind('Nbobtc\Bitcoind\Bitcoind', function($app) {
$bitcoind_client = $app->make('Nbobtc\Bitcoind\Client');
$bitcoind = new Bitcoind($bitcoind_client);
return $bitcoind;
});
$this->app-... | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"bindConfig",
"(",
")",
";",
"$",
"this",
"->",
"app",
"->",
"bind",
"(",
"'Nbobtc\\Bitcoind\\Bitcoind'",
",",
"function",
"(",
"$",
"app",
")",
"{",
"$",
"bitcoind_client",
"=",
"$",
... | Register the service provider.
@return void | [
"Register",
"the",
"service",
"provider",
"."
] | train | https://github.com/tokenly/bitcoin-payer/blob/73d4b5b6a33e89e3a29cca99a464283046d31e6b/src/Tokenly/BitcoinPayer/Provider/BitcoinPayerServiceProvider.php#L29-L58 |
drunomics/service-utils | src/Core/Entity/EntityTypeManagerTrait.php | EntityTypeManagerTrait.getEntityTypeManager | public function getEntityTypeManager() {
if (empty($this->entityTypeManager)) {
$this->entityTypeManager = \Drupal::entityTypeManager();
}
return $this->entityTypeManager;
} | php | public function getEntityTypeManager() {
if (empty($this->entityTypeManager)) {
$this->entityTypeManager = \Drupal::entityTypeManager();
}
return $this->entityTypeManager;
} | [
"public",
"function",
"getEntityTypeManager",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"entityTypeManager",
")",
")",
"{",
"$",
"this",
"->",
"entityTypeManager",
"=",
"\\",
"Drupal",
"::",
"entityTypeManager",
"(",
")",
";",
"}",
"return... | Gets the entity type manager.
@return \Drupal\Core\Entity\EntityTypeManagerInterface
The entity type manager. | [
"Gets",
"the",
"entity",
"type",
"manager",
"."
] | train | https://github.com/drunomics/service-utils/blob/56761750043132365ef4ae5d9e0cf4263459328f/src/Core/Entity/EntityTypeManagerTrait.php#L38-L43 |
axelitus/php-base | src/Num.php | Num.parse | public static function parse($value, $default = null)
{
if (!is_string($value) || !is_numeric($value)) {
return $default;
}
if(Int::extIs($value)){
return Int::parse($value);
} else {
return Float::parse($value);
}
} | php | public static function parse($value, $default = null)
{
if (!is_string($value) || !is_numeric($value)) {
return $default;
}
if(Int::extIs($value)){
return Int::parse($value);
} else {
return Float::parse($value);
}
} | [
"public",
"static",
"function",
"parse",
"(",
"$",
"value",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"value",
")",
"||",
"!",
"is_numeric",
"(",
"$",
"value",
")",
")",
"{",
"return",
"$",
"default",
";",
... | Parses a string numeric value into an integer or a float.
@param string $value The value to parse.
@param null $default The default return value if the given value is not a string or is not numeric.
@return mixed Returns the parsed value or the default value. | [
"Parses",
"a",
"string",
"numeric",
"value",
"into",
"an",
"integer",
"or",
"a",
"float",
"."
] | train | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/Num.php#L68-L79 |
axelitus/php-base | src/Num.php | Num.compare | public static function compare($num1, $num2)
{
if (!static::is($num1) || !static::is($num2)) {
throw new \InvalidArgumentException("The \$num1 and \$num2 parameters must be numeric.");
}
return ($num1 - $num2);
} | php | public static function compare($num1, $num2)
{
if (!static::is($num1) || !static::is($num2)) {
throw new \InvalidArgumentException("The \$num1 and \$num2 parameters must be numeric.");
}
return ($num1 - $num2);
} | [
"public",
"static",
"function",
"compare",
"(",
"$",
"num1",
",",
"$",
"num2",
")",
"{",
"if",
"(",
"!",
"static",
"::",
"is",
"(",
"$",
"num1",
")",
"||",
"!",
"static",
"::",
"is",
"(",
"$",
"num2",
")",
")",
"{",
"throw",
"new",
"\\",
"Inval... | Compares two numeric values.
The returning value contains the actual value difference.
@param int|float $num1 The left operand.
@param int|float $num2 The right operand.
@return int Returns <0 if $num1<$num2, =0 if $num1 == $num2, >0 if $num1>$num2
@throws \InvalidArgumentException | [
"Compares",
"two",
"numeric",
"values",
"."
] | train | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/Num.php#L128-L135 |
axelitus/php-base | src/Num.php | Num.add | public static function add($num1, $num2)
{
if (!static::is($num1) || !static::is($num2)) {
throw new \InvalidArgumentException("The \$num1 and \$num2 parameters must be numeric.");
}
return ($num1 + $num2);
} | php | public static function add($num1, $num2)
{
if (!static::is($num1) || !static::is($num2)) {
throw new \InvalidArgumentException("The \$num1 and \$num2 parameters must be numeric.");
}
return ($num1 + $num2);
} | [
"public",
"static",
"function",
"add",
"(",
"$",
"num1",
",",
"$",
"num2",
")",
"{",
"if",
"(",
"!",
"static",
"::",
"is",
"(",
"$",
"num1",
")",
"||",
"!",
"static",
"::",
"is",
"(",
"$",
"num2",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidAr... | Adds a number to another number.
@param int|float $num1 The left operand.
@param int|float $num2 The right operand.
@return int|float The result of the operation.
@throws \InvalidArgumentException | [
"Adds",
"a",
"number",
"to",
"another",
"number",
"."
] | train | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/Num.php#L234-L241 |
axelitus/php-base | src/Num.php | Num.sub | public static function sub($num1, $num2)
{
if (!static::is($num1) || !static::is($num2)) {
throw new \InvalidArgumentException("The \$num1 and \$num2 parameters must be numeric.");
}
return ($num1 - $num2);
} | php | public static function sub($num1, $num2)
{
if (!static::is($num1) || !static::is($num2)) {
throw new \InvalidArgumentException("The \$num1 and \$num2 parameters must be numeric.");
}
return ($num1 - $num2);
} | [
"public",
"static",
"function",
"sub",
"(",
"$",
"num1",
",",
"$",
"num2",
")",
"{",
"if",
"(",
"!",
"static",
"::",
"is",
"(",
"$",
"num1",
")",
"||",
"!",
"static",
"::",
"is",
"(",
"$",
"num2",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidAr... | Subtracts a number from another number.
@param int|float $num1 The left operand.
@param int|float $num2 The right operand.
@return int|float The result of the operation.
@throws \InvalidArgumentException | [
"Subtracts",
"a",
"number",
"from",
"another",
"number",
"."
] | train | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/Num.php#L252-L259 |
axelitus/php-base | src/Num.php | Num.mul | public static function mul($num1, $num2)
{
if (!static::is($num1) || !static::is($num2)) {
throw new \InvalidArgumentException("The \$num1 and \$num2 parameters must be numeric.");
}
return ($num1 * $num2);
} | php | public static function mul($num1, $num2)
{
if (!static::is($num1) || !static::is($num2)) {
throw new \InvalidArgumentException("The \$num1 and \$num2 parameters must be numeric.");
}
return ($num1 * $num2);
} | [
"public",
"static",
"function",
"mul",
"(",
"$",
"num1",
",",
"$",
"num2",
")",
"{",
"if",
"(",
"!",
"static",
"::",
"is",
"(",
"$",
"num1",
")",
"||",
"!",
"static",
"::",
"is",
"(",
"$",
"num2",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidAr... | Multiplies a number by another number.
@param int|float $num1 The left operand.
@param int|float $num2 The right operand.
@return int|float The result of the operation.
@throws \InvalidArgumentException | [
"Multiplies",
"a",
"number",
"by",
"another",
"number",
"."
] | train | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/Num.php#L270-L277 |
axelitus/php-base | src/Num.php | Num.div | public static function div($num1, $num2)
{
if (!static::is($num1) || !static::is($num2)) {
throw new \InvalidArgumentException("The \$num1 and \$num2 parameters must be numeric.");
}
if ($num2 == 0) {
throw new \InvalidArgumentException("Cannot divide by zero. The \$... | php | public static function div($num1, $num2)
{
if (!static::is($num1) || !static::is($num2)) {
throw new \InvalidArgumentException("The \$num1 and \$num2 parameters must be numeric.");
}
if ($num2 == 0) {
throw new \InvalidArgumentException("Cannot divide by zero. The \$... | [
"public",
"static",
"function",
"div",
"(",
"$",
"num1",
",",
"$",
"num2",
")",
"{",
"if",
"(",
"!",
"static",
"::",
"is",
"(",
"$",
"num1",
")",
"||",
"!",
"static",
"::",
"is",
"(",
"$",
"num2",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidAr... | Divides a number by another number.
@param int|float $num1 The left operand.
@param int|float $num2 The right operand.
@return int|float The result of the operation.
@throws \InvalidArgumentException | [
"Divides",
"a",
"number",
"by",
"another",
"number",
"."
] | train | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/Num.php#L288-L299 |
stubbles/stubbles-webapp-core | src/main/php/auth/token/TokenFilter.php | TokenFilter.apply | public function apply(Value $value): array
{
if ($value->isEmpty()) {
return $this->filtered(new Token(null));
}
$value = $value->value();
if (strtolower(trim(substr($value, 0, 7))) === 'bearer') {
return $this->filtered(new Token(substr($value, 7)));
... | php | public function apply(Value $value): array
{
if ($value->isEmpty()) {
return $this->filtered(new Token(null));
}
$value = $value->value();
if (strtolower(trim(substr($value, 0, 7))) === 'bearer') {
return $this->filtered(new Token(substr($value, 7)));
... | [
"public",
"function",
"apply",
"(",
"Value",
"$",
"value",
")",
":",
"array",
"{",
"if",
"(",
"$",
"value",
"->",
"isEmpty",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"filtered",
"(",
"new",
"Token",
"(",
"null",
")",
")",
";",
"}",
"$",
... | apply filter on given value
@param \stubbles\values\Value $value
@return array | [
"apply",
"filter",
"on",
"given",
"value"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/auth/token/TokenFilter.php#L31-L43 |
nkt/flame | src/QueryBuilder/SelectQuery.php | SelectQuery.from | public function from($table, $alias = null)
{
if ($alias === null) {
$this->from[] = $this->grammar->buildId($table);
} else {
$this->from[] = $this->grammar->buildIdWithAlias($table, $alias);
}
return $this;
} | php | public function from($table, $alias = null)
{
if ($alias === null) {
$this->from[] = $this->grammar->buildId($table);
} else {
$this->from[] = $this->grammar->buildIdWithAlias($table, $alias);
}
return $this;
} | [
"public",
"function",
"from",
"(",
"$",
"table",
",",
"$",
"alias",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"alias",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"from",
"[",
"]",
"=",
"$",
"this",
"->",
"grammar",
"->",
"buildId",
"(",
"$",
"tab... | @param string $table
@param string $alias
@return static | [
"@param",
"string",
"$table",
"@param",
"string",
"$alias"
] | train | https://github.com/nkt/flame/blob/16f9f172db5a8a618b628429e0986eacb089d217/src/QueryBuilder/SelectQuery.php#L71-L80 |
nkt/flame | src/QueryBuilder/SelectQuery.php | SelectQuery.column | public function column($name, $alias = null)
{
if ($alias === null) {
$this->columns[] = $this->grammar->buildId($name);
} else {
$this->columns[] = $this->grammar->buildIdWithAlias($name, $alias);
}
return $this;
} | php | public function column($name, $alias = null)
{
if ($alias === null) {
$this->columns[] = $this->grammar->buildId($name);
} else {
$this->columns[] = $this->grammar->buildIdWithAlias($name, $alias);
}
return $this;
} | [
"public",
"function",
"column",
"(",
"$",
"name",
",",
"$",
"alias",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"alias",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"columns",
"[",
"]",
"=",
"$",
"this",
"->",
"grammar",
"->",
"buildId",
"(",
"$",
... | @param string $name
@param string $alias
@return static | [
"@param",
"string",
"$name",
"@param",
"string",
"$alias"
] | train | https://github.com/nkt/flame/blob/16f9f172db5a8a618b628429e0986eacb089d217/src/QueryBuilder/SelectQuery.php#L88-L97 |
nkt/flame | src/QueryBuilder/SelectQuery.php | SelectQuery.columns | public function columns($column)
{
foreach (func_get_args() as $column) {
$this->columns[] = $this->grammar->buildId($column);
}
return $this;
} | php | public function columns($column)
{
foreach (func_get_args() as $column) {
$this->columns[] = $this->grammar->buildId($column);
}
return $this;
} | [
"public",
"function",
"columns",
"(",
"$",
"column",
")",
"{",
"foreach",
"(",
"func_get_args",
"(",
")",
"as",
"$",
"column",
")",
"{",
"$",
"this",
"->",
"columns",
"[",
"]",
"=",
"$",
"this",
"->",
"grammar",
"->",
"buildId",
"(",
"$",
"column",
... | @param string $column,...
@return static | [
"@param",
"string",
"$column",
"..."
] | train | https://github.com/nkt/flame/blob/16f9f172db5a8a618b628429e0986eacb089d217/src/QueryBuilder/SelectQuery.php#L104-L111 |
nkt/flame | src/QueryBuilder/SelectQuery.php | SelectQuery.orderBy | public function orderBy($column, $asc = true)
{
if ($asc) {
$this->orders[] = $this->grammar->buildId($column) . ' ASC';
} else {
$this->orders[] = $this->grammar->buildId($column) . ' DESC';
}
return $this;
} | php | public function orderBy($column, $asc = true)
{
if ($asc) {
$this->orders[] = $this->grammar->buildId($column) . ' ASC';
} else {
$this->orders[] = $this->grammar->buildId($column) . ' DESC';
}
return $this;
} | [
"public",
"function",
"orderBy",
"(",
"$",
"column",
",",
"$",
"asc",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"asc",
")",
"{",
"$",
"this",
"->",
"orders",
"[",
"]",
"=",
"$",
"this",
"->",
"grammar",
"->",
"buildId",
"(",
"$",
"column",
")",
".... | @param string $column
@param bool $asc
@return static | [
"@param",
"string",
"$column",
"@param",
"bool",
"$asc"
] | train | https://github.com/nkt/flame/blob/16f9f172db5a8a618b628429e0986eacb089d217/src/QueryBuilder/SelectQuery.php#L143-L152 |
nkt/flame | src/QueryBuilder/SelectQuery.php | SelectQuery.union | public function union(SelectQuery $select, $all = false)
{
$this->unions[] = "\nUNION" . ($all ? ' ALL' : '') . "\n" . $select;
return $this;
} | php | public function union(SelectQuery $select, $all = false)
{
$this->unions[] = "\nUNION" . ($all ? ' ALL' : '') . "\n" . $select;
return $this;
} | [
"public",
"function",
"union",
"(",
"SelectQuery",
"$",
"select",
",",
"$",
"all",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"unions",
"[",
"]",
"=",
"\"\\nUNION\"",
".",
"(",
"$",
"all",
"?",
"' ALL'",
":",
"''",
")",
".",
"\"\\n\"",
".",
"$",
... | @param SelectQuery $select
@param bool $all
@return static | [
"@param",
"SelectQuery",
"$select",
"@param",
"bool",
"$all"
] | train | https://github.com/nkt/flame/blob/16f9f172db5a8a618b628429e0986eacb089d217/src/QueryBuilder/SelectQuery.php#L184-L189 |
goblindegook/Syllables | src/Shortcode.php | Shortcode.output | final public function output( $atts, $content = null, $tag = null ) {
if ( empty( $tag ) ) {
$tag = $this->get_tag();
}
$output = $this->render( $atts, $content, $tag );
/**
* Filters the shortcode content.
*
* @param string $output This shortcode's rendered content.
* @param array $atts ... | php | final public function output( $atts, $content = null, $tag = null ) {
if ( empty( $tag ) ) {
$tag = $this->get_tag();
}
$output = $this->render( $atts, $content, $tag );
/**
* Filters the shortcode content.
*
* @param string $output This shortcode's rendered content.
* @param array $atts ... | [
"final",
"public",
"function",
"output",
"(",
"$",
"atts",
",",
"$",
"content",
"=",
"null",
",",
"$",
"tag",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"tag",
")",
")",
"{",
"$",
"tag",
"=",
"$",
"this",
"->",
"get_tag",
"(",
")",
... | Callback that outputs the shortcode.
@param array $atts The shortcode's attributes.
@param string|null $content (Optional) Content enclosed in shortcode.
@param string|null $tag (Optional) Shortcode tag.
@return string The rendered shortcode.
@uses \apply_filters() | [
"Callback",
"that",
"outputs",
"the",
"shortcode",
"."
] | train | https://github.com/goblindegook/Syllables/blob/1a98cd15e37595a85b242242f88fee38c4e36acc/src/Shortcode.php#L91-L108 |
goblindegook/Syllables | src/Shortcode.php | Shortcode.render | public function render( $atts, $content = null, $tag = null ) {
if ( is_callable( $this->callback ) ) {
$content = call_user_func( $this->callback, $atts, $content, $tag );
}
/**
* Filters the shortcode content.
*
* @param string $content This shortcode's rendered content.
* @param array $atts... | php | public function render( $atts, $content = null, $tag = null ) {
if ( is_callable( $this->callback ) ) {
$content = call_user_func( $this->callback, $atts, $content, $tag );
}
/**
* Filters the shortcode content.
*
* @param string $content This shortcode's rendered content.
* @param array $atts... | [
"public",
"function",
"render",
"(",
"$",
"atts",
",",
"$",
"content",
"=",
"null",
",",
"$",
"tag",
"=",
"null",
")",
"{",
"if",
"(",
"is_callable",
"(",
"$",
"this",
"->",
"callback",
")",
")",
"{",
"$",
"content",
"=",
"call_user_func",
"(",
"$"... | Renders the hooked shortcode.
@param array $atts The shortcode's attributes.
@param string|null $content (Optional) Content enclosed in shortcode.
@param string|null $tag (Optional) Shortcode tag.
@return string The rendered shortcode.
@uses \apply_filters() | [
"Renders",
"the",
"hooked",
"shortcode",
"."
] | train | https://github.com/goblindegook/Syllables/blob/1a98cd15e37595a85b242242f88fee38c4e36acc/src/Shortcode.php#L120-L137 |
Agares/MicroORM | src/EntityMapper.php | EntityMapper.mapEntityFields | private function mapEntityFields(array $fields, \ReflectionClass $entityReflection, $entityInstance, array $fieldsDefinition)
{
foreach ($fieldsDefinition as $fieldName => $definition) {
$typeName = $definition->getTypeName();
if (!isset($this->typeMappers[$typeName])) {
... | php | private function mapEntityFields(array $fields, \ReflectionClass $entityReflection, $entityInstance, array $fieldsDefinition)
{
foreach ($fieldsDefinition as $fieldName => $definition) {
$typeName = $definition->getTypeName();
if (!isset($this->typeMappers[$typeName])) {
... | [
"private",
"function",
"mapEntityFields",
"(",
"array",
"$",
"fields",
",",
"\\",
"ReflectionClass",
"$",
"entityReflection",
",",
"$",
"entityInstance",
",",
"array",
"$",
"fieldsDefinition",
")",
"{",
"foreach",
"(",
"$",
"fieldsDefinition",
"as",
"$",
"fieldN... | @param array $fields
@param \ReflectionClass $entityReflection
@param mixed $entityInstance
@param EntityFieldDefinition[] $fieldsDefinition
@throws UnknownFieldTypeException | [
"@param",
"array",
"$fields",
"@param",
"\\",
"ReflectionClass",
"$entityReflection",
"@param",
"mixed",
"$entityInstance",
"@param",
"EntityFieldDefinition",
"[]",
"$fieldsDefinition"
] | train | https://github.com/Agares/MicroORM/blob/2852bdff07d91c436725b574cf6dea4e4dab7060/src/EntityMapper.php#L56-L70 |
contao-bootstrap/buttons | src/Netzmacht/Bootstrap/Buttons/Button.php | Button.generate | public function generate()
{
return sprintf(
'<%s %s>%s</%s>%s',
$this->tag,
parent::generate(),
$this->label,
$this->tag,
PHP_EOL
);
} | php | public function generate()
{
return sprintf(
'<%s %s>%s</%s>%s',
$this->tag,
parent::generate(),
$this->label,
$this->tag,
PHP_EOL
);
} | [
"public",
"function",
"generate",
"(",
")",
"{",
"return",
"sprintf",
"(",
"'<%s %s>%s</%s>%s'",
",",
"$",
"this",
"->",
"tag",
",",
"parent",
"::",
"generate",
"(",
")",
",",
"$",
"this",
"->",
"label",
",",
"$",
"this",
"->",
"tag",
",",
"PHP_EOL",
... | Generate the button.
@return string | [
"Generate",
"the",
"button",
"."
] | train | https://github.com/contao-bootstrap/buttons/blob/f573a24c19ec059aae528a12ba46dfc993844201/src/Netzmacht/Bootstrap/Buttons/Button.php#L106-L116 |
ejsmont-artur/phpProxyBuilder | src/PhpProxyBuilder/Adapter/Log/SimpleErrorLog.php | SimpleErrorLog.logDebug | public function logDebug($message, $attachment = null) {
error_log($message . print_r($attachment, true), $this->messageType , $this->destination);
} | php | public function logDebug($message, $attachment = null) {
error_log($message . print_r($attachment, true), $this->messageType , $this->destination);
} | [
"public",
"function",
"logDebug",
"(",
"$",
"message",
",",
"$",
"attachment",
"=",
"null",
")",
"{",
"error_log",
"(",
"$",
"message",
".",
"print_r",
"(",
"$",
"attachment",
",",
"true",
")",
",",
"$",
"this",
"->",
"messageType",
",",
"$",
"this",
... | Log message as debug level
@param string $message
@param mixed $attachment optional array or structure of data to be attached
@return void | [
"Log",
"message",
"as",
"debug",
"level"
] | train | https://github.com/ejsmont-artur/phpProxyBuilder/blob/ef7ec14e5d18eeba7a93e3617a0fdb5b146d6480/src/PhpProxyBuilder/Adapter/Log/SimpleErrorLog.php#L62-L64 |
bocharsky-bw/FileNamingResolver | src/NamingStrategy/DatetimeNamingStrategy.php | DatetimeNamingStrategy.provideName | public function provideName(FileInfo $srcFileInfo)
{
$datetime = \DateTime::createFromFormat('U.u', microtime(true));
$pathSuffix = FileInfo::purifyPath($datetime->format($this->dirFormat));
$dstFileInfo = $srcFileInfo
->changePath($srcFileInfo->getPath().FileInfo::SEPARATOR_DIR... | php | public function provideName(FileInfo $srcFileInfo)
{
$datetime = \DateTime::createFromFormat('U.u', microtime(true));
$pathSuffix = FileInfo::purifyPath($datetime->format($this->dirFormat));
$dstFileInfo = $srcFileInfo
->changePath($srcFileInfo->getPath().FileInfo::SEPARATOR_DIR... | [
"public",
"function",
"provideName",
"(",
"FileInfo",
"$",
"srcFileInfo",
")",
"{",
"$",
"datetime",
"=",
"\\",
"DateTime",
"::",
"createFromFormat",
"(",
"'U.u'",
",",
"microtime",
"(",
"true",
")",
")",
";",
"$",
"pathSuffix",
"=",
"FileInfo",
"::",
"pur... | {@inheritdoc} | [
"{"
] | train | https://github.com/bocharsky-bw/FileNamingResolver/blob/0a0fe86fee0e7acf1ab43a84c1abd51954ce2fbe/src/NamingStrategy/DatetimeNamingStrategy.php#L45-L56 |
baleen/cli | src/CommandBus/Config/InitHandler.php | InitHandler.handle | public function handle(InitMessage $message)
{
$output = $message->getOutput();
$configStorage = $message->getConfigStorage();
if ($configStorage->isInitialized($message->getConfig())) {
$output->writeln(sprintf(
'%s is already initialised!',
$mes... | php | public function handle(InitMessage $message)
{
$output = $message->getOutput();
$configStorage = $message->getConfigStorage();
if ($configStorage->isInitialized($message->getConfig())) {
$output->writeln(sprintf(
'%s is already initialised!',
$mes... | [
"public",
"function",
"handle",
"(",
"InitMessage",
"$",
"message",
")",
"{",
"$",
"output",
"=",
"$",
"message",
"->",
"getOutput",
"(",
")",
";",
"$",
"configStorage",
"=",
"$",
"message",
"->",
"getConfigStorage",
"(",
")",
";",
"if",
"(",
"$",
"con... | Handle an InitMessage. Creates an end-user configuration file using default values. If the file already exists
it simply exists without doing anything.
@param InitMessage $message | [
"Handle",
"an",
"InitMessage",
".",
"Creates",
"an",
"end",
"-",
"user",
"configuration",
"file",
"using",
"default",
"values",
".",
"If",
"the",
"file",
"already",
"exists",
"it",
"simply",
"exists",
"without",
"doing",
"anything",
"."
] | train | https://github.com/baleen/cli/blob/2ecbc7179c5800c9075fd93204ef25da375536ed/src/CommandBus/Config/InitHandler.php#L36-L62 |
pageon/SlackWebhookMonolog | src/Slack/Payload.php | Payload.setIcon | private function setIcon()
{
if (!$this->slackConfig->getCustomUser()->hasIcon()) {
return;
}
$iconType = 'icon_' . $this->slackConfig->getCustomUser()->getIcon()->getType();
$this->payload[$iconType] = $this->slackConfig->getCustomUser()->getIcon();
} | php | private function setIcon()
{
if (!$this->slackConfig->getCustomUser()->hasIcon()) {
return;
}
$iconType = 'icon_' . $this->slackConfig->getCustomUser()->getIcon()->getType();
$this->payload[$iconType] = $this->slackConfig->getCustomUser()->getIcon();
} | [
"private",
"function",
"setIcon",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"slackConfig",
"->",
"getCustomUser",
"(",
")",
"->",
"hasIcon",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"iconType",
"=",
"'icon_'",
".",
"$",
"this",
"->",
"s... | Set a custom icon if available. | [
"Set",
"a",
"custom",
"icon",
"if",
"available",
"."
] | train | https://github.com/pageon/SlackWebhookMonolog/blob/6755060ddd6429620fd4c7decbb95f05463fc36b/src/Slack/Payload.php#L93-L101 |
pageon/SlackWebhookMonolog | src/Slack/Payload.php | Payload.setUsername | private function setUsername()
{
if (!$this->slackConfig->getCustomUser()->hasUsername()) {
return;
}
$this->payload['username'] = $this->slackConfig->getCustomUser()->getUsername();
} | php | private function setUsername()
{
if (!$this->slackConfig->getCustomUser()->hasUsername()) {
return;
}
$this->payload['username'] = $this->slackConfig->getCustomUser()->getUsername();
} | [
"private",
"function",
"setUsername",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"slackConfig",
"->",
"getCustomUser",
"(",
")",
"->",
"hasUsername",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"payload",
"[",
"'username'",
"]",
... | Set a custom username if available. | [
"Set",
"a",
"custom",
"username",
"if",
"available",
"."
] | train | https://github.com/pageon/SlackWebhookMonolog/blob/6755060ddd6429620fd4c7decbb95f05463fc36b/src/Slack/Payload.php#L106-L113 |
pageon/SlackWebhookMonolog | src/Slack/Payload.php | Payload.setChannel | private function setChannel()
{
if (!$this->slackConfig->getWebhook()->hasCustomChannel()) {
return;
}
$this->payload['channel'] = $this->slackConfig->getWebhook()->getCustomChannel();
} | php | private function setChannel()
{
if (!$this->slackConfig->getWebhook()->hasCustomChannel()) {
return;
}
$this->payload['channel'] = $this->slackConfig->getWebhook()->getCustomChannel();
} | [
"private",
"function",
"setChannel",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"slackConfig",
"->",
"getWebhook",
"(",
")",
"->",
"hasCustomChannel",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"payload",
"[",
"'channel'",
"]",
... | Set a custom channel if available. | [
"Set",
"a",
"custom",
"channel",
"if",
"available",
"."
] | train | https://github.com/pageon/SlackWebhookMonolog/blob/6755060ddd6429620fd4c7decbb95f05463fc36b/src/Slack/Payload.php#L118-L125 |
pageon/SlackWebhookMonolog | src/Slack/Payload.php | Payload.setErrorData | private function setErrorData()
{
if (!isset($this->record['context']['error'])) {
return;
}
$this->errorData = $this->record['context']['error'];
// remove the error from the context so we can use it for for other things.
unset($this->record['context']['error']... | php | private function setErrorData()
{
if (!isset($this->record['context']['error'])) {
return;
}
$this->errorData = $this->record['context']['error'];
// remove the error from the context so we can use it for for other things.
unset($this->record['context']['error']... | [
"private",
"function",
"setErrorData",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"record",
"[",
"'context'",
"]",
"[",
"'error'",
"]",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"errorData",
"=",
"$",
"this",
"->",
... | If available set the error data. | [
"If",
"available",
"set",
"the",
"error",
"data",
"."
] | train | https://github.com/pageon/SlackWebhookMonolog/blob/6755060ddd6429620fd4c7decbb95f05463fc36b/src/Slack/Payload.php#L130-L140 |
nicolasmure/NmureEncryptor | src/Formatter/HexFormatter.php | HexFormatter.parse | public function parse($input, $ivLength)
{
$input = hex2bin($input);
return array(
self::KEY_IV => substr($input, 0, $ivLength),
self::KEY_DATA => substr($input, $ivLength, strlen($input)),
);
} | php | public function parse($input, $ivLength)
{
$input = hex2bin($input);
return array(
self::KEY_IV => substr($input, 0, $ivLength),
self::KEY_DATA => substr($input, $ivLength, strlen($input)),
);
} | [
"public",
"function",
"parse",
"(",
"$",
"input",
",",
"$",
"ivLength",
")",
"{",
"$",
"input",
"=",
"hex2bin",
"(",
"$",
"input",
")",
";",
"return",
"array",
"(",
"self",
"::",
"KEY_IV",
"=>",
"substr",
"(",
"$",
"input",
",",
"0",
",",
"$",
"i... | {@inheritdoc} | [
"{"
] | train | https://github.com/nicolasmure/NmureEncryptor/blob/571b5311e7230f5a1241706edacbb2346624634d/src/Formatter/HexFormatter.php#L20-L28 |
DeprecatedPackages/CodingStandard | src/ZenifyCodingStandard/Sniffs/Namespaces/UseDeclarationSniff.php | UseDeclarationSniff.shouldIgnoreUse | private function shouldIgnoreUse(PHP_CodeSniffer_File $file, $position) : bool
{
$tokens = $file->getTokens();
// Ignore USE keywords inside closures.
$next = $file->findNext(T_WHITESPACE, ($position + 1), NULL, TRUE);
if ($tokens[$next]['code'] === T_OPEN_PARENTHESIS) {
return TRUE;
}
// Ignore USE k... | php | private function shouldIgnoreUse(PHP_CodeSniffer_File $file, $position) : bool
{
$tokens = $file->getTokens();
// Ignore USE keywords inside closures.
$next = $file->findNext(T_WHITESPACE, ($position + 1), NULL, TRUE);
if ($tokens[$next]['code'] === T_OPEN_PARENTHESIS) {
return TRUE;
}
// Ignore USE k... | [
"private",
"function",
"shouldIgnoreUse",
"(",
"PHP_CodeSniffer_File",
"$",
"file",
",",
"$",
"position",
")",
":",
"bool",
"{",
"$",
"tokens",
"=",
"$",
"file",
"->",
"getTokens",
"(",
")",
";",
"// Ignore USE keywords inside closures.",
"$",
"next",
"=",
"$"... | Check if this use statement is part of the namespace block.
@param PHP_CodeSniffer_File $file
@param int|bool $position | [
"Check",
"if",
"this",
"use",
"statement",
"is",
"part",
"of",
"the",
"namespace",
"block",
"."
] | train | https://github.com/DeprecatedPackages/CodingStandard/blob/071a296bca199c8b7341e7c9e2f20f33d81b230e/src/ZenifyCodingStandard/Sniffs/Namespaces/UseDeclarationSniff.php#L84-L100 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/LoginLogQuery.php | LoginLogQuery.filterById | public function filterById($id = null, $comparison = null)
{
if (is_array($id)) {
$useMinMax = false;
if (isset($id['min'])) {
$this->addUsingAlias(LoginLogTableMap::COL_ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
... | php | public function filterById($id = null, $comparison = null)
{
if (is_array($id)) {
$useMinMax = false;
if (isset($id['min'])) {
$this->addUsingAlias(LoginLogTableMap::COL_ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
... | [
"public",
"function",
"filterById",
"(",
"$",
"id",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"id",
")",
")",
"{",
"$",
"useMinMax",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"$",
"id",
"[",
... | Filter the query on the id column
Example usage:
<code>
$query->filterById(1234); // WHERE id = 1234
$query->filterById(array(12, 34)); // WHERE id IN (12, 34)
$query->filterById(array('min' => 12)); // WHERE id > 12
</code>
@param mixed $id The value to use as filter.
Use scalar values for equality.
Use array va... | [
"Filter",
"the",
"query",
"on",
"the",
"id",
"column"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/LoginLogQuery.php#L270-L291 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/LoginLogQuery.php | LoginLogQuery.filterByType | public function filterByType($type = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($type)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $type)) {
$type = str_replace('*', '%', $type);
$comparison... | php | public function filterByType($type = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($type)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $type)) {
$type = str_replace('*', '%', $type);
$comparison... | [
"public",
"function",
"filterByType",
"(",
"$",
"type",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"type",
")",
")",
"{",
"$",
"comparison",
"=... | Filter the query on the type column
Example usage:
<code>
$query->filterByType('fooValue'); // WHERE type = 'fooValue'
$query->filterByType('%fooValue%'); // WHERE type LIKE '%fooValue%'
</code>
@param string $type The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $compari... | [
"Filter",
"the",
"query",
"on",
"the",
"type",
"column"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/LoginLogQuery.php#L308-L320 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/LoginLogQuery.php | LoginLogQuery.filterByClientAddress | public function filterByClientAddress($clientAddress = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($clientAddress)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $clientAddress)) {
$clientAddress = str_replace(... | php | public function filterByClientAddress($clientAddress = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($clientAddress)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $clientAddress)) {
$clientAddress = str_replace(... | [
"public",
"function",
"filterByClientAddress",
"(",
"$",
"clientAddress",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"clientAddress",
")",
")",
"{",
... | Filter the query on the client_address column
Example usage:
<code>
$query->filterByClientAddress('fooValue'); // WHERE client_address = 'fooValue'
$query->filterByClientAddress('%fooValue%'); // WHERE client_address LIKE '%fooValue%'
</code>
@param string $clientAddress The value to use as filter.
Accepts wild... | [
"Filter",
"the",
"query",
"on",
"the",
"client_address",
"column"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/LoginLogQuery.php#L467-L479 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/LoginLogQuery.php | LoginLogQuery.filterByClientIp | public function filterByClientIp($clientIp = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($clientIp)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $clientIp)) {
$clientIp = str_replace('*', '%', $clientIp);
... | php | public function filterByClientIp($clientIp = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($clientIp)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $clientIp)) {
$clientIp = str_replace('*', '%', $clientIp);
... | [
"public",
"function",
"filterByClientIp",
"(",
"$",
"clientIp",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"clientIp",
")",
")",
"{",
"$",
"compa... | Filter the query on the client_ip column
Example usage:
<code>
$query->filterByClientIp('fooValue'); // WHERE client_ip = 'fooValue'
$query->filterByClientIp('%fooValue%'); // WHERE client_ip LIKE '%fooValue%'
</code>
@param string $clientIp The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)... | [
"Filter",
"the",
"query",
"on",
"the",
"client_ip",
"column"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/LoginLogQuery.php#L496-L508 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/LoginLogQuery.php | LoginLogQuery.prune | public function prune($loginLog = null)
{
if ($loginLog) {
$this->addUsingAlias(LoginLogTableMap::COL_ID, $loginLog->getId(), Criteria::NOT_EQUAL);
}
return $this;
} | php | public function prune($loginLog = null)
{
if ($loginLog) {
$this->addUsingAlias(LoginLogTableMap::COL_ID, $loginLog->getId(), Criteria::NOT_EQUAL);
}
return $this;
} | [
"public",
"function",
"prune",
"(",
"$",
"loginLog",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"loginLog",
")",
"{",
"$",
"this",
"->",
"addUsingAlias",
"(",
"LoginLogTableMap",
"::",
"COL_ID",
",",
"$",
"loginLog",
"->",
"getId",
"(",
")",
",",
"Criteria... | Exclude object from result
@param ChildLoginLog $loginLog Object to remove from the list of results
@return $this|ChildLoginLogQuery The current query, for fluid interface | [
"Exclude",
"object",
"from",
"result"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/LoginLogQuery.php#L575-L582 |
withfatpanda/illuminate-wordpress | src/WordPress/Models/PostBuilder.php | PostBuilder.with | function with($meta, $operator = null, $value = null)
{
list($value, $operator) = $this->prepareValueAndOperator(
$value, $operator, func_num_args() == 2
);
static $count;
if (empty($count)) {
$count = 0;
}
if (!is_array($meta)) {
$meta = [ $meta => $value ];
}
foreach($meta as $key =>... | php | function with($meta, $operator = null, $value = null)
{
list($value, $operator) = $this->prepareValueAndOperator(
$value, $operator, func_num_args() == 2
);
static $count;
if (empty($count)) {
$count = 0;
}
if (!is_array($meta)) {
$meta = [ $meta => $value ];
}
foreach($meta as $key =>... | [
"function",
"with",
"(",
"$",
"meta",
",",
"$",
"operator",
"=",
"null",
",",
"$",
"value",
"=",
"null",
")",
"{",
"list",
"(",
"$",
"value",
",",
"$",
"operator",
")",
"=",
"$",
"this",
"->",
"prepareValueAndOperator",
"(",
"$",
"value",
",",
"$",... | Add one or more meta data conditions to the query. | [
"Add",
"one",
"or",
"more",
"meta",
"data",
"conditions",
"to",
"the",
"query",
"."
] | train | https://github.com/withfatpanda/illuminate-wordpress/blob/b426ca81a55367459430c974932ee5a941d759d8/src/WordPress/Models/PostBuilder.php#L11-L35 |
gdbots/pbjx-bundle-php | src/Controller/PbjxReceiveController.php | PbjxReceiveController.receiveAction | public function receiveAction(Request $request): JsonResponse
{
if (!$this->enabled) {
throw new AccessDeniedHttpException(
'The receive endpoint is not enabled.',
null,
Code::UNIMPLEMENTED
);
}
$token = $request->heade... | php | public function receiveAction(Request $request): JsonResponse
{
if (!$this->enabled) {
throw new AccessDeniedHttpException(
'The receive endpoint is not enabled.',
null,
Code::UNIMPLEMENTED
);
}
$token = $request->heade... | [
"public",
"function",
"receiveAction",
"(",
"Request",
"$",
"request",
")",
":",
"JsonResponse",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"enabled",
")",
"{",
"throw",
"new",
"AccessDeniedHttpException",
"(",
"'The receive endpoint is not enabled.'",
",",
"null",
... | @param Request $request
@return JsonResponse
@throws \Throwable | [
"@param",
"Request",
"$request"
] | train | https://github.com/gdbots/pbjx-bundle-php/blob/f3c0088583879fc92f13247a0752634bd8696eac/src/Controller/PbjxReceiveController.php#L65-L141 |
gdbots/pbjx-bundle-php | src/Controller/PbjxReceiveController.php | PbjxReceiveController.receiveMessage | private function receiveMessage(Message $message): void
{
if ($message instanceof Command) {
$this->locator->getCommandBus()->receiveCommand($message);
return;
}
if ($message instanceof Event) {
$this->locator->getEventBus()->receiveEvent($message);
... | php | private function receiveMessage(Message $message): void
{
if ($message instanceof Command) {
$this->locator->getCommandBus()->receiveCommand($message);
return;
}
if ($message instanceof Event) {
$this->locator->getEventBus()->receiveEvent($message);
... | [
"private",
"function",
"receiveMessage",
"(",
"Message",
"$",
"message",
")",
":",
"void",
"{",
"if",
"(",
"$",
"message",
"instanceof",
"Command",
")",
"{",
"$",
"this",
"->",
"locator",
"->",
"getCommandBus",
"(",
")",
"->",
"receiveCommand",
"(",
"$",
... | @param Message $message
@throws BadRequestHttpException | [
"@param",
"Message",
"$message"
] | train | https://github.com/gdbots/pbjx-bundle-php/blob/f3c0088583879fc92f13247a0752634bd8696eac/src/Controller/PbjxReceiveController.php#L148-L165 |
movoin/one-swoole | src/Protocol/Message/Headers.php | Headers.get | public function get(string $key, $default = null)
{
if ($this->has($key)) {
return parent::get($key)['value'];
}
return $default;
} | php | public function get(string $key, $default = null)
{
if ($this->has($key)) {
return parent::get($key)['value'];
}
return $default;
} | [
"public",
"function",
"get",
"(",
"string",
"$",
"key",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"has",
"(",
"$",
"key",
")",
")",
"{",
"return",
"parent",
"::",
"get",
"(",
"$",
"key",
")",
"[",
"'value'",
"]",... | 返回指定数据项
@param string $key
@param mixed $default
@return mixed | [
"返回指定数据项"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Protocol/Message/Headers.php#L53-L60 |
movoin/one-swoole | src/Protocol/Message/Headers.php | Headers.set | public function set(string $key, $value)
{
if (! is_array($value)) {
$value = [$value];
}
parent::set($key, [
'value' => $value,
'originalKey' => $key
]);
} | php | public function set(string $key, $value)
{
if (! is_array($value)) {
$value = [$value];
}
parent::set($key, [
'value' => $value,
'originalKey' => $key
]);
} | [
"public",
"function",
"set",
"(",
"string",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"[",
"$",
"value",
"]",
";",
"}",
"parent",
"::",
"set",
"(",
"$",
"key",
",... | 设置数据项
@param string $key
@param mixed $value | [
"设置数据项"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Protocol/Message/Headers.php#L85-L95 |
movoin/one-swoole | src/Protocol/Message/Headers.php | Headers.normalizeKey | public function normalizeKey(string $key): string
{
$key = strtr(strtolower(trim($key)), '_', '-');
if (strpos($key, 'http-') === 0) {
$key = substr($key, 5);
}
return $key;
} | php | public function normalizeKey(string $key): string
{
$key = strtr(strtolower(trim($key)), '_', '-');
if (strpos($key, 'http-') === 0) {
$key = substr($key, 5);
}
return $key;
} | [
"public",
"function",
"normalizeKey",
"(",
"string",
"$",
"key",
")",
":",
"string",
"{",
"$",
"key",
"=",
"strtr",
"(",
"strtolower",
"(",
"trim",
"(",
"$",
"key",
")",
")",
",",
"'_'",
",",
"'-'",
")",
";",
"if",
"(",
"strpos",
"(",
"$",
"key",... | 标准化键名
@param string $key
@return string | [
"标准化键名"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Protocol/Message/Headers.php#L119-L128 |
esperecyan/dictionary-php | src/parser/InteligenceoParser.php | InteligenceoParser.parseShiritoriLine | protected function parseShiritoriLine(Dictionary $dictionary, string $line)
{
$fields = explode(',', $line);
if (isset($fields[1]) && $this->isNumeric($fields[1])) {
throw new SyntaxException(sprintf(_('2列目に数値「%s」は含められません。'), $fields[1]));
}
$fieldsAsMul... | php | protected function parseShiritoriLine(Dictionary $dictionary, string $line)
{
$fields = explode(',', $line);
if (isset($fields[1]) && $this->isNumeric($fields[1])) {
throw new SyntaxException(sprintf(_('2列目に数値「%s」は含められません。'), $fields[1]));
}
$fieldsAsMul... | [
"protected",
"function",
"parseShiritoriLine",
"(",
"Dictionary",
"$",
"dictionary",
",",
"string",
"$",
"line",
")",
"{",
"$",
"fields",
"=",
"explode",
"(",
"','",
",",
"$",
"line",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"fields",
"[",
"1",
"]",
"... | しりとり辞書の行を解析します。
プレフィックス、サフィックスの組み合わせの結果がすべて空文字列になる時はnullを返します。
@param Dictionary $dictionary
@param string $line
@throws SyntaxException 2つ目のフィールド数値の場合。読み方が設定されていない場合。
読み方にしりとり辞書で使用可能なひらがな以外が含まれている、「ん」「ー」で始まる、「っー」「ゎー」「んー」「ーー」で終わる場合。 | [
"しりとり辞書の行を解析します。",
"プレフィックス、サフィックスの組み合わせの結果がすべて空文字列になる時はnullを返します。"
] | train | https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/parser/InteligenceoParser.php#L64-L156 |
esperecyan/dictionary-php | src/parser/InteligenceoParser.php | InteligenceoParser.parseQuizLines | protected function parseQuizLines(Dictionary $dictioanry, string $question, string $answer)
{
$line = "$question\n$answer";
$specifics = new URLSearchParams();
$questionFields = explode(',', $question, 5);
$answerFields = explode(',', $answer);
if (!$this->... | php | protected function parseQuizLines(Dictionary $dictioanry, string $question, string $answer)
{
$line = "$question\n$answer";
$specifics = new URLSearchParams();
$questionFields = explode(',', $question, 5);
$answerFields = explode(',', $answer);
if (!$this->... | [
"protected",
"function",
"parseQuizLines",
"(",
"Dictionary",
"$",
"dictioanry",
",",
"string",
"$",
"question",
",",
"string",
"$",
"answer",
")",
"{",
"$",
"line",
"=",
"\"$question\\n$answer\"",
";",
"$",
"specifics",
"=",
"new",
"URLSearchParams",
"(",
")"... | Q&Aを解析します。
@param Dictionary $dictioanry
@param string $question
@param string $answer | [
"Q&Aを解析します。"
] | train | https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/parser/InteligenceoParser.php#L180-L508 |
esperecyan/dictionary-php | src/parser/InteligenceoParser.php | InteligenceoParser.decodeCommaInTaggingEntity | protected function decodeCommaInTaggingEntity(string $fileLocation): string
{
return preg_replace_callback(
'/^(tag:)((?:"(?:[^"\\\\]|\\\\.)*"|[^"]+@)?[^:]+)/iu',
function (array $matches): string {
return $matches[1] . str_replace('%2C', ',', $matches[2]);
... | php | protected function decodeCommaInTaggingEntity(string $fileLocation): string
{
return preg_replace_callback(
'/^(tag:)((?:"(?:[^"\\\\]|\\\\.)*"|[^"]+@)?[^:]+)/iu',
function (array $matches): string {
return $matches[1] . str_replace('%2C', ',', $matches[2]);
... | [
"protected",
"function",
"decodeCommaInTaggingEntity",
"(",
"string",
"$",
"fileLocation",
")",
":",
"string",
"{",
"return",
"preg_replace_callback",
"(",
"'/^(tag:)((?:\"(?:[^\"\\\\\\\\]|\\\\\\\\.)*\"|[^\"]+@)?[^:]+)/iu'",
",",
"function",
"(",
"array",
"$",
"matches",
")... | tag URLにおけるtaggingEntity中の不正にパーセント符号化された「,」を複号します。
@param string $fileLocation | [
"tag",
"URLにおけるtaggingEntity中の不正にパーセント符号化された「",
"」を複号します。"
] | train | https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/parser/InteligenceoParser.php#L514-L523 |
esperecyan/dictionary-php | src/parser/InteligenceoParser.php | InteligenceoParser.parseQuestionLine | protected function parseQuestionLine(Dictionary $dictionary, string $question = null)
{
if ($this->answers) {
// 未解析の解答が存在する場合
$this->parseQuizLines($dictionary, $this->question, $this->answers);
$this->question = null;
$this->answers = null;
} elseif ... | php | protected function parseQuestionLine(Dictionary $dictionary, string $question = null)
{
if ($this->answers) {
// 未解析の解答が存在する場合
$this->parseQuizLines($dictionary, $this->question, $this->answers);
$this->question = null;
$this->answers = null;
} elseif ... | [
"protected",
"function",
"parseQuestionLine",
"(",
"Dictionary",
"$",
"dictionary",
",",
"string",
"$",
"question",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"answers",
")",
"{",
"// 未解析の解答が存在する場合",
"$",
"this",
"->",
"parseQuizLines",
"(",
"$",
... | 問題行を解析します。
@param Dictionary $dictionary
@param string $question
@throws SyntaxException すでに未解析の問題行が存在していた場合。 | [
"問題行を解析します。"
] | train | https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/parser/InteligenceoParser.php#L531-L543 |
esperecyan/dictionary-php | src/parser/InteligenceoParser.php | InteligenceoParser.parseAnswerLine | protected function parseAnswerLine(string $answer)
{
if (is_null($this->question)) {
throw new SyntaxException(_('辞書は「Q,」で始めなければなりません。'));
} elseif ($this->answers) {
$this->answers .= ",$answer";
} else {
$this->answers = $answer;
}
} | php | protected function parseAnswerLine(string $answer)
{
if (is_null($this->question)) {
throw new SyntaxException(_('辞書は「Q,」で始めなければなりません。'));
} elseif ($this->answers) {
$this->answers .= ",$answer";
} else {
$this->answers = $answer;
}
} | [
"protected",
"function",
"parseAnswerLine",
"(",
"string",
"$",
"answer",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"question",
")",
")",
"{",
"throw",
"new",
"SyntaxException",
"(",
"_",
"(",
"'辞書は「Q,」で始めなければなりません。'));",
"",
"",
"",
"}",
"... | 問題行を解析します。
@param string $answer
@throws SyntaxException 未解析の問題行が存在していない場合。 | [
"問題行を解析します。"
] | train | https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/parser/InteligenceoParser.php#L550-L559 |
esperecyan/dictionary-php | src/parser/InteligenceoParser.php | InteligenceoParser.parseLine | protected function parseLine(Dictionary $dictionary, string $line = null)
{
if (is_null($line)) {
if ($this->type === 'Inteligenceω クイズ') {
$output = $this->parseQuestionLine($dictionary, null);
}
} elseif ($line[0] !== '%') {
// 空行でなければ
... | php | protected function parseLine(Dictionary $dictionary, string $line = null)
{
if (is_null($line)) {
if ($this->type === 'Inteligenceω クイズ') {
$output = $this->parseQuestionLine($dictionary, null);
}
} elseif ($line[0] !== '%') {
// 空行でなければ
... | [
"protected",
"function",
"parseLine",
"(",
"Dictionary",
"$",
"dictionary",
",",
"string",
"$",
"line",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"line",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"type",
"===",
"'Inteligenceω クイズ') {",
... | 行を解析します。
@param Dictionary $dictionary
@param string|null ファイル終端ならnull。
@throws SyntaxException クイズ辞書で、コメント、問題、解答のいずれでもない行があれば
@return Word|null | [
"行を解析します。"
] | train | https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/parser/InteligenceoParser.php#L568-L596 |
esperecyan/dictionary-php | src/parser/InteligenceoParser.php | InteligenceoParser.getTitleFromFilename | protected function getTitleFromFilename(string $filename)
{
$withoutExtension = pathinfo($filename, PATHINFO_FILENAME);
return $withoutExtension !== '' ? $withoutExtension : $filename;
} | php | protected function getTitleFromFilename(string $filename)
{
$withoutExtension = pathinfo($filename, PATHINFO_FILENAME);
return $withoutExtension !== '' ? $withoutExtension : $filename;
} | [
"protected",
"function",
"getTitleFromFilename",
"(",
"string",
"$",
"filename",
")",
"{",
"$",
"withoutExtension",
"=",
"pathinfo",
"(",
"$",
"filename",
",",
"PATHINFO_FILENAME",
")",
";",
"return",
"$",
"withoutExtension",
"!==",
"''",
"?",
"$",
"withoutExten... | ファイル名から辞書のタイトルを取得します。
@param string $filename
@return string|null | [
"ファイル名から辞書のタイトルを取得します。"
] | train | https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/parser/InteligenceoParser.php#L603-L607 |
esperecyan/dictionary-php | src/parser/InteligenceoParser.php | InteligenceoParser.correctArchiveFilenamesEncoding | protected function correctArchiveFilenamesEncoding(ZipFile $archive)
{
$parser = new GenericDictionaryParser();
foreach ($archive->getListFiles() as $filename) {
$corrected = $parser->correctEncoding($filename);
if ($filename !== $corrected) {
$archive->rename... | php | protected function correctArchiveFilenamesEncoding(ZipFile $archive)
{
$parser = new GenericDictionaryParser();
foreach ($archive->getListFiles() as $filename) {
$corrected = $parser->correctEncoding($filename);
if ($filename !== $corrected) {
$archive->rename... | [
"protected",
"function",
"correctArchiveFilenamesEncoding",
"(",
"ZipFile",
"$",
"archive",
")",
"{",
"$",
"parser",
"=",
"new",
"GenericDictionaryParser",
"(",
")",
";",
"foreach",
"(",
"$",
"archive",
"->",
"getListFiles",
"(",
")",
"as",
"$",
"filename",
")... | アーカイブ中のファイル名の符号化方式をUTF-8に矯正します。
@param ZipFile $archive | [
"アーカイブ中のファイル名の符号化方式をUTF",
"-",
"8に矯正します。"
] | train | https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/parser/InteligenceoParser.php#L613-L622 |
esperecyan/dictionary-php | src/parser/InteligenceoParser.php | InteligenceoParser.flattenArchive | protected function flattenArchive(ZipFile $archive)
{
$validator = new validator\FileLocationValidator();
foreach ($archive->getListFiles() as $filename) {
if (\Stringy\StaticStringy::endsWith($filename, '/')) {
$archive->deleteFromName($directory);
} else {
... | php | protected function flattenArchive(ZipFile $archive)
{
$validator = new validator\FileLocationValidator();
foreach ($archive->getListFiles() as $filename) {
if (\Stringy\StaticStringy::endsWith($filename, '/')) {
$archive->deleteFromName($directory);
} else {
... | [
"protected",
"function",
"flattenArchive",
"(",
"ZipFile",
"$",
"archive",
")",
"{",
"$",
"validator",
"=",
"new",
"validator",
"\\",
"FileLocationValidator",
"(",
")",
";",
"foreach",
"(",
"$",
"archive",
"->",
"getListFiles",
"(",
")",
"as",
"$",
"filename... | アーカイブ中のディレクトリ構造を除去します。
@param ZipFile $archive
@throws SyntaxException 同名のファイルが存在する場合。 | [
"アーカイブ中のディレクトリ構造を除去します。"
] | train | https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/parser/InteligenceoParser.php#L629-L645 |
esperecyan/dictionary-php | src/parser/InteligenceoParser.php | InteligenceoParser.correctArchiveFilenames | protected function correctArchiveFilenames(ZipFile $archive): array
{
$filenames = [];
foreach ($archive->getListFiles() as $filename) {
$corrected = (new validator\FilenameValidator(null, $filenames, false))->correct($filename);
if ($filename !== $corrected) {
... | php | protected function correctArchiveFilenames(ZipFile $archive): array
{
$filenames = [];
foreach ($archive->getListFiles() as $filename) {
$corrected = (new validator\FilenameValidator(null, $filenames, false))->correct($filename);
if ($filename !== $corrected) {
... | [
"protected",
"function",
"correctArchiveFilenames",
"(",
"ZipFile",
"$",
"archive",
")",
":",
"array",
"{",
"$",
"filenames",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"archive",
"->",
"getListFiles",
"(",
")",
"as",
"$",
"filename",
")",
"{",
"$",
"corre... | アーカイブ中のファイル名を矯正します。
@param ZipFile $archive
@return string[] ファイル名の一覧。矯正を行った場合は、キーに矯正前のファイル名を持ちます。 | [
"アーカイブ中のファイル名を矯正します。"
] | train | https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/parser/InteligenceoParser.php#L652-L668 |
esperecyan/dictionary-php | src/parser/InteligenceoParser.php | InteligenceoParser.parseArchive | protected function parseArchive(\SplFileInfo $file): \SplFileInfo
{
$archive = (new ZipFile())->openFile(
$file instanceof \SplTempFileObject ? $this->generateTempFile($file) : $file->getRealPath()
);
$this->correctArchiveFilenamesEncoding($archive);
$this->flattenArchive... | php | protected function parseArchive(\SplFileInfo $file): \SplFileInfo
{
$archive = (new ZipFile())->openFile(
$file instanceof \SplTempFileObject ? $this->generateTempFile($file) : $file->getRealPath()
);
$this->correctArchiveFilenamesEncoding($archive);
$this->flattenArchive... | [
"protected",
"function",
"parseArchive",
"(",
"\\",
"SplFileInfo",
"$",
"file",
")",
":",
"\\",
"SplFileInfo",
"{",
"$",
"archive",
"=",
"(",
"new",
"ZipFile",
"(",
")",
")",
"->",
"openFile",
"(",
"$",
"file",
"instanceof",
"\\",
"SplTempFileObject",
"?",... | ZIPアーカイブを解析し、ファイルの矯正を行います。
@param \SplFileInfo $file
@throws SyntaxException
@return \SplFileInfo | [
"ZIPアーカイブを解析し、ファイルの矯正を行います。"
] | train | https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/parser/InteligenceoParser.php#L676-L716 |
stubbles/stubbles-webapp-core | src/main/php/response/mimetypes/Json.php | Json.serialize | public function serialize($resource, OutputStream $out): OutputStream
{
$out->write(json_encode($resource));
return $out;
} | php | public function serialize($resource, OutputStream $out): OutputStream
{
$out->write(json_encode($resource));
return $out;
} | [
"public",
"function",
"serialize",
"(",
"$",
"resource",
",",
"OutputStream",
"$",
"out",
")",
":",
"OutputStream",
"{",
"$",
"out",
"->",
"write",
"(",
"json_encode",
"(",
"$",
"resource",
")",
")",
";",
"return",
"$",
"out",
";",
"}"
] | serializes resource to output stream
@param mixed $resource
@param \stubbles\streams\OutputStream $out
@return \stubbles\streams\OutputStream | [
"serializes",
"resource",
"to",
"output",
"stream"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/response/mimetypes/Json.php#L37-L41 |
CalderaWP/magic-tags | src/magictag.php | magictag.do_magic_tag | public function do_magic_tag($content){
// check for magics
preg_match_all("/\{(.+?)\}/", (string) $content, $magics);
// on found tags
if(!empty($magics[1])){
foreach($magics[1] as $magic_key=>$magic_tag){
$params = explode(':', $magic_tag, 2 );
if( empty( $params[1] ) ){ continue; }
// filt... | php | public function do_magic_tag($content){
// check for magics
preg_match_all("/\{(.+?)\}/", (string) $content, $magics);
// on found tags
if(!empty($magics[1])){
foreach($magics[1] as $magic_key=>$magic_tag){
$params = explode(':', $magic_tag, 2 );
if( empty( $params[1] ) ){ continue; }
// filt... | [
"public",
"function",
"do_magic_tag",
"(",
"$",
"content",
")",
"{",
"// check for magics",
"preg_match_all",
"(",
"\"/\\{(.+?)\\}/\"",
",",
"(",
"string",
")",
"$",
"content",
",",
"$",
"magics",
")",
";",
"// on found tags",
"if",
"(",
"!",
"empty",
"(",
"... | Renders a magic tag
@return string converted string with matched tags replaced | [
"Renders",
"a",
"magic",
"tag"
] | train | https://github.com/CalderaWP/magic-tags/blob/0e46a6d187bff87c027ed8a6a9e09446aa5f3bd9/src/magictag.php#L48-L71 |
CalderaWP/magic-tags | src/magictag.php | magictag.get_post_value | private function get_post_value( $field, $in_params, $post ){
if( !is_object( $post ) ){
return $in_params;
}
if ( 'permalink' == $field || 'post_permalink' == $field ) {
return esc_url( get_permalink( $post->ID ) );
}
//handle auto-generated and <!--more--> tag excerpts @since 1.1.0
if ( 'post_... | php | private function get_post_value( $field, $in_params, $post ){
if( !is_object( $post ) ){
return $in_params;
}
if ( 'permalink' == $field || 'post_permalink' == $field ) {
return esc_url( get_permalink( $post->ID ) );
}
//handle auto-generated and <!--more--> tag excerpts @since 1.1.0
if ( 'post_... | [
"private",
"function",
"get_post_value",
"(",
"$",
"field",
",",
"$",
"in_params",
",",
"$",
"post",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"post",
")",
")",
"{",
"return",
"$",
"in_params",
";",
"}",
"if",
"(",
"'permalink'",
"==",
"$",
... | Gets a posts meta value
@since 0.0.1
@return string post field value | [
"Gets",
"a",
"posts",
"meta",
"value"
] | train | https://github.com/CalderaWP/magic-tags/blob/0e46a6d187bff87c027ed8a6a9e09446aa5f3bd9/src/magictag.php#L80-L123 |
withfatpanda/illuminate-wordpress | src/WordPress/Models/FieldGroup.php | FieldGroup.buildConfig | function buildConfig(Plugin $plugin)
{
if (!empty($this->fields)) {
$this->config['fields'] = [];
foreach($this->fields as $field) {
$this->config['fields'][] = $field->buildConfig($plugin);
}
}
if (!is_null($this->id)) {
$this->config['id'] = $this->id;
}
return ... | php | function buildConfig(Plugin $plugin)
{
if (!empty($this->fields)) {
$this->config['fields'] = [];
foreach($this->fields as $field) {
$this->config['fields'][] = $field->buildConfig($plugin);
}
}
if (!is_null($this->id)) {
$this->config['id'] = $this->id;
}
return ... | [
"function",
"buildConfig",
"(",
"Plugin",
"$",
"plugin",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"fields",
")",
")",
"{",
"$",
"this",
"->",
"config",
"[",
"'fields'",
"]",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",... | Build field group config
@return array | [
"Build",
"field",
"group",
"config"
] | train | https://github.com/withfatpanda/illuminate-wordpress/blob/b426ca81a55367459430c974932ee5a941d759d8/src/WordPress/Models/FieldGroup.php#L196-L210 |
Wonail/wocenter | traits/DispatchTrait.php | DispatchTrait.error | public function error($message = '', $jumpUrl = '', $data = [])
{
return $this->getDispatch()->error($message, $jumpUrl, $data);
} | php | public function error($message = '', $jumpUrl = '', $data = [])
{
return $this->getDispatch()->error($message, $jumpUrl, $data);
} | [
"public",
"function",
"error",
"(",
"$",
"message",
"=",
"''",
",",
"$",
"jumpUrl",
"=",
"''",
",",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"getDispatch",
"(",
")",
"->",
"error",
"(",
"$",
"message",
",",
"$",
"jumpUrl... | 操作失败后返回结果至客户端
@param string|array $message 提示信息
@param string|array $jumpUrl 页面跳转地址
@param mixed $data
- 为整数,则代表页面跳转停留时间,默认为3妙,时间结束后自动跳转至指定的`$jumpUrl`页面
- 为数组,则代表返回给客户端的数据
@return mixed | [
"操作失败后返回结果至客户端"
] | train | https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/traits/DispatchTrait.php#L101-L104 |
Wonail/wocenter | traits/DispatchTrait.php | DispatchTrait.success | public function success($message = '', $jumpUrl = '', $data = [])
{
return $this->getDispatch()->success($message, $jumpUrl, $data);
} | php | public function success($message = '', $jumpUrl = '', $data = [])
{
return $this->getDispatch()->success($message, $jumpUrl, $data);
} | [
"public",
"function",
"success",
"(",
"$",
"message",
"=",
"''",
",",
"$",
"jumpUrl",
"=",
"''",
",",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"getDispatch",
"(",
")",
"->",
"success",
"(",
"$",
"message",
",",
"$",
"jum... | 操作成功后返回结果至客户端
@param string|array $message 提示信息
@param string|array $jumpUrl 页面跳转地址
@param mixed $data
- 为整数,则代表页面跳转停留时间,默认为1妙,时间结束后自动跳转至指定的`$jumpUrl`页面
- 为数组,则代表返回给客户端的数据
@return mixed | [
"操作成功后返回结果至客户端"
] | train | https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/traits/DispatchTrait.php#L117-L120 |
Wonail/wocenter | traits/DispatchTrait.php | DispatchTrait.normalizeDispatchNamespace | public function normalizeDispatchNamespace($route)
{
$route = explode('/', $route);
foreach ($route as &$part) {
if (strpos($part, '-') !== false) {
$part = Inflector::variablize($part);
}
}
return ($this->_isDeveloperMode() ? $this->d... | php | public function normalizeDispatchNamespace($route)
{
$route = explode('/', $route);
foreach ($route as &$part) {
if (strpos($part, '-') !== false) {
$part = Inflector::variablize($part);
}
}
return ($this->_isDeveloperMode() ? $this->d... | [
"public",
"function",
"normalizeDispatchNamespace",
"(",
"$",
"route",
")",
"{",
"$",
"route",
"=",
"explode",
"(",
"'/'",
",",
"$",
"route",
")",
";",
"foreach",
"(",
"$",
"route",
"as",
"&",
"$",
"part",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"... | 格式化带'-_'字符的调度器路由地址
例如:ConfigManager控制器,路由地址为'config-manager',调度器在处理路由地址时,因命名空间不支持带'-'的命名方式,
因此需要处理该字符窜,操作将返回如`configManager`这样格式的字符窜
@param string $route
@return string | [
"格式化带",
"-",
"_",
"字符的调度器路由地址",
"例如:ConfigManager控制器,路由地址为",
"config",
"-",
"manager",
",调度器在处理路由地址时,因命名空间不支持带",
"-",
"的命名方式,",
"因此需要处理该字符窜,操作将返回如",
"configManager",
"这样格式的字符窜"
] | train | https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/traits/DispatchTrait.php#L201-L212 |
Wonail/wocenter | traits/DispatchTrait.php | DispatchTrait.getDispatch | public function getDispatch($route = null)
{
// 没有指定调度路由则默认获取主题公共调度器
return $route === null ? $this->getCommonDispatch() : $this->_getDispatchByRoute($route);
} | php | public function getDispatch($route = null)
{
// 没有指定调度路由则默认获取主题公共调度器
return $route === null ? $this->getCommonDispatch() : $this->_getDispatchByRoute($route);
} | [
"public",
"function",
"getDispatch",
"(",
"$",
"route",
"=",
"null",
")",
"{",
"// 没有指定调度路由则默认获取主题公共调度器",
"return",
"$",
"route",
"===",
"null",
"?",
"$",
"this",
"->",
"getCommonDispatch",
"(",
")",
":",
"$",
"this",
"->",
"_getDispatchByRoute",
"(",
"$",
... | 根据路由地址获取调度器,默认获取主题公共调度器
该方法和[[run()|runAction()]]方法类似,唯一区别是在获取到指定调度器时不默认执行[[run()]],而是可以自由调用调度器里面的方法,
这样可以有效实现部分代码重用
@param null|string $route 调度路由,支持以下格式:'view', 'comment/view', '/admin/comment/view'
@return null|Dispatch | [
"根据路由地址获取调度器,默认获取主题公共调度器"
] | train | https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/traits/DispatchTrait.php#L238-L242 |
Wonail/wocenter | traits/DispatchTrait.php | DispatchTrait._createDispatchByConfig | private function _createDispatchByConfig($id, $config)
{
if (!is_array($config)) {
$config = ['class' => $config];
}
internal:
$className = ltrim($config['class'], '\\');
$dispatch = null;
if (class_exists($className)) {
if (i... | php | private function _createDispatchByConfig($id, $config)
{
if (!is_array($config)) {
$config = ['class' => $config];
}
internal:
$className = ltrim($config['class'], '\\');
$dispatch = null;
if (class_exists($className)) {
if (i... | [
"private",
"function",
"_createDispatchByConfig",
"(",
"$",
"id",
",",
"$",
"config",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"config",
")",
")",
"{",
"$",
"config",
"=",
"[",
"'class'",
"=>",
"$",
"config",
"]",
";",
"}",
"internal",
":",
... | 根据调度器配置创建调度器
@param string $id 调度器ID
@param string|array $config 调度器类名或调度器配置信息
@return null|Dispatch|object
@throws Exception
@throws InvalidConfigException | [
"根据调度器配置创建调度器"
] | train | https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/traits/DispatchTrait.php#L254-L292 |
Wonail/wocenter | traits/DispatchTrait.php | DispatchTrait._createDispatch | private function _createDispatch($id, $withConfig = true)
{
if ($id === '') {
$id = $this->defaultAction;
}
if ($withConfig) {
$dispatchMap = $this->dispatches();
// 存在调度配置信息则执行自定义调度,否则终止调度行为
if (in_array($id, $dispatchMap) || isset($d... | php | private function _createDispatch($id, $withConfig = true)
{
if ($id === '') {
$id = $this->defaultAction;
}
if ($withConfig) {
$dispatchMap = $this->dispatches();
// 存在调度配置信息则执行自定义调度,否则终止调度行为
if (in_array($id, $dispatchMap) || isset($d... | [
"private",
"function",
"_createDispatch",
"(",
"$",
"id",
",",
"$",
"withConfig",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"id",
"===",
"''",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"defaultAction",
";",
"}",
"if",
"(",
"$",
"withConfig",
")",
... | 根据调度器ID创建调度器
@param string $id 调度器ID
@param bool $withConfig 是否使用调度器配置。默认使用,即根据`[[dispatches()]]`配置来创建调度器
@return null|Dispatch
@throws InvalidConfigException | [
"根据调度器ID创建调度器"
] | train | https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/traits/DispatchTrait.php#L303-L351 |
Wonail/wocenter | traits/DispatchTrait.php | DispatchTrait._getDispatchByRoute | private function _getDispatchByRoute($route)
{
$pos = strpos($route, '/');
if ($pos === false) {
$parts = [$this, $route];
} elseif ($pos > 0) {
$parts = $this->module->createController($route);
} else {
$parts = Yii::$app->createController($route)... | php | private function _getDispatchByRoute($route)
{
$pos = strpos($route, '/');
if ($pos === false) {
$parts = [$this, $route];
} elseif ($pos > 0) {
$parts = $this->module->createController($route);
} else {
$parts = Yii::$app->createController($route)... | [
"private",
"function",
"_getDispatchByRoute",
"(",
"$",
"route",
")",
"{",
"$",
"pos",
"=",
"strpos",
"(",
"$",
"route",
",",
"'/'",
")",
";",
"if",
"(",
"$",
"pos",
"===",
"false",
")",
"{",
"$",
"parts",
"=",
"[",
"$",
"this",
",",
"$",
"route"... | 根据路由地址获取调度器
@param string $route 调度路由,支持以下格式:'view', 'comment/view', '/admin/comment/view'
@return null|Dispatch
@throws InvalidRouteException | [
"根据路由地址获取调度器"
] | train | https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/traits/DispatchTrait.php#L361-L387 |
Wonail/wocenter | traits/DispatchTrait.php | DispatchTrait._generateDispatchFile | private function _generateDispatchFile($className)
{
$file = '@' . str_replace('\\', '/', ltrim($className, '\\')) . '.php';
$file = str_replace('\\', DIRECTORY_SEPARATOR, Yii::getAlias($file));
throw new Exception("请在该路径下创建调度器文件:\r\n{$file}");
} | php | private function _generateDispatchFile($className)
{
$file = '@' . str_replace('\\', '/', ltrim($className, '\\')) . '.php';
$file = str_replace('\\', DIRECTORY_SEPARATOR, Yii::getAlias($file));
throw new Exception("请在该路径下创建调度器文件:\r\n{$file}");
} | [
"private",
"function",
"_generateDispatchFile",
"(",
"$",
"className",
")",
"{",
"$",
"file",
"=",
"'@'",
".",
"str_replace",
"(",
"'\\\\'",
",",
"'/'",
",",
"ltrim",
"(",
"$",
"className",
",",
"'\\\\'",
")",
")",
".",
"'.php'",
";",
"$",
"file",
"=",... | 调度器不存在则抛出友好提示信息
@param string $className 调度器类名
@throws Exception | [
"调度器不存在则抛出友好提示信息"
] | train | https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/traits/DispatchTrait.php#L396-L401 |
phramework/jsonapi | src/Controller/GET.php | GET.handleGET | protected static function handleGET(
$parameters,
$modelClass,
$primaryDataParameters = [],
$relationshipParameters = []
) {
$page = $modelClass::parsePage($parameters);
$filter = $modelClass::parseFilter($parameters);
$sort = $modelClass::parseSort($param... | php | protected static function handleGET(
$parameters,
$modelClass,
$primaryDataParameters = [],
$relationshipParameters = []
) {
$page = $modelClass::parsePage($parameters);
$filter = $modelClass::parseFilter($parameters);
$sort = $modelClass::parseSort($param... | [
"protected",
"static",
"function",
"handleGET",
"(",
"$",
"parameters",
",",
"$",
"modelClass",
",",
"$",
"primaryDataParameters",
"=",
"[",
"]",
",",
"$",
"relationshipParameters",
"=",
"[",
"]",
")",
"{",
"$",
"page",
"=",
"$",
"modelClass",
"::",
"parse... | handles GET requests
@param object $parameters Request parameters
@param string $modelClass Resource's primary model class name
to be used
@param array $primaryDataParameters *[Optional]* Array with any
additional arguments that the primary data is requiring
@param array $relationshi... | [
"handles",
"GET",
"requests"
] | train | https://github.com/phramework/jsonapi/blob/af20882a8b6f6e5be9c8e09e5b87f6c23a4b0726/src/Controller/GET.php#L59-L104 |
movoin/one-swoole | src/FileSystem/Adapters/Local.php | Local.read | public function read(string $path): string
{
$location = $this->applyBasePath($path);
$content = file_get_contents($location);
unset($location);
return $content;
} | php | public function read(string $path): string
{
$location = $this->applyBasePath($path);
$content = file_get_contents($location);
unset($location);
return $content;
} | [
"public",
"function",
"read",
"(",
"string",
"$",
"path",
")",
":",
"string",
"{",
"$",
"location",
"=",
"$",
"this",
"->",
"applyBasePath",
"(",
"$",
"path",
")",
";",
"$",
"content",
"=",
"file_get_contents",
"(",
"$",
"location",
")",
";",
"unset",
... | 读取文件内容
@param string $path
@return string | [
"读取文件内容"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/Adapters/Local.php#L96-L104 |
movoin/one-swoole | src/FileSystem/Adapters/Local.php | Local.readStream | public function readStream(string $path)
{
$location = $this->applyBasePath($path);
$stream = @fopen($location, 'rb');
unset($location);
return $stream;
} | php | public function readStream(string $path)
{
$location = $this->applyBasePath($path);
$stream = @fopen($location, 'rb');
unset($location);
return $stream;
} | [
"public",
"function",
"readStream",
"(",
"string",
"$",
"path",
")",
"{",
"$",
"location",
"=",
"$",
"this",
"->",
"applyBasePath",
"(",
"$",
"path",
")",
";",
"$",
"stream",
"=",
"@",
"fopen",
"(",
"$",
"location",
",",
"'rb'",
")",
";",
"unset",
... | 从文件中读取数据流
@param string $path
@return resource | [
"从文件中读取数据流"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/Adapters/Local.php#L113-L121 |
movoin/one-swoole | src/FileSystem/Adapters/Local.php | Local.listContents | public function listContents(string $directory = '', bool $recursive = false): array
{
$list = [];
$location = $this->applyBasePath($directory);
if (! is_dir($location)) {
return $list;
}
$iterator = $recursive ?
$this->getRecursiveDirectoryI... | php | public function listContents(string $directory = '', bool $recursive = false): array
{
$list = [];
$location = $this->applyBasePath($directory);
if (! is_dir($location)) {
return $list;
}
$iterator = $recursive ?
$this->getRecursiveDirectoryI... | [
"public",
"function",
"listContents",
"(",
"string",
"$",
"directory",
"=",
"''",
",",
"bool",
"$",
"recursive",
"=",
"false",
")",
":",
"array",
"{",
"$",
"list",
"=",
"[",
"]",
";",
"$",
"location",
"=",
"$",
"this",
"->",
"applyBasePath",
"(",
"$"... | 返回目录中的内容
@param string $directory
@param bool $recursive
@return array | [
"返回目录中的内容"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/Adapters/Local.php#L131-L159 |
movoin/one-swoole | src/FileSystem/Adapters/Local.php | Local.update | public function update(string $path, string $contents, array $config = []): bool
{
$location = $this->applyBasePath($path);
$this->ensureDirectory(dirname($location));
if (file_put_contents($location, $contents, $this->writeFlags) === false) {
return false;
}
if... | php | public function update(string $path, string $contents, array $config = []): bool
{
$location = $this->applyBasePath($path);
$this->ensureDirectory(dirname($location));
if (file_put_contents($location, $contents, $this->writeFlags) === false) {
return false;
}
if... | [
"public",
"function",
"update",
"(",
"string",
"$",
"path",
",",
"string",
"$",
"contents",
",",
"array",
"$",
"config",
"=",
"[",
"]",
")",
":",
"bool",
"{",
"$",
"location",
"=",
"$",
"this",
"->",
"applyBasePath",
"(",
"$",
"path",
")",
";",
"$"... | 更新文件内容
@param string $path
@param string $contents
@param array $config
@return bool
@throws \One\FileSystem\Exceptions\FileSystemException | [
"更新文件内容"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/Adapters/Local.php#L234-L250 |
movoin/one-swoole | src/FileSystem/Adapters/Local.php | Local.updateStream | public function updateStream(string $path, $resource, array $config = []): bool
{
$location = $this->applyBasePath($path);
$this->ensureDirectory(dirname($location));
$stream = @fopen($location, 'w+b');
if (! $stream) {
return false;
}
stream_copy_to_str... | php | public function updateStream(string $path, $resource, array $config = []): bool
{
$location = $this->applyBasePath($path);
$this->ensureDirectory(dirname($location));
$stream = @fopen($location, 'w+b');
if (! $stream) {
return false;
}
stream_copy_to_str... | [
"public",
"function",
"updateStream",
"(",
"string",
"$",
"path",
",",
"$",
"resource",
",",
"array",
"$",
"config",
"=",
"[",
"]",
")",
":",
"bool",
"{",
"$",
"location",
"=",
"$",
"this",
"->",
"applyBasePath",
"(",
"$",
"path",
")",
";",
"$",
"t... | 以数据流的方式更新文件内容
@param string $path
@param resource $resource
@param array $config
@return bool
@throws \One\FileSystem\Exceptions\FileSystemException | [
"以数据流的方式更新文件内容"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/Adapters/Local.php#L262-L285 |
movoin/one-swoole | src/FileSystem/Adapters/Local.php | Local.getMetaData | public function getMetaData(string $path): array
{
$location = $this->applyBasePath($path);
$info = new SplFileInfo($location);
$metadata = $this->normalizeFileInfo($info);
unset($location, $info);
return $metadata === null ? [] : $metadata;
} | php | public function getMetaData(string $path): array
{
$location = $this->applyBasePath($path);
$info = new SplFileInfo($location);
$metadata = $this->normalizeFileInfo($info);
unset($location, $info);
return $metadata === null ? [] : $metadata;
} | [
"public",
"function",
"getMetaData",
"(",
"string",
"$",
"path",
")",
":",
"array",
"{",
"$",
"location",
"=",
"$",
"this",
"->",
"applyBasePath",
"(",
"$",
"path",
")",
";",
"$",
"info",
"=",
"new",
"SplFileInfo",
"(",
"$",
"location",
")",
";",
"$"... | 获得文件的源数据
@param string $path
@return array | [
"获得文件的源数据"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/Adapters/Local.php#L294-L303 |
movoin/one-swoole | src/FileSystem/Adapters/Local.php | Local.getMimeType | public function getMimeType(string $path): string
{
$location = $this->applyBasePath($path);
$finfo = new Finfo(FILEINFO_MIME_TYPE);
$mimetype = $finfo->file($location);
if (in_array($mimetype, ['application/octet-stream', 'inode/x-empty'])) {
$mimetype = MimeType::de... | php | public function getMimeType(string $path): string
{
$location = $this->applyBasePath($path);
$finfo = new Finfo(FILEINFO_MIME_TYPE);
$mimetype = $finfo->file($location);
if (in_array($mimetype, ['application/octet-stream', 'inode/x-empty'])) {
$mimetype = MimeType::de... | [
"public",
"function",
"getMimeType",
"(",
"string",
"$",
"path",
")",
":",
"string",
"{",
"$",
"location",
"=",
"$",
"this",
"->",
"applyBasePath",
"(",
"$",
"path",
")",
";",
"$",
"finfo",
"=",
"new",
"Finfo",
"(",
"FILEINFO_MIME_TYPE",
")",
";",
"$",... | 获得文件的类型
@param string $path
@return string | [
"获得文件的类型"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/Adapters/Local.php#L312-L323 |
movoin/one-swoole | src/FileSystem/Adapters/Local.php | Local.getVisibility | public function getVisibility(string $path): string
{
$location = $this->applyBasePath($path);
clearstatcache(false, $location);
$permission = octdec(substr(sprintf('%o', fileperms($location)), -4));
return $permission & 0044 ? self::VIS_PUB : self::VIS_PRI;
} | php | public function getVisibility(string $path): string
{
$location = $this->applyBasePath($path);
clearstatcache(false, $location);
$permission = octdec(substr(sprintf('%o', fileperms($location)), -4));
return $permission & 0044 ? self::VIS_PUB : self::VIS_PRI;
} | [
"public",
"function",
"getVisibility",
"(",
"string",
"$",
"path",
")",
":",
"string",
"{",
"$",
"location",
"=",
"$",
"this",
"->",
"applyBasePath",
"(",
"$",
"path",
")",
";",
"clearstatcache",
"(",
"false",
",",
"$",
"location",
")",
";",
"$",
"perm... | 返回文件可见性
@param string $path
@return string | [
"返回文件可见性"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/Adapters/Local.php#L332-L339 |
movoin/one-swoole | src/FileSystem/Adapters/Local.php | Local.setVisibility | public function setVisibility(string $path, string $visibility): bool
{
$location = $this->applyBasePath($path);
$type = is_dir($location) ? 'dir' : 'file';
return chmod($location, $this->permissions[$type][$visibility]);
} | php | public function setVisibility(string $path, string $visibility): bool
{
$location = $this->applyBasePath($path);
$type = is_dir($location) ? 'dir' : 'file';
return chmod($location, $this->permissions[$type][$visibility]);
} | [
"public",
"function",
"setVisibility",
"(",
"string",
"$",
"path",
",",
"string",
"$",
"visibility",
")",
":",
"bool",
"{",
"$",
"location",
"=",
"$",
"this",
"->",
"applyBasePath",
"(",
"$",
"path",
")",
";",
"$",
"type",
"=",
"is_dir",
"(",
"$",
"l... | 设置文件可见性
@param string $path
@param string $visibility
@return bool | [
"设置文件可见性"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/Adapters/Local.php#L349-L355 |
movoin/one-swoole | src/FileSystem/Adapters/Local.php | Local.rename | public function rename(string $path, string $newpath): bool
{
$location = $this->applyBasePath($path);
$destination = $this->applyBasePath($newpath);
$this->ensureDirectory(dirname($destination));
return rename($location, $destination);
} | php | public function rename(string $path, string $newpath): bool
{
$location = $this->applyBasePath($path);
$destination = $this->applyBasePath($newpath);
$this->ensureDirectory(dirname($destination));
return rename($location, $destination);
} | [
"public",
"function",
"rename",
"(",
"string",
"$",
"path",
",",
"string",
"$",
"newpath",
")",
":",
"bool",
"{",
"$",
"location",
"=",
"$",
"this",
"->",
"applyBasePath",
"(",
"$",
"path",
")",
";",
"$",
"destination",
"=",
"$",
"this",
"->",
"apply... | 重命名文件
@param string $path
@param string $newpath
@return bool
@throws \One\FileSystem\Exceptions\FileSystemException | [
"重命名文件"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/Adapters/Local.php#L366-L374 |
movoin/one-swoole | src/FileSystem/Adapters/Local.php | Local.createDir | public function createDir(string $dirname, array $config = []): bool
{
$location = $this->applyBasePath($dirname);
if (is_dir($location)) {
throw new DirectoryExistsException($dirname);
}
$umask = umask(0);
$visibility = Arr::get($config, 'visibility', 'public')... | php | public function createDir(string $dirname, array $config = []): bool
{
$location = $this->applyBasePath($dirname);
if (is_dir($location)) {
throw new DirectoryExistsException($dirname);
}
$umask = umask(0);
$visibility = Arr::get($config, 'visibility', 'public')... | [
"public",
"function",
"createDir",
"(",
"string",
"$",
"dirname",
",",
"array",
"$",
"config",
"=",
"[",
"]",
")",
":",
"bool",
"{",
"$",
"location",
"=",
"$",
"this",
"->",
"applyBasePath",
"(",
"$",
"dirname",
")",
";",
"if",
"(",
"is_dir",
"(",
... | 创建目录
@param string $dirname
@param array $config
@return bool
@throws \One\FileSystem\Exceptions\DirectoryExistsException | [
"创建目录"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/Adapters/Local.php#L397-L415 |
movoin/one-swoole | src/FileSystem/Adapters/Local.php | Local.deleteDir | public function deleteDir(string $dirname): bool
{
$location = $this->applyBasePath($dirname);
if (! is_dir($location)) {
throw new DirectoryNotExistsException($dirname);
}
$contents = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($location, ... | php | public function deleteDir(string $dirname): bool
{
$location = $this->applyBasePath($dirname);
if (! is_dir($location)) {
throw new DirectoryNotExistsException($dirname);
}
$contents = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($location, ... | [
"public",
"function",
"deleteDir",
"(",
"string",
"$",
"dirname",
")",
":",
"bool",
"{",
"$",
"location",
"=",
"$",
"this",
"->",
"applyBasePath",
"(",
"$",
"dirname",
")",
";",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"location",
")",
")",
"{",
"throw",
... | 删除目录
@param string $dirname
@return bool
@throws \One\FileSystem\Exceptions\DirectoryNotExistsException | [
"删除目录"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/Adapters/Local.php#L425-L457 |
movoin/one-swoole | src/FileSystem/Adapters/Local.php | Local.ensureDirectory | protected function ensureDirectory(string $path)
{
if (! is_dir($path)) {
$umask = umask(0);
@mkdir($path, $this->permissions['dir']['public'], true);
umask($umask);
if (! is_dir($path)) {
throw new FileSystemException($path, 'Unable to create... | php | protected function ensureDirectory(string $path)
{
if (! is_dir($path)) {
$umask = umask(0);
@mkdir($path, $this->permissions['dir']['public'], true);
umask($umask);
if (! is_dir($path)) {
throw new FileSystemException($path, 'Unable to create... | [
"protected",
"function",
"ensureDirectory",
"(",
"string",
"$",
"path",
")",
"{",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"path",
")",
")",
"{",
"$",
"umask",
"=",
"umask",
"(",
"0",
")",
";",
"@",
"mkdir",
"(",
"$",
"path",
",",
"$",
"this",
"->",
... | 确认目录存在
@param string $path
@throws \One\FileSystem\Exceptions\FileSystemException | [
"确认目录存在"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/Adapters/Local.php#L466-L481 |
movoin/one-swoole | src/FileSystem/Adapters/Local.php | Local.normalizeFileInfo | protected function normalizeFileInfo(SplFileInfo $file)
{
if (! $file->isLink()) {
$normalized = [
'type' => $file->getType(),
'path' => $this->getFilePath($file),
'timestamp' => $file->getMTime()
];
if ($normaliz... | php | protected function normalizeFileInfo(SplFileInfo $file)
{
if (! $file->isLink()) {
$normalized = [
'type' => $file->getType(),
'path' => $this->getFilePath($file),
'timestamp' => $file->getMTime()
];
if ($normaliz... | [
"protected",
"function",
"normalizeFileInfo",
"(",
"SplFileInfo",
"$",
"file",
")",
"{",
"if",
"(",
"!",
"$",
"file",
"->",
"isLink",
"(",
")",
")",
"{",
"$",
"normalized",
"=",
"[",
"'type'",
"=>",
"$",
"file",
"->",
"getType",
"(",
")",
",",
"'path... | 标准化文件信息
@param \SplFileInfo $file
@return array|null | [
"标准化文件信息"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/Adapters/Local.php#L490-L505 |
movoin/one-swoole | src/FileSystem/Adapters/Local.php | Local.getFilePath | protected function getFilePath(SplFileInfo $file): string
{
$location = $file->getPathName();
$path = $this->removeBasePath($location);
unset($location);
return trim(str_replace('\\', '/', $path), '/');
} | php | protected function getFilePath(SplFileInfo $file): string
{
$location = $file->getPathName();
$path = $this->removeBasePath($location);
unset($location);
return trim(str_replace('\\', '/', $path), '/');
} | [
"protected",
"function",
"getFilePath",
"(",
"SplFileInfo",
"$",
"file",
")",
":",
"string",
"{",
"$",
"location",
"=",
"$",
"file",
"->",
"getPathName",
"(",
")",
";",
"$",
"path",
"=",
"$",
"this",
"->",
"removeBasePath",
"(",
"$",
"location",
")",
"... | 从 SplFileInfo 中返回完整文件路径
@param \SplFileInfo $file
@return string | [
"从",
"SplFileInfo",
"中返回完整文件路径"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/Adapters/Local.php#L514-L522 |
movoin/one-swoole | src/Swoole/Components/Timer/Provider.php | Provider.register | public function register()
{
$this->bind('timer', function ($server) {
$scheduler = new Scheduler;
$scheduler->setSwoole($server->getSwoole());
return $scheduler;
});
} | php | public function register()
{
$this->bind('timer', function ($server) {
$scheduler = new Scheduler;
$scheduler->setSwoole($server->getSwoole());
return $scheduler;
});
} | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"bind",
"(",
"'timer'",
",",
"function",
"(",
"$",
"server",
")",
"{",
"$",
"scheduler",
"=",
"new",
"Scheduler",
";",
"$",
"scheduler",
"->",
"setSwoole",
"(",
"$",
"server",
"->",
... | 注册服务 | [
"注册服务"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Swoole/Components/Timer/Provider.php#L22-L30 |
jan-dolata/crude-crud | src/Engine/CrudeSetupTrait/ColumnFormat.php | ColumnFormat.setColumnFormat | public function setColumnFormat($attr, $format = null)
{
$formats = is_array($attr)
? $attr
: [$attr => $format];
foreach ($formats as $a => $f)
$this->_setSingleColumnFormat($a, $f);
return $this;
} | php | public function setColumnFormat($attr, $format = null)
{
$formats = is_array($attr)
? $attr
: [$attr => $format];
foreach ($formats as $a => $f)
$this->_setSingleColumnFormat($a, $f);
return $this;
} | [
"public",
"function",
"setColumnFormat",
"(",
"$",
"attr",
",",
"$",
"format",
"=",
"null",
")",
"{",
"$",
"formats",
"=",
"is_array",
"(",
"$",
"attr",
")",
"?",
"$",
"attr",
":",
"[",
"$",
"attr",
"=>",
"$",
"format",
"]",
";",
"foreach",
"(",
... | Sets the Column cell format rules.
@param array $columnFormat the column format
@return self | [
"Sets",
"the",
"Column",
"cell",
"format",
"rules",
"."
] | train | https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Engine/CrudeSetupTrait/ColumnFormat.php#L31-L41 |
comelyio/comely | src/Comely/IO/Mailer/Agents/SMTP.php | SMTP.authCredentials | public function authCredentials(string $username, string $password): self
{
$this->username = $username;
$this->password = $password;
return $this;
} | php | public function authCredentials(string $username, string $password): self
{
$this->username = $username;
$this->password = $password;
return $this;
} | [
"public",
"function",
"authCredentials",
"(",
"string",
"$",
"username",
",",
"string",
"$",
"password",
")",
":",
"self",
"{",
"$",
"this",
"->",
"username",
"=",
"$",
"username",
";",
"$",
"this",
"->",
"password",
"=",
"$",
"password",
";",
"return",
... | Set auth. credentials for AUTH LOGIN
@param string $username
@param string $password
@return SMTP | [
"Set",
"auth",
".",
"credentials",
"for",
"AUTH",
"LOGIN"
] | train | https://github.com/comelyio/comely/blob/561ea7aef36fea347a1a79d3ee5597d4057ddf82/src/Comely/IO/Mailer/Agents/SMTP.php#L112-L117 |
comelyio/comely | src/Comely/IO/Mailer/Agents/SMTP.php | SMTP.connect | private function connect()
{
if (!$this->stream) {
$errorNum = 0;
$errorMsg = "";
$context = @stream_context_create($this->streamOptions);
$this->stream = @stream_socket_client(
sprintf('%1$s:%2$d', $this->host, $this->port),
$e... | php | private function connect()
{
if (!$this->stream) {
$errorNum = 0;
$errorMsg = "";
$context = @stream_context_create($this->streamOptions);
$this->stream = @stream_socket_client(
sprintf('%1$s:%2$d', $this->host, $this->port),
$e... | [
"private",
"function",
"connect",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"stream",
")",
"{",
"$",
"errorNum",
"=",
"0",
";",
"$",
"errorMsg",
"=",
"\"\"",
";",
"$",
"context",
"=",
"@",
"stream_context_create",
"(",
"$",
"this",
"->",
"s... | Establish connection to SMTP server or revive existing one | [
"Establish",
"connection",
"to",
"SMTP",
"server",
"or",
"revive",
"existing",
"one"
] | train | https://github.com/comelyio/comely/blob/561ea7aef36fea347a1a79d3ee5597d4057ddf82/src/Comely/IO/Mailer/Agents/SMTP.php#L157-L229 |
comelyio/comely | src/Comely/IO/Mailer/Agents/SMTP.php | SMTP.command | public function command(string $command, string $args = null, int $expect = 0): string
{
$sendCommand = $args ? sprintf('%1$s %2$s', $command, $args) : $command;
$this->write($sendCommand);
$response = $this->read();
$responseCode = $this->lastResponseCode();
if ($expect > 0... | php | public function command(string $command, string $args = null, int $expect = 0): string
{
$sendCommand = $args ? sprintf('%1$s %2$s', $command, $args) : $command;
$this->write($sendCommand);
$response = $this->read();
$responseCode = $this->lastResponseCode();
if ($expect > 0... | [
"public",
"function",
"command",
"(",
"string",
"$",
"command",
",",
"string",
"$",
"args",
"=",
"null",
",",
"int",
"$",
"expect",
"=",
"0",
")",
":",
"string",
"{",
"$",
"sendCommand",
"=",
"$",
"args",
"?",
"sprintf",
"(",
"'%1$s %2$s'",
",",
"$",... | Send command to server, read response, and make sure response code matches expected code
@param string $command
@param string|null $args
@param int $expect
@return string
@throws SMTPException | [
"Send",
"command",
"to",
"server",
"read",
"response",
"and",
"make",
"sure",
"response",
"code",
"matches",
"expected",
"code"
] | train | https://github.com/comelyio/comely/blob/561ea7aef36fea347a1a79d3ee5597d4057ddf82/src/Comely/IO/Mailer/Agents/SMTP.php#L283-L297 |
comelyio/comely | src/Comely/IO/Mailer/Agents/SMTP.php | SMTP.read | private function read(): string
{
$this->lastResponse = fread($this->stream, 1024); // Read up to 1KB
$this->lastResponseCode = intval(explode(" ", $this->lastResponse)[0]);
$this->lastResponseCode = $this->lastResponseCode > 0 ? $this->lastResponseCode : -1;
return $this->lastRespon... | php | private function read(): string
{
$this->lastResponse = fread($this->stream, 1024); // Read up to 1KB
$this->lastResponseCode = intval(explode(" ", $this->lastResponse)[0]);
$this->lastResponseCode = $this->lastResponseCode > 0 ? $this->lastResponseCode : -1;
return $this->lastRespon... | [
"private",
"function",
"read",
"(",
")",
":",
"string",
"{",
"$",
"this",
"->",
"lastResponse",
"=",
"fread",
"(",
"$",
"this",
"->",
"stream",
",",
"1024",
")",
";",
"// Read up to 1KB",
"$",
"this",
"->",
"lastResponseCode",
"=",
"intval",
"(",
"explod... | Read response from SMTP server
@return string | [
"Read",
"response",
"from",
"SMTP",
"server"
] | train | https://github.com/comelyio/comely/blob/561ea7aef36fea347a1a79d3ee5597d4057ddf82/src/Comely/IO/Mailer/Agents/SMTP.php#L314-L320 |
comelyio/comely | src/Comely/IO/Mailer/Agents/SMTP.php | SMTP.send | public function send(Message $message, array $emails): int
{
$this->connect(); // Establish or revive connection
$this->command("RSET"); // Reset SMTP buffer
$this->command(sprintf('MAIL FROM:<%1$s>', $message->sender()->email), null, 250); // Set mail from
$count = 0;
forea... | php | public function send(Message $message, array $emails): int
{
$this->connect(); // Establish or revive connection
$this->command("RSET"); // Reset SMTP buffer
$this->command(sprintf('MAIL FROM:<%1$s>', $message->sender()->email), null, 250); // Set mail from
$count = 0;
forea... | [
"public",
"function",
"send",
"(",
"Message",
"$",
"message",
",",
"array",
"$",
"emails",
")",
":",
"int",
"{",
"$",
"this",
"->",
"connect",
"(",
")",
";",
"// Establish or revive connection",
"$",
"this",
"->",
"command",
"(",
"\"RSET\"",
")",
";",
"/... | Send email message(s)
@param Message $message
@param array $emails
@return int
@throws SMTPException | [
"Send",
"email",
"message",
"(",
"s",
")"
] | train | https://github.com/comelyio/comely/blob/561ea7aef36fea347a1a79d3ee5597d4057ddf82/src/Comely/IO/Mailer/Agents/SMTP.php#L346-L381 |
movoin/one-swoole | src/Swoole/Provider.php | Provider.log | final protected function log(string $level, string $message, array $context = [])
{
$this->provider('logger')->log($level, $message, $context);
} | php | final protected function log(string $level, string $message, array $context = [])
{
$this->provider('logger')->log($level, $message, $context);
} | [
"final",
"protected",
"function",
"log",
"(",
"string",
"$",
"level",
",",
"string",
"$",
"message",
",",
"array",
"$",
"context",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"provider",
"(",
"'logger'",
")",
"->",
"log",
"(",
"$",
"level",
",",
"$... | 写入日志
@param string $level
@param string $message
@param array $context | [
"写入日志"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Swoole/Provider.php#L101-L104 |
stubbles/stubbles-webapp-core | src/main/php/routing/Interceptors.php | Interceptors.preProcess | public function preProcess(Request $request, Response $response): bool
{
foreach ($this->preInterceptors as $preInterceptor) {
if (false === $this->executePreInterceptor($preInterceptor, $request, $response)) {
return false;
}
}
return true;
} | php | public function preProcess(Request $request, Response $response): bool
{
foreach ($this->preInterceptors as $preInterceptor) {
if (false === $this->executePreInterceptor($preInterceptor, $request, $response)) {
return false;
}
}
return true;
} | [
"public",
"function",
"preProcess",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
")",
":",
"bool",
"{",
"foreach",
"(",
"$",
"this",
"->",
"preInterceptors",
"as",
"$",
"preInterceptor",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"thi... | apply pre interceptors
Returns false if one of the pre interceptors cancels the request.
@param \stubbles\webapp\Request $request current request
@param \stubbles\webapp\Response $response response to send
@return bool | [
"apply",
"pre",
"interceptors"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/routing/Interceptors.php#L64-L73 |
stubbles/stubbles-webapp-core | src/main/php/routing/Interceptors.php | Interceptors.executePreInterceptor | private function executePreInterceptor($preInterceptor, Request $request, Response $response)
{
if (is_callable($preInterceptor)) {
return $preInterceptor($request, $response);
}
if ($preInterceptor instanceof PreInterceptor) {
return $preInterceptor->preProcess($req... | php | private function executePreInterceptor($preInterceptor, Request $request, Response $response)
{
if (is_callable($preInterceptor)) {
return $preInterceptor($request, $response);
}
if ($preInterceptor instanceof PreInterceptor) {
return $preInterceptor->preProcess($req... | [
"private",
"function",
"executePreInterceptor",
"(",
"$",
"preInterceptor",
",",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
")",
"{",
"if",
"(",
"is_callable",
"(",
"$",
"preInterceptor",
")",
")",
"{",
"return",
"$",
"preInterceptor",
"(",
... | executes pre interceptor
@param mixed $preInterceptor
@param \stubbles\webapp\Request $request current request
@param \stubbles\webapp\Response $response response to send
@return bool|null | [
"executes",
"pre",
"interceptor"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/routing/Interceptors.php#L83-L105 |
stubbles/stubbles-webapp-core | src/main/php/routing/Interceptors.php | Interceptors.postProcess | public function postProcess(Request $request, Response $response): bool
{
foreach ($this->postInterceptors as $postInterceptor) {
if (false === $this->executePostInterceptor($postInterceptor, $request, $response)) {
return false;
}
}
return true;
... | php | public function postProcess(Request $request, Response $response): bool
{
foreach ($this->postInterceptors as $postInterceptor) {
if (false === $this->executePostInterceptor($postInterceptor, $request, $response)) {
return false;
}
}
return true;
... | [
"public",
"function",
"postProcess",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
")",
":",
"bool",
"{",
"foreach",
"(",
"$",
"this",
"->",
"postInterceptors",
"as",
"$",
"postInterceptor",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"... | apply post interceptors
@param \stubbles\webapp\Request $request current request
@param \stubbles\webapp\Response $response response to send
@return bool | [
"apply",
"post",
"interceptors"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/routing/Interceptors.php#L114-L123 |
stubbles/stubbles-webapp-core | src/main/php/routing/Interceptors.php | Interceptors.executePostInterceptor | private function executePostInterceptor($postInterceptor, Request $request, Response $response)
{
if (is_callable($postInterceptor)) {
return $postInterceptor($request, $response);
}
if ($postInterceptor instanceof PostInterceptor) {
return $postInterceptor->postProc... | php | private function executePostInterceptor($postInterceptor, Request $request, Response $response)
{
if (is_callable($postInterceptor)) {
return $postInterceptor($request, $response);
}
if ($postInterceptor instanceof PostInterceptor) {
return $postInterceptor->postProc... | [
"private",
"function",
"executePostInterceptor",
"(",
"$",
"postInterceptor",
",",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
")",
"{",
"if",
"(",
"is_callable",
"(",
"$",
"postInterceptor",
")",
")",
"{",
"return",
"$",
"postInterceptor",
"(... | executes post interceptor
@param mixed $postInterceptor
@param \stubbles\webapp\Request $request current request
@param \stubbles\webapp\Response $response response to send
@return bool|null | [
"executes",
"post",
"interceptor"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/routing/Interceptors.php#L133-L155 |
ekyna/GlsUniBox | Renderer/LabelRenderer.php | LabelRenderer.initialize | private function initialize()
{
if (null === $this->layout) {
$this->layout = [
// Control bar 1
Config::T110 => ['s' => 84, 'x' => 28, 'y' => 155],
Config::T310 => ['s' => 84, 'x' => 545, 'y' => 155, 'c' => 'white'],
Config::T100... | php | private function initialize()
{
if (null === $this->layout) {
$this->layout = [
// Control bar 1
Config::T110 => ['s' => 84, 'x' => 28, 'y' => 155],
Config::T310 => ['s' => 84, 'x' => 545, 'y' => 155, 'c' => 'white'],
Config::T100... | [
"private",
"function",
"initialize",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"layout",
")",
"{",
"$",
"this",
"->",
"layout",
"=",
"[",
"// Control bar 1",
"Config",
"::",
"T110",
"=>",
"[",
"'s'",
"=>",
"84",
",",
"'x'",
"=>",
... | Initializes the label. | [
"Initializes",
"the",
"label",
"."
] | train | https://github.com/ekyna/GlsUniBox/blob/b474271ba355c3917074422306dc64abf09584d0/Renderer/LabelRenderer.php#L55-L107 |
ekyna/GlsUniBox | Renderer/LabelRenderer.php | LabelRenderer.build | private function build(array $data)
{
foreach ($this->layout as $key => $c) {
if (!isset($data[$key]) || 0 === strlen($value = $data[$key])) {
continue;
}
if (isset($c['prepend'])) $value = $c['prepend'] . $value;
if (isset($c['append'])) $val... | php | private function build(array $data)
{
foreach ($this->layout as $key => $c) {
if (!isset($data[$key]) || 0 === strlen($value = $data[$key])) {
continue;
}
if (isset($c['prepend'])) $value = $c['prepend'] . $value;
if (isset($c['append'])) $val... | [
"private",
"function",
"build",
"(",
"array",
"$",
"data",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"layout",
"as",
"$",
"key",
"=>",
"$",
"c",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"data",
"[",
"$",
"key",
"]",
")",
"||",
"0",
"==... | Writes the fields to the label.
@param array $data | [
"Writes",
"the",
"fields",
"to",
"the",
"label",
"."
] | train | https://github.com/ekyna/GlsUniBox/blob/b474271ba355c3917074422306dc64abf09584d0/Renderer/LabelRenderer.php#L114-L191 |
ekyna/GlsUniBox | Renderer/LabelRenderer.php | LabelRenderer.text | private function text($text, $size, $x, $y, $color = 'black', $font = 'swiss_normal', $angle = 0)
{
imagettftext($this->image, $size, $angle, $x, $y, $this->colors[$color], $this->fonts[$font], $text);
} | php | private function text($text, $size, $x, $y, $color = 'black', $font = 'swiss_normal', $angle = 0)
{
imagettftext($this->image, $size, $angle, $x, $y, $this->colors[$color], $this->fonts[$font], $text);
} | [
"private",
"function",
"text",
"(",
"$",
"text",
",",
"$",
"size",
",",
"$",
"x",
",",
"$",
"y",
",",
"$",
"color",
"=",
"'black'",
",",
"$",
"font",
"=",
"'swiss_normal'",
",",
"$",
"angle",
"=",
"0",
")",
"{",
"imagettftext",
"(",
"$",
"this",
... | Writes the given text.
@param string $text
@param int $size
@param int $x
@param int $y
@param string $color
@param string $font
@param int $angle | [
"Writes",
"the",
"given",
"text",
"."
] | train | https://github.com/ekyna/GlsUniBox/blob/b474271ba355c3917074422306dc64abf09584d0/Renderer/LabelRenderer.php#L204-L207 |
ekyna/GlsUniBox | Renderer/LabelRenderer.php | LabelRenderer.getImageData | private function getImageData()
{
ob_start();
imagegif($this->image);
$output = ob_get_contents();
ob_end_clean();
imagedestroy($this->image);
return $output;
} | php | private function getImageData()
{
ob_start();
imagegif($this->image);
$output = ob_get_contents();
ob_end_clean();
imagedestroy($this->image);
return $output;
} | [
"private",
"function",
"getImageData",
"(",
")",
"{",
"ob_start",
"(",
")",
";",
"imagegif",
"(",
"$",
"this",
"->",
"image",
")",
";",
"$",
"output",
"=",
"ob_get_contents",
"(",
")",
";",
"ob_end_clean",
"(",
")",
";",
"imagedestroy",
"(",
"$",
"this... | Returns the image raw data.
@return string | [
"Returns",
"the",
"image",
"raw",
"data",
"."
] | train | https://github.com/ekyna/GlsUniBox/blob/b474271ba355c3917074422306dc64abf09584d0/Renderer/LabelRenderer.php#L214-L223 |
ekyna/GlsUniBox | Renderer/LabelRenderer.php | LabelRenderer.getBarcodeDatamatrix | public function getBarcodeDatamatrix($data)
{
$barcode = new Barcode();
$bobj = $barcode->getBarcodeObj(
'DATAMATRIX',
$data,
256,
256,
'black',
array(0, 0, 0, 0)
)->setBackgroundColor('white');
return $bobj->g... | php | public function getBarcodeDatamatrix($data)
{
$barcode = new Barcode();
$bobj = $barcode->getBarcodeObj(
'DATAMATRIX',
$data,
256,
256,
'black',
array(0, 0, 0, 0)
)->setBackgroundColor('white');
return $bobj->g... | [
"public",
"function",
"getBarcodeDatamatrix",
"(",
"$",
"data",
")",
"{",
"$",
"barcode",
"=",
"new",
"Barcode",
"(",
")",
";",
"$",
"bobj",
"=",
"$",
"barcode",
"->",
"getBarcodeObj",
"(",
"'DATAMATRIX'",
",",
"$",
"data",
",",
"256",
",",
"256",
",",... | Returns the datamatrix from the given data.
@param string $data
@return string | [
"Returns",
"the",
"datamatrix",
"from",
"the",
"given",
"data",
"."
] | train | https://github.com/ekyna/GlsUniBox/blob/b474271ba355c3917074422306dc64abf09584d0/Renderer/LabelRenderer.php#L232-L246 |
ekyna/GlsUniBox | Renderer/LabelRenderer.php | LabelRenderer.getBarcode128 | public function getBarcode128($data)
{
$barcode = new Barcode();
$bobj = $barcode->getBarcodeObj(
'C128',
$data,
380,
135,
'black',
array(0, 0, 0, 0)
)->setBackgroundColor('white');
return $bobj->getPngData();
... | php | public function getBarcode128($data)
{
$barcode = new Barcode();
$bobj = $barcode->getBarcodeObj(
'C128',
$data,
380,
135,
'black',
array(0, 0, 0, 0)
)->setBackgroundColor('white');
return $bobj->getPngData();
... | [
"public",
"function",
"getBarcode128",
"(",
"$",
"data",
")",
"{",
"$",
"barcode",
"=",
"new",
"Barcode",
"(",
")",
";",
"$",
"bobj",
"=",
"$",
"barcode",
"->",
"getBarcodeObj",
"(",
"'C128'",
",",
"$",
"data",
",",
"380",
",",
"135",
",",
"'black'",... | Returns the barcode from the given data.
@param string $data
@return string | [
"Returns",
"the",
"barcode",
"from",
"the",
"given",
"data",
"."
] | train | https://github.com/ekyna/GlsUniBox/blob/b474271ba355c3917074422306dc64abf09584d0/Renderer/LabelRenderer.php#L255-L269 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.