repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
tequila/mongodb-odm | src/Proxy/Traits/RootProxyTrait.php | RootProxyTrait.setOnInsert | public function setOnInsert(string $field, $value)
{
$this->update();
$this->mongoDbUpdate['$setOnInsert'][$field] = $value;
return $this;
} | php | public function setOnInsert(string $field, $value)
{
$this->update();
$this->mongoDbUpdate['$setOnInsert'][$field] = $value;
return $this;
} | [
"public",
"function",
"setOnInsert",
"(",
"string",
"$",
"field",
",",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"update",
"(",
")",
";",
"$",
"this",
"->",
"mongoDbUpdate",
"[",
"'$setOnInsert'",
"]",
"[",
"$",
"field",
"]",
"=",
"$",
"value",
";",... | @param string $field
@param mixed $value
@return $this | [
"@param",
"string",
"$field",
"@param",
"mixed",
"$value"
] | train | https://github.com/tequila/mongodb-odm/blob/501d58529bbcb23ad7839680462f62d5c3466d23/src/Proxy/Traits/RootProxyTrait.php#L270-L276 |
tequila/mongodb-odm | src/Proxy/Traits/RootProxyTrait.php | RootProxyTrait.set | public function set(string $field, $value)
{
$this->update();
$this->mongoDbUpdate['$set'][$field] = $value;
return $this;
} | php | public function set(string $field, $value)
{
$this->update();
$this->mongoDbUpdate['$set'][$field] = $value;
return $this;
} | [
"public",
"function",
"set",
"(",
"string",
"$",
"field",
",",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"update",
"(",
")",
";",
"$",
"this",
"->",
"mongoDbUpdate",
"[",
"'$set'",
"]",
"[",
"$",
"field",
"]",
"=",
"$",
"value",
";",
"return",
"... | @param string $field
@param mixed $value
@return $this | [
"@param",
"string",
"$field",
"@param",
"mixed",
"$value"
] | train | https://github.com/tequila/mongodb-odm/blob/501d58529bbcb23ad7839680462f62d5c3466d23/src/Proxy/Traits/RootProxyTrait.php#L284-L290 |
php-lug/lug | src/Component/Grid/Filter/Filterer.php | Filterer.filter | public function filter(DataSourceBuilderInterface $builder, GridInterface $grid, array $filters = [])
{
foreach ($filters as $name => $filter) {
if (!$grid->hasFilter($name)) {
continue;
}
$gridFilter = $grid->getFilter($name);
$types = $this-... | php | public function filter(DataSourceBuilderInterface $builder, GridInterface $grid, array $filters = [])
{
foreach ($filters as $name => $filter) {
if (!$grid->hasFilter($name)) {
continue;
}
$gridFilter = $grid->getFilter($name);
$types = $this-... | [
"public",
"function",
"filter",
"(",
"DataSourceBuilderInterface",
"$",
"builder",
",",
"GridInterface",
"$",
"grid",
",",
"array",
"$",
"filters",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"filters",
"as",
"$",
"name",
"=>",
"$",
"filter",
")",
"{",... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Component/Grid/Filter/Filterer.php#L41-L61 |
php-lug/lug | src/Component/Grid/Filter/Filterer.php | Filterer.resolveTypes | private function resolveTypes($type)
{
$filterTypes = [];
do {
$filterTypes[] = $filterType = $this->filterRegistry[$type];
} while (($type = $filterType->getParent()) !== null);
return $filterTypes;
} | php | private function resolveTypes($type)
{
$filterTypes = [];
do {
$filterTypes[] = $filterType = $this->filterRegistry[$type];
} while (($type = $filterType->getParent()) !== null);
return $filterTypes;
} | [
"private",
"function",
"resolveTypes",
"(",
"$",
"type",
")",
"{",
"$",
"filterTypes",
"=",
"[",
"]",
";",
"do",
"{",
"$",
"filterTypes",
"[",
"]",
"=",
"$",
"filterType",
"=",
"$",
"this",
"->",
"filterRegistry",
"[",
"$",
"type",
"]",
";",
"}",
"... | @param string $type
@return TypeInterface[] | [
"@param",
"string",
"$type"
] | train | https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Component/Grid/Filter/Filterer.php#L68-L77 |
simbiosis-group/yii2-helper | actions/EnvelopeAction.php | EnvelopeAction.run | public function run()
{
$mpdf = $this->mpdf;
foreach ($this->data as $record) {
$mpdf->AddPage();
$mpdf->WriteHTML($this->controller->renderPartial(
$this->envelopeViewPath,
[
'data' => $record,
'adjustment' => $this->adjustment,
... | php | public function run()
{
$mpdf = $this->mpdf;
foreach ($this->data as $record) {
$mpdf->AddPage();
$mpdf->WriteHTML($this->controller->renderPartial(
$this->envelopeViewPath,
[
'data' => $record,
'adjustment' => $this->adjustment,
... | [
"public",
"function",
"run",
"(",
")",
"{",
"$",
"mpdf",
"=",
"$",
"this",
"->",
"mpdf",
";",
"foreach",
"(",
"$",
"this",
"->",
"data",
"as",
"$",
"record",
")",
"{",
"$",
"mpdf",
"->",
"AddPage",
"(",
")",
";",
"$",
"mpdf",
"->",
"WriteHTML",
... | Runs the action
@return string result content | [
"Runs",
"the",
"action"
] | train | https://github.com/simbiosis-group/yii2-helper/blob/c85c4204dd06b16e54210e75fe6deb51869d1dd9/actions/EnvelopeAction.php#L81-L100 |
php-lug/lug | src/Bundle/StorageBundle/DependencyInjection/LugStorageExtension.php | LugStorageExtension.loadInternal | protected function loadInternal(array $config, ContainerBuilder $container)
{
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$this->loadCookie($config['cookie'], $loader);
$this->loadDoctrine($config['doctrine'], $loader, $container);
$this... | php | protected function loadInternal(array $config, ContainerBuilder $container)
{
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$this->loadCookie($config['cookie'], $loader);
$this->loadDoctrine($config['doctrine'], $loader, $container);
$this... | [
"protected",
"function",
"loadInternal",
"(",
"array",
"$",
"config",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"loader",
"=",
"new",
"XmlFileLoader",
"(",
"$",
"container",
",",
"new",
"FileLocator",
"(",
"__DIR__",
".",
"'/../Resources/config'"... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Bundle/StorageBundle/DependencyInjection/LugStorageExtension.php#L29-L36 |
zhouyl/mellivora | Mellivora/Database/Console/Migrations/MigrateMakeCommand.php | MigrateMakeCommand.fire | public function fire()
{
// It's possible for the developer to specify the tables to modify in this
// schema operation. The developer may also specify if this table needs
// to be freshly created so we can create the appropriate migrations.
$name = trim($this->input->getArgument('na... | php | public function fire()
{
// It's possible for the developer to specify the tables to modify in this
// schema operation. The developer may also specify if this table needs
// to be freshly created so we can create the appropriate migrations.
$name = trim($this->input->getArgument('na... | [
"public",
"function",
"fire",
"(",
")",
"{",
"// It's possible for the developer to specify the tables to modify in this",
"// schema operation. The developer may also specify if this table needs",
"// to be freshly created so we can create the appropriate migrations.",
"$",
"name",
"=",
"tr... | Execute the console command.
@return void | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/Console/Migrations/MigrateMakeCommand.php#L29-L53 |
zhouyl/mellivora | Mellivora/Database/Console/Migrations/MigrateMakeCommand.php | MigrateMakeCommand.getMigrationPath | protected function getMigrationPath()
{
if (!is_null($targetPath = $this->input->getOption('path'))) {
return root_path($targetPath);
}
return parent::getMigrationPath();
} | php | protected function getMigrationPath()
{
if (!is_null($targetPath = $this->input->getOption('path'))) {
return root_path($targetPath);
}
return parent::getMigrationPath();
} | [
"protected",
"function",
"getMigrationPath",
"(",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"targetPath",
"=",
"$",
"this",
"->",
"input",
"->",
"getOption",
"(",
"'path'",
")",
")",
")",
"{",
"return",
"root_path",
"(",
"$",
"targetPath",
")",
";... | Get migration path (either specified by '--path' option or default location).
@return string | [
"Get",
"migration",
"path",
"(",
"either",
"specified",
"by",
"--",
"path",
"option",
"or",
"default",
"location",
")",
"."
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/Console/Migrations/MigrateMakeCommand.php#L81-L88 |
mvccore/ext-router-module | src/MvcCore/Ext/Routers/Modules/Route/Matching.php | Matching.matchesGetSubject | protected function matchesGetSubject (\MvcCore\IRequest & $request) {
$subject = $this->matchesGetSubjectHostAndBase($request) ;
if (!$this->flags[0]) {
$selfClass = version_compare(PHP_VERSION, '5.5', '>') ? self::class : __CLASS__;
throw new \InvalidArgumentException(
"[".$selfClass."] Domain route patt... | php | protected function matchesGetSubject (\MvcCore\IRequest & $request) {
$subject = $this->matchesGetSubjectHostAndBase($request) ;
if (!$this->flags[0]) {
$selfClass = version_compare(PHP_VERSION, '5.5', '>') ? self::class : __CLASS__;
throw new \InvalidArgumentException(
"[".$selfClass."] Domain route patt... | [
"protected",
"function",
"matchesGetSubject",
"(",
"\\",
"MvcCore",
"\\",
"IRequest",
"&",
"$",
"request",
")",
"{",
"$",
"subject",
"=",
"$",
"this",
"->",
"matchesGetSubjectHostAndBase",
"(",
"$",
"request",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
... | Return subject value used for `preg_match_all()` route match processing.
Complete subject by route flags. Route `pattern` (or `reverse`) must
contain domain part or/and base path. Prepare those values from request
object.
@param \MvcCore\IRequest $request
@throws \InvalidArgumentException Domain route pattern or revers... | [
"Return",
"subject",
"value",
"used",
"for",
"preg_match_all",
"()",
"route",
"match",
"processing",
".",
"Complete",
"subject",
"by",
"route",
"flags",
".",
"Route",
"pattern",
"(",
"or",
"reverse",
")",
"must",
"contain",
"domain",
"part",
"or",
"/",
"and"... | train | https://github.com/mvccore/ext-router-module/blob/7695784a451db86cca6a43c98d076803cd0a50a7/src/MvcCore/Ext/Routers/Modules/Route/Matching.php#L28-L38 |
mvccore/ext-router-module | src/MvcCore/Ext/Routers/Modules/Route/Matching.php | Matching.& | protected function & matchesParseRewriteParams (& $matchedValues, & $defaults) {
$matchedParams = [];
array_shift($matchedValues); // first item is always matched whole `$request->GetPath()` string.
foreach ($matchedValues as $key => $matchedValueArr) {
if (is_numeric($key)) continue;
$matchedValue = (strin... | php | protected function & matchesParseRewriteParams (& $matchedValues, & $defaults) {
$matchedParams = [];
array_shift($matchedValues); // first item is always matched whole `$request->GetPath()` string.
foreach ($matchedValues as $key => $matchedValueArr) {
if (is_numeric($key)) continue;
$matchedValue = (strin... | [
"protected",
"function",
"&",
"matchesParseRewriteParams",
"(",
"&",
"$",
"matchedValues",
",",
"&",
"$",
"defaults",
")",
"{",
"$",
"matchedParams",
"=",
"[",
"]",
";",
"array_shift",
"(",
"$",
"matchedValues",
")",
";",
"// first item is always matched whole `$r... | Parse rewrite params from `preg_match_all()` `$matches` result array into
array, keyed by param name with parsed value.
@param array $matchedValues
@param array $defaults
@return array | [
"Parse",
"rewrite",
"params",
"from",
"preg_match_all",
"()",
"$matches",
"result",
"array",
"into",
"array",
"keyed",
"by",
"param",
"name",
"with",
"parsed",
"value",
"."
] | train | https://github.com/mvccore/ext-router-module/blob/7695784a451db86cca6a43c98d076803cd0a50a7/src/MvcCore/Ext/Routers/Modules/Route/Matching.php#L47-L63 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/transport_connection.php | ezcMailTransportConnection.sendData | public function sendData( $data )
{
if ( is_resource( $this->connection ) )
{
if ( fwrite( $this->connection, $data . self::CRLF,
strlen( $data ) + strlen( self::CRLF ) ) === false )
{
throw new ezcMailTransportException( 'Could not wr... | php | public function sendData( $data )
{
if ( is_resource( $this->connection ) )
{
if ( fwrite( $this->connection, $data . self::CRLF,
strlen( $data ) + strlen( self::CRLF ) ) === false )
{
throw new ezcMailTransportException( 'Could not wr... | [
"public",
"function",
"sendData",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"is_resource",
"(",
"$",
"this",
"->",
"connection",
")",
")",
"{",
"if",
"(",
"fwrite",
"(",
"$",
"this",
"->",
"connection",
",",
"$",
"data",
".",
"self",
"::",
"CRLF",
","... | Send $data to the server through the connection.
This method appends one line-break at the end of $data.
@throws ezcMailTransportException
if there is no valid connection.
@param string $data | [
"Send",
"$data",
"to",
"the",
"server",
"through",
"the",
"connection",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/transport_connection.php#L177-L187 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/transport_connection.php | ezcMailTransportConnection.getLine | public function getLine( $trim = false )
{
$data = '';
$line = '';
if ( is_resource( $this->connection ) )
{
// in case there is a problem with the connection fgets() returns false
while ( strpos( $data, self::CRLF ) === false )
{
... | php | public function getLine( $trim = false )
{
$data = '';
$line = '';
if ( is_resource( $this->connection ) )
{
// in case there is a problem with the connection fgets() returns false
while ( strpos( $data, self::CRLF ) === false )
{
... | [
"public",
"function",
"getLine",
"(",
"$",
"trim",
"=",
"false",
")",
"{",
"$",
"data",
"=",
"''",
";",
"$",
"line",
"=",
"''",
";",
"if",
"(",
"is_resource",
"(",
"$",
"this",
"->",
"connection",
")",
")",
"{",
"// in case there is a problem with the co... | Returns one line of data from the stream.
The returned line will have linebreaks removed if the $trim option is set.
@throws ezcMailTransportConnection
if there is no valid connection
@param bool $trim
@return string | [
"Returns",
"one",
"line",
"of",
"data",
"from",
"the",
"stream",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/transport_connection.php#L199-L233 |
Erdiko/core | src/cache/File.php | File.put | public function put($key, $data)
{
$filename = $this->getKeyCode($key);
$data = json_encode($data);
$this->write($data, $filename);
} | php | public function put($key, $data)
{
$filename = $this->getKeyCode($key);
$data = json_encode($data);
$this->write($data, $filename);
} | [
"public",
"function",
"put",
"(",
"$",
"key",
",",
"$",
"data",
")",
"{",
"$",
"filename",
"=",
"$",
"this",
"->",
"getKeyCode",
"(",
"$",
"key",
")",
";",
"$",
"data",
"=",
"json_encode",
"(",
"$",
"data",
")",
";",
"$",
"this",
"->",
"write",
... | Put Key
@param mixed $key
@param mixed $data | [
"Put",
"Key"
] | train | https://github.com/Erdiko/core/blob/c7947ee973b0ad2fd05a6d1d8ce45696618c8fa6/src/cache/File.php#L43-L48 |
Erdiko/core | src/cache/File.php | File.get | public function get($key)
{
$filename = $this->getKeyCode($key);
if ($this->fileExists($filename)) {
$value = $this->read($filename);
} else {
return null;
}
return json_decode($value, true);
} | php | public function get($key)
{
$filename = $this->getKeyCode($key);
if ($this->fileExists($filename)) {
$value = $this->read($filename);
} else {
return null;
}
return json_decode($value, true);
} | [
"public",
"function",
"get",
"(",
"$",
"key",
")",
"{",
"$",
"filename",
"=",
"$",
"this",
"->",
"getKeyCode",
"(",
"$",
"key",
")",
";",
"if",
"(",
"$",
"this",
"->",
"fileExists",
"(",
"$",
"filename",
")",
")",
"{",
"$",
"value",
"=",
"$",
"... | Get Key
@param string @key
@return mixed | [
"Get",
"Key"
] | train | https://github.com/Erdiko/core/blob/c7947ee973b0ad2fd05a6d1d8ce45696618c8fa6/src/cache/File.php#L56-L67 |
Erdiko/core | src/cache/File.php | File.delete | public function delete($key, $path = null)
{
$filename = $this->getKeyCode($key);
parent::delete($filename, $path);
} | php | public function delete($key, $path = null)
{
$filename = $this->getKeyCode($key);
parent::delete($filename, $path);
} | [
"public",
"function",
"delete",
"(",
"$",
"key",
",",
"$",
"path",
"=",
"null",
")",
"{",
"$",
"filename",
"=",
"$",
"this",
"->",
"getKeyCode",
"(",
"$",
"key",
")",
";",
"parent",
"::",
"delete",
"(",
"$",
"filename",
",",
"$",
"path",
")",
";"... | Delete a key
@param string @key
@note path is only for compatibility, do not use | [
"Delete",
"a",
"key"
] | train | https://github.com/Erdiko/core/blob/c7947ee973b0ad2fd05a6d1d8ce45696618c8fa6/src/cache/File.php#L75-L79 |
Erdiko/core | src/cache/File.php | File.clear | public function clear()
{
$files = glob(ERDIKO_VAR."/cache/*");
foreach ($files as $file) {
if (is_file($file)) {
parent::delete(basename($file));
}
}
} | php | public function clear()
{
$files = glob(ERDIKO_VAR."/cache/*");
foreach ($files as $file) {
if (is_file($file)) {
parent::delete(basename($file));
}
}
} | [
"public",
"function",
"clear",
"(",
")",
"{",
"$",
"files",
"=",
"glob",
"(",
"ERDIKO_VAR",
".",
"\"/cache/*\"",
")",
";",
"foreach",
"(",
"$",
"files",
"as",
"$",
"file",
")",
"{",
"if",
"(",
"is_file",
"(",
"$",
"file",
")",
")",
"{",
"parent",
... | Delete all keys | [
"Delete",
"all",
"keys"
] | train | https://github.com/Erdiko/core/blob/c7947ee973b0ad2fd05a6d1d8ce45696618c8fa6/src/cache/File.php#L84-L92 |
php-lug/lug | src/Bundle/TranslationBundle/Form/Type/TranslatableType.php | TranslatableType.buildForm | public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('translations', TranslationsFormsType::class, [
'form_type' => $options['resource']->getRelation('translation')->getForm(),
'empty_data' => function () {
return new ArrayCollecti... | php | public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('translations', TranslationsFormsType::class, [
'form_type' => $options['resource']->getRelation('translation')->getForm(),
'empty_data' => function () {
return new ArrayCollecti... | [
"public",
"function",
"buildForm",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"array",
"$",
"options",
")",
"{",
"$",
"builder",
"->",
"add",
"(",
"'translations'",
",",
"TranslationsFormsType",
"::",
"class",
",",
"[",
"'form_type'",
"=>",
"$",
"option... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Bundle/TranslationBundle/Form/Type/TranslatableType.php#L28-L36 |
Visithor/visithor | src/Visithor/Client/GuzzleClient.php | GuzzleClient.buildClient | public function buildClient()
{
//Handle redirect configuration for guzzle 6
if (class_exists('\GuzzleHttp\Psr7\Request')) {
$options = ['allow_redirects' => false];
} else {
$options = [
'defaults' => [
'allow_redirects' => false
... | php | public function buildClient()
{
//Handle redirect configuration for guzzle 6
if (class_exists('\GuzzleHttp\Psr7\Request')) {
$options = ['allow_redirects' => false];
} else {
$options = [
'defaults' => [
'allow_redirects' => false
... | [
"public",
"function",
"buildClient",
"(",
")",
"{",
"//Handle redirect configuration for guzzle 6",
"if",
"(",
"class_exists",
"(",
"'\\GuzzleHttp\\Psr7\\Request'",
")",
")",
"{",
"$",
"options",
"=",
"[",
"'allow_redirects'",
"=>",
"false",
"]",
";",
"}",
"else",
... | Build client
@return $this Self object | [
"Build",
"client"
] | train | https://github.com/Visithor/visithor/blob/201ba2cfc536a0875983c79226947aa20b9f4dca/src/Visithor/Client/GuzzleClient.php#L39-L55 |
Visithor/visithor | src/Visithor/Client/GuzzleClient.php | GuzzleClient.getResponseHTTPCode | public function getResponseHTTPCode(Url $url)
{
try {
$verb = $url->getOption('verb', 'GET');
$client = $this->client;
$result = $client
->send(
class_exists('\GuzzleHttp\Psr7\Request')
? new \GuzzleHttp\Psr7\Req... | php | public function getResponseHTTPCode(Url $url)
{
try {
$verb = $url->getOption('verb', 'GET');
$client = $this->client;
$result = $client
->send(
class_exists('\GuzzleHttp\Psr7\Request')
? new \GuzzleHttp\Psr7\Req... | [
"public",
"function",
"getResponseHTTPCode",
"(",
"Url",
"$",
"url",
")",
"{",
"try",
"{",
"$",
"verb",
"=",
"$",
"url",
"->",
"getOption",
"(",
"'verb'",
",",
"'GET'",
")",
";",
"$",
"client",
"=",
"$",
"this",
"->",
"client",
";",
"$",
"result",
... | Get the HTTP Code Response given an URL instance
@param Url $url Url
@return int Response HTTP Code | [
"Get",
"the",
"HTTP",
"Code",
"Response",
"given",
"an",
"URL",
"instance"
] | train | https://github.com/Visithor/visithor/blob/201ba2cfc536a0875983c79226947aa20b9f4dca/src/Visithor/Client/GuzzleClient.php#L64-L81 |
phpgears/dto | src/AbstractDTOCollection.php | AbstractDTOCollection.verifyElementsType | private function verifyElementsType(array $elements): void
{
$allowedType = $this->getAllowedType();
if ($allowedType !== DTO::class
&& (!\class_exists($allowedType) || !\in_array(DTO::class, \class_implements($allowedType), true))
) {
throw new InvalidCollectionTypeE... | php | private function verifyElementsType(array $elements): void
{
$allowedType = $this->getAllowedType();
if ($allowedType !== DTO::class
&& (!\class_exists($allowedType) || !\in_array(DTO::class, \class_implements($allowedType), true))
) {
throw new InvalidCollectionTypeE... | [
"private",
"function",
"verifyElementsType",
"(",
"array",
"$",
"elements",
")",
":",
"void",
"{",
"$",
"allowedType",
"=",
"$",
"this",
"->",
"getAllowedType",
"(",
")",
";",
"if",
"(",
"$",
"allowedType",
"!==",
"DTO",
"::",
"class",
"&&",
"(",
"!",
... | Verify collection elements type.
@param mixed[] $elements
@throws InvalidCollectionTypeException
@throws InvalidParameterException | [
"Verify",
"collection",
"elements",
"type",
"."
] | train | https://github.com/phpgears/dto/blob/404b2cdea108538b55caa261c29280062dd0e3db/src/AbstractDTOCollection.php#L76-L100 |
alevilar/ristorantino-vendor | Risto/Model/Behavior/MediaUploadableBehavior.php | MediaUploadableBehavior.setUp | function setUp(Model $Model, $options = array()) {
if ( array_key_exists('mediaUploadFieldName', $options) ) {
$this->_form_field_name = $options['mediaUploadFieldName'];
}
if ( array_key_exists('mediaUploadFk', $options) ) {
$this->_form_fk = $options['mediaUploadFk'];
}
$Model->bindModel(
... | php | function setUp(Model $Model, $options = array()) {
if ( array_key_exists('mediaUploadFieldName', $options) ) {
$this->_form_field_name = $options['mediaUploadFieldName'];
}
if ( array_key_exists('mediaUploadFk', $options) ) {
$this->_form_fk = $options['mediaUploadFk'];
}
$Model->bindModel(
... | [
"function",
"setUp",
"(",
"Model",
"$",
"Model",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"'mediaUploadFieldName'",
",",
"$",
"options",
")",
")",
"{",
"$",
"this",
"->",
"_form_field_name",
"=",
"$",
"... | Setup the behavior | [
"Setup",
"the",
"behavior"
] | train | https://github.com/alevilar/ristorantino-vendor/blob/6b91a1e20cc0ba09a1968d77e3de6512cfa2d966/Risto/Model/Behavior/MediaUploadableBehavior.php#L11-L44 |
alevilar/ristorantino-vendor | Risto/Model/Behavior/MediaUploadableBehavior.php | MediaUploadableBehavior.beforeSave | function beforeSave( Model $Model, $options = array() ){
if ( !array_key_exists('Media', $Model->belongsTo) ) {
$Model->bindModel(
array('belongsTo' => array(
'Media' => array(
'className' => 'Risto.Media'
)
)
)
)... | php | function beforeSave( Model $Model, $options = array() ){
if ( !array_key_exists('Media', $Model->belongsTo) ) {
$Model->bindModel(
array('belongsTo' => array(
'Media' => array(
'className' => 'Risto.Media'
)
)
)
)... | [
"function",
"beforeSave",
"(",
"Model",
"$",
"Model",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"'Media'",
",",
"$",
"Model",
"->",
"belongsTo",
")",
")",
"{",
"$",
"Model",
"->",
"bindModel",
"("... | beforeSave if a file is found, upload it, and then save the filename according to the settings | [
"beforeSave",
"if",
"a",
"file",
"is",
"found",
"upload",
"it",
"and",
"then",
"save",
"the",
"filename",
"according",
"to",
"the",
"settings"
] | train | https://github.com/alevilar/ristorantino-vendor/blob/6b91a1e20cc0ba09a1968d77e3de6512cfa2d966/Risto/Model/Behavior/MediaUploadableBehavior.php#L52-L82 |
maestroprog/saw-php | src/Service/ApplicationLoader.php | ApplicationLoader.instanceApp | public function instanceApp(string $applicationClass): ApplicationInterface
{
if (!$this->applicationConfig->isApplicationClassValid($applicationClass)) {
throw new \RuntimeException('Invalid application class: ' . $applicationClass);
}
try {
$arguments = $this->appli... | php | public function instanceApp(string $applicationClass): ApplicationInterface
{
if (!$this->applicationConfig->isApplicationClassValid($applicationClass)) {
throw new \RuntimeException('Invalid application class: ' . $applicationClass);
}
try {
$arguments = $this->appli... | [
"public",
"function",
"instanceApp",
"(",
"string",
"$",
"applicationClass",
")",
":",
"ApplicationInterface",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"applicationConfig",
"->",
"isApplicationClassValid",
"(",
"$",
"applicationClass",
")",
")",
"{",
"throw",
"ne... | Инстанцирует новый объект приложения.
Используется скриптом index.php.
@param string $applicationClass
@return ApplicationInterface | [
"Инстанцирует",
"новый",
"объект",
"приложения",
".",
"Используется",
"скриптом",
"index",
".",
"php",
"."
] | train | https://github.com/maestroprog/saw-php/blob/159215a4d7a951cca2a9c2eed3e1aa4f5b624cfb/src/Service/ApplicationLoader.php#L31-L51 |
maestroprog/saw-php | src/Service/ApplicationLoader.php | ApplicationLoader.instanceAllApps | public function instanceAllApps(): array
{
$allAppIds = $this->applicationConfig->getAllApplicationIds();
return array_map(function (string $id) {
return $this->instanceAppById($id);
}, $allAppIds);
} | php | public function instanceAllApps(): array
{
$allAppIds = $this->applicationConfig->getAllApplicationIds();
return array_map(function (string $id) {
return $this->instanceAppById($id);
}, $allAppIds);
} | [
"public",
"function",
"instanceAllApps",
"(",
")",
":",
"array",
"{",
"$",
"allAppIds",
"=",
"$",
"this",
"->",
"applicationConfig",
"->",
"getAllApplicationIds",
"(",
")",
";",
"return",
"array_map",
"(",
"function",
"(",
"string",
"$",
"id",
")",
"{",
"r... | Создаёт инстансы для всех приложений, описанных в разделе "applications" конфига.
@return ApplicationInterface[] | [
"Создаёт",
"инстансы",
"для",
"всех",
"приложений",
"описанных",
"в",
"разделе",
"applications",
"конфига",
"."
] | train | https://github.com/maestroprog/saw-php/blob/159215a4d7a951cca2a9c2eed3e1aa4f5b624cfb/src/Service/ApplicationLoader.php#L76-L83 |
phPoirot/psr7 | HttpRequest.php | HttpRequest.withUri | function withUri(UriInterface $uri, $preserveHost = false)
{
$new = clone $this;
$new->uri = $uri;
if ($preserveHost && $this->hasHeader('Host'))
return $new;
if (! $uri->getHost())
return $new;
$host = $uri->getHost();
if ($uri->getPort())
... | php | function withUri(UriInterface $uri, $preserveHost = false)
{
$new = clone $this;
$new->uri = $uri;
if ($preserveHost && $this->hasHeader('Host'))
return $new;
if (! $uri->getHost())
return $new;
$host = $uri->getHost();
if ($uri->getPort())
... | [
"function",
"withUri",
"(",
"UriInterface",
"$",
"uri",
",",
"$",
"preserveHost",
"=",
"false",
")",
"{",
"$",
"new",
"=",
"clone",
"$",
"this",
";",
"$",
"new",
"->",
"uri",
"=",
"$",
"uri",
";",
"if",
"(",
"$",
"preserveHost",
"&&",
"$",
"this",
... | Returns an instance with the provided URI.
This method MUST update the Host header of the returned request by
default if the URI contains a host component. If the URI does not
contain a host component, any pre-existing Host header MUST be carried
over to the returned request.
You can opt-in to preserving the original... | [
"Returns",
"an",
"instance",
"with",
"the",
"provided",
"URI",
"."
] | train | https://github.com/phPoirot/psr7/blob/e90295e806dc2eb0cc422f315075f673c63a0780/HttpRequest.php#L235-L262 |
phPoirot/psr7 | HttpRequest.php | HttpRequest.getHeaders | function getHeaders()
{
$headers = $this->headers;
if (! $this->hasHeader('host')) {
if ($this->uri && $this->uri->getHost())
$headers['Host'] = array($this->_getHostFromUri());
}
return $headers;
} | php | function getHeaders()
{
$headers = $this->headers;
if (! $this->hasHeader('host')) {
if ($this->uri && $this->uri->getHost())
$headers['Host'] = array($this->_getHostFromUri());
}
return $headers;
} | [
"function",
"getHeaders",
"(",
")",
"{",
"$",
"headers",
"=",
"$",
"this",
"->",
"headers",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"hasHeader",
"(",
"'host'",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"uri",
"&&",
"$",
"this",
"->",
"uri",
... | @Override
{@inheritdoc} | [
"@Override"
] | train | https://github.com/phPoirot/psr7/blob/e90295e806dc2eb0cc422f315075f673c63a0780/HttpRequest.php#L272-L281 |
phPoirot/psr7 | HttpRequest.php | HttpRequest.getHeader | function getHeader($header)
{
if (! $this->hasHeader($header)) {
if (strtolower($header) === 'host'
&& ($this->uri && $this->uri->getHost())
)
return array($this->_getHostFromUri());
return array();
}
$header = $this->_c_h... | php | function getHeader($header)
{
if (! $this->hasHeader($header)) {
if (strtolower($header) === 'host'
&& ($this->uri && $this->uri->getHost())
)
return array($this->_getHostFromUri());
return array();
}
$header = $this->_c_h... | [
"function",
"getHeader",
"(",
"$",
"header",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasHeader",
"(",
"$",
"header",
")",
")",
"{",
"if",
"(",
"strtolower",
"(",
"$",
"header",
")",
"===",
"'host'",
"&&",
"(",
"$",
"this",
"->",
"uri",
"&&"... | @Override
{@inheritdoc} | [
"@Override"
] | train | https://github.com/phPoirot/psr7/blob/e90295e806dc2eb0cc422f315075f673c63a0780/HttpRequest.php#L288-L303 |
phPoirot/psr7 | HttpRequest.php | HttpRequest._getHostFromUri | protected function _getHostFromUri()
{
$host = $this->uri->getHost();
$host .= $this->uri->getPort() ? ':' . $this->uri->getPort() : '';
return $host;
} | php | protected function _getHostFromUri()
{
$host = $this->uri->getHost();
$host .= $this->uri->getPort() ? ':' . $this->uri->getPort() : '';
return $host;
} | [
"protected",
"function",
"_getHostFromUri",
"(",
")",
"{",
"$",
"host",
"=",
"$",
"this",
"->",
"uri",
"->",
"getHost",
"(",
")",
";",
"$",
"host",
".=",
"$",
"this",
"->",
"uri",
"->",
"getPort",
"(",
")",
"?",
"':'",
".",
"$",
"this",
"->",
"ur... | Retrieve the host from the URI instance
@return string | [
"Retrieve",
"the",
"host",
"from",
"the",
"URI",
"instance"
] | train | https://github.com/phPoirot/psr7/blob/e90295e806dc2eb0cc422f315075f673c63a0780/HttpRequest.php#L310-L315 |
dragonmantank/fillet | src/Fillet/Writer/WriterFactory.php | WriterFactory.create | public static function create($postType, $config, $throwExceptionOnInvalidWriter = false)
{
$className = 'Fillet\\Writer\\' . ucfirst($postType) . 'Writer';
if(class_exists($className)) {
/** @var WriterInterface $writer */
$writer = new $className($config['destinationFolders... | php | public static function create($postType, $config, $throwExceptionOnInvalidWriter = false)
{
$className = 'Fillet\\Writer\\' . ucfirst($postType) . 'Writer';
if(class_exists($className)) {
/** @var WriterInterface $writer */
$writer = new $className($config['destinationFolders... | [
"public",
"static",
"function",
"create",
"(",
"$",
"postType",
",",
"$",
"config",
",",
"$",
"throwExceptionOnInvalidWriter",
"=",
"false",
")",
"{",
"$",
"className",
"=",
"'Fillet\\\\Writer\\\\'",
".",
"ucfirst",
"(",
"$",
"postType",
")",
".",
"'Writer'",
... | Create a new instance of a writer based on the post type
@param string $postType Post type we are working against
@param array $config Config to use to generate the writer
@param bool $throwExceptionOnInvalidWriter Whether to throw an exception if an unknown writer is requested
@return WriterInterface
@throws \Except... | [
"Create",
"a",
"new",
"instance",
"of",
"a",
"writer",
"based",
"on",
"the",
"post",
"type"
] | train | https://github.com/dragonmantank/fillet/blob/b197947608c05ac2318e8f6b296345494004d9c6/src/Fillet/Writer/WriterFactory.php#L22-L34 |
EmanuelNikolov/IgdbApiBundle | Igdb/Parameter/ParameterBuilder.php | ParameterBuilder.setFilters | public function setFilters(
string $field,
string $postfix
): ParameterBuilderInterface {
$this->filters[$field] = $postfix;
return $this;
} | php | public function setFilters(
string $field,
string $postfix
): ParameterBuilderInterface {
$this->filters[$field] = $postfix;
return $this;
} | [
"public",
"function",
"setFilters",
"(",
"string",
"$",
"field",
",",
"string",
"$",
"postfix",
")",
":",
"ParameterBuilderInterface",
"{",
"$",
"this",
"->",
"filters",
"[",
"$",
"field",
"]",
"=",
"$",
"postfix",
";",
"return",
"$",
"this",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/EmanuelNikolov/IgdbApiBundle/blob/eedfc80298064a424990ebc5924649afdeaa00c8/Igdb/Parameter/ParameterBuilder.php#L82-L88 |
EmanuelNikolov/IgdbApiBundle | Igdb/Parameter/ParameterBuilder.php | ParameterBuilder.buildQueryString | public function buildQueryString(): string
{
$propsArr = get_object_vars($this);
foreach ($propsArr as $key => $prop) {
// faster than is_array smh
if ((array)$prop === $prop && $key !== 'filters') {
$propsArr[$key] = implode(',', $prop);
}
... | php | public function buildQueryString(): string
{
$propsArr = get_object_vars($this);
foreach ($propsArr as $key => $prop) {
// faster than is_array smh
if ((array)$prop === $prop && $key !== 'filters') {
$propsArr[$key] = implode(',', $prop);
}
... | [
"public",
"function",
"buildQueryString",
"(",
")",
":",
"string",
"{",
"$",
"propsArr",
"=",
"get_object_vars",
"(",
"$",
"this",
")",
";",
"foreach",
"(",
"$",
"propsArr",
"as",
"$",
"key",
"=>",
"$",
"prop",
")",
"{",
"// faster than is_array smh",
"if"... | {@inheritdoc} | [
"{"
] | train | https://github.com/EmanuelNikolov/IgdbApiBundle/blob/eedfc80298064a424990ebc5924649afdeaa00c8/Igdb/Parameter/ParameterBuilder.php#L156-L184 |
EmanuelNikolov/IgdbApiBundle | Igdb/Parameter/ParameterBuilder.php | ParameterBuilder.clear | public function clear(): void
{
$props = get_object_vars($this);
foreach ($props as $key => $prop) {
$this->$key = null;
}
} | php | public function clear(): void
{
$props = get_object_vars($this);
foreach ($props as $key => $prop) {
$this->$key = null;
}
} | [
"public",
"function",
"clear",
"(",
")",
":",
"void",
"{",
"$",
"props",
"=",
"get_object_vars",
"(",
"$",
"this",
")",
";",
"foreach",
"(",
"$",
"props",
"as",
"$",
"key",
"=>",
"$",
"prop",
")",
"{",
"$",
"this",
"->",
"$",
"key",
"=",
"null",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/EmanuelNikolov/IgdbApiBundle/blob/eedfc80298064a424990ebc5924649afdeaa00c8/Igdb/Parameter/ParameterBuilder.php#L189-L196 |
rinvex/renamed-attributes | src/Traits/Attributable.php | Attributable.relationsToArray | public function relationsToArray()
{
$eavAttributes = [];
$attributes = parent::relationsToArray();
$relations = array_keys($this->getEntityAttributeRelations());
foreach ($relations as $relation) {
if (array_key_exists($relation, $attributes)) {
$eavAttr... | php | public function relationsToArray()
{
$eavAttributes = [];
$attributes = parent::relationsToArray();
$relations = array_keys($this->getEntityAttributeRelations());
foreach ($relations as $relation) {
if (array_key_exists($relation, $attributes)) {
$eavAttr... | [
"public",
"function",
"relationsToArray",
"(",
")",
"{",
"$",
"eavAttributes",
"=",
"[",
"]",
";",
"$",
"attributes",
"=",
"parent",
"::",
"relationsToArray",
"(",
")",
";",
"$",
"relations",
"=",
"array_keys",
"(",
"$",
"this",
"->",
"getEntityAttributeRela... | {@inheritdoc} | [
"{"
] | train | https://github.com/rinvex/renamed-attributes/blob/5cd6807783e6c8356a3805f15a0d8ea621c48a63/src/Traits/Attributable.php#L81-L106 |
mmanos/laravel-casset | src/Mmanos/Casset/Container.php | Container.add | public function add($source, array $attributes = array(), array $dependencies = array())
{
$ext = pathinfo($source, PATHINFO_EXTENSION);
$this->assets[$source] = compact('ext', 'source', 'attributes', 'dependencies');
} | php | public function add($source, array $attributes = array(), array $dependencies = array())
{
$ext = pathinfo($source, PATHINFO_EXTENSION);
$this->assets[$source] = compact('ext', 'source', 'attributes', 'dependencies');
} | [
"public",
"function",
"add",
"(",
"$",
"source",
",",
"array",
"$",
"attributes",
"=",
"array",
"(",
")",
",",
"array",
"$",
"dependencies",
"=",
"array",
"(",
")",
")",
"{",
"$",
"ext",
"=",
"pathinfo",
"(",
"$",
"source",
",",
"PATHINFO_EXTENSION",
... | Add an asset (of any type) to the container.
Accepts a source relative to the configured 'assets_dir'.
eg: 'js/jquery.js'
Also accepts a source relative to a package.
eg: 'package::js/file.js'
@param string $source Relative path to file.
@param array $attributes Attribuets array.
@param array $dependencies... | [
"Add",
"an",
"asset",
"(",
"of",
"any",
"type",
")",
"to",
"the",
"container",
"."
] | train | https://github.com/mmanos/laravel-casset/blob/0f7db71211c1daa99bde30afa41da2692a39b81c/src/Mmanos/Casset/Container.php#L154-L159 |
mmanos/laravel-casset | src/Mmanos/Casset/Container.php | Container.styles | public function styles()
{
$assets = array();
foreach ($this->assets as $asset) {
if ('css' !== $asset['ext'] && 'less' !== $asset['ext']) {
continue;
}
$assets[] = $this->route ? $asset : $this->process($asset);
}
if (empty($assets)) {
return '';
}
if ($this->route) {
retur... | php | public function styles()
{
$assets = array();
foreach ($this->assets as $asset) {
if ('css' !== $asset['ext'] && 'less' !== $asset['ext']) {
continue;
}
$assets[] = $this->route ? $asset : $this->process($asset);
}
if (empty($assets)) {
return '';
}
if ($this->route) {
retur... | [
"public",
"function",
"styles",
"(",
")",
"{",
"$",
"assets",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"assets",
"as",
"$",
"asset",
")",
"{",
"if",
"(",
"'css'",
"!==",
"$",
"asset",
"[",
"'ext'",
"]",
"&&",
"'less'",
"!==... | Get the HTML links to all of the registered CSS assets.
@return string | [
"Get",
"the",
"HTML",
"links",
"to",
"all",
"of",
"the",
"registered",
"CSS",
"assets",
"."
] | train | https://github.com/mmanos/laravel-casset/blob/0f7db71211c1daa99bde30afa41da2692a39b81c/src/Mmanos/Casset/Container.php#L166-L197 |
mmanos/laravel-casset | src/Mmanos/Casset/Container.php | Container.scripts | public function scripts()
{
$assets = array();
foreach ($this->assets as $asset) {
if ('js' !== $asset['ext']) {
continue;
}
$assets[] = $this->route ? $asset : $this->process($asset);
}
if (empty($assets)) {
return '';
}
if ($this->route) {
return $this->prepareForControlle... | php | public function scripts()
{
$assets = array();
foreach ($this->assets as $asset) {
if ('js' !== $asset['ext']) {
continue;
}
$assets[] = $this->route ? $asset : $this->process($asset);
}
if (empty($assets)) {
return '';
}
if ($this->route) {
return $this->prepareForControlle... | [
"public",
"function",
"scripts",
"(",
")",
"{",
"$",
"assets",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"assets",
"as",
"$",
"asset",
")",
"{",
"if",
"(",
"'js'",
"!==",
"$",
"asset",
"[",
"'ext'",
"]",
")",
"{",
"continue"... | Get the HTML links to all of the registered JavaScript assets.
@return string | [
"Get",
"the",
"HTML",
"links",
"to",
"all",
"of",
"the",
"registered",
"JavaScript",
"assets",
"."
] | train | https://github.com/mmanos/laravel-casset/blob/0f7db71211c1daa99bde30afa41da2692a39b81c/src/Mmanos/Casset/Container.php#L204-L235 |
mmanos/laravel-casset | src/Mmanos/Casset/Container.php | Container.prepareForController | public function prepareForController($assets, $type)
{
$controller_url = $this->cdn ? $this->cdn . '/' : '/';
$controller_url .= $this->route . '/' . $type;
$controller_url .= '?c=' . urlencode($this->name);
$links = array();
foreach ($assets as &$asset) {
$attributes = $asset['attributes'];
unse... | php | public function prepareForController($assets, $type)
{
$controller_url = $this->cdn ? $this->cdn . '/' : '/';
$controller_url .= $this->route . '/' . $type;
$controller_url .= '?c=' . urlencode($this->name);
$links = array();
foreach ($assets as &$asset) {
$attributes = $asset['attributes'];
unse... | [
"public",
"function",
"prepareForController",
"(",
"$",
"assets",
",",
"$",
"type",
")",
"{",
"$",
"controller_url",
"=",
"$",
"this",
"->",
"cdn",
"?",
"$",
"this",
"->",
"cdn",
".",
"'/'",
":",
"'/'",
";",
"$",
"controller_url",
".=",
"$",
"this",
... | Prepare the given assets to be rendered to call the Casset controller
and return the HTML link to that resource.
@param array $assets
@param string $type
@return string | [
"Prepare",
"the",
"given",
"assets",
"to",
"be",
"rendered",
"to",
"call",
"the",
"Casset",
"controller",
"and",
"return",
"the",
"HTML",
"link",
"to",
"that",
"resource",
"."
] | train | https://github.com/mmanos/laravel-casset/blob/0f7db71211c1daa99bde30afa41da2692a39b81c/src/Mmanos/Casset/Container.php#L246-L289 |
mmanos/laravel-casset | src/Mmanos/Casset/Container.php | Container.content | public function content($type)
{
$assets = array();
foreach ($this->assets as $asset) {
if ('style' == $type && 'css' !== $asset['ext'] && 'less' !== $asset['ext']) {
continue;
}
else if ('script' == $type && 'js' !== $asset['ext']) {
continue;
}
$assets[] = $this->process($asset);
... | php | public function content($type)
{
$assets = array();
foreach ($this->assets as $asset) {
if ('style' == $type && 'css' !== $asset['ext'] && 'less' !== $asset['ext']) {
continue;
}
else if ('script' == $type && 'js' !== $asset['ext']) {
continue;
}
$assets[] = $this->process($asset);
... | [
"public",
"function",
"content",
"(",
"$",
"type",
")",
"{",
"$",
"assets",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"assets",
"as",
"$",
"asset",
")",
"{",
"if",
"(",
"'style'",
"==",
"$",
"type",
"&&",
"'css'",
"!==",
"$"... | Process and return the contents for this container for the
requested file type.
@param string $type 'style' or 'script'
@return string | [
"Process",
"and",
"return",
"the",
"contents",
"for",
"this",
"container",
"for",
"the",
"requested",
"file",
"type",
"."
] | train | https://github.com/mmanos/laravel-casset/blob/0f7db71211c1daa99bde30afa41da2692a39b81c/src/Mmanos/Casset/Container.php#L299-L329 |
mmanos/laravel-casset | src/Mmanos/Casset/Container.php | Container.image | public function image($source, $alt = null, $attributes = array())
{
$url = $source;
if (false === strstr($source, '://') && '//' !== substr($source, 0, 2)) {
$url = $this->cdn($source);
}
return HTML::image($url, $alt, $attributes);
} | php | public function image($source, $alt = null, $attributes = array())
{
$url = $source;
if (false === strstr($source, '://') && '//' !== substr($source, 0, 2)) {
$url = $this->cdn($source);
}
return HTML::image($url, $alt, $attributes);
} | [
"public",
"function",
"image",
"(",
"$",
"source",
",",
"$",
"alt",
"=",
"null",
",",
"$",
"attributes",
"=",
"array",
"(",
")",
")",
"{",
"$",
"url",
"=",
"$",
"source",
";",
"if",
"(",
"false",
"===",
"strstr",
"(",
"$",
"source",
",",
"'://'",... | Add an image asset to the container.
@param string $source
@param string $alt
@param array $attributes
@return string | [
"Add",
"an",
"image",
"asset",
"to",
"the",
"container",
"."
] | train | https://github.com/mmanos/laravel-casset/blob/0f7db71211c1daa99bde30afa41da2692a39b81c/src/Mmanos/Casset/Container.php#L340-L349 |
mmanos/laravel-casset | src/Mmanos/Casset/Container.php | Container.cdn | public function cdn($source)
{
$url = str_ireplace($this->public_path, '', $this->assets_path . '/' . ltrim($source, '/'));
$url = $this->cdn ? $this->cdn . $url : $url;
return $url;
} | php | public function cdn($source)
{
$url = str_ireplace($this->public_path, '', $this->assets_path . '/' . ltrim($source, '/'));
$url = $this->cdn ? $this->cdn . $url : $url;
return $url;
} | [
"public",
"function",
"cdn",
"(",
"$",
"source",
")",
"{",
"$",
"url",
"=",
"str_ireplace",
"(",
"$",
"this",
"->",
"public_path",
",",
"''",
",",
"$",
"this",
"->",
"assets_path",
".",
"'/'",
".",
"ltrim",
"(",
"$",
"source",
",",
"'/'",
")",
")",... | Get the URL to the CDN for an asset.
@param string $source
@return string | [
"Get",
"the",
"URL",
"to",
"the",
"CDN",
"for",
"an",
"asset",
"."
] | train | https://github.com/mmanos/laravel-casset/blob/0f7db71211c1daa99bde30afa41da2692a39b81c/src/Mmanos/Casset/Container.php#L358-L363 |
mmanos/laravel-casset | src/Mmanos/Casset/Container.php | Container.path | public function path($source)
{
if (false === stristr($source, '::')) {
return $this->assets_path . '/' . ltrim($source, '/');
}
$source_parts = explode('::', $source);
$package_name = current($source_parts);
// Is this relative to the public dir?
$path = '/public/' . ltrim(end($source_parts), '/'... | php | public function path($source)
{
if (false === stristr($source, '::')) {
return $this->assets_path . '/' . ltrim($source, '/');
}
$source_parts = explode('::', $source);
$package_name = current($source_parts);
// Is this relative to the public dir?
$path = '/public/' . ltrim(end($source_parts), '/'... | [
"public",
"function",
"path",
"(",
"$",
"source",
")",
"{",
"if",
"(",
"false",
"===",
"stristr",
"(",
"$",
"source",
",",
"'::'",
")",
")",
"{",
"return",
"$",
"this",
"->",
"assets_path",
".",
"'/'",
".",
"ltrim",
"(",
"$",
"source",
",",
"'/'",
... | Get the full path to the given asset source. Will try to load from a
package/workbench if prefixed with: "{package_name}::".
@param string $source Asset source.
@return string | [
"Get",
"the",
"full",
"path",
"to",
"the",
"given",
"asset",
"source",
".",
"Will",
"try",
"to",
"load",
"from",
"a",
"package",
"/",
"workbench",
"if",
"prefixed",
"with",
":",
"{",
"package_name",
"}",
"::",
"."
] | train | https://github.com/mmanos/laravel-casset/blob/0f7db71211c1daa99bde30afa41da2692a39b81c/src/Mmanos/Casset/Container.php#L385-L416 |
mmanos/laravel-casset | src/Mmanos/Casset/Container.php | Container.publicPath | public function publicPath(array $asset)
{
$path = $this->path($asset['source']);
$is_public = (bool) stristr($path, $this->public_path);
$compiled_exts = array('less');
if ($is_public && !in_array($asset['ext'], $compiled_exts)) {
return $path;
}
$cache_path = $this->cache_path
. ... | php | public function publicPath(array $asset)
{
$path = $this->path($asset['source']);
$is_public = (bool) stristr($path, $this->public_path);
$compiled_exts = array('less');
if ($is_public && !in_array($asset['ext'], $compiled_exts)) {
return $path;
}
$cache_path = $this->cache_path
. ... | [
"public",
"function",
"publicPath",
"(",
"array",
"$",
"asset",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"path",
"(",
"$",
"asset",
"[",
"'source'",
"]",
")",
";",
"$",
"is_public",
"=",
"(",
"bool",
")",
"stristr",
"(",
"$",
"path",
",",
"... | Return the public path to the given asset.
If the file is not in the public directory,
or if it needs to be compiled (less, etc...), then the
public cache path is returned.
@param array $asset Asset array.
@return string | [
"Return",
"the",
"public",
"path",
"to",
"the",
"given",
"asset",
".",
"If",
"the",
"file",
"is",
"not",
"in",
"the",
"public",
"directory",
"or",
"if",
"it",
"needs",
"to",
"be",
"compiled",
"(",
"less",
"etc",
"...",
")",
"then",
"the",
"public",
"... | train | https://github.com/mmanos/laravel-casset/blob/0f7db71211c1daa99bde30afa41da2692a39b81c/src/Mmanos/Casset/Container.php#L428-L445 |
mmanos/laravel-casset | src/Mmanos/Casset/Container.php | Container.needsProcessing | public function needsProcessing(array $asset)
{
if (isset(static::$needs_processing[$asset['source']])) {
return static::$needs_processing[$asset['source']];
}
$path = $this->path($asset['source']);
$is_public = (bool) stristr($path, $this->public_path);
$compiled_exts = array('less');
... | php | public function needsProcessing(array $asset)
{
if (isset(static::$needs_processing[$asset['source']])) {
return static::$needs_processing[$asset['source']];
}
$path = $this->path($asset['source']);
$is_public = (bool) stristr($path, $this->public_path);
$compiled_exts = array('less');
... | [
"public",
"function",
"needsProcessing",
"(",
"array",
"$",
"asset",
")",
"{",
"if",
"(",
"isset",
"(",
"static",
"::",
"$",
"needs_processing",
"[",
"$",
"asset",
"[",
"'source'",
"]",
"]",
")",
")",
"{",
"return",
"static",
"::",
"$",
"needs_processing... | Returns whether or not a file needs to be processed.
@param array $asset Asset array.
@return boolean | [
"Returns",
"whether",
"or",
"not",
"a",
"file",
"needs",
"to",
"be",
"processed",
"."
] | train | https://github.com/mmanos/laravel-casset/blob/0f7db71211c1daa99bde30afa41da2692a39b81c/src/Mmanos/Casset/Container.php#L454-L513 |
mmanos/laravel-casset | src/Mmanos/Casset/Container.php | Container.process | public function process(array $asset)
{
// Any dependencies that need processing?
$dependencies = isset($asset['dependencies']) ? $asset['dependencies'] : array();
$dependencies = array_unique(array_merge(array_get($this->dependencies, $asset['ext'], array()), $dependencies));
if (!empty($dependencies)) {
f... | php | public function process(array $asset)
{
// Any dependencies that need processing?
$dependencies = isset($asset['dependencies']) ? $asset['dependencies'] : array();
$dependencies = array_unique(array_merge(array_get($this->dependencies, $asset['ext'], array()), $dependencies));
if (!empty($dependencies)) {
f... | [
"public",
"function",
"process",
"(",
"array",
"$",
"asset",
")",
"{",
"// Any dependencies that need processing?",
"$",
"dependencies",
"=",
"isset",
"(",
"$",
"asset",
"[",
"'dependencies'",
"]",
")",
"?",
"$",
"asset",
"[",
"'dependencies'",
"]",
":",
"arra... | Process the given asset.
Make public, if needed.
Compile, if needed (less, etc...).
Returns a valid asset.
@param array $asset Asset array.
@return array [url, attributes] | [
"Process",
"the",
"given",
"asset",
".",
"Make",
"public",
"if",
"needed",
".",
"Compile",
"if",
"needed",
"(",
"less",
"etc",
"...",
")",
"."
] | train | https://github.com/mmanos/laravel-casset/blob/0f7db71211c1daa99bde30afa41da2692a39b81c/src/Mmanos/Casset/Container.php#L526-L559 |
mmanos/laravel-casset | src/Mmanos/Casset/Container.php | Container.compile | public function compile($path)
{
switch (pathinfo($path, PATHINFO_EXTENSION)) {
case 'less':
$less = new Less_Parser;
$content = '/*' . md5(File::get($path)) . "*/\n" . $less->parseFile($path)->getCss();
break;
default:
$content = File::get($path);
}
return $content;
} | php | public function compile($path)
{
switch (pathinfo($path, PATHINFO_EXTENSION)) {
case 'less':
$less = new Less_Parser;
$content = '/*' . md5(File::get($path)) . "*/\n" . $less->parseFile($path)->getCss();
break;
default:
$content = File::get($path);
}
return $content;
} | [
"public",
"function",
"compile",
"(",
"$",
"path",
")",
"{",
"switch",
"(",
"pathinfo",
"(",
"$",
"path",
",",
"PATHINFO_EXTENSION",
")",
")",
"{",
"case",
"'less'",
":",
"$",
"less",
"=",
"new",
"Less_Parser",
";",
"$",
"content",
"=",
"'/*'",
".",
... | Compile and return the content for the given asset according to it's
extension.
@param string $path Asset path.
@return string | [
"Compile",
"and",
"return",
"the",
"content",
"for",
"the",
"given",
"asset",
"according",
"to",
"it",
"s",
"extension",
"."
] | train | https://github.com/mmanos/laravel-casset/blob/0f7db71211c1daa99bde30afa41da2692a39b81c/src/Mmanos/Casset/Container.php#L569-L583 |
mmanos/laravel-casset | src/Mmanos/Casset/Container.php | Container.combine | public function combine(array $assets, $type)
{
$paths = array();
$lastmod = 0;
foreach ($assets as $asset) {
$paths[] = $asset['path'];
$mod = File::lastModified($asset['path']);
if ($mod > $lastmod) {
$lastmod = $mod;
}
}
$file = $this->cache_path . '/casset-' . md5(implode(',', $paths) ... | php | public function combine(array $assets, $type)
{
$paths = array();
$lastmod = 0;
foreach ($assets as $asset) {
$paths[] = $asset['path'];
$mod = File::lastModified($asset['path']);
if ($mod > $lastmod) {
$lastmod = $mod;
}
}
$file = $this->cache_path . '/casset-' . md5(implode(',', $paths) ... | [
"public",
"function",
"combine",
"(",
"array",
"$",
"assets",
",",
"$",
"type",
")",
"{",
"$",
"paths",
"=",
"array",
"(",
")",
";",
"$",
"lastmod",
"=",
"0",
";",
"foreach",
"(",
"$",
"assets",
"as",
"$",
"asset",
")",
"{",
"$",
"paths",
"[",
... | Combine the given array of assets. Minify, if enabled.
Returns new array containing one asset.
@param array $assets Array of assets.
@param string $type File type (script, style).
@return array | [
"Combine",
"the",
"given",
"array",
"of",
"assets",
".",
"Minify",
"if",
"enabled",
".",
"Returns",
"new",
"array",
"containing",
"one",
"asset",
"."
] | train | https://github.com/mmanos/laravel-casset/blob/0f7db71211c1daa99bde30afa41da2692a39b81c/src/Mmanos/Casset/Container.php#L594-L654 |
pvsaintpe/yii2-grid | components/ColumnTrait.php | ColumnTrait.fetchContentOptions | protected function fetchContentOptions($model, $key, $index)
{
$options = parent::fetchContentOptions($model, $key, $index);
if (!empty($this->columnOptions)) {
foreach ($this->columnOptions as $option => $value) {
$options['data-column-' . $option] = $value;
... | php | protected function fetchContentOptions($model, $key, $index)
{
$options = parent::fetchContentOptions($model, $key, $index);
if (!empty($this->columnOptions)) {
foreach ($this->columnOptions as $option => $value) {
$options['data-column-' . $option] = $value;
... | [
"protected",
"function",
"fetchContentOptions",
"(",
"$",
"model",
",",
"$",
"key",
",",
"$",
"index",
")",
"{",
"$",
"options",
"=",
"parent",
"::",
"fetchContentOptions",
"(",
"$",
"model",
",",
"$",
"key",
",",
"$",
"index",
")",
";",
"if",
"(",
"... | Parses and fetches updated content options for grid visibility and format
@param mixed $model the data model being rendered
@param mixed $key the key associated with the data model
@param integer $index the zero-based index of the data item among the item array returned by
[[GridView::dataProvider]].
@return array | [
"Parses",
"and",
"fetches",
"updated",
"content",
"options",
"for",
"grid",
"visibility",
"and",
"format"
] | train | https://github.com/pvsaintpe/yii2-grid/blob/8c91a1737412070775dc3fbee6a89384a67ca2cf/components/ColumnTrait.php#L41-L52 |
ShaoZeMing/laravel-merchant | src/Controllers/ModelForm.php | ModelForm.destroy | public function destroy($id)
{
if ($this->form()->destroy($id)) {
return response()->json([
'status' => true,
'message' => trans('merchant.delete_succeeded'),
]);
} else {
return response()->json([
'status' => fals... | php | public function destroy($id)
{
if ($this->form()->destroy($id)) {
return response()->json([
'status' => true,
'message' => trans('merchant.delete_succeeded'),
]);
} else {
return response()->json([
'status' => fals... | [
"public",
"function",
"destroy",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"form",
"(",
")",
"->",
"destroy",
"(",
"$",
"id",
")",
")",
"{",
"return",
"response",
"(",
")",
"->",
"json",
"(",
"[",
"'status'",
"=>",
"true",
",",
"'... | Remove the specified resource from storage.
@param int $id
@return \Illuminate\Http\Response | [
"Remove",
"the",
"specified",
"resource",
"from",
"storage",
"."
] | train | https://github.com/ShaoZeMing/laravel-merchant/blob/20801b1735e7832a6e58b37c2c391328f8d626fa/src/Controllers/ModelForm.php#L38-L51 |
heidelpay/PhpDoc | src/phpDocumentor/Descriptor/Builder/AssemblerFactory.php | AssemblerFactory.get | public function get($criteria)
{
foreach (array_merge($this->assemblers, $this->fallbackAssemblers) as $candidate) {
$matcher = $candidate['matcher'];
if ($matcher($criteria) === true) {
return $candidate['assembler'];
}
}
return null;
... | php | public function get($criteria)
{
foreach (array_merge($this->assemblers, $this->fallbackAssemblers) as $candidate) {
$matcher = $candidate['matcher'];
if ($matcher($criteria) === true) {
return $candidate['assembler'];
}
}
return null;
... | [
"public",
"function",
"get",
"(",
"$",
"criteria",
")",
"{",
"foreach",
"(",
"array_merge",
"(",
"$",
"this",
"->",
"assemblers",
",",
"$",
"this",
"->",
"fallbackAssemblers",
")",
"as",
"$",
"candidate",
")",
"{",
"$",
"matcher",
"=",
"$",
"candidate",
... | Retrieves a matching Assembler based on the provided criteria or null if none was found.
@param mixed $criteria
@return AssemblerInterface|null | [
"Retrieves",
"a",
"matching",
"Assembler",
"based",
"on",
"the",
"provided",
"criteria",
"or",
"null",
"if",
"none",
"was",
"found",
"."
] | train | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Descriptor/Builder/AssemblerFactory.php#L67-L77 |
WScore/Validation | src/Utils/ValueArray.php | ValueArray.getValue | public function getValue()
{
$values = [];
foreach($this->values as $key => $value) {
$values[$key] = $value->getValue();
}
return $values;
} | php | public function getValue()
{
$values = [];
foreach($this->values as $key => $value) {
$values[$key] = $value->getValue();
}
return $values;
} | [
"public",
"function",
"getValue",
"(",
")",
"{",
"$",
"values",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"values",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"values",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
"->",
"getV... | returns the value.
the value maybe invalid.
@return mixed | [
"returns",
"the",
"value",
".",
"the",
"value",
"maybe",
"invalid",
"."
] | train | https://github.com/WScore/Validation/blob/25c0dca37d624bb0bb22f8e79ba54db2f69e0950/src/Utils/ValueArray.php#L50-L57 |
WScore/Validation | src/Utils/ValueArray.php | ValueArray.getValidValue | public function getValidValue()
{
$values = [];
foreach($this->values as $key => $value) {
if ($this->isValidValue($value)) {
$values[$key] = $value->getValidValue();
}
}
return $values;
} | php | public function getValidValue()
{
$values = [];
foreach($this->values as $key => $value) {
if ($this->isValidValue($value)) {
$values[$key] = $value->getValidValue();
}
}
return $values;
} | [
"public",
"function",
"getValidValue",
"(",
")",
"{",
"$",
"values",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"values",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isValidValue",
"(",
"$",
"value",
... | return the validated value.
returns false if validation fails.
@return bool|mixed | [
"return",
"the",
"validated",
"value",
".",
"returns",
"false",
"if",
"validation",
"fails",
"."
] | train | https://github.com/WScore/Validation/blob/25c0dca37d624bb0bb22f8e79ba54db2f69e0950/src/Utils/ValueArray.php#L76-L85 |
WScore/Validation | src/Utils/ValueArray.php | ValueArray.message | public function message()
{
$messages = [];
foreach($this->values as $key => $value) {
if ($value->fails()) {
$messages[$key] = $value->message();
}
}
return $messages;
} | php | public function message()
{
$messages = [];
foreach($this->values as $key => $value) {
if ($value->fails()) {
$messages[$key] = $value->message();
}
}
return $messages;
} | [
"public",
"function",
"message",
"(",
")",
"{",
"$",
"messages",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"values",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"->",
"fails",
"(",
")",
")",
"{",
"$",
... | gets message regardless of the error state of this ValueTO.
use this message ONLY WHEN valueTO is error.
@return string|array | [
"gets",
"message",
"regardless",
"of",
"the",
"error",
"state",
"of",
"this",
"ValueTO",
".",
"use",
"this",
"message",
"ONLY",
"WHEN",
"valueTO",
"is",
"error",
"."
] | train | https://github.com/WScore/Validation/blob/25c0dca37d624bb0bb22f8e79ba54db2f69e0950/src/Utils/ValueArray.php#L112-L121 |
alexandresalome/journal-extension | src/Behat/JournalExtension/Formatter/Driver/MinkDriver.php | MinkDriver.getScreenshot | public function getScreenshot()
{
$driver = $this->mink->getSession()->getDriver();
if ($driver instanceof SeleniumDriver) {
$out = $driver->getBrowser()->captureEntirePageScreenshotToString("");
$out = str_replace("\n", "", $out);
return base64_decode($out);
... | php | public function getScreenshot()
{
$driver = $this->mink->getSession()->getDriver();
if ($driver instanceof SeleniumDriver) {
$out = $driver->getBrowser()->captureEntirePageScreenshotToString("");
$out = str_replace("\n", "", $out);
return base64_decode($out);
... | [
"public",
"function",
"getScreenshot",
"(",
")",
"{",
"$",
"driver",
"=",
"$",
"this",
"->",
"mink",
"->",
"getSession",
"(",
")",
"->",
"getDriver",
"(",
")",
";",
"if",
"(",
"$",
"driver",
"instanceof",
"SeleniumDriver",
")",
"{",
"$",
"out",
"=",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/alexandresalome/journal-extension/blob/de87304abb52abfa6905f1b83d2e35cc7bc52c0d/src/Behat/JournalExtension/Formatter/Driver/MinkDriver.php#L22-L38 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Cache/src/stack/lfu_meta_data.php | ezcCacheStackLfuMetaData.addItemToReplacementData | public function addItemToReplacementData( $itemId )
{
if ( !isset( $this->replacementData[$itemId] ) )
{
$this->replacementData[$itemId] = 0;
}
++$this->replacementData[$itemId];
} | php | public function addItemToReplacementData( $itemId )
{
if ( !isset( $this->replacementData[$itemId] ) )
{
$this->replacementData[$itemId] = 0;
}
++$this->replacementData[$itemId];
} | [
"public",
"function",
"addItemToReplacementData",
"(",
"$",
"itemId",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"replacementData",
"[",
"$",
"itemId",
"]",
")",
")",
"{",
"$",
"this",
"->",
"replacementData",
"[",
"$",
"itemId",
"]",
"... | Adds the given $itemId to the replacement data.
Initializes the entry for $itemId with 1, if it does not exist, yet.
Increments the entry by 1, if it does exist.
@param string $itemId | [
"Adds",
"the",
"given",
"$itemId",
"to",
"the",
"replacement",
"data",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Cache/src/stack/lfu_meta_data.php#L32-L39 |
gregorybesson/PlaygroundCms | src/Mapper/Dynablock.php | Dynablock.findByDynarea | public function findByDynarea($dynarea)
{
$er = $this->em->getRepository($this->options->getDynablockEntityClass());
$entities = $er->findBy(array('dynarea' => $dynarea), array('position' => 'ASC'));
return $entities;
} | php | public function findByDynarea($dynarea)
{
$er = $this->em->getRepository($this->options->getDynablockEntityClass());
$entities = $er->findBy(array('dynarea' => $dynarea), array('position' => 'ASC'));
return $entities;
} | [
"public",
"function",
"findByDynarea",
"(",
"$",
"dynarea",
")",
"{",
"$",
"er",
"=",
"$",
"this",
"->",
"em",
"->",
"getRepository",
"(",
"$",
"this",
"->",
"options",
"->",
"getDynablockEntityClass",
"(",
")",
")",
";",
"$",
"entities",
"=",
"$",
"er... | Find entity by integer id or string identifier
@param $identifier
@return object
@throws \Exception | [
"Find",
"entity",
"by",
"integer",
"id",
"or",
"string",
"identifier"
] | train | https://github.com/gregorybesson/PlaygroundCms/blob/e929a283f2a6e82d4f248c930f7aa454ce20cbc3/src/Mapper/Dynablock.php#L72-L79 |
gregorybesson/PlaygroundCms | src/Mapper/Dynablock.php | Dynablock.find | public function find($identifier)
{
if (is_int($identifier)) {
$entity = $this->findById($identifier);
} elseif (is_string($identifier)) {
$entity = $this->findByIdentifier($identifier);
} else {
throw new \Exception('Wrong block identifier provided.');
... | php | public function find($identifier)
{
if (is_int($identifier)) {
$entity = $this->findById($identifier);
} elseif (is_string($identifier)) {
$entity = $this->findByIdentifier($identifier);
} else {
throw new \Exception('Wrong block identifier provided.');
... | [
"public",
"function",
"find",
"(",
"$",
"identifier",
")",
"{",
"if",
"(",
"is_int",
"(",
"$",
"identifier",
")",
")",
"{",
"$",
"entity",
"=",
"$",
"this",
"->",
"findById",
"(",
"$",
"identifier",
")",
";",
"}",
"elseif",
"(",
"is_string",
"(",
"... | Find entity by integer id or string identifier
@param $identifier
@return object
@throws \Exception | [
"Find",
"entity",
"by",
"integer",
"id",
"or",
"string",
"identifier"
] | train | https://github.com/gregorybesson/PlaygroundCms/blob/e929a283f2a6e82d4f248c930f7aa454ce20cbc3/src/Mapper/Dynablock.php#L104-L115 |
zhouyl/mellivora | Mellivora/Http/Request.php | Request.fullUrlWithQuery | public function fullUrlWithQuery(array $query)
{
parse_str($this->getUri()->getQuery(), $queryParts);
return (string) $this->getUri()
->withQuery(http_build_query($query + $queryParts));
} | php | public function fullUrlWithQuery(array $query)
{
parse_str($this->getUri()->getQuery(), $queryParts);
return (string) $this->getUri()
->withQuery(http_build_query($query + $queryParts));
} | [
"public",
"function",
"fullUrlWithQuery",
"(",
"array",
"$",
"query",
")",
"{",
"parse_str",
"(",
"$",
"this",
"->",
"getUri",
"(",
")",
"->",
"getQuery",
"(",
")",
",",
"$",
"queryParts",
")",
";",
"return",
"(",
"string",
")",
"$",
"this",
"->",
"g... | Get the full URL for the request with the added query string parameters.
@param array $query
@return string | [
"Get",
"the",
"full",
"URL",
"for",
"the",
"request",
"with",
"the",
"added",
"query",
"string",
"parameters",
"."
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Http/Request.php#L85-L91 |
zhouyl/mellivora | Mellivora/Http/Request.php | Request.fullUrlIs | public function fullUrlIs()
{
$url = $this->fullUrl();
foreach (func_get_args() as $pattern) {
if (Str::is($pattern, $url)) {
return true;
}
}
return false;
} | php | public function fullUrlIs()
{
$url = $this->fullUrl();
foreach (func_get_args() as $pattern) {
if (Str::is($pattern, $url)) {
return true;
}
}
return false;
} | [
"public",
"function",
"fullUrlIs",
"(",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"fullUrl",
"(",
")",
";",
"foreach",
"(",
"func_get_args",
"(",
")",
"as",
"$",
"pattern",
")",
"{",
"if",
"(",
"Str",
"::",
"is",
"(",
"$",
"pattern",
",",
"$"... | Determine if the current request URL and query string matches a pattern.
@return bool | [
"Determine",
"if",
"the",
"current",
"request",
"URL",
"and",
"query",
"string",
"matches",
"a",
"pattern",
"."
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Http/Request.php#L146-L157 |
zhouyl/mellivora | Mellivora/Http/Request.php | Request.getClientAddress | public function getClientAddress()
{
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
// When a HTTP request is proxied, some proxy server will add requester's
// IP address to $_SERVER['HTTP_X_FORWARDED_FOR'].
// As a request may go through several proxies,
//... | php | public function getClientAddress()
{
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
// When a HTTP request is proxied, some proxy server will add requester's
// IP address to $_SERVER['HTTP_X_FORWARDED_FOR'].
// As a request may go through several proxies,
//... | [
"public",
"function",
"getClientAddress",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"_SERVER",
"[",
"'HTTP_X_FORWARDED_FOR'",
"]",
")",
")",
"{",
"// When a HTTP request is proxied, some proxy server will add requester's",
"// IP address to $_SERVER['HTTP_X_FORWARDED_... | Returns the client IP address.
@return string | [
"Returns",
"the",
"client",
"IP",
"address",
"."
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Http/Request.php#L194-L216 |
zhouyl/mellivora | Mellivora/Http/Request.php | Request.only | public function only($keys)
{
$keys = is_array($keys) ? $keys : func_get_args();
$results = [];
$input = $this->all();
foreach ($keys as $key) {
Arr::set($results, $key, data_get($input, $key));
}
return $results;
} | php | public function only($keys)
{
$keys = is_array($keys) ? $keys : func_get_args();
$results = [];
$input = $this->all();
foreach ($keys as $key) {
Arr::set($results, $key, data_get($input, $key));
}
return $results;
} | [
"public",
"function",
"only",
"(",
"$",
"keys",
")",
"{",
"$",
"keys",
"=",
"is_array",
"(",
"$",
"keys",
")",
"?",
"$",
"keys",
":",
"func_get_args",
"(",
")",
";",
"$",
"results",
"=",
"[",
"]",
";",
"$",
"input",
"=",
"$",
"this",
"->",
"all... | Get a subset containing the provided keys with values from the input data.
@param array|mixed $keys
@return array | [
"Get",
"a",
"subset",
"containing",
"the",
"provided",
"keys",
"with",
"values",
"from",
"the",
"input",
"data",
"."
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Http/Request.php#L348-L361 |
zhouyl/mellivora | Mellivora/Http/Request.php | Request.query | public function query($key = null, $default = null)
{
$queries = $this->getQueryParams();
return is_null($key) ? $queries : data_get($queries, $key, $default);
} | php | public function query($key = null, $default = null)
{
$queries = $this->getQueryParams();
return is_null($key) ? $queries : data_get($queries, $key, $default);
} | [
"public",
"function",
"query",
"(",
"$",
"key",
"=",
"null",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"queries",
"=",
"$",
"this",
"->",
"getQueryParams",
"(",
")",
";",
"return",
"is_null",
"(",
"$",
"key",
")",
"?",
"$",
"queries",
":",
... | Retrieve a query string item from the request.
@param string $key
@param null|array|string $default
@return array|string | [
"Retrieve",
"a",
"query",
"string",
"item",
"from",
"the",
"request",
"."
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Http/Request.php#L402-L407 |
zhouyl/mellivora | Mellivora/Http/Request.php | Request.post | public function post($key = null, $default = null)
{
$posts = $this->getPostParams();
return is_null($key) ? $posts : data_get($posts, $key, $default);
} | php | public function post($key = null, $default = null)
{
$posts = $this->getPostParams();
return is_null($key) ? $posts : data_get($posts, $key, $default);
} | [
"public",
"function",
"post",
"(",
"$",
"key",
"=",
"null",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"posts",
"=",
"$",
"this",
"->",
"getPostParams",
"(",
")",
";",
"return",
"is_null",
"(",
"$",
"key",
")",
"?",
"$",
"posts",
":",
"data... | Retrieve a post data item from the request.
@param string $key
@param null|array|string $default
@return array|string | [
"Retrieve",
"a",
"post",
"data",
"item",
"from",
"the",
"request",
"."
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Http/Request.php#L417-L422 |
zhouyl/mellivora | Mellivora/Http/Request.php | Request.server | public function server($key = null, $default = null)
{
$servers = $this->getServerParams();
return is_null($key) ? $servers : data_get($servers, $key, $default);
} | php | public function server($key = null, $default = null)
{
$servers = $this->getServerParams();
return is_null($key) ? $servers : data_get($servers, $key, $default);
} | [
"public",
"function",
"server",
"(",
"$",
"key",
"=",
"null",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"servers",
"=",
"$",
"this",
"->",
"getServerParams",
"(",
")",
";",
"return",
"is_null",
"(",
"$",
"key",
")",
"?",
"$",
"servers",
":",... | Retrieve a server variable from the request.
@param string $key
@param null|array|string $default
@return array|string | [
"Retrieve",
"a",
"server",
"variable",
"from",
"the",
"request",
"."
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Http/Request.php#L432-L437 |
zhouyl/mellivora | Mellivora/Http/Request.php | Request.cookie | public function cookie($key = null, $default = null)
{
$cookies = $this->getCookieParams();
return is_null($key) ? $cookies : data_get($cookies, $key, $default);
} | php | public function cookie($key = null, $default = null)
{
$cookies = $this->getCookieParams();
return is_null($key) ? $cookies : data_get($cookies, $key, $default);
} | [
"public",
"function",
"cookie",
"(",
"$",
"key",
"=",
"null",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"cookies",
"=",
"$",
"this",
"->",
"getCookieParams",
"(",
")",
";",
"return",
"is_null",
"(",
"$",
"key",
")",
"?",
"$",
"cookies",
":",... | Retrieve a cookie from the request.
@param string $key
@param null|array|string $default
@return array|string | [
"Retrieve",
"a",
"cookie",
"from",
"the",
"request",
"."
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Http/Request.php#L447-L452 |
zhouyl/mellivora | Mellivora/Http/Request.php | Request.file | public function file($key = null, $default = null)
{
$files = $this->getUploadedFiles();
return is_null($key) ? $files : data_get($files, $key, $default);
} | php | public function file($key = null, $default = null)
{
$files = $this->getUploadedFiles();
return is_null($key) ? $files : data_get($files, $key, $default);
} | [
"public",
"function",
"file",
"(",
"$",
"key",
"=",
"null",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"files",
"=",
"$",
"this",
"->",
"getUploadedFiles",
"(",
")",
";",
"return",
"is_null",
"(",
"$",
"key",
")",
"?",
"$",
"files",
":",
"d... | Retrieve a file from the request.
@param string $key
@param mixed $default
@return null|array | [
"Retrieve",
"a",
"file",
"from",
"the",
"request",
"."
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Http/Request.php#L462-L467 |
inhere/php-librarys | src/Helpers/PhpHelper.php | PhpHelper.getMaxUploadSize | public static function getMaxUploadSize($max_size = 0): int
{
$post_max_size = FormatHelper::convertBytes(ini_get('post_max_size'));
$upload_max_fileSize = FormatHelper::convertBytes(ini_get('upload_max_filesize'));
if ($max_size > 0) {
$result = min($post_max_size, $upload_max_... | php | public static function getMaxUploadSize($max_size = 0): int
{
$post_max_size = FormatHelper::convertBytes(ini_get('post_max_size'));
$upload_max_fileSize = FormatHelper::convertBytes(ini_get('upload_max_filesize'));
if ($max_size > 0) {
$result = min($post_max_size, $upload_max_... | [
"public",
"static",
"function",
"getMaxUploadSize",
"(",
"$",
"max_size",
"=",
"0",
")",
":",
"int",
"{",
"$",
"post_max_size",
"=",
"FormatHelper",
"::",
"convertBytes",
"(",
"ini_get",
"(",
"'post_max_size'",
")",
")",
";",
"$",
"upload_max_fileSize",
"=",
... | 根据服务器设置得到文件上传大小的最大值
@param int $max_size optional max file size
@return int max file size in bytes | [
"根据服务器设置得到文件上传大小的最大值"
] | train | https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/Helpers/PhpHelper.php#L99-L111 |
inhere/php-librarys | src/Helpers/PhpHelper.php | PhpHelper.exceptionToString | public static function exceptionToString($e, $getTrace = true, $catcher = null): string
{
return PhpException::toString($e, $getTrace, $catcher);
} | php | public static function exceptionToString($e, $getTrace = true, $catcher = null): string
{
return PhpException::toString($e, $getTrace, $catcher);
} | [
"public",
"static",
"function",
"exceptionToString",
"(",
"$",
"e",
",",
"$",
"getTrace",
"=",
"true",
",",
"$",
"catcher",
"=",
"null",
")",
":",
"string",
"{",
"return",
"PhpException",
"::",
"toString",
"(",
"$",
"e",
",",
"$",
"getTrace",
",",
"$",... | Converts an exception into a simple string.
@param \Exception|\Throwable $e the exception being converted
@param bool $getTrace
@param null|string $catcher
@return string the string representation of the exception. | [
"Converts",
"an",
"exception",
"into",
"a",
"simple",
"string",
"."
] | train | https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/Helpers/PhpHelper.php#L120-L123 |
inhere/php-librarys | src/Helpers/PhpHelper.php | PhpHelper.printVars | public static function printVars(...$args): string
{
$string = '';
foreach ($args as $arg) {
$string .= print_r($arg, 1) . PHP_EOL;
}
return preg_replace("/Array\n\s+\(/", 'Array (', $string);
} | php | public static function printVars(...$args): string
{
$string = '';
foreach ($args as $arg) {
$string .= print_r($arg, 1) . PHP_EOL;
}
return preg_replace("/Array\n\s+\(/", 'Array (', $string);
} | [
"public",
"static",
"function",
"printVars",
"(",
"...",
"$",
"args",
")",
":",
"string",
"{",
"$",
"string",
"=",
"''",
";",
"foreach",
"(",
"$",
"args",
"as",
"$",
"arg",
")",
"{",
"$",
"string",
".=",
"print_r",
"(",
"$",
"arg",
",",
"1",
")",... | print vars
@param array ...$args
@return string | [
"print",
"vars"
] | train | https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/Helpers/PhpHelper.php#L170-L179 |
thelia-modules/CustomerGroup | Handler/ConfigurationFileHandler.php | ConfigurationFileHandler.loadConfigurationFile | public function loadConfigurationFile(Module $module)
{
$finder = (new Finder)
// TODO: Flip when yaml parsing will be up
// ->name('#customer[-_\.]?group\.(?:xml|yml|yaml)#i')
->name('#customer[-_\.]?group\.xml#i')
->in($module->getAbsoluteConfigPath());
... | php | public function loadConfigurationFile(Module $module)
{
$finder = (new Finder)
// TODO: Flip when yaml parsing will be up
// ->name('#customer[-_\.]?group\.(?:xml|yml|yaml)#i')
->name('#customer[-_\.]?group\.xml#i')
->in($module->getAbsoluteConfigPath());
... | [
"public",
"function",
"loadConfigurationFile",
"(",
"Module",
"$",
"module",
")",
"{",
"$",
"finder",
"=",
"(",
"new",
"Finder",
")",
"// TODO: Flip when yaml parsing will be up",
"// ->name('#customer[-_\\.]?group\\.(?:xml|yml|yaml)#i')",
"->",
"name",
"(",
"'#c... | Find, parse and load customer group configuration file for module
@param Module $module A module object
@throws InvalidConfigurationException | [
"Find",
"parse",
"and",
"load",
"customer",
"group",
"configuration",
"file",
"for",
"module"
] | train | https://github.com/thelia-modules/CustomerGroup/blob/672cc64c686812f6a95cf0d702111f93d8c0e850/Handler/ConfigurationFileHandler.php#L25-L47 |
thelia-modules/CustomerGroup | Handler/ConfigurationFileHandler.php | ConfigurationFileHandler.applyConfig | protected function applyConfig(array $moduleConfiguration)
{
foreach ($moduleConfiguration['customer_group'] as $customerGroupData) {
if (CustomerGroupQuery::create()->findOneByCode($customerGroupData['code']) === null) {
$customerGroup = (new CustomerGroup)
-... | php | protected function applyConfig(array $moduleConfiguration)
{
foreach ($moduleConfiguration['customer_group'] as $customerGroupData) {
if (CustomerGroupQuery::create()->findOneByCode($customerGroupData['code']) === null) {
$customerGroup = (new CustomerGroup)
-... | [
"protected",
"function",
"applyConfig",
"(",
"array",
"$",
"moduleConfiguration",
")",
"{",
"foreach",
"(",
"$",
"moduleConfiguration",
"[",
"'customer_group'",
"]",
"as",
"$",
"customerGroupData",
")",
"{",
"if",
"(",
"CustomerGroupQuery",
"::",
"create",
"(",
... | Save new customer group to database
@param array $moduleConfiguration Customer group module configuration | [
"Save",
"new",
"customer",
"group",
"to",
"database"
] | train | https://github.com/thelia-modules/CustomerGroup/blob/672cc64c686812f6a95cf0d702111f93d8c0e850/Handler/ConfigurationFileHandler.php#L105-L133 |
thelia-modules/CustomerGroup | Handler/ConfigurationFileHandler.php | ConfigurationFileHandler.resetDefault | protected function resetDefault()
{
$defaultGroups = CustomerGroupQuery::create()
->filterByIsDefault(true)
->find();
foreach ($defaultGroups as $defaultGroup) {
$defaultGroup
->setIsDefault(false)
->save();
}
} | php | protected function resetDefault()
{
$defaultGroups = CustomerGroupQuery::create()
->filterByIsDefault(true)
->find();
foreach ($defaultGroups as $defaultGroup) {
$defaultGroup
->setIsDefault(false)
->save();
}
} | [
"protected",
"function",
"resetDefault",
"(",
")",
"{",
"$",
"defaultGroups",
"=",
"CustomerGroupQuery",
"::",
"create",
"(",
")",
"->",
"filterByIsDefault",
"(",
"true",
")",
"->",
"find",
"(",
")",
";",
"foreach",
"(",
"$",
"defaultGroups",
"as",
"$",
"d... | Remove is_default flag | [
"Remove",
"is_default",
"flag"
] | train | https://github.com/thelia-modules/CustomerGroup/blob/672cc64c686812f6a95cf0d702111f93d8c0e850/Handler/ConfigurationFileHandler.php#L138-L150 |
NuclearCMS/Hierarchy | src/Providers/BuilderServiceProvider.php | BuilderServiceProvider.register | public function register()
{
$this->registerModelBuilder();
$this->registerMigrationBuilder();
$this->registerFormBuilder();
$this->registerCacheBuilder();
$this->registerBuilderService();
} | php | public function register()
{
$this->registerModelBuilder();
$this->registerMigrationBuilder();
$this->registerFormBuilder();
$this->registerCacheBuilder();
$this->registerBuilderService();
} | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"registerModelBuilder",
"(",
")",
";",
"$",
"this",
"->",
"registerMigrationBuilder",
"(",
")",
";",
"$",
"this",
"->",
"registerFormBuilder",
"(",
")",
";",
"$",
"this",
"->",
"registerCa... | Register the service provider.
@return void | [
"Register",
"the",
"service",
"provider",
"."
] | train | https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Providers/BuilderServiceProvider.php#L38-L45 |
webdevvie/pheanstalk-task-queue-bundle | Service/TaskCommandGenerator.php | TaskCommandGenerator.generate | public function generate(WorkPackage $work)
{
$description = $work->getTaskDescription();
$command =$description->getCommand();
if (!$this->isValidCommand($command)) {
throw new TaskCommandGeneratorException("This command is not usable '{$command}' is not valid");
}
... | php | public function generate(WorkPackage $work)
{
$description = $work->getTaskDescription();
$command =$description->getCommand();
if (!$this->isValidCommand($command)) {
throw new TaskCommandGeneratorException("This command is not usable '{$command}' is not valid");
}
... | [
"public",
"function",
"generate",
"(",
"WorkPackage",
"$",
"work",
")",
"{",
"$",
"description",
"=",
"$",
"work",
"->",
"getTaskDescription",
"(",
")",
";",
"$",
"command",
"=",
"$",
"description",
"->",
"getCommand",
"(",
")",
";",
"if",
"(",
"!",
"$... | Generates a symfony2 console command to execute from the task
@param WorkPackage $work
@throws TaskCommandGeneratorException
@return string | [
"Generates",
"a",
"symfony2",
"console",
"command",
"to",
"execute",
"from",
"the",
"task"
] | train | https://github.com/webdevvie/pheanstalk-task-queue-bundle/blob/db5e63a8f844e345dc2e69ce8e94b32d851020eb/Service/TaskCommandGenerator.php#L25-L36 |
webdevvie/pheanstalk-task-queue-bundle | Service/TaskCommandGenerator.php | TaskCommandGenerator.generateArguments | private function generateArguments(TaskDescriptionInterface $description)
{
$cmdPart = '';
$arguments = $description->getArguments();
if (!is_array($arguments)) {
return $cmdPart;
}
foreach ($arguments as $argumentValue) {
if (is_string($argumentValue)... | php | private function generateArguments(TaskDescriptionInterface $description)
{
$cmdPart = '';
$arguments = $description->getArguments();
if (!is_array($arguments)) {
return $cmdPart;
}
foreach ($arguments as $argumentValue) {
if (is_string($argumentValue)... | [
"private",
"function",
"generateArguments",
"(",
"TaskDescriptionInterface",
"$",
"description",
")",
"{",
"$",
"cmdPart",
"=",
"''",
";",
"$",
"arguments",
"=",
"$",
"description",
"->",
"getArguments",
"(",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
... | Generates the argument part of the command
@param TaskDescriptionInterface $description
@return string | [
"Generates",
"the",
"argument",
"part",
"of",
"the",
"command"
] | train | https://github.com/webdevvie/pheanstalk-task-queue-bundle/blob/db5e63a8f844e345dc2e69ce8e94b32d851020eb/Service/TaskCommandGenerator.php#L44-L57 |
webdevvie/pheanstalk-task-queue-bundle | Service/TaskCommandGenerator.php | TaskCommandGenerator.generateOptions | private function generateOptions(TaskDescriptionInterface $description)
{
$cmdPart = '';
$options = $description->getOptions();
if (!is_array($options)) {
return $cmdPart;
}
foreach ($options as $optionName => $optionValue) {
//validate the option name... | php | private function generateOptions(TaskDescriptionInterface $description)
{
$cmdPart = '';
$options = $description->getOptions();
if (!is_array($options)) {
return $cmdPart;
}
foreach ($options as $optionName => $optionValue) {
//validate the option name... | [
"private",
"function",
"generateOptions",
"(",
"TaskDescriptionInterface",
"$",
"description",
")",
"{",
"$",
"cmdPart",
"=",
"''",
";",
"$",
"options",
"=",
"$",
"description",
"->",
"getOptions",
"(",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"opti... | Generates the options part of the command
@param TaskDescriptionInterface $description
@return string | [
"Generates",
"the",
"options",
"part",
"of",
"the",
"command"
] | train | https://github.com/webdevvie/pheanstalk-task-queue-bundle/blob/db5e63a8f844e345dc2e69ce8e94b32d851020eb/Service/TaskCommandGenerator.php#L65-L85 |
oroinc/OroLayoutComponent | Extension/Theme/Model/ThemeManager.php | ThemeManager.getTheme | public function getTheme($themeName)
{
if (empty($themeName)) {
throw new \InvalidArgumentException('The theme name must not be empty.');
} elseif (!$this->hasTheme($themeName)) {
throw new \LogicException(sprintf('Unable to retrieve definition for theme "%s".', $themeName));... | php | public function getTheme($themeName)
{
if (empty($themeName)) {
throw new \InvalidArgumentException('The theme name must not be empty.');
} elseif (!$this->hasTheme($themeName)) {
throw new \LogicException(sprintf('Unable to retrieve definition for theme "%s".', $themeName));... | [
"public",
"function",
"getTheme",
"(",
"$",
"themeName",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"themeName",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'The theme name must not be empty.'",
")",
";",
"}",
"elseif",
"(",
"!",
"$",... | Gets theme model instance
@param string $themeName
@return Theme | [
"Gets",
"theme",
"model",
"instance"
] | train | https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/Extension/Theme/Model/ThemeManager.php#L55-L69 |
oroinc/OroLayoutComponent | Extension/Theme/Model/ThemeManager.php | ThemeManager.mergePageTemplates | private function mergePageTemplates(Theme $theme)
{
if ($theme->getParentTheme()) {
$parentTheme = $this->getTheme($theme->getParentTheme());
foreach ($parentTheme->getPageTemplates() as $parentPageTemplate) {
$theme->addPageTemplate($parentPageTemplate);
... | php | private function mergePageTemplates(Theme $theme)
{
if ($theme->getParentTheme()) {
$parentTheme = $this->getTheme($theme->getParentTheme());
foreach ($parentTheme->getPageTemplates() as $parentPageTemplate) {
$theme->addPageTemplate($parentPageTemplate);
... | [
"private",
"function",
"mergePageTemplates",
"(",
"Theme",
"$",
"theme",
")",
"{",
"if",
"(",
"$",
"theme",
"->",
"getParentTheme",
"(",
")",
")",
"{",
"$",
"parentTheme",
"=",
"$",
"this",
"->",
"getTheme",
"(",
"$",
"theme",
"->",
"getParentTheme",
"("... | @param Theme $theme
@return Theme | [
"@param",
"Theme",
"$theme"
] | train | https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/Extension/Theme/Model/ThemeManager.php#L76-L93 |
oroinc/OroLayoutComponent | Extension/Theme/Model/ThemeManager.php | ThemeManager.getAllThemes | public function getAllThemes($groups = null)
{
$names = $this->getThemeNames();
$themes = array_combine(
$names,
array_map(
function ($themeName) {
return $this->getTheme($themeName);
},
$names
)... | php | public function getAllThemes($groups = null)
{
$names = $this->getThemeNames();
$themes = array_combine(
$names,
array_map(
function ($themeName) {
return $this->getTheme($themeName);
},
$names
)... | [
"public",
"function",
"getAllThemes",
"(",
"$",
"groups",
"=",
"null",
")",
"{",
"$",
"names",
"=",
"$",
"this",
"->",
"getThemeNames",
"(",
")",
";",
"$",
"themes",
"=",
"array_combine",
"(",
"$",
"names",
",",
"array_map",
"(",
"function",
"(",
"$",
... | @param null|string|array $groups
@return Theme[] | [
"@param",
"null|string|array",
"$groups"
] | train | https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/Extension/Theme/Model/ThemeManager.php#L100-L125 |
opsbears/piccolo | src/Module/AbstractModule.php | AbstractModule.getRequiredModule | protected function getRequiredModule(string $className) {
if (\array_key_exists($className, $this->modules)) {
return $this->modules[$className];
} else {
throw new ConfigurationException(__CLASS__ . ' tried to request module ' . $className .
', but it was not listed as a dependency or has not yet added.'... | php | protected function getRequiredModule(string $className) {
if (\array_key_exists($className, $this->modules)) {
return $this->modules[$className];
} else {
throw new ConfigurationException(__CLASS__ . ' tried to request module ' . $className .
', but it was not listed as a dependency or has not yet added.'... | [
"protected",
"function",
"getRequiredModule",
"(",
"string",
"$",
"className",
")",
"{",
"if",
"(",
"\\",
"array_key_exists",
"(",
"$",
"className",
",",
"$",
"this",
"->",
"modules",
")",
")",
"{",
"return",
"$",
"this",
"->",
"modules",
"[",
"$",
"clas... | Returns a module that has been set as required. This is only available after the constructor has finished.
@param string $className
@return Module
@throws ConfigurationException | [
"Returns",
"a",
"module",
"that",
"has",
"been",
"set",
"as",
"required",
".",
"This",
"is",
"only",
"available",
"after",
"the",
"constructor",
"has",
"finished",
"."
] | train | https://github.com/opsbears/piccolo/blob/ebba9f892ed35965140265ba1c61b2c645eab6e0/src/Module/AbstractModule.php#L81-L88 |
mvccore/ext-router-module | src/MvcCore/Ext/Routers/Module/Redirect.php | Redirect.redirectToVersion | protected function redirectToVersion ($systemParams) {
/** @var $request \MvcCore\Request */
$request = & $this->request;
// get domain with base path URL section,
// path with query string URL section
// system params for URL prefixes
// and if path with query string URL section targeting `/` or `/ind... | php | protected function redirectToVersion ($systemParams) {
/** @var $request \MvcCore\Request */
$request = & $this->request;
// get domain with base path URL section,
// path with query string URL section
// system params for URL prefixes
// and if path with query string URL section targeting `/` or `/ind... | [
"protected",
"function",
"redirectToVersion",
"(",
"$",
"systemParams",
")",
"{",
"/** @var $request \\MvcCore\\Request */",
"$",
"request",
"=",
"&",
"$",
"this",
"->",
"request",
";",
"// get domain with base path URL section, ",
"// path with query string URL section ",
"/... | Redirect to target media site version with path and by cloned request
object global `$_GET` collection. Return always `FALSE`.
@param array $systemParams
@return bool | [
"Redirect",
"to",
"target",
"media",
"site",
"version",
"with",
"path",
"and",
"by",
"cloned",
"request",
"object",
"global",
"$_GET",
"collection",
".",
"Return",
"always",
"FALSE",
"."
] | train | https://github.com/mvccore/ext-router-module/blob/7695784a451db86cca6a43c98d076803cd0a50a7/src/MvcCore/Ext/Routers/Module/Redirect.php#L24-L77 |
antaresproject/notifications | src/Listener/ConfigurationListener.php | ConfigurationListener.handle | public function handle(Fluent $model, Grid $grid)
{
$grid->fieldset(function(Fieldset $fieldset) {
$fieldset->legend(trans('antares/notifications::logs.form.notifications_config_legend'));
$fieldset->control('input:text', 'days')
->label('')
-... | php | public function handle(Fluent $model, Grid $grid)
{
$grid->fieldset(function(Fieldset $fieldset) {
$fieldset->legend(trans('antares/notifications::logs.form.notifications_config_legend'));
$fieldset->control('input:text', 'days')
->label('')
-... | [
"public",
"function",
"handle",
"(",
"Fluent",
"$",
"model",
",",
"Grid",
"$",
"grid",
")",
"{",
"$",
"grid",
"->",
"fieldset",
"(",
"function",
"(",
"Fieldset",
"$",
"fieldset",
")",
"{",
"$",
"fieldset",
"->",
"legend",
"(",
"trans",
"(",
"'antares/n... | Handles the security form event.
@param SecurityFormSubmitted $securityFormSubmitted | [
"Handles",
"the",
"security",
"form",
"event",
"."
] | train | https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Listener/ConfigurationListener.php#L18-L33 |
antaresproject/notifications | src/Listener/ConfigurationListener.php | ConfigurationListener.updated | public function updated(Option $model)
{
$option = Option::query()->firstOrNew([
'name' => 'notifications_remove_after_days'
]);
$option->value = input('days');
return $option->save();
} | php | public function updated(Option $model)
{
$option = Option::query()->firstOrNew([
'name' => 'notifications_remove_after_days'
]);
$option->value = input('days');
return $option->save();
} | [
"public",
"function",
"updated",
"(",
"Option",
"$",
"model",
")",
"{",
"$",
"option",
"=",
"Option",
"::",
"query",
"(",
")",
"->",
"firstOrNew",
"(",
"[",
"'name'",
"=>",
"'notifications_remove_after_days'",
"]",
")",
";",
"$",
"option",
"->",
"value",
... | Save notifications configuration
@param Option $model | [
"Save",
"notifications",
"configuration"
] | train | https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Listener/ConfigurationListener.php#L40-L48 |
ezsystems/ezcomments-ls-extension | classes/ezcomsubscription.php | ezcomSubscription.countWithSubscriberID | static function countWithSubscriberID( $subscriberID, $languageID =false , $enabled = false )
{
$cond = array();
$cond['subscriber_id'] = $subscriberID;
if ( $enabled !== false )
{
$cond['enabled'] = $enabled;
}
if ( $languageID !== false )
{
... | php | static function countWithSubscriberID( $subscriberID, $languageID =false , $enabled = false )
{
$cond = array();
$cond['subscriber_id'] = $subscriberID;
if ( $enabled !== false )
{
$cond['enabled'] = $enabled;
}
if ( $languageID !== false )
{
... | [
"static",
"function",
"countWithSubscriberID",
"(",
"$",
"subscriberID",
",",
"$",
"languageID",
"=",
"false",
",",
"$",
"enabled",
"=",
"false",
")",
"{",
"$",
"cond",
"=",
"array",
"(",
")",
";",
"$",
"cond",
"[",
"'subscriber_id'",
"]",
"=",
"$",
"s... | get the count of subscription in a subscriber ID
@param $subscriberID
@param $status
@return unknown_type | [
"get",
"the",
"count",
"of",
"subscription",
"in",
"a",
"subscriber",
"ID"
] | train | https://github.com/ezsystems/ezcomments-ls-extension/blob/2b4cd8c34d4a77813e4d6a9c5a0d317a274c63c5/classes/ezcomsubscription.php#L143-L157 |
ezsystems/ezcomments-ls-extension | classes/ezcomsubscription.php | ezcomSubscription.contentObject | public function contentObject()
{
$contentID = $this->attribute( 'content_id' );
//TODO:try to get the language id
$languageID = $this->attribute( 'language_id' );
return eZContentObject::fetch( $contentID );
} | php | public function contentObject()
{
$contentID = $this->attribute( 'content_id' );
//TODO:try to get the language id
$languageID = $this->attribute( 'language_id' );
return eZContentObject::fetch( $contentID );
} | [
"public",
"function",
"contentObject",
"(",
")",
"{",
"$",
"contentID",
"=",
"$",
"this",
"->",
"attribute",
"(",
"'content_id'",
")",
";",
"//TODO:try to get the language id",
"$",
"languageID",
"=",
"$",
"this",
"->",
"attribute",
"(",
"'language_id'",
")",
... | get the content of the subscription
@return ezcontentobject | [
"get",
"the",
"content",
"of",
"the",
"subscription"
] | train | https://github.com/ezsystems/ezcomments-ls-extension/blob/2b4cd8c34d4a77813e4d6a9c5a0d317a274c63c5/classes/ezcomsubscription.php#L182-L188 |
ezsystems/ezcomments-ls-extension | classes/ezcomsubscription.php | ezcomSubscription.cleanupSubscription | static function cleanupSubscription( $email, $contentobjectID, $languageID )
{
//2. get subscriber
$subscriber = ezcomSubscriber::fetchByEmail( $email );
if ( is_null( $subscriber ) )
{
return false;
}
$subscriberID = $subscriber->attribute( 'id' );
... | php | static function cleanupSubscription( $email, $contentobjectID, $languageID )
{
//2. get subscriber
$subscriber = ezcomSubscriber::fetchByEmail( $email );
if ( is_null( $subscriber ) )
{
return false;
}
$subscriberID = $subscriber->attribute( 'id' );
... | [
"static",
"function",
"cleanupSubscription",
"(",
"$",
"email",
",",
"$",
"contentobjectID",
",",
"$",
"languageID",
")",
"{",
"//2. get subscriber",
"$",
"subscriber",
"=",
"ezcomSubscriber",
"::",
"fetchByEmail",
"(",
"$",
"email",
")",
";",
"if",
"(",
"is_n... | clean up subscription based on an email address and content, language,
make the subscription consistent.
example:
@param string $email
@return true - there is subscription deleted
false - no subscription deleted
null - error | [
"clean",
"up",
"subscription",
"based",
"on",
"an",
"email",
"address",
"and",
"content",
"language",
"make",
"the",
"subscription",
"consistent",
".",
"example",
":"
] | train | https://github.com/ezsystems/ezcomments-ls-extension/blob/2b4cd8c34d4a77813e4d6a9c5a0d317a274c63c5/classes/ezcomsubscription.php#L199-L215 |
ezsystems/ezcomments-ls-extension | classes/ezcomsubscription.php | ezcomSubscription.exists | static function exists( $contentID, $languageID , $subscriptionType, $email = null, $enabled = false )
{
$emailString = '';
if ( !is_null($email) )
{
$emailString = " WHERE email = '$email'";
}
$countArray = null;
$db = eZDB::instance();
if ... | php | static function exists( $contentID, $languageID , $subscriptionType, $email = null, $enabled = false )
{
$emailString = '';
if ( !is_null($email) )
{
$emailString = " WHERE email = '$email'";
}
$countArray = null;
$db = eZDB::instance();
if ... | [
"static",
"function",
"exists",
"(",
"$",
"contentID",
",",
"$",
"languageID",
",",
"$",
"subscriptionType",
",",
"$",
"email",
"=",
"null",
",",
"$",
"enabled",
"=",
"false",
")",
"{",
"$",
"emailString",
"=",
"''",
";",
"if",
"(",
"!",
"is_null",
"... | Check if the subscription exists by a given contentID
@param string $contentID : the ID of content subscribed
@param string $languageID : the language ID of content
@param string $subscriptionType : type of the subscription
@param string $email : email in table subscriber
@param integer $enabled : 1/0 - check if the su... | [
"Check",
"if",
"the",
"subscription",
"exists",
"by",
"a",
"given",
"contentID"
] | train | https://github.com/ezsystems/ezcomments-ls-extension/blob/2b4cd8c34d4a77813e4d6a9c5a0d317a274c63c5/classes/ezcomsubscription.php#L227-L285 |
ShaoZeMing/laravel-merchant | src/Tree.php | Tree.render | public function render()
{
Merchant::script($this->script());
view()->share([
'path' => $this->path,
'keyName' => $this->model->getKeyName(),
'branchView' => $this->view['branch'],
'branchCallback' => $this->branchCallback,
... | php | public function render()
{
Merchant::script($this->script());
view()->share([
'path' => $this->path,
'keyName' => $this->model->getKeyName(),
'branchView' => $this->view['branch'],
'branchCallback' => $this->branchCallback,
... | [
"public",
"function",
"render",
"(",
")",
"{",
"Merchant",
"::",
"script",
"(",
"$",
"this",
"->",
"script",
"(",
")",
")",
";",
"view",
"(",
")",
"->",
"share",
"(",
"[",
"'path'",
"=>",
"$",
"this",
"->",
"path",
",",
"'keyName'",
"=>",
"$",
"t... | Render a tree.
@return \Illuminate\Http\JsonResponse|string | [
"Render",
"a",
"tree",
"."
] | train | https://github.com/ShaoZeMing/laravel-merchant/blob/20801b1735e7832a6e58b37c2c391328f8d626fa/src/Tree.php#L356-L368 |
fortis/silex-graphite | src/Graphite/Silex/Client/GraphiteClient.php | GraphiteClient.send | public function send($data)
{
$pieces = [
$this->config['apiKey'],
$this->config['prefix'],
$data.' '.time(),
];
$message = implode('.', $pieces).PHP_EOL;
return $this->sendData($this->config['host'], $this->config['port'], $message);
} | php | public function send($data)
{
$pieces = [
$this->config['apiKey'],
$this->config['prefix'],
$data.' '.time(),
];
$message = implode('.', $pieces).PHP_EOL;
return $this->sendData($this->config['host'], $this->config['port'], $message);
} | [
"public",
"function",
"send",
"(",
"$",
"data",
")",
"{",
"$",
"pieces",
"=",
"[",
"$",
"this",
"->",
"config",
"[",
"'apiKey'",
"]",
",",
"$",
"this",
"->",
"config",
"[",
"'prefix'",
"]",
",",
"$",
"data",
".",
"' '",
".",
"time",
"(",
")",
"... | Data to send to Graphite host
@param string $data
@return bool | [
"Data",
"to",
"send",
"to",
"Graphite",
"host"
] | train | https://github.com/fortis/silex-graphite/blob/1faf4b53531c62d19b281b736a1dda326e127c7f/src/Graphite/Silex/Client/GraphiteClient.php#L21-L31 |
fortis/silex-graphite | src/Graphite/Silex/Client/GraphiteClient.php | GraphiteClient.sendData | protected function sendData($host, $port, $message)
{
$socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
return socket_sendto($socket, $message, strlen($message), 0, $host, $port);
} | php | protected function sendData($host, $port, $message)
{
$socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
return socket_sendto($socket, $message, strlen($message), 0, $host, $port);
} | [
"protected",
"function",
"sendData",
"(",
"$",
"host",
",",
"$",
"port",
",",
"$",
"message",
")",
"{",
"$",
"socket",
"=",
"socket_create",
"(",
"AF_INET",
",",
"SOCK_DGRAM",
",",
"SOL_UDP",
")",
";",
"return",
"socket_sendto",
"(",
"$",
"socket",
",",
... | @param string $host
@param int $port
@param string $message
@return int | [
"@param",
"string",
"$host",
"@param",
"int",
"$port",
"@param",
"string",
"$message"
] | train | https://github.com/fortis/silex-graphite/blob/1faf4b53531c62d19b281b736a1dda326e127c7f/src/Graphite/Silex/Client/GraphiteClient.php#L40-L45 |
WellCommerce/AppBundle | Repository/LocaleRepository.php | LocaleRepository.getAvailableLocaleCodes | public function getAvailableLocaleCodes() : array
{
if (empty($this->currentLocales)) {
$this->currentLocales = $this->getAvailableLocales();
}
$codes = [];
foreach ($this->currentLocales as $locale) {
$codes[$locale['code']] = $locale['code'];
}
... | php | public function getAvailableLocaleCodes() : array
{
if (empty($this->currentLocales)) {
$this->currentLocales = $this->getAvailableLocales();
}
$codes = [];
foreach ($this->currentLocales as $locale) {
$codes[$locale['code']] = $locale['code'];
}
... | [
"public",
"function",
"getAvailableLocaleCodes",
"(",
")",
":",
"array",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"currentLocales",
")",
")",
"{",
"$",
"this",
"->",
"currentLocales",
"=",
"$",
"this",
"->",
"getAvailableLocales",
"(",
")",
";",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/WellCommerce/AppBundle/blob/2add687d1c898dd0b24afd611d896e3811a0eac3/Repository/LocaleRepository.php#L29-L42 |
WellCommerce/AppBundle | Repository/LocaleRepository.php | LocaleRepository.getLocaleNames | public function getLocaleNames() : array
{
$locales = Intl::getLocaleBundle()->getLocaleNames();
$Data = [];
foreach ($locales as $locale => $name) {
$Data[$locale] = sprintf('%s (%s)', $name, $locale);
}
return $Data;
} | php | public function getLocaleNames() : array
{
$locales = Intl::getLocaleBundle()->getLocaleNames();
$Data = [];
foreach ($locales as $locale => $name) {
$Data[$locale] = sprintf('%s (%s)', $name, $locale);
}
return $Data;
} | [
"public",
"function",
"getLocaleNames",
"(",
")",
":",
"array",
"{",
"$",
"locales",
"=",
"Intl",
"::",
"getLocaleBundle",
"(",
")",
"->",
"getLocaleNames",
"(",
")",
";",
"$",
"Data",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"locales",
"as",
"$",
"l... | {@inheritdoc} | [
"{"
] | train | https://github.com/WellCommerce/AppBundle/blob/2add687d1c898dd0b24afd611d896e3811a0eac3/Repository/LocaleRepository.php#L58-L69 |
alevilar/ristorantino-vendor | Product/Model/Producto.php | Producto.beforeSave | public function beforeSave($options = array()) {
if ( !empty($this->data['Producto']['precio']) ) {
$this->data['Producto']['precio'] = formatearPrecio($this->data['Producto']['precio']);
}
if ( !empty($this->data['ProductosPreciosFuturo']['precio']) ) {
$this->data['Pr... | php | public function beforeSave($options = array()) {
if ( !empty($this->data['Producto']['precio']) ) {
$this->data['Producto']['precio'] = formatearPrecio($this->data['Producto']['precio']);
}
if ( !empty($this->data['ProductosPreciosFuturo']['precio']) ) {
$this->data['Pr... | [
"public",
"function",
"beforeSave",
"(",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"data",
"[",
"'Producto'",
"]",
"[",
"'precio'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"data",
"[",
"'Pro... | } | [
"}"
] | train | https://github.com/alevilar/ristorantino-vendor/blob/6b91a1e20cc0ba09a1968d77e3de6512cfa2d966/Product/Model/Producto.php#L252-L263 |
ArrowSphere/Client | src/xAC/MagicFactoryTrait.php | MagicFactoryTrait.__callstatic | public static function __callstatic($name, $arguments)
{
// Get global services or entity services
$services = Client::getServices(isset($arguments['context']) ? $arguments['context'] : null);
if (array_key_exists($name, $services)) {
$service = $services[$name];
... | php | public static function __callstatic($name, $arguments)
{
// Get global services or entity services
$services = Client::getServices(isset($arguments['context']) ? $arguments['context'] : null);
if (array_key_exists($name, $services)) {
$service = $services[$name];
... | [
"public",
"static",
"function",
"__callstatic",
"(",
"$",
"name",
",",
"$",
"arguments",
")",
"{",
"// Get global services or entity services",
"$",
"services",
"=",
"Client",
"::",
"getServices",
"(",
"isset",
"(",
"$",
"arguments",
"[",
"'context'",
"]",
")",
... | Magic method for static calls
@param string $name
@param array $arguments
@return mixed | [
"Magic",
"method",
"for",
"static",
"calls"
] | train | https://github.com/ArrowSphere/Client/blob/6608f8257060375e7d3a27c485b23268b73f6ef7/src/xAC/MagicFactoryTrait.php#L17-L59 |
ajgarlag/AjglSessionConcurrency | src/Http/Session/CompositeSessionAuthenticationStrategy.php | CompositeSessionAuthenticationStrategy.onAuthentication | public function onAuthentication(Request $request, TokenInterface $token)
{
foreach ($this->delegateStrategies as $strategy) {
$strategy->onAuthentication($request, $token);
}
} | php | public function onAuthentication(Request $request, TokenInterface $token)
{
foreach ($this->delegateStrategies as $strategy) {
$strategy->onAuthentication($request, $token);
}
} | [
"public",
"function",
"onAuthentication",
"(",
"Request",
"$",
"request",
",",
"TokenInterface",
"$",
"token",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"delegateStrategies",
"as",
"$",
"strategy",
")",
"{",
"$",
"strategy",
"->",
"onAuthentication",
"(",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/ajgarlag/AjglSessionConcurrency/blob/daa3b1ff3ad4951947f7192e12b2496555e135fb/src/Http/Session/CompositeSessionAuthenticationStrategy.php#L44-L49 |
Eresus/EresusCMS | src/core/content.php | TContent.adminRender | public function adminRender(Eresus_CMS_Request $request)
{
if (!UserRights(EDITOR))
{
return '';
}
$legacyKernel = Eresus_CMS::getLegacyKernel();
$plugins = Eresus_Plugin_Registry::getInstance();
/** @var TAdminUI $page */
$page = Eresus_Kernel::a... | php | public function adminRender(Eresus_CMS_Request $request)
{
if (!UserRights(EDITOR))
{
return '';
}
$legacyKernel = Eresus_CMS::getLegacyKernel();
$plugins = Eresus_Plugin_Registry::getInstance();
/** @var TAdminUI $page */
$page = Eresus_Kernel::a... | [
"public",
"function",
"adminRender",
"(",
"Eresus_CMS_Request",
"$",
"request",
")",
"{",
"if",
"(",
"!",
"UserRights",
"(",
"EDITOR",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"legacyKernel",
"=",
"Eresus_CMS",
"::",
"getLegacyKernel",
"(",
")",
";",
... | Возвращает разметку интерфейса управления контентом текущего раздела
@param Eresus_CMS_Request $request
@return string|Eresus_HTTP_Response HTML | [
"Возвращает",
"разметку",
"интерфейса",
"управления",
"контентом",
"текущего",
"раздела"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/content.php#L46-L129 |
php-lug/lug | src/Bundle/GridBundle/Form/Type/Batch/GridBatchType.php | GridBatchType.buildForm | public function buildForm(FormBuilderInterface $builder, array $options)
{
$grid = $options['grid'];
$driver = $grid->getDefinition()->getResource()->getDriver();
$builder
->add('all', GridBatchAllType::class, ['grid' => $grid])
->add('type', GridBatchTypeType::class... | php | public function buildForm(FormBuilderInterface $builder, array $options)
{
$grid = $options['grid'];
$driver = $grid->getDefinition()->getResource()->getDriver();
$builder
->add('all', GridBatchAllType::class, ['grid' => $grid])
->add('type', GridBatchTypeType::class... | [
"public",
"function",
"buildForm",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"array",
"$",
"options",
")",
"{",
"$",
"grid",
"=",
"$",
"options",
"[",
"'grid'",
"]",
";",
"$",
"driver",
"=",
"$",
"grid",
"->",
"getDefinition",
"(",
")",
"->",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Bundle/GridBundle/Form/Type/Batch/GridBatchType.php#L42-L52 |
Eresus/EresusCMS | src/core/i18n.php | I18n.getInstance | static public function getInstance()
{
if (!self::$instance)
{
self::$instance = new I18n(Eresus_Kernel::app()->getFsRoot() . '/lang');
}
return self::$instance;
} | php | static public function getInstance()
{
if (!self::$instance)
{
self::$instance = new I18n(Eresus_Kernel::app()->getFsRoot() . '/lang');
}
return self::$instance;
} | [
"static",
"public",
"function",
"getInstance",
"(",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"$",
"instance",
")",
"{",
"self",
"::",
"$",
"instance",
"=",
"new",
"I18n",
"(",
"Eresus_Kernel",
"::",
"app",
"(",
")",
"->",
"getFsRoot",
"(",
")",
".",
... | Возвращает экземпляр-одиночку
@return I18n | [
"Возвращает",
"экземпляр",
"-",
"одиночку"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/i18n.php#L66-L74 |
NuclearCMS/Hierarchy | src/Tags/TagRepository.php | TagRepository.getTagAndSetLocale | public function getTagAndSetLocale($name, $locale = null)
{
$tag = $this->getTag($name);
// Override locale or use tag locale
// this is for when a tag does not have to be translated
// and the app locale is determined via route parameter (etiket|tag)
$locale = $locale ?: $t... | php | public function getTagAndSetLocale($name, $locale = null)
{
$tag = $this->getTag($name);
// Override locale or use tag locale
// this is for when a tag does not have to be translated
// and the app locale is determined via route parameter (etiket|tag)
$locale = $locale ?: $t... | [
"public",
"function",
"getTagAndSetLocale",
"(",
"$",
"name",
",",
"$",
"locale",
"=",
"null",
")",
"{",
"$",
"tag",
"=",
"$",
"this",
"->",
"getTag",
"(",
"$",
"name",
")",
";",
"// Override locale or use tag locale",
"// this is for when a tag does not have to b... | Returns a tag by name and sets the locale
@param string $name
@param string $locale
@return Tag | [
"Returns",
"a",
"tag",
"by",
"name",
"and",
"sets",
"the",
"locale"
] | train | https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Tags/TagRepository.php#L27-L39 |
OKTOTV/OktolabMediaBundle | Controller/EpisodeController.php | EpisodeController.createAction | public function createAction(Request $request)
{
$entity = $this->get('oktolab_media')->createEpisode();
$form = $this->createCreateForm($entity);
$form->handleRequest($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($... | php | public function createAction(Request $request)
{
$entity = $this->get('oktolab_media')->createEpisode();
$form = $this->createCreateForm($entity);
$form->handleRequest($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($... | [
"public",
"function",
"createAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"entity",
"=",
"$",
"this",
"->",
"get",
"(",
"'oktolab_media'",
")",
"->",
"createEpisode",
"(",
")",
";",
"$",
"form",
"=",
"$",
"this",
"->",
"createCreateForm",
"(",... | Creates a new Episode entity.
@Route("/", name="oktolab_episode_create")
@Method("POST")
@Template("OktolabMediaBundle:Episode:new.html.twig") | [
"Creates",
"a",
"new",
"Episode",
"entity",
"."
] | train | https://github.com/OKTOTV/OktolabMediaBundle/blob/f9c1eac4f6b19d2ab25288b301dd0d9350478bb3/Controller/EpisodeController.php#L35-L68 |
OKTOTV/OktolabMediaBundle | Controller/EpisodeController.php | EpisodeController.createCreateForm | private function createCreateForm(Episode $entity)
{
$form = $this->createForm(EpisodeType::class, $entity, array(
'action' => $this->generateUrl('oktolab_episode_create'),
'method' => 'POST',
));
$form->add(
'submit',
SubmitType::class,
... | php | private function createCreateForm(Episode $entity)
{
$form = $this->createForm(EpisodeType::class, $entity, array(
'action' => $this->generateUrl('oktolab_episode_create'),
'method' => 'POST',
));
$form->add(
'submit',
SubmitType::class,
... | [
"private",
"function",
"createCreateForm",
"(",
"Episode",
"$",
"entity",
")",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"createForm",
"(",
"EpisodeType",
"::",
"class",
",",
"$",
"entity",
",",
"array",
"(",
"'action'",
"=>",
"$",
"this",
"->",
"generat... | Creates a form to create a Episode entity.
@param Episode $entity The entity
@return \Symfony\Component\Form\Form The form | [
"Creates",
"a",
"form",
"to",
"create",
"a",
"Episode",
"entity",
"."
] | train | https://github.com/OKTOTV/OktolabMediaBundle/blob/f9c1eac4f6b19d2ab25288b301dd0d9350478bb3/Controller/EpisodeController.php#L99-L116 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.