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 |
|---|---|---|---|---|---|---|---|---|---|---|
harp-orm/query | src/Arr.php | Arr.flatten | public static function flatten(array $array)
{
$result = array();
array_walk_recursive($array, function ($value, $key) use (& $result) {
if (is_numeric($key) or is_object($value)) {
$result[] = $value;
} else {
$result[$key] = $value;
... | php | public static function flatten(array $array)
{
$result = array();
array_walk_recursive($array, function ($value, $key) use (& $result) {
if (is_numeric($key) or is_object($value)) {
$result[] = $value;
} else {
$result[$key] = $value;
... | [
"public",
"static",
"function",
"flatten",
"(",
"array",
"$",
"array",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"array_walk_recursive",
"(",
"$",
"array",
",",
"function",
"(",
"$",
"value",
",",
"$",
"key",
")",
"use",
"(",
"&",
"$",
... | Flatten an array
@param array $array
@return array | [
"Flatten",
"an",
"array"
] | train | https://github.com/harp-orm/query/blob/98ce2468a0a31fe15ed3692bad32547bf6dbe41a/src/Arr.php#L40-L53 |
harp-orm/query | src/Arr.php | Arr.flipNested | public static function flipNested(array $arr)
{
$result = array();
foreach ($arr as $key => $values) {
foreach ($values as $innerKey => $value) {
$result[$innerKey][$key] = $value;
}
}
return $result;
} | php | public static function flipNested(array $arr)
{
$result = array();
foreach ($arr as $key => $values) {
foreach ($values as $innerKey => $value) {
$result[$innerKey][$key] = $value;
}
}
return $result;
} | [
"public",
"static",
"function",
"flipNested",
"(",
"array",
"$",
"arr",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"arr",
"as",
"$",
"key",
"=>",
"$",
"values",
")",
"{",
"foreach",
"(",
"$",
"values",
"as",
"$",
"... | Transpose 2 dimensional array:
array ( | | array (
1 => array( | | 'name' => array(
'name' => 'val1', | | 1 => 'val1',
'email' => 'val2', | | 2 => 'val3',
), | to | ),
2 => array( | | 'email' => array(
'name' ... | [
"Transpose",
"2",
"dimensional",
"array",
":"
] | train | https://github.com/harp-orm/query/blob/98ce2468a0a31fe15ed3692bad32547bf6dbe41a/src/Arr.php#L81-L92 |
hamjoint/mustard-auctions | src/database/migrations/2015_09_01_300000_mustard_auctions_tables.php | MustardAuctionsTables.up | public function up()
{
Schema::create('bids', function (Blueprint $table) {
$table->integer('bid_id', true)->unsigned();
$table->integer('item_id')->unsigned();
$table->integer('user_id')->unsigned();
$table->decimal('amount', 8, 2)->unsigned();
$t... | php | public function up()
{
Schema::create('bids', function (Blueprint $table) {
$table->integer('bid_id', true)->unsigned();
$table->integer('item_id')->unsigned();
$table->integer('user_id')->unsigned();
$table->decimal('amount', 8, 2)->unsigned();
$t... | [
"public",
"function",
"up",
"(",
")",
"{",
"Schema",
"::",
"create",
"(",
"'bids'",
",",
"function",
"(",
"Blueprint",
"$",
"table",
")",
"{",
"$",
"table",
"->",
"integer",
"(",
"'bid_id'",
",",
"true",
")",
"->",
"unsigned",
"(",
")",
";",
"$",
"... | Run the migrations.
@return void | [
"Run",
"the",
"migrations",
"."
] | train | https://github.com/hamjoint/mustard-auctions/blob/66c8723d8681466e280263ad100f3fdc5895480d/src/database/migrations/2015_09_01_300000_mustard_auctions_tables.php#L33-L71 |
datasift/datasift-php | lib/DataSift/StreamConsumer.php | DataSift_StreamConsumer.factory | public static function factory($user, $type, $definition, $eventHandler)
{
$classname = 'DataSift_StreamConsumer_' . $type;
if (! class_exists($classname)) {
throw new DataSift_Exception_InvalidData('Consumer type "' . $type . '" is unknown');
}
return new $classname($us... | php | public static function factory($user, $type, $definition, $eventHandler)
{
$classname = 'DataSift_StreamConsumer_' . $type;
if (! class_exists($classname)) {
throw new DataSift_Exception_InvalidData('Consumer type "' . $type . '" is unknown');
}
return new $classname($us... | [
"public",
"static",
"function",
"factory",
"(",
"$",
"user",
",",
"$",
"type",
",",
"$",
"definition",
",",
"$",
"eventHandler",
")",
"{",
"$",
"classname",
"=",
"'DataSift_StreamConsumer_'",
".",
"$",
"type",
";",
"if",
"(",
"!",
"class_exists",
"(",
"$... | Factory function. Creates a StreamConsumer-derived object for the given
type.
@param string $user Use DataSift_User object.
@param string $type Use the TYPE_ constants
@param mixed $definition CSDL string or a Definition object.
@param string $eventHandler The object that will receive events.
@retu... | [
"Factory",
"function",
".",
"Creates",
"a",
"StreamConsumer",
"-",
"derived",
"object",
"for",
"the",
"given",
"type",
"."
] | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/StreamConsumer.php#L82-L90 |
datasift/datasift-php | lib/DataSift/StreamConsumer.php | DataSift_StreamConsumer.onData | protected function onData($json)
{
// Decode the JSON
$interaction = json_decode(trim($json), true);
// If the interaction is valid, pass it to the event handler
if ($interaction) {
if (isset($interaction['status'])) {
switch ($interaction['status']) {
... | php | protected function onData($json)
{
// Decode the JSON
$interaction = json_decode(trim($json), true);
// If the interaction is valid, pass it to the event handler
if ($interaction) {
if (isset($interaction['status'])) {
switch ($interaction['status']) {
... | [
"protected",
"function",
"onData",
"(",
"$",
"json",
")",
"{",
"// Decode the JSON",
"$",
"interaction",
"=",
"json_decode",
"(",
"trim",
"(",
"$",
"json",
")",
",",
"true",
")",
";",
"// If the interaction is valid, pass it to the event handler",
"if",
"(",
"$",
... | This is called when a complete JSON item is received.
@param $json The JSON data.
@return void | [
"This",
"is",
"called",
"when",
"a",
"complete",
"JSON",
"item",
"is",
"received",
"."
] | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/StreamConsumer.php#L159-L198 |
datasift/datasift-php | lib/DataSift/StreamConsumer.php | DataSift_StreamConsumer.onInteraction | protected function onInteraction($interaction, $hash = false)
{
$this->_eventHandler->onInteraction($this, $interaction, $hash);
} | php | protected function onInteraction($interaction, $hash = false)
{
$this->_eventHandler->onInteraction($this, $interaction, $hash);
} | [
"protected",
"function",
"onInteraction",
"(",
"$",
"interaction",
",",
"$",
"hash",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"_eventHandler",
"->",
"onInteraction",
"(",
"$",
"this",
",",
"$",
"interaction",
",",
"$",
"hash",
")",
";",
"}"
] | This is called for each interaction received from the stream and must
be implemented in extending classes.
@param array $interaction The interaction data structure
@param bool $hash
@return void | [
"This",
"is",
"called",
"for",
"each",
"interaction",
"received",
"from",
"the",
"stream",
"and",
"must",
"be",
"implemented",
"in",
"extending",
"classes",
"."
] | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/StreamConsumer.php#L219-L222 |
datasift/datasift-php | lib/DataSift/StreamConsumer.php | DataSift_StreamConsumer.onDeleted | protected function onDeleted($interaction, $hash = false)
{
$this->_eventHandler->onDeleted($this, $interaction, $hash);
} | php | protected function onDeleted($interaction, $hash = false)
{
$this->_eventHandler->onDeleted($this, $interaction, $hash);
} | [
"protected",
"function",
"onDeleted",
"(",
"$",
"interaction",
",",
"$",
"hash",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"_eventHandler",
"->",
"onDeleted",
"(",
"$",
"this",
",",
"$",
"interaction",
",",
"$",
"hash",
")",
";",
"}"
] | This is called for each DELETE request received from the stream and must
be implemented in extending classes.
@param array $interaction The interaction data structure
@param string $hash The stream hash.
@return void | [
"This",
"is",
"called",
"for",
"each",
"DELETE",
"request",
"received",
"from",
"the",
"stream",
"and",
"must",
"be",
"implemented",
"in",
"extending",
"classes",
"."
] | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/StreamConsumer.php#L233-L236 |
datasift/datasift-php | lib/DataSift/StreamConsumer.php | DataSift_StreamConsumer.consume | public function consume($auto_reconnect = true)
{
$this->_auto_reconnect = $auto_reconnect;
// Start consuming
$this->_state = self::STATE_STARTING;
$this->onStart();
} | php | public function consume($auto_reconnect = true)
{
$this->_auto_reconnect = $auto_reconnect;
// Start consuming
$this->_state = self::STATE_STARTING;
$this->onStart();
} | [
"public",
"function",
"consume",
"(",
"$",
"auto_reconnect",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"_auto_reconnect",
"=",
"$",
"auto_reconnect",
";",
"// Start consuming",
"$",
"this",
"->",
"_state",
"=",
"self",
"::",
"STATE_STARTING",
";",
"$",
"this... | Once an instance of a StreamConsumer is ready for use, call this to
start consuming. Extending classes should implement onStart to handle
actually starting.
@param boolean $auto_reconnect Whether to reconnect automatically
@return void | [
"Once",
"an",
"instance",
"of",
"a",
"StreamConsumer",
"is",
"ready",
"for",
"use",
"call",
"this",
"to",
"start",
"consuming",
".",
"Extending",
"classes",
"should",
"implement",
"onStart",
"to",
"handle",
"actually",
"starting",
"."
] | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/StreamConsumer.php#L308-L315 |
datasift/datasift-php | lib/DataSift/StreamConsumer.php | DataSift_StreamConsumer.stop | public function stop()
{
if ($this->_state != self::STATE_RUNNING) {
throw new DataSift_Exception_InvalidData('Consumer state must be RUNNING before it can be stopped');
}
$this->_state = self::STATE_STOPPING;
} | php | public function stop()
{
if ($this->_state != self::STATE_RUNNING) {
throw new DataSift_Exception_InvalidData('Consumer state must be RUNNING before it can be stopped');
}
$this->_state = self::STATE_STOPPING;
} | [
"public",
"function",
"stop",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_state",
"!=",
"self",
"::",
"STATE_RUNNING",
")",
"{",
"throw",
"new",
"DataSift_Exception_InvalidData",
"(",
"'Consumer state must be RUNNING before it can be stopped'",
")",
";",
"}",
"... | This method can be called at any time to *request* that the consumer
stop consuming. This method sets the state to STATE_STOPPING and it's
up to the consumer implementation to notice that this has changed, stop
consuming and call the onStopped method.
@return void
@throws DataSift_Exception_InalidData | [
"This",
"method",
"can",
"be",
"called",
"at",
"any",
"time",
"to",
"*",
"request",
"*",
"that",
"the",
"consumer",
"stop",
"consuming",
".",
"This",
"method",
"sets",
"the",
"state",
"to",
"STATE_STOPPING",
"and",
"it",
"s",
"up",
"to",
"the",
"consumer... | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/StreamConsumer.php#L334-L340 |
datasift/datasift-php | lib/DataSift/StreamConsumer.php | DataSift_StreamConsumer.onStop | protected function onStop($reason = '')
{
//var_dump(debug_backtrace());
if ($this->_state != self::STATE_STOPPING and $reason == '') {
$reason = 'Unexpected';
}
$this->_state = self::STATE_STOPPED;
$this->onStopped($reason);
} | php | protected function onStop($reason = '')
{
//var_dump(debug_backtrace());
if ($this->_state != self::STATE_STOPPING and $reason == '') {
$reason = 'Unexpected';
}
$this->_state = self::STATE_STOPPED;
$this->onStopped($reason);
} | [
"protected",
"function",
"onStop",
"(",
"$",
"reason",
"=",
"''",
")",
"{",
"//var_dump(debug_backtrace());",
"if",
"(",
"$",
"this",
"->",
"_state",
"!=",
"self",
"::",
"STATE_STOPPING",
"and",
"$",
"reason",
"==",
"''",
")",
"{",
"$",
"reason",
"=",
"'... | Default implementation of onStop. It's unlikely that this method will
ever be used in isolation, but rather it should be called as the final
step in the extending class's implementation.
@param string $reason Reason why the stream was stopped
@return void
@throws DataSift_Exception_InvalidData | [
"Default",
"implementation",
"of",
"onStop",
".",
"It",
"s",
"unlikely",
"that",
"this",
"method",
"will",
"ever",
"be",
"used",
"in",
"isolation",
"but",
"rather",
"it",
"should",
"be",
"called",
"as",
"the",
"final",
"step",
"in",
"the",
"extending",
"cl... | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/StreamConsumer.php#L352-L361 |
huasituo/hstcms | src/Providers/HelperServiceProvider.php | HelperServiceProvider.register | public function register()
{
$file = $this->app->make(Filesystem::class);
$path = realpath(__DIR__.'/../Helpers');
$helpers = $file->glob($path.'/*.php');
foreach ($helpers as $helper)
{
require_once($helper);
}
$helpers = $file->glob($path.'/*... | php | public function register()
{
$file = $this->app->make(Filesystem::class);
$path = realpath(__DIR__.'/../Helpers');
$helpers = $file->glob($path.'/*.php');
foreach ($helpers as $helper)
{
require_once($helper);
}
$helpers = $file->glob($path.'/*... | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"app",
"->",
"make",
"(",
"Filesystem",
"::",
"class",
")",
";",
"$",
"path",
"=",
"realpath",
"(",
"__DIR__",
".",
"'/../Helpers'",
")",
";",
"$",
"helpers",
"=",
... | Register the application services.
@return void | [
"Register",
"the",
"application",
"services",
"."
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Providers/HelperServiceProvider.php#L29-L43 |
kiwiz/ecl | src/ArrayUnion.php | ArrayUnion.getKeys | public function getKeys() {
$keys = [];
foreach($this->arrays as $array) {
$keys = array_merge($keys, $array instanceof \ArrayAccess ? $array->getKeys():array_keys($array));
}
return array_unique($keys);
} | php | public function getKeys() {
$keys = [];
foreach($this->arrays as $array) {
$keys = array_merge($keys, $array instanceof \ArrayAccess ? $array->getKeys():array_keys($array));
}
return array_unique($keys);
} | [
"public",
"function",
"getKeys",
"(",
")",
"{",
"$",
"keys",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"arrays",
"as",
"$",
"array",
")",
"{",
"$",
"keys",
"=",
"array_merge",
"(",
"$",
"keys",
",",
"$",
"array",
"instanceof",
"\\",
... | Get a list of all defined keys.
@return string[] Keys. | [
"Get",
"a",
"list",
"of",
"all",
"defined",
"keys",
"."
] | train | https://github.com/kiwiz/ecl/blob/6536dd2a4c1905a08cf718bdbef56a22f0e9b488/src/ArrayUnion.php#L25-L31 |
kiwiz/ecl | src/ArrayUnion.php | ArrayUnion.& | public function &offsetGet($key) {
for($i = 0; $i < count($this->arrays); ++$i) {
if(Util::exists($this->arrays[$i], $key)) {
return $this->arrays[$i][$key];
}
}
throw new KeyNotFoundException($key);
} | php | public function &offsetGet($key) {
for($i = 0; $i < count($this->arrays); ++$i) {
if(Util::exists($this->arrays[$i], $key)) {
return $this->arrays[$i][$key];
}
}
throw new KeyNotFoundException($key);
} | [
"public",
"function",
"&",
"offsetGet",
"(",
"$",
"key",
")",
"{",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"count",
"(",
"$",
"this",
"->",
"arrays",
")",
";",
"++",
"$",
"i",
")",
"{",
"if",
"(",
"Util",
"::",
"exists",
"(",
"$... | Get the value for a symbol.
@param string $key Symbol name.
@return Value Symbol value. | [
"Get",
"the",
"value",
"for",
"a",
"symbol",
"."
] | train | https://github.com/kiwiz/ecl/blob/6536dd2a4c1905a08cf718bdbef56a22f0e9b488/src/ArrayUnion.php#L38-L45 |
phramework/validate | src/NumberValidator.php | NumberValidator.validate | public function validate($value)
{
$return = $this->validateCommon($value, new ValidateResult($value, true));
if ($return->status === false) {
return $return;
}
return $this->validateNumber($return->value);
} | php | public function validate($value)
{
$return = $this->validateCommon($value, new ValidateResult($value, true));
if ($return->status === false) {
return $return;
}
return $this->validateNumber($return->value);
} | [
"public",
"function",
"validate",
"(",
"$",
"value",
")",
"{",
"$",
"return",
"=",
"$",
"this",
"->",
"validateCommon",
"(",
"$",
"value",
",",
"new",
"ValidateResult",
"(",
"$",
"value",
",",
"true",
")",
")",
";",
"if",
"(",
"$",
"return",
"->",
... | Validate value
@see \Phramework\Validate\ValidateResult for ValidateResult object
@param mixed $value Value to validate
@return ValidateResult | [
"Validate",
"value"
] | train | https://github.com/phramework/validate/blob/22dd3c4e5f7a77a1a75d92f98444f3e4b7ce5cfc/src/NumberValidator.php#L109-L118 |
phramework/validate | src/NumberValidator.php | NumberValidator.validateNumber | protected function validateNumber($value)
{
$return = new ValidateResult($value, false);
if (is_string($value)) {
//Replace comma with dot
$value = str_replace(',', '.', $value);
}
//Apply all rules
if (!is_numeric($value) || filter_var($value, FILTE... | php | protected function validateNumber($value)
{
$return = new ValidateResult($value, false);
if (is_string($value)) {
//Replace comma with dot
$value = str_replace(',', '.', $value);
}
//Apply all rules
if (!is_numeric($value) || filter_var($value, FILTE... | [
"protected",
"function",
"validateNumber",
"(",
"$",
"value",
")",
"{",
"$",
"return",
"=",
"new",
"ValidateResult",
"(",
"$",
"value",
",",
"false",
")",
";",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"//Replace comma with dot",
"$",
"va... | Validate value, without calling validateCommon
@see \Phramework\Validate\ValidateResult for ValidateResult object
@param mixed $value Value to validate
@return ValidateResult | [
"Validate",
"value",
"without",
"calling",
"validateCommon"
] | train | https://github.com/phramework/validate/blob/22dd3c4e5f7a77a1a75d92f98444f3e4b7ce5cfc/src/NumberValidator.php#L126-L187 |
contao-bootstrap/buttons | src/Netzmacht/Bootstrap/Buttons/Factory.php | Factory.createFromFieldset | public static function createFromFieldset($definition)
{
$definition = self::parseDefinition($definition);
$root = new Group();
$group = $root;
/** @var bool|Dropdown $dropdown */
$dropdown = false;
$first = true;
foreach ($definition as $butto... | php | public static function createFromFieldset($definition)
{
$definition = self::parseDefinition($definition);
$root = new Group();
$group = $root;
/** @var bool|Dropdown $dropdown */
$dropdown = false;
$first = true;
foreach ($definition as $butto... | [
"public",
"static",
"function",
"createFromFieldset",
"(",
"$",
"definition",
")",
"{",
"$",
"definition",
"=",
"self",
"::",
"parseDefinition",
"(",
"$",
"definition",
")",
";",
"$",
"root",
"=",
"new",
"Group",
"(",
")",
";",
"$",
"group",
"=",
"$",
... | Create button from fieldset defintiion.
@param string|array $definition Button definition.
@return Group|Toolbar | [
"Create",
"button",
"from",
"fieldset",
"defintiion",
"."
] | train | https://github.com/contao-bootstrap/buttons/blob/f573a24c19ec059aae528a12ba46dfc993844201/src/Netzmacht/Bootstrap/Buttons/Factory.php#L28-L79 |
contao-bootstrap/buttons | src/Netzmacht/Bootstrap/Buttons/Factory.php | Factory.createButton | public static function createButton($label, $url, array $attributes = array(), $fromFieldset = false)
{
$button = new Button();
$button->setLabel($label);
static::applyAttributes($button, $attributes, $fromFieldset);
$button->setAttribute('href', $url);
return $button;
} | php | public static function createButton($label, $url, array $attributes = array(), $fromFieldset = false)
{
$button = new Button();
$button->setLabel($label);
static::applyAttributes($button, $attributes, $fromFieldset);
$button->setAttribute('href', $url);
return $button;
} | [
"public",
"static",
"function",
"createButton",
"(",
"$",
"label",
",",
"$",
"url",
",",
"array",
"$",
"attributes",
"=",
"array",
"(",
")",
",",
"$",
"fromFieldset",
"=",
"false",
")",
"{",
"$",
"button",
"=",
"new",
"Button",
"(",
")",
";",
"$",
... | Create a button.
@param string $label Button label.
@param string $url Button href url.
@param array $attributes Additional html attributes.
@param bool $fromFieldset Set true if attributes comes from fieldset definitions have to be transformed.
@return Button | [
"Create",
"a",
"button",
"."
] | train | https://github.com/contao-bootstrap/buttons/blob/f573a24c19ec059aae528a12ba46dfc993844201/src/Netzmacht/Bootstrap/Buttons/Factory.php#L91-L99 |
contao-bootstrap/buttons | src/Netzmacht/Bootstrap/Buttons/Factory.php | Factory.createGroup | public static function createGroup(array $attributes = array(), $fromFieldset = false, $vertical = false)
{
$group = new Group(array(), $vertical);
static::applyAttributes($group, $attributes, $fromFieldset);
return $group;
} | php | public static function createGroup(array $attributes = array(), $fromFieldset = false, $vertical = false)
{
$group = new Group(array(), $vertical);
static::applyAttributes($group, $attributes, $fromFieldset);
return $group;
} | [
"public",
"static",
"function",
"createGroup",
"(",
"array",
"$",
"attributes",
"=",
"array",
"(",
")",
",",
"$",
"fromFieldset",
"=",
"false",
",",
"$",
"vertical",
"=",
"false",
")",
"{",
"$",
"group",
"=",
"new",
"Group",
"(",
"array",
"(",
")",
"... | Create button group.
@param array $attributes Additional html attributes.
@param bool $fromFieldset Set true if attributes comes from fieldset definitions have to be transformed.
@param bool $vertical If true a vertical group is created.
@return Group | [
"Create",
"button",
"group",
"."
] | train | https://github.com/contao-bootstrap/buttons/blob/f573a24c19ec059aae528a12ba46dfc993844201/src/Netzmacht/Bootstrap/Buttons/Factory.php#L110-L116 |
contao-bootstrap/buttons | src/Netzmacht/Bootstrap/Buttons/Factory.php | Factory.createToolbar | public static function createToolbar(array $attributes = array(), $fromFieldset = false)
{
$toolbar = new Toolbar();
static::applyAttributes($toolbar, $attributes, $fromFieldset);
return $toolbar;
} | php | public static function createToolbar(array $attributes = array(), $fromFieldset = false)
{
$toolbar = new Toolbar();
static::applyAttributes($toolbar, $attributes, $fromFieldset);
return $toolbar;
} | [
"public",
"static",
"function",
"createToolbar",
"(",
"array",
"$",
"attributes",
"=",
"array",
"(",
")",
",",
"$",
"fromFieldset",
"=",
"false",
")",
"{",
"$",
"toolbar",
"=",
"new",
"Toolbar",
"(",
")",
";",
"static",
"::",
"applyAttributes",
"(",
"$",... | Create button toolbar.
@param array $attributes Additional html attributes.
@param bool $fromFieldset Set true if attributes comes from fieldset definitions have to be transformed.
@return Toolbar | [
"Create",
"button",
"toolbar",
"."
] | train | https://github.com/contao-bootstrap/buttons/blob/f573a24c19ec059aae528a12ba46dfc993844201/src/Netzmacht/Bootstrap/Buttons/Factory.php#L126-L132 |
contao-bootstrap/buttons | src/Netzmacht/Bootstrap/Buttons/Factory.php | Factory.createDropdown | public static function createDropdown($label, array $attributes = array(), $fromFieldset = false)
{
$dropdown = new Dropdown();
$dropdown->setLabel($label);
static::applyAttributes($dropdown, $attributes, $fromFieldset);
return $dropdown;
} | php | public static function createDropdown($label, array $attributes = array(), $fromFieldset = false)
{
$dropdown = new Dropdown();
$dropdown->setLabel($label);
static::applyAttributes($dropdown, $attributes, $fromFieldset);
return $dropdown;
} | [
"public",
"static",
"function",
"createDropdown",
"(",
"$",
"label",
",",
"array",
"$",
"attributes",
"=",
"array",
"(",
")",
",",
"$",
"fromFieldset",
"=",
"false",
")",
"{",
"$",
"dropdown",
"=",
"new",
"Dropdown",
"(",
")",
";",
"$",
"dropdown",
"->... | Create dropdown button.
@param string $label Dropdown button.
@param array $attributes Additional html attributes.
@param bool $fromFieldset Set true if attributes comes from fieldset definitions have to be transformed.
@return Dropdown | [
"Create",
"dropdown",
"button",
"."
] | train | https://github.com/contao-bootstrap/buttons/blob/f573a24c19ec059aae528a12ba46dfc993844201/src/Netzmacht/Bootstrap/Buttons/Factory.php#L143-L151 |
contao-bootstrap/buttons | src/Netzmacht/Bootstrap/Buttons/Factory.php | Factory.createDropdownHeader | public static function createDropdownHeader($label, array $attributes = array(), $fromFieldset = false)
{
$dropdown = new Dropdown\Header();
$dropdown->setLabel($label);
static::applyAttributes($dropdown, $attributes, $fromFieldset);
return $dropdown;
} | php | public static function createDropdownHeader($label, array $attributes = array(), $fromFieldset = false)
{
$dropdown = new Dropdown\Header();
$dropdown->setLabel($label);
static::applyAttributes($dropdown, $attributes, $fromFieldset);
return $dropdown;
} | [
"public",
"static",
"function",
"createDropdownHeader",
"(",
"$",
"label",
",",
"array",
"$",
"attributes",
"=",
"array",
"(",
")",
",",
"$",
"fromFieldset",
"=",
"false",
")",
"{",
"$",
"dropdown",
"=",
"new",
"Dropdown",
"\\",
"Header",
"(",
")",
";",
... | Create dropdown header.
@param string $label Dropdown button.
@param array $attributes Additional html attributes.
@param bool $fromFieldset Set true if attributes comes from fieldset definitions have to be transformed.
@return Dropdown\Header | [
"Create",
"dropdown",
"header",
"."
] | train | https://github.com/contao-bootstrap/buttons/blob/f573a24c19ec059aae528a12ba46dfc993844201/src/Netzmacht/Bootstrap/Buttons/Factory.php#L162-L170 |
contao-bootstrap/buttons | src/Netzmacht/Bootstrap/Buttons/Factory.php | Factory.createDropdownDivider | public static function createDropdownDivider(array $attributes = array(), $fromFieldset = false)
{
$dropdown = new Dropdown\Divider();
static::applyAttributes($dropdown, $attributes, $fromFieldset);
return $dropdown;
} | php | public static function createDropdownDivider(array $attributes = array(), $fromFieldset = false)
{
$dropdown = new Dropdown\Divider();
static::applyAttributes($dropdown, $attributes, $fromFieldset);
return $dropdown;
} | [
"public",
"static",
"function",
"createDropdownDivider",
"(",
"array",
"$",
"attributes",
"=",
"array",
"(",
")",
",",
"$",
"fromFieldset",
"=",
"false",
")",
"{",
"$",
"dropdown",
"=",
"new",
"Dropdown",
"\\",
"Divider",
"(",
")",
";",
"static",
"::",
"... | Create dropdown divider.
@param array $attributes Additional html attributes.
@param bool $fromFieldset Set true if attributes comes from fieldset definitions have to be transformed.
@return Dropdown\Divider | [
"Create",
"dropdown",
"divider",
"."
] | train | https://github.com/contao-bootstrap/buttons/blob/f573a24c19ec059aae528a12ba46dfc993844201/src/Netzmacht/Bootstrap/Buttons/Factory.php#L180-L186 |
contao-bootstrap/buttons | src/Netzmacht/Bootstrap/Buttons/Factory.php | Factory.createDropdownItem | public static function createDropdownItem($label, $url, array $attributes = array(), $fromFieldset = false)
{
$button = static::createButton($label, $url, $attributes, $fromFieldset);
$button->setAttribute('role', 'menuitem');
$dropdown = new Dropdown\Item($button);
return $dropdown... | php | public static function createDropdownItem($label, $url, array $attributes = array(), $fromFieldset = false)
{
$button = static::createButton($label, $url, $attributes, $fromFieldset);
$button->setAttribute('role', 'menuitem');
$dropdown = new Dropdown\Item($button);
return $dropdown... | [
"public",
"static",
"function",
"createDropdownItem",
"(",
"$",
"label",
",",
"$",
"url",
",",
"array",
"$",
"attributes",
"=",
"array",
"(",
")",
",",
"$",
"fromFieldset",
"=",
"false",
")",
"{",
"$",
"button",
"=",
"static",
"::",
"createButton",
"(",
... | Create dropdown item.
@param string $label Dropdown label.
@param string $url Dropdown url.
@param array $attributes Additional html attributes.
@param bool $fromFieldset Set true if attributes comes from fieldset definitions have to be transformed.
@return Dropdown\Item | [
"Create",
"dropdown",
"item",
"."
] | train | https://github.com/contao-bootstrap/buttons/blob/f573a24c19ec059aae528a12ba46dfc993844201/src/Netzmacht/Bootstrap/Buttons/Factory.php#L198-L205 |
contao-bootstrap/buttons | src/Netzmacht/Bootstrap/Buttons/Factory.php | Factory.applyAttributes | protected static function applyAttributes(Attributes $node, array $attributes, $fromFieldset = false)
{
if (empty($attributes)) {
return;
}
if ($fromFieldset) {
foreach ($attributes as $attribute) {
if ($attribute['name']) {
if ($a... | php | protected static function applyAttributes(Attributes $node, array $attributes, $fromFieldset = false)
{
if (empty($attributes)) {
return;
}
if ($fromFieldset) {
foreach ($attributes as $attribute) {
if ($attribute['name']) {
if ($a... | [
"protected",
"static",
"function",
"applyAttributes",
"(",
"Attributes",
"$",
"node",
",",
"array",
"$",
"attributes",
",",
"$",
"fromFieldset",
"=",
"false",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"attributes",
")",
")",
"{",
"return",
";",
"}",
"if",
... | Apply attributes.
@param Attributes $node Attrbiutes alement.
@param array $attributes Html attributes which being applied.
@param bool $fromFieldset Set true if attributes comes from fieldset definitions have to be transformed.
@return void | [
"Apply",
"attributes",
"."
] | train | https://github.com/contao-bootstrap/buttons/blob/f573a24c19ec059aae528a12ba46dfc993844201/src/Netzmacht/Bootstrap/Buttons/Factory.php#L216-L242 |
contao-bootstrap/buttons | src/Netzmacht/Bootstrap/Buttons/Factory.php | Factory.enableToolbar | protected static function enableToolbar($root)
{
if (!$root instanceof Toolbar) {
$group = $root;
$root = static::createToolbar(array(), true);
if ($group instanceof Group && $group->getChildren()) {
$root->addChild($group);
}
}
... | php | protected static function enableToolbar($root)
{
if (!$root instanceof Toolbar) {
$group = $root;
$root = static::createToolbar(array(), true);
if ($group instanceof Group && $group->getChildren()) {
$root->addChild($group);
}
}
... | [
"protected",
"static",
"function",
"enableToolbar",
"(",
"$",
"root",
")",
"{",
"if",
"(",
"!",
"$",
"root",
"instanceof",
"Toolbar",
")",
"{",
"$",
"group",
"=",
"$",
"root",
";",
"$",
"root",
"=",
"static",
"::",
"createToolbar",
"(",
"array",
"(",
... | Enable the toolbar.
@param mixed $root Current root element.
@return Toolbar | [
"Enable",
"the",
"toolbar",
"."
] | train | https://github.com/contao-bootstrap/buttons/blob/f573a24c19ec059aae528a12ba46dfc993844201/src/Netzmacht/Bootstrap/Buttons/Factory.php#L251-L263 |
contao-bootstrap/buttons | src/Netzmacht/Bootstrap/Buttons/Factory.php | Factory.parseDropdownChild | private static function parseDropdownChild($dropdown, $button)
{
if ($dropdown === false || !$dropdown instanceof Dropdown) {
// @codingStandardsIgnoreStart
// TODO throw exception?
// @codingStandardsIgnoreEnd
return;
}
if ($button['type'] ==... | php | private static function parseDropdownChild($dropdown, $button)
{
if ($dropdown === false || !$dropdown instanceof Dropdown) {
// @codingStandardsIgnoreStart
// TODO throw exception?
// @codingStandardsIgnoreEnd
return;
}
if ($button['type'] ==... | [
"private",
"static",
"function",
"parseDropdownChild",
"(",
"$",
"dropdown",
",",
"$",
"button",
")",
"{",
"if",
"(",
"$",
"dropdown",
"===",
"false",
"||",
"!",
"$",
"dropdown",
"instanceof",
"Dropdown",
")",
"{",
"// @codingStandardsIgnoreStart",
"// TODO thro... | Parse dropdown child.
@param Dropdown|bool $dropdown Current dropdown element.
@param array $button Button definition.
@return void | [
"Parse",
"dropdown",
"child",
"."
] | train | https://github.com/contao-bootstrap/buttons/blob/f573a24c19ec059aae528a12ba46dfc993844201/src/Netzmacht/Bootstrap/Buttons/Factory.php#L273-L294 |
contao-bootstrap/buttons | src/Netzmacht/Bootstrap/Buttons/Factory.php | Factory.parseDefinition | protected static function parseDefinition($definition)
{
if (!is_array($definition)) {
$definition = deserialize($definition, true);
return $definition;
}
return $definition;
} | php | protected static function parseDefinition($definition)
{
if (!is_array($definition)) {
$definition = deserialize($definition, true);
return $definition;
}
return $definition;
} | [
"protected",
"static",
"function",
"parseDefinition",
"(",
"$",
"definition",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"definition",
")",
")",
"{",
"$",
"definition",
"=",
"deserialize",
"(",
"$",
"definition",
",",
"true",
")",
";",
"return",
"$"... | Parse button definition.
@param string|array $definition Button definition.
@return array | [
"Parse",
"button",
"definition",
"."
] | train | https://github.com/contao-bootstrap/buttons/blob/f573a24c19ec059aae528a12ba46dfc993844201/src/Netzmacht/Bootstrap/Buttons/Factory.php#L303-L312 |
contao-bootstrap/buttons | src/Netzmacht/Bootstrap/Buttons/Factory.php | Factory.encodeValue | protected static function encodeValue($button)
{
if (isset($button['button']) && $button['button'] == 'link') {
if (substr($button['value'], 0, 7) == 'mailto:') {
if (version_compare(VERSION . '.' . BUILD, '3.5.5', '>=')) {
$button['value'] = \StringUtil::enco... | php | protected static function encodeValue($button)
{
if (isset($button['button']) && $button['button'] == 'link') {
if (substr($button['value'], 0, 7) == 'mailto:') {
if (version_compare(VERSION . '.' . BUILD, '3.5.5', '>=')) {
$button['value'] = \StringUtil::enco... | [
"protected",
"static",
"function",
"encodeValue",
"(",
"$",
"button",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"button",
"[",
"'button'",
"]",
")",
"&&",
"$",
"button",
"[",
"'button'",
"]",
"==",
"'link'",
")",
"{",
"if",
"(",
"substr",
"(",
"$",
"... | Encode button value.
@param array $button Button definition.
@return array | [
"Encode",
"button",
"value",
"."
] | train | https://github.com/contao-bootstrap/buttons/blob/f573a24c19ec059aae528a12ba46dfc993844201/src/Netzmacht/Bootstrap/Buttons/Factory.php#L333-L348 |
contao-bootstrap/buttons | src/Netzmacht/Bootstrap/Buttons/Factory.php | Factory.createNewGroup | protected static function createNewGroup(&$root, $button, &$dropdown, $addToRoot = true)
{
if ($addToRoot) {
$root = self::enableToolbar($root);
}
if ($dropdown !== false) {
$dropdown = false;
}
$group = static::createGroup($button['attributes'], tru... | php | protected static function createNewGroup(&$root, $button, &$dropdown, $addToRoot = true)
{
if ($addToRoot) {
$root = self::enableToolbar($root);
}
if ($dropdown !== false) {
$dropdown = false;
}
$group = static::createGroup($button['attributes'], tru... | [
"protected",
"static",
"function",
"createNewGroup",
"(",
"&",
"$",
"root",
",",
"$",
"button",
",",
"&",
"$",
"dropdown",
",",
"$",
"addToRoot",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"addToRoot",
")",
"{",
"$",
"root",
"=",
"self",
"::",
"enableToo... | Create a new group element.
@param mixed $root Current root.
@param array $button Button definition.
@param Dropdown|bool $dropdown Dropdown element.
@param bool $addToRoot If rue the created group is added to the root.
@return Group | [
"Create",
"a",
"new",
"group",
"element",
"."
] | train | https://github.com/contao-bootstrap/buttons/blob/f573a24c19ec059aae528a12ba46dfc993844201/src/Netzmacht/Bootstrap/Buttons/Factory.php#L360-L379 |
jan-dolata/crude-crud | src/Engine/CrudeInstance.php | CrudeInstance.get | public static function get($name)
{
$namespaces = config('crude.namespace');
if (! is_array($namespaces)) {
$fullName = $namespaces . $name;
return class_exists($fullName)
? new $fullName()
: null;
}
foreach ($namespaces as $... | php | public static function get($name)
{
$namespaces = config('crude.namespace');
if (! is_array($namespaces)) {
$fullName = $namespaces . $name;
return class_exists($fullName)
? new $fullName()
: null;
}
foreach ($namespaces as $... | [
"public",
"static",
"function",
"get",
"(",
"$",
"name",
")",
"{",
"$",
"namespaces",
"=",
"config",
"(",
"'crude.namespace'",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"namespaces",
")",
")",
"{",
"$",
"fullName",
"=",
"$",
"namespaces",
".",
... | Create crude instance
@param string $name
@return Model|null | [
"Create",
"crude",
"instance"
] | train | https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Engine/CrudeInstance.php#L13-L32 |
blast-project/CoreBundle | src/Admin/Traits/PreEvents.php | PreEvents.prePersistOrUpdate | protected function prePersistOrUpdate($object, $method)
{
$analyzer = new ClassAnalyzer();
foreach ($analyzer->getTraits($this) as $traitname) {
$rc = new \ReflectionClass($traitname);
if (method_exists($this, $exec = $method . $rc->getShortName())) {
$this->$... | php | protected function prePersistOrUpdate($object, $method)
{
$analyzer = new ClassAnalyzer();
foreach ($analyzer->getTraits($this) as $traitname) {
$rc = new \ReflectionClass($traitname);
if (method_exists($this, $exec = $method . $rc->getShortName())) {
$this->$... | [
"protected",
"function",
"prePersistOrUpdate",
"(",
"$",
"object",
",",
"$",
"method",
")",
"{",
"$",
"analyzer",
"=",
"new",
"ClassAnalyzer",
"(",
")",
";",
"foreach",
"(",
"$",
"analyzer",
"->",
"getTraits",
"(",
"$",
"this",
")",
"as",
"$",
"traitname... | function prePersistOrUpdate.
Searches in every trait (as if they were kind of Doctrine Behaviors) some logical to be
executed during the self::prePersist() or self::preUpdate() calls
The logical is stored in the self::prePersist{TraitName}() method
@param object $object (Entity)
@param string $method (the current cal... | [
"function",
"prePersistOrUpdate",
"."
] | train | https://github.com/blast-project/CoreBundle/blob/7a0832758ca14e5bc5d65515532c1220df3930ae/src/Admin/Traits/PreEvents.php#L51-L62 |
comelyio/comely | src/Comely/IO/Yaml/Compiler.php | Compiler.setIndent | public function setIndent(int $indent = 2): self
{
if (!Number::Range($indent, 2, 8)) {
throw new CompilerException(sprintf('"%d" is an invalid indent value', $indent));
}
return $this;
} | php | public function setIndent(int $indent = 2): self
{
if (!Number::Range($indent, 2, 8)) {
throw new CompilerException(sprintf('"%d" is an invalid indent value', $indent));
}
return $this;
} | [
"public",
"function",
"setIndent",
"(",
"int",
"$",
"indent",
"=",
"2",
")",
":",
"self",
"{",
"if",
"(",
"!",
"Number",
"::",
"Range",
"(",
"$",
"indent",
",",
"2",
",",
"8",
")",
")",
"{",
"throw",
"new",
"CompilerException",
"(",
"sprintf",
"(",... | Set indent spacer
@param int $indent
@return Compiler
@throws CompilerException | [
"Set",
"indent",
"spacer"
] | train | https://github.com/comelyio/comely/blob/561ea7aef36fea347a1a79d3ee5597d4057ddf82/src/Comely/IO/Yaml/Compiler.php#L66-L73 |
axelitus/php-base | src/Comparison/IntComparer.php | IntComparer.setCallback | public function setCallback(Closure $callback = null)
{
if ($this->callback !== null || $callback === null) {
throw new \RuntimeException("Cannot redeclare this comparer callback.");
}
$this->callback = Closure::bind($callback, $this, get_called_class());
} | php | public function setCallback(Closure $callback = null)
{
if ($this->callback !== null || $callback === null) {
throw new \RuntimeException("Cannot redeclare this comparer callback.");
}
$this->callback = Closure::bind($callback, $this, get_called_class());
} | [
"public",
"function",
"setCallback",
"(",
"Closure",
"$",
"callback",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"callback",
"!==",
"null",
"||",
"$",
"callback",
"===",
"null",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"\"Cannot... | This comparer does not allow to set the callback outside this class.
@param Closure $callback The new callback.
@throws \RuntimeException | [
"This",
"comparer",
"does",
"not",
"allow",
"to",
"set",
"the",
"callback",
"outside",
"this",
"class",
"."
] | train | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/Comparison/IntComparer.php#L52-L59 |
faganchalabizada/millikart-epos-laravel | src/Controller/EPOSController.php | EPOSController.createTransaction | public function createTransaction(Request $request)
{
$this->validate($request, [
'amount' => 'required|numeric',
'card_type' => 'required|numeric|max:3',
'phone_number' => 'phone_number',
]);
$amount = $request->input("amount");
$card_type = $re... | php | public function createTransaction(Request $request)
{
$this->validate($request, [
'amount' => 'required|numeric',
'card_type' => 'required|numeric|max:3',
'phone_number' => 'phone_number',
]);
$amount = $request->input("amount");
$card_type = $re... | [
"public",
"function",
"createTransaction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"this",
"->",
"validate",
"(",
"$",
"request",
",",
"[",
"'amount'",
"=>",
"'required|numeric'",
",",
"'card_type'",
"=>",
"'required|numeric|max:3'",
",",
"'phone_number'",
... | Create transaction
@param $request
@return | [
"Create",
"transaction"
] | train | https://github.com/faganchalabizada/millikart-epos-laravel/blob/0a535c59ba30acb1d0cbee933e788b35404eb7be/src/Controller/EPOSController.php#L53-L112 |
ekyna/GlsUniBox | Api/AbstractData.php | AbstractData.get | protected function get($tag)
{
if (isset($this->data[$tag])) {
return $this->data[$tag];
}
return null;
} | php | protected function get($tag)
{
if (isset($this->data[$tag])) {
return $this->data[$tag];
}
return null;
} | [
"protected",
"function",
"get",
"(",
"$",
"tag",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"$",
"tag",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"data",
"[",
"$",
"tag",
"]",
";",
"}",
"return",
"null",
";",
"}... | Returns the value for the given tag.
@param string $tag
@return string|null | [
"Returns",
"the",
"value",
"for",
"the",
"given",
"tag",
"."
] | train | https://github.com/ekyna/GlsUniBox/blob/b474271ba355c3917074422306dc64abf09584d0/Api/AbstractData.php#L54-L61 |
ekyna/GlsUniBox | Api/AbstractData.php | AbstractData.clean | public function clean()
{
foreach ($this->data as $key => $data) {
if (empty($data)) {
unset($this->data[$key]);
}
}
return $this;
} | php | public function clean()
{
foreach ($this->data as $key => $data) {
if (empty($data)) {
unset($this->data[$key]);
}
}
return $this;
} | [
"public",
"function",
"clean",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"data",
"as",
"$",
"key",
"=>",
"$",
"data",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"data",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"data",
"[",
"$",
"k... | Removes keys with empty value.
@return $this | [
"Removes",
"keys",
"with",
"empty",
"value",
"."
] | train | https://github.com/ekyna/GlsUniBox/blob/b474271ba355c3917074422306dc64abf09584d0/Api/AbstractData.php#L68-L77 |
vincentchalamon/VinceCmsSonataAdminBundle | Form/Type/AreaType.php | AreaType.buildForm | public function buildForm(FormBuilderInterface $builder, array $options)
{
foreach ($options['areas'] as $area) {
/** @var Area $area */
$fieldOptions = array_merge(array(
'label' => $area->getTitle(),
'required' => $area->isRequired(),
), ... | php | public function buildForm(FormBuilderInterface $builder, array $options)
{
foreach ($options['areas'] as $area) {
/** @var Area $area */
$fieldOptions = array_merge(array(
'label' => $area->getTitle(),
'required' => $area->isRequired(),
), ... | [
"public",
"function",
"buildForm",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"array",
"$",
"options",
")",
"{",
"foreach",
"(",
"$",
"options",
"[",
"'areas'",
"]",
"as",
"$",
"area",
")",
"{",
"/** @var Area $area */",
"$",
"fieldOptions",
"=",
"arr... | {@inheritdoc} | [
"{"
] | train | https://github.com/vincentchalamon/VinceCmsSonataAdminBundle/blob/edc768061734a92ba116488dd7b61ad40af21ceb/Form/Type/AreaType.php#L28-L41 |
huasituo/hstcms | src/Console/Commands/HstcmsSeedCommand.php | HstcmsSeedCommand.handle | public function handle()
{
$seeder = ['ManageUser', 'CommonConfig', 'CommonRole', 'CommonRoleUri', 'ManageMenu'];
if($seeder) {
if($this->option('table')) {
if(in_array($this->option('table'), $seeder)) {
$fullPath = 'Huasituo\Hstcms\Database\Seeds\\'.... | php | public function handle()
{
$seeder = ['ManageUser', 'CommonConfig', 'CommonRole', 'CommonRoleUri', 'ManageMenu'];
if($seeder) {
if($this->option('table')) {
if(in_array($this->option('table'), $seeder)) {
$fullPath = 'Huasituo\Hstcms\Database\Seeds\\'.... | [
"public",
"function",
"handle",
"(",
")",
"{",
"$",
"seeder",
"=",
"[",
"'ManageUser'",
",",
"'CommonConfig'",
",",
"'CommonRole'",
",",
"'CommonRoleUri'",
",",
"'ManageMenu'",
"]",
";",
"if",
"(",
"$",
"seeder",
")",
"{",
"if",
"(",
"$",
"this",
"->",
... | Execute the console command.
@return mixed | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Console/Commands/HstcmsSeedCommand.php#L52-L68 |
huasituo/hstcms | src/Console/Commands/HstcmsSeedCommand.php | HstcmsSeedCommand.seed | protected function seed($fullPath, $table)
{
if (class_exists($fullPath)) {
if ($this->option('class')) {
$params['--class'] = $this->option('class');
} else {
$params['--class'] = $fullPath;
}
if ($option = $this->option('data... | php | protected function seed($fullPath, $table)
{
if (class_exists($fullPath)) {
if ($this->option('class')) {
$params['--class'] = $this->option('class');
} else {
$params['--class'] = $fullPath;
}
if ($option = $this->option('data... | [
"protected",
"function",
"seed",
"(",
"$",
"fullPath",
",",
"$",
"table",
")",
"{",
"if",
"(",
"class_exists",
"(",
"$",
"fullPath",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"option",
"(",
"'class'",
")",
")",
"{",
"$",
"params",
"[",
"'--class... | Seed the specific module.
@param string $module
@return array | [
"Seed",
"the",
"specific",
"module",
"."
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Console/Commands/HstcmsSeedCommand.php#L77-L94 |
refinery29/piston | src/RequestFactory.php | RequestFactory.fromGlobals | public static function fromGlobals(
array $server = null,
array $query = null,
array $body = null,
array $cookies = null,
array $files = null
) {
$cookies = new CookieJar($cookies ?: $_COOKIE);
$server = static::normalizeServer($server ?: $_SERVER);
$f... | php | public static function fromGlobals(
array $server = null,
array $query = null,
array $body = null,
array $cookies = null,
array $files = null
) {
$cookies = new CookieJar($cookies ?: $_COOKIE);
$server = static::normalizeServer($server ?: $_SERVER);
$f... | [
"public",
"static",
"function",
"fromGlobals",
"(",
"array",
"$",
"server",
"=",
"null",
",",
"array",
"$",
"query",
"=",
"null",
",",
"array",
"$",
"body",
"=",
"null",
",",
"array",
"$",
"cookies",
"=",
"null",
",",
"array",
"$",
"files",
"=",
"nul... | @param array $server
@param array $query
@param array $body
@param array $cookies
@param array $files
@return ServerRequest | [
"@param",
"array",
"$server",
"@param",
"array",
"$query",
"@param",
"array",
"$body",
"@param",
"array",
"$cookies",
"@param",
"array",
"$files"
] | train | https://github.com/refinery29/piston/blob/75c402e814136577fa9a02479e8803aca664c865/src/RequestFactory.php#L27-L51 |
ray-di/Ray.WebFormModule | src/AbstractForm.php | AbstractForm.setBaseDependencies | public function setBaseDependencies(
BuilderInterface $builder,
FilterFactory $filterFactory,
HelperLocatorFactory $helperFactory
) {
$this->builder = $builder;
$this->filter = $filterFactory->newSubjectFilter();
$this->helper = $helperFactory->newInstance();
} | php | public function setBaseDependencies(
BuilderInterface $builder,
FilterFactory $filterFactory,
HelperLocatorFactory $helperFactory
) {
$this->builder = $builder;
$this->filter = $filterFactory->newSubjectFilter();
$this->helper = $helperFactory->newInstance();
} | [
"public",
"function",
"setBaseDependencies",
"(",
"BuilderInterface",
"$",
"builder",
",",
"FilterFactory",
"$",
"filterFactory",
",",
"HelperLocatorFactory",
"$",
"helperFactory",
")",
"{",
"$",
"this",
"->",
"builder",
"=",
"$",
"builder",
";",
"$",
"this",
"-... | @param BuilderInterface $builder
@param FilterFactory $filterFactory
@param HelperLocatorFactory $helperFactory
@\Ray\Di\Di\Inject | [
"@param",
"BuilderInterface",
"$builder",
"@param",
"FilterFactory",
"$filterFactory",
"@param",
"HelperLocatorFactory",
"$helperFactory"
] | train | https://github.com/ray-di/Ray.WebFormModule/blob/4b6d33adb4a5c285278a068f3e7a5afdc4e680d9/src/AbstractForm.php#L78-L86 |
ray-di/Ray.WebFormModule | src/AbstractForm.php | AbstractForm.error | public function error($input)
{
if (! $this->errorMessages) {
$failure = $this->filter->getFailures();
if ($failure) {
$this->errorMessages = $failure->getMessages();
}
}
if (isset($this->errorMessages[$input])) {
return $this-... | php | public function error($input)
{
if (! $this->errorMessages) {
$failure = $this->filter->getFailures();
if ($failure) {
$this->errorMessages = $failure->getMessages();
}
}
if (isset($this->errorMessages[$input])) {
return $this-... | [
"public",
"function",
"error",
"(",
"$",
"input",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"errorMessages",
")",
"{",
"$",
"failure",
"=",
"$",
"this",
"->",
"filter",
"->",
"getFailures",
"(",
")",
";",
"if",
"(",
"$",
"failure",
")",
"{",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/ray-di/Ray.WebFormModule/blob/4b6d33adb4a5c285278a068f3e7a5afdc4e680d9/src/AbstractForm.php#L115-L129 |
ray-di/Ray.WebFormModule | src/AbstractForm.php | AbstractForm.form | public function form($attr = [])
{
$form = $this->helper->form($attr);
if (isset($this->inputs['__csrf_token'])) {
$form .= $this->helper->input($this->get('__csrf_token'));
}
return $form;
} | php | public function form($attr = [])
{
$form = $this->helper->form($attr);
if (isset($this->inputs['__csrf_token'])) {
$form .= $this->helper->input($this->get('__csrf_token'));
}
return $form;
} | [
"public",
"function",
"form",
"(",
"$",
"attr",
"=",
"[",
"]",
")",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"helper",
"->",
"form",
"(",
"$",
"attr",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"inputs",
"[",
"'__csrf_token'",
"]",
... | @param array $attr attributes for the form tag
@throws \Aura\Html\Exception\HelperNotFound
@throws \Aura\Input\Exception\NoSuchInput
@return string | [
"@param",
"array",
"$attr",
"attributes",
"for",
"the",
"form",
"tag"
] | train | https://github.com/ray-di/Ray.WebFormModule/blob/4b6d33adb4a5c285278a068f3e7a5afdc4e680d9/src/AbstractForm.php#L139-L147 |
ray-di/Ray.WebFormModule | src/AbstractForm.php | AbstractForm.apply | public function apply(array $data)
{
if ($this->antiCsrf && ! $this->antiCsrf->isValid($data)) {
throw new CsrfViolationException;
}
$this->fill($data);
return $this->filter->apply($data);
} | php | public function apply(array $data)
{
if ($this->antiCsrf && ! $this->antiCsrf->isValid($data)) {
throw new CsrfViolationException;
}
$this->fill($data);
return $this->filter->apply($data);
} | [
"public",
"function",
"apply",
"(",
"array",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"antiCsrf",
"&&",
"!",
"$",
"this",
"->",
"antiCsrf",
"->",
"isValid",
"(",
"$",
"data",
")",
")",
"{",
"throw",
"new",
"CsrfViolationException",
";",
"... | Applies the filter to a subject.
@param array $data
@throws CsrfViolationException
@return bool | [
"Applies",
"the",
"filter",
"to",
"a",
"subject",
"."
] | train | https://github.com/ray-di/Ray.WebFormModule/blob/4b6d33adb4a5c285278a068f3e7a5afdc4e680d9/src/AbstractForm.php#L158-L166 |
andyvenus/form | src/EntityProcessor/GetterSetterEntityProcessor.php | GetterSetterEntityProcessor.getFromEntity | public function getFromEntity($entity, array $formParameters, $limitFields = null)
{
$extracted_data = array();
foreach($formParameters as $field) {
$getter_name = "get".$this->dashesToCamelCase($field);
if (($limitFields === null || in_array($field, $limitFields)) && metho... | php | public function getFromEntity($entity, array $formParameters, $limitFields = null)
{
$extracted_data = array();
foreach($formParameters as $field) {
$getter_name = "get".$this->dashesToCamelCase($field);
if (($limitFields === null || in_array($field, $limitFields)) && metho... | [
"public",
"function",
"getFromEntity",
"(",
"$",
"entity",
",",
"array",
"$",
"formParameters",
",",
"$",
"limitFields",
"=",
"null",
")",
"{",
"$",
"extracted_data",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"formParameters",
"as",
"$",
"field",
... | Get data from an entity using getter methods
@param $entity
@param array $formParameters
@param null $limitFields
@return array | [
"Get",
"data",
"from",
"an",
"entity",
"using",
"getter",
"methods"
] | train | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/EntityProcessor/GetterSetterEntityProcessor.php#L25-L38 |
andyvenus/form | src/EntityProcessor/GetterSetterEntityProcessor.php | GetterSetterEntityProcessor.saveToEntity | public function saveToEntity($entity, $formData, $limitFields = null)
{
foreach($formData as $field => $value) {
$setter_name = "set".$this->dashesToCamelCase($field);
if (($limitFields === null || in_array($field, $limitFields)) && method_exists($entity, $setter_name)) {
... | php | public function saveToEntity($entity, $formData, $limitFields = null)
{
foreach($formData as $field => $value) {
$setter_name = "set".$this->dashesToCamelCase($field);
if (($limitFields === null || in_array($field, $limitFields)) && method_exists($entity, $setter_name)) {
... | [
"public",
"function",
"saveToEntity",
"(",
"$",
"entity",
",",
"$",
"formData",
",",
"$",
"limitFields",
"=",
"null",
")",
"{",
"foreach",
"(",
"$",
"formData",
"as",
"$",
"field",
"=>",
"$",
"value",
")",
"{",
"$",
"setter_name",
"=",
"\"set\"",
".",
... | Save data to an entity using setter methods
@param $entity
@param $formData
@param null $limitFields
@return void | [
"Save",
"data",
"to",
"an",
"entity",
"using",
"setter",
"methods"
] | train | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/EntityProcessor/GetterSetterEntityProcessor.php#L48-L57 |
foothing/laravel-repository | src/Foothing/Repository/Eloquent/EloquentRepository.php | EloquentRepository.setModel | public function setModel(\Illuminate\Database\Eloquent\Model $model) {
$this->model = $model;
if ($this->model instanceof ResourceInterface) {
$this->enableAutoEagerLoading = true;
}
} | php | public function setModel(\Illuminate\Database\Eloquent\Model $model) {
$this->model = $model;
if ($this->model instanceof ResourceInterface) {
$this->enableAutoEagerLoading = true;
}
} | [
"public",
"function",
"setModel",
"(",
"\\",
"Illuminate",
"\\",
"Database",
"\\",
"Eloquent",
"\\",
"Model",
"$",
"model",
")",
"{",
"$",
"this",
"->",
"model",
"=",
"$",
"model",
";",
"if",
"(",
"$",
"this",
"->",
"model",
"instanceof",
"ResourceInterf... | Set the repository model.
@param \Illuminate\Database\Eloquent\Model $model | [
"Set",
"the",
"repository",
"model",
"."
] | train | https://github.com/foothing/laravel-repository/blob/a2e329acb26a08d9f260c66534b0d4f42e2adff5/src/Foothing/Repository/Eloquent/EloquentRepository.php#L60-L65 |
foothing/laravel-repository | src/Foothing/Repository/Eloquent/EloquentRepository.php | EloquentRepository.finalize | protected function finalize($result) {
$this->eagerLoad = [];
$this->criteria->reset();
$this->scope = null;
return $result;
} | php | protected function finalize($result) {
$this->eagerLoad = [];
$this->criteria->reset();
$this->scope = null;
return $result;
} | [
"protected",
"function",
"finalize",
"(",
"$",
"result",
")",
"{",
"$",
"this",
"->",
"eagerLoad",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"criteria",
"->",
"reset",
"(",
")",
";",
"$",
"this",
"->",
"scope",
"=",
"null",
";",
"return",
"$",
"result... | Utility method for flags reset. Always use this to return results.
@param $result
The result we want to return
@return mixed | [
"Utility",
"method",
"for",
"flags",
"reset",
".",
"Always",
"use",
"this",
"to",
"return",
"results",
"."
] | train | https://github.com/foothing/laravel-repository/blob/a2e329acb26a08d9f260c66534b0d4f42e2adff5/src/Foothing/Repository/Eloquent/EloquentRepository.php#L75-L80 |
foothing/laravel-repository | src/Foothing/Repository/Eloquent/EloquentRepository.php | EloquentRepository.applyAutoEagerLoading | protected function applyAutoEagerLoading($fetch = 'unit') {
if (! empty($this->eagerLoad)) {
return;
}
if ($this->enableAutoEagerLoading && $fetch == 'unit') {
$this->eagerLoad = $this->model->unitRelations();
}
elseif ($this->enableAutoEagerLoading && $... | php | protected function applyAutoEagerLoading($fetch = 'unit') {
if (! empty($this->eagerLoad)) {
return;
}
if ($this->enableAutoEagerLoading && $fetch == 'unit') {
$this->eagerLoad = $this->model->unitRelations();
}
elseif ($this->enableAutoEagerLoading && $... | [
"protected",
"function",
"applyAutoEagerLoading",
"(",
"$",
"fetch",
"=",
"'unit'",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"eagerLoad",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"enableAutoEagerLoading",
"&&",
... | Check whether the autoEagerLoading feature has to be applied.
@param string $fetch | [
"Check",
"whether",
"the",
"autoEagerLoading",
"feature",
"has",
"to",
"be",
"applied",
"."
] | train | https://github.com/foothing/laravel-repository/blob/a2e329acb26a08d9f260c66534b0d4f42e2adff5/src/Foothing/Repository/Eloquent/EloquentRepository.php#L87-L99 |
heyday/heystack | src/DependencyInjection/SilverStripe/SilverStripeServiceTrait.php | SilverStripeServiceTrait.getInjector | protected function getInjector()
{
if ($this->injector === null) {
$this->injector = \Injector::inst();
}
return $this->injector;
} | php | protected function getInjector()
{
if ($this->injector === null) {
$this->injector = \Injector::inst();
}
return $this->injector;
} | [
"protected",
"function",
"getInjector",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"injector",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"injector",
"=",
"\\",
"Injector",
"::",
"inst",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"injector",... | Retrieves the Injector instance
@return \Injector | [
"Retrieves",
"the",
"Injector",
"instance"
] | train | https://github.com/heyday/heystack/blob/2c051933f8c532d0a9a23be6ee1ff5c619e47dfe/src/DependencyInjection/SilverStripe/SilverStripeServiceTrait.php#L34-L41 |
activecollab/databasestructure | src/Builder/TriggersBuilder.php | TriggersBuilder.prepareCreateTriggerStatement | public function prepareCreateTriggerStatement(TypeInterface $type, TriggerInterface $trigger)
{
if (strpos($trigger->getBody(), "\n") === false) {
return rtrim('CREATE TRIGGER ' . $this->getConnection()->escapeFieldName($trigger->getName()) . ' ' . strtoupper($trigger->getTime()) . ' ' . strtoup... | php | public function prepareCreateTriggerStatement(TypeInterface $type, TriggerInterface $trigger)
{
if (strpos($trigger->getBody(), "\n") === false) {
return rtrim('CREATE TRIGGER ' . $this->getConnection()->escapeFieldName($trigger->getName()) . ' ' . strtoupper($trigger->getTime()) . ' ' . strtoup... | [
"public",
"function",
"prepareCreateTriggerStatement",
"(",
"TypeInterface",
"$",
"type",
",",
"TriggerInterface",
"$",
"trigger",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"trigger",
"->",
"getBody",
"(",
")",
",",
"\"\\n\"",
")",
"===",
"false",
")",
"{",
... | Prepare belongs to constraint statement.
@param TypeInterface $type
@param TriggerInterface $trigger
@return string | [
"Prepare",
"belongs",
"to",
"constraint",
"statement",
"."
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Builder/TriggersBuilder.php#L83-L97 |
activecollab/databasestructure | src/Builder/TriggersBuilder.php | TriggersBuilder.triggerExists | private function triggerExists($trigger_name)
{
if ($triggers = $this->getConnection()->execute('SHOW TRIGGERS', $trigger_name)) {
foreach ($triggers as $trigger) {
if ($trigger['Trigger'] == $trigger_name) {
return true;
}
}
... | php | private function triggerExists($trigger_name)
{
if ($triggers = $this->getConnection()->execute('SHOW TRIGGERS', $trigger_name)) {
foreach ($triggers as $trigger) {
if ($trigger['Trigger'] == $trigger_name) {
return true;
}
}
... | [
"private",
"function",
"triggerExists",
"(",
"$",
"trigger_name",
")",
"{",
"if",
"(",
"$",
"triggers",
"=",
"$",
"this",
"->",
"getConnection",
"(",
")",
"->",
"execute",
"(",
"'SHOW TRIGGERS'",
",",
"$",
"trigger_name",
")",
")",
"{",
"foreach",
"(",
"... | Check if trigger exists.
@param string $trigger_name
@return bool | [
"Check",
"if",
"trigger",
"exists",
"."
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Builder/TriggersBuilder.php#L134-L145 |
jan-dolata/crude-crud | src/Engine/Traits/FromModelTraitPart/StoreUpdateDeleteTrait.php | StoreUpdateDeleteTrait.store | public function store($attributes)
{
$attributes = $this->formatStoreAttributes($attributes);
$model = $this->model->create($this->mapAttributesWithScope($attributes));
if ($this->canOrder()) {
if ($this->storeInLastPlace) {
$attr = $this->crudeSetup->getOrderAt... | php | public function store($attributes)
{
$attributes = $this->formatStoreAttributes($attributes);
$model = $this->model->create($this->mapAttributesWithScope($attributes));
if ($this->canOrder()) {
if ($this->storeInLastPlace) {
$attr = $this->crudeSetup->getOrderAt... | [
"public",
"function",
"store",
"(",
"$",
"attributes",
")",
"{",
"$",
"attributes",
"=",
"$",
"this",
"->",
"formatStoreAttributes",
"(",
"$",
"attributes",
")",
";",
"$",
"model",
"=",
"$",
"this",
"->",
"model",
"->",
"create",
"(",
"$",
"this",
"->"... | Store new model
@param array $attributes
@return Model | [
"Store",
"new",
"model"
] | train | https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Engine/Traits/FromModelTraitPart/StoreUpdateDeleteTrait.php#L47-L67 |
jan-dolata/crude-crud | src/Engine/Traits/FromModelTraitPart/StoreUpdateDeleteTrait.php | StoreUpdateDeleteTrait.updateById | public function updateById($id, $attributes)
{
$attributes = $this->formatUpdateAttributes($attributes);
$model = $this->model->find($id);
if (empty($model))
return $this;
$model->update($this->mapAttributesWithScope($attributes));
$apiModel = $this->getById($... | php | public function updateById($id, $attributes)
{
$attributes = $this->formatUpdateAttributes($attributes);
$model = $this->model->find($id);
if (empty($model))
return $this;
$model->update($this->mapAttributesWithScope($attributes));
$apiModel = $this->getById($... | [
"public",
"function",
"updateById",
"(",
"$",
"id",
",",
"$",
"attributes",
")",
"{",
"$",
"attributes",
"=",
"$",
"this",
"->",
"formatUpdateAttributes",
"(",
"$",
"attributes",
")",
";",
"$",
"model",
"=",
"$",
"this",
"->",
"model",
"->",
"find",
"(... | Update by id
@param integer $id
@param array $attributes
@return Model | [
"Update",
"by",
"id"
] | train | https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Engine/Traits/FromModelTraitPart/StoreUpdateDeleteTrait.php#L75-L89 |
jan-dolata/crude-crud | src/Engine/Traits/FromModelTraitPart/StoreUpdateDeleteTrait.php | StoreUpdateDeleteTrait.deleteById | public function deleteById($id)
{
$model = $this->getById($id);
if (empty($model))
return $this;
if ($this instanceof \JanDolata\CrudeCRUD\Engine\Interfaces\WithFileInterface) {
$fileAttrName = $this->fileAttrName;
$modelFiles = $model->$fileAttrName;
... | php | public function deleteById($id)
{
$model = $this->getById($id);
if (empty($model))
return $this;
if ($this instanceof \JanDolata\CrudeCRUD\Engine\Interfaces\WithFileInterface) {
$fileAttrName = $this->fileAttrName;
$modelFiles = $model->$fileAttrName;
... | [
"public",
"function",
"deleteById",
"(",
"$",
"id",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"getById",
"(",
"$",
"id",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"model",
")",
")",
"return",
"$",
"this",
";",
"if",
"(",
"$",
"this",
"insta... | Delete by id
@param integer $id
@return self | [
"Delete",
"by",
"id"
] | train | https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Engine/Traits/FromModelTraitPart/StoreUpdateDeleteTrait.php#L124-L145 |
JoffreyPoreeCoding/MongoDB-ODM | src/Hydrator.php | Hydrator.hydrate | public function hydrate(&$object, $data, $soft = false, $maxReferenceDepth = 10)
{
$strategy = $this->documentManager->getOptions()['hydratorStrategy'] ?? self::STRAT_SETTERS;
$reflectionClass = new \ReflectionClass($this->classMetadata->getName());
if ($data instanceof \MongoDB\Model\BSONAr... | php | public function hydrate(&$object, $data, $soft = false, $maxReferenceDepth = 10)
{
$strategy = $this->documentManager->getOptions()['hydratorStrategy'] ?? self::STRAT_SETTERS;
$reflectionClass = new \ReflectionClass($this->classMetadata->getName());
if ($data instanceof \MongoDB\Model\BSONAr... | [
"public",
"function",
"hydrate",
"(",
"&",
"$",
"object",
",",
"$",
"data",
",",
"$",
"soft",
"=",
"false",
",",
"$",
"maxReferenceDepth",
"=",
"10",
")",
"{",
"$",
"strategy",
"=",
"$",
"this",
"->",
"documentManager",
"->",
"getOptions",
"(",
")",
... | Hydrate an object
@param mixed $object Object to hydrate
@param array $data Data wich will hydrate object
@param integer $maxReferenceDepth Max reference depth
@return void | [
"Hydrate",
"an",
"object"
] | train | https://github.com/JoffreyPoreeCoding/MongoDB-ODM/blob/56fd7ab28c22f276573a89d56bb93c8d74ad7f74/src/Hydrator.php#L67-L208 |
JoffreyPoreeCoding/MongoDB-ODM | src/Hydrator.php | Hydrator.unhydrate | public function unhydrate($object)
{
$properties = $this->classMetadata->getPropertiesInfos();
$datas = [];
if (!is_object($object)) {
return $object;
}
foreach ($properties as $name => $infos) {
$prop = new \ReflectionProperty($this->classMetadata->... | php | public function unhydrate($object)
{
$properties = $this->classMetadata->getPropertiesInfos();
$datas = [];
if (!is_object($object)) {
return $object;
}
foreach ($properties as $name => $infos) {
$prop = new \ReflectionProperty($this->classMetadata->... | [
"public",
"function",
"unhydrate",
"(",
"$",
"object",
")",
"{",
"$",
"properties",
"=",
"$",
"this",
"->",
"classMetadata",
"->",
"getPropertiesInfos",
"(",
")",
";",
"$",
"datas",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"is_object",
"(",
"$",
"object",
... | Unhydrate an object
@param object $object Object to unhydrate
@return array Unhydrated Object | [
"Unhydrate",
"an",
"object"
] | train | https://github.com/JoffreyPoreeCoding/MongoDB-ODM/blob/56fd7ab28c22f276573a89d56bb93c8d74ad7f74/src/Hydrator.php#L216-L294 |
JoffreyPoreeCoding/MongoDB-ODM | src/Hydrator.php | Hydrator.recursiveConvertInArray | public function recursiveConvertInArray($array)
{
$newArray = [];
foreach ($array as $key => $value) {
if ($value instanceof \MongoDB\Model\BSONDocument || $value instanceof \MongoDB\Model\BSONArray) {
$value = (array) $value;
}
if (is_array($valu... | php | public function recursiveConvertInArray($array)
{
$newArray = [];
foreach ($array as $key => $value) {
if ($value instanceof \MongoDB\Model\BSONDocument || $value instanceof \MongoDB\Model\BSONArray) {
$value = (array) $value;
}
if (is_array($valu... | [
"public",
"function",
"recursiveConvertInArray",
"(",
"$",
"array",
")",
"{",
"$",
"newArray",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"array",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"instanceof",
"\\",
"MongoDB",
"... | Convert BSONDocument and BSONArray to array recursively
@param array $array Array to convert
@return array | [
"Convert",
"BSONDocument",
"and",
"BSONArray",
"to",
"array",
"recursively"
] | train | https://github.com/JoffreyPoreeCoding/MongoDB-ODM/blob/56fd7ab28c22f276573a89d56bb93c8d74ad7f74/src/Hydrator.php#L302-L318 |
JoffreyPoreeCoding/MongoDB-ODM | src/Hydrator.php | Hydrator.getHydrator | public function getHydrator($class)
{
$metadata = $this->classMetadataFactory->getMetadataForClass($class);
return new Hydrator($this->classMetadataFactory, $metadata, $this->documentManager, $this->repositoryFactory);
} | php | public function getHydrator($class)
{
$metadata = $this->classMetadataFactory->getMetadataForClass($class);
return new Hydrator($this->classMetadataFactory, $metadata, $this->documentManager, $this->repositoryFactory);
} | [
"public",
"function",
"getHydrator",
"(",
"$",
"class",
")",
"{",
"$",
"metadata",
"=",
"$",
"this",
"->",
"classMetadataFactory",
"->",
"getMetadataForClass",
"(",
"$",
"class",
")",
";",
"return",
"new",
"Hydrator",
"(",
"$",
"this",
"->",
"classMetadataFa... | Get hydrator for specified class
@param string $class Class which you will get hydrator
@return Hydrator Hydrator corresponding to specified class | [
"Get",
"hydrator",
"for",
"specified",
"class"
] | train | https://github.com/JoffreyPoreeCoding/MongoDB-ODM/blob/56fd7ab28c22f276573a89d56bb93c8d74ad7f74/src/Hydrator.php#L326-L330 |
movoin/one-swoole | src/Protocol/Message/Uri.php | Uri.withScheme | public function withScheme($scheme): UriInterface
{
$scheme = $this->filterScheme($scheme);
$clone = clone $this;
$clone->scheme = $scheme;
return $clone;
} | php | public function withScheme($scheme): UriInterface
{
$scheme = $this->filterScheme($scheme);
$clone = clone $this;
$clone->scheme = $scheme;
return $clone;
} | [
"public",
"function",
"withScheme",
"(",
"$",
"scheme",
")",
":",
"UriInterface",
"{",
"$",
"scheme",
"=",
"$",
"this",
"->",
"filterScheme",
"(",
"$",
"scheme",
")",
";",
"$",
"clone",
"=",
"clone",
"$",
"this",
";",
"$",
"clone",
"->",
"scheme",
"=... | 获得指定 Uri 协议的 Uri 对象
@param string $scheme
@return self
@throws \InvalidArgumentException | [
"获得指定",
"Uri",
"协议的",
"Uri",
"对象"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Protocol/Message/Uri.php#L121-L129 |
movoin/one-swoole | src/Protocol/Message/Uri.php | Uri.withUserInfo | public function withUserInfo($user, $password = null): UriInterface
{
if (! is_string($user)) {
throw new InvalidArgumentException('Uri user must be a string');
}
$clone = clone $this;
$clone->user = $this->filterUserInfo($user);
if ($clone->user) {
... | php | public function withUserInfo($user, $password = null): UriInterface
{
if (! is_string($user)) {
throw new InvalidArgumentException('Uri user must be a string');
}
$clone = clone $this;
$clone->user = $this->filterUserInfo($user);
if ($clone->user) {
... | [
"public",
"function",
"withUserInfo",
"(",
"$",
"user",
",",
"$",
"password",
"=",
"null",
")",
":",
"UriInterface",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"user",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Uri user must be a stri... | 获得指定用户信息的 Uri 对象
@param string $user
@param null|string $password
@return self
@throws \InvalidArgumentException | [
"获得指定用户信息的",
"Uri",
"对象"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Protocol/Message/Uri.php#L164-L180 |
movoin/one-swoole | src/Protocol/Message/Uri.php | Uri.withPort | public function withPort($port): UriInterface
{
$port = $this->filterPort($port);
$clone = clone $this;
$clone->port = $port;
return $clone;
} | php | public function withPort($port): UriInterface
{
$port = $this->filterPort($port);
$clone = clone $this;
$clone->port = $port;
return $clone;
} | [
"public",
"function",
"withPort",
"(",
"$",
"port",
")",
":",
"UriInterface",
"{",
"$",
"port",
"=",
"$",
"this",
"->",
"filterPort",
"(",
"$",
"port",
")",
";",
"$",
"clone",
"=",
"clone",
"$",
"this",
";",
"$",
"clone",
"->",
"port",
"=",
"$",
... | 获得指定端口的 Uri 对象
@param null|int $port
@return self
@throws \InvalidArgumentException | [
"获得指定端口的",
"Uri",
"对象"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Protocol/Message/Uri.php#L230-L238 |
stubbles/stubbles-webapp-core | src/main/php/response/mimetypes/TextPlain.php | TextPlain.serialize | public function serialize($resource, OutputStream $out): OutputStream
{
if (is_object($resource) && method_exists($resource, '__toString')) {
$out->write((string) $resource);
} elseif (is_object($resource) || is_array($resource)) {
$out->write(var_export($resource, true));
... | php | public function serialize($resource, OutputStream $out): OutputStream
{
if (is_object($resource) && method_exists($resource, '__toString')) {
$out->write((string) $resource);
} elseif (is_object($resource) || is_array($resource)) {
$out->write(var_export($resource, true));
... | [
"public",
"function",
"serialize",
"(",
"$",
"resource",
",",
"OutputStream",
"$",
"out",
")",
":",
"OutputStream",
"{",
"if",
"(",
"is_object",
"(",
"$",
"resource",
")",
"&&",
"method_exists",
"(",
"$",
"resource",
",",
"'__toString'",
")",
")",
"{",
"... | 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/TextPlain.php#L37-L52 |
WebDevTmas/date-repetition | src/DateRepetition/DateRepetitionCalculator.php | DateRepetitionCalculator.getNextOccurence | public function getNextOccurence(DateRepetition $dateRepetition, DateTime $datetime = null)
{
if(null === $datetime) {
$datetime = $this->timeProvider->now();
}
switch(true) {
case $dateRepetition instanceof WeeklyDateRepetition:
return $this->getNext... | php | public function getNextOccurence(DateRepetition $dateRepetition, DateTime $datetime = null)
{
if(null === $datetime) {
$datetime = $this->timeProvider->now();
}
switch(true) {
case $dateRepetition instanceof WeeklyDateRepetition:
return $this->getNext... | [
"public",
"function",
"getNextOccurence",
"(",
"DateRepetition",
"$",
"dateRepetition",
",",
"DateTime",
"$",
"datetime",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"datetime",
")",
"{",
"$",
"datetime",
"=",
"$",
"this",
"->",
"timeProvider",
"... | Find next occurence of date repetition
@param DateRepetition
@param DateTime next occurence from this date (null == now)
@return DateTime date/time of next occurence | [
"Find",
"next",
"occurence",
"of",
"date",
"repetition"
] | train | https://github.com/WebDevTmas/date-repetition/blob/3ebd59f4ab3aab4b7497ebd767a57fad08277c6d/src/DateRepetition/DateRepetitionCalculator.php#L33-L49 |
miquido/data-structure | src/Map/MapCollection.php | MapCollection.find | public function find(callable $callback): MapInterface
{
foreach ($this->data as $item) {
$result = $callback($item);
Assert::boolean($result, \sprintf('Callback should return a boolean, but %s was returned', \gettype($result)));
if ($result) {
return $it... | php | public function find(callable $callback): MapInterface
{
foreach ($this->data as $item) {
$result = $callback($item);
Assert::boolean($result, \sprintf('Callback should return a boolean, but %s was returned', \gettype($result)));
if ($result) {
return $it... | [
"public",
"function",
"find",
"(",
"callable",
"$",
"callback",
")",
":",
"MapInterface",
"{",
"foreach",
"(",
"$",
"this",
"->",
"data",
"as",
"$",
"item",
")",
"{",
"$",
"result",
"=",
"$",
"callback",
"(",
"$",
"item",
")",
";",
"Assert",
"::",
... | @param callable $callback
@throws ItemNotFoundException
@return MapInterface | [
"@param",
"callable",
"$callback"
] | train | https://github.com/miquido/data-structure/blob/54352ff1927dc5f09aad4dd0b3365c43358cb60d/src/Map/MapCollection.php#L60-L72 |
miquido/data-structure | src/Map/MapCollection.php | MapCollection.findByKeyAndValue | public function findByKeyAndValue(string $key, $value): MapInterface
{
return $this->find(function (MapInterface $item) use ($key, $value): bool {
return $item->get($key) === $value;
});
} | php | public function findByKeyAndValue(string $key, $value): MapInterface
{
return $this->find(function (MapInterface $item) use ($key, $value): bool {
return $item->get($key) === $value;
});
} | [
"public",
"function",
"findByKeyAndValue",
"(",
"string",
"$",
"key",
",",
"$",
"value",
")",
":",
"MapInterface",
"{",
"return",
"$",
"this",
"->",
"find",
"(",
"function",
"(",
"MapInterface",
"$",
"item",
")",
"use",
"(",
"$",
"key",
",",
"$",
"valu... | @param string $key
@param mixed $value
@throws ItemNotFoundException
@return MapInterface | [
"@param",
"string",
"$key",
"@param",
"mixed",
"$value"
] | train | https://github.com/miquido/data-structure/blob/54352ff1927dc5f09aad4dd0b3365c43358cb60d/src/Map/MapCollection.php#L82-L87 |
tonicospinelli/class-generation | src/ClassGeneration/MethodCollection.php | MethodCollection.add | public function add($method)
{
if (!$method instanceof MethodInterface) {
throw new \InvalidArgumentException('This Method must be a instance of \ClassGeneration\MethodInterface');
}
if ($method->getName() === null) {
$method->setName('method' . ($this->count() + 1));... | php | public function add($method)
{
if (!$method instanceof MethodInterface) {
throw new \InvalidArgumentException('This Method must be a instance of \ClassGeneration\MethodInterface');
}
if ($method->getName() === null) {
$method->setName('method' . ($this->count() + 1));... | [
"public",
"function",
"add",
"(",
"$",
"method",
")",
"{",
"if",
"(",
"!",
"$",
"method",
"instanceof",
"MethodInterface",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'This Method must be a instance of \\ClassGeneration\\MethodInterface'",
")",
"... | Adds a new Method on collection.
@param MethodInterface $method
@return bool
@throws \InvalidArgumentException | [
"Adds",
"a",
"new",
"Method",
"on",
"collection",
"."
] | train | https://github.com/tonicospinelli/class-generation/blob/eee63bdb68c066b25b885b57b23656e809381a76/src/ClassGeneration/MethodCollection.php#L32-L43 |
tonicospinelli/class-generation | src/ClassGeneration/MethodCollection.php | MethodCollection.toString | public function toString()
{
$string = '';
$methods = $this->getIterator();
foreach ($methods as $method) {
$string .= $method->toString();
}
return $string;
} | php | public function toString()
{
$string = '';
$methods = $this->getIterator();
foreach ($methods as $method) {
$string .= $method->toString();
}
return $string;
} | [
"public",
"function",
"toString",
"(",
")",
"{",
"$",
"string",
"=",
"''",
";",
"$",
"methods",
"=",
"$",
"this",
"->",
"getIterator",
"(",
")",
";",
"foreach",
"(",
"$",
"methods",
"as",
"$",
"method",
")",
"{",
"$",
"string",
".=",
"$",
"method",... | Parse the Method Collection to string.
@return string | [
"Parse",
"the",
"Method",
"Collection",
"to",
"string",
"."
] | train | https://github.com/tonicospinelli/class-generation/blob/eee63bdb68c066b25b885b57b23656e809381a76/src/ClassGeneration/MethodCollection.php#L58-L67 |
tonicospinelli/class-generation | src/ClassGeneration/MethodCollection.php | MethodCollection.removeByName | public function removeByName($methodName)
{
$removedList = new self();
$list = $this->getIterator();
foreach ($list as $index => $method) {
if ((is_array($methodName) && in_array($method->getName(), $methodName))
|| ($method->getName() === $methodName)
... | php | public function removeByName($methodName)
{
$removedList = new self();
$list = $this->getIterator();
foreach ($list as $index => $method) {
if ((is_array($methodName) && in_array($method->getName(), $methodName))
|| ($method->getName() === $methodName)
... | [
"public",
"function",
"removeByName",
"(",
"$",
"methodName",
")",
"{",
"$",
"removedList",
"=",
"new",
"self",
"(",
")",
";",
"$",
"list",
"=",
"$",
"this",
"->",
"getIterator",
"(",
")",
";",
"foreach",
"(",
"$",
"list",
"as",
"$",
"index",
"=>",
... | Removes tags by name.
@param string $methodName
@return MethodCollection Returns a collection with removed methods. | [
"Removes",
"tags",
"by",
"name",
"."
] | train | https://github.com/tonicospinelli/class-generation/blob/eee63bdb68c066b25b885b57b23656e809381a76/src/ClassGeneration/MethodCollection.php#L76-L90 |
withfatpanda/illuminate-wordpress | src/Support/Concerns/Retriable.php | Retriable.fail | function fail($callback)
{
if (is_null($this->state)) {
$this->onError[] = $callback;
} else if (!$this->state) {
$callback($this->result);
}
return $this;
} | php | function fail($callback)
{
if (is_null($this->state)) {
$this->onError[] = $callback;
} else if (!$this->state) {
$callback($this->result);
}
return $this;
} | [
"function",
"fail",
"(",
"$",
"callback",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"state",
")",
")",
"{",
"$",
"this",
"->",
"onError",
"[",
"]",
"=",
"$",
"callback",
";",
"}",
"else",
"if",
"(",
"!",
"$",
"this",
"->",
"state"... | If the wrapped operation ultimately fails on all attempts,
invoke the given function. Many functions can be
added to the stack. If the attempted execution
of the wrapped operation has already failed, the the function
given here will be invoked instantly.
@param function
@return self | [
"If",
"the",
"wrapped",
"operation",
"ultimately",
"fails",
"on",
"all",
"attempts",
"invoke",
"the",
"given",
"function",
".",
"Many",
"functions",
"can",
"be",
"added",
"to",
"the",
"stack",
".",
"If",
"the",
"attempted",
"execution",
"of",
"the",
"wrapped... | train | https://github.com/withfatpanda/illuminate-wordpress/blob/b426ca81a55367459430c974932ee5a941d759d8/src/Support/Concerns/Retriable.php#L143-L151 |
withfatpanda/illuminate-wordpress | src/Support/Concerns/Retriable.php | Retriable.then | function then($callback)
{
if (is_null($this->state)) {
$this->onSuccess[] = $callback;
} else if ($this->state) {
$callback($this->result);
}
return $this;
} | php | function then($callback)
{
if (is_null($this->state)) {
$this->onSuccess[] = $callback;
} else if ($this->state) {
$callback($this->result);
}
return $this;
} | [
"function",
"then",
"(",
"$",
"callback",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"state",
")",
")",
"{",
"$",
"this",
"->",
"onSuccess",
"[",
"]",
"=",
"$",
"callback",
";",
"}",
"else",
"if",
"(",
"$",
"this",
"->",
"state",
"... | If the wrapped operation ultimately succeeds,
invoke the given function. Many functions can be
added to the stack. If the attempted execution
of the wrapped operation has already succeeded,
the the function given here will be invoked instantly.
If the given function throws an Exception, the
wrapped operation will be re... | [
"If",
"the",
"wrapped",
"operation",
"ultimately",
"succeeds",
"invoke",
"the",
"given",
"function",
".",
"Many",
"functions",
"can",
"be",
"added",
"to",
"the",
"stack",
".",
"If",
"the",
"attempted",
"execution",
"of",
"the",
"wrapped",
"operation",
"has",
... | train | https://github.com/withfatpanda/illuminate-wordpress/blob/b426ca81a55367459430c974932ee5a941d759d8/src/Support/Concerns/Retriable.php#L167-L175 |
withfatpanda/illuminate-wordpress | src/Support/Concerns/Retriable.php | Retriable.until | function until($limit)
{
$until = function() use ($limit) {
if (is_int($limit)) {
if ($this->attempts < $limit) {
return true;
} else {
return false;
}
} else {
if ($limit($this->lastException, $this->attempts)) {
return true;
} e... | php | function until($limit)
{
$until = function() use ($limit) {
if (is_int($limit)) {
if ($this->attempts < $limit) {
return true;
} else {
return false;
}
} else {
if ($limit($this->lastException, $this->attempts)) {
return true;
} e... | [
"function",
"until",
"(",
"$",
"limit",
")",
"{",
"$",
"until",
"=",
"function",
"(",
")",
"use",
"(",
"$",
"limit",
")",
"{",
"if",
"(",
"is_int",
"(",
"$",
"limit",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"attempts",
"<",
"$",
"limit",
... | Start the loop with the given limit
@param mixed Can be an integer or a function of
the signature function(\Exception $e, $attempt),
where $e is the last Exception thrown and $attempt
is the count of attempts made to execute the wrapped
operation
@return The return result of the wrapped operation,
if and when it comple... | [
"Start",
"the",
"loop",
"with",
"the",
"given",
"limit"
] | train | https://github.com/withfatpanda/illuminate-wordpress/blob/b426ca81a55367459430c974932ee5a941d759d8/src/Support/Concerns/Retriable.php#L237-L302 |
huasituo/hstcms | src/Libraries/Fields/Files.php | Files.option | public function option($option)
{
$option['fieldtype'] = isset($option['fieldtype']) ? $option['fieldtype'] : '';
$option['fieldlength'] = isset($option['fieldlength']) ? $option['fieldlength'] : '';
$option['uptips'] = isset($option['uptips']) ? $option['uptips'] : '';
$option['fvalue'] = isset($option['fval... | php | public function option($option)
{
$option['fieldtype'] = isset($option['fieldtype']) ? $option['fieldtype'] : '';
$option['fieldlength'] = isset($option['fieldlength']) ? $option['fieldlength'] : '';
$option['uptips'] = isset($option['uptips']) ? $option['uptips'] : '';
$option['fvalue'] = isset($option['fval... | [
"public",
"function",
"option",
"(",
"$",
"option",
")",
"{",
"$",
"option",
"[",
"'fieldtype'",
"]",
"=",
"isset",
"(",
"$",
"option",
"[",
"'fieldtype'",
"]",
")",
"?",
"$",
"option",
"[",
"'fieldtype'",
"]",
":",
"''",
";",
"$",
"option",
"[",
"... | 字段相关属性参数
@param array $value 值
@return string | [
"字段相关属性参数"
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Libraries/Fields/Files.php#L33-L98 |
huasituo/hstcms | src/Libraries/Fields/Files.php | Files.input | public function input($cname, $name, $cfg, $value = NULL, $id = 0)
{
$upauto = isset($cfg['option']['upauto']) ? $cfg['option']['upauto'] ? 'true' : 'false' : 'true';
$upbuttontext = isset($cfg['option']['upbuttontext']) ? $cfg['option']['upbuttontext'] : hst_lang('hstcms::fields.file.select.pic');
$uptips = i... | php | public function input($cname, $name, $cfg, $value = NULL, $id = 0)
{
$upauto = isset($cfg['option']['upauto']) ? $cfg['option']['upauto'] ? 'true' : 'false' : 'true';
$upbuttontext = isset($cfg['option']['upbuttontext']) ? $cfg['option']['upbuttontext'] : hst_lang('hstcms::fields.file.select.pic');
$uptips = i... | [
"public",
"function",
"input",
"(",
"$",
"cname",
",",
"$",
"name",
",",
"$",
"cfg",
",",
"$",
"value",
"=",
"NULL",
",",
"$",
"id",
"=",
"0",
")",
"{",
"$",
"upauto",
"=",
"isset",
"(",
"$",
"cfg",
"[",
"'option'",
"]",
"[",
"'upauto'",
"]",
... | 字段表单输入
@param string $cname 字段别名
@param string $name 字段名称
@param array $cfg 字段配置
@param array $data 值
@return string | [
"字段表单输入"
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Libraries/Fields/Files.php#L109-L152 |
huasituo/hstcms | src/Libraries/Fields/Files.php | Files.insert_value | public function insert_value(Request $request, $field, $postData = [])
{
$value = $request->get($field['fieldname']);
if($value) {
$aids = [];
foreach ($value['aid'] as $k => $v) {
$aids[] = $v;
}
$value = implode(',', $aids);
}
$postData[$field['relatedtable']][$field['fieldname']] = (string)$... | php | public function insert_value(Request $request, $field, $postData = [])
{
$value = $request->get($field['fieldname']);
if($value) {
$aids = [];
foreach ($value['aid'] as $k => $v) {
$aids[] = $v;
}
$value = implode(',', $aids);
}
$postData[$field['relatedtable']][$field['fieldname']] = (string)$... | [
"public",
"function",
"insert_value",
"(",
"Request",
"$",
"request",
",",
"$",
"field",
",",
"$",
"postData",
"=",
"[",
"]",
")",
"{",
"$",
"value",
"=",
"$",
"request",
"->",
"get",
"(",
"$",
"field",
"[",
"'fieldname'",
"]",
")",
";",
"if",
"(",... | 处理输入数据,提供给入库 | [
"处理输入数据,提供给入库"
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Libraries/Fields/Files.php#L158-L170 |
huasituo/hstcms | src/Libraries/Fields/Files.php | Files.output_data | public function output_data($data, $field = [])
{
if(!isset($data[$field['fieldname']])) {
return $data;
}
$value = $data[$field['fieldname']];
$data['_'.$field['fieldname']] = $value;
$data[$field['fieldname']] = AttachmentModel::getAttachs(explode(',', $value));
return $data;
} | php | public function output_data($data, $field = [])
{
if(!isset($data[$field['fieldname']])) {
return $data;
}
$value = $data[$field['fieldname']];
$data['_'.$field['fieldname']] = $value;
$data[$field['fieldname']] = AttachmentModel::getAttachs(explode(',', $value));
return $data;
} | [
"public",
"function",
"output_data",
"(",
"$",
"data",
",",
"$",
"field",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"data",
"[",
"$",
"field",
"[",
"'fieldname'",
"]",
"]",
")",
")",
"{",
"return",
"$",
"data",
";",
"}",
"$",
... | 字段输出 | [
"字段输出"
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Libraries/Fields/Files.php#L175-L184 |
activecollab/databasestructure | src/Field/Composite/CreatedAtField.php | CreatedAtField.onAddedToType | public function onAddedToType(TypeInterface &$type)
{
parent::onAddedToType($type);
if ($this->getAddIndex()) {
$type->addIndex(new Index($this->name));
}
$type->addTrait(CreatedAtInterface::class, CreatedAtInterfaceImplementation::class)->serialize($this->name);
} | php | public function onAddedToType(TypeInterface &$type)
{
parent::onAddedToType($type);
if ($this->getAddIndex()) {
$type->addIndex(new Index($this->name));
}
$type->addTrait(CreatedAtInterface::class, CreatedAtInterfaceImplementation::class)->serialize($this->name);
} | [
"public",
"function",
"onAddedToType",
"(",
"TypeInterface",
"&",
"$",
"type",
")",
"{",
"parent",
"::",
"onAddedToType",
"(",
"$",
"type",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getAddIndex",
"(",
")",
")",
"{",
"$",
"type",
"->",
"addIndex",
"(",
... | Method that is called when field is added to a type.
@param TypeInterface $type | [
"Method",
"that",
"is",
"called",
"when",
"field",
"is",
"added",
"to",
"a",
"type",
"."
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Field/Composite/CreatedAtField.php#L67-L76 |
gbprod/elastica-provider-bundle | src/ElasticaProviderBundle/Provider/BulkProvider.php | BulkProvider.run | public function run(Client $client, $index, $type, EventDispatcherInterface $dispatcher)
{
$this->initialize($client, $index, $type, $dispatcher);
$this->populate();
$this->commit();
} | php | public function run(Client $client, $index, $type, EventDispatcherInterface $dispatcher)
{
$this->initialize($client, $index, $type, $dispatcher);
$this->populate();
$this->commit();
} | [
"public",
"function",
"run",
"(",
"Client",
"$",
"client",
",",
"$",
"index",
",",
"$",
"type",
",",
"EventDispatcherInterface",
"$",
"dispatcher",
")",
"{",
"$",
"this",
"->",
"initialize",
"(",
"$",
"client",
",",
"$",
"index",
",",
"$",
"type",
",",... | {@inheritdoc} | [
"{"
] | train | https://github.com/gbprod/elastica-provider-bundle/blob/ee1e2ca78651d570b7400049bf81d8405fc744fc/src/ElasticaProviderBundle/Provider/BulkProvider.php#L56-L61 |
EcomDev/phpspec-magento-di-adapter | src/ParameterValidator.php | ParameterValidator.addGenerator | public function addGenerator($generatorClass, $suffix, \Closure $factory = null)
{
$this->generators[] = new GeneratorWrapper($this->createGeneratorFactory($generatorClass, $factory), $suffix);
return $this;
} | php | public function addGenerator($generatorClass, $suffix, \Closure $factory = null)
{
$this->generators[] = new GeneratorWrapper($this->createGeneratorFactory($generatorClass, $factory), $suffix);
return $this;
} | [
"public",
"function",
"addGenerator",
"(",
"$",
"generatorClass",
",",
"$",
"suffix",
",",
"\\",
"Closure",
"$",
"factory",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"generators",
"[",
"]",
"=",
"new",
"GeneratorWrapper",
"(",
"$",
"this",
"->",
"createG... | *
Adds a new generator
@param string $generatorClass
@param string $suffix
@param \Closure|null $factory
@return $this | [
"*",
"Adds",
"a",
"new",
"generator"
] | train | https://github.com/EcomDev/phpspec-magento-di-adapter/blob/b39f6f0afbb837dbf0eb4c71e6cdb318b8c9de37/src/ParameterValidator.php#L65-L69 |
EcomDev/phpspec-magento-di-adapter | src/ParameterValidator.php | ParameterValidator.generator | public function generator($className)
{
foreach ($this->generators as $generator) {
if ($generator->supports($className)) {
return $generator->createGenerator($className);
}
}
return false;
} | php | public function generator($className)
{
foreach ($this->generators as $generator) {
if ($generator->supports($className)) {
return $generator->createGenerator($className);
}
}
return false;
} | [
"public",
"function",
"generator",
"(",
"$",
"className",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"generators",
"as",
"$",
"generator",
")",
"{",
"if",
"(",
"$",
"generator",
"->",
"supports",
"(",
"$",
"className",
")",
")",
"{",
"return",
"$",
... | Generates a generator from class name rules
@param string $className
@return bool|\Magento\Framework\Code\Generator\EntityAbstract | [
"Generates",
"a",
"generator",
"from",
"class",
"name",
"rules"
] | train | https://github.com/EcomDev/phpspec-magento-di-adapter/blob/b39f6f0afbb837dbf0eb4c71e6cdb318b8c9de37/src/ParameterValidator.php#L78-L87 |
EcomDev/phpspec-magento-di-adapter | src/ParameterValidator.php | ParameterValidator.createGeneratorFactory | private function createGeneratorFactory($generatorClass, \Closure $factory = null)
{
return function ($sourceClass, $prefixClass) use ($factory, $generatorClass) {
if ($factory) {
return $factory($sourceClass, $prefixClass, $this->generationIo, $this->definedClasses, $generatorCl... | php | private function createGeneratorFactory($generatorClass, \Closure $factory = null)
{
return function ($sourceClass, $prefixClass) use ($factory, $generatorClass) {
if ($factory) {
return $factory($sourceClass, $prefixClass, $this->generationIo, $this->definedClasses, $generatorCl... | [
"private",
"function",
"createGeneratorFactory",
"(",
"$",
"generatorClass",
",",
"\\",
"Closure",
"$",
"factory",
"=",
"null",
")",
"{",
"return",
"function",
"(",
"$",
"sourceClass",
",",
"$",
"prefixClass",
")",
"use",
"(",
"$",
"factory",
",",
"$",
"ge... | Returns generator factory
@param string $generatorClass
@param \Closure|null $factory
@return \Closure | [
"Returns",
"generator",
"factory"
] | train | https://github.com/EcomDev/phpspec-magento-di-adapter/blob/b39f6f0afbb837dbf0eb4c71e6cdb318b8c9de37/src/ParameterValidator.php#L97-L106 |
EcomDev/phpspec-magento-di-adapter | src/ParameterValidator.php | ParameterValidator.validate | public function validate(\ReflectionFunctionAbstract $reflectionFunction)
{
foreach ($reflectionFunction->getParameters() as $parameter) {
$this->validateParameter($parameter);
}
return $this;
} | php | public function validate(\ReflectionFunctionAbstract $reflectionFunction)
{
foreach ($reflectionFunction->getParameters() as $parameter) {
$this->validateParameter($parameter);
}
return $this;
} | [
"public",
"function",
"validate",
"(",
"\\",
"ReflectionFunctionAbstract",
"$",
"reflectionFunction",
")",
"{",
"foreach",
"(",
"$",
"reflectionFunction",
"->",
"getParameters",
"(",
")",
"as",
"$",
"parameter",
")",
"{",
"$",
"this",
"->",
"validateParameter",
... | Validates method signature and tries to generate missing classes
@param \ReflectionFunctionAbstract $reflectionFunction
@return $this | [
"Validates",
"method",
"signature",
"and",
"tries",
"to",
"generate",
"missing",
"classes"
] | train | https://github.com/EcomDev/phpspec-magento-di-adapter/blob/b39f6f0afbb837dbf0eb4c71e6cdb318b8c9de37/src/ParameterValidator.php#L115-L122 |
EcomDev/phpspec-magento-di-adapter | src/ParameterValidator.php | ParameterValidator.validateParameter | private function validateParameter(\ReflectionParameter $parameter)
{
$catcher = function ($className) {
$generator = $this->generator($className);
if ($generator) {
include $generator->generate();
}
};
if (($reflectionClass = $par... | php | private function validateParameter(\ReflectionParameter $parameter)
{
$catcher = function ($className) {
$generator = $this->generator($className);
if ($generator) {
include $generator->generate();
}
};
if (($reflectionClass = $par... | [
"private",
"function",
"validateParameter",
"(",
"\\",
"ReflectionParameter",
"$",
"parameter",
")",
"{",
"$",
"catcher",
"=",
"function",
"(",
"$",
"className",
")",
"{",
"$",
"generator",
"=",
"$",
"this",
"->",
"generator",
"(",
"$",
"className",
")",
"... | Reflection parameter
@param \ReflectionParameter $parameter
@return $this | [
"Reflection",
"parameter"
] | train | https://github.com/EcomDev/phpspec-magento-di-adapter/blob/b39f6f0afbb837dbf0eb4c71e6cdb318b8c9de37/src/ParameterValidator.php#L131-L162 |
phramework/jsonapi | src/Controller/GETById.php | GETById.handleGETById | protected static function handleGETById(
$parameters,
$id,
$modelClass,
$primaryDataParameters = [],
$relationshipParameters = []
) {
$filterValidationModel = $modelClass::getFilterValidationModel();
$idAttribute = $modelClass::getIdAttribute();
//Fi... | php | protected static function handleGETById(
$parameters,
$id,
$modelClass,
$primaryDataParameters = [],
$relationshipParameters = []
) {
$filterValidationModel = $modelClass::getFilterValidationModel();
$idAttribute = $modelClass::getIdAttribute();
//Fi... | [
"protected",
"static",
"function",
"handleGETById",
"(",
"$",
"parameters",
",",
"$",
"id",
",",
"$",
"modelClass",
",",
"$",
"primaryDataParameters",
"=",
"[",
"]",
",",
"$",
"relationshipParameters",
"=",
"[",
"]",
")",
"{",
"$",
"filterValidationModel",
"... | handles GETById requests
@param object $parameters Request parameters
@param integer|string $id Requested resource's id
@param string $modelClass Resource's primary model
to be used
@param array $primaryDataParameters [Optional] Array with... | [
"handles",
"GETById",
"requests"
] | train | https://github.com/phramework/jsonapi/blob/af20882a8b6f6e5be9c8e09e5b87f6c23a4b0726/src/Controller/GETById.php#L46-L90 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Map/RolePermissionTableMap.php | RolePermissionTableMap.addInstanceToPool | public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if (null === $key) {
$key = serialize(array((string) $obj->getRoleId(), (string) $obj->getPermissionId()));
} // if key === null
self::$instances[$key] ... | php | public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if (null === $key) {
$key = serialize(array((string) $obj->getRoleId(), (string) $obj->getPermissionId()));
} // if key === null
self::$instances[$key] ... | [
"public",
"static",
"function",
"addInstanceToPool",
"(",
"$",
"obj",
",",
"$",
"key",
"=",
"null",
")",
"{",
"if",
"(",
"Propel",
"::",
"isInstancePoolingEnabled",
"(",
")",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"key",
")",
"{",
"$",
"key",
"=",
... | Adds an object to the instance pool.
Propel keeps cached copies of objects in an instance pool when they are retrieved
from the database. In some cases you may need to explicitly add objects
to the cache in order to ensure that the same objects are always returned by find*()
and findPk*() calls.
@param \Alchemy\Compo... | [
"Adds",
"an",
"object",
"to",
"the",
"instance",
"pool",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Map/RolePermissionTableMap.php#L160-L168 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Map/RolePermissionTableMap.php | RolePermissionTableMap.removeInstanceFromPool | public static function removeInstanceFromPool($value)
{
if (Propel::isInstancePoolingEnabled() && null !== $value) {
if (is_object($value) && $value instanceof \Alchemy\Component\Cerberus\Model\RolePermission) {
$key = serialize(array((string) $value->getRoleId(), (string) $value... | php | public static function removeInstanceFromPool($value)
{
if (Propel::isInstancePoolingEnabled() && null !== $value) {
if (is_object($value) && $value instanceof \Alchemy\Component\Cerberus\Model\RolePermission) {
$key = serialize(array((string) $value->getRoleId(), (string) $value... | [
"public",
"static",
"function",
"removeInstanceFromPool",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"Propel",
"::",
"isInstancePoolingEnabled",
"(",
")",
"&&",
"null",
"!==",
"$",
"value",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"value",
")",
"&&",
"$"... | Removes an object from the instance pool.
Propel keeps cached copies of objects in an instance pool when they are retrieved
from the database. In some cases -- especially when you override doDelete
methods in your stub classes -- you may need to explicitly remove objects
from the cache in order to prevent returning o... | [
"Removes",
"an",
"object",
"from",
"the",
"instance",
"pool",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Map/RolePermissionTableMap.php#L180-L200 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Map/RolePermissionTableMap.php | RolePermissionTableMap.addSelectColumns | public static function addSelectColumns(Criteria $criteria, $alias = null)
{
if (null === $alias) {
$criteria->addSelectColumn(RolePermissionTableMap::COL_ROLE_ID);
$criteria->addSelectColumn(RolePermissionTableMap::COL_PERMISSION_ID);
} else {
$criteria->addSelec... | php | public static function addSelectColumns(Criteria $criteria, $alias = null)
{
if (null === $alias) {
$criteria->addSelectColumn(RolePermissionTableMap::COL_ROLE_ID);
$criteria->addSelectColumn(RolePermissionTableMap::COL_PERMISSION_ID);
} else {
$criteria->addSelec... | [
"public",
"static",
"function",
"addSelectColumns",
"(",
"Criteria",
"$",
"criteria",
",",
"$",
"alias",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"alias",
")",
"{",
"$",
"criteria",
"->",
"addSelectColumn",
"(",
"RolePermissionTableMap",
"::",
... | Add all the columns needed to create a new object.
Note: any columns that were marked with lazyLoad="true" in the
XML schema will not be added to the select list and only loaded
on demand.
@param Criteria $criteria object containing the columns to add.
@param string $alias optional table alias
@throws PropelExce... | [
"Add",
"all",
"the",
"columns",
"needed",
"to",
"create",
"a",
"new",
"object",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Map/RolePermissionTableMap.php#L349-L358 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Map/RolePermissionTableMap.php | RolePermissionTableMap.buildTableMap | public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(RolePermissionTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(RolePermissionTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new RolePermissionTableMap());
}
} | php | public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(RolePermissionTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(RolePermissionTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new RolePermissionTableMap());
}
} | [
"public",
"static",
"function",
"buildTableMap",
"(",
")",
"{",
"$",
"dbMap",
"=",
"Propel",
"::",
"getServiceContainer",
"(",
")",
"->",
"getDatabaseMap",
"(",
"RolePermissionTableMap",
"::",
"DATABASE_NAME",
")",
";",
"if",
"(",
"!",
"$",
"dbMap",
"->",
"h... | Add a TableMap instance to the database for this tableMap class. | [
"Add",
"a",
"TableMap",
"instance",
"to",
"the",
"database",
"for",
"this",
"tableMap",
"class",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Map/RolePermissionTableMap.php#L375-L381 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Map/RolePermissionTableMap.php | RolePermissionTableMap.doInsert | public static function doInsert($criteria, ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(RolePermissionTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // ... | php | public static function doInsert($criteria, ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(RolePermissionTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // ... | [
"public",
"static",
"function",
"doInsert",
"(",
"$",
"criteria",
",",
"ConnectionInterface",
"$",
"con",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"con",
")",
"{",
"$",
"con",
"=",
"Propel",
"::",
"getServiceContainer",
"(",
")",
"->",
"ge... | Performs an INSERT on the database, given a RolePermission or Criteria object.
@param mixed $criteria Criteria or RolePermission object containing data that is used to create the INSERT statement.
@param ConnectionInterface $con the ConnectionInterface connection to use
@return mixed The new pr... | [
"Performs",
"an",
"INSERT",
"on",
"the",
"database",
"given",
"a",
"RolePermission",
"or",
"Criteria",
"object",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Map/RolePermissionTableMap.php#L454-L475 |
gregorybesson/PlaygroundCore | src/Filter/Slugify.php | Slugify.filter | public function filter($value)
{
setlocale(LC_CTYPE, 'en_US.UTF-8');
//@HotFix : en attendant Bacon/BaconStringUtils
$unwanted_array = array('Š'=>'S', 'š'=>'s', 'Ž'=>'Z', 'ž'=>'z', 'À'=>'A', 'Á'=>'A', 'Â'=>'A', 'Ã'=>'A', 'Ä'=>'A', 'Å'=>'A', 'Æ'=>'A', 'Ç'=>'C', 'È'=>'E', 'É'=>'E',
... | php | public function filter($value)
{
setlocale(LC_CTYPE, 'en_US.UTF-8');
//@HotFix : en attendant Bacon/BaconStringUtils
$unwanted_array = array('Š'=>'S', 'š'=>'s', 'Ž'=>'Z', 'ž'=>'z', 'À'=>'A', 'Á'=>'A', 'Â'=>'A', 'Ã'=>'A', 'Ä'=>'A', 'Å'=>'A', 'Æ'=>'A', 'Ç'=>'C', 'È'=>'E', 'É'=>'E',
... | [
"public",
"function",
"filter",
"(",
"$",
"value",
")",
"{",
"setlocale",
"(",
"LC_CTYPE",
",",
"'en_US.UTF-8'",
")",
";",
"//@HotFix : en attendant Bacon/BaconStringUtils",
"$",
"unwanted_array",
"=",
"array",
"(",
"'Š'=",
">'",
"S',",
" ",
"š'=>",
"'s",
"', ",... | Defined by Zend\Filter\FilterInterface
Returns the string $value, converting characters to lowercase as necessary
@param string $value
@return string | [
"Defined",
"by",
"Zend",
"\\",
"Filter",
"\\",
"FilterInterface"
] | train | https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Filter/Slugify.php#L43-L70 |
huasituo/hstcms | src/Http/Controllers/Manage/AuthController.php | AuthController.login | public function login()
{
if (Session::get('manager')) {
return redirect()->route('manageIndex');
}
$this->addMessage(hst_lang('hstcms::manage.login.title'), 'seo_title');
return $this->loadTemplate('login');
} | php | public function login()
{
if (Session::get('manager')) {
return redirect()->route('manageIndex');
}
$this->addMessage(hst_lang('hstcms::manage.login.title'), 'seo_title');
return $this->loadTemplate('login');
} | [
"public",
"function",
"login",
"(",
")",
"{",
"if",
"(",
"Session",
"::",
"get",
"(",
"'manager'",
")",
")",
"{",
"return",
"redirect",
"(",
")",
"->",
"route",
"(",
"'manageIndex'",
")",
";",
"}",
"$",
"this",
"->",
"addMessage",
"(",
"hst_lang",
"(... | 后台登录页面 | [
"后台登录页面"
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Http/Controllers/Manage/AuthController.php#L29-L36 |
jan-dolata/crude-crud | src/Http/Requests/FileRequest.php | FileRequest.authorize | public function authorize()
{
$crude = CrudeInstance::get($this->input('crudeName'));
if ($crude == null)
return false;
if (! $crude instanceof \JanDolata\CrudeCRUD\Engine\Interfaces\ListInterface)
return false;
if (! $crude instanceof \JanDolata\CrudeCRUD\... | php | public function authorize()
{
$crude = CrudeInstance::get($this->input('crudeName'));
if ($crude == null)
return false;
if (! $crude instanceof \JanDolata\CrudeCRUD\Engine\Interfaces\ListInterface)
return false;
if (! $crude instanceof \JanDolata\CrudeCRUD\... | [
"public",
"function",
"authorize",
"(",
")",
"{",
"$",
"crude",
"=",
"CrudeInstance",
"::",
"get",
"(",
"$",
"this",
"->",
"input",
"(",
"'crudeName'",
")",
")",
";",
"if",
"(",
"$",
"crude",
"==",
"null",
")",
"return",
"false",
";",
"if",
"(",
"!... | Determine if the user is authorized to make this request.
@return bool | [
"Determine",
"if",
"the",
"user",
"is",
"authorized",
"to",
"make",
"this",
"request",
"."
] | train | https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Http/Requests/FileRequest.php#L16-L30 |
VDMi/Guzzle-oAuth | src/GuzzleOauth/Plugin/Oauth2/Oauth2Plugin.php | Oauth2Plugin.onRequestBeforeSend | public function onRequestBeforeSend(Event $event)
{
if (!strlen($this->config['access_token'])) {
return;
}
switch ($this->config['authorize_location']) {
case 'query':
$event['request']->getQuery()->set(
$this->config['query_param_key'],
... | php | public function onRequestBeforeSend(Event $event)
{
if (!strlen($this->config['access_token'])) {
return;
}
switch ($this->config['authorize_location']) {
case 'query':
$event['request']->getQuery()->set(
$this->config['query_param_key'],
... | [
"public",
"function",
"onRequestBeforeSend",
"(",
"Event",
"$",
"event",
")",
"{",
"if",
"(",
"!",
"strlen",
"(",
"$",
"this",
"->",
"config",
"[",
"'access_token'",
"]",
")",
")",
"{",
"return",
";",
"}",
"switch",
"(",
"$",
"this",
"->",
"config",
... | Request before-send event handler
@param Event $event Event received
@return array | [
"Request",
"before",
"-",
"send",
"event",
"handler"
] | train | https://github.com/VDMi/Guzzle-oAuth/blob/e2b2561e4e402e13ba605082bf768b29942f90cb/src/GuzzleOauth/Plugin/Oauth2/Oauth2Plugin.php#L47-L73 |
larakit/lk-staticfiles | src/StaticFiles/Manager.php | Manager.package | static function package($package) {
if(!isset(self::$packages[$package])) {
self::$packages[$package] = new Package($package);
}
return self::$packages[$package];
} | php | static function package($package) {
if(!isset(self::$packages[$package])) {
self::$packages[$package] = new Package($package);
}
return self::$packages[$package];
} | [
"static",
"function",
"package",
"(",
"$",
"package",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"packages",
"[",
"$",
"package",
"]",
")",
")",
"{",
"self",
"::",
"$",
"packages",
"[",
"$",
"package",
"]",
"=",
"new",
"Package",
... | @param $package
@return Package | [
"@param",
"$package"
] | train | https://github.com/larakit/lk-staticfiles/blob/1ee718b1f3a00c29c46b06c2f501413599b0335a/src/StaticFiles/Manager.php#L19-L25 |
braincrafted/arrayquery | src/Braincrafted/ArrayQuery/Evaluation.php | Evaluation.evaluateFilter | protected function evaluateFilter($value, $filter)
{
$filter = explode(' ', $filter, 2);
if (1 === count($filter)) {
$args = [];
$filter = $filter[0];
} else {
$args = array_map('trim', explode(',', $filter[1]));
$filter = $filter[0];
... | php | protected function evaluateFilter($value, $filter)
{
$filter = explode(' ', $filter, 2);
if (1 === count($filter)) {
$args = [];
$filter = $filter[0];
} else {
$args = array_map('trim', explode(',', $filter[1]));
$filter = $filter[0];
... | [
"protected",
"function",
"evaluateFilter",
"(",
"$",
"value",
",",
"$",
"filter",
")",
"{",
"$",
"filter",
"=",
"explode",
"(",
"' '",
",",
"$",
"filter",
",",
"2",
")",
";",
"if",
"(",
"1",
"===",
"count",
"(",
"$",
"filter",
")",
")",
"{",
"$",... | Evaluates the given value with the given filter.
@param mixed $value
@param string|array $filter
@return mixed
@throws Braincrafted\ArrayQuery\Exception\UnkownFilterException if a filter does not exist. | [
"Evaluates",
"the",
"given",
"value",
"with",
"the",
"given",
"filter",
"."
] | train | https://github.com/braincrafted/arrayquery/blob/8b0c44ee76cea796589422f52e2f7130676b9bd1/src/Braincrafted/ArrayQuery/Evaluation.php#L36-L52 |
heyday/heystack | src/Processor/HandlerTrait.php | HandlerTrait.getProcessor | public function getProcessor($name)
{
return isset($this->processors[$name]) ? $this->processors[$name] : false;
} | php | public function getProcessor($name)
{
return isset($this->processors[$name]) ? $this->processors[$name] : false;
} | [
"public",
"function",
"getProcessor",
"(",
"$",
"name",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"processors",
"[",
"$",
"name",
"]",
")",
"?",
"$",
"this",
"->",
"processors",
"[",
"$",
"name",
"]",
":",
"false",
";",
"}"
] | Return a processor by an identifier if it exists
@param string $name The processor identifier
@return mixed The processor if it exists | [
"Return",
"a",
"processor",
"by",
"an",
"identifier",
"if",
"it",
"exists"
] | train | https://github.com/heyday/heystack/blob/2c051933f8c532d0a9a23be6ee1ff5c619e47dfe/src/Processor/HandlerTrait.php#L27-L30 |
crossjoin/Css | src/Crossjoin/Css/Format/Rule/AtDocument/DocumentRule.php | DocumentRule.setUrl | public function setUrl($url)
{
if (is_string($url)) {
$this->url = $url;
} else {
throw new \InvalidArgumentException(
"Invalid type '" . gettype($url) . "' for argument 'url' given. String expected."
);
}
} | php | public function setUrl($url)
{
if (is_string($url)) {
$this->url = $url;
} else {
throw new \InvalidArgumentException(
"Invalid type '" . gettype($url) . "' for argument 'url' given. String expected."
);
}
} | [
"public",
"function",
"setUrl",
"(",
"$",
"url",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"url",
")",
")",
"{",
"$",
"this",
"->",
"url",
"=",
"$",
"url",
";",
"}",
"else",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\"Invalid typ... | Sets the document URL filter.
@param string $url | [
"Sets",
"the",
"document",
"URL",
"filter",
"."
] | train | https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtDocument/DocumentRule.php#L52-L61 |
crossjoin/Css | src/Crossjoin/Css/Format/Rule/AtDocument/DocumentRule.php | DocumentRule.setUrlPrefix | public function setUrlPrefix($urlPrefix)
{
if (is_string($urlPrefix)) {
$this->urlPrefix = $urlPrefix;
} else {
throw new \InvalidArgumentException(
"Invalid type '" . gettype($urlPrefix) . "' for argument 'urlPrefix' given. String expected."
);
... | php | public function setUrlPrefix($urlPrefix)
{
if (is_string($urlPrefix)) {
$this->urlPrefix = $urlPrefix;
} else {
throw new \InvalidArgumentException(
"Invalid type '" . gettype($urlPrefix) . "' for argument 'urlPrefix' given. String expected."
);
... | [
"public",
"function",
"setUrlPrefix",
"(",
"$",
"urlPrefix",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"urlPrefix",
")",
")",
"{",
"$",
"this",
"->",
"urlPrefix",
"=",
"$",
"urlPrefix",
";",
"}",
"else",
"{",
"throw",
"new",
"\\",
"InvalidArgumentExcep... | Sets the document URL prefix filter.
@param string $urlPrefix | [
"Sets",
"the",
"document",
"URL",
"prefix",
"filter",
"."
] | train | https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtDocument/DocumentRule.php#L78-L87 |
crossjoin/Css | src/Crossjoin/Css/Format/Rule/AtDocument/DocumentRule.php | DocumentRule.setDomain | public function setDomain($domain)
{
if (is_string($domain)) {
$this->domain = $domain;
} else {
throw new \InvalidArgumentException(
"Invalid type '" . gettype($domain) . "' for argument 'domain' given. String expected."
);
}
} | php | public function setDomain($domain)
{
if (is_string($domain)) {
$this->domain = $domain;
} else {
throw new \InvalidArgumentException(
"Invalid type '" . gettype($domain) . "' for argument 'domain' given. String expected."
);
}
} | [
"public",
"function",
"setDomain",
"(",
"$",
"domain",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"domain",
")",
")",
"{",
"$",
"this",
"->",
"domain",
"=",
"$",
"domain",
";",
"}",
"else",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
... | Sets the document domain filter.
@param string $domain | [
"Sets",
"the",
"document",
"domain",
"filter",
"."
] | train | https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtDocument/DocumentRule.php#L104-L113 |
crossjoin/Css | src/Crossjoin/Css/Format/Rule/AtDocument/DocumentRule.php | DocumentRule.setRegexp | public function setRegexp($regexp)
{
if (is_string($regexp)) {
$this->regexp = $regexp;
} else {
throw new \InvalidArgumentException(
"Invalid type '" . gettype($regexp) . "' for argument 'regexp' given. String expected."
);
}
} | php | public function setRegexp($regexp)
{
if (is_string($regexp)) {
$this->regexp = $regexp;
} else {
throw new \InvalidArgumentException(
"Invalid type '" . gettype($regexp) . "' for argument 'regexp' given. String expected."
);
}
} | [
"public",
"function",
"setRegexp",
"(",
"$",
"regexp",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"regexp",
")",
")",
"{",
"$",
"this",
"->",
"regexp",
"=",
"$",
"regexp",
";",
"}",
"else",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
... | Sets the document regular expression filter.
@param string $regexp | [
"Sets",
"the",
"document",
"regular",
"expression",
"filter",
"."
] | train | https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtDocument/DocumentRule.php#L130-L139 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.