id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
27,500 | Litepie/Message | src/Http/Controllers/MessageResourceController.php | MessageResourceController.show | public function show(MessageRequest $request, Message $message)
{
if ($message->exists) {
$view = 'message::message.show';
} else {
$view = 'message::message.new';
}
return $this->response->title(trans('app.view') . ' ' . trans('message::message.name'))
... | php | public function show(MessageRequest $request, Message $message)
{
if ($message->exists) {
$view = 'message::message.show';
} else {
$view = 'message::message.new';
}
return $this->response->title(trans('app.view') . ' ' . trans('message::message.name'))
... | [
"public",
"function",
"show",
"(",
"MessageRequest",
"$",
"request",
",",
"Message",
"$",
"message",
")",
"{",
"if",
"(",
"$",
"message",
"->",
"exists",
")",
"{",
"$",
"view",
"=",
"'message::message.show'",
";",
"}",
"else",
"{",
"$",
"view",
"=",
"'... | Display message.
@param Request $request
@param Model $message
@return Response | [
"Display",
"message",
"."
] | 6c123f0feea627d572141fd71935250f3ba3cad0 | https://github.com/Litepie/Message/blob/6c123f0feea627d572141fd71935250f3ba3cad0/src/Http/Controllers/MessageResourceController.php#L66-L79 |
27,501 | Litepie/Message | src/Http/Controllers/MessageResourceController.php | MessageResourceController.store | public function store(MessageRequest $request)
{
try {
$mail_to = $request->get('mails');
$status = $request->get('status');
$sent = $request->all();
$inbox = $request->all();
$draft = $request->all();
if (empty($mail_to)) {
... | php | public function store(MessageRequest $request)
{
try {
$mail_to = $request->get('mails');
$status = $request->get('status');
$sent = $request->all();
$inbox = $request->all();
$draft = $request->all();
if (empty($mail_to)) {
... | [
"public",
"function",
"store",
"(",
"MessageRequest",
"$",
"request",
")",
"{",
"try",
"{",
"$",
"mail_to",
"=",
"$",
"request",
"->",
"get",
"(",
"'mails'",
")",
";",
"$",
"status",
"=",
"$",
"request",
"->",
"get",
"(",
"'status'",
")",
";",
"$",
... | Create new message.
@param Request $request
@return Response | [
"Create",
"new",
"message",
"."
] | 6c123f0feea627d572141fd71935250f3ba3cad0 | https://github.com/Litepie/Message/blob/6c123f0feea627d572141fd71935250f3ba3cad0/src/Http/Controllers/MessageResourceController.php#L105-L169 |
27,502 | Litepie/Message | src/Http/Controllers/MessageResourceController.php | MessageResourceController.edit | public function edit(MessageRequest $request, Message $message)
{
Form::populate($message);
return response()->view('message::message.edit', compact('message'));
} | php | public function edit(MessageRequest $request, Message $message)
{
Form::populate($message);
return response()->view('message::message.edit', compact('message'));
} | [
"public",
"function",
"edit",
"(",
"MessageRequest",
"$",
"request",
",",
"Message",
"$",
"message",
")",
"{",
"Form",
"::",
"populate",
"(",
"$",
"message",
")",
";",
"return",
"response",
"(",
")",
"->",
"view",
"(",
"'message::message.edit'",
",",
"comp... | Show message for editing.
@param Request $request
@param Model $message
@return Response | [
"Show",
"message",
"for",
"editing",
"."
] | 6c123f0feea627d572141fd71935250f3ba3cad0 | https://github.com/Litepie/Message/blob/6c123f0feea627d572141fd71935250f3ba3cad0/src/Http/Controllers/MessageResourceController.php#L179-L183 |
27,503 | Litepie/Message | src/Http/Controllers/MessageResourceController.php | MessageResourceController.destroy | public function destroy(MessageRequest $request, Message $message)
{
try {
if (!empty($request->get('arrayIds'))) {
$ids = $request->get('arrayIds');
$t = $this->repository->deleteMultiple($ids);
return $t;
} else {
$... | php | public function destroy(MessageRequest $request, Message $message)
{
try {
if (!empty($request->get('arrayIds'))) {
$ids = $request->get('arrayIds');
$t = $this->repository->deleteMultiple($ids);
return $t;
} else {
$... | [
"public",
"function",
"destroy",
"(",
"MessageRequest",
"$",
"request",
",",
"Message",
"$",
"message",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"request",
"->",
"get",
"(",
"'arrayIds'",
")",
")",
")",
"{",
"$",
"ids",
"=",
"$",
"r... | Remove the message.
@param Model $message
@return Response | [
"Remove",
"the",
"message",
"."
] | 6c123f0feea627d572141fd71935250f3ba3cad0 | https://github.com/Litepie/Message/blob/6c123f0feea627d572141fd71935250f3ba3cad0/src/Http/Controllers/MessageResourceController.php#L227-L260 |
27,504 | kherge-abandoned/php-phar-update | src/lib/Herrera/Phar/Update/Manifest.php | Manifest.load | public static function load($json)
{
$j = new Json();
return self::create($j->decode($json), $j);
} | php | public static function load($json)
{
$j = new Json();
return self::create($j->decode($json), $j);
} | [
"public",
"static",
"function",
"load",
"(",
"$",
"json",
")",
"{",
"$",
"j",
"=",
"new",
"Json",
"(",
")",
";",
"return",
"self",
"::",
"create",
"(",
"$",
"j",
"->",
"decode",
"(",
"$",
"json",
")",
",",
"$",
"j",
")",
";",
"}"
] | Loads the manifest from a JSON encoded string.
@param string $json The JSON encoded string.
@return Manifest The manifest. | [
"Loads",
"the",
"manifest",
"from",
"a",
"JSON",
"encoded",
"string",
"."
] | 15643c90d3d43620a4f45c910e6afb7a0ad4b488 | https://github.com/kherge-abandoned/php-phar-update/blob/15643c90d3d43620a4f45c910e6afb7a0ad4b488/src/lib/Herrera/Phar/Update/Manifest.php#L88-L93 |
27,505 | kherge-abandoned/php-phar-update | src/lib/Herrera/Phar/Update/Manifest.php | Manifest.loadFile | public static function loadFile($file)
{
$json = new Json();
return self::create($json->decodeFile($file), $json);
} | php | public static function loadFile($file)
{
$json = new Json();
return self::create($json->decodeFile($file), $json);
} | [
"public",
"static",
"function",
"loadFile",
"(",
"$",
"file",
")",
"{",
"$",
"json",
"=",
"new",
"Json",
"(",
")",
";",
"return",
"self",
"::",
"create",
"(",
"$",
"json",
"->",
"decodeFile",
"(",
"$",
"file",
")",
",",
"$",
"json",
")",
";",
"}"... | Loads the manifest from a JSON encoded file.
@param string $file The JSON encoded file.
@return Manifest The manifest. | [
"Loads",
"the",
"manifest",
"from",
"a",
"JSON",
"encoded",
"file",
"."
] | 15643c90d3d43620a4f45c910e6afb7a0ad4b488 | https://github.com/kherge-abandoned/php-phar-update/blob/15643c90d3d43620a4f45c910e6afb7a0ad4b488/src/lib/Herrera/Phar/Update/Manifest.php#L102-L107 |
27,506 | kherge-abandoned/php-phar-update | src/lib/Herrera/Phar/Update/Manifest.php | Manifest.create | private static function create($decoded, Json $json)
{
$json->validate(
$json->decodeFile(PHAR_UPDATE_MANIFEST_SCHEMA),
$decoded
);
$updates = array();
foreach ($decoded as $update) {
$updates[] = new Update(
$update->name,
... | php | private static function create($decoded, Json $json)
{
$json->validate(
$json->decodeFile(PHAR_UPDATE_MANIFEST_SCHEMA),
$decoded
);
$updates = array();
foreach ($decoded as $update) {
$updates[] = new Update(
$update->name,
... | [
"private",
"static",
"function",
"create",
"(",
"$",
"decoded",
",",
"Json",
"$",
"json",
")",
"{",
"$",
"json",
"->",
"validate",
"(",
"$",
"json",
"->",
"decodeFile",
"(",
"PHAR_UPDATE_MANIFEST_SCHEMA",
")",
",",
"$",
"decoded",
")",
";",
"$",
"updates... | Validates the data, processes it, and returns a new instance of Manifest.
@param array $decoded The decoded JSON data.
@param Json $json The Json instance used to decode the data.
@return Manifest The new instance. | [
"Validates",
"the",
"data",
"processes",
"it",
"and",
"returns",
"a",
"new",
"instance",
"of",
"Manifest",
"."
] | 15643c90d3d43620a4f45c910e6afb7a0ad4b488 | https://github.com/kherge-abandoned/php-phar-update/blob/15643c90d3d43620a4f45c910e6afb7a0ad4b488/src/lib/Herrera/Phar/Update/Manifest.php#L117-L147 |
27,507 | prooph/laravel-package | src/Migration/Schema/SnapshotSchema.php | SnapshotSchema.create | public static function create($snapshotName = 'snapshot')
{
Schema::create($snapshotName, function (Blueprint $snapshot) use ($snapshotName) {
// UUID4 of linked aggregate
$snapshot->char('aggregate_id', 36);
// Class of the linked aggregate
$snapshot->string(... | php | public static function create($snapshotName = 'snapshot')
{
Schema::create($snapshotName, function (Blueprint $snapshot) use ($snapshotName) {
// UUID4 of linked aggregate
$snapshot->char('aggregate_id', 36);
// Class of the linked aggregate
$snapshot->string(... | [
"public",
"static",
"function",
"create",
"(",
"$",
"snapshotName",
"=",
"'snapshot'",
")",
"{",
"Schema",
"::",
"create",
"(",
"$",
"snapshotName",
",",
"function",
"(",
"Blueprint",
"$",
"snapshot",
")",
"use",
"(",
"$",
"snapshotName",
")",
"{",
"// UUI... | Creates a snapshot schema
@param Schema $schema
@param string $snapshotName Defaults to 'snapshot' | [
"Creates",
"a",
"snapshot",
"schema"
] | e9647921ad1dc7b9753010e4648933555d89cddc | https://github.com/prooph/laravel-package/blob/e9647921ad1dc7b9753010e4648933555d89cddc/src/Migration/Schema/SnapshotSchema.php#L30-L45 |
27,508 | prooph/laravel-package | src/Facades/QueryBus.php | QueryBus.resultFrom | public static function resultFrom($aQuery)
{
/** @var \Prooph\ServiceBus\QueryBus $instance */
$instance = self::getFacadeRoot();
$ret = null;
$instance
->dispatch($aQuery)
->done(function ($result) use (&$ret) {
$ret = $result;
},... | php | public static function resultFrom($aQuery)
{
/** @var \Prooph\ServiceBus\QueryBus $instance */
$instance = self::getFacadeRoot();
$ret = null;
$instance
->dispatch($aQuery)
->done(function ($result) use (&$ret) {
$ret = $result;
},... | [
"public",
"static",
"function",
"resultFrom",
"(",
"$",
"aQuery",
")",
"{",
"/** @var \\Prooph\\ServiceBus\\QueryBus $instance */",
"$",
"instance",
"=",
"self",
"::",
"getFacadeRoot",
"(",
")",
";",
"$",
"ret",
"=",
"null",
";",
"$",
"instance",
"->",
"dispatch... | The default dispatch method will return you a promise
sometimes you might want to just get the result instead
this method will return you the result on a successful
query, and throw an exception instead if the query
fails.
@throws QueryResultFailed
@param Query|mixed $aQuery
@return mixed | [
"The",
"default",
"dispatch",
"method",
"will",
"return",
"you",
"a",
"promise",
"sometimes",
"you",
"might",
"want",
"to",
"just",
"get",
"the",
"result",
"instead",
"this",
"method",
"will",
"return",
"you",
"the",
"result",
"on",
"a",
"successful",
"query... | e9647921ad1dc7b9753010e4648933555d89cddc | https://github.com/prooph/laravel-package/blob/e9647921ad1dc7b9753010e4648933555d89cddc/src/Facades/QueryBus.php#L39-L54 |
27,509 | DivineOmega/array_undot | src/ArrayHelpers.php | ArrayHelpers.undot | public function undot(array $dotNotationArray)
{
$array = [];
foreach ($dotNotationArray as $key => $value) {
$this->set($array, $key, $value);
}
return $array;
} | php | public function undot(array $dotNotationArray)
{
$array = [];
foreach ($dotNotationArray as $key => $value) {
$this->set($array, $key, $value);
}
return $array;
} | [
"public",
"function",
"undot",
"(",
"array",
"$",
"dotNotationArray",
")",
"{",
"$",
"array",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"dotNotationArray",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"set",
"(",
"$",
"array",
... | Expands a dot notation array into a full multi-dimensional array
@param array $dotNotationArray
@return array | [
"Expands",
"a",
"dot",
"notation",
"array",
"into",
"a",
"full",
"multi",
"-",
"dimensional",
"array"
] | 44aed525e775718e3821d670b08046fd84914d10 | https://github.com/DivineOmega/array_undot/blob/44aed525e775718e3821d670b08046fd84914d10/src/ArrayHelpers.php#L14-L22 |
27,510 | dreamfactorysoftware/df-sqldb | src/Database/Schema/SqlSchema.php | SqlSchema.getSupportedResourceTypes | public function getSupportedResourceTypes()
{
return [
DbResourceTypes::TYPE_SCHEMA,
DbResourceTypes::TYPE_TABLE,
DbResourceTypes::TYPE_TABLE_FIELD,
DbResourceTypes::TYPE_TABLE_CONSTRAINT,
DbResourceTypes::TYPE_TABLE_RELATIONSHIP,
DbRes... | php | public function getSupportedResourceTypes()
{
return [
DbResourceTypes::TYPE_SCHEMA,
DbResourceTypes::TYPE_TABLE,
DbResourceTypes::TYPE_TABLE_FIELD,
DbResourceTypes::TYPE_TABLE_CONSTRAINT,
DbResourceTypes::TYPE_TABLE_RELATIONSHIP,
DbRes... | [
"public",
"function",
"getSupportedResourceTypes",
"(",
")",
"{",
"return",
"[",
"DbResourceTypes",
"::",
"TYPE_SCHEMA",
",",
"DbResourceTypes",
"::",
"TYPE_TABLE",
",",
"DbResourceTypes",
"::",
"TYPE_TABLE_FIELD",
",",
"DbResourceTypes",
"::",
"TYPE_TABLE_CONSTRAINT",
... | Return an array of supported schema resource types.
@return array | [
"Return",
"an",
"array",
"of",
"supported",
"schema",
"resource",
"types",
"."
] | f5b6c45fae068db5043419405299bfbc928fa90b | https://github.com/dreamfactorysoftware/df-sqldb/blob/f5b6c45fae068db5043419405299bfbc928fa90b/src/Database/Schema/SqlSchema.php#L33-L45 |
27,511 | dreamfactorysoftware/df-sqldb | src/Resources/StoredProcedure.php | StoredProcedure.describeProcedures | protected function describeProcedures($names, $refresh = false)
{
$names = static::validateAsArray(
$names,
',',
true,
'The request contains no valid procedure names or properties.'
);
$out = [];
foreach ($names as $name) {
... | php | protected function describeProcedures($names, $refresh = false)
{
$names = static::validateAsArray(
$names,
',',
true,
'The request contains no valid procedure names or properties.'
);
$out = [];
foreach ($names as $name) {
... | [
"protected",
"function",
"describeProcedures",
"(",
"$",
"names",
",",
"$",
"refresh",
"=",
"false",
")",
"{",
"$",
"names",
"=",
"static",
"::",
"validateAsArray",
"(",
"$",
"names",
",",
"','",
",",
"true",
",",
"'The request contains no valid procedure names ... | Get multiple procedures and their properties
@param string | array $names Procedure names comma-delimited string or array
@param bool $refresh Force a refresh of the schema from the database
@return array
@throws \Exception | [
"Get",
"multiple",
"procedures",
"and",
"their",
"properties"
] | f5b6c45fae068db5043419405299bfbc928fa90b | https://github.com/dreamfactorysoftware/df-sqldb/blob/f5b6c45fae068db5043419405299bfbc928fa90b/src/Resources/StoredProcedure.php#L273-L288 |
27,512 | dreamfactorysoftware/df-sqldb | src/Resources/StoredProcedure.php | StoredProcedure.describeProcedure | protected function describeProcedure($name, $refresh = false)
{
$name = (is_array($name) ? array_get($name, 'name') : $name);
if (empty($name)) {
throw new BadRequestException('Procedure name can not be empty.');
}
$this->checkPermission(Verbs::GET, $name);
try ... | php | protected function describeProcedure($name, $refresh = false)
{
$name = (is_array($name) ? array_get($name, 'name') : $name);
if (empty($name)) {
throw new BadRequestException('Procedure name can not be empty.');
}
$this->checkPermission(Verbs::GET, $name);
try ... | [
"protected",
"function",
"describeProcedure",
"(",
"$",
"name",
",",
"$",
"refresh",
"=",
"false",
")",
"{",
"$",
"name",
"=",
"(",
"is_array",
"(",
"$",
"name",
")",
"?",
"array_get",
"(",
"$",
"name",
",",
"'name'",
")",
":",
"$",
"name",
")",
";... | Get any properties related to the procedure
@param string | array $name Procedure name or defining properties
@param bool $refresh Force a refresh of the schema from the database
@return array
@throws \Exception | [
"Get",
"any",
"properties",
"related",
"to",
"the",
"procedure"
] | f5b6c45fae068db5043419405299bfbc928fa90b | https://github.com/dreamfactorysoftware/df-sqldb/blob/f5b6c45fae068db5043419405299bfbc928fa90b/src/Resources/StoredProcedure.php#L299-L319 |
27,513 | nglasl/silverstripe-mediawesome | src/pages/MediaPage.php | MediaPage.validate | public function validate() {
$parent = $this->getParent();
// The URL segment will conflict with a year/month/day/media format when numeric.
if(is_numeric($this->URLSegment) || !($parent instanceof MediaHolder) || ($this->MediaTypeID && ($parent->MediaTypeID != $this->MediaTypeID))) {
// Customise a valida... | php | public function validate() {
$parent = $this->getParent();
// The URL segment will conflict with a year/month/day/media format when numeric.
if(is_numeric($this->URLSegment) || !($parent instanceof MediaHolder) || ($this->MediaTypeID && ($parent->MediaTypeID != $this->MediaTypeID))) {
// Customise a valida... | [
"public",
"function",
"validate",
"(",
")",
"{",
"$",
"parent",
"=",
"$",
"this",
"->",
"getParent",
"(",
")",
";",
"// The URL segment will conflict with a year/month/day/media format when numeric.",
"if",
"(",
"is_numeric",
"(",
"$",
"this",
"->",
"URLSegment",
")... | Confirm that the current page is valid. | [
"Confirm",
"that",
"the",
"current",
"page",
"is",
"valid",
"."
] | 0537ad9934f69a680cd20115269efed13e082abf | https://github.com/nglasl/silverstripe-mediawesome/blob/0537ad9934f69a680cd20115269efed13e082abf/src/pages/MediaPage.php#L322-L350 |
27,514 | nglasl/silverstripe-mediawesome | src/pages/MediaPage.php | MediaPage.Link | public function Link($action = null) {
$parent = $this->getParent();
if(!$parent) {
return null;
}
$date = ($parent->URLFormatting !== '-') ? $this->dbObject('Date')->Format($parent->URLFormatting ?: 'y/MM/dd/') : '';
$join = array(
$parent->Link(),
"{$date}{$this->URLSegment}/"
);
if($action) {... | php | public function Link($action = null) {
$parent = $this->getParent();
if(!$parent) {
return null;
}
$date = ($parent->URLFormatting !== '-') ? $this->dbObject('Date')->Format($parent->URLFormatting ?: 'y/MM/dd/') : '';
$join = array(
$parent->Link(),
"{$date}{$this->URLSegment}/"
);
if($action) {... | [
"public",
"function",
"Link",
"(",
"$",
"action",
"=",
"null",
")",
"{",
"$",
"parent",
"=",
"$",
"this",
"->",
"getParent",
"(",
")",
";",
"if",
"(",
"!",
"$",
"parent",
")",
"{",
"return",
"null",
";",
"}",
"$",
"date",
"=",
"(",
"$",
"parent... | Determine the URL by using the media holder's defined URL format. | [
"Determine",
"the",
"URL",
"by",
"using",
"the",
"media",
"holder",
"s",
"defined",
"URL",
"format",
"."
] | 0537ad9934f69a680cd20115269efed13e082abf | https://github.com/nglasl/silverstripe-mediawesome/blob/0537ad9934f69a680cd20115269efed13e082abf/src/pages/MediaPage.php#L405-L421 |
27,515 | nglasl/silverstripe-mediawesome | src/pages/MediaPage.php | MediaPage.AbsoluteLink | public function AbsoluteLink($action = null) {
$parent = $this->getParent();
if(!$parent) {
return null;
}
$date = ($parent->URLFormatting !== '-') ? $this->dbObject('Date')->Format($parent->URLFormatting ?: 'y/MM/dd/') : '';
$link = $parent->AbsoluteLink() . "{$date}{$this->URLSegment}/";
if($action) {... | php | public function AbsoluteLink($action = null) {
$parent = $this->getParent();
if(!$parent) {
return null;
}
$date = ($parent->URLFormatting !== '-') ? $this->dbObject('Date')->Format($parent->URLFormatting ?: 'y/MM/dd/') : '';
$link = $parent->AbsoluteLink() . "{$date}{$this->URLSegment}/";
if($action) {... | [
"public",
"function",
"AbsoluteLink",
"(",
"$",
"action",
"=",
"null",
")",
"{",
"$",
"parent",
"=",
"$",
"this",
"->",
"getParent",
"(",
")",
";",
"if",
"(",
"!",
"$",
"parent",
")",
"{",
"return",
"null",
";",
"}",
"$",
"date",
"=",
"(",
"$",
... | Determine the absolute URL by using the media holder's defined URL format. | [
"Determine",
"the",
"absolute",
"URL",
"by",
"using",
"the",
"media",
"holder",
"s",
"defined",
"URL",
"format",
"."
] | 0537ad9934f69a680cd20115269efed13e082abf | https://github.com/nglasl/silverstripe-mediawesome/blob/0537ad9934f69a680cd20115269efed13e082abf/src/pages/MediaPage.php#L427-L439 |
27,516 | dreamfactorysoftware/df-sqldb | src/Database/Schema/SqliteSchema.php | SqliteSchema.addForeignKey | public function addForeignKey($name, $table, $columns, $refTable, $refColumns, $delete = null, $update = null)
{
throw new \Exception('Adding a foreign key constraint to an existing table is not supported by SQLite.');
} | php | public function addForeignKey($name, $table, $columns, $refTable, $refColumns, $delete = null, $update = null)
{
throw new \Exception('Adding a foreign key constraint to an existing table is not supported by SQLite.');
} | [
"public",
"function",
"addForeignKey",
"(",
"$",
"name",
",",
"$",
"table",
",",
"$",
"columns",
",",
"$",
"refTable",
",",
"$",
"refColumns",
",",
"$",
"delete",
"=",
"null",
",",
"$",
"update",
"=",
"null",
")",
"{",
"throw",
"new",
"\\",
"Exceptio... | Builds a SQL statement for adding a foreign key constraint to an existing table.
Because SQLite does not support adding foreign key to an existing table, calling this method will throw an
exception.
@param string $name the name of the foreign key constraint.
@param string $table the table that the foreign k... | [
"Builds",
"a",
"SQL",
"statement",
"for",
"adding",
"a",
"foreign",
"key",
"constraint",
"to",
"an",
"existing",
"table",
".",
"Because",
"SQLite",
"does",
"not",
"support",
"adding",
"foreign",
"key",
"to",
"an",
"existing",
"table",
"calling",
"this",
"met... | f5b6c45fae068db5043419405299bfbc928fa90b | https://github.com/dreamfactorysoftware/df-sqldb/blob/f5b6c45fae068db5043419405299bfbc928fa90b/src/Database/Schema/SqliteSchema.php#L472-L475 |
27,517 | nglasl/silverstripe-mediawesome | src/objects/MediaTag.php | MediaTag.validate | public function validate() {
$result = parent::validate();
// Confirm that the current tag has been given a title and doesn't already exist.
$this->Title = strtolower($this->Title);
if($result->isValid() && !$this->Title) {
$result->addError('"Title" required!');
}
else if($result->isValid() && MediaT... | php | public function validate() {
$result = parent::validate();
// Confirm that the current tag has been given a title and doesn't already exist.
$this->Title = strtolower($this->Title);
if($result->isValid() && !$this->Title) {
$result->addError('"Title" required!');
}
else if($result->isValid() && MediaT... | [
"public",
"function",
"validate",
"(",
")",
"{",
"$",
"result",
"=",
"parent",
"::",
"validate",
"(",
")",
";",
"// Confirm that the current tag has been given a title and doesn't already exist.",
"$",
"this",
"->",
"Title",
"=",
"strtolower",
"(",
"$",
"this",
"->"... | Confirm that the current tag is valid. | [
"Confirm",
"that",
"the",
"current",
"tag",
"is",
"valid",
"."
] | 0537ad9934f69a680cd20115269efed13e082abf | https://github.com/nglasl/silverstripe-mediawesome/blob/0537ad9934f69a680cd20115269efed13e082abf/src/objects/MediaTag.php#L46-L67 |
27,518 | MetaModels/filter_fromto | src/FilterRule/FromTo.php | FromTo.setLowerBound | public function setLowerBound($value, $inclusive)
{
$this->lowerBound = $value;
$this->lowerInclusive = (bool) $inclusive;
return $this;
} | php | public function setLowerBound($value, $inclusive)
{
$this->lowerBound = $value;
$this->lowerInclusive = (bool) $inclusive;
return $this;
} | [
"public",
"function",
"setLowerBound",
"(",
"$",
"value",
",",
"$",
"inclusive",
")",
"{",
"$",
"this",
"->",
"lowerBound",
"=",
"$",
"value",
";",
"$",
"this",
"->",
"lowerInclusive",
"=",
"(",
"bool",
")",
"$",
"inclusive",
";",
"return",
"$",
"this"... | Mark the lower bound of the range to search.
@param mixed $value The value to use for the lower bound.
@param bool $inclusive Flag if the value shall also be included in the result.
@return FromTo | [
"Mark",
"the",
"lower",
"bound",
"of",
"the",
"range",
"to",
"search",
"."
] | 0d65f4b14f3eceab9e022c79388fbced5e47ed9d | https://github.com/MetaModels/filter_fromto/blob/0d65f4b14f3eceab9e022c79388fbced5e47ed9d/src/FilterRule/FromTo.php#L90-L96 |
27,519 | MetaModels/filter_fromto | src/FilterRule/FromTo.php | FromTo.setUpperBound | public function setUpperBound($value, $inclusive)
{
$this->upperBound = $value;
$this->upperInclusive = (bool) $inclusive;
return $this;
} | php | public function setUpperBound($value, $inclusive)
{
$this->upperBound = $value;
$this->upperInclusive = (bool) $inclusive;
return $this;
} | [
"public",
"function",
"setUpperBound",
"(",
"$",
"value",
",",
"$",
"inclusive",
")",
"{",
"$",
"this",
"->",
"upperBound",
"=",
"$",
"value",
";",
"$",
"this",
"->",
"upperInclusive",
"=",
"(",
"bool",
")",
"$",
"inclusive",
";",
"return",
"$",
"this"... | Mark the upper bound of the range to search.
@param mixed $value The value to use for the upper bound.
@param bool $inclusive Flag if the value shall also be included in the result.
@return FromTo | [
"Mark",
"the",
"upper",
"bound",
"of",
"the",
"range",
"to",
"search",
"."
] | 0d65f4b14f3eceab9e022c79388fbced5e47ed9d | https://github.com/MetaModels/filter_fromto/blob/0d65f4b14f3eceab9e022c79388fbced5e47ed9d/src/FilterRule/FromTo.php#L127-L133 |
27,520 | MetaModels/filter_fromto | src/FilterRule/FromTo.php | FromTo.evaluateLowerBound | protected function evaluateLowerBound()
{
if (empty($this->lowerBound)) {
return null;
}
return $this->executeRule(
new GreaterThan($this->getAttribute(), $this->getLowerBound(), $this->isLowerInclusive())
);
} | php | protected function evaluateLowerBound()
{
if (empty($this->lowerBound)) {
return null;
}
return $this->executeRule(
new GreaterThan($this->getAttribute(), $this->getLowerBound(), $this->isLowerInclusive())
);
} | [
"protected",
"function",
"evaluateLowerBound",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"lowerBound",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"$",
"this",
"->",
"executeRule",
"(",
"new",
"GreaterThan",
"(",
"$",
"this",
... | Evaluate the lower bounding of the range.
@return null|\string[] | [
"Evaluate",
"the",
"lower",
"bounding",
"of",
"the",
"range",
"."
] | 0d65f4b14f3eceab9e022c79388fbced5e47ed9d | https://github.com/MetaModels/filter_fromto/blob/0d65f4b14f3eceab9e022c79388fbced5e47ed9d/src/FilterRule/FromTo.php#L182-L191 |
27,521 | MetaModels/filter_fromto | src/FilterRule/FromTo.php | FromTo.evaluateUpperBound | protected function evaluateUpperBound()
{
if (empty($this->upperBound)) {
return null;
}
return $this->executeRule(
new LessThan($this->getAttribute(), $this->getUpperBound(), $this->isUpperInclusive())
);
} | php | protected function evaluateUpperBound()
{
if (empty($this->upperBound)) {
return null;
}
return $this->executeRule(
new LessThan($this->getAttribute(), $this->getUpperBound(), $this->isUpperInclusive())
);
} | [
"protected",
"function",
"evaluateUpperBound",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"upperBound",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"$",
"this",
"->",
"executeRule",
"(",
"new",
"LessThan",
"(",
"$",
"this",
"->... | Evaluate the upper bounding of the range.
@return null|\string[] | [
"Evaluate",
"the",
"upper",
"bounding",
"of",
"the",
"range",
"."
] | 0d65f4b14f3eceab9e022c79388fbced5e47ed9d | https://github.com/MetaModels/filter_fromto/blob/0d65f4b14f3eceab9e022c79388fbced5e47ed9d/src/FilterRule/FromTo.php#L198-L207 |
27,522 | MetaModels/filter_fromto | src/EventListener/FilterRangeDateRegexpListener.php | FilterRangeDateRegexpListener.onAddCustomRegexp | public static function onAddCustomRegexp($rgxp, $value, $widget)
{
if ('MetaModelsFilterRangeDateRgXp' !== $rgxp) {
return;
}
$format = $widget->dateformat;
if (!\preg_match('~^'. Date::getRegexp($format) .'$~i', $value)) {
$widget->addError(\sprintf($GLOBALS... | php | public static function onAddCustomRegexp($rgxp, $value, $widget)
{
if ('MetaModelsFilterRangeDateRgXp' !== $rgxp) {
return;
}
$format = $widget->dateformat;
if (!\preg_match('~^'. Date::getRegexp($format) .'$~i', $value)) {
$widget->addError(\sprintf($GLOBALS... | [
"public",
"static",
"function",
"onAddCustomRegexp",
"(",
"$",
"rgxp",
",",
"$",
"value",
",",
"$",
"widget",
")",
"{",
"if",
"(",
"'MetaModelsFilterRangeDateRgXp'",
"!==",
"$",
"rgxp",
")",
"{",
"return",
";",
"}",
"$",
"format",
"=",
"$",
"widget",
"->... | Process a custom date regexp on a widget.
@param string $rgxp The rgxp being evaluated.
@param string $value The value to check.
@param Widget $widget The widget to process.
@return void
@SuppressWarnings(PHPMD.Superglobals)
@SuppressWarnings(PHPMD.CamelCaseVariableName) | [
"Process",
"a",
"custom",
"date",
"regexp",
"on",
"a",
"widget",
"."
] | 0d65f4b14f3eceab9e022c79388fbced5e47ed9d | https://github.com/MetaModels/filter_fromto/blob/0d65f4b14f3eceab9e022c79388fbced5e47ed9d/src/EventListener/FilterRangeDateRegexpListener.php#L47-L64 |
27,523 | MetaModels/filter_fromto | src/FilterSetting/AbstractFromTo.php | AbstractFromTo.getParameterValue | protected function getParameterValue($filterUrl)
{
$parameterName = $this->getParamName();
if (isset($filterUrl[$parameterName]) && !empty($filterUrl[$parameterName])) {
if (\is_array($filterUrl[$parameterName])) {
return \array_values($filterUrl[$parameterName]);
... | php | protected function getParameterValue($filterUrl)
{
$parameterName = $this->getParamName();
if (isset($filterUrl[$parameterName]) && !empty($filterUrl[$parameterName])) {
if (\is_array($filterUrl[$parameterName])) {
return \array_values($filterUrl[$parameterName]);
... | [
"protected",
"function",
"getParameterValue",
"(",
"$",
"filterUrl",
")",
"{",
"$",
"parameterName",
"=",
"$",
"this",
"->",
"getParamName",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"filterUrl",
"[",
"$",
"parameterName",
"]",
")",
"&&",
"!",
"empty"... | Retrieve the parameter value from the filter url.
@param array $filterUrl The filter url from which to extract the parameter.
@return null|string|array | [
"Retrieve",
"the",
"parameter",
"value",
"from",
"the",
"filter",
"url",
"."
] | 0d65f4b14f3eceab9e022c79388fbced5e47ed9d | https://github.com/MetaModels/filter_fromto/blob/0d65f4b14f3eceab9e022c79388fbced5e47ed9d/src/FilterSetting/AbstractFromTo.php#L84-L96 |
27,524 | MetaModels/filter_fromto | src/FilterSetting/AbstractFromTo.php | AbstractFromTo.getReferencedAttributes | public function getReferencedAttributes()
{
$objAttribute = null;
if (!($this->get('attr_id')
&& ($objAttribute = $this->getMetaModel()->getAttributeById($this->get('attr_id'))))) {
return [];
}
return $objAttribute ? [$objAttribute->getColName()] : [];
} | php | public function getReferencedAttributes()
{
$objAttribute = null;
if (!($this->get('attr_id')
&& ($objAttribute = $this->getMetaModel()->getAttributeById($this->get('attr_id'))))) {
return [];
}
return $objAttribute ? [$objAttribute->getColName()] : [];
} | [
"public",
"function",
"getReferencedAttributes",
"(",
")",
"{",
"$",
"objAttribute",
"=",
"null",
";",
"if",
"(",
"!",
"(",
"$",
"this",
"->",
"get",
"(",
"'attr_id'",
")",
"&&",
"(",
"$",
"objAttribute",
"=",
"$",
"this",
"->",
"getMetaModel",
"(",
")... | Retrieve the attribute name that is referenced in this filter setting.
@return array | [
"Retrieve",
"the",
"attribute",
"name",
"that",
"is",
"referenced",
"in",
"this",
"filter",
"setting",
"."
] | 0d65f4b14f3eceab9e022c79388fbced5e47ed9d | https://github.com/MetaModels/filter_fromto/blob/0d65f4b14f3eceab9e022c79388fbced5e47ed9d/src/FilterSetting/AbstractFromTo.php#L103-L112 |
27,525 | MetaModels/filter_fromto | src/FilterSetting/AbstractFromTo.php | AbstractFromTo.prepareWidgetOptions | protected function prepareWidgetOptions($arrIds, $objAttribute)
{
$arrOptions = $objAttribute->getFilterOptions(
($this->get('onlypossible') ? $arrIds : null),
(bool) $this->get('onlyused')
);
// Remove empty values from list.
foreach ($arrOptions as $mixKeyO... | php | protected function prepareWidgetOptions($arrIds, $objAttribute)
{
$arrOptions = $objAttribute->getFilterOptions(
($this->get('onlypossible') ? $arrIds : null),
(bool) $this->get('onlyused')
);
// Remove empty values from list.
foreach ($arrOptions as $mixKeyO... | [
"protected",
"function",
"prepareWidgetOptions",
"(",
"$",
"arrIds",
",",
"$",
"objAttribute",
")",
"{",
"$",
"arrOptions",
"=",
"$",
"objAttribute",
"->",
"getFilterOptions",
"(",
"(",
"$",
"this",
"->",
"get",
"(",
"'onlypossible'",
")",
"?",
"$",
"arrIds"... | Prepare options for the widget.
@param array $arrIds List of ids.
@param IAttribute $objAttribute The metamodel attribute.
@return array | [
"Prepare",
"options",
"for",
"the",
"widget",
"."
] | 0d65f4b14f3eceab9e022c79388fbced5e47ed9d | https://github.com/MetaModels/filter_fromto/blob/0d65f4b14f3eceab9e022c79388fbced5e47ed9d/src/FilterSetting/AbstractFromTo.php#L180-L199 |
27,526 | MetaModels/filter_fromto | src/FilterSetting/AbstractFromTo.php | AbstractFromTo.prepareWidgetParamAndFilterUrl | protected function prepareWidgetParamAndFilterUrl($arrFilterUrl)
{
// Split up our param so the widgets can use it again.
$parameterName = $this->getParamName();
$privateFilterUrl = $arrFilterUrl;
$parameterValue = null;
// If we have a value, we have to explode it by d... | php | protected function prepareWidgetParamAndFilterUrl($arrFilterUrl)
{
// Split up our param so the widgets can use it again.
$parameterName = $this->getParamName();
$privateFilterUrl = $arrFilterUrl;
$parameterValue = null;
// If we have a value, we have to explode it by d... | [
"protected",
"function",
"prepareWidgetParamAndFilterUrl",
"(",
"$",
"arrFilterUrl",
")",
"{",
"// Split up our param so the widgets can use it again.",
"$",
"parameterName",
"=",
"$",
"this",
"->",
"getParamName",
"(",
")",
";",
"$",
"privateFilterUrl",
"=",
"$",
"arrF... | Prepare the widget Param and filter url.
@param array $arrFilterUrl The filter url.
@return array | [
"Prepare",
"the",
"widget",
"Param",
"and",
"filter",
"url",
"."
] | 0d65f4b14f3eceab9e022c79388fbced5e47ed9d | https://github.com/MetaModels/filter_fromto/blob/0d65f4b14f3eceab9e022c79388fbced5e47ed9d/src/FilterSetting/AbstractFromTo.php#L208-L237 |
27,527 | MetaModels/filter_fromto | src/FilterSetting/AbstractFromTo.php | AbstractFromTo.formatEmpty | private function formatEmpty($value)
{
if (empty($value = \trim($value))) {
return $value;
}
return $this->formatValue($value);
} | php | private function formatEmpty($value)
{
if (empty($value = \trim($value))) {
return $value;
}
return $this->formatValue($value);
} | [
"private",
"function",
"formatEmpty",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"value",
"=",
"\\",
"trim",
"(",
"$",
"value",
")",
")",
")",
"{",
"return",
"$",
"value",
";",
"}",
"return",
"$",
"this",
"->",
"formatValue",
"(",
... | Format the value but return empty if it is empty.
@param string $value The value to format.
@return bool|string | [
"Format",
"the",
"value",
"but",
"return",
"empty",
"if",
"it",
"is",
"empty",
"."
] | 0d65f4b14f3eceab9e022c79388fbced5e47ed9d | https://github.com/MetaModels/filter_fromto/blob/0d65f4b14f3eceab9e022c79388fbced5e47ed9d/src/FilterSetting/AbstractFromTo.php#L351-L358 |
27,528 | MetaModels/filter_fromto | src/FilterSetting/AbstractFromTo.php | AbstractFromTo.createFromToRule | private function createFromToRule(IAttribute $attribute, $formattedValueZero, $formattedValueOne)
{
// If something went wrong return an empty list.
if ($formattedValueZero === false || $formattedValueOne === false) {
return new StaticIdList([]);
}
// Add rule to the fil... | php | private function createFromToRule(IAttribute $attribute, $formattedValueZero, $formattedValueOne)
{
// If something went wrong return an empty list.
if ($formattedValueZero === false || $formattedValueOne === false) {
return new StaticIdList([]);
}
// Add rule to the fil... | [
"private",
"function",
"createFromToRule",
"(",
"IAttribute",
"$",
"attribute",
",",
"$",
"formattedValueZero",
",",
"$",
"formattedValueOne",
")",
"{",
"// If something went wrong return an empty list.",
"if",
"(",
"$",
"formattedValueZero",
"===",
"false",
"||",
"$",
... | Create and populate a rule instance.
@param IAttribute $attribute The attribute to filter on.
@param string $formattedValueZero The formatted first value.
@param string $formattedValueOne The formatted second value.
@return \MetaModels\FilterFromToBundle\FilterRule\FromTo|StaticIdList | [
"Create",
"and",
"populate",
"a",
"rule",
"instance",
"."
] | 0d65f4b14f3eceab9e022c79388fbced5e47ed9d | https://github.com/MetaModels/filter_fromto/blob/0d65f4b14f3eceab9e022c79388fbced5e47ed9d/src/FilterSetting/AbstractFromTo.php#L369-L391 |
27,529 | nglasl/silverstripe-mediawesome | src/controllers/MediaHolderController.php | MediaHolderController.index | public function index() {
// Use a custom media type holder template if one exists.
$type = $this->data()->MediaType();
$templates = array();
if($type->exists()) {
$templates[] = 'MediaHolder_' . str_replace(' ', '', $type->Title);
}
$templates[] = 'MediaHolder';
$templates[] = 'Page';
$this->exten... | php | public function index() {
// Use a custom media type holder template if one exists.
$type = $this->data()->MediaType();
$templates = array();
if($type->exists()) {
$templates[] = 'MediaHolder_' . str_replace(' ', '', $type->Title);
}
$templates[] = 'MediaHolder';
$templates[] = 'Page';
$this->exten... | [
"public",
"function",
"index",
"(",
")",
"{",
"// Use a custom media type holder template if one exists.",
"$",
"type",
"=",
"$",
"this",
"->",
"data",
"(",
")",
"->",
"MediaType",
"(",
")",
";",
"$",
"templates",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$... | Determine the template for this media holder. | [
"Determine",
"the",
"template",
"for",
"this",
"media",
"holder",
"."
] | 0537ad9934f69a680cd20115269efed13e082abf | https://github.com/nglasl/silverstripe-mediawesome/blob/0537ad9934f69a680cd20115269efed13e082abf/src/controllers/MediaHolderController.php#L36-L49 |
27,530 | nglasl/silverstripe-mediawesome | src/controllers/MediaHolderController.php | MediaHolderController.resolveURL | private function resolveURL() {
// Retrieve the current request URL segments.
$request = $this->getRequest();
$URL = $request->getURL();
$holder = substr($URL, 0, strpos($URL, '/'));
$page = substr($URL, strrpos($URL, '/') + 1);
// Determine whether a media page child once existed.
$resolution = self:... | php | private function resolveURL() {
// Retrieve the current request URL segments.
$request = $this->getRequest();
$URL = $request->getURL();
$holder = substr($URL, 0, strpos($URL, '/'));
$page = substr($URL, strrpos($URL, '/') + 1);
// Determine whether a media page child once existed.
$resolution = self:... | [
"private",
"function",
"resolveURL",
"(",
")",
"{",
"// Retrieve the current request URL segments.",
"$",
"request",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
";",
"$",
"URL",
"=",
"$",
"request",
"->",
"getURL",
"(",
")",
";",
"$",
"holder",
"=",
"s... | Determine whether a media page child once existed for the current request, and redirect appropriately.
@return http response | [
"Determine",
"whether",
"a",
"media",
"page",
"child",
"once",
"existed",
"for",
"the",
"current",
"request",
"and",
"redirect",
"appropriately",
"."
] | 0537ad9934f69a680cd20115269efed13e082abf | https://github.com/nglasl/silverstripe-mediawesome/blob/0537ad9934f69a680cd20115269efed13e082abf/src/controllers/MediaHolderController.php#L353-L390 |
27,531 | nglasl/silverstripe-mediawesome | src/controllers/MediaHolderController.php | MediaHolderController.getDateFilterForm | public function getDateFilterForm() {
// Display a form that allows filtering from a specified date.
$children = MediaPage::get()->filter('ParentID', $this->data()->ID);
$form = Form::create(
$this,
'getDateFilterForm',
FieldList::create(
$date = DateField::create(
'from',
'From'
)->s... | php | public function getDateFilterForm() {
// Display a form that allows filtering from a specified date.
$children = MediaPage::get()->filter('ParentID', $this->data()->ID);
$form = Form::create(
$this,
'getDateFilterForm',
FieldList::create(
$date = DateField::create(
'from',
'From'
)->s... | [
"public",
"function",
"getDateFilterForm",
"(",
")",
"{",
"// Display a form that allows filtering from a specified date.",
"$",
"children",
"=",
"MediaPage",
"::",
"get",
"(",
")",
"->",
"filter",
"(",
"'ParentID'",
",",
"$",
"this",
"->",
"data",
"(",
")",
"->",... | Retrieve a simple date filter form.
@return form | [
"Retrieve",
"a",
"simple",
"date",
"filter",
"form",
"."
] | 0537ad9934f69a680cd20115269efed13e082abf | https://github.com/nglasl/silverstripe-mediawesome/blob/0537ad9934f69a680cd20115269efed13e082abf/src/controllers/MediaHolderController.php#L398-L446 |
27,532 | nglasl/silverstripe-mediawesome | src/controllers/MediaHolderController.php | MediaHolderController.dateFilter | public function dateFilter() {
// Apply the from date filter.
$request = $this->getRequest();
$from = $request->getVar('from');
$link = $this->Link();
$separator = '?';
if($from) {
// Determine the formatted URL to represent the request filter.
$date = DBDate::create()->setValue($from);
$link .... | php | public function dateFilter() {
// Apply the from date filter.
$request = $this->getRequest();
$from = $request->getVar('from');
$link = $this->Link();
$separator = '?';
if($from) {
// Determine the formatted URL to represent the request filter.
$date = DBDate::create()->setValue($from);
$link .... | [
"public",
"function",
"dateFilter",
"(",
")",
"{",
"// Apply the from date filter.",
"$",
"request",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
";",
"$",
"from",
"=",
"$",
"request",
"->",
"getVar",
"(",
"'from'",
")",
";",
"$",
"link",
"=",
"$",
... | Request media page children from the filtered date. | [
"Request",
"media",
"page",
"children",
"from",
"the",
"filtered",
"date",
"."
] | 0537ad9934f69a680cd20115269efed13e082abf | https://github.com/nglasl/silverstripe-mediawesome/blob/0537ad9934f69a680cd20115269efed13e082abf/src/controllers/MediaHolderController.php#L452-L487 |
27,533 | nglasl/silverstripe-mediawesome | src/objects/MediaAttribute.php | MediaAttribute.checkPermissions | public function checkPermissions($member = null) {
// Retrieve the current site configuration permissions for customisation of media.
$configuration = SiteConfig::current_site_config();
return Permission::check($configuration->MediaPermission, 'any', $member);
} | php | public function checkPermissions($member = null) {
// Retrieve the current site configuration permissions for customisation of media.
$configuration = SiteConfig::current_site_config();
return Permission::check($configuration->MediaPermission, 'any', $member);
} | [
"public",
"function",
"checkPermissions",
"(",
"$",
"member",
"=",
"null",
")",
"{",
"// Retrieve the current site configuration permissions for customisation of media.",
"$",
"configuration",
"=",
"SiteConfig",
"::",
"current_site_config",
"(",
")",
";",
"return",
"Permiss... | Determine access for the current CMS user from the site configuration permissions.
@parameter <{CURRENT_MEMBER}> member
@return boolean | [
"Determine",
"access",
"for",
"the",
"current",
"CMS",
"user",
"from",
"the",
"site",
"configuration",
"permissions",
"."
] | 0537ad9934f69a680cd20115269efed13e082abf | https://github.com/nglasl/silverstripe-mediawesome/blob/0537ad9934f69a680cd20115269efed13e082abf/src/objects/MediaAttribute.php#L74-L80 |
27,534 | nglasl/silverstripe-mediawesome | src/objects/MediaAttribute.php | MediaAttribute.validate | public function validate() {
$result = parent::validate();
// Confirm that the current attribute has been given a title.
if($result->isValid() && !$this->Title) {
$result->addError('"Title" required!');
}
// Allow extension customisation.
$this->extend('validateMediaAttribute', $result);
return $r... | php | public function validate() {
$result = parent::validate();
// Confirm that the current attribute has been given a title.
if($result->isValid() && !$this->Title) {
$result->addError('"Title" required!');
}
// Allow extension customisation.
$this->extend('validateMediaAttribute', $result);
return $r... | [
"public",
"function",
"validate",
"(",
")",
"{",
"$",
"result",
"=",
"parent",
"::",
"validate",
"(",
")",
";",
"// Confirm that the current attribute has been given a title.",
"if",
"(",
"$",
"result",
"->",
"isValid",
"(",
")",
"&&",
"!",
"$",
"this",
"->",
... | Confirm that the current attribute is valid. | [
"Confirm",
"that",
"the",
"current",
"attribute",
"is",
"valid",
"."
] | 0537ad9934f69a680cd20115269efed13e082abf | https://github.com/nglasl/silverstripe-mediawesome/blob/0537ad9934f69a680cd20115269efed13e082abf/src/objects/MediaAttribute.php#L99-L113 |
27,535 | jonnitto/Jonnitto.PrettyEmbedYoutube | Classes/Eel/YoutubeHelper.php | YoutubeHelper.parseID | function parseID($url) {
if (!$url) {
return false;
}
$regs = array();
if (preg_match('/(?<=(?:(?<=v)|(?<=i)|(?<=list))=)[a-zA-Z0-9-]+(?=&)|(?<=(?:(?<=v)|(?<=i)|(?<=list))\/)[^&\n]+|(?<=embed\/)[^"&\n]+|(?<=(?:(?<=v)|(?<=i)|(?<=list))=)[^&\n]+|(?<=youtu.be\/)[^&\n]+/im', $url... | php | function parseID($url) {
if (!$url) {
return false;
}
$regs = array();
if (preg_match('/(?<=(?:(?<=v)|(?<=i)|(?<=list))=)[a-zA-Z0-9-]+(?=&)|(?<=(?:(?<=v)|(?<=i)|(?<=list))\/)[^&\n]+|(?<=embed\/)[^"&\n]+|(?<=(?:(?<=v)|(?<=i)|(?<=list))=)[^&\n]+|(?<=youtu.be\/)[^&\n]+/im', $url... | [
"function",
"parseID",
"(",
"$",
"url",
")",
"{",
"if",
"(",
"!",
"$",
"url",
")",
"{",
"return",
"false",
";",
"}",
"$",
"regs",
"=",
"array",
"(",
")",
";",
"if",
"(",
"preg_match",
"(",
"'/(?<=(?:(?<=v)|(?<=i)|(?<=list))=)[a-zA-Z0-9-]+(?=&)|(?<=(?:(?<=v)|... | Get Youtube video id from url
@param string $url The URL
@return string the video id extracted from url | [
"Get",
"Youtube",
"video",
"id",
"from",
"url"
] | 2df6d1ced7fce9fd1cea327bc6cb617a25e714d0 | https://github.com/jonnitto/Jonnitto.PrettyEmbedYoutube/blob/2df6d1ced7fce9fd1cea327bc6cb617a25e714d0/Classes/Eel/YoutubeHelper.php#L23-L32 |
27,536 | jonnitto/Jonnitto.PrettyEmbedYoutube | Classes/Eel/YoutubeHelper.php | YoutubeHelper.data | function data($id)
{
if (!$id) {
return false;
}
$data = json_decode(@file_get_contents('https://www.youtube.com/oembed?url=https%3A//youtube.com/watch%3Fv%3D' . $id));
if (!$data) {
return false;
}
return $data;
} | php | function data($id)
{
if (!$id) {
return false;
}
$data = json_decode(@file_get_contents('https://www.youtube.com/oembed?url=https%3A//youtube.com/watch%3Fv%3D' . $id));
if (!$data) {
return false;
}
return $data;
} | [
"function",
"data",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"!",
"$",
"id",
")",
"{",
"return",
"false",
";",
"}",
"$",
"data",
"=",
"json_decode",
"(",
"@",
"file_get_contents",
"(",
"'https://www.youtube.com/oembed?url=https%3A//youtube.com/watch%3Fv%3D'",
".",
... | Grab the data of a publicly embeddable video hosted on youtube
@param string $id The "id" of a video
@return mixed The data or false if there's an error | [
"Grab",
"the",
"data",
"of",
"a",
"publicly",
"embeddable",
"video",
"hosted",
"on",
"youtube"
] | 2df6d1ced7fce9fd1cea327bc6cb617a25e714d0 | https://github.com/jonnitto/Jonnitto.PrettyEmbedYoutube/blob/2df6d1ced7fce9fd1cea327bc6cb617a25e714d0/Classes/Eel/YoutubeHelper.php#L39-L49 |
27,537 | jonnitto/Jonnitto.PrettyEmbedYoutube | Classes/Eel/YoutubeHelper.php | YoutubeHelper.title | function title($id) {
$data = $this->data($id);
if (!$data) {
return false;
}
return $data->title;
} | php | function title($id) {
$data = $this->data($id);
if (!$data) {
return false;
}
return $data->title;
} | [
"function",
"title",
"(",
"$",
"id",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"data",
"(",
"$",
"id",
")",
";",
"if",
"(",
"!",
"$",
"data",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"data",
"->",
"title",
";",
"}"
] | Grab the title of a publicly embeddable video hosted on youtube
@param string $id The "id" of a video
@return mixed The title or false if there's an error | [
"Grab",
"the",
"title",
"of",
"a",
"publicly",
"embeddable",
"video",
"hosted",
"on",
"youtube"
] | 2df6d1ced7fce9fd1cea327bc6cb617a25e714d0 | https://github.com/jonnitto/Jonnitto.PrettyEmbedYoutube/blob/2df6d1ced7fce9fd1cea327bc6cb617a25e714d0/Classes/Eel/YoutubeHelper.php#L56-L62 |
27,538 | nglasl/silverstripe-mediawesome | src/extensions/SiteConfigMediaPermissionExtension.php | SiteConfigMediaPermissionExtension.updateCMSFields | public function updateCMSFields(FieldList $fields) {
$permissions = array(
'ADMIN' => 'Administrators and developers',
'SITETREE_EDIT_ALL' => 'Content authors'
);
// Confirm that the current CMS user has permission.
if(Permission::check('EDIT_SITECONFIG') === false) {
$fields->addFieldToTab('Root.Ac... | php | public function updateCMSFields(FieldList $fields) {
$permissions = array(
'ADMIN' => 'Administrators and developers',
'SITETREE_EDIT_ALL' => 'Content authors'
);
// Confirm that the current CMS user has permission.
if(Permission::check('EDIT_SITECONFIG') === false) {
$fields->addFieldToTab('Root.Ac... | [
"public",
"function",
"updateCMSFields",
"(",
"FieldList",
"$",
"fields",
")",
"{",
"$",
"permissions",
"=",
"array",
"(",
"'ADMIN'",
"=>",
"'Administrators and developers'",
",",
"'SITETREE_EDIT_ALL'",
"=>",
"'Content authors'",
")",
";",
"// Confirm that the current C... | Allow permission configuration for customisation of media. | [
"Allow",
"permission",
"configuration",
"for",
"customisation",
"of",
"media",
"."
] | 0537ad9934f69a680cd20115269efed13e082abf | https://github.com/nglasl/silverstripe-mediawesome/blob/0537ad9934f69a680cd20115269efed13e082abf/src/extensions/SiteConfigMediaPermissionExtension.php#L30-L60 |
27,539 | MetaModels/filter_fromto | src/FilterRule/FromToDate.php | FromToDate.runSimpleQuery | private function runSimpleQuery($operation, $value)
{
$attribute = $this->getAttribute();
if (!$attribute instanceof ISimple) {
throw new \RuntimeException('Filtering for time ranges is only possible on simple attributes.');
}
return $this->executeRule(new SimpleQuery(
... | php | private function runSimpleQuery($operation, $value)
{
$attribute = $this->getAttribute();
if (!$attribute instanceof ISimple) {
throw new \RuntimeException('Filtering for time ranges is only possible on simple attributes.');
}
return $this->executeRule(new SimpleQuery(
... | [
"private",
"function",
"runSimpleQuery",
"(",
"$",
"operation",
",",
"$",
"value",
")",
"{",
"$",
"attribute",
"=",
"$",
"this",
"->",
"getAttribute",
"(",
")",
";",
"if",
"(",
"!",
"$",
"attribute",
"instanceof",
"ISimple",
")",
"{",
"throw",
"new",
"... | Run a simple query against the attribute when using time only filtering.
@param string $operation The mathematical operation to use for evaluating.
@param string $value The value to match against.
@return array|null
@throws \RuntimeException When the attribute is not a simple one. | [
"Run",
"a",
"simple",
"query",
"against",
"the",
"attribute",
"when",
"using",
"time",
"only",
"filtering",
"."
] | 0d65f4b14f3eceab9e022c79388fbced5e47ed9d | https://github.com/MetaModels/filter_fromto/blob/0d65f4b14f3eceab9e022c79388fbced5e47ed9d/src/FilterRule/FromToDate.php#L99-L118 |
27,540 | cssjanus/php-cssjanus | src/CSSJanus.php | CSSJanus.buildPatterns | private static function buildPatterns() {
if (!is_null(self::$patterns['escape'])) {
// Patterns have already been built
return;
}
// @codingStandardsIgnoreStart Generic.Files.LineLength.TooLong
$patterns =& self::$patterns;
$patterns['escape'] = "(?:{$patterns['unicode']}|\\[^\r\n\f0-9a-f])";
$patte... | php | private static function buildPatterns() {
if (!is_null(self::$patterns['escape'])) {
// Patterns have already been built
return;
}
// @codingStandardsIgnoreStart Generic.Files.LineLength.TooLong
$patterns =& self::$patterns;
$patterns['escape'] = "(?:{$patterns['unicode']}|\\[^\r\n\f0-9a-f])";
$patte... | [
"private",
"static",
"function",
"buildPatterns",
"(",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"self",
"::",
"$",
"patterns",
"[",
"'escape'",
"]",
")",
")",
"{",
"// Patterns have already been built",
"return",
";",
"}",
"// @codingStandardsIgnoreStart Generic.... | Build patterns we can't define above because they depend on other patterns. | [
"Build",
"patterns",
"we",
"can",
"t",
"define",
"above",
"because",
"they",
"depend",
"on",
"other",
"patterns",
"."
] | 44362c7c8aace5c52bd20d917b87e6c1d2d8c5c6 | https://github.com/cssjanus/php-cssjanus/blob/44362c7c8aace5c52bd20d917b87e6c1d2d8c5c6/src/CSSJanus.php#L87-L135 |
27,541 | cssjanus/php-cssjanus | src/CSSJanus.php | CSSJanus.transform | public static function transform($css, $options = array(), $transformEdgeInUrl = false) {
if (!is_array($options)) {
$options = array(
'transformDirInUrl' => (bool)$options,
'transformEdgeInUrl' => (bool)$transformEdgeInUrl,
);
}
// Defaults
$options += array(
'transformDirInUrl' => false,
... | php | public static function transform($css, $options = array(), $transformEdgeInUrl = false) {
if (!is_array($options)) {
$options = array(
'transformDirInUrl' => (bool)$options,
'transformEdgeInUrl' => (bool)$transformEdgeInUrl,
);
}
// Defaults
$options += array(
'transformDirInUrl' => false,
... | [
"public",
"static",
"function",
"transform",
"(",
"$",
"css",
",",
"$",
"options",
"=",
"array",
"(",
")",
",",
"$",
"transformEdgeInUrl",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"options",
")",
")",
"{",
"$",
"options",
"=",
... | Transform an LTR stylesheet to RTL
@param string $css Stylesheet to transform
@param array|bool $options Options array or value of transformDirInUrl option (back-compat)
@param bool $options['transformDirInUrl'] Transform directions in URLs (ltr/rtl). Default: false.
@param bool $options['transformEdgeInUrl'] Transform... | [
"Transform",
"an",
"LTR",
"stylesheet",
"to",
"RTL"
] | 44362c7c8aace5c52bd20d917b87e6c1d2d8c5c6 | https://github.com/cssjanus/php-cssjanus/blob/44362c7c8aace5c52bd20d917b87e6c1d2d8c5c6/src/CSSJanus.php#L146-L202 |
27,542 | cssjanus/php-cssjanus | src/CSSJanus.php | CSSJanus.fixLtrRtlInURL | private static function fixLtrRtlInURL($css) {
$css = preg_replace(self::$patterns['ltr_in_url'], self::$patterns['tmpToken'], $css);
$css = preg_replace(self::$patterns['rtl_in_url'], 'ltr', $css);
$css = str_replace(self::$patterns['tmpToken'], 'rtl', $css);
return $css;
} | php | private static function fixLtrRtlInURL($css) {
$css = preg_replace(self::$patterns['ltr_in_url'], self::$patterns['tmpToken'], $css);
$css = preg_replace(self::$patterns['rtl_in_url'], 'ltr', $css);
$css = str_replace(self::$patterns['tmpToken'], 'rtl', $css);
return $css;
} | [
"private",
"static",
"function",
"fixLtrRtlInURL",
"(",
"$",
"css",
")",
"{",
"$",
"css",
"=",
"preg_replace",
"(",
"self",
"::",
"$",
"patterns",
"[",
"'ltr_in_url'",
"]",
",",
"self",
"::",
"$",
"patterns",
"[",
"'tmpToken'",
"]",
",",
"$",
"css",
")... | Replace 'ltr' with 'rtl' and vice versa in background URLs
@param $css string
@return string | [
"Replace",
"ltr",
"with",
"rtl",
"and",
"vice",
"versa",
"in",
"background",
"URLs"
] | 44362c7c8aace5c52bd20d917b87e6c1d2d8c5c6 | https://github.com/cssjanus/php-cssjanus/blob/44362c7c8aace5c52bd20d917b87e6c1d2d8c5c6/src/CSSJanus.php#L233-L239 |
27,543 | cssjanus/php-cssjanus | src/CSSJanus.php | CSSJanus.fixLeftRightInURL | private static function fixLeftRightInURL($css) {
$css = preg_replace(self::$patterns['left_in_url'], self::$patterns['tmpToken'], $css);
$css = preg_replace(self::$patterns['right_in_url'], 'left', $css);
$css = str_replace(self::$patterns['tmpToken'], 'right', $css);
return $css;
} | php | private static function fixLeftRightInURL($css) {
$css = preg_replace(self::$patterns['left_in_url'], self::$patterns['tmpToken'], $css);
$css = preg_replace(self::$patterns['right_in_url'], 'left', $css);
$css = str_replace(self::$patterns['tmpToken'], 'right', $css);
return $css;
} | [
"private",
"static",
"function",
"fixLeftRightInURL",
"(",
"$",
"css",
")",
"{",
"$",
"css",
"=",
"preg_replace",
"(",
"self",
"::",
"$",
"patterns",
"[",
"'left_in_url'",
"]",
",",
"self",
"::",
"$",
"patterns",
"[",
"'tmpToken'",
"]",
",",
"$",
"css",
... | Replace 'left' with 'right' and vice versa in background URLs
@param $css string
@return string | [
"Replace",
"left",
"with",
"right",
"and",
"vice",
"versa",
"in",
"background",
"URLs"
] | 44362c7c8aace5c52bd20d917b87e6c1d2d8c5c6 | https://github.com/cssjanus/php-cssjanus/blob/44362c7c8aace5c52bd20d917b87e6c1d2d8c5c6/src/CSSJanus.php#L246-L252 |
27,544 | cssjanus/php-cssjanus | src/CSSJanus.php | CSSJanus.fixShadows | private static function fixShadows($css) {
$css = preg_replace_callback(self::$patterns['box_shadow'], function ($matches) {
return $matches[1] . self::flipSign($matches[2]);
}, $css);
$css = preg_replace_callback(self::$patterns['text_shadow1'], function ($matches) {
return $matches[1] . $matches[2] . $ma... | php | private static function fixShadows($css) {
$css = preg_replace_callback(self::$patterns['box_shadow'], function ($matches) {
return $matches[1] . self::flipSign($matches[2]);
}, $css);
$css = preg_replace_callback(self::$patterns['text_shadow1'], function ($matches) {
return $matches[1] . $matches[2] . $ma... | [
"private",
"static",
"function",
"fixShadows",
"(",
"$",
"css",
")",
"{",
"$",
"css",
"=",
"preg_replace_callback",
"(",
"self",
"::",
"$",
"patterns",
"[",
"'box_shadow'",
"]",
",",
"function",
"(",
"$",
"matches",
")",
"{",
"return",
"$",
"matches",
"[... | Negates horizontal offset in box-shadow and text-shadow rules.
@param $css string
@return string | [
"Negates",
"horizontal",
"offset",
"in",
"box",
"-",
"shadow",
"and",
"text",
"-",
"shadow",
"rules",
"."
] | 44362c7c8aace5c52bd20d917b87e6c1d2d8c5c6 | https://github.com/cssjanus/php-cssjanus/blob/44362c7c8aace5c52bd20d917b87e6c1d2d8c5c6/src/CSSJanus.php#L389-L407 |
27,545 | cssjanus/php-cssjanus | src/CSSJanus.php | CSSJanus.fixBackgroundPosition | private static function fixBackgroundPosition($css) {
$replaced = preg_replace_callback(
self::$patterns['bg_horizontal_percentage'],
array('self', 'calculateNewBackgroundPosition'),
$css
);
if ($replaced !== null) {
// preg_replace_callback() sometimes returns null
$css = $replaced;
}
$replace... | php | private static function fixBackgroundPosition($css) {
$replaced = preg_replace_callback(
self::$patterns['bg_horizontal_percentage'],
array('self', 'calculateNewBackgroundPosition'),
$css
);
if ($replaced !== null) {
// preg_replace_callback() sometimes returns null
$css = $replaced;
}
$replace... | [
"private",
"static",
"function",
"fixBackgroundPosition",
"(",
"$",
"css",
")",
"{",
"$",
"replaced",
"=",
"preg_replace_callback",
"(",
"self",
"::",
"$",
"patterns",
"[",
"'bg_horizontal_percentage'",
"]",
",",
"array",
"(",
"'self'",
",",
"'calculateNewBackgrou... | Flip horizontal background percentages.
@param $css string
@return string | [
"Flip",
"horizontal",
"background",
"percentages",
"."
] | 44362c7c8aace5c52bd20d917b87e6c1d2d8c5c6 | https://github.com/cssjanus/php-cssjanus/blob/44362c7c8aace5c52bd20d917b87e6c1d2d8c5c6/src/CSSJanus.php#L432-L452 |
27,546 | nglasl/silverstripe-mediawesome | src/objects/MediaType.php | MediaType.validate | public function validate() {
$result = parent::validate();
// Confirm that the current type has been given a title and doesn't already exist.
if($result->isValid() && !$this->Title) {
$result->addError('"Title" required!');
}
else if($result->isValid() && MediaType::get_one(MediaType::class, array(
'... | php | public function validate() {
$result = parent::validate();
// Confirm that the current type has been given a title and doesn't already exist.
if($result->isValid() && !$this->Title) {
$result->addError('"Title" required!');
}
else if($result->isValid() && MediaType::get_one(MediaType::class, array(
'... | [
"public",
"function",
"validate",
"(",
")",
"{",
"$",
"result",
"=",
"parent",
"::",
"validate",
"(",
")",
";",
"// Confirm that the current type has been given a title and doesn't already exist.",
"if",
"(",
"$",
"result",
"->",
"isValid",
"(",
")",
"&&",
"!",
"$... | Confirm that the current type is valid. | [
"Confirm",
"that",
"the",
"current",
"type",
"is",
"valid",
"."
] | 0537ad9934f69a680cd20115269efed13e082abf | https://github.com/nglasl/silverstripe-mediawesome/blob/0537ad9934f69a680cd20115269efed13e082abf/src/objects/MediaType.php#L105-L125 |
27,547 | dreamfactorysoftware/df-sqldb | src/Resources/StoredFunction.php | StoredFunction.describeFunctions | protected function describeFunctions($names, $refresh = false)
{
$names = static::validateAsArray(
$names,
',',
true,
'The request contains no valid function names or properties.'
);
$out = [];
foreach ($names as $name) {
$... | php | protected function describeFunctions($names, $refresh = false)
{
$names = static::validateAsArray(
$names,
',',
true,
'The request contains no valid function names or properties.'
);
$out = [];
foreach ($names as $name) {
$... | [
"protected",
"function",
"describeFunctions",
"(",
"$",
"names",
",",
"$",
"refresh",
"=",
"false",
")",
"{",
"$",
"names",
"=",
"static",
"::",
"validateAsArray",
"(",
"$",
"names",
",",
"','",
",",
"true",
",",
"'The request contains no valid function names or... | Get multiple functions and their properties
@param string | array $names Function names comma-delimited string or array
@param bool $refresh Force a refresh of the schema from the database
@return array
@throws \Exception | [
"Get",
"multiple",
"functions",
"and",
"their",
"properties"
] | f5b6c45fae068db5043419405299bfbc928fa90b | https://github.com/dreamfactorysoftware/df-sqldb/blob/f5b6c45fae068db5043419405299bfbc928fa90b/src/Resources/StoredFunction.php#L270-L285 |
27,548 | dreamfactorysoftware/df-sqldb | src/Resources/StoredFunction.php | StoredFunction.describeFunction | protected function describeFunction($name, $refresh = false)
{
$name = (is_array($name) ? array_get($name, 'name') : $name);
if (empty($name)) {
throw new BadRequestException('Function name can not be empty.');
}
$this->checkPermission(Verbs::GET, $name);
try {
... | php | protected function describeFunction($name, $refresh = false)
{
$name = (is_array($name) ? array_get($name, 'name') : $name);
if (empty($name)) {
throw new BadRequestException('Function name can not be empty.');
}
$this->checkPermission(Verbs::GET, $name);
try {
... | [
"protected",
"function",
"describeFunction",
"(",
"$",
"name",
",",
"$",
"refresh",
"=",
"false",
")",
"{",
"$",
"name",
"=",
"(",
"is_array",
"(",
"$",
"name",
")",
"?",
"array_get",
"(",
"$",
"name",
",",
"'name'",
")",
":",
"$",
"name",
")",
";"... | Get any properties related to the function
@param string | array $name Function name or defining properties
@param bool $refresh Force a refresh of the schema from the database
@return array
@throws \Exception | [
"Get",
"any",
"properties",
"related",
"to",
"the",
"function"
] | f5b6c45fae068db5043419405299bfbc928fa90b | https://github.com/dreamfactorysoftware/df-sqldb/blob/f5b6c45fae068db5043419405299bfbc928fa90b/src/Resources/StoredFunction.php#L296-L316 |
27,549 | rtconner/laravel-likeable | src/LikeCounter.php | LikeCounter.rebuild | public static function rebuild($modelClass)
{
if(empty($modelClass)) {
throw new \Exception('$modelClass cannot be empty/null. Maybe set the $morphClass variable on your model.');
}
$builder = Like::query()
->select(\DB::raw('count(*) as count, likeable_type, likeable_id'))
->where('likeable_type', $... | php | public static function rebuild($modelClass)
{
if(empty($modelClass)) {
throw new \Exception('$modelClass cannot be empty/null. Maybe set the $morphClass variable on your model.');
}
$builder = Like::query()
->select(\DB::raw('count(*) as count, likeable_type, likeable_id'))
->where('likeable_type', $... | [
"public",
"static",
"function",
"rebuild",
"(",
"$",
"modelClass",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"modelClass",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'$modelClass cannot be empty/null. Maybe set the $morphClass variable on your model.'",
")"... | Delete all counts of the given model, and recount them and insert new counts
@param string $model (should match Model::$morphClass) | [
"Delete",
"all",
"counts",
"of",
"the",
"given",
"model",
"and",
"recount",
"them",
"and",
"insert",
"new",
"counts"
] | d3b61686703a23a4aa61f593e55bc10b87f60621 | https://github.com/rtconner/laravel-likeable/blob/d3b61686703a23a4aa61f593e55bc10b87f60621/src/LikeCounter.php#L23-L39 |
27,550 | rtconner/laravel-likeable | src/Likeable.php | Likeable.like | public function like($userId=null)
{
if(is_null($userId)) {
$userId = $this->loggedInUserId();
}
if($userId) {
$like = $this->likes()
->where('user_id', '=', $userId)
->first();
if($like) return;
$like = new Like();
$like->user_id = $userId;
$this->likes()->save($like);
}
$t... | php | public function like($userId=null)
{
if(is_null($userId)) {
$userId = $this->loggedInUserId();
}
if($userId) {
$like = $this->likes()
->where('user_id', '=', $userId)
->first();
if($like) return;
$like = new Like();
$like->user_id = $userId;
$this->likes()->save($like);
}
$t... | [
"public",
"function",
"like",
"(",
"$",
"userId",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"userId",
")",
")",
"{",
"$",
"userId",
"=",
"$",
"this",
"->",
"loggedInUserId",
"(",
")",
";",
"}",
"if",
"(",
"$",
"userId",
")",
"{",
"... | Add a like for this record by the given user.
@param $userId mixed - If null will use currently logged in user. | [
"Add",
"a",
"like",
"for",
"this",
"record",
"by",
"the",
"given",
"user",
"."
] | d3b61686703a23a4aa61f593e55bc10b87f60621 | https://github.com/rtconner/laravel-likeable/blob/d3b61686703a23a4aa61f593e55bc10b87f60621/src/Likeable.php#L69-L88 |
27,551 | rtconner/laravel-likeable | src/Likeable.php | Likeable.liked | public function liked($userId=null)
{
if(is_null($userId)) {
$userId = $this->loggedInUserId();
}
return (bool) $this->likes()
->where('user_id', '=', $userId)
->count();
} | php | public function liked($userId=null)
{
if(is_null($userId)) {
$userId = $this->loggedInUserId();
}
return (bool) $this->likes()
->where('user_id', '=', $userId)
->count();
} | [
"public",
"function",
"liked",
"(",
"$",
"userId",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"userId",
")",
")",
"{",
"$",
"userId",
"=",
"$",
"this",
"->",
"loggedInUserId",
"(",
")",
";",
"}",
"return",
"(",
"bool",
")",
"$",
"this... | Has the currently logged in user already "liked" the current object
@param string $userId
@return boolean | [
"Has",
"the",
"currently",
"logged",
"in",
"user",
"already",
"liked",
"the",
"current",
"object"
] | d3b61686703a23a4aa61f593e55bc10b87f60621 | https://github.com/rtconner/laravel-likeable/blob/d3b61686703a23a4aa61f593e55bc10b87f60621/src/Likeable.php#L119-L128 |
27,552 | rtconner/laravel-likeable | src/Likeable.php | Likeable.incrementLikeCount | private function incrementLikeCount()
{
$counter = $this->likeCounter()->first();
if($counter) {
$counter->count++;
$counter->save();
} else {
$counter = new LikeCounter;
$counter->count = 1;
$this->likeCounter()->save($counter);
}
} | php | private function incrementLikeCount()
{
$counter = $this->likeCounter()->first();
if($counter) {
$counter->count++;
$counter->save();
} else {
$counter = new LikeCounter;
$counter->count = 1;
$this->likeCounter()->save($counter);
}
} | [
"private",
"function",
"incrementLikeCount",
"(",
")",
"{",
"$",
"counter",
"=",
"$",
"this",
"->",
"likeCounter",
"(",
")",
"->",
"first",
"(",
")",
";",
"if",
"(",
"$",
"counter",
")",
"{",
"$",
"counter",
"->",
"count",
"++",
";",
"$",
"counter",
... | Private. Increment the total like count stored in the counter | [
"Private",
".",
"Increment",
"the",
"total",
"like",
"count",
"stored",
"in",
"the",
"counter"
] | d3b61686703a23a4aa61f593e55bc10b87f60621 | https://github.com/rtconner/laravel-likeable/blob/d3b61686703a23a4aa61f593e55bc10b87f60621/src/Likeable.php#L133-L145 |
27,553 | rtconner/laravel-likeable | src/Likeable.php | Likeable.decrementLikeCount | private function decrementLikeCount()
{
$counter = $this->likeCounter()->first();
if($counter) {
$counter->count--;
if($counter->count) {
$counter->save();
} else {
$counter->delete();
}
}
} | php | private function decrementLikeCount()
{
$counter = $this->likeCounter()->first();
if($counter) {
$counter->count--;
if($counter->count) {
$counter->save();
} else {
$counter->delete();
}
}
} | [
"private",
"function",
"decrementLikeCount",
"(",
")",
"{",
"$",
"counter",
"=",
"$",
"this",
"->",
"likeCounter",
"(",
")",
"->",
"first",
"(",
")",
";",
"if",
"(",
"$",
"counter",
")",
"{",
"$",
"counter",
"->",
"count",
"--",
";",
"if",
"(",
"$"... | Private. Decrement the total like count stored in the counter | [
"Private",
".",
"Decrement",
"the",
"total",
"like",
"count",
"stored",
"in",
"the",
"counter"
] | d3b61686703a23a4aa61f593e55bc10b87f60621 | https://github.com/rtconner/laravel-likeable/blob/d3b61686703a23a4aa61f593e55bc10b87f60621/src/Likeable.php#L150-L162 |
27,554 | rtconner/laravel-likeable | src/Likeable.php | Likeable.removeLikes | public function removeLikes()
{
Like::where('likeable_type', $this->morphClass)->where('likeable_id', $this->id)->delete();
LikeCounter::where('likeable_type', $this->morphClass)->where('likeable_id', $this->id)->delete();
} | php | public function removeLikes()
{
Like::where('likeable_type', $this->morphClass)->where('likeable_id', $this->id)->delete();
LikeCounter::where('likeable_type', $this->morphClass)->where('likeable_id', $this->id)->delete();
} | [
"public",
"function",
"removeLikes",
"(",
")",
"{",
"Like",
"::",
"where",
"(",
"'likeable_type'",
",",
"$",
"this",
"->",
"morphClass",
")",
"->",
"where",
"(",
"'likeable_id'",
",",
"$",
"this",
"->",
"id",
")",
"->",
"delete",
"(",
")",
";",
"LikeCo... | Delete likes related to the current record | [
"Delete",
"likes",
"related",
"to",
"the",
"current",
"record"
] | d3b61686703a23a4aa61f593e55bc10b87f60621 | https://github.com/rtconner/laravel-likeable/blob/d3b61686703a23a4aa61f593e55bc10b87f60621/src/Likeable.php#L197-L202 |
27,555 | rinvex/cortex-auth-b2b2c2 | src/Http/Controllers/Managerarea/ManagersController.php | ManagersController.import | public function import(Manager $manager, ImportRecordsDataTable $importRecordsDataTable)
{
return $importRecordsDataTable->with([
'resource' => $manager,
'tabs' => 'managerarea.attributes.tabs',
'url' => route('managerarea.attributes.stash'),
'id' => "managera... | php | public function import(Manager $manager, ImportRecordsDataTable $importRecordsDataTable)
{
return $importRecordsDataTable->with([
'resource' => $manager,
'tabs' => 'managerarea.attributes.tabs',
'url' => route('managerarea.attributes.stash'),
'id' => "managera... | [
"public",
"function",
"import",
"(",
"Manager",
"$",
"manager",
",",
"ImportRecordsDataTable",
"$",
"importRecordsDataTable",
")",
"{",
"return",
"$",
"importRecordsDataTable",
"->",
"with",
"(",
"[",
"'resource'",
"=>",
"$",
"manager",
",",
"'tabs'",
"=>",
"'ma... | Import managers.
@param \Cortex\Auth\Models\Manager $manager
@param \Cortex\Foundation\DataTables\ImportRecordsDataTable $importRecordsDataTable
@return \Illuminate\View\View | [
"Import",
"managers",
"."
] | 3152b5314f77910656ddaddfd1bf7aa8e2517905 | https://github.com/rinvex/cortex-auth-b2b2c2/blob/3152b5314f77910656ddaddfd1bf7aa8e2517905/src/Http/Controllers/Managerarea/ManagersController.php#L119-L127 |
27,556 | laravie/codex | src/Support/Versioning.php | Versioning.proxyRequestViaVersion | protected function proxyRequestViaVersion(string $swapVersion, callable $callback): Response
{
$version = $this->version;
try {
$this->version = $swapVersion;
return \call_user_func($callback);
} finally {
$this->version = $version;
}
} | php | protected function proxyRequestViaVersion(string $swapVersion, callable $callback): Response
{
$version = $this->version;
try {
$this->version = $swapVersion;
return \call_user_func($callback);
} finally {
$this->version = $version;
}
} | [
"protected",
"function",
"proxyRequestViaVersion",
"(",
"string",
"$",
"swapVersion",
",",
"callable",
"$",
"callback",
")",
":",
"Response",
"{",
"$",
"version",
"=",
"$",
"this",
"->",
"version",
";",
"try",
"{",
"$",
"this",
"->",
"version",
"=",
"$",
... | Proxy route to response via other version.
@param string $swapVersion
@param callable $callback
@return \Laravie\Codex\Contracts\Response | [
"Proxy",
"route",
"to",
"response",
"via",
"other",
"version",
"."
] | 4d813bcbe20e7cf0b6c0cb98d3b077a070285709 | https://github.com/laravie/codex/blob/4d813bcbe20e7cf0b6c0cb98d3b077a070285709/src/Support/Versioning.php#L27-L38 |
27,557 | rinvex/cortex-auth-b2b2c2 | src/Http/Controllers/Frontarea/PhoneVerificationController.php | PhoneVerificationController.send | public function send(PhoneVerificationSendRequest $request)
{
$user = $request->user($this->getGuard())
?? $request->attemptUser($this->getGuard())
?? app('cortex.auth.member')->whereNotNull('phone')->where('phone', $request->input('phone'))->first();
$user->sendP... | php | public function send(PhoneVerificationSendRequest $request)
{
$user = $request->user($this->getGuard())
?? $request->attemptUser($this->getGuard())
?? app('cortex.auth.member')->whereNotNull('phone')->where('phone', $request->input('phone'))->first();
$user->sendP... | [
"public",
"function",
"send",
"(",
"PhoneVerificationSendRequest",
"$",
"request",
")",
"{",
"$",
"user",
"=",
"$",
"request",
"->",
"user",
"(",
"$",
"this",
"->",
"getGuard",
"(",
")",
")",
"??",
"$",
"request",
"->",
"attemptUser",
"(",
"$",
"this",
... | Process the phone verification request form.
@param \Cortex\Auth\B2B2C2\Http\Requests\Frontarea\PhoneVerificationSendRequest $request
@return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse | [
"Process",
"the",
"phone",
"verification",
"request",
"form",
"."
] | 3152b5314f77910656ddaddfd1bf7aa8e2517905 | https://github.com/rinvex/cortex-auth-b2b2c2/blob/3152b5314f77910656ddaddfd1bf7aa8e2517905/src/Http/Controllers/Frontarea/PhoneVerificationController.php#L37-L49 |
27,558 | rinvex/cortex-auth-b2b2c2 | src/Http/Controllers/Frontarea/PhoneVerificationController.php | PhoneVerificationController.process | public function process(PhoneVerificationProcessRequest $request)
{
// Guest trying to authenticate through TwoFactor
if (($attemptUser = $request->attemptUser($this->getGuard())) && $this->attemptTwoFactor($attemptUser, $request->get('token'))) {
auth()->guard($this->getGuard())->login(... | php | public function process(PhoneVerificationProcessRequest $request)
{
// Guest trying to authenticate through TwoFactor
if (($attemptUser = $request->attemptUser($this->getGuard())) && $this->attemptTwoFactor($attemptUser, $request->get('token'))) {
auth()->guard($this->getGuard())->login(... | [
"public",
"function",
"process",
"(",
"PhoneVerificationProcessRequest",
"$",
"request",
")",
"{",
"// Guest trying to authenticate through TwoFactor",
"if",
"(",
"(",
"$",
"attemptUser",
"=",
"$",
"request",
"->",
"attemptUser",
"(",
"$",
"this",
"->",
"getGuard",
... | Process the phone verification form.
@param \Cortex\Auth\B2B2C2\Http\Requests\Frontarea\PhoneVerificationProcessRequest $request
@return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse | [
"Process",
"the",
"phone",
"verification",
"form",
"."
] | 3152b5314f77910656ddaddfd1bf7aa8e2517905 | https://github.com/rinvex/cortex-auth-b2b2c2/blob/3152b5314f77910656ddaddfd1bf7aa8e2517905/src/Http/Controllers/Frontarea/PhoneVerificationController.php#L70-L100 |
27,559 | rinvex/cortex-auth-b2b2c2 | src/Http/Controllers/Tenantarea/AccountMediaController.php | AccountMediaController.destroy | public function destroy(Member $member, Media $media)
{
$member->media()->where($media->getKeyName(), $media->getKey())->first()->delete();
return intend([
'url' => route('frontarea.account.settings'),
'with' => [
'warning' => trans('cortex/foundation::messag... | php | public function destroy(Member $member, Media $media)
{
$member->media()->where($media->getKeyName(), $media->getKey())->first()->delete();
return intend([
'url' => route('frontarea.account.settings'),
'with' => [
'warning' => trans('cortex/foundation::messag... | [
"public",
"function",
"destroy",
"(",
"Member",
"$",
"member",
",",
"Media",
"$",
"media",
")",
"{",
"$",
"member",
"->",
"media",
"(",
")",
"->",
"where",
"(",
"$",
"media",
"->",
"getKeyName",
"(",
")",
",",
"$",
"media",
"->",
"getKey",
"(",
")"... | Destroy given member media.
@param \Cortex\Auth\Models\Member $member
@param \Spatie\MediaLibrary\Models\Media $media
@return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse | [
"Destroy",
"given",
"member",
"media",
"."
] | 3152b5314f77910656ddaddfd1bf7aa8e2517905 | https://github.com/rinvex/cortex-auth-b2b2c2/blob/3152b5314f77910656ddaddfd1bf7aa8e2517905/src/Http/Controllers/Tenantarea/AccountMediaController.php#L21-L34 |
27,560 | laravie/codex | src/Client.php | Client.useVersion | public function useVersion(string $version)
{
if (! \array_key_exists($version, $this->supportedVersions)) {
throw new InvalidArgumentException("API version [{$version}] is not supported.");
}
$this->defaultVersion = $version;
return $this;
} | php | public function useVersion(string $version)
{
if (! \array_key_exists($version, $this->supportedVersions)) {
throw new InvalidArgumentException("API version [{$version}] is not supported.");
}
$this->defaultVersion = $version;
return $this;
} | [
"public",
"function",
"useVersion",
"(",
"string",
"$",
"version",
")",
"{",
"if",
"(",
"!",
"\\",
"array_key_exists",
"(",
"$",
"version",
",",
"$",
"this",
"->",
"supportedVersions",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"API ve... | Use different API version.
@param string $version
@throws \InvalidArgumentException
@return $this | [
"Use",
"different",
"API",
"version",
"."
] | 4d813bcbe20e7cf0b6c0cb98d3b077a070285709 | https://github.com/laravie/codex/blob/4d813bcbe20e7cf0b6c0cb98d3b077a070285709/src/Client.php#L65-L74 |
27,561 | rinvex/cortex-auth-b2b2c2 | src/Http/Controllers/Tenantarea/EmailVerificationController.php | EmailVerificationController.send | public function send(EmailVerificationSendRequest $request)
{
$result = app('rinvex.auth.emailverification')
->broker($this->getEmailVerificationBroker())
->sendVerificationLink($request->only(['email']));
switch ($result) {
case EmailVerificationBrokerContract::... | php | public function send(EmailVerificationSendRequest $request)
{
$result = app('rinvex.auth.emailverification')
->broker($this->getEmailVerificationBroker())
->sendVerificationLink($request->only(['email']));
switch ($result) {
case EmailVerificationBrokerContract::... | [
"public",
"function",
"send",
"(",
"EmailVerificationSendRequest",
"$",
"request",
")",
"{",
"$",
"result",
"=",
"app",
"(",
"'rinvex.auth.emailverification'",
")",
"->",
"broker",
"(",
"$",
"this",
"->",
"getEmailVerificationBroker",
"(",
")",
")",
"->",
"sendV... | Process the email verification request form.
@param \Cortex\Auth\B2B2C2\Http\Requests\Tenantarea\EmailVerificationSendRequest $request
@return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse | [
"Process",
"the",
"email",
"verification",
"request",
"form",
"."
] | 3152b5314f77910656ddaddfd1bf7aa8e2517905 | https://github.com/rinvex/cortex-auth-b2b2c2/blob/3152b5314f77910656ddaddfd1bf7aa8e2517905/src/Http/Controllers/Tenantarea/EmailVerificationController.php#L34-L55 |
27,562 | rinvex/cortex-auth-b2b2c2 | src/Http/Controllers/Tenantarea/EmailVerificationController.php | EmailVerificationController.verify | public function verify(EmailVerificationProcessRequest $request)
{
$result = app('rinvex.auth.emailverification')
->broker($this->getEmailVerificationBroker())
->verify($request->only(['email', 'expiration', 'token']), function ($user) {
$user->fill([
... | php | public function verify(EmailVerificationProcessRequest $request)
{
$result = app('rinvex.auth.emailverification')
->broker($this->getEmailVerificationBroker())
->verify($request->only(['email', 'expiration', 'token']), function ($user) {
$user->fill([
... | [
"public",
"function",
"verify",
"(",
"EmailVerificationProcessRequest",
"$",
"request",
")",
"{",
"$",
"result",
"=",
"app",
"(",
"'rinvex.auth.emailverification'",
")",
"->",
"broker",
"(",
"$",
"this",
"->",
"getEmailVerificationBroker",
"(",
")",
")",
"->",
"... | Process the email verification.
@param \Cortex\Auth\B2B2C2\Http\Requests\Tenantarea\EmailVerificationProcessRequest $request
@return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse | [
"Process",
"the",
"email",
"verification",
"."
] | 3152b5314f77910656ddaddfd1bf7aa8e2517905 | https://github.com/rinvex/cortex-auth-b2b2c2/blob/3152b5314f77910656ddaddfd1bf7aa8e2517905/src/Http/Controllers/Tenantarea/EmailVerificationController.php#L64-L91 |
27,563 | contributte/cache | src/Storages/MemoryAdapterStorage.php | MemoryAdapterStorage.read | public function read($key)
{
// Get data from memory storage
$data = $this->memoryStorage->read($key);
if ($data !== null) {
return $data;
}
// Get data from cached storage and write them to memory storage
$data = $this->cachedStorage->read($key);
if ($data !== null) {
$this->memoryStorage->write(... | php | public function read($key)
{
// Get data from memory storage
$data = $this->memoryStorage->read($key);
if ($data !== null) {
return $data;
}
// Get data from cached storage and write them to memory storage
$data = $this->cachedStorage->read($key);
if ($data !== null) {
$this->memoryStorage->write(... | [
"public",
"function",
"read",
"(",
"$",
"key",
")",
"{",
"// Get data from memory storage",
"$",
"data",
"=",
"$",
"this",
"->",
"memoryStorage",
"->",
"read",
"(",
"$",
"key",
")",
";",
"if",
"(",
"$",
"data",
"!==",
"null",
")",
"{",
"return",
"$",
... | Read from cache.
@param string $key
@return mixed|null
@phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint | [
"Read",
"from",
"cache",
"."
] | ac4e8ee28cc23e21ac1e9aabef323d88f8beb15e | https://github.com/contributte/cache/blob/ac4e8ee28cc23e21ac1e9aabef323d88f8beb15e/src/Storages/MemoryAdapterStorage.php#L30-L45 |
27,564 | contributte/cache | src/Storages/MemoryAdapterStorage.php | MemoryAdapterStorage.write | public function write($key, $data, array $dependencies): void
{
$this->cachedStorage->write($key, $data, $dependencies);
$this->memoryStorage->write($key, $data, $dependencies);
} | php | public function write($key, $data, array $dependencies): void
{
$this->cachedStorage->write($key, $data, $dependencies);
$this->memoryStorage->write($key, $data, $dependencies);
} | [
"public",
"function",
"write",
"(",
"$",
"key",
",",
"$",
"data",
",",
"array",
"$",
"dependencies",
")",
":",
"void",
"{",
"$",
"this",
"->",
"cachedStorage",
"->",
"write",
"(",
"$",
"key",
",",
"$",
"data",
",",
"$",
"dependencies",
")",
";",
"$... | Writes item into the cache.
@param string $key
@param mixed $data
@param mixed[] $dependencies
@phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint | [
"Writes",
"item",
"into",
"the",
"cache",
"."
] | ac4e8ee28cc23e21ac1e9aabef323d88f8beb15e | https://github.com/contributte/cache/blob/ac4e8ee28cc23e21ac1e9aabef323d88f8beb15e/src/Storages/MemoryAdapterStorage.php#L67-L71 |
27,565 | contributte/cache | src/Storages/MemoryAdapterStorage.php | MemoryAdapterStorage.remove | public function remove($key): void
{
$this->cachedStorage->remove($key);
$this->memoryStorage->remove($key);
} | php | public function remove($key): void
{
$this->cachedStorage->remove($key);
$this->memoryStorage->remove($key);
} | [
"public",
"function",
"remove",
"(",
"$",
"key",
")",
":",
"void",
"{",
"$",
"this",
"->",
"cachedStorage",
"->",
"remove",
"(",
"$",
"key",
")",
";",
"$",
"this",
"->",
"memoryStorage",
"->",
"remove",
"(",
"$",
"key",
")",
";",
"}"
] | Removes item from the cache.
@param string $key
@phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint | [
"Removes",
"item",
"from",
"the",
"cache",
"."
] | ac4e8ee28cc23e21ac1e9aabef323d88f8beb15e | https://github.com/contributte/cache/blob/ac4e8ee28cc23e21ac1e9aabef323d88f8beb15e/src/Storages/MemoryAdapterStorage.php#L79-L83 |
27,566 | contributte/cache | src/Storages/MemoryAdapterStorage.php | MemoryAdapterStorage.clean | public function clean(array $conditions): void
{
$this->cachedStorage->clean($conditions);
$this->memoryStorage->clean($conditions);
} | php | public function clean(array $conditions): void
{
$this->cachedStorage->clean($conditions);
$this->memoryStorage->clean($conditions);
} | [
"public",
"function",
"clean",
"(",
"array",
"$",
"conditions",
")",
":",
"void",
"{",
"$",
"this",
"->",
"cachedStorage",
"->",
"clean",
"(",
"$",
"conditions",
")",
";",
"$",
"this",
"->",
"memoryStorage",
"->",
"clean",
"(",
"$",
"conditions",
")",
... | Removes items from the cache by conditions.
@param mixed[] $conditions | [
"Removes",
"items",
"from",
"the",
"cache",
"by",
"conditions",
"."
] | ac4e8ee28cc23e21ac1e9aabef323d88f8beb15e | https://github.com/contributte/cache/blob/ac4e8ee28cc23e21ac1e9aabef323d88f8beb15e/src/Storages/MemoryAdapterStorage.php#L90-L94 |
27,567 | swoft-cloud/swoft-rpc-client | src/Service/ServiceProxy.php | ServiceProxy.getMethodsTemplate | private static function getMethodsTemplate(array $reflectionMethods): string
{
$template = "";
foreach ($reflectionMethods as $reflectionMethod) {
$methodName = $reflectionMethod->getName();
// not to overrided method
if ($reflectionMethod->isConstructor() || $re... | php | private static function getMethodsTemplate(array $reflectionMethods): string
{
$template = "";
foreach ($reflectionMethods as $reflectionMethod) {
$methodName = $reflectionMethod->getName();
// not to overrided method
if ($reflectionMethod->isConstructor() || $re... | [
"private",
"static",
"function",
"getMethodsTemplate",
"(",
"array",
"$",
"reflectionMethods",
")",
":",
"string",
"{",
"$",
"template",
"=",
"\"\"",
";",
"foreach",
"(",
"$",
"reflectionMethods",
"as",
"$",
"reflectionMethod",
")",
"{",
"$",
"methodName",
"="... | return template of method
@param \ReflectionMethod[] $reflectionMethods
@return string | [
"return",
"template",
"of",
"method"
] | f163834c9db7c1d45643347a49232152e42cd64a | https://github.com/swoft-cloud/swoft-rpc-client/blob/f163834c9db7c1d45643347a49232152e42cd64a/src/Service/ServiceProxy.php#L37-L71 |
27,568 | rinvex/cortex-auth-b2b2c2 | src/Http/Controllers/Tenantarea/SocialAuthenticationController.php | SocialAuthenticationController.createLocalUser | protected function createLocalUser(string $provider, array $attributes)
{
$localUser = app('cortex.auth.member');
$attributes['password'] = str_random();
$attributes['email_verified_at'] = now();
$attributes['is_active'] = ! config('cortex.auth.registration.moderated');
$lo... | php | protected function createLocalUser(string $provider, array $attributes)
{
$localUser = app('cortex.auth.member');
$attributes['password'] = str_random();
$attributes['email_verified_at'] = now();
$attributes['is_active'] = ! config('cortex.auth.registration.moderated');
$lo... | [
"protected",
"function",
"createLocalUser",
"(",
"string",
"$",
"provider",
",",
"array",
"$",
"attributes",
")",
"{",
"$",
"localUser",
"=",
"app",
"(",
"'cortex.auth.member'",
")",
";",
"$",
"attributes",
"[",
"'password'",
"]",
"=",
"str_random",
"(",
")"... | Create local user for the given provider.
@param string $provider
@param array $attributes
@return \Illuminate\Database\Eloquent\Model|null | [
"Create",
"local",
"user",
"for",
"the",
"given",
"provider",
"."
] | 3152b5314f77910656ddaddfd1bf7aa8e2517905 | https://github.com/rinvex/cortex-auth-b2b2c2/blob/3152b5314f77910656ddaddfd1bf7aa8e2517905/src/Http/Controllers/Tenantarea/SocialAuthenticationController.php#L106-L125 |
27,569 | rinvex/cortex-auth-b2b2c2 | src/Http/Controllers/Managerarea/RolesController.php | RolesController.import | public function import(Role $role, ImportRecordsDataTable $importRecordsDataTable)
{
return $importRecordsDataTable->with([
'resource' => $role,
'tabs' => 'managerarea.roles.tabs',
'url' => route('managerarea.roles.stash'),
'id' => "managerarea-roles-{$role->g... | php | public function import(Role $role, ImportRecordsDataTable $importRecordsDataTable)
{
return $importRecordsDataTable->with([
'resource' => $role,
'tabs' => 'managerarea.roles.tabs',
'url' => route('managerarea.roles.stash'),
'id' => "managerarea-roles-{$role->g... | [
"public",
"function",
"import",
"(",
"Role",
"$",
"role",
",",
"ImportRecordsDataTable",
"$",
"importRecordsDataTable",
")",
"{",
"return",
"$",
"importRecordsDataTable",
"->",
"with",
"(",
"[",
"'resource'",
"=>",
"$",
"role",
",",
"'tabs'",
"=>",
"'managerarea... | Import roles.
@param \Cortex\Auth\Models\Role $role
@param \Cortex\Foundation\DataTables\ImportRecordsDataTable $importRecordsDataTable
@return \Illuminate\View\View | [
"Import",
"roles",
"."
] | 3152b5314f77910656ddaddfd1bf7aa8e2517905 | https://github.com/rinvex/cortex-auth-b2b2c2/blob/3152b5314f77910656ddaddfd1bf7aa8e2517905/src/Http/Controllers/Managerarea/RolesController.php#L67-L75 |
27,570 | rinvex/cortex-auth-b2b2c2 | src/Http/Controllers/Managerarea/RolesController.php | RolesController.destroy | public function destroy(Role $role)
{
$role->delete();
return intend([
'url' => route('managerarea.roles.index'),
'with' => ['warning' => trans('cortex/foundation::messages.resource_deleted', ['resource' => trans('cortex/auth::common.role'), 'identifier' => $role->title])],
... | php | public function destroy(Role $role)
{
$role->delete();
return intend([
'url' => route('managerarea.roles.index'),
'with' => ['warning' => trans('cortex/foundation::messages.resource_deleted', ['resource' => trans('cortex/auth::common.role'), 'identifier' => $role->title])],
... | [
"public",
"function",
"destroy",
"(",
"Role",
"$",
"role",
")",
"{",
"$",
"role",
"->",
"delete",
"(",
")",
";",
"return",
"intend",
"(",
"[",
"'url'",
"=>",
"route",
"(",
"'managerarea.roles.index'",
")",
",",
"'with'",
"=>",
"[",
"'warning'",
"=>",
"... | Destroy given role.
@param \Cortex\Auth\Models\Role $role
@throws \Exception
@return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse | [
"Destroy",
"given",
"role",
"."
] | 3152b5314f77910656ddaddfd1bf7aa8e2517905 | https://github.com/rinvex/cortex-auth-b2b2c2/blob/3152b5314f77910656ddaddfd1bf7aa8e2517905/src/Http/Controllers/Managerarea/RolesController.php#L237-L245 |
27,571 | rinvex/cortex-auth-b2b2c2 | src/Http/Controllers/Tenantarea/PasswordResetController.php | PasswordResetController.send | public function send(PasswordResetSendRequest $request)
{
$result = app('auth.password')
->broker($this->getPasswordResetBroker())
->sendResetLink($request->only(['email']));
switch ($result) {
case PasswordResetBrokerContract::RESET_LINK_SENT:
re... | php | public function send(PasswordResetSendRequest $request)
{
$result = app('auth.password')
->broker($this->getPasswordResetBroker())
->sendResetLink($request->only(['email']));
switch ($result) {
case PasswordResetBrokerContract::RESET_LINK_SENT:
re... | [
"public",
"function",
"send",
"(",
"PasswordResetSendRequest",
"$",
"request",
")",
"{",
"$",
"result",
"=",
"app",
"(",
"'auth.password'",
")",
"->",
"broker",
"(",
"$",
"this",
"->",
"getPasswordResetBroker",
"(",
")",
")",
"->",
"sendResetLink",
"(",
"$",... | Process the password reset request form.
@param \Cortex\Auth\B2B2C2\Http\Requests\Tenantarea\PasswordResetSendRequest $request
@return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse | [
"Process",
"the",
"password",
"reset",
"request",
"form",
"."
] | 3152b5314f77910656ddaddfd1bf7aa8e2517905 | https://github.com/rinvex/cortex-auth-b2b2c2/blob/3152b5314f77910656ddaddfd1bf7aa8e2517905/src/Http/Controllers/Tenantarea/PasswordResetController.php#L35-L56 |
27,572 | rinvex/cortex-auth-b2b2c2 | src/Http/Controllers/Tenantarea/PasswordResetController.php | PasswordResetController.process | public function process(PasswordResetPostProcessRequest $request)
{
$result = app('auth.password')
->broker($this->getPasswordResetBroker())
->reset($request->only(['email', 'expiration', 'token', 'password', 'password_confirmation']), function ($user, $password) {
$u... | php | public function process(PasswordResetPostProcessRequest $request)
{
$result = app('auth.password')
->broker($this->getPasswordResetBroker())
->reset($request->only(['email', 'expiration', 'token', 'password', 'password_confirmation']), function ($user, $password) {
$u... | [
"public",
"function",
"process",
"(",
"PasswordResetPostProcessRequest",
"$",
"request",
")",
"{",
"$",
"result",
"=",
"app",
"(",
"'auth.password'",
")",
"->",
"broker",
"(",
"$",
"this",
"->",
"getPasswordResetBroker",
"(",
")",
")",
"->",
"reset",
"(",
"$... | Process the password reset form.
@param \Cortex\Auth\B2B2C2\Http\Requests\Tenantarea\PasswordResetPostProcessRequest $request
@return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse | [
"Process",
"the",
"password",
"reset",
"form",
"."
] | 3152b5314f77910656ddaddfd1bf7aa8e2517905 | https://github.com/rinvex/cortex-auth-b2b2c2/blob/3152b5314f77910656ddaddfd1bf7aa8e2517905/src/Http/Controllers/Tenantarea/PasswordResetController.php#L79-L108 |
27,573 | rinvex/cortex-auth-b2b2c2 | src/Http/Controllers/Adminarea/MembersController.php | MembersController.import | public function import(Member $member, ImportRecordsDataTable $importRecordsDataTable)
{
return $importRecordsDataTable->with([
'resource' => $member,
'tabs' => 'adminarea.attributes.tabs',
'url' => route('adminarea.members.stash'),
'id' => "adminarea-attribut... | php | public function import(Member $member, ImportRecordsDataTable $importRecordsDataTable)
{
return $importRecordsDataTable->with([
'resource' => $member,
'tabs' => 'adminarea.attributes.tabs',
'url' => route('adminarea.members.stash'),
'id' => "adminarea-attribut... | [
"public",
"function",
"import",
"(",
"Member",
"$",
"member",
",",
"ImportRecordsDataTable",
"$",
"importRecordsDataTable",
")",
"{",
"return",
"$",
"importRecordsDataTable",
"->",
"with",
"(",
"[",
"'resource'",
"=>",
"$",
"member",
",",
"'tabs'",
"=>",
"'admin... | Import members.
@param \Cortex\Auth\Models\Member $member
@param \Cortex\Foundation\DataTables\ImportRecordsDataTable $importRecordsDataTable
@return \Illuminate\View\View | [
"Import",
"members",
"."
] | 3152b5314f77910656ddaddfd1bf7aa8e2517905 | https://github.com/rinvex/cortex-auth-b2b2c2/blob/3152b5314f77910656ddaddfd1bf7aa8e2517905/src/Http/Controllers/Adminarea/MembersController.php#L119-L127 |
27,574 | rinvex/cortex-auth-b2b2c2 | src/Http/Controllers/Managerarea/MembersController.php | MembersController.destroy | public function destroy(Member $member)
{
$member->delete();
return intend([
'url' => route('managerarea.members.index'),
'with' => ['warning' => trans('cortex/foundation::messages.resource_deleted', ['resource' => trans('cortex/auth::common.member'), 'identifier' => $member... | php | public function destroy(Member $member)
{
$member->delete();
return intend([
'url' => route('managerarea.members.index'),
'with' => ['warning' => trans('cortex/foundation::messages.resource_deleted', ['resource' => trans('cortex/auth::common.member'), 'identifier' => $member... | [
"public",
"function",
"destroy",
"(",
"Member",
"$",
"member",
")",
"{",
"$",
"member",
"->",
"delete",
"(",
")",
";",
"return",
"intend",
"(",
"[",
"'url'",
"=>",
"route",
"(",
"'managerarea.members.index'",
")",
",",
"'with'",
"=>",
"[",
"'warning'",
"... | Destroy given member.
@param \Cortex\Auth\Models\Member $member
@throws \Exception
@return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse | [
"Destroy",
"given",
"member",
"."
] | 3152b5314f77910656ddaddfd1bf7aa8e2517905 | https://github.com/rinvex/cortex-auth-b2b2c2/blob/3152b5314f77910656ddaddfd1bf7aa8e2517905/src/Http/Controllers/Managerarea/MembersController.php#L290-L298 |
27,575 | rinvex/cortex-auth-b2b2c2 | src/Http/Controllers/Managerarea/AccountTwoFactorController.php | AccountTwoFactorController.index | public function index(Request $request)
{
$twoFactor = $request->user($this->getGuard())->getTwoFactor();
return view('cortex/auth::managerarea.pages.account-twofactor', compact('twoFactor'));
} | php | public function index(Request $request)
{
$twoFactor = $request->user($this->getGuard())->getTwoFactor();
return view('cortex/auth::managerarea.pages.account-twofactor', compact('twoFactor'));
} | [
"public",
"function",
"index",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"twoFactor",
"=",
"$",
"request",
"->",
"user",
"(",
"$",
"this",
"->",
"getGuard",
"(",
")",
")",
"->",
"getTwoFactor",
"(",
")",
";",
"return",
"view",
"(",
"'cortex/auth::... | Show the account security form.
@param \Illuminate\Http\Request $request
@return \Illuminate\View\View | [
"Show",
"the",
"account",
"security",
"form",
"."
] | 3152b5314f77910656ddaddfd1bf7aa8e2517905 | https://github.com/rinvex/cortex-auth-b2b2c2/blob/3152b5314f77910656ddaddfd1bf7aa8e2517905/src/Http/Controllers/Managerarea/AccountTwoFactorController.php#L23-L28 |
27,576 | rinvex/cortex-auth-b2b2c2 | src/Http/Controllers/Adminarea/ManagersMediaController.php | ManagersMediaController.destroy | public function destroy(Manager $manager, Media $media)
{
$manager->media()->where($media->getKeyName(), $media->getKey())->first()->delete();
return intend([
'url' => route('adminarea.managers.edit', ['manager' => $manager]),
'with' => ['warning' => trans('cortex/foundation... | php | public function destroy(Manager $manager, Media $media)
{
$manager->media()->where($media->getKeyName(), $media->getKey())->first()->delete();
return intend([
'url' => route('adminarea.managers.edit', ['manager' => $manager]),
'with' => ['warning' => trans('cortex/foundation... | [
"public",
"function",
"destroy",
"(",
"Manager",
"$",
"manager",
",",
"Media",
"$",
"media",
")",
"{",
"$",
"manager",
"->",
"media",
"(",
")",
"->",
"where",
"(",
"$",
"media",
"->",
"getKeyName",
"(",
")",
",",
"$",
"media",
"->",
"getKey",
"(",
... | Destroy given manager media.
@param \Cortex\Auth\Models\Manager $manager
@param \Spatie\MediaLibrary\Models\Media $media
@return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse | [
"Destroy",
"given",
"manager",
"media",
"."
] | 3152b5314f77910656ddaddfd1bf7aa8e2517905 | https://github.com/rinvex/cortex-auth-b2b2c2/blob/3152b5314f77910656ddaddfd1bf7aa8e2517905/src/Http/Controllers/Adminarea/ManagersMediaController.php#L46-L54 |
27,577 | laravie/codex | src/Support/Responsable.php | Responsable.interactsWithResponse | protected function interactsWithResponse(Response $response): Response
{
if ($response instanceof Filterable && $this instanceof Filterable) {
$response->setFilterable($this->getFilterable());
}
if ($this->validateResponseAutomatically === true) {
$response->validate... | php | protected function interactsWithResponse(Response $response): Response
{
if ($response instanceof Filterable && $this instanceof Filterable) {
$response->setFilterable($this->getFilterable());
}
if ($this->validateResponseAutomatically === true) {
$response->validate... | [
"protected",
"function",
"interactsWithResponse",
"(",
"Response",
"$",
"response",
")",
":",
"Response",
"{",
"if",
"(",
"$",
"response",
"instanceof",
"Filterable",
"&&",
"$",
"this",
"instanceof",
"Filterable",
")",
"{",
"$",
"response",
"->",
"setFilterable"... | Interacts with Response.
@param \Laravie\Codex\Contracts\Response $response
@return \Laravie\Codex\Contracts\Response | [
"Interacts",
"with",
"Response",
"."
] | 4d813bcbe20e7cf0b6c0cb98d3b077a070285709 | https://github.com/laravie/codex/blob/4d813bcbe20e7cf0b6c0cb98d3b077a070285709/src/Support/Responsable.php#L18-L29 |
27,578 | rinvex/cortex-auth-b2b2c2 | src/Http/Controllers/Adminarea/ManagersController.php | ManagersController.destroy | public function destroy(Manager $manager)
{
$manager->delete();
return intend([
'url' => route('adminarea.managers.index'),
'with' => ['warning' => trans('cortex/foundation::messages.resource_deleted', ['resource' => trans('cortex/auth::common.manager'), 'identifier' => $man... | php | public function destroy(Manager $manager)
{
$manager->delete();
return intend([
'url' => route('adminarea.managers.index'),
'with' => ['warning' => trans('cortex/foundation::messages.resource_deleted', ['resource' => trans('cortex/auth::common.manager'), 'identifier' => $man... | [
"public",
"function",
"destroy",
"(",
"Manager",
"$",
"manager",
")",
"{",
"$",
"manager",
"->",
"delete",
"(",
")",
";",
"return",
"intend",
"(",
"[",
"'url'",
"=>",
"route",
"(",
"'adminarea.managers.index'",
")",
",",
"'with'",
"=>",
"[",
"'warning'",
... | Destroy given manager.
@param \Cortex\Auth\Models\Manager $manager
@throws \Exception
@return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse | [
"Destroy",
"given",
"manager",
"."
] | 3152b5314f77910656ddaddfd1bf7aa8e2517905 | https://github.com/rinvex/cortex-auth-b2b2c2/blob/3152b5314f77910656ddaddfd1bf7aa8e2517905/src/Http/Controllers/Adminarea/ManagersController.php#L294-L302 |
27,579 | rinvex/cortex-auth-b2b2c2 | src/Http/Controllers/Frontarea/TenantRegistrationController.php | TenantRegistrationController.form | public function form(TenantRegistrationRequest $request)
{
$countries = collect(countries())->map(function ($country, $code) {
return [
'id' => $code,
'text' => $country['name'],
'emoji' => $country['emoji'],
];
})->values();
... | php | public function form(TenantRegistrationRequest $request)
{
$countries = collect(countries())->map(function ($country, $code) {
return [
'id' => $code,
'text' => $country['name'],
'emoji' => $country['emoji'],
];
})->values();
... | [
"public",
"function",
"form",
"(",
"TenantRegistrationRequest",
"$",
"request",
")",
"{",
"$",
"countries",
"=",
"collect",
"(",
"countries",
"(",
")",
")",
"->",
"map",
"(",
"function",
"(",
"$",
"country",
",",
"$",
"code",
")",
"{",
"return",
"[",
"... | Show the registration form.
@param \Cortex\Auth\B2B2C2\Http\Requests\Frontarea\TenantRegistrationRequest $request
@return \Illuminate\View\View | [
"Show",
"the",
"registration",
"form",
"."
] | 3152b5314f77910656ddaddfd1bf7aa8e2517905 | https://github.com/rinvex/cortex-auth-b2b2c2/blob/3152b5314f77910656ddaddfd1bf7aa8e2517905/src/Http/Controllers/Frontarea/TenantRegistrationController.php#L22-L34 |
27,580 | laravie/codex | src/Concerns/Request/Multipart.php | Multipart.prepareMultipartRequestPayloads | final public function prepareMultipartRequestPayloads(array $headers = [], array $body = [], array $files = []): array
{
$multipart = (($headers['Content-Type'] ?? null) == 'multipart/form-data');
if (empty($files) && ! $multipart) {
return [$headers, $body];
}
$builder... | php | final public function prepareMultipartRequestPayloads(array $headers = [], array $body = [], array $files = []): array
{
$multipart = (($headers['Content-Type'] ?? null) == 'multipart/form-data');
if (empty($files) && ! $multipart) {
return [$headers, $body];
}
$builder... | [
"final",
"public",
"function",
"prepareMultipartRequestPayloads",
"(",
"array",
"$",
"headers",
"=",
"[",
"]",
",",
"array",
"$",
"body",
"=",
"[",
"]",
",",
"array",
"$",
"files",
"=",
"[",
"]",
")",
":",
"array",
"{",
"$",
"multipart",
"=",
"(",
"(... | Prepare multipart request payloads.
@param array $headers
@param array $body
@param array $files
@return array | [
"Prepare",
"multipart",
"request",
"payloads",
"."
] | 4d813bcbe20e7cf0b6c0cb98d3b077a070285709 | https://github.com/laravie/codex/blob/4d813bcbe20e7cf0b6c0cb98d3b077a070285709/src/Concerns/Request/Multipart.php#L56-L74 |
27,581 | laravie/codex | src/Concerns/Request/Multipart.php | Multipart.addBodyToMultipartBuilder | final protected function addBodyToMultipartBuilder(Builder $builder, array $body, ?string $prefix = null): void
{
foreach ($body as $key => $value) {
$name = $key;
if (! \is_null($prefix)) {
$name = "{$prefix}[{$key}]";
}
if (\is_array($value... | php | final protected function addBodyToMultipartBuilder(Builder $builder, array $body, ?string $prefix = null): void
{
foreach ($body as $key => $value) {
$name = $key;
if (! \is_null($prefix)) {
$name = "{$prefix}[{$key}]";
}
if (\is_array($value... | [
"final",
"protected",
"function",
"addBodyToMultipartBuilder",
"(",
"Builder",
"$",
"builder",
",",
"array",
"$",
"body",
",",
"?",
"string",
"$",
"prefix",
"=",
"null",
")",
":",
"void",
"{",
"foreach",
"(",
"$",
"body",
"as",
"$",
"key",
"=>",
"$",
"... | Add body to multipart stream builder.
@param \Http\Message\MultipartStream\MultipartStreamBuilder $builder
@param array $body
@param string|null $prefix
@return void | [
"Add",
"body",
"to",
"multipart",
"stream",
"builder",
"."
] | 4d813bcbe20e7cf0b6c0cb98d3b077a070285709 | https://github.com/laravie/codex/blob/4d813bcbe20e7cf0b6c0cb98d3b077a070285709/src/Concerns/Request/Multipart.php#L85-L101 |
27,582 | laravie/codex | src/Concerns/Request/Multipart.php | Multipart.addFilesToMultipartBuilder | final protected function addFilesToMultipartBuilder(Builder $builder, array $files = []): void
{
foreach ($files as $key => $file) {
if (! \is_null($file)) {
$builder->addResource($key, fopen($file, 'r'));
}
}
} | php | final protected function addFilesToMultipartBuilder(Builder $builder, array $files = []): void
{
foreach ($files as $key => $file) {
if (! \is_null($file)) {
$builder->addResource($key, fopen($file, 'r'));
}
}
} | [
"final",
"protected",
"function",
"addFilesToMultipartBuilder",
"(",
"Builder",
"$",
"builder",
",",
"array",
"$",
"files",
"=",
"[",
"]",
")",
":",
"void",
"{",
"foreach",
"(",
"$",
"files",
"as",
"$",
"key",
"=>",
"$",
"file",
")",
"{",
"if",
"(",
... | Add files to multipart stream builder.
@param \Http\Message\MultipartStream\MultipartStreamBuilder $builder
@param array $files
@return void | [
"Add",
"files",
"to",
"multipart",
"stream",
"builder",
"."
] | 4d813bcbe20e7cf0b6c0cb98d3b077a070285709 | https://github.com/laravie/codex/blob/4d813bcbe20e7cf0b6c0cb98d3b077a070285709/src/Concerns/Request/Multipart.php#L111-L118 |
27,583 | byTestGear/laravel-accountable | src/Traits/Accountable.php | Accountable.updatedBy | public function updatedBy()
{
$relation = $this->belongsTo(
AccountableServiceProvider::userModel(),
config('accountable.column_names.updated_by')
);
return $this->userModelUsesSoftDeletes() ? $relation->withTrashed() : $relation;
} | php | public function updatedBy()
{
$relation = $this->belongsTo(
AccountableServiceProvider::userModel(),
config('accountable.column_names.updated_by')
);
return $this->userModelUsesSoftDeletes() ? $relation->withTrashed() : $relation;
} | [
"public",
"function",
"updatedBy",
"(",
")",
"{",
"$",
"relation",
"=",
"$",
"this",
"->",
"belongsTo",
"(",
"AccountableServiceProvider",
"::",
"userModel",
"(",
")",
",",
"config",
"(",
"'accountable.column_names.updated_by'",
")",
")",
";",
"return",
"$",
"... | Define the updated by relationship.
@return \Illuminate\Database\Eloquent\Relations\BelongsTo | [
"Define",
"the",
"updated",
"by",
"relationship",
"."
] | 17a4d45de255b0106c1e51ae8974dd83301b4aff | https://github.com/byTestGear/laravel-accountable/blob/17a4d45de255b0106c1e51ae8974dd83301b4aff/src/Traits/Accountable.php#L94-L102 |
27,584 | byTestGear/laravel-accountable | src/Traits/Accountable.php | Accountable.scopeOnlyCreatedBy | public function scopeOnlyCreatedBy(Builder $query, Model $user)
{
return $query->where(config('accountable.column_names.created_by'), $user->getKey());
} | php | public function scopeOnlyCreatedBy(Builder $query, Model $user)
{
return $query->where(config('accountable.column_names.created_by'), $user->getKey());
} | [
"public",
"function",
"scopeOnlyCreatedBy",
"(",
"Builder",
"$",
"query",
",",
"Model",
"$",
"user",
")",
"{",
"return",
"$",
"query",
"->",
"where",
"(",
"config",
"(",
"'accountable.column_names.created_by'",
")",
",",
"$",
"user",
"->",
"getKey",
"(",
")"... | Scope a query to only include records created by a given user.
@param \Illuminate\Database\Eloquent\Builder $query
@param \Illuminate\Database\Eloquent\Model $user
@return \Illuminate\Database\Eloquent\Builder | [
"Scope",
"a",
"query",
"to",
"only",
"include",
"records",
"created",
"by",
"a",
"given",
"user",
"."
] | 17a4d45de255b0106c1e51ae8974dd83301b4aff | https://github.com/byTestGear/laravel-accountable/blob/17a4d45de255b0106c1e51ae8974dd83301b4aff/src/Traits/Accountable.php#L127-L130 |
27,585 | byTestGear/laravel-accountable | src/Traits/Accountable.php | Accountable.scopeOnlyUpdatedBy | public function scopeOnlyUpdatedBy(Builder $query, Model $user)
{
return $query->where(config('accountable.column_names.updated_by'), $user->getKey());
} | php | public function scopeOnlyUpdatedBy(Builder $query, Model $user)
{
return $query->where(config('accountable.column_names.updated_by'), $user->getKey());
} | [
"public",
"function",
"scopeOnlyUpdatedBy",
"(",
"Builder",
"$",
"query",
",",
"Model",
"$",
"user",
")",
"{",
"return",
"$",
"query",
"->",
"where",
"(",
"config",
"(",
"'accountable.column_names.updated_by'",
")",
",",
"$",
"user",
"->",
"getKey",
"(",
")"... | Scope a query to only include records updated by a given user.
@param \Illuminate\Database\Eloquent\Builder $query
@param \Illuminate\Database\Eloquent\Model $user
@return \Illuminate\Database\Eloquent\Builder | [
"Scope",
"a",
"query",
"to",
"only",
"include",
"records",
"updated",
"by",
"a",
"given",
"user",
"."
] | 17a4d45de255b0106c1e51ae8974dd83301b4aff | https://github.com/byTestGear/laravel-accountable/blob/17a4d45de255b0106c1e51ae8974dd83301b4aff/src/Traits/Accountable.php#L152-L155 |
27,586 | byTestGear/laravel-accountable | src/Traits/Accountable.php | Accountable.scopeOnlyDeletedBy | public function scopeOnlyDeletedBy(Builder $query, Model $user)
{
return $query->where(config('accountable.column_names.deleted_by'), $user->getKey());
} | php | public function scopeOnlyDeletedBy(Builder $query, Model $user)
{
return $query->where(config('accountable.column_names.deleted_by'), $user->getKey());
} | [
"public",
"function",
"scopeOnlyDeletedBy",
"(",
"Builder",
"$",
"query",
",",
"Model",
"$",
"user",
")",
"{",
"return",
"$",
"query",
"->",
"where",
"(",
"config",
"(",
"'accountable.column_names.deleted_by'",
")",
",",
"$",
"user",
"->",
"getKey",
"(",
")"... | Scope a query to only include records deleted by a given user.
@param \Illuminate\Database\Eloquent\Builder $query
@param \Illuminate\Database\Eloquent\Model $user
@return \Illuminate\Database\Eloquent\Builder | [
"Scope",
"a",
"query",
"to",
"only",
"include",
"records",
"deleted",
"by",
"a",
"given",
"user",
"."
] | 17a4d45de255b0106c1e51ae8974dd83301b4aff | https://github.com/byTestGear/laravel-accountable/blob/17a4d45de255b0106c1e51ae8974dd83301b4aff/src/Traits/Accountable.php#L165-L168 |
27,587 | byTestGear/laravel-accountable | src/AccountableServiceProvider.php | AccountableServiceProvider.userModel | public static function userModel()
{
$guard = self::authDriver();
return collect(config('auth.guards'))
->map(function ($guard) {
return config("auth.providers.{$guard['provider']}.model");
})->get($guard);
} | php | public static function userModel()
{
$guard = self::authDriver();
return collect(config('auth.guards'))
->map(function ($guard) {
return config("auth.providers.{$guard['provider']}.model");
})->get($guard);
} | [
"public",
"static",
"function",
"userModel",
"(",
")",
"{",
"$",
"guard",
"=",
"self",
"::",
"authDriver",
"(",
")",
";",
"return",
"collect",
"(",
"config",
"(",
"'auth.guards'",
")",
")",
"->",
"map",
"(",
"function",
"(",
"$",
"guard",
")",
"{",
"... | Returns the user model, based on the configured authentication driver.
@return string | [
"Returns",
"the",
"user",
"model",
"based",
"on",
"the",
"configured",
"authentication",
"driver",
"."
] | 17a4d45de255b0106c1e51ae8974dd83301b4aff | https://github.com/byTestGear/laravel-accountable/blob/17a4d45de255b0106c1e51ae8974dd83301b4aff/src/AccountableServiceProvider.php#L52-L60 |
27,588 | byTestGear/laravel-accountable | src/Observer/AccountableObserver.php | AccountableObserver.creating | public function creating($model)
{
if ($model->accountableEnabled()) {
$model->{$this->config['column_names']['created_by']} = $this->accountableUserId();
$model->{$this->config['column_names']['updated_by']} = $this->accountableUserId();
}
} | php | public function creating($model)
{
if ($model->accountableEnabled()) {
$model->{$this->config['column_names']['created_by']} = $this->accountableUserId();
$model->{$this->config['column_names']['updated_by']} = $this->accountableUserId();
}
} | [
"public",
"function",
"creating",
"(",
"$",
"model",
")",
"{",
"if",
"(",
"$",
"model",
"->",
"accountableEnabled",
"(",
")",
")",
"{",
"$",
"model",
"->",
"{",
"$",
"this",
"->",
"config",
"[",
"'column_names'",
"]",
"[",
"'created_by'",
"]",
"}",
"... | Store the user creating a record.
@param \Illuminate\Database\Eloquent\Model $model | [
"Store",
"the",
"user",
"creating",
"a",
"record",
"."
] | 17a4d45de255b0106c1e51ae8974dd83301b4aff | https://github.com/byTestGear/laravel-accountable/blob/17a4d45de255b0106c1e51ae8974dd83301b4aff/src/Observer/AccountableObserver.php#L38-L44 |
27,589 | byTestGear/laravel-accountable | src/Observer/AccountableObserver.php | AccountableObserver.deleting | public function deleting($model)
{
if ($model->accountableEnabled() &&
collect(class_uses($model))->contains(SoftDeletes::class)) {
$model->{$this->config['column_names']['deleted_by']} = $this->accountableUserId();
$model->save();
}
} | php | public function deleting($model)
{
if ($model->accountableEnabled() &&
collect(class_uses($model))->contains(SoftDeletes::class)) {
$model->{$this->config['column_names']['deleted_by']} = $this->accountableUserId();
$model->save();
}
} | [
"public",
"function",
"deleting",
"(",
"$",
"model",
")",
"{",
"if",
"(",
"$",
"model",
"->",
"accountableEnabled",
"(",
")",
"&&",
"collect",
"(",
"class_uses",
"(",
"$",
"model",
")",
")",
"->",
"contains",
"(",
"SoftDeletes",
"::",
"class",
")",
")"... | Store the user deleting a record.
@param \Illuminate\Database\Eloquent\Model $model | [
"Store",
"the",
"user",
"deleting",
"a",
"record",
"."
] | 17a4d45de255b0106c1e51ae8974dd83301b4aff | https://github.com/byTestGear/laravel-accountable/blob/17a4d45de255b0106c1e51ae8974dd83301b4aff/src/Observer/AccountableObserver.php#L63-L71 |
27,590 | byTestGear/laravel-accountable | src/Accountable.php | Accountable.columns | public static function columns(Blueprint $table, $usesSoftDeletes = true)
{
self::addColumn($table, config('accountable.column_names.created_by'));
self::addColumn($table, config('accountable.column_names.updated_by'));
if ($usesSoftDeletes) {
self::addColumn($table, config('acc... | php | public static function columns(Blueprint $table, $usesSoftDeletes = true)
{
self::addColumn($table, config('accountable.column_names.created_by'));
self::addColumn($table, config('accountable.column_names.updated_by'));
if ($usesSoftDeletes) {
self::addColumn($table, config('acc... | [
"public",
"static",
"function",
"columns",
"(",
"Blueprint",
"$",
"table",
",",
"$",
"usesSoftDeletes",
"=",
"true",
")",
"{",
"self",
"::",
"addColumn",
"(",
"$",
"table",
",",
"config",
"(",
"'accountable.column_names.created_by'",
")",
")",
";",
"self",
"... | Add accountable.column_names to the table, including indexes.
@param \Illuminate\Database\Schema\Blueprint $table
@param bool $usesSoftDeletes | [
"Add",
"accountable",
".",
"column_names",
"to",
"the",
"table",
"including",
"indexes",
"."
] | 17a4d45de255b0106c1e51ae8974dd83301b4aff | https://github.com/byTestGear/laravel-accountable/blob/17a4d45de255b0106c1e51ae8974dd83301b4aff/src/Accountable.php#L15-L23 |
27,591 | byTestGear/laravel-accountable | src/Accountable.php | Accountable.addColumn | public static function addColumn(Blueprint $table, string $name)
{
$table->unsignedInteger($name)->nullable();
$table->index($name);
} | php | public static function addColumn(Blueprint $table, string $name)
{
$table->unsignedInteger($name)->nullable();
$table->index($name);
} | [
"public",
"static",
"function",
"addColumn",
"(",
"Blueprint",
"$",
"table",
",",
"string",
"$",
"name",
")",
"{",
"$",
"table",
"->",
"unsignedInteger",
"(",
"$",
"name",
")",
"->",
"nullable",
"(",
")",
";",
"$",
"table",
"->",
"index",
"(",
"$",
"... | Add a single Accountable column to the table. Also creates an index.
@param \Illuminate\Database\Schema\Blueprint $table
@param string $name | [
"Add",
"a",
"single",
"Accountable",
"column",
"to",
"the",
"table",
".",
"Also",
"creates",
"an",
"index",
"."
] | 17a4d45de255b0106c1e51ae8974dd83301b4aff | https://github.com/byTestGear/laravel-accountable/blob/17a4d45de255b0106c1e51ae8974dd83301b4aff/src/Accountable.php#L31-L35 |
27,592 | techdivision/import-product | src/Observers/UrlKeyObserver.php | UrlKeyObserver.makeUrlKeyUnique | protected function makeUrlKeyUnique($urlKey)
{
// initialize the entity type ID
$entityType = $this->getEntityType();
$entityTypeId = (integer) $entityType[MemberNames::ENTITY_TYPE_ID];
// initialize the store view ID, use the admin store view if no store view has
// been s... | php | protected function makeUrlKeyUnique($urlKey)
{
// initialize the entity type ID
$entityType = $this->getEntityType();
$entityTypeId = (integer) $entityType[MemberNames::ENTITY_TYPE_ID];
// initialize the store view ID, use the admin store view if no store view has
// been s... | [
"protected",
"function",
"makeUrlKeyUnique",
"(",
"$",
"urlKey",
")",
"{",
"// initialize the entity type ID",
"$",
"entityType",
"=",
"$",
"this",
"->",
"getEntityType",
"(",
")",
";",
"$",
"entityTypeId",
"=",
"(",
"integer",
")",
"$",
"entityType",
"[",
"Me... | Make's the passed URL key unique by adding the next number to the end.
@param string $urlKey The URL key to make unique
@return string The unique URL key | [
"Make",
"s",
"the",
"passed",
"URL",
"key",
"unique",
"by",
"adding",
"the",
"next",
"number",
"to",
"the",
"end",
"."
] | a596e0c4b0495c918139935a709815c739d61e95 | https://github.com/techdivision/import-product/blob/a596e0c4b0495c918139935a709815c739d61e95/src/Observers/UrlKeyObserver.php#L159-L224 |
27,593 | techdivision/import-product | src/Repositories/ProductWebsiteRepository.php | ProductWebsiteRepository.findOneByProductIdAndWebsite | public function findOneByProductIdAndWebsite($productId, $websiteId)
{
// prepare the params
$params = array(
MemberNames::PRODUCT_ID => $productId,
MemberNames::WEBSITE_ID => $websiteId
);
// load and return the product with the passed product/website ID
... | php | public function findOneByProductIdAndWebsite($productId, $websiteId)
{
// prepare the params
$params = array(
MemberNames::PRODUCT_ID => $productId,
MemberNames::WEBSITE_ID => $websiteId
);
// load and return the product with the passed product/website ID
... | [
"public",
"function",
"findOneByProductIdAndWebsite",
"(",
"$",
"productId",
",",
"$",
"websiteId",
")",
"{",
"// prepare the params",
"$",
"params",
"=",
"array",
"(",
"MemberNames",
"::",
"PRODUCT_ID",
"=>",
"$",
"productId",
",",
"MemberNames",
"::",
"WEBSITE_I... | Load's and return's the product website relation with the passed product and website ID.
@param string $productId The product ID of the relation
@param string $websiteId The website ID of the relation
@return array The product website | [
"Load",
"s",
"and",
"return",
"s",
"the",
"product",
"website",
"relation",
"with",
"the",
"passed",
"product",
"and",
"website",
"ID",
"."
] | a596e0c4b0495c918139935a709815c739d61e95 | https://github.com/techdivision/import-product/blob/a596e0c4b0495c918139935a709815c739d61e95/src/Repositories/ProductWebsiteRepository.php#L67-L79 |
27,594 | contributte/thepay-api | src/DataApi/Processors/Digester.php | Digester.processItem | protected function processItem($value): string
{
if (Utils::isList($value)) {
return $this->processList($value);
}
return $this->processHash($value);
} | php | protected function processItem($value): string
{
if (Utils::isList($value)) {
return $this->processList($value);
}
return $this->processHash($value);
} | [
"protected",
"function",
"processItem",
"(",
"$",
"value",
")",
":",
"string",
"{",
"if",
"(",
"Utils",
"::",
"isList",
"(",
"$",
"value",
")",
")",
"{",
"return",
"$",
"this",
"->",
"processList",
"(",
"$",
"value",
")",
";",
"}",
"return",
"$",
"... | Hashes, lists and booleans are treated specially. Other values are simply
converted to strings, strings are left untouched.
@param mixed $value | [
"Hashes",
"lists",
"and",
"booleans",
"are",
"treated",
"specially",
".",
"Other",
"values",
"are",
"simply",
"converted",
"to",
"strings",
"strings",
"are",
"left",
"untouched",
"."
] | 7e28eaf30ad1880533add93cf9e7296e61c09b8e | https://github.com/contributte/thepay-api/blob/7e28eaf30ad1880533add93cf9e7296e61c09b8e/src/DataApi/Processors/Digester.php#L69-L76 |
27,595 | contributte/thepay-api | src/ReturnedPayment.php | ReturnedPayment.verifySignature | public function verifySignature(?string $signature = null): bool
{
// check merchantId and accountId from request
if (
$this->getRequestMerchantId() !== $this->getMerchantConfig()->merchantId
|| $this->getRequestAccountId() !== $this->getMerchantConfig()->accountId
) {
throw new InvalidSignatureExceptio... | php | public function verifySignature(?string $signature = null): bool
{
// check merchantId and accountId from request
if (
$this->getRequestMerchantId() !== $this->getMerchantConfig()->merchantId
|| $this->getRequestAccountId() !== $this->getMerchantConfig()->accountId
) {
throw new InvalidSignatureExceptio... | [
"public",
"function",
"verifySignature",
"(",
"?",
"string",
"$",
"signature",
"=",
"null",
")",
":",
"bool",
"{",
"// check merchantId and accountId from request",
"if",
"(",
"$",
"this",
"->",
"getRequestMerchantId",
"(",
")",
"!==",
"$",
"this",
"->",
"getMer... | Use this call to verify signature of the payment.
this method is called automatically.
@return true if signature is valid, otherwise throws
a Tp\TpInvalidSignatureException.
@throws InvalidSignatureException , when signature isinvalid. | [
"Use",
"this",
"call",
"to",
"verify",
"signature",
"of",
"the",
"payment",
".",
"this",
"method",
"is",
"called",
"automatically",
"."
] | 7e28eaf30ad1880533add93cf9e7296e61c09b8e | https://github.com/contributte/thepay-api/blob/7e28eaf30ad1880533add93cf9e7296e61c09b8e/src/ReturnedPayment.php#L219-L261 |
27,596 | OXID-eSales/paymorrow-module | core/oxpspaymorrowlogger.php | OxpsPaymorrowLogger.log | public function log( array $aInfo )
{
/** @var $oPmSettings OxpsPaymorrowSettings */
$oPmSettings = oxNew( 'OxpsPaymorrowSettings' );
return $oPmSettings->isLoggingEnabled()
? $this->_saveToFile( $this->_toConvertToString( $aInfo ) )
: false;
} | php | public function log( array $aInfo )
{
/** @var $oPmSettings OxpsPaymorrowSettings */
$oPmSettings = oxNew( 'OxpsPaymorrowSettings' );
return $oPmSettings->isLoggingEnabled()
? $this->_saveToFile( $this->_toConvertToString( $aInfo ) )
: false;
} | [
"public",
"function",
"log",
"(",
"array",
"$",
"aInfo",
")",
"{",
"/** @var $oPmSettings OxpsPaymorrowSettings */",
"$",
"oPmSettings",
"=",
"oxNew",
"(",
"'OxpsPaymorrowSettings'",
")",
";",
"return",
"$",
"oPmSettings",
"->",
"isLoggingEnabled",
"(",
")",
"?",
... | Method that writes the given info to the log.
@param array $aInfo
@return bool|string | [
"Method",
"that",
"writes",
"the",
"given",
"info",
"to",
"the",
"log",
"."
] | adb5d7f50c2fa5b566abd262161c483c42847b42 | https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorrowlogger.php#L89-L97 |
27,597 | OXID-eSales/paymorrow-module | core/oxpspaymorrowlogger.php | OxpsPaymorrowLogger.logWithType | public function logWithType( array $aInfo, $sType = '' )
{
$this->setFileName( sprintf( "oxpspaymorrow_%s_data-%s_log.txt", $sType, date( 'Y-m-d' ) ) );
$this->log( $aInfo );
} | php | public function logWithType( array $aInfo, $sType = '' )
{
$this->setFileName( sprintf( "oxpspaymorrow_%s_data-%s_log.txt", $sType, date( 'Y-m-d' ) ) );
$this->log( $aInfo );
} | [
"public",
"function",
"logWithType",
"(",
"array",
"$",
"aInfo",
",",
"$",
"sType",
"=",
"''",
")",
"{",
"$",
"this",
"->",
"setFileName",
"(",
"sprintf",
"(",
"\"oxpspaymorrow_%s_data-%s_log.txt\"",
",",
"$",
"sType",
",",
"date",
"(",
"'Y-m-d'",
")",
")"... | Logs Paymorrow to file with type and date appended.
@param array $aInfo
@param string $sType | [
"Logs",
"Paymorrow",
"to",
"file",
"with",
"type",
"and",
"date",
"appended",
"."
] | adb5d7f50c2fa5b566abd262161c483c42847b42 | https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorrowlogger.php#L105-L109 |
27,598 | OXID-eSales/paymorrow-module | core/oxpspaymorrowlogger.php | OxpsPaymorrowLogger.getContents | public function getContents()
{
$sErrorLogPath = $this->getErrorLogPathWithName();
$sLog = '';
if ( is_file( $sErrorLogPath ) ) {
$fErrorLog = fopen( $sErrorLogPath, "r" );
while ( !feof( $fErrorLog ) ) {
$sLog .= trim( fgets( $fErrorLog, 4096 ) ) .... | php | public function getContents()
{
$sErrorLogPath = $this->getErrorLogPathWithName();
$sLog = '';
if ( is_file( $sErrorLogPath ) ) {
$fErrorLog = fopen( $sErrorLogPath, "r" );
while ( !feof( $fErrorLog ) ) {
$sLog .= trim( fgets( $fErrorLog, 4096 ) ) .... | [
"public",
"function",
"getContents",
"(",
")",
"{",
"$",
"sErrorLogPath",
"=",
"$",
"this",
"->",
"getErrorLogPathWithName",
"(",
")",
";",
"$",
"sLog",
"=",
"''",
";",
"if",
"(",
"is_file",
"(",
"$",
"sErrorLogPath",
")",
")",
"{",
"$",
"fErrorLog",
"... | Get error log file contents.
@return string | [
"Get",
"error",
"log",
"file",
"contents",
"."
] | adb5d7f50c2fa5b566abd262161c483c42847b42 | https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorrowlogger.php#L116-L133 |
27,599 | OXID-eSales/paymorrow-module | core/oxpspaymorrowlogger.php | OxpsPaymorrowLogger.getAllContents | public function getAllContents()
{
$sLog = '';
$sFormat = "----------------------------------------------------------------------\n" .
"%s\n" .
"----------------------------------------------------------------------\n\n" .
"%s\n\n";
... | php | public function getAllContents()
{
$sLog = '';
$sFormat = "----------------------------------------------------------------------\n" .
"%s\n" .
"----------------------------------------------------------------------\n\n" .
"%s\n\n";
... | [
"public",
"function",
"getAllContents",
"(",
")",
"{",
"$",
"sLog",
"=",
"''",
";",
"$",
"sFormat",
"=",
"\"----------------------------------------------------------------------\\n\"",
".",
"\"%s\\n\"",
".",
"\"--------------------------------------------------------------------... | Get all error log files contents.
@return string | [
"Get",
"all",
"error",
"log",
"files",
"contents",
"."
] | adb5d7f50c2fa5b566abd262161c483c42847b42 | https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorrowlogger.php#L140-L158 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.