id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
224,800 | dereuromark/cakephp-data | src/Controller/Admin/CountriesController.php | CountriesController.icons | public function icons() {
$icons = $this->_icons();
$countries = $this->Countries->find('all', ['fields' => ['id', 'name', 'iso2', 'iso3']]);
$usedIcons = [];
# countries without icons
$contriesWithoutIcons = [];
foreach ($countries as $country) {
$icon = strtoupper($country['iso2']);
if (!in_array... | php | public function icons() {
$icons = $this->_icons();
$countries = $this->Countries->find('all', ['fields' => ['id', 'name', 'iso2', 'iso3']]);
$usedIcons = [];
# countries without icons
$contriesWithoutIcons = [];
foreach ($countries as $country) {
$icon = strtoupper($country['iso2']);
if (!in_array... | [
"public",
"function",
"icons",
"(",
")",
"{",
"$",
"icons",
"=",
"$",
"this",
"->",
"_icons",
"(",
")",
";",
"$",
"countries",
"=",
"$",
"this",
"->",
"Countries",
"->",
"find",
"(",
"'all'",
",",
"[",
"'fields'",
"=>",
"[",
"'id'",
",",
"'name'",
... | Check for missing or unused country flag icons
@return \Cake\Http\Response|null | [
"Check",
"for",
"missing",
"or",
"unused",
"country",
"flag",
"icons"
] | 362f8db270fc994ac3665c33682cefba7d73bb44 | https://github.com/dereuromark/cakephp-data/blob/362f8db270fc994ac3665c33682cefba7d73bb44/src/Controller/Admin/CountriesController.php#L67-L92 |
224,801 | mediumart/orange-sms | src/Http/SMSClient.php | SMSClient.configure | public function configure()
{
switch (count($options = func_get_args())) {
case 0:
break;
case 1:
$this->configureInstance($options[0]);
break;
case 2:
$this->configureInstanceAssoc(
sta... | php | public function configure()
{
switch (count($options = func_get_args())) {
case 0:
break;
case 1:
$this->configureInstance($options[0]);
break;
case 2:
$this->configureInstanceAssoc(
sta... | [
"public",
"function",
"configure",
"(",
")",
"{",
"switch",
"(",
"count",
"(",
"$",
"options",
"=",
"func_get_args",
"(",
")",
")",
")",
"{",
"case",
"0",
":",
"break",
";",
"case",
"1",
":",
"$",
"this",
"->",
"configureInstance",
"(",
"$",
"options... | Configure the instance.
@param array $options
@return $this | [
"Configure",
"the",
"instance",
"."
] | 62aff9d24c326663fa8b9e742fa3f15c9df20945 | https://github.com/mediumart/orange-sms/blob/62aff9d24c326663fa8b9e742fa3f15c9df20945/src/Http/SMSClient.php#L91-L113 |
224,802 | mediumart/orange-sms | src/Http/SMSClient.php | SMSClient.configureInstance | protected function configureInstance($options)
{
if (is_string($options)) {
$this->setToken($options)->setTokenExpiresIn(null);
} elseif (is_array($options)) {
$this->configureInstanceAssoc($options);
}
} | php | protected function configureInstance($options)
{
if (is_string($options)) {
$this->setToken($options)->setTokenExpiresIn(null);
} elseif (is_array($options)) {
$this->configureInstanceAssoc($options);
}
} | [
"protected",
"function",
"configureInstance",
"(",
"$",
"options",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"options",
")",
")",
"{",
"$",
"this",
"->",
"setToken",
"(",
"$",
"options",
")",
"->",
"setTokenExpiresIn",
"(",
"null",
")",
";",
"}",
"el... | Configure instance using options.
@param mixed $options
@return $this | [
"Configure",
"instance",
"using",
"options",
"."
] | 62aff9d24c326663fa8b9e742fa3f15c9df20945 | https://github.com/mediumart/orange-sms/blob/62aff9d24c326663fa8b9e742fa3f15c9df20945/src/Http/SMSClient.php#L121-L128 |
224,803 | mediumart/orange-sms | src/Http/SMSClient.php | SMSClient.configureInstanceAssoc | protected function configureInstanceAssoc(array $options)
{
if (array_key_exists('access_token', $options)) {
$this->setToken($options['access_token']);
}
if (array_key_exists('expires_in', $options)) {
$this->setTokenExpiresIn($options['expires_in']);
}
... | php | protected function configureInstanceAssoc(array $options)
{
if (array_key_exists('access_token', $options)) {
$this->setToken($options['access_token']);
}
if (array_key_exists('expires_in', $options)) {
$this->setTokenExpiresIn($options['expires_in']);
}
... | [
"protected",
"function",
"configureInstanceAssoc",
"(",
"array",
"$",
"options",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"'access_token'",
",",
"$",
"options",
")",
")",
"{",
"$",
"this",
"->",
"setToken",
"(",
"$",
"options",
"[",
"'access_token'",
"]... | Configure instance using assoc array options.
@param array $options
@return $this | [
"Configure",
"instance",
"using",
"assoc",
"array",
"options",
"."
] | 62aff9d24c326663fa8b9e742fa3f15c9df20945 | https://github.com/mediumart/orange-sms/blob/62aff9d24c326663fa8b9e742fa3f15c9df20945/src/Http/SMSClient.php#L136-L147 |
224,804 | mediumart/orange-sms | src/Http/SMSClient.php | SMSClient.executeRequest | public function executeRequest(SMSClientRequest $request, $decodeJson = true)
{
$options = $request->options();
if (! isset($options['headers']["Authorization"])) {
$options['headers']["Authorization"] = "Bearer ". $this->getToken();
}
$response = $request->execute($opt... | php | public function executeRequest(SMSClientRequest $request, $decodeJson = true)
{
$options = $request->options();
if (! isset($options['headers']["Authorization"])) {
$options['headers']["Authorization"] = "Bearer ". $this->getToken();
}
$response = $request->execute($opt... | [
"public",
"function",
"executeRequest",
"(",
"SMSClientRequest",
"$",
"request",
",",
"$",
"decodeJson",
"=",
"true",
")",
"{",
"$",
"options",
"=",
"$",
"request",
"->",
"options",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"options",
"[",
"'he... | Execute a request against the Api server
@param SMSClientRequest $request
@param bool $decodeJson
@return array | [
"Execute",
"a",
"request",
"against",
"the",
"Api",
"server"
] | 62aff9d24c326663fa8b9e742fa3f15c9df20945 | https://github.com/mediumart/orange-sms/blob/62aff9d24c326663fa8b9e742fa3f15c9df20945/src/Http/SMSClient.php#L156-L167 |
224,805 | mediumart/orange-sms | src/Http/SMSClient.php | SMSClient.authorize | public static function authorize($clientID, $clientSecret)
{
return json_decode(
(new AuthorizationRequest($clientID, $clientSecret))->execute()->getBody(), true
);
} | php | public static function authorize($clientID, $clientSecret)
{
return json_decode(
(new AuthorizationRequest($clientID, $clientSecret))->execute()->getBody(), true
);
} | [
"public",
"static",
"function",
"authorize",
"(",
"$",
"clientID",
",",
"$",
"clientSecret",
")",
"{",
"return",
"json_decode",
"(",
"(",
"new",
"AuthorizationRequest",
"(",
"$",
"clientID",
",",
"$",
"clientSecret",
")",
")",
"->",
"execute",
"(",
")",
"-... | Get the client access token
@param $clientID
@param $clientSecret
@return array | [
"Get",
"the",
"client",
"access",
"token"
] | 62aff9d24c326663fa8b9e742fa3f15c9df20945 | https://github.com/mediumart/orange-sms/blob/62aff9d24c326663fa8b9e742fa3f15c9df20945/src/Http/SMSClient.php#L176-L181 |
224,806 | dereuromark/cakephp-data | src/Controller/Component/CountryStateHelperComponent.php | CountryStateHelperComponent.provideData | public function provideData($ignoreStates = false, $model = null, $defaultValue = 0) {
if (!isset($this->Controller->Countries)) {
$this->Controller->Countries = TableRegistry::get('Data.Countries');
}
$countries = $this->Controller->Countries->findActive()->hydrate(false)->find('list')->toArray();
$states ... | php | public function provideData($ignoreStates = false, $model = null, $defaultValue = 0) {
if (!isset($this->Controller->Countries)) {
$this->Controller->Countries = TableRegistry::get('Data.Countries');
}
$countries = $this->Controller->Countries->findActive()->hydrate(false)->find('list')->toArray();
$states ... | [
"public",
"function",
"provideData",
"(",
"$",
"ignoreStates",
"=",
"false",
",",
"$",
"model",
"=",
"null",
",",
"$",
"defaultValue",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"Controller",
"->",
"Countries",
")",
")",
"{"... | Call in methods where needed
@param bool $ignoreStates
@param string|null $model
@param int $defaultValue
@return void | [
"Call",
"in",
"methods",
"where",
"needed"
] | 362f8db270fc994ac3665c33682cefba7d73bb44 | https://github.com/dereuromark/cakephp-data/blob/362f8db270fc994ac3665c33682cefba7d73bb44/src/Controller/Component/CountryStateHelperComponent.php#L34-L66 |
224,807 | fillup/walmart-auth-signature-php | src/Signature.php | Signature.calculateSignature | public static function calculateSignature($consumerId, $privateKey, $requestUrl, $requestMethod, $timestamp=null)
{
if(is_null($timestamp) || !is_numeric($timestamp)){
$timestamp = self::getMilliseconds();
}
/**
* Append values into string for signing
*/
... | php | public static function calculateSignature($consumerId, $privateKey, $requestUrl, $requestMethod, $timestamp=null)
{
if(is_null($timestamp) || !is_numeric($timestamp)){
$timestamp = self::getMilliseconds();
}
/**
* Append values into string for signing
*/
... | [
"public",
"static",
"function",
"calculateSignature",
"(",
"$",
"consumerId",
",",
"$",
"privateKey",
",",
"$",
"requestUrl",
",",
"$",
"requestMethod",
",",
"$",
"timestamp",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"timestamp",
")",
"||",
... | Static method for quick calls to calculate a signature.
@link https://developer.walmartapis.com/#authentication
@param string $consumerId
@param string $privateKey
@param string $requestUrl
@param string $requestMethod
@param string|null $timestamp
@return string
@throws \Exception | [
"Static",
"method",
"for",
"quick",
"calls",
"to",
"calculate",
"a",
"signature",
"."
] | 7c1b94a0e00baa79bf51d5d0986fd9a667e6efce | https://github.com/fillup/walmart-auth-signature-php/blob/7c1b94a0e00baa79bf51d5d0986fd9a667e6efce/src/Signature.php#L76-L114 |
224,808 | sulu/SuluRedirectBundle | Controller/RedirectRouteController.php | RedirectRouteController.cgetAction | public function cgetAction(Request $request)
{
$restHelper = $this->get('sulu_core.doctrine_rest_helper');
$factory = $this->get('sulu_core.doctrine_list_builder_factory');
$listBuilder = $factory->create(RedirectRoute::class);
$restHelper->initializeListBuilder($listBuilder, $this-... | php | public function cgetAction(Request $request)
{
$restHelper = $this->get('sulu_core.doctrine_rest_helper');
$factory = $this->get('sulu_core.doctrine_list_builder_factory');
$listBuilder = $factory->create(RedirectRoute::class);
$restHelper->initializeListBuilder($listBuilder, $this-... | [
"public",
"function",
"cgetAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"restHelper",
"=",
"$",
"this",
"->",
"get",
"(",
"'sulu_core.doctrine_rest_helper'",
")",
";",
"$",
"factory",
"=",
"$",
"this",
"->",
"get",
"(",
"'sulu_core.doctrine_list_bui... | Returns redirect-routes.
@param Request $request
@return Response | [
"Returns",
"redirect",
"-",
"routes",
"."
] | 913c501cced6c7db5fb96d4baf6cce4b884c65c6 | https://github.com/sulu/SuluRedirectBundle/blob/913c501cced6c7db5fb96d4baf6cce4b884c65c6/Controller/RedirectRouteController.php#L52-L72 |
224,809 | sulu/SuluRedirectBundle | Controller/RedirectRouteController.php | RedirectRouteController.postAction | public function postAction(Request $request)
{
$data = $request->request->all();
$serializer = $this->get('serializer');
$redirectRoute = $serializer->deserialize(
json_encode($data),
$this->getParameter('sulu.model.redirect_route.class'),
'json'
... | php | public function postAction(Request $request)
{
$data = $request->request->all();
$serializer = $this->get('serializer');
$redirectRoute = $serializer->deserialize(
json_encode($data),
$this->getParameter('sulu.model.redirect_route.class'),
'json'
... | [
"public",
"function",
"postAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"data",
"=",
"$",
"request",
"->",
"request",
"->",
"all",
"(",
")",
";",
"$",
"serializer",
"=",
"$",
"this",
"->",
"get",
"(",
"'serializer'",
")",
";",
"$",
"redire... | Create a new redirect-route.
@param Request $request
@return Response | [
"Create",
"a",
"new",
"redirect",
"-",
"route",
"."
] | 913c501cced6c7db5fb96d4baf6cce4b884c65c6 | https://github.com/sulu/SuluRedirectBundle/blob/913c501cced6c7db5fb96d4baf6cce4b884c65c6/Controller/RedirectRouteController.php#L81-L96 |
224,810 | sulu/SuluRedirectBundle | Controller/RedirectRouteController.php | RedirectRouteController.getAction | public function getAction($id)
{
$entity = $this->getRedirectRouteRepository()->find($id);
if (!$entity) {
throw new EntityNotFoundException($this->getParameter('sulu.model.redirect_route.class'), $id);
}
return $this->handleView($this->view($entity));
} | php | public function getAction($id)
{
$entity = $this->getRedirectRouteRepository()->find($id);
if (!$entity) {
throw new EntityNotFoundException($this->getParameter('sulu.model.redirect_route.class'), $id);
}
return $this->handleView($this->view($entity));
} | [
"public",
"function",
"getAction",
"(",
"$",
"id",
")",
"{",
"$",
"entity",
"=",
"$",
"this",
"->",
"getRedirectRouteRepository",
"(",
")",
"->",
"find",
"(",
"$",
"id",
")",
";",
"if",
"(",
"!",
"$",
"entity",
")",
"{",
"throw",
"new",
"EntityNotFou... | Returns single redirect-route.
@param string $id
@return Response
@throws EntityNotFoundException | [
"Returns",
"single",
"redirect",
"-",
"route",
"."
] | 913c501cced6c7db5fb96d4baf6cce4b884c65c6 | https://github.com/sulu/SuluRedirectBundle/blob/913c501cced6c7db5fb96d4baf6cce4b884c65c6/Controller/RedirectRouteController.php#L107-L115 |
224,811 | sulu/SuluRedirectBundle | Controller/RedirectRouteController.php | RedirectRouteController.deleteAction | public function deleteAction($id)
{
$redirectRoute = $this->getRedirectRouteRepository()->find($id);
if (!$redirectRoute) {
throw new EntityNotFoundException($this->getParameter('sulu.model.redirect_route.class'), $id);
}
$this->getRedirectRouteManager()->delete($redirec... | php | public function deleteAction($id)
{
$redirectRoute = $this->getRedirectRouteRepository()->find($id);
if (!$redirectRoute) {
throw new EntityNotFoundException($this->getParameter('sulu.model.redirect_route.class'), $id);
}
$this->getRedirectRouteManager()->delete($redirec... | [
"public",
"function",
"deleteAction",
"(",
"$",
"id",
")",
"{",
"$",
"redirectRoute",
"=",
"$",
"this",
"->",
"getRedirectRouteRepository",
"(",
")",
"->",
"find",
"(",
"$",
"id",
")",
";",
"if",
"(",
"!",
"$",
"redirectRoute",
")",
"{",
"throw",
"new"... | Delete a redirect-route identified by id.
@param string $id
@return Response
@throws EntityNotFoundException | [
"Delete",
"a",
"redirect",
"-",
"route",
"identified",
"by",
"id",
"."
] | 913c501cced6c7db5fb96d4baf6cce4b884c65c6 | https://github.com/sulu/SuluRedirectBundle/blob/913c501cced6c7db5fb96d4baf6cce4b884c65c6/Controller/RedirectRouteController.php#L152-L163 |
224,812 | sulu/SuluRedirectBundle | Controller/RedirectRouteController.php | RedirectRouteController.cdeleteAction | public function cdeleteAction(Request $request)
{
$repository = $this->getRedirectRouteRepository();
$manager = $this->getRedirectRouteManager();
$ids = array_filter(explode(',', $request->query->get('ids', '')));
foreach ($ids as $id) {
$redirectRoute = $repository->fin... | php | public function cdeleteAction(Request $request)
{
$repository = $this->getRedirectRouteRepository();
$manager = $this->getRedirectRouteManager();
$ids = array_filter(explode(',', $request->query->get('ids', '')));
foreach ($ids as $id) {
$redirectRoute = $repository->fin... | [
"public",
"function",
"cdeleteAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"repository",
"=",
"$",
"this",
"->",
"getRedirectRouteRepository",
"(",
")",
";",
"$",
"manager",
"=",
"$",
"this",
"->",
"getRedirectRouteManager",
"(",
")",
";",
"$",
... | Delete a list of redirect-route identified by id.
@param Request $request
@return Response | [
"Delete",
"a",
"list",
"of",
"redirect",
"-",
"route",
"identified",
"by",
"id",
"."
] | 913c501cced6c7db5fb96d4baf6cce4b884c65c6 | https://github.com/sulu/SuluRedirectBundle/blob/913c501cced6c7db5fb96d4baf6cce4b884c65c6/Controller/RedirectRouteController.php#L172-L190 |
224,813 | sulu/SuluRedirectBundle | Import/FileImport.php | FileImport.importItem | private function importItem(array $item)
{
if (!$this->converter->supports($item)) {
throw new ConverterNotFoundException($item);
}
$entity = $this->converter->convert($item);
$this->writer->write($entity);
return $entity;
} | php | private function importItem(array $item)
{
if (!$this->converter->supports($item)) {
throw new ConverterNotFoundException($item);
}
$entity = $this->converter->convert($item);
$this->writer->write($entity);
return $entity;
} | [
"private",
"function",
"importItem",
"(",
"array",
"$",
"item",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"converter",
"->",
"supports",
"(",
"$",
"item",
")",
")",
"{",
"throw",
"new",
"ConverterNotFoundException",
"(",
"$",
"item",
")",
";",
"}",
... | Import given item.
@param array $item
@return RedirectRouteInterface
@throws \Exception | [
"Import",
"given",
"item",
"."
] | 913c501cced6c7db5fb96d4baf6cce4b884c65c6 | https://github.com/sulu/SuluRedirectBundle/blob/913c501cced6c7db5fb96d4baf6cce4b884c65c6/Import/FileImport.php#L88-L98 |
224,814 | simplesamlphp/simplesamlphp-module-openid | lib/SessionStore.php | sspmod_openid_SessionStore.set | public function set($key, $value) {
assert('is_string($key)');
$session = SimpleSAML_Session::getSessionFromRequest();
$session->setData('openid.session', $key, $value);
} | php | public function set($key, $value) {
assert('is_string($key)');
$session = SimpleSAML_Session::getSessionFromRequest();
$session->setData('openid.session', $key, $value);
} | [
"public",
"function",
"set",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"assert",
"(",
"'is_string($key)'",
")",
";",
"$",
"session",
"=",
"SimpleSAML_Session",
"::",
"getSessionFromRequest",
"(",
")",
";",
"$",
"session",
"->",
"setData",
"(",
"'openid... | Save a value to the session store under the given key.
@param string $key The key we should save.
@param mixed NULL $value The value we should save. | [
"Save",
"a",
"value",
"to",
"the",
"session",
"store",
"under",
"the",
"given",
"key",
"."
] | f2256f9866fcd6561ff0ab41d1c810328a310f63 | https://github.com/simplesamlphp/simplesamlphp-module-openid/blob/f2256f9866fcd6561ff0ab41d1c810328a310f63/lib/SessionStore.php#L33-L38 |
224,815 | liip/LiipTranslationBundle | Repository/UnitRepository.php | UnitRepository.removeTranslation | public function removeTranslation($locale, $domain, $key)
{
$unit = $this->findByDomainAndKey($domain, $key);
$unit->deleteTranslation($locale);
$this->persist($unit);
} | php | public function removeTranslation($locale, $domain, $key)
{
$unit = $this->findByDomainAndKey($domain, $key);
$unit->deleteTranslation($locale);
$this->persist($unit);
} | [
"public",
"function",
"removeTranslation",
"(",
"$",
"locale",
",",
"$",
"domain",
",",
"$",
"key",
")",
"{",
"$",
"unit",
"=",
"$",
"this",
"->",
"findByDomainAndKey",
"(",
"$",
"domain",
",",
"$",
"key",
")",
";",
"$",
"unit",
"->",
"deleteTranslatio... | Remove a specific translation.
@param string $locale
@param string $domain
@param string $key | [
"Remove",
"a",
"specific",
"translation",
"."
] | 6e9896042d80c4e50f1e7ceacf434e772daaf149 | https://github.com/liip/LiipTranslationBundle/blob/6e9896042d80c4e50f1e7ceacf434e772daaf149/Repository/UnitRepository.php#L320-L325 |
224,816 | liip/LiipTranslationBundle | Repository/UnitRepository.php | UnitRepository.updateTranslation | public function updateTranslation($locale, $domain, $key, $value)
{
$unit = $this->findByDomainAndKey($domain, $key);
$unit->setTranslation($locale, $value);
$this->persist($unit);
} | php | public function updateTranslation($locale, $domain, $key, $value)
{
$unit = $this->findByDomainAndKey($domain, $key);
$unit->setTranslation($locale, $value);
$this->persist($unit);
} | [
"public",
"function",
"updateTranslation",
"(",
"$",
"locale",
",",
"$",
"domain",
",",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$",
"unit",
"=",
"$",
"this",
"->",
"findByDomainAndKey",
"(",
"$",
"domain",
",",
"$",
"key",
")",
";",
"$",
"unit",
... | Update a specific translation.
@param string $locale
@param string $domain
@param string $key
@param string $value | [
"Update",
"a",
"specific",
"translation",
"."
] | 6e9896042d80c4e50f1e7ceacf434e772daaf149 | https://github.com/liip/LiipTranslationBundle/blob/6e9896042d80c4e50f1e7ceacf434e772daaf149/Repository/UnitRepository.php#L335-L340 |
224,817 | jasny/error-handler | src/ErrorHandler/HandleShutdownError.php | HandleShutdownError.initShutdownFunction | protected function initShutdownFunction()
{
if (!$this->registeredShutdown) {
$this->registerShutdownFunction([$this, 'shutdownFunction']) ?: false;
$this->registeredShutdown = true;
$this->reserveMemory();
}
} | php | protected function initShutdownFunction()
{
if (!$this->registeredShutdown) {
$this->registerShutdownFunction([$this, 'shutdownFunction']) ?: false;
$this->registeredShutdown = true;
$this->reserveMemory();
}
} | [
"protected",
"function",
"initShutdownFunction",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"registeredShutdown",
")",
"{",
"$",
"this",
"->",
"registerShutdownFunction",
"(",
"[",
"$",
"this",
",",
"'shutdownFunction'",
"]",
")",
"?",
":",
"false",
... | Register the shutdown function | [
"Register",
"the",
"shutdown",
"function"
] | 38e076fc36d86689010081bc2eab96f12d97b0d8 | https://github.com/jasny/error-handler/blob/38e076fc36d86689010081bc2eab96f12d97b0d8/src/ErrorHandler/HandleShutdownError.php#L72-L80 |
224,818 | jasny/error-handler | src/ErrorHandler/HandleShutdownError.php | HandleShutdownError.shutdownFunction | public function shutdownFunction()
{
$this->reservedMemory = null;
$err = $this->errorGetLast();
$unhandled = E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR;
if (empty($err) || !($err['type'] & $unhandled)) {
return;
}
$error... | php | public function shutdownFunction()
{
$this->reservedMemory = null;
$err = $this->errorGetLast();
$unhandled = E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR;
if (empty($err) || !($err['type'] & $unhandled)) {
return;
}
$error... | [
"public",
"function",
"shutdownFunction",
"(",
")",
"{",
"$",
"this",
"->",
"reservedMemory",
"=",
"null",
";",
"$",
"err",
"=",
"$",
"this",
"->",
"errorGetLast",
"(",
")",
";",
"$",
"unhandled",
"=",
"E_ERROR",
"|",
"E_PARSE",
"|",
"E_CORE_ERROR",
"|",... | Called when the script has ends
@ignore | [
"Called",
"when",
"the",
"script",
"has",
"ends"
] | 38e076fc36d86689010081bc2eab96f12d97b0d8 | https://github.com/jasny/error-handler/blob/38e076fc36d86689010081bc2eab96f12d97b0d8/src/ErrorHandler/HandleShutdownError.php#L86-L104 |
224,819 | liip/LiipTranslationBundle | Controller/BaseController.php | BaseController.securityCheck | public function securityCheck($domain = null, $locale = null)
{
if (isset($domain) && $this->getSecurity()->isSecuredByDomain()) {
if (!$this->getSecurityContext()->isGranted(Security::getRoleForDomain($domain))) {
throw new AccessDeniedHttpException("You don't have permissions t... | php | public function securityCheck($domain = null, $locale = null)
{
if (isset($domain) && $this->getSecurity()->isSecuredByDomain()) {
if (!$this->getSecurityContext()->isGranted(Security::getRoleForDomain($domain))) {
throw new AccessDeniedHttpException("You don't have permissions t... | [
"public",
"function",
"securityCheck",
"(",
"$",
"domain",
"=",
"null",
",",
"$",
"locale",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"domain",
")",
"&&",
"$",
"this",
"->",
"getSecurity",
"(",
")",
"->",
"isSecuredByDomain",
"(",
")",
")"... | Process security for the provided locale or domain. Either one of the both
parameters can be null if we don't need to check them.
@param string $domain domain to check for
@param string $locale locale to check for
@throws AccessDeniedHttpException | [
"Process",
"security",
"for",
"the",
"provided",
"locale",
"or",
"domain",
".",
"Either",
"one",
"of",
"the",
"both",
"parameters",
"can",
"be",
"null",
"if",
"we",
"don",
"t",
"need",
"to",
"check",
"them",
"."
] | 6e9896042d80c4e50f1e7ceacf434e772daaf149 | https://github.com/liip/LiipTranslationBundle/blob/6e9896042d80c4e50f1e7ceacf434e772daaf149/Controller/BaseController.php#L42-L55 |
224,820 | jasny/error-handler | src/ErrorHandler/Middleware.php | Middleware.errorResponse | protected function errorResponse(ServerRequestInterface $request, ResponseInterface $response)
{
if (
interface_exists(GlobalEnvironmentInterface::class, false) &&
$response instanceof GlobalEnvironmentInterface &&
$response->isStale()
) {
$response = ... | php | protected function errorResponse(ServerRequestInterface $request, ResponseInterface $response)
{
if (
interface_exists(GlobalEnvironmentInterface::class, false) &&
$response instanceof GlobalEnvironmentInterface &&
$response->isStale()
) {
$response = ... | [
"protected",
"function",
"errorResponse",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"ResponseInterface",
"$",
"response",
")",
"{",
"if",
"(",
"interface_exists",
"(",
"GlobalEnvironmentInterface",
"::",
"class",
",",
"false",
")",
"&&",
"$",
"response",
... | Handle caught error
@param ServerRequestInterface $request
@param ResponseInterface $response
@return ResponseInterface | [
"Handle",
"caught",
"error"
] | 38e076fc36d86689010081bc2eab96f12d97b0d8 | https://github.com/jasny/error-handler/blob/38e076fc36d86689010081bc2eab96f12d97b0d8/src/ErrorHandler/Middleware.php#L70-L84 |
224,821 | jasny/error-handler | src/ErrorHandler/ErrorCodes.php | ErrorCodes.getLogLevel | protected function getLogLevel($code = null)
{
switch ($code) {
case E_STRICT:
case E_DEPRECATED:
case E_USER_DEPRECATED:
return LogLevel::INFO;
case E_NOTICE:
case E_USER_NOTICE:
return LogLevel::NOTICE... | php | protected function getLogLevel($code = null)
{
switch ($code) {
case E_STRICT:
case E_DEPRECATED:
case E_USER_DEPRECATED:
return LogLevel::INFO;
case E_NOTICE:
case E_USER_NOTICE:
return LogLevel::NOTICE... | [
"protected",
"function",
"getLogLevel",
"(",
"$",
"code",
"=",
"null",
")",
"{",
"switch",
"(",
"$",
"code",
")",
"{",
"case",
"E_STRICT",
":",
"case",
"E_DEPRECATED",
":",
"case",
"E_USER_DEPRECATED",
":",
"return",
"LogLevel",
"::",
"INFO",
";",
"case",
... | Get the log level for an error code
@param int $code E_* error code
@return string | [
"Get",
"the",
"log",
"level",
"for",
"an",
"error",
"code"
] | 38e076fc36d86689010081bc2eab96f12d97b0d8 | https://github.com/jasny/error-handler/blob/38e076fc36d86689010081bc2eab96f12d97b0d8/src/ErrorHandler/ErrorCodes.php#L18-L44 |
224,822 | Crinsane/LaravelNotify | src/Notifications/Notification.php | Notification.add | public function add($type, $message, $title = null)
{
$notifications = $this->getNotifications();
$notifications[] = [
'type' => $type,
'message' => $message,
'title' => $title
];
$this->session->flash(self::SESSION_KEY, $notifications);
... | php | public function add($type, $message, $title = null)
{
$notifications = $this->getNotifications();
$notifications[] = [
'type' => $type,
'message' => $message,
'title' => $title
];
$this->session->flash(self::SESSION_KEY, $notifications);
... | [
"public",
"function",
"add",
"(",
"$",
"type",
",",
"$",
"message",
",",
"$",
"title",
"=",
"null",
")",
"{",
"$",
"notifications",
"=",
"$",
"this",
"->",
"getNotifications",
"(",
")",
";",
"$",
"notifications",
"[",
"]",
"=",
"[",
"'type'",
"=>",
... | Add a new notification to the session
@param string $type
@param string $message
@param null $title
@return void | [
"Add",
"a",
"new",
"notification",
"to",
"the",
"session"
] | 5064482018534abdb4483b9a08f86fa3ac735efd | https://github.com/Crinsane/LaravelNotify/blob/5064482018534abdb4483b9a08f86fa3ac735efd/src/Notifications/Notification.php#L60-L71 |
224,823 | liip/LiipTranslationBundle | Model/Unit.php | Unit.setTranslation | public function setTranslation($locale, $translation, $isUpdate = true)
{
$this->offsetSet($locale, $translation);
if ($isUpdate) {
$this->setIsModified(true);
}
} | php | public function setTranslation($locale, $translation, $isUpdate = true)
{
$this->offsetSet($locale, $translation);
if ($isUpdate) {
$this->setIsModified(true);
}
} | [
"public",
"function",
"setTranslation",
"(",
"$",
"locale",
",",
"$",
"translation",
",",
"$",
"isUpdate",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"offsetSet",
"(",
"$",
"locale",
",",
"$",
"translation",
")",
";",
"if",
"(",
"$",
"isUpdate",
")",
... | Set a translation for the given locale without caring if
the translation already exists or not.
@param string $locale the locale
@param string $translation the translation (value)
@param bool $isUpdate | [
"Set",
"a",
"translation",
"for",
"the",
"given",
"locale",
"without",
"caring",
"if",
"the",
"translation",
"already",
"exists",
"or",
"not",
"."
] | 6e9896042d80c4e50f1e7ceacf434e772daaf149 | https://github.com/liip/LiipTranslationBundle/blob/6e9896042d80c4e50f1e7ceacf434e772daaf149/Model/Unit.php#L75-L81 |
224,824 | liip/LiipTranslationBundle | Model/Unit.php | Unit.addTranslation | public function addTranslation(Translation $translation, $isUpdate = true)
{
$this->translations[$translation->getLocale()] = $translation;
if ($isUpdate) {
$this->setIsModified(true);
}
} | php | public function addTranslation(Translation $translation, $isUpdate = true)
{
$this->translations[$translation->getLocale()] = $translation;
if ($isUpdate) {
$this->setIsModified(true);
}
} | [
"public",
"function",
"addTranslation",
"(",
"Translation",
"$",
"translation",
",",
"$",
"isUpdate",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"translations",
"[",
"$",
"translation",
"->",
"getLocale",
"(",
")",
"]",
"=",
"$",
"translation",
";",
"if",
... | Add or set the translation for the locale associated to the
given translation.
@param Translation $translation | [
"Add",
"or",
"set",
"the",
"translation",
"for",
"the",
"locale",
"associated",
"to",
"the",
"given",
"translation",
"."
] | 6e9896042d80c4e50f1e7ceacf434e772daaf149 | https://github.com/liip/LiipTranslationBundle/blob/6e9896042d80c4e50f1e7ceacf434e772daaf149/Model/Unit.php#L89-L95 |
224,825 | liip/LiipTranslationBundle | Import/SessionImporter.php | SessionImporter.extractZip | protected function extractZip($file)
{
$tempFolder = sys_get_temp_dir().'/'.md5(rand(0, 99999));
if (@mkdir($tempFolder) === false) {
throw new ImportException('Impossible to create a temp folder for zip extraction');
}
$zip = new \ZipArchive();
$zip->open($file->... | php | protected function extractZip($file)
{
$tempFolder = sys_get_temp_dir().'/'.md5(rand(0, 99999));
if (@mkdir($tempFolder) === false) {
throw new ImportException('Impossible to create a temp folder for zip extraction');
}
$zip = new \ZipArchive();
$zip->open($file->... | [
"protected",
"function",
"extractZip",
"(",
"$",
"file",
")",
"{",
"$",
"tempFolder",
"=",
"sys_get_temp_dir",
"(",
")",
".",
"'/'",
".",
"md5",
"(",
"rand",
"(",
"0",
",",
"99999",
")",
")",
";",
"if",
"(",
"@",
"mkdir",
"(",
"$",
"tempFolder",
")... | Extract a zip file into a temp folder and return the folder path.
@param UploadedFile $file
@return string The path to the temp folder
@throws ImportException | [
"Extract",
"a",
"zip",
"file",
"into",
"a",
"temp",
"folder",
"and",
"return",
"the",
"folder",
"path",
"."
] | 6e9896042d80c4e50f1e7ceacf434e772daaf149 | https://github.com/liip/LiipTranslationBundle/blob/6e9896042d80c4e50f1e7ceacf434e772daaf149/Import/SessionImporter.php#L88-L100 |
224,826 | liip/LiipTranslationBundle | Import/SessionImporter.php | SessionImporter.importFile | protected function importFile($filePath, $fileName = null)
{
// Filename parsing
if ($fileName == null) {
$fileName = basename($filePath);
}
if (!preg_match('/\w+\.\w+\.\w+/', $fileName)) {
throw new ImportException("Invalid filename [$fileName], all translati... | php | protected function importFile($filePath, $fileName = null)
{
// Filename parsing
if ($fileName == null) {
$fileName = basename($filePath);
}
if (!preg_match('/\w+\.\w+\.\w+/', $fileName)) {
throw new ImportException("Invalid filename [$fileName], all translati... | [
"protected",
"function",
"importFile",
"(",
"$",
"filePath",
",",
"$",
"fileName",
"=",
"null",
")",
"{",
"// Filename parsing",
"if",
"(",
"$",
"fileName",
"==",
"null",
")",
"{",
"$",
"fileName",
"=",
"basename",
"(",
"$",
"filePath",
")",
";",
"}",
... | Add a file to the current import buffer.
@param string $filePath The path to the file
@param string $fileName Optional, the filename to parse to extract resources data
@return array
@throws ImportException | [
"Add",
"a",
"file",
"to",
"the",
"current",
"import",
"buffer",
"."
] | 6e9896042d80c4e50f1e7ceacf434e772daaf149 | https://github.com/liip/LiipTranslationBundle/blob/6e9896042d80c4e50f1e7ceacf434e772daaf149/Import/SessionImporter.php#L112-L152 |
224,827 | liip/LiipTranslationBundle | Command/GitPersistenceAwareCommand.php | GitPersistenceAwareCommand.getPersistence | public function getPersistence()
{
$persistence = $this->getContainer()->get('liip.translation.persistence');
if (false === $persistence instanceof GitPersistence) {
throw new \RuntimeException(sprintf(
'Cannot initialize git repository, configured persistence should be ... | php | public function getPersistence()
{
$persistence = $this->getContainer()->get('liip.translation.persistence');
if (false === $persistence instanceof GitPersistence) {
throw new \RuntimeException(sprintf(
'Cannot initialize git repository, configured persistence should be ... | [
"public",
"function",
"getPersistence",
"(",
")",
"{",
"$",
"persistence",
"=",
"$",
"this",
"->",
"getContainer",
"(",
")",
"->",
"get",
"(",
"'liip.translation.persistence'",
")",
";",
"if",
"(",
"false",
"===",
"$",
"persistence",
"instanceof",
"GitPersiste... | Returns the configured repository, which should be a GitPersistence.
@return GitPersistence
@throws \RuntimeException | [
"Returns",
"the",
"configured",
"repository",
"which",
"should",
"be",
"a",
"GitPersistence",
"."
] | 6e9896042d80c4e50f1e7ceacf434e772daaf149 | https://github.com/liip/LiipTranslationBundle/blob/6e9896042d80c4e50f1e7ceacf434e772daaf149/Command/GitPersistenceAwareCommand.php#L29-L42 |
224,828 | liip/LiipTranslationBundle | Persistence/GitPersistence.php | GitPersistence.cloneRepository | public function cloneRepository($remote)
{
$fileSystem = new Filesystem();
$fileSystem->mkdir($this->directory);
if ($fileSystem->exists($this->directory.DIRECTORY_SEPARATOR.'.git')) {
throw new \RuntimeException(sprintf('"%s" already is a git repository.', $this->directory));
... | php | public function cloneRepository($remote)
{
$fileSystem = new Filesystem();
$fileSystem->mkdir($this->directory);
if ($fileSystem->exists($this->directory.DIRECTORY_SEPARATOR.'.git')) {
throw new \RuntimeException(sprintf('"%s" already is a git repository.', $this->directory));
... | [
"public",
"function",
"cloneRepository",
"(",
"$",
"remote",
")",
"{",
"$",
"fileSystem",
"=",
"new",
"Filesystem",
"(",
")",
";",
"$",
"fileSystem",
"->",
"mkdir",
"(",
"$",
"this",
"->",
"directory",
")",
";",
"if",
"(",
"$",
"fileSystem",
"->",
"exi... | Clones a given remote.
@param string $remote
@return bool
@throws \RuntimeException | [
"Clones",
"a",
"given",
"remote",
"."
] | 6e9896042d80c4e50f1e7ceacf434e772daaf149 | https://github.com/liip/LiipTranslationBundle/blob/6e9896042d80c4e50f1e7ceacf434e772daaf149/Persistence/GitPersistence.php#L136-L150 |
224,829 | liip/LiipTranslationBundle | Persistence/GitPersistence.php | GitPersistence.executeCmd | protected function executeCmd($command)
{
$process = new $this->processClass($command);
$process->run();
if (false === $process->isSuccessful() && strlen($process->getErrorOutput()) > 0) {
throw new \RuntimeException($process->getErrorOutput());
}
return $proces... | php | protected function executeCmd($command)
{
$process = new $this->processClass($command);
$process->run();
if (false === $process->isSuccessful() && strlen($process->getErrorOutput()) > 0) {
throw new \RuntimeException($process->getErrorOutput());
}
return $proces... | [
"protected",
"function",
"executeCmd",
"(",
"$",
"command",
")",
"{",
"$",
"process",
"=",
"new",
"$",
"this",
"->",
"processClass",
"(",
"$",
"command",
")",
";",
"$",
"process",
"->",
"run",
"(",
")",
";",
"if",
"(",
"false",
"===",
"$",
"process",... | Executes a given command on the shell.
@param string $command
@return bool
@throws \RuntimeException | [
"Executes",
"a",
"given",
"command",
"on",
"the",
"shell",
"."
] | 6e9896042d80c4e50f1e7ceacf434e772daaf149 | https://github.com/liip/LiipTranslationBundle/blob/6e9896042d80c4e50f1e7ceacf434e772daaf149/Persistence/GitPersistence.php#L193-L203 |
224,830 | liip/LiipTranslationBundle | Persistence/GitPersistence.php | GitPersistence.getResolvedOptions | protected function getResolvedOptions(array $options)
{
$resolver = new OptionsResolver();
$resolver->setDefaults(array(
'processClass' => 'Symfony\\Component\\Process\\Process',
))
->setRequired(array('folder'))
->setAllowedTypes(array(
... | php | protected function getResolvedOptions(array $options)
{
$resolver = new OptionsResolver();
$resolver->setDefaults(array(
'processClass' => 'Symfony\\Component\\Process\\Process',
))
->setRequired(array('folder'))
->setAllowedTypes(array(
... | [
"protected",
"function",
"getResolvedOptions",
"(",
"array",
"$",
"options",
")",
"{",
"$",
"resolver",
"=",
"new",
"OptionsResolver",
"(",
")",
";",
"$",
"resolver",
"->",
"setDefaults",
"(",
"array",
"(",
"'processClass'",
"=>",
"'Symfony\\\\Component\\\\Process... | Get a set of usable options.
@param array $options
@return array | [
"Get",
"a",
"set",
"of",
"usable",
"options",
"."
] | 6e9896042d80c4e50f1e7ceacf434e772daaf149 | https://github.com/liip/LiipTranslationBundle/blob/6e9896042d80c4e50f1e7ceacf434e772daaf149/Persistence/GitPersistence.php#L212-L226 |
224,831 | adrotec/breeze.server.php | src/Adrotec/BreezeJs/CallbackExpressionProvider.php | CallbackExpressionProvider.onLogicalExpression | public function onLogicalExpression($expressionType, $left, $right) {
switch ($expressionType) {
case ExpressionType::AND_LOGICAL:
// return '$logicalAnd('.$left.', '.$right.')';
return $this->_prepareBinaryExpression(self::LOGICAL_AND, $left, $right);
break;
... | php | public function onLogicalExpression($expressionType, $left, $right) {
switch ($expressionType) {
case ExpressionType::AND_LOGICAL:
// return '$logicalAnd('.$left.', '.$right.')';
return $this->_prepareBinaryExpression(self::LOGICAL_AND, $left, $right);
break;
... | [
"public",
"function",
"onLogicalExpression",
"(",
"$",
"expressionType",
",",
"$",
"left",
",",
"$",
"right",
")",
"{",
"switch",
"(",
"$",
"expressionType",
")",
"{",
"case",
"ExpressionType",
"::",
"AND_LOGICAL",
":",
"//\t\t\t\treturn '$logicalAnd('.$left.', '.$r... | Call-back for logical expression
@param ExpressionType $expressionType The type of logical expression.
@param string $left The left expression.
@param string $right The left expression.
@return string | [
"Call",
"-",
"back",
"for",
"logical",
"expression"
] | 0c29d7121b303e00e01588804821e760787dff0c | https://github.com/adrotec/breeze.server.php/blob/0c29d7121b303e00e01588804821e760787dff0c/src/Adrotec/BreezeJs/CallbackExpressionProvider.php#L110-L123 |
224,832 | adrotec/breeze.server.php | src/Adrotec/BreezeJs/CallbackExpressionProvider.php | CallbackExpressionProvider.onArithmeticExpression | public function onArithmeticExpression($expressionType, $left, $right) {
switch ($expressionType) {
case ExpressionType::MULTIPLY:
return $this->_prepareBinaryExpression(self::MULTIPLY, $left, $right);
break;
case ExpressionType::DIVIDE:
re... | php | public function onArithmeticExpression($expressionType, $left, $right) {
switch ($expressionType) {
case ExpressionType::MULTIPLY:
return $this->_prepareBinaryExpression(self::MULTIPLY, $left, $right);
break;
case ExpressionType::DIVIDE:
re... | [
"public",
"function",
"onArithmeticExpression",
"(",
"$",
"expressionType",
",",
"$",
"left",
",",
"$",
"right",
")",
"{",
"switch",
"(",
"$",
"expressionType",
")",
"{",
"case",
"ExpressionType",
"::",
"MULTIPLY",
":",
"return",
"$",
"this",
"->",
"_prepare... | Call-back for arithmetic expression
@param ExpressionType $expressionType The type of arithmetic expression.
@param string $left The left expression.
@param string $right The left expression.
@return string | [
"Call",
"-",
"back",
"for",
"arithmetic",
"expression"
] | 0c29d7121b303e00e01588804821e760787dff0c | https://github.com/adrotec/breeze.server.php/blob/0c29d7121b303e00e01588804821e760787dff0c/src/Adrotec/BreezeJs/CallbackExpressionProvider.php#L134-L154 |
224,833 | adrotec/breeze.server.php | src/Adrotec/BreezeJs/CallbackExpressionProvider.php | CallbackExpressionProvider.onRelationalExpression | public function onRelationalExpression($expressionType, $left, $right) {
switch ($expressionType) {
case ExpressionType::GREATERTHAN:
return $this->_prepareBinaryExpression(self::GREATERTHAN, $left, $right);
break;
case ExpressionType::GREATERTHAN_OR_EQUAL... | php | public function onRelationalExpression($expressionType, $left, $right) {
switch ($expressionType) {
case ExpressionType::GREATERTHAN:
return $this->_prepareBinaryExpression(self::GREATERTHAN, $left, $right);
break;
case ExpressionType::GREATERTHAN_OR_EQUAL... | [
"public",
"function",
"onRelationalExpression",
"(",
"$",
"expressionType",
",",
"$",
"left",
",",
"$",
"right",
")",
"{",
"switch",
"(",
"$",
"expressionType",
")",
"{",
"case",
"ExpressionType",
"::",
"GREATERTHAN",
":",
"return",
"$",
"this",
"->",
"_prep... | Call-back for relational expression
@param ExpressionType $expressionType The type of relation expression
@param string $left The left expression
@param string $right The right expression
@return string | [
"Call",
"-",
"back",
"for",
"relational",
"expression"
] | 0c29d7121b303e00e01588804821e760787dff0c | https://github.com/adrotec/breeze.server.php/blob/0c29d7121b303e00e01588804821e760787dff0c/src/Adrotec/BreezeJs/CallbackExpressionProvider.php#L165-L192 |
224,834 | adrotec/breeze.server.php | src/Adrotec/BreezeJs/CallbackExpressionProvider.php | CallbackExpressionProvider.onUnaryExpression | public function onUnaryExpression($expressionType, $child) {
switch ($expressionType) {
case ExpressionType::NEGATE:
return $this->_prepareUnaryExpression(self::NEGATE, $child);
break;
case ExpressionType::NOT_LOGICAL:
return $this->_prepar... | php | public function onUnaryExpression($expressionType, $child) {
switch ($expressionType) {
case ExpressionType::NEGATE:
return $this->_prepareUnaryExpression(self::NEGATE, $child);
break;
case ExpressionType::NOT_LOGICAL:
return $this->_prepar... | [
"public",
"function",
"onUnaryExpression",
"(",
"$",
"expressionType",
",",
"$",
"child",
")",
"{",
"switch",
"(",
"$",
"expressionType",
")",
"{",
"case",
"ExpressionType",
"::",
"NEGATE",
":",
"return",
"$",
"this",
"->",
"_prepareUnaryExpression",
"(",
"sel... | Call-back for unary expression
@param ExpressionType $expressionType The type of unary expression
@param string $child The child expression
@return string | [
"Call",
"-",
"back",
"for",
"unary",
"expression"
] | 0c29d7121b303e00e01588804821e760787dff0c | https://github.com/adrotec/breeze.server.php/blob/0c29d7121b303e00e01588804821e760787dff0c/src/Adrotec/BreezeJs/CallbackExpressionProvider.php#L202-L213 |
224,835 | adrotec/breeze.server.php | src/Adrotec/BreezeJs/CallbackExpressionProvider.php | CallbackExpressionProvider._prepareUnaryExpression | private function _prepareUnaryExpression($operator, $child) {
return $this->_iterName.$operator.self::OPEN_BRAKET.$child.self::CLOSE_BRACKET;
} | php | private function _prepareUnaryExpression($operator, $child) {
return $this->_iterName.$operator.self::OPEN_BRAKET.$child.self::CLOSE_BRACKET;
} | [
"private",
"function",
"_prepareUnaryExpression",
"(",
"$",
"operator",
",",
"$",
"child",
")",
"{",
"return",
"$",
"this",
"->",
"_iterName",
".",
"$",
"operator",
".",
"self",
"::",
"OPEN_BRAKET",
".",
"$",
"child",
".",
"self",
"::",
"CLOSE_BRACKET",
";... | To format unary expression
@param string $operator The unary operator.
@param string $child The operand.
@return string | [
"To",
"format",
"unary",
"expression"
] | 0c29d7121b303e00e01588804821e760787dff0c | https://github.com/adrotec/breeze.server.php/blob/0c29d7121b303e00e01588804821e760787dff0c/src/Adrotec/BreezeJs/CallbackExpressionProvider.php#L367-L369 |
224,836 | liip/LiipTranslationBundle | Translation/Translator.php | Translator.addResource | public function addResource($format, $resource, $locale, $domain = null)
{
$this->standardResources[] = array(
'format' => $format,
'path' => $resource,
'locale' => $locale,
'domain' => $domain === null ? 'messages' : $domain,
);
} | php | public function addResource($format, $resource, $locale, $domain = null)
{
$this->standardResources[] = array(
'format' => $format,
'path' => $resource,
'locale' => $locale,
'domain' => $domain === null ? 'messages' : $domain,
);
} | [
"public",
"function",
"addResource",
"(",
"$",
"format",
",",
"$",
"resource",
",",
"$",
"locale",
",",
"$",
"domain",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"standardResources",
"[",
"]",
"=",
"array",
"(",
"'format'",
"=>",
"$",
"format",
",",
"... | Override the addResource, so that we can keep tracking standard resources
but we don't call the parent method as we don't want to use them anymore.
@param string $format
@param mixed $resource
@param string $locale
@param string|null $domain | [
"Override",
"the",
"addResource",
"so",
"that",
"we",
"can",
"keep",
"tracking",
"standard",
"resources",
"but",
"we",
"don",
"t",
"call",
"the",
"parent",
"method",
"as",
"we",
"don",
"t",
"want",
"to",
"use",
"them",
"anymore",
"."
] | 6e9896042d80c4e50f1e7ceacf434e772daaf149 | https://github.com/liip/LiipTranslationBundle/blob/6e9896042d80c4e50f1e7ceacf434e772daaf149/Translation/Translator.php#L43-L51 |
224,837 | liip/LiipTranslationBundle | Translation/Translator.php | Translator.getStandardResources | public function getStandardResources()
{
if (!$this->initialized && isset($this->options['resource_files'])) {
foreach ($this->options['resource_files'] as $files) {
foreach ($files as $file) {
// filename is domain.locale.format
list($doma... | php | public function getStandardResources()
{
if (!$this->initialized && isset($this->options['resource_files'])) {
foreach ($this->options['resource_files'] as $files) {
foreach ($files as $file) {
// filename is domain.locale.format
list($doma... | [
"public",
"function",
"getStandardResources",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"initialized",
"&&",
"isset",
"(",
"$",
"this",
"->",
"options",
"[",
"'resource_files'",
"]",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"options",
... | Return the list of 'standard' resources.
@return array | [
"Return",
"the",
"list",
"of",
"standard",
"resources",
"."
] | 6e9896042d80c4e50f1e7ceacf434e772daaf149 | https://github.com/liip/LiipTranslationBundle/blob/6e9896042d80c4e50f1e7ceacf434e772daaf149/Translation/Translator.php#L58-L78 |
224,838 | liip/LiipTranslationBundle | Translation/Translator.php | Translator.loadResource | public function loadResource($resource)
{
// If possible use our custom xliff loader, so we get metadata
if (in_array($resource['format'], array('xliff', 'xlf'))) {
return $this->container->get('liip.translation.xliff.loader')->load($resource['path'], $resource['locale'], $resource['doma... | php | public function loadResource($resource)
{
// If possible use our custom xliff loader, so we get metadata
if (in_array($resource['format'], array('xliff', 'xlf'))) {
return $this->container->get('liip.translation.xliff.loader')->load($resource['path'], $resource['locale'], $resource['doma... | [
"public",
"function",
"loadResource",
"(",
"$",
"resource",
")",
"{",
"// If possible use our custom xliff loader, so we get metadata",
"if",
"(",
"in_array",
"(",
"$",
"resource",
"[",
"'format'",
"]",
",",
"array",
"(",
"'xliff'",
",",
"'xlf'",
")",
")",
")",
... | Load a specific resource.
@param array $resource
@return MessageCatalogue
@throws \RuntimeException | [
"Load",
"a",
"specific",
"resource",
"."
] | 6e9896042d80c4e50f1e7ceacf434e772daaf149 | https://github.com/liip/LiipTranslationBundle/blob/6e9896042d80c4e50f1e7ceacf434e772daaf149/Translation/Translator.php#L111-L131 |
224,839 | liip/LiipTranslationBundle | Translation/Translator.php | Translator.initialize | protected function initialize()
{
if ($this->initialized) {
return;
}
parent::initialize();
// Add resources files directly, so that we still have translations
// event if we don't run translation:import
$standardResources = $this->getStandardResources()... | php | protected function initialize()
{
if ($this->initialized) {
return;
}
parent::initialize();
// Add resources files directly, so that we still have translations
// event if we don't run translation:import
$standardResources = $this->getStandardResources()... | [
"protected",
"function",
"initialize",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"initialized",
")",
"{",
"return",
";",
"}",
"parent",
"::",
"initialize",
"(",
")",
";",
"// Add resources files directly, so that we still have translations",
"// event if we don't r... | Initialize the translation before loading catalogues from the storage. | [
"Initialize",
"the",
"translation",
"before",
"loading",
"catalogues",
"from",
"the",
"storage",
"."
] | 6e9896042d80c4e50f1e7ceacf434e772daaf149 | https://github.com/liip/LiipTranslationBundle/blob/6e9896042d80c4e50f1e7ceacf434e772daaf149/Translation/Translator.php#L136-L161 |
224,840 | umulmrum/holiday | src/Helper/HolidayHelper.php | HolidayHelper.isDayAHoliday | public function isDayAHoliday(DateTime $dateTime, $region)
{
$holidayList = $this->holidayCalculator->calculateHolidaysForYear((int) $dateTime->format('Y'), $region, $dateTime->getTimezone());
$filteredHolidays = (new IncludeTimespanFilter())->filter($holidayList, [
IncludeTimespanFilter... | php | public function isDayAHoliday(DateTime $dateTime, $region)
{
$holidayList = $this->holidayCalculator->calculateHolidaysForYear((int) $dateTime->format('Y'), $region, $dateTime->getTimezone());
$filteredHolidays = (new IncludeTimespanFilter())->filter($holidayList, [
IncludeTimespanFilter... | [
"public",
"function",
"isDayAHoliday",
"(",
"DateTime",
"$",
"dateTime",
",",
"$",
"region",
")",
"{",
"$",
"holidayList",
"=",
"$",
"this",
"->",
"holidayCalculator",
"->",
"calculateHolidaysForYear",
"(",
"(",
"int",
")",
"$",
"dateTime",
"->",
"format",
"... | Returns if the given date is a holiday in the given region.
@param DateTime $dateTime
@param string $region
@return bool true if the day is a holiday, else false
@throws HolidayException | [
"Returns",
"if",
"the",
"given",
"date",
"is",
"a",
"holiday",
"in",
"the",
"given",
"region",
"."
] | 19bd2f0259c0e01d4b984876b014d636c53a2be3 | https://github.com/umulmrum/holiday/blob/19bd2f0259c0e01d4b984876b014d636c53a2be3/src/Helper/HolidayHelper.php#L61-L70 |
224,841 | umulmrum/holiday | src/Helper/HolidayHelper.php | HolidayHelper.getHolidaysForMonth | public function getHolidaysForMonth($year, $month, $region, DateTimeZone $timezone = null)
{
$holidayList = $this->holidayCalculator->calculateHolidaysForYear($year, $region, $timezone);
$date = new DateTime(sprintf('%s-%s-01', $year, $month), $timezone);
$lastDayOfMonth = (int) $date->forma... | php | public function getHolidaysForMonth($year, $month, $region, DateTimeZone $timezone = null)
{
$holidayList = $this->holidayCalculator->calculateHolidaysForYear($year, $region, $timezone);
$date = new DateTime(sprintf('%s-%s-01', $year, $month), $timezone);
$lastDayOfMonth = (int) $date->forma... | [
"public",
"function",
"getHolidaysForMonth",
"(",
"$",
"year",
",",
"$",
"month",
",",
"$",
"region",
",",
"DateTimeZone",
"$",
"timezone",
"=",
"null",
")",
"{",
"$",
"holidayList",
"=",
"$",
"this",
"->",
"holidayCalculator",
"->",
"calculateHolidaysForYear"... | Returns all holidays for the given month in the given region.
@param int $year
@param int $month
@param string $region
@param DateTimeZone $timezone
@return HolidayList
@throws HolidayException | [
"Returns",
"all",
"holidays",
"for",
"the",
"given",
"month",
"in",
"the",
"given",
"region",
"."
] | 19bd2f0259c0e01d4b984876b014d636c53a2be3 | https://github.com/umulmrum/holiday/blob/19bd2f0259c0e01d4b984876b014d636c53a2be3/src/Helper/HolidayHelper.php#L84-L95 |
224,842 | umulmrum/holiday | src/Helper/HolidayHelper.php | HolidayHelper.getHolidaysByName | public function getHolidaysByName($year, $holidayName, $region, DateTimeZone $timezone = null)
{
$holidayList = $this->holidayCalculator->calculateHolidaysForYear($year, $region, $timezone);
$filteredHolidays = (new IncludeHolidayNameFilter())->filter($holidayList, [
IncludeHolidayNameFi... | php | public function getHolidaysByName($year, $holidayName, $region, DateTimeZone $timezone = null)
{
$holidayList = $this->holidayCalculator->calculateHolidaysForYear($year, $region, $timezone);
$filteredHolidays = (new IncludeHolidayNameFilter())->filter($holidayList, [
IncludeHolidayNameFi... | [
"public",
"function",
"getHolidaysByName",
"(",
"$",
"year",
",",
"$",
"holidayName",
",",
"$",
"region",
",",
"DateTimeZone",
"$",
"timezone",
"=",
"null",
")",
"{",
"$",
"holidayList",
"=",
"$",
"this",
"->",
"holidayCalculator",
"->",
"calculateHolidaysForY... | Returns all holidays with the given name for the given year in the given region. Note that holiday names are
not necessarily unique, and therefore a HolidayList object is returned.
@param int $year
@param string $holidayName
@param string $region
@param DateTimeZone $timezone
@return HolidayList
... | [
"Returns",
"all",
"holidays",
"with",
"the",
"given",
"name",
"for",
"the",
"given",
"year",
"in",
"the",
"given",
"region",
".",
"Note",
"that",
"holiday",
"names",
"are",
"not",
"necessarily",
"unique",
"and",
"therefore",
"a",
"HolidayList",
"object",
"is... | 19bd2f0259c0e01d4b984876b014d636c53a2be3 | https://github.com/umulmrum/holiday/blob/19bd2f0259c0e01d4b984876b014d636c53a2be3/src/Helper/HolidayHelper.php#L110-L118 |
224,843 | umulmrum/holiday | src/Helper/HolidayHelper.php | HolidayHelper.getNoWorkDaysForTimespan | public function getNoWorkDaysForTimespan(DateTime $firstDay, DateTime $lastDay, $region, array $noWorkWeekdayProviders = [])
{
if (count($noWorkWeekdayProviders) > 0) {
$noWork = $noWorkWeekdayProviders;
} else {
$noWork = [
new Sundays(),
];
... | php | public function getNoWorkDaysForTimespan(DateTime $firstDay, DateTime $lastDay, $region, array $noWorkWeekdayProviders = [])
{
if (count($noWorkWeekdayProviders) > 0) {
$noWork = $noWorkWeekdayProviders;
} else {
$noWork = [
new Sundays(),
];
... | [
"public",
"function",
"getNoWorkDaysForTimespan",
"(",
"DateTime",
"$",
"firstDay",
",",
"DateTime",
"$",
"lastDay",
",",
"$",
"region",
",",
"array",
"$",
"noWorkWeekdayProviders",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"noWorkWeekdayProviders... | Returns all days in the given timespan and the region in which normally employees do not need to work.
Be aware that this method is quite heavy-weight if multiple no-work days for multiple years are requested.
@param DateTime $firstDay
@param DateTime $lastDay
@param string ... | [
"Returns",
"all",
"days",
"in",
"the",
"given",
"timespan",
"and",
"the",
"region",
"in",
"which",
"normally",
"employees",
"do",
"not",
"need",
"to",
"work",
".",
"Be",
"aware",
"that",
"this",
"method",
"is",
"quite",
"heavy",
"-",
"weight",
"if",
"mul... | 19bd2f0259c0e01d4b984876b014d636c53a2be3 | https://github.com/umulmrum/holiday/blob/19bd2f0259c0e01d4b984876b014d636c53a2be3/src/Helper/HolidayHelper.php#L133-L153 |
224,844 | umulmrum/holiday | src/Helper/HolidayHelper.php | HolidayHelper.mergeHolidayLists | public function mergeHolidayLists(array $holidayLists)
{
$newList = new HolidayList();
foreach ($holidayLists as $holidayList) {
foreach ($holidayList->getList() as $holiday) {
$newList->add($holiday);
}
}
return (new SortByDateFilter())->filt... | php | public function mergeHolidayLists(array $holidayLists)
{
$newList = new HolidayList();
foreach ($holidayLists as $holidayList) {
foreach ($holidayList->getList() as $holiday) {
$newList->add($holiday);
}
}
return (new SortByDateFilter())->filt... | [
"public",
"function",
"mergeHolidayLists",
"(",
"array",
"$",
"holidayLists",
")",
"{",
"$",
"newList",
"=",
"new",
"HolidayList",
"(",
")",
";",
"foreach",
"(",
"$",
"holidayLists",
"as",
"$",
"holidayList",
")",
"{",
"foreach",
"(",
"$",
"holidayList",
"... | Returns a merged list of all the HolidayList objects given.
@param HolidayList[] $holidayLists
@return HolidayList | [
"Returns",
"a",
"merged",
"list",
"of",
"all",
"the",
"HolidayList",
"objects",
"given",
"."
] | 19bd2f0259c0e01d4b984876b014d636c53a2be3 | https://github.com/umulmrum/holiday/blob/19bd2f0259c0e01d4b984876b014d636c53a2be3/src/Helper/HolidayHelper.php#L194-L204 |
224,845 | jasny/error-handler | src/ErrorHandler/Logging.php | Logging.log | public function log($error)
{
if ($error instanceof \Error || $error instanceof \ErrorException) {
return $this->logError($error);
}
if ($error instanceof \Exception) {
return $this->logException($error);
}
$message = "Unable to log a... | php | public function log($error)
{
if ($error instanceof \Error || $error instanceof \ErrorException) {
return $this->logError($error);
}
if ($error instanceof \Exception) {
return $this->logException($error);
}
$message = "Unable to log a... | [
"public",
"function",
"log",
"(",
"$",
"error",
")",
"{",
"if",
"(",
"$",
"error",
"instanceof",
"\\",
"Error",
"||",
"$",
"error",
"instanceof",
"\\",
"ErrorException",
")",
"{",
"return",
"$",
"this",
"->",
"logError",
"(",
"$",
"error",
")",
";",
... | Log an error or exception
@param \Exception|\Error $error | [
"Log",
"an",
"error",
"or",
"exception"
] | 38e076fc36d86689010081bc2eab96f12d97b0d8 | https://github.com/jasny/error-handler/blob/38e076fc36d86689010081bc2eab96f12d97b0d8/src/ErrorHandler/Logging.php#L67-L79 |
224,846 | jasny/error-handler | src/ErrorHandler/Logging.php | Logging.logException | protected function logException(\Exception $exception)
{
$level = $this->getLogLevel();
$message = sprintf('Uncaught Exception %s: "%s" at %s line %s', get_class($exception), $exception->getMessage(),
$exception->getFile(), $exception->getLine());
$context = com... | php | protected function logException(\Exception $exception)
{
$level = $this->getLogLevel();
$message = sprintf('Uncaught Exception %s: "%s" at %s line %s', get_class($exception), $exception->getMessage(),
$exception->getFile(), $exception->getLine());
$context = com... | [
"protected",
"function",
"logException",
"(",
"\\",
"Exception",
"$",
"exception",
")",
"{",
"$",
"level",
"=",
"$",
"this",
"->",
"getLogLevel",
"(",
")",
";",
"$",
"message",
"=",
"sprintf",
"(",
"'Uncaught Exception %s: \"%s\" at %s line %s'",
",",
"get_class... | Log an exception
@param \Exception $exception | [
"Log",
"an",
"exception"
] | 38e076fc36d86689010081bc2eab96f12d97b0d8 | https://github.com/jasny/error-handler/blob/38e076fc36d86689010081bc2eab96f12d97b0d8/src/ErrorHandler/Logging.php#L110-L120 |
224,847 | paillechat/php-enum | src/Enum.php | Enum.createByName | final public static function createByName(string $name)
{
$canonicalName = strtoupper($name);
if ($canonicalName !== $name) {
$name = $canonicalName;
trigger_error('PSR-1 requires constant to be declared in upper case.', E_USER_NOTICE);
}
$const = static::get... | php | final public static function createByName(string $name)
{
$canonicalName = strtoupper($name);
if ($canonicalName !== $name) {
$name = $canonicalName;
trigger_error('PSR-1 requires constant to be declared in upper case.', E_USER_NOTICE);
}
$const = static::get... | [
"final",
"public",
"static",
"function",
"createByName",
"(",
"string",
"$",
"name",
")",
"{",
"$",
"canonicalName",
"=",
"strtoupper",
"(",
"$",
"name",
")",
";",
"if",
"(",
"$",
"canonicalName",
"!==",
"$",
"name",
")",
"{",
"$",
"name",
"=",
"$",
... | Creates enum instance by name
@param string $name
@return static
@throws EnumException | [
"Creates",
"enum",
"instance",
"by",
"name"
] | 1a4d98d45b9c736f2fd036ef314d72e3d09d15b5 | https://github.com/paillechat/php-enum/blob/1a4d98d45b9c736f2fd036ef314d72e3d09d15b5/src/Enum.php#L35-L50 |
224,848 | paillechat/php-enum | src/Enum.php | Enum.createNamedInstance | private static function createNamedInstance(string $name)
{
$class = self::findParentClassForConst($name);
$key = self::getConstKey($class, $name);
if (!array_key_exists($key, self::$instances)) {
self::$instances[$key] = new static($name);
}
return self::$inst... | php | private static function createNamedInstance(string $name)
{
$class = self::findParentClassForConst($name);
$key = self::getConstKey($class, $name);
if (!array_key_exists($key, self::$instances)) {
self::$instances[$key] = new static($name);
}
return self::$inst... | [
"private",
"static",
"function",
"createNamedInstance",
"(",
"string",
"$",
"name",
")",
"{",
"$",
"class",
"=",
"self",
"::",
"findParentClassForConst",
"(",
"$",
"name",
")",
";",
"$",
"key",
"=",
"self",
"::",
"getConstKey",
"(",
"$",
"class",
",",
"$... | Create named enum instance
@param string $name
@return static | [
"Create",
"named",
"enum",
"instance"
] | 1a4d98d45b9c736f2fd036ef314d72e3d09d15b5 | https://github.com/paillechat/php-enum/blob/1a4d98d45b9c736f2fd036ef314d72e3d09d15b5/src/Enum.php#L116-L127 |
224,849 | mrteye/GDAX | src/Api.php | Api._call | private function _call($method, $path, $param, $header = false) {
// Clear connection; Set timeout, and json header.
$this->curl->resetConnection();
// Set additional headers.
if ($header) {
foreach ($header as $name => $value) {
$this->curl->setHeader($name, $value);
}
}
/... | php | private function _call($method, $path, $param, $header = false) {
// Clear connection; Set timeout, and json header.
$this->curl->resetConnection();
// Set additional headers.
if ($header) {
foreach ($header as $name => $value) {
$this->curl->setHeader($name, $value);
}
}
/... | [
"private",
"function",
"_call",
"(",
"$",
"method",
",",
"$",
"path",
",",
"$",
"param",
",",
"$",
"header",
"=",
"false",
")",
"{",
"// Clear connection; Set timeout, and json header.",
"$",
"this",
"->",
"curl",
"->",
"resetConnection",
"(",
")",
";",
"// ... | Connection logic; send requests to the Gdax API. | [
"Connection",
"logic",
";",
"send",
"requests",
"to",
"the",
"Gdax",
"API",
"."
] | 891e5e95abb4a0fc8d4e5b937d8f143701460824 | https://github.com/mrteye/GDAX/blob/891e5e95abb4a0fc8d4e5b937d8f143701460824/src/Api.php#L79-L122 |
224,850 | hendrikmaus/drafter-installer | src/Installer.php | Installer.createComposerInMemoryPackage | public static function createComposerInMemoryPackage($targetDir, $tag)
{
$package = new Package('apiaryio/drafter', 'drafter', $tag);
$package->setTargetDir($targetDir);
$package->setInstallationSource('source');
$package->setSourceUrl('https://github.com/apiaryio/drafter');
... | php | public static function createComposerInMemoryPackage($targetDir, $tag)
{
$package = new Package('apiaryio/drafter', 'drafter', $tag);
$package->setTargetDir($targetDir);
$package->setInstallationSource('source');
$package->setSourceUrl('https://github.com/apiaryio/drafter');
... | [
"public",
"static",
"function",
"createComposerInMemoryPackage",
"(",
"$",
"targetDir",
",",
"$",
"tag",
")",
"{",
"$",
"package",
"=",
"new",
"Package",
"(",
"'apiaryio/drafter'",
",",
"'drafter'",
",",
"$",
"tag",
")",
";",
"$",
"package",
"->",
"setTarget... | Create composer in memory package
@param string $targetDir Download target dir
@param string $tag Tag to install, e.g. v3.1.1
@return Package | [
"Create",
"composer",
"in",
"memory",
"package"
] | 1dcad857cf8df47aac74dd8641cc6bb71d700712 | https://github.com/hendrikmaus/drafter-installer/blob/1dcad857cf8df47aac74dd8641cc6bb71d700712/src/Installer.php#L108-L118 |
224,851 | Crinsane/LaravelNotify | src/Notifications/Renderers/NativeRenderer.php | NativeRenderer.generateMessage | private function generateMessage($notification)
{
$message = ucfirst($notification['type']) . '\n\n';
if ( ! is_null($notification['title'])) {
$message .= $this->escapeTitle($notification['title']) . '\n\n';
}
return $this->escapeMessage($message . $notification['messa... | php | private function generateMessage($notification)
{
$message = ucfirst($notification['type']) . '\n\n';
if ( ! is_null($notification['title'])) {
$message .= $this->escapeTitle($notification['title']) . '\n\n';
}
return $this->escapeMessage($message . $notification['messa... | [
"private",
"function",
"generateMessage",
"(",
"$",
"notification",
")",
"{",
"$",
"message",
"=",
"ucfirst",
"(",
"$",
"notification",
"[",
"'type'",
"]",
")",
".",
"'\\n\\n'",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"notification",
"[",
"'title'",
"]... | Generate the message for a native alert
@param array $notification
@return string | [
"Generate",
"the",
"message",
"for",
"a",
"native",
"alert"
] | 5064482018534abdb4483b9a08f86fa3ac735efd | https://github.com/Crinsane/LaravelNotify/blob/5064482018534abdb4483b9a08f86fa3ac735efd/src/Notifications/Renderers/NativeRenderer.php#L55-L64 |
224,852 | yii2mod/yii2-bx-slider | BxSlider.php | BxSlider.run | public function run()
{
if (empty($this->items)) {
return;
}
if (!isset($this->containerOptions['id'])) {
$this->containerOptions['id'] = $this->getId();
}
echo $this->renderItems() . "\n";
$this->registerAssets();
} | php | public function run()
{
if (empty($this->items)) {
return;
}
if (!isset($this->containerOptions['id'])) {
$this->containerOptions['id'] = $this->getId();
}
echo $this->renderItems() . "\n";
$this->registerAssets();
} | [
"public",
"function",
"run",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"items",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"containerOptions",
"[",
"'id'",
"]",
")",
")",
"{",
"$",
"this... | Render range slider
@return string|void | [
"Render",
"range",
"slider"
] | 027468995da085ee4baae75d073cdb991533be14 | https://github.com/yii2mod/yii2-bx-slider/blob/027468995da085ee4baae75d073cdb991533be14/BxSlider.php#L47-L57 |
224,853 | yii2mod/yii2-bx-slider | BxSlider.php | BxSlider.renderItems | public function renderItems()
{
$items = [];
for ($i = 0, $count = count($this->items); $i < $count; $i++) {
$items[] = Html::tag('li', $this->items[$i], $this->itemOptions);
}
return Html::tag('ul', implode("\n", $items), $this->containerOptions);
} | php | public function renderItems()
{
$items = [];
for ($i = 0, $count = count($this->items); $i < $count; $i++) {
$items[] = Html::tag('li', $this->items[$i], $this->itemOptions);
}
return Html::tag('ul', implode("\n", $items), $this->containerOptions);
} | [
"public",
"function",
"renderItems",
"(",
")",
"{",
"$",
"items",
"=",
"[",
"]",
";",
"for",
"(",
"$",
"i",
"=",
"0",
",",
"$",
"count",
"=",
"count",
"(",
"$",
"this",
"->",
"items",
")",
";",
"$",
"i",
"<",
"$",
"count",
";",
"$",
"i",
"+... | Renders slider items.
@return string the rendering result | [
"Renders",
"slider",
"items",
"."
] | 027468995da085ee4baae75d073cdb991533be14 | https://github.com/yii2mod/yii2-bx-slider/blob/027468995da085ee4baae75d073cdb991533be14/BxSlider.php#L84-L92 |
224,854 | liip/LiipTranslationBundle | Persistence/PropelPersistence.php | PropelPersistence.saveUnit | public function saveUnit(Unit $unit)
{
$propelUnit = UnitQuery::create()->findOneByDomainAndKey($unit->getDomain(), $unit->getKey());
if (!$propelUnit) {
$propelUnit = new PropelUnit();
}
$propelUnit->updateFromModel($unit);
$propelUnit->save();
} | php | public function saveUnit(Unit $unit)
{
$propelUnit = UnitQuery::create()->findOneByDomainAndKey($unit->getDomain(), $unit->getKey());
if (!$propelUnit) {
$propelUnit = new PropelUnit();
}
$propelUnit->updateFromModel($unit);
$propelUnit->save();
} | [
"public",
"function",
"saveUnit",
"(",
"Unit",
"$",
"unit",
")",
"{",
"$",
"propelUnit",
"=",
"UnitQuery",
"::",
"create",
"(",
")",
"->",
"findOneByDomainAndKey",
"(",
"$",
"unit",
"->",
"getDomain",
"(",
")",
",",
"$",
"unit",
"->",
"getKey",
"(",
")... | Save the given Unit to the persistence layer.
@param Unit $unit
@return bool | [
"Save",
"the",
"given",
"Unit",
"to",
"the",
"persistence",
"layer",
"."
] | 6e9896042d80c4e50f1e7ceacf434e772daaf149 | https://github.com/liip/LiipTranslationBundle/blob/6e9896042d80c4e50f1e7ceacf434e772daaf149/Persistence/PropelPersistence.php#L65-L73 |
224,855 | liip/LiipTranslationBundle | Security/Security.php | Security.getAuthorizedLocaleList | public function getAuthorizedLocaleList($securityChecker)
{
$this->validateSecurityChecker($securityChecker);
if (!$securityChecker || !$this->isSecuredByLocale()) {
return $this->getLocaleList();
}
$authorizedLocaleList = array();
foreach ($this->getLocaleList(... | php | public function getAuthorizedLocaleList($securityChecker)
{
$this->validateSecurityChecker($securityChecker);
if (!$securityChecker || !$this->isSecuredByLocale()) {
return $this->getLocaleList();
}
$authorizedLocaleList = array();
foreach ($this->getLocaleList(... | [
"public",
"function",
"getAuthorizedLocaleList",
"(",
"$",
"securityChecker",
")",
"{",
"$",
"this",
"->",
"validateSecurityChecker",
"(",
"$",
"securityChecker",
")",
";",
"if",
"(",
"!",
"$",
"securityChecker",
"||",
"!",
"$",
"this",
"->",
"isSecuredByLocale"... | Return the list of locales authorized by the provided security context.
@param SecurityContextInterface|AuthorizationCheckerInterface|null $securityChecker
@return array | [
"Return",
"the",
"list",
"of",
"locales",
"authorized",
"by",
"the",
"provided",
"security",
"context",
"."
] | 6e9896042d80c4e50f1e7ceacf434e772daaf149 | https://github.com/liip/LiipTranslationBundle/blob/6e9896042d80c4e50f1e7ceacf434e772daaf149/Security/Security.php#L87-L103 |
224,856 | liip/LiipTranslationBundle | Translation/Loader/XliffFileLoader.php | XliffFileLoader.load | public function load($resource, $locale, $domain = 'messages')
{
/* @var MessageCatalogue $catalogue */
$base_catalogue = parent::load($resource, $locale, $domain);
$catalogue = new MessageCatalogue($locale);
$catalogue->addCatalogue($base_catalogue);
// Process a second pas... | php | public function load($resource, $locale, $domain = 'messages')
{
/* @var MessageCatalogue $catalogue */
$base_catalogue = parent::load($resource, $locale, $domain);
$catalogue = new MessageCatalogue($locale);
$catalogue->addCatalogue($base_catalogue);
// Process a second pas... | [
"public",
"function",
"load",
"(",
"$",
"resource",
",",
"$",
"locale",
",",
"$",
"domain",
"=",
"'messages'",
")",
"{",
"/* @var MessageCatalogue $catalogue */",
"$",
"base_catalogue",
"=",
"parent",
"::",
"load",
"(",
"$",
"resource",
",",
"$",
"locale",
"... | Load translations and metadata of the trans-unit.
{@inheritdoc}
@api | [
"Load",
"translations",
"and",
"metadata",
"of",
"the",
"trans",
"-",
"unit",
"."
] | 6e9896042d80c4e50f1e7ceacf434e772daaf149 | https://github.com/liip/LiipTranslationBundle/blob/6e9896042d80c4e50f1e7ceacf434e772daaf149/Translation/Loader/XliffFileLoader.php#L17-L46 |
224,857 | liip/LiipTranslationBundle | Export/ZipExporter.php | ZipExporter.setUnits | public function setUnits($units)
{
$this->unitsByLocaleAndDomain = array();
foreach ($units as $unit) {
foreach ($unit->getTranslations() as $translation) {
$this->unitsByLocaleAndDomain[$translation->getLocale()][$translation->getDomain()][] = $translation;
}... | php | public function setUnits($units)
{
$this->unitsByLocaleAndDomain = array();
foreach ($units as $unit) {
foreach ($unit->getTranslations() as $translation) {
$this->unitsByLocaleAndDomain[$translation->getLocale()][$translation->getDomain()][] = $translation;
}... | [
"public",
"function",
"setUnits",
"(",
"$",
"units",
")",
"{",
"$",
"this",
"->",
"unitsByLocaleAndDomain",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"units",
"as",
"$",
"unit",
")",
"{",
"foreach",
"(",
"$",
"unit",
"->",
"getTranslations",
"(... | Set the units you want to export.
@param Unit[] $units | [
"Set",
"the",
"units",
"you",
"want",
"to",
"export",
"."
] | 6e9896042d80c4e50f1e7ceacf434e772daaf149 | https://github.com/liip/LiipTranslationBundle/blob/6e9896042d80c4e50f1e7ceacf434e772daaf149/Export/ZipExporter.php#L32-L40 |
224,858 | liip/LiipTranslationBundle | Export/ZipExporter.php | ZipExporter.createZipContent | public function createZipContent()
{
$zipFile = $this->createZipFile();
$content = file_get_contents($zipFile);
unlink($zipFile);
return $content;
} | php | public function createZipContent()
{
$zipFile = $this->createZipFile();
$content = file_get_contents($zipFile);
unlink($zipFile);
return $content;
} | [
"public",
"function",
"createZipContent",
"(",
")",
"{",
"$",
"zipFile",
"=",
"$",
"this",
"->",
"createZipFile",
"(",
")",
";",
"$",
"content",
"=",
"file_get_contents",
"(",
"$",
"zipFile",
")",
";",
"unlink",
"(",
"$",
"zipFile",
")",
";",
"return",
... | Create the data of a zip file from the current units.
@return string The zip file content | [
"Create",
"the",
"data",
"of",
"a",
"zip",
"file",
"from",
"the",
"current",
"units",
"."
] | 6e9896042d80c4e50f1e7ceacf434e772daaf149 | https://github.com/liip/LiipTranslationBundle/blob/6e9896042d80c4e50f1e7ceacf434e772daaf149/Export/ZipExporter.php#L47-L54 |
224,859 | liip/LiipTranslationBundle | Export/ZipExporter.php | ZipExporter.createZipFile | public function createZipFile($path = null)
{
if ($path === null) {
$path = tempnam(sys_get_temp_dir(), 'temp-zip-');
}
$zip = new \ZipArchive();
$zip->open($path, \ZipArchive::CREATE);
$this->addYmlFiles($zip);
$zip->close();
return $path;
} | php | public function createZipFile($path = null)
{
if ($path === null) {
$path = tempnam(sys_get_temp_dir(), 'temp-zip-');
}
$zip = new \ZipArchive();
$zip->open($path, \ZipArchive::CREATE);
$this->addYmlFiles($zip);
$zip->close();
return $path;
} | [
"public",
"function",
"createZipFile",
"(",
"$",
"path",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"path",
"===",
"null",
")",
"{",
"$",
"path",
"=",
"tempnam",
"(",
"sys_get_temp_dir",
"(",
")",
",",
"'temp-zip-'",
")",
";",
"}",
"$",
"zip",
"=",
"ne... | Create a zip file from the current units.
@param string|null $path The pathname of the file o create. If not provided, file create a temporary file
@return string The zip file content | [
"Create",
"a",
"zip",
"file",
"from",
"the",
"current",
"units",
"."
] | 6e9896042d80c4e50f1e7ceacf434e772daaf149 | https://github.com/liip/LiipTranslationBundle/blob/6e9896042d80c4e50f1e7ceacf434e772daaf149/Export/ZipExporter.php#L63-L74 |
224,860 | liip/LiipTranslationBundle | Persistence/Propel/Model/Unit.php | Unit.convertToModel | public function convertToModel()
{
$unit = new \Liip\TranslationBundle\Model\Unit(
$this->getDomain(),
$this->getKey(),
$this->getMetadata()
);
foreach ($this->getTranslations() as $translation) {
$unit->setTranslation($translation->getLocale()... | php | public function convertToModel()
{
$unit = new \Liip\TranslationBundle\Model\Unit(
$this->getDomain(),
$this->getKey(),
$this->getMetadata()
);
foreach ($this->getTranslations() as $translation) {
$unit->setTranslation($translation->getLocale()... | [
"public",
"function",
"convertToModel",
"(",
")",
"{",
"$",
"unit",
"=",
"new",
"\\",
"Liip",
"\\",
"TranslationBundle",
"\\",
"Model",
"\\",
"Unit",
"(",
"$",
"this",
"->",
"getDomain",
"(",
")",
",",
"$",
"this",
"->",
"getKey",
"(",
")",
",",
"$",... | Create a ModelUnit representation of a this object.
@return ModelUnit | [
"Create",
"a",
"ModelUnit",
"representation",
"of",
"a",
"this",
"object",
"."
] | 6e9896042d80c4e50f1e7ceacf434e772daaf149 | https://github.com/liip/LiipTranslationBundle/blob/6e9896042d80c4e50f1e7ceacf434e772daaf149/Persistence/Propel/Model/Unit.php#L30-L42 |
224,861 | liip/LiipTranslationBundle | Persistence/Propel/Model/Unit.php | Unit.updateFromModel | public function updateFromModel(ModelUnit $unit)
{
$this->setDomain($unit->getDomain());
$this->setKey($unit->getKey());
$this->setMetadata($unit->getMetadata());
} | php | public function updateFromModel(ModelUnit $unit)
{
$this->setDomain($unit->getDomain());
$this->setKey($unit->getKey());
$this->setMetadata($unit->getMetadata());
} | [
"public",
"function",
"updateFromModel",
"(",
"ModelUnit",
"$",
"unit",
")",
"{",
"$",
"this",
"->",
"setDomain",
"(",
"$",
"unit",
"->",
"getDomain",
"(",
")",
")",
";",
"$",
"this",
"->",
"setKey",
"(",
"$",
"unit",
"->",
"getKey",
"(",
")",
")",
... | Update the current object from a ModelUnit.
@param ModelUnit $unit | [
"Update",
"the",
"current",
"object",
"from",
"a",
"ModelUnit",
"."
] | 6e9896042d80c4e50f1e7ceacf434e772daaf149 | https://github.com/liip/LiipTranslationBundle/blob/6e9896042d80c4e50f1e7ceacf434e772daaf149/Persistence/Propel/Model/Unit.php#L49-L54 |
224,862 | liip/LiipTranslationBundle | Persistence/Propel/Model/Unit.php | Unit.getOrCreateTranslationForLocale | public function getOrCreateTranslationForLocale($locale)
{
foreach ($this->getTranslations() as $propelTranslation) {
if ($propelTranslation->getLocale() == $locale) {
return $propelTranslation;
}
}
$propelTranslation = new PropelTranslation();
... | php | public function getOrCreateTranslationForLocale($locale)
{
foreach ($this->getTranslations() as $propelTranslation) {
if ($propelTranslation->getLocale() == $locale) {
return $propelTranslation;
}
}
$propelTranslation = new PropelTranslation();
... | [
"public",
"function",
"getOrCreateTranslationForLocale",
"(",
"$",
"locale",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getTranslations",
"(",
")",
"as",
"$",
"propelTranslation",
")",
"{",
"if",
"(",
"$",
"propelTranslation",
"->",
"getLocale",
"(",
")",
... | Get or create a Propel Tranlation object for the given locale.
@param string $locale
@return Translation | [
"Get",
"or",
"create",
"a",
"Propel",
"Tranlation",
"object",
"for",
"the",
"given",
"locale",
"."
] | 6e9896042d80c4e50f1e7ceacf434e772daaf149 | https://github.com/liip/LiipTranslationBundle/blob/6e9896042d80c4e50f1e7ceacf434e772daaf149/Persistence/Propel/Model/Unit.php#L63-L76 |
224,863 | RikudouSage/QrPaymentSK | src/QrPayment.php | QrPayment.getIBAN | public function getIBAN()
{
if (!is_null($this->iban)) {
return $this->iban;
}
$this->country = strtoupper($this->country);
$part1 = ord($this->country[0]) - ord('A') + 10;
$part2 = ord($this->country[1]) - ord('A') + 10;
$accountPrefix = 0;
$acc... | php | public function getIBAN()
{
if (!is_null($this->iban)) {
return $this->iban;
}
$this->country = strtoupper($this->country);
$part1 = ord($this->country[0]) - ord('A') + 10;
$part2 = ord($this->country[1]) - ord('A') + 10;
$accountPrefix = 0;
$acc... | [
"public",
"function",
"getIBAN",
"(",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"iban",
")",
")",
"{",
"return",
"$",
"this",
"->",
"iban",
";",
"}",
"$",
"this",
"->",
"country",
"=",
"strtoupper",
"(",
"$",
"this",
"->",
"cou... | Converts account and bank numbers to IBAN
@return string | [
"Converts",
"account",
"and",
"bank",
"numbers",
"to",
"IBAN"
] | 88b04b88f4110481f500f67f27f19a1d8df1778e | https://github.com/RikudouSage/QrPaymentSK/blob/88b04b88f4110481f500f67f27f19a1d8df1778e/src/QrPayment.php#L164-L193 |
224,864 | mrteye/GDAX | src/AppCurl.php | AppCurl.resetConnection | public function resetConnection() {
$this->reset();
// Get quicker feedback when the API is down. (sandbox or other)
$this->setOpt(CURLOPT_TIMEOUT_MS, $this->timeout);
$this->setHeader("Content-Type", "application/json");
} | php | public function resetConnection() {
$this->reset();
// Get quicker feedback when the API is down. (sandbox or other)
$this->setOpt(CURLOPT_TIMEOUT_MS, $this->timeout);
$this->setHeader("Content-Type", "application/json");
} | [
"public",
"function",
"resetConnection",
"(",
")",
"{",
"$",
"this",
"->",
"reset",
"(",
")",
";",
"// Get quicker feedback when the API is down. (sandbox or other)",
"$",
"this",
"->",
"setOpt",
"(",
"CURLOPT_TIMEOUT_MS",
",",
"$",
"this",
"->",
"timeout",
")",
"... | Reset the curl connection. | [
"Reset",
"the",
"curl",
"connection",
"."
] | 891e5e95abb4a0fc8d4e5b937d8f143701460824 | https://github.com/mrteye/GDAX/blob/891e5e95abb4a0fc8d4e5b937d8f143701460824/src/AppCurl.php#L20-L27 |
224,865 | jasny/error-handler | src/ErrorHandler.php | ErrorHandler.setError | public function setError($error)
{
if (isset($error) && !$error instanceof \Error && !$error instanceof \Exception) {
$type = (is_object($error) ? get_class($error) . ' ' : '') . gettype($error);
trigger_error("Excpeted an Error or Exception, got a $type", E_USER_WARNING);
... | php | public function setError($error)
{
if (isset($error) && !$error instanceof \Error && !$error instanceof \Exception) {
$type = (is_object($error) ? get_class($error) . ' ' : '') . gettype($error);
trigger_error("Excpeted an Error or Exception, got a $type", E_USER_WARNING);
... | [
"public",
"function",
"setError",
"(",
"$",
"error",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"error",
")",
"&&",
"!",
"$",
"error",
"instanceof",
"\\",
"Error",
"&&",
"!",
"$",
"error",
"instanceof",
"\\",
"Exception",
")",
"{",
"$",
"type",
"=",
"... | Set the caught error
@param \Throwable|\Exception|\Error | [
"Set",
"the",
"caught",
"error"
] | 38e076fc36d86689010081bc2eab96f12d97b0d8 | https://github.com/jasny/error-handler/blob/38e076fc36d86689010081bc2eab96f12d97b0d8/src/ErrorHandler.php#L38-L47 |
224,866 | jasny/error-handler | src/ErrorHandler.php | ErrorHandler.onFatalError | public function onFatalError($callback, $clearOutput = false)
{
if (!$clearOutput) {
$this->onFatalError = $callback;
} else {
$this->onFatalError = function ($error) use ($callback) {
$this->clearOutputBuffer();
$callback($error);
... | php | public function onFatalError($callback, $clearOutput = false)
{
if (!$clearOutput) {
$this->onFatalError = $callback;
} else {
$this->onFatalError = function ($error) use ($callback) {
$this->clearOutputBuffer();
$callback($error);
... | [
"public",
"function",
"onFatalError",
"(",
"$",
"callback",
",",
"$",
"clearOutput",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"clearOutput",
")",
"{",
"$",
"this",
"->",
"onFatalError",
"=",
"$",
"callback",
";",
"}",
"else",
"{",
"$",
"this",
"-... | Set a callback for when the script dies because of a fatal, non-catchable error.
The callback should have an `ErrorException` as only argument.
@param callable $callback
@param boolean $clearOutput Clear the output buffer before calling the callback | [
"Set",
"a",
"callback",
"for",
"when",
"the",
"script",
"dies",
"because",
"of",
"a",
"fatal",
"non",
"-",
"catchable",
"error",
".",
"The",
"callback",
"should",
"have",
"an",
"ErrorException",
"as",
"only",
"argument",
"."
] | 38e076fc36d86689010081bc2eab96f12d97b0d8 | https://github.com/jasny/error-handler/blob/38e076fc36d86689010081bc2eab96f12d97b0d8/src/ErrorHandler.php#L93-L103 |
224,867 | taniko/dijkstra | src/Graph.php | Graph.cost | public function cost(array $route) : float
{
$result = 0;
if (count($route) > 0) {
$num = count($route) -1;
for ($i = 0; $i < $num; $i++) {
if (!isset($this->nodes[$route[$i]][$route[$i+1]])) {
throw new \UnexpectedValueException("edge from... | php | public function cost(array $route) : float
{
$result = 0;
if (count($route) > 0) {
$num = count($route) -1;
for ($i = 0; $i < $num; $i++) {
if (!isset($this->nodes[$route[$i]][$route[$i+1]])) {
throw new \UnexpectedValueException("edge from... | [
"public",
"function",
"cost",
"(",
"array",
"$",
"route",
")",
":",
"float",
"{",
"$",
"result",
"=",
"0",
";",
"if",
"(",
"count",
"(",
"$",
"route",
")",
">",
"0",
")",
"{",
"$",
"num",
"=",
"count",
"(",
"$",
"route",
")",
"-",
"1",
";",
... | calculate cost of route
@param array $route
@return float | [
"calculate",
"cost",
"of",
"route"
] | 7b012cb499f0dd57d03a2e3ab36534ba78c52b7f | https://github.com/taniko/dijkstra/blob/7b012cb499f0dd57d03a2e3ab36534ba78c52b7f/src/Graph.php#L114-L127 |
224,868 | liip/LiipTranslationBundle | Persistence/Propel/Model/Translation.php | Translation.updateFromModel | public function updateFromModel(ModelTranslation $translation)
{
$this->setLocale($translation->getLocale());
$this->setValue($translation->getValue());
$this->setMetadata($translation->getMetadata());
} | php | public function updateFromModel(ModelTranslation $translation)
{
$this->setLocale($translation->getLocale());
$this->setValue($translation->getValue());
$this->setMetadata($translation->getMetadata());
} | [
"public",
"function",
"updateFromModel",
"(",
"ModelTranslation",
"$",
"translation",
")",
"{",
"$",
"this",
"->",
"setLocale",
"(",
"$",
"translation",
"->",
"getLocale",
"(",
")",
")",
";",
"$",
"this",
"->",
"setValue",
"(",
"$",
"translation",
"->",
"g... | Update this object from a ModelTranslation.
@param ModelTranslation $translation | [
"Update",
"this",
"object",
"from",
"a",
"ModelTranslation",
"."
] | 6e9896042d80c4e50f1e7ceacf434e772daaf149 | https://github.com/liip/LiipTranslationBundle/blob/6e9896042d80c4e50f1e7ceacf434e772daaf149/Persistence/Propel/Model/Translation.php#L29-L34 |
224,869 | umulmrum/holiday | src/Model/HolidayList.php | HolidayList.add | public function add(Holiday $holiday)
{
if (-1 !== $index = $this->getIndexByNameAndDate($holiday->getName(), $holiday->getDate())) {
$this->holidayList[$index] = new Holiday($holiday->getName(), $holiday->getDate(), $holiday->getType() | $this->holidayList[$index]->getType());
} else {
... | php | public function add(Holiday $holiday)
{
if (-1 !== $index = $this->getIndexByNameAndDate($holiday->getName(), $holiday->getDate())) {
$this->holidayList[$index] = new Holiday($holiday->getName(), $holiday->getDate(), $holiday->getType() | $this->holidayList[$index]->getType());
} else {
... | [
"public",
"function",
"add",
"(",
"Holiday",
"$",
"holiday",
")",
"{",
"if",
"(",
"-",
"1",
"!==",
"$",
"index",
"=",
"$",
"this",
"->",
"getIndexByNameAndDate",
"(",
"$",
"holiday",
"->",
"getName",
"(",
")",
",",
"$",
"holiday",
"->",
"getDate",
"(... | Adds a holiday to the list. If there already is a holiday with the same name and date, then the holiday will
not be added a second time, but its types will be added to the existing one.
@param Holiday $holiday | [
"Adds",
"a",
"holiday",
"to",
"the",
"list",
".",
"If",
"there",
"already",
"is",
"a",
"holiday",
"with",
"the",
"same",
"name",
"and",
"date",
"then",
"the",
"holiday",
"will",
"not",
"be",
"added",
"a",
"second",
"time",
"but",
"its",
"types",
"will"... | 19bd2f0259c0e01d4b984876b014d636c53a2be3 | https://github.com/umulmrum/holiday/blob/19bd2f0259c0e01d4b984876b014d636c53a2be3/src/Model/HolidayList.php#L40-L47 |
224,870 | itbdw/laravel-storage-qiniu | src/QiniuAdapter.php | QiniuAdapter.fetch | public function fetch($url, $key)
{
$bucketMgr = $this->getBucketManager();
list($ret, $err) = $bucketMgr->fetch($url, $this->bucket, $key);
if ($err !== null) {
$this->logQiniuError($err);
return false;
} else {
return $ret['key'];
}
} | php | public function fetch($url, $key)
{
$bucketMgr = $this->getBucketManager();
list($ret, $err) = $bucketMgr->fetch($url, $this->bucket, $key);
if ($err !== null) {
$this->logQiniuError($err);
return false;
} else {
return $ret['key'];
}
} | [
"public",
"function",
"fetch",
"(",
"$",
"url",
",",
"$",
"key",
")",
"{",
"$",
"bucketMgr",
"=",
"$",
"this",
"->",
"getBucketManager",
"(",
")",
";",
"list",
"(",
"$",
"ret",
",",
"$",
"err",
")",
"=",
"$",
"bucketMgr",
"->",
"fetch",
"(",
"$",... | Fetch a file from url.
@param string $url The specified url.
@param string $key The target filename.
@return string|false | [
"Fetch",
"a",
"file",
"from",
"url",
"."
] | 9c0b49b1423532fd095ca4886109ec641bf5b3c6 | https://github.com/itbdw/laravel-storage-qiniu/blob/9c0b49b1423532fd095ca4886109ec641bf5b3c6/src/QiniuAdapter.php#L212-L222 |
224,871 | notamedia/yii2-relation | RelationBehavior.php | RelationBehavior.getRelationData | public function getRelationData($attribute)
{
return isset($this->relationalData[$attribute]) ? $this->relationalData[$attribute]['data'] : null;
} | php | public function getRelationData($attribute)
{
return isset($this->relationalData[$attribute]) ? $this->relationalData[$attribute]['data'] : null;
} | [
"public",
"function",
"getRelationData",
"(",
"$",
"attribute",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"relationalData",
"[",
"$",
"attribute",
"]",
")",
"?",
"$",
"this",
"->",
"relationalData",
"[",
"$",
"attribute",
"]",
"[",
"'data'",
"... | Return relation data of attribute
@param $attribute string
@return mixed|null | [
"Return",
"relation",
"data",
"of",
"attribute"
] | ed8050df0b63df5e76cbb088ab03de5c7ab61b7b | https://github.com/notamedia/yii2-relation/blob/ed8050df0b63df5e76cbb088ab03de5c7ab61b7b/RelationBehavior.php#L128-L131 |
224,872 | notamedia/yii2-relation | RelationBehavior.php | RelationBehavior.canSetProperty | public function canSetProperty($name, $checkVars = true)
{
return array_key_exists($name, $this->relationalFields) || parent::canSetProperty($name, $checkVars);
} | php | public function canSetProperty($name, $checkVars = true)
{
return array_key_exists($name, $this->relationalFields) || parent::canSetProperty($name, $checkVars);
} | [
"public",
"function",
"canSetProperty",
"(",
"$",
"name",
",",
"$",
"checkVars",
"=",
"true",
")",
"{",
"return",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"relationalFields",
")",
"||",
"parent",
"::",
"canSetProperty",
"(",
"$",
"name... | Permission for this behavior to set relational attributes.
{@inheritdoc} | [
"Permission",
"for",
"this",
"behavior",
"to",
"set",
"relational",
"attributes",
"."
] | ed8050df0b63df5e76cbb088ab03de5c7ab61b7b | https://github.com/notamedia/yii2-relation/blob/ed8050df0b63df5e76cbb088ab03de5c7ab61b7b/RelationBehavior.php#L156-L159 |
224,873 | notamedia/yii2-relation | RelationBehavior.php | RelationBehavior.loadData | protected function loadData()
{
/** @var ActiveQuery $activeQuery */
foreach ($this->relationalData as $attribute => &$data) {
$getter = 'get' . ucfirst($attribute);
$data['activeQuery'] = $activeQuery = $this->owner->$getter();
$data['newModels'] = [];
... | php | protected function loadData()
{
/** @var ActiveQuery $activeQuery */
foreach ($this->relationalData as $attribute => &$data) {
$getter = 'get' . ucfirst($attribute);
$data['activeQuery'] = $activeQuery = $this->owner->$getter();
$data['newModels'] = [];
... | [
"protected",
"function",
"loadData",
"(",
")",
"{",
"/** @var ActiveQuery $activeQuery */",
"foreach",
"(",
"$",
"this",
"->",
"relationalData",
"as",
"$",
"attribute",
"=>",
"&",
"$",
"data",
")",
"{",
"$",
"getter",
"=",
"'get'",
".",
"ucfirst",
"(",
"$",
... | Load relational data from owner-model getter.
- Create related ActiveRecord objects from POST array data.
- Load existing related ActiveRecord objects from database.
- Check ON condition format.
- Get ActiveQuery object from attribute getter method.
Fill $this->relationalData array for each relational attribute:
```... | [
"Load",
"relational",
"data",
"from",
"owner",
"-",
"model",
"getter",
"."
] | ed8050df0b63df5e76cbb088ab03de5c7ab61b7b | https://github.com/notamedia/yii2-relation/blob/ed8050df0b63df5e76cbb088ab03de5c7ab61b7b/RelationBehavior.php#L206-L248 |
224,874 | notamedia/yii2-relation | RelationBehavior.php | RelationBehavior.validateData | protected function validateData()
{
foreach ($this->relationalData as $attribute => &$data) {
/** @var ActiveRecord $model */
/** @var ActiveQuery $activeQuery */
$activeQuery = $data['activeQuery'];
foreach ($data['newModels'] as &$model) {
if... | php | protected function validateData()
{
foreach ($this->relationalData as $attribute => &$data) {
/** @var ActiveRecord $model */
/** @var ActiveQuery $activeQuery */
$activeQuery = $data['activeQuery'];
foreach ($data['newModels'] as &$model) {
if... | [
"protected",
"function",
"validateData",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"relationalData",
"as",
"$",
"attribute",
"=>",
"&",
"$",
"data",
")",
"{",
"/** @var ActiveRecord $model */",
"/** @var ActiveQuery $activeQuery */",
"$",
"activeQuery",
"=",... | Validate relational models, return true only if all models successfully validated. Skip errors for foreign
columns.
@return bool | [
"Validate",
"relational",
"models",
"return",
"true",
"only",
"if",
"all",
"models",
"successfully",
"validated",
".",
"Skip",
"errors",
"for",
"foreign",
"columns",
"."
] | ed8050df0b63df5e76cbb088ab03de5c7ab61b7b | https://github.com/notamedia/yii2-relation/blob/ed8050df0b63df5e76cbb088ab03de5c7ab61b7b/RelationBehavior.php#L256-L283 |
224,875 | notamedia/yii2-relation | RelationBehavior.php | RelationBehavior.saveData | public function saveData()
{
$needSaveOwner = false;
foreach ($this->relationalData as $attribute => $data) {
// delete models
$this->deleteModels($attribute);
// save models
$this->saveModels($attribute);
if (!$data['activeQuery']->multi... | php | public function saveData()
{
$needSaveOwner = false;
foreach ($this->relationalData as $attribute => $data) {
// delete models
$this->deleteModels($attribute);
// save models
$this->saveModels($attribute);
if (!$data['activeQuery']->multi... | [
"public",
"function",
"saveData",
"(",
")",
"{",
"$",
"needSaveOwner",
"=",
"false",
";",
"foreach",
"(",
"$",
"this",
"->",
"relationalData",
"as",
"$",
"attribute",
"=>",
"$",
"data",
")",
"{",
"// delete models",
"$",
"this",
"->",
"deleteModels",
"(",
... | Save changed related models.
- Delete old related models, which not exist in POST array.
- Create new related models, which not exist in database.
- Update owner models for one-to-one relation. | [
"Save",
"changed",
"related",
"models",
"."
] | ed8050df0b63df5e76cbb088ab03de5c7ab61b7b | https://github.com/notamedia/yii2-relation/blob/ed8050df0b63df5e76cbb088ab03de5c7ab61b7b/RelationBehavior.php#L292-L320 |
224,876 | notamedia/yii2-relation | RelationBehavior.php | RelationBehavior.relationsMap | protected function relationsMap($relations, $callback)
{
try {
if (is_callable($callback)) {
array_map($callback, $relations);
}
} catch (\Exception $e) {
Yii::$app->getDb()->getTransaction()->rollBack();
throw new RelationException('Ow... | php | protected function relationsMap($relations, $callback)
{
try {
if (is_callable($callback)) {
array_map($callback, $relations);
}
} catch (\Exception $e) {
Yii::$app->getDb()->getTransaction()->rollBack();
throw new RelationException('Ow... | [
"protected",
"function",
"relationsMap",
"(",
"$",
"relations",
",",
"$",
"callback",
")",
"{",
"try",
"{",
"if",
"(",
"is_callable",
"(",
"$",
"callback",
")",
")",
"{",
"array_map",
"(",
"$",
"callback",
",",
"$",
"relations",
")",
";",
"}",
"}",
"... | Execute callback for each relation
- if error occurred throws exception
@param array $relations
@param callable $callback
@throws RelationException | [
"Execute",
"callback",
"for",
"each",
"relation"
] | ed8050df0b63df5e76cbb088ab03de5c7ab61b7b | https://github.com/notamedia/yii2-relation/blob/ed8050df0b63df5e76cbb088ab03de5c7ab61b7b/RelationBehavior.php#L331-L341 |
224,877 | notamedia/yii2-relation | RelationBehavior.php | RelationBehavior.replaceExistingModel | protected function replaceExistingModel($model, $attribute)
{
$modelAttributes = $model->attributes;
unset($modelAttributes[$model->primaryKey()[0]]);
foreach ($this->relationalData[$attribute]['oldModels'] as $oldModel) {
/** @var ActiveRecord $oldModel */
$oldModel... | php | protected function replaceExistingModel($model, $attribute)
{
$modelAttributes = $model->attributes;
unset($modelAttributes[$model->primaryKey()[0]]);
foreach ($this->relationalData[$attribute]['oldModels'] as $oldModel) {
/** @var ActiveRecord $oldModel */
$oldModel... | [
"protected",
"function",
"replaceExistingModel",
"(",
"$",
"model",
",",
"$",
"attribute",
")",
"{",
"$",
"modelAttributes",
"=",
"$",
"model",
"->",
"attributes",
";",
"unset",
"(",
"$",
"modelAttributes",
"[",
"$",
"model",
"->",
"primaryKey",
"(",
")",
... | Return existing model if it found in old models
@param ActiveRecord $model
@param $attribute
@return ActiveRecord | [
"Return",
"existing",
"model",
"if",
"it",
"found",
"in",
"old",
"models"
] | ed8050df0b63df5e76cbb088ab03de5c7ab61b7b | https://github.com/notamedia/yii2-relation/blob/ed8050df0b63df5e76cbb088ab03de5c7ab61b7b/RelationBehavior.php#L351-L367 |
224,878 | notamedia/yii2-relation | RelationBehavior.php | RelationBehavior.isExistingRow | protected function isExistingRow($row, $attribute)
{
$rowAttributes = $row;
unset($rowAttributes[$this->relationalData[$attribute]['junctionColumn']]);
foreach ($this->relationalData[$attribute]['oldRows'] as $oldRow) {
$oldModelAttributes = $oldRow;
unset($oldModelA... | php | protected function isExistingRow($row, $attribute)
{
$rowAttributes = $row;
unset($rowAttributes[$this->relationalData[$attribute]['junctionColumn']]);
foreach ($this->relationalData[$attribute]['oldRows'] as $oldRow) {
$oldModelAttributes = $oldRow;
unset($oldModelA... | [
"protected",
"function",
"isExistingRow",
"(",
"$",
"row",
",",
"$",
"attribute",
")",
"{",
"$",
"rowAttributes",
"=",
"$",
"row",
";",
"unset",
"(",
"$",
"rowAttributes",
"[",
"$",
"this",
"->",
"relationalData",
"[",
"$",
"attribute",
"]",
"[",
"'junct... | Check existing row if it found in old rows
@param $row
@param $attribute
@return mixed | [
"Check",
"existing",
"row",
"if",
"it",
"found",
"in",
"old",
"rows"
] | ed8050df0b63df5e76cbb088ab03de5c7ab61b7b | https://github.com/notamedia/yii2-relation/blob/ed8050df0b63df5e76cbb088ab03de5c7ab61b7b/RelationBehavior.php#L376-L390 |
224,879 | notamedia/yii2-relation | RelationBehavior.php | RelationBehavior.afterDelete | public function afterDelete()
{
foreach ($this->relationalFields as $attribute => $value) {
$getter = 'get' . ucfirst($attribute);
/** @var ActiveQuery $activeQuery */
$activeQuery = $this->owner->$getter();
$models = [];
if (empty($activeQuery->v... | php | public function afterDelete()
{
foreach ($this->relationalFields as $attribute => $value) {
$getter = 'get' . ucfirst($attribute);
/** @var ActiveQuery $activeQuery */
$activeQuery = $this->owner->$getter();
$models = [];
if (empty($activeQuery->v... | [
"public",
"function",
"afterDelete",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"relationalFields",
"as",
"$",
"attribute",
"=>",
"$",
"value",
")",
"{",
"$",
"getter",
"=",
"'get'",
".",
"ucfirst",
"(",
"$",
"attribute",
")",
";",
"/** @var Activ... | Delete related models. Rollback transaction and throw RelationException, if error occurred while deleting. | [
"Delete",
"related",
"models",
".",
"Rollback",
"transaction",
"and",
"throw",
"RelationException",
"if",
"error",
"occurred",
"while",
"deleting",
"."
] | ed8050df0b63df5e76cbb088ab03de5c7ab61b7b | https://github.com/notamedia/yii2-relation/blob/ed8050df0b63df5e76cbb088ab03de5c7ab61b7b/RelationBehavior.php#L444-L490 |
224,880 | notamedia/yii2-relation | RelationBehavior.php | RelationBehavior.validateOnCondition | protected function validateOnCondition($activeQuery)
{
if (
!ArrayHelper::isAssociative($activeQuery->on) &&
!empty($activeQuery->on)
) {
return false;
}
if (
$activeQuery->multiple &&
!empty($activeQuery->via) &&
... | php | protected function validateOnCondition($activeQuery)
{
if (
!ArrayHelper::isAssociative($activeQuery->on) &&
!empty($activeQuery->on)
) {
return false;
}
if (
$activeQuery->multiple &&
!empty($activeQuery->via) &&
... | [
"protected",
"function",
"validateOnCondition",
"(",
"$",
"activeQuery",
")",
"{",
"if",
"(",
"!",
"ArrayHelper",
"::",
"isAssociative",
"(",
"$",
"activeQuery",
"->",
"on",
")",
"&&",
"!",
"empty",
"(",
"$",
"activeQuery",
"->",
"on",
")",
")",
"{",
"re... | Validate ON condition in ActiveQuery
@param ActiveQuery $activeQuery
@return bool | [
"Validate",
"ON",
"condition",
"in",
"ActiveQuery"
] | ed8050df0b63df5e76cbb088ab03de5c7ab61b7b | https://github.com/notamedia/yii2-relation/blob/ed8050df0b63df5e76cbb088ab03de5c7ab61b7b/RelationBehavior.php#L498-L519 |
224,881 | notamedia/yii2-relation | RelationBehavior.php | RelationBehavior.loadModelsOneToOne | protected function loadModelsOneToOne($attribute)
{
$data = $this->relationalData[$attribute];
$activeQuery = $data['activeQuery'];
$class = $activeQuery->modelClass;
$model = new $class($data['data']);
if (isset($this->relations[$attribute]) && is_callable($this->relations... | php | protected function loadModelsOneToOne($attribute)
{
$data = $this->relationalData[$attribute];
$activeQuery = $data['activeQuery'];
$class = $activeQuery->modelClass;
$model = new $class($data['data']);
if (isset($this->relations[$attribute]) && is_callable($this->relations... | [
"protected",
"function",
"loadModelsOneToOne",
"(",
"$",
"attribute",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"relationalData",
"[",
"$",
"attribute",
"]",
";",
"$",
"activeQuery",
"=",
"$",
"data",
"[",
"'activeQuery'",
"]",
";",
"$",
"class",
"=... | Load new model from POST for one-to-one relation
@param $attribute | [
"Load",
"new",
"model",
"from",
"POST",
"for",
"one",
"-",
"to",
"-",
"one",
"relation"
] | ed8050df0b63df5e76cbb088ab03de5c7ab61b7b | https://github.com/notamedia/yii2-relation/blob/ed8050df0b63df5e76cbb088ab03de5c7ab61b7b/RelationBehavior.php#L526-L540 |
224,882 | notamedia/yii2-relation | RelationBehavior.php | RelationBehavior.loadModelsOneToMany | protected function loadModelsOneToMany($attribute)
{
$data = $this->relationalData[$attribute];
$activeQuery = $data['activeQuery'];
$class = $activeQuery->modelClass;
// default query conditions
$params = !ArrayHelper::isAssociative($activeQuery->on) ? [] : $active... | php | protected function loadModelsOneToMany($attribute)
{
$data = $this->relationalData[$attribute];
$activeQuery = $data['activeQuery'];
$class = $activeQuery->modelClass;
// default query conditions
$params = !ArrayHelper::isAssociative($activeQuery->on) ? [] : $active... | [
"protected",
"function",
"loadModelsOneToMany",
"(",
"$",
"attribute",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"relationalData",
"[",
"$",
"attribute",
"]",
";",
"$",
"activeQuery",
"=",
"$",
"data",
"[",
"'activeQuery'",
"]",
";",
"$",
"class",
"... | Load new models from POST for one-to-many relation
@param $attribute | [
"Load",
"new",
"models",
"from",
"POST",
"for",
"one",
"-",
"to",
"-",
"many",
"relation"
] | ed8050df0b63df5e76cbb088ab03de5c7ab61b7b | https://github.com/notamedia/yii2-relation/blob/ed8050df0b63df5e76cbb088ab03de5c7ab61b7b/RelationBehavior.php#L547-L577 |
224,883 | notamedia/yii2-relation | RelationBehavior.php | RelationBehavior.loadModelsManyToManyViaTable | protected function loadModelsManyToManyViaTable($attribute)
{
$data = $this->relationalData[$attribute];
$activeQuery = $data['activeQuery'];
/** @var ActiveRecord $class */
$class = $activeQuery->modelClass;
$via = $activeQuery->via;
$data['junctionTable'] = $via->... | php | protected function loadModelsManyToManyViaTable($attribute)
{
$data = $this->relationalData[$attribute];
$activeQuery = $data['activeQuery'];
/** @var ActiveRecord $class */
$class = $activeQuery->modelClass;
$via = $activeQuery->via;
$data['junctionTable'] = $via->... | [
"protected",
"function",
"loadModelsManyToManyViaTable",
"(",
"$",
"attribute",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"relationalData",
"[",
"$",
"attribute",
"]",
";",
"$",
"activeQuery",
"=",
"$",
"data",
"[",
"'activeQuery'",
"]",
";",
"/** @var ... | Load new models from POST for many-to-many relation with viaTable
@param $attribute
@throws RelationException | [
"Load",
"new",
"models",
"from",
"POST",
"for",
"many",
"-",
"to",
"-",
"many",
"relation",
"with",
"viaTable"
] | ed8050df0b63df5e76cbb088ab03de5c7ab61b7b | https://github.com/notamedia/yii2-relation/blob/ed8050df0b63df5e76cbb088ab03de5c7ab61b7b/RelationBehavior.php#L585-L634 |
224,884 | notamedia/yii2-relation | RelationBehavior.php | RelationBehavior.loadModelsManyToManyVia | protected function loadModelsManyToManyVia($attribute)
{
$data = $this->relationalData[$attribute];
$activeQuery = $data['activeQuery'];
/** @var ActiveRecord $class */
$class = $activeQuery->modelClass;
if (!is_object($activeQuery->via[1])) {
throw new Relation... | php | protected function loadModelsManyToManyVia($attribute)
{
$data = $this->relationalData[$attribute];
$activeQuery = $data['activeQuery'];
/** @var ActiveRecord $class */
$class = $activeQuery->modelClass;
if (!is_object($activeQuery->via[1])) {
throw new Relation... | [
"protected",
"function",
"loadModelsManyToManyVia",
"(",
"$",
"attribute",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"relationalData",
"[",
"$",
"attribute",
"]",
";",
"$",
"activeQuery",
"=",
"$",
"data",
"[",
"'activeQuery'",
"]",
";",
"/** @var Activ... | Load new models from POST for many-to-many relation with via
@param $attribute
@throws RelationException | [
"Load",
"new",
"models",
"from",
"POST",
"for",
"many",
"-",
"to",
"-",
"many",
"relation",
"with",
"via"
] | ed8050df0b63df5e76cbb088ab03de5c7ab61b7b | https://github.com/notamedia/yii2-relation/blob/ed8050df0b63df5e76cbb088ab03de5c7ab61b7b/RelationBehavior.php#L642-L690 |
224,885 | notamedia/yii2-relation | RelationBehavior.php | RelationBehavior.saveModels | protected function saveModels($attribute)
{
$data = $this->relationalData[$attribute];
/** @var ActiveRecord $model */
foreach ($data['newModels'] as $model) {
if ($model->isNewRecord) {
if (!empty($data['activeQuery']->via)) {
// only for man... | php | protected function saveModels($attribute)
{
$data = $this->relationalData[$attribute];
/** @var ActiveRecord $model */
foreach ($data['newModels'] as $model) {
if ($model->isNewRecord) {
if (!empty($data['activeQuery']->via)) {
// only for man... | [
"protected",
"function",
"saveModels",
"(",
"$",
"attribute",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"relationalData",
"[",
"$",
"attribute",
"]",
";",
"/** @var ActiveRecord $model */",
"foreach",
"(",
"$",
"data",
"[",
"'newModels'",
"]",
"as",
"$"... | Save all new models for attribute
@param $attribute
@throws RelationException | [
"Save",
"all",
"new",
"models",
"for",
"attribute"
] | ed8050df0b63df5e76cbb088ab03de5c7ab61b7b | https://github.com/notamedia/yii2-relation/blob/ed8050df0b63df5e76cbb088ab03de5c7ab61b7b/RelationBehavior.php#L698-L732 |
224,886 | notamedia/yii2-relation | RelationBehavior.php | RelationBehavior.deleteModels | protected function deleteModels($attribute)
{
$data = $this->relationalData[$attribute];
/** @var ActiveRecord $model */
foreach ($data['oldModels'] as $model) {
if ($this->isDeletedModel($model, $attribute)) {
if (!$model->delete()) {
Yii::$a... | php | protected function deleteModels($attribute)
{
$data = $this->relationalData[$attribute];
/** @var ActiveRecord $model */
foreach ($data['oldModels'] as $model) {
if ($this->isDeletedModel($model, $attribute)) {
if (!$model->delete()) {
Yii::$a... | [
"protected",
"function",
"deleteModels",
"(",
"$",
"attribute",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"relationalData",
"[",
"$",
"attribute",
"]",
";",
"/** @var ActiveRecord $model */",
"foreach",
"(",
"$",
"data",
"[",
"'oldModels'",
"]",
"as",
"... | Delete all old models for attribute if it needed
@param $attribute
@throws RelationException | [
"Delete",
"all",
"old",
"models",
"for",
"attribute",
"if",
"it",
"needed"
] | ed8050df0b63df5e76cbb088ab03de5c7ab61b7b | https://github.com/notamedia/yii2-relation/blob/ed8050df0b63df5e76cbb088ab03de5c7ab61b7b/RelationBehavior.php#L740-L761 |
224,887 | liip/LiipTranslationBundle | Controller/ImportController.php | ImportController.indexAction | public function indexAction()
{
return $this->render('LiipTranslationBundle:Import:index.html.twig', array(
'upload_form' => $this->createForm(new FileImportType())->createView(),
'translations' => $this->getSessionImporter()->getCurrentTranslations(),
));
} | php | public function indexAction()
{
return $this->render('LiipTranslationBundle:Import:index.html.twig', array(
'upload_form' => $this->createForm(new FileImportType())->createView(),
'translations' => $this->getSessionImporter()->getCurrentTranslations(),
));
} | [
"public",
"function",
"indexAction",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"render",
"(",
"'LiipTranslationBundle:Import:index.html.twig'",
",",
"array",
"(",
"'upload_form'",
"=>",
"$",
"this",
"->",
"createForm",
"(",
"new",
"FileImportType",
"(",
")",
"... | Importating dashboard.
@return Response | [
"Importating",
"dashboard",
"."
] | 6e9896042d80c4e50f1e7ceacf434e772daaf149 | https://github.com/liip/LiipTranslationBundle/blob/6e9896042d80c4e50f1e7ceacf434e772daaf149/Controller/ImportController.php#L33-L39 |
224,888 | liip/LiipTranslationBundle | Controller/ImportController.php | ImportController.uploadAction | public function uploadAction(Request $request)
{
$form = $this->createForm(new FileImportType());
$data = $form->handleRequest($request)->getData();
$session = $this->getSession();
try {
$counters = $this->getSessionImporter()->handleUploadedFile($data['file']);
... | php | public function uploadAction(Request $request)
{
$form = $this->createForm(new FileImportType());
$data = $form->handleRequest($request)->getData();
$session = $this->getSession();
try {
$counters = $this->getSessionImporter()->handleUploadedFile($data['file']);
... | [
"public",
"function",
"uploadAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"createForm",
"(",
"new",
"FileImportType",
"(",
")",
")",
";",
"$",
"data",
"=",
"$",
"form",
"->",
"handleRequest",
"(",
"$",
"reques... | File upload handling, redirect to the dashboard.
@param Request $request the request
@return \Symfony\Component\HttpFoundation\RedirectResponse | [
"File",
"upload",
"handling",
"redirect",
"to",
"the",
"dashboard",
"."
] | 6e9896042d80c4e50f1e7ceacf434e772daaf149 | https://github.com/liip/LiipTranslationBundle/blob/6e9896042d80c4e50f1e7ceacf434e772daaf149/Controller/ImportController.php#L60-L78 |
224,889 | liip/LiipTranslationBundle | Controller/ImportController.php | ImportController.removeEntryAction | public function removeEntryAction($locale, $domain, $key)
{
$this->securityCheck($domain, $locale);
$this->getSessionImporter()->remove($domain, $key, $locale);
$session = $this->getSession();
$session->getFlashBag()->set('success', 'Entry removed');
return $this->redirect(... | php | public function removeEntryAction($locale, $domain, $key)
{
$this->securityCheck($domain, $locale);
$this->getSessionImporter()->remove($domain, $key, $locale);
$session = $this->getSession();
$session->getFlashBag()->set('success', 'Entry removed');
return $this->redirect(... | [
"public",
"function",
"removeEntryAction",
"(",
"$",
"locale",
",",
"$",
"domain",
",",
"$",
"key",
")",
"{",
"$",
"this",
"->",
"securityCheck",
"(",
"$",
"domain",
",",
"$",
"locale",
")",
";",
"$",
"this",
"->",
"getSessionImporter",
"(",
")",
"->",... | Remove an entry from the session.
@param string $locale
@param string $domain
@param string $key
@return \Symfony\Component\HttpFoundation\RedirectResponse | [
"Remove",
"an",
"entry",
"from",
"the",
"session",
"."
] | 6e9896042d80c4e50f1e7ceacf434e772daaf149 | https://github.com/liip/LiipTranslationBundle/blob/6e9896042d80c4e50f1e7ceacf434e772daaf149/Controller/ImportController.php#L89-L98 |
224,890 | liip/LiipTranslationBundle | Controller/ImportController.php | ImportController.processAction | public function processAction($locale)
{
$stats = $this->getSessionImporter()->comfirmImportation($locale);
$session = $this->getSession();
$session->getFlashBag()->set('success', "Import success ({$stats['translations']['text']})");
return $this->redirect($this->generateUrl('liip_t... | php | public function processAction($locale)
{
$stats = $this->getSessionImporter()->comfirmImportation($locale);
$session = $this->getSession();
$session->getFlashBag()->set('success', "Import success ({$stats['translations']['text']})");
return $this->redirect($this->generateUrl('liip_t... | [
"public",
"function",
"processAction",
"(",
"$",
"locale",
")",
"{",
"$",
"stats",
"=",
"$",
"this",
"->",
"getSessionImporter",
"(",
")",
"->",
"comfirmImportation",
"(",
"$",
"locale",
")",
";",
"$",
"session",
"=",
"$",
"this",
"->",
"getSession",
"("... | Process the importation for the given locale, and redirect to the dashboard.
@param string $locale
@return \Symfony\Component\HttpFoundation\RedirectResponse | [
"Process",
"the",
"importation",
"for",
"the",
"given",
"locale",
"and",
"redirect",
"to",
"the",
"dashboard",
"."
] | 6e9896042d80c4e50f1e7ceacf434e772daaf149 | https://github.com/liip/LiipTranslationBundle/blob/6e9896042d80c4e50f1e7ceacf434e772daaf149/Controller/ImportController.php#L107-L114 |
224,891 | kzykhys/PHPCsvParser | src/KzykHys/CsvParser/CsvParser.php | CsvParser.fromFile | public static function fromFile($file, array $option = array())
{
if (!file_exists($file)) {
throw new \InvalidArgumentException('File not found: ' . $file);
}
return new self(new FileIterator($file), $option);
} | php | public static function fromFile($file, array $option = array())
{
if (!file_exists($file)) {
throw new \InvalidArgumentException('File not found: ' . $file);
}
return new self(new FileIterator($file), $option);
} | [
"public",
"static",
"function",
"fromFile",
"(",
"$",
"file",
",",
"array",
"$",
"option",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"file",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'File n... | Returns new instance from CSV file
@param string $file The CSV string to parse
@param array $option Options
@throws \InvalidArgumentException
@return CsvParser | [
"Returns",
"new",
"instance",
"from",
"CSV",
"file"
] | a7d20bbfe1ec6402d736975571d8f4dcece6b489 | https://github.com/kzykhys/PHPCsvParser/blob/a7d20bbfe1ec6402d736975571d8f4dcece6b489/src/KzykHys/CsvParser/CsvParser.php#L31-L38 |
224,892 | kzykhys/PHPCsvParser | src/KzykHys/CsvParser/CsvParser.php | CsvParser.fromString | public static function fromString($csv, array $option = array())
{
$lines = array();
if ($csv !== '') {
if (!preg_match('/(\r|\n|\r\n)\Z/m', $csv)) {
$csv .= "\n";
}
preg_match_all('/[^\r\n]*(?:\r|\n|\r\n)+/m', $csv, $matches);
$line... | php | public static function fromString($csv, array $option = array())
{
$lines = array();
if ($csv !== '') {
if (!preg_match('/(\r|\n|\r\n)\Z/m', $csv)) {
$csv .= "\n";
}
preg_match_all('/[^\r\n]*(?:\r|\n|\r\n)+/m', $csv, $matches);
$line... | [
"public",
"static",
"function",
"fromString",
"(",
"$",
"csv",
",",
"array",
"$",
"option",
"=",
"array",
"(",
")",
")",
"{",
"$",
"lines",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"csv",
"!==",
"''",
")",
"{",
"if",
"(",
"!",
"preg_match",
... | Returns new instance from string
@param string $csv The CSV string to parse
@param array $option Options
@return CsvParser | [
"Returns",
"new",
"instance",
"from",
"string"
] | a7d20bbfe1ec6402d736975571d8f4dcece6b489 | https://github.com/kzykhys/PHPCsvParser/blob/a7d20bbfe1ec6402d736975571d8f4dcece6b489/src/KzykHys/CsvParser/CsvParser.php#L48-L63 |
224,893 | valga/fbns-react | src/Json.php | Json.decode | public static function decode($json)
{
$flags = 0;
if (PHP_INT_SIZE === 4) {
$flags |= JSON_BIGINT_AS_STRING;
}
$data = json_decode($json, false, 512, $flags);
$error = json_last_error();
if ($error !== JSON_ERROR_NONE) {
throw new \InvalidArgu... | php | public static function decode($json)
{
$flags = 0;
if (PHP_INT_SIZE === 4) {
$flags |= JSON_BIGINT_AS_STRING;
}
$data = json_decode($json, false, 512, $flags);
$error = json_last_error();
if ($error !== JSON_ERROR_NONE) {
throw new \InvalidArgu... | [
"public",
"static",
"function",
"decode",
"(",
"$",
"json",
")",
"{",
"$",
"flags",
"=",
"0",
";",
"if",
"(",
"PHP_INT_SIZE",
"===",
"4",
")",
"{",
"$",
"flags",
"|=",
"JSON_BIGINT_AS_STRING",
";",
"}",
"$",
"data",
"=",
"json_decode",
"(",
"$",
"jso... | Special decoder to keep big numbers on x86 PHP builds.
@param string $json
@return mixed | [
"Special",
"decoder",
"to",
"keep",
"big",
"numbers",
"on",
"x86",
"PHP",
"builds",
"."
] | 4bbf513a8ffed7e0c9ca10776033d34515bb8b37 | https://github.com/valga/fbns-react/blob/4bbf513a8ffed7e0c9ca10776033d34515bb8b37/src/Json.php#L14-L27 |
224,894 | moeen-basra/laravel-passport-mongodb | src/Guards/TokenGuard.php | TokenGuard.decodeJwtTokenCookie | protected function decodeJwtTokenCookie($request)
{
return (array) JWT::decode(
$this->encrypter->decrypt($request->cookie(Passport::cookie())),
$this->encrypter->getKey(), ['HS256']
);
} | php | protected function decodeJwtTokenCookie($request)
{
return (array) JWT::decode(
$this->encrypter->decrypt($request->cookie(Passport::cookie())),
$this->encrypter->getKey(), ['HS256']
);
} | [
"protected",
"function",
"decodeJwtTokenCookie",
"(",
"$",
"request",
")",
"{",
"return",
"(",
"array",
")",
"JWT",
"::",
"decode",
"(",
"$",
"this",
"->",
"encrypter",
"->",
"decrypt",
"(",
"$",
"request",
"->",
"cookie",
"(",
"Passport",
"::",
"cookie",
... | Decode and decrypt the JWT token cookie.
@param \Illuminate\Http\Request $request
@return array | [
"Decode",
"and",
"decrypt",
"the",
"JWT",
"token",
"cookie",
"."
] | 738261912672e39f9f4f4e5bf420b99dbe303ef8 | https://github.com/moeen-basra/laravel-passport-mongodb/blob/738261912672e39f9f4f4e5bf420b99dbe303ef8/src/Guards/TokenGuard.php#L186-L192 |
224,895 | Spomky-Labs/pbkdf2 | src/PBKDF2.php | PBKDF2.customPBKDF2 | private static function customPBKDF2($algorithm, $password, $salt, $count, $key_length)
{
$hash_length = strlen(hash($algorithm, '', true));
if (0 === $key_length) {
$key_length = $hash_length;
}
$block_count = ceil($key_length / $hash_length);
$output = '';
... | php | private static function customPBKDF2($algorithm, $password, $salt, $count, $key_length)
{
$hash_length = strlen(hash($algorithm, '', true));
if (0 === $key_length) {
$key_length = $hash_length;
}
$block_count = ceil($key_length / $hash_length);
$output = '';
... | [
"private",
"static",
"function",
"customPBKDF2",
"(",
"$",
"algorithm",
",",
"$",
"password",
",",
"$",
"salt",
",",
"$",
"count",
",",
"$",
"key_length",
")",
"{",
"$",
"hash_length",
"=",
"strlen",
"(",
"hash",
"(",
"$",
"algorithm",
",",
"''",
",",
... | Pure PHP PBKDF2 key derivation function.
@param string $algorithm The hash algorithm to use. For supported hash algorithms, see hash_algos().
@param string $password The password.
@param string $salt A salt that is unique to the password.
@param int $count Iteration count. Higher is better, but slower... | [
"Pure",
"PHP",
"PBKDF2",
"key",
"derivation",
"function",
"."
] | e5928f517d526dfd65963f81df736b618a48ce27 | https://github.com/Spomky-Labs/pbkdf2/blob/e5928f517d526dfd65963f81df736b618a48ce27/src/PBKDF2.php#L64-L83 |
224,896 | pdeans/http | src/Factories/MessageFactory.php | MessageFactory.createRequest | public function createRequest($method, $uri, array $headers = [], $body = null, $protocol_version = '1.1')
{
return (
new Request($uri, $method, $this->stream->createStream($body), $headers)
)->withProtocolVersion($protocol_version);
} | php | public function createRequest($method, $uri, array $headers = [], $body = null, $protocol_version = '1.1')
{
return (
new Request($uri, $method, $this->stream->createStream($body), $headers)
)->withProtocolVersion($protocol_version);
} | [
"public",
"function",
"createRequest",
"(",
"$",
"method",
",",
"$",
"uri",
",",
"array",
"$",
"headers",
"=",
"[",
"]",
",",
"$",
"body",
"=",
"null",
",",
"$",
"protocol_version",
"=",
"'1.1'",
")",
"{",
"return",
"(",
"new",
"Request",
"(",
"$",
... | Create a PSR-7 request
@param string $method
@param \Psr\Http\Message\UriInterface|string $uri
@param array $headers
@param \Psr\Http\Message\StreamInterface|resource|string|null $body
@param string $protocol_version
@return \Psr\Http\Message\RequestInterface | [
"Create",
"a",
"PSR",
"-",
"7",
"request"
] | 6ebd9d9926ed815d85d47c8808ca87b236e49d88 | https://github.com/pdeans/http/blob/6ebd9d9926ed815d85d47c8808ca87b236e49d88/src/Factories/MessageFactory.php#L43-L48 |
224,897 | pdeans/http | src/Factories/MessageFactory.php | MessageFactory.createResponse | public function createResponse($status = 200, $reason = null, array $headers = [], $body = null, $protocol_version = '1.1')
{
return (
new Response($this->stream->createStream($body), $status, $headers)
)->withProtocolVersion($protocol_version);
} | php | public function createResponse($status = 200, $reason = null, array $headers = [], $body = null, $protocol_version = '1.1')
{
return (
new Response($this->stream->createStream($body), $status, $headers)
)->withProtocolVersion($protocol_version);
} | [
"public",
"function",
"createResponse",
"(",
"$",
"status",
"=",
"200",
",",
"$",
"reason",
"=",
"null",
",",
"array",
"$",
"headers",
"=",
"[",
"]",
",",
"$",
"body",
"=",
"null",
",",
"$",
"protocol_version",
"=",
"'1.1'",
")",
"{",
"return",
"(",
... | Create a PSR-7 response
@param integer $status Response status code
@param string|null $reason Response reason phrase
@param array $headers Response headers
@param \Psr\Http\Message\StreamInterface|resource|string|null $body Response body
@param string $protocol Response http protocol version
@return \Psr\H... | [
"Create",
"a",
"PSR",
"-",
"7",
"response"
] | 6ebd9d9926ed815d85d47c8808ca87b236e49d88 | https://github.com/pdeans/http/blob/6ebd9d9926ed815d85d47c8808ca87b236e49d88/src/Factories/MessageFactory.php#L61-L66 |
224,898 | pdeans/http | src/Exceptions/HttpException.php | HttpException.create | public static function create(
RequestInterface $request,
ResponseInterface $response,
Exception $last_exception = null
) {
$message = sprintf(
'[url] %s [http method] %s [status code] %s [reason phrase] %s',
$request->getRequestTarget(),
$request->getMethod(),
$response->getStatusCode(),
$respo... | php | public static function create(
RequestInterface $request,
ResponseInterface $response,
Exception $last_exception = null
) {
$message = sprintf(
'[url] %s [http method] %s [status code] %s [reason phrase] %s',
$request->getRequestTarget(),
$request->getMethod(),
$response->getStatusCode(),
$respo... | [
"public",
"static",
"function",
"create",
"(",
"RequestInterface",
"$",
"request",
",",
"ResponseInterface",
"$",
"response",
",",
"Exception",
"$",
"last_exception",
"=",
"null",
")",
"{",
"$",
"message",
"=",
"sprintf",
"(",
"'[url] %s [http method] %s [status cod... | Create a new exception with standardized error message
@param \Psr\Http\Message\RequestInterface $request Request object
@param \Psr\Http\Message\ResponseInterface $response Response object
@param \Exception|null $last_exception Previous exception object
@return \pdeans\Http\Exceptions\HttpException | [
"Create",
"a",
"new",
"exception",
"with",
"standardized",
"error",
"message"
] | 6ebd9d9926ed815d85d47c8808ca87b236e49d88 | https://github.com/pdeans/http/blob/6ebd9d9926ed815d85d47c8808ca87b236e49d88/src/Exceptions/HttpException.php#L60-L74 |
224,899 | moeen-basra/laravel-passport-mongodb | src/TokenRepository.php | TokenRepository.getValidToken | public function getValidToken($user, $client)
{
return $client->tokens()
->whereUserId($user->getKey())
->whereRevoked(0)
->where('expires_at', '>', Carbon::now())
->first();
} | php | public function getValidToken($user, $client)
{
return $client->tokens()
->whereUserId($user->getKey())
->whereRevoked(0)
->where('expires_at', '>', Carbon::now())
->first();
} | [
"public",
"function",
"getValidToken",
"(",
"$",
"user",
",",
"$",
"client",
")",
"{",
"return",
"$",
"client",
"->",
"tokens",
"(",
")",
"->",
"whereUserId",
"(",
"$",
"user",
"->",
"getKey",
"(",
")",
")",
"->",
"whereRevoked",
"(",
"0",
")",
"->",... | Get a valid token instance for the given user and client.
@param \Jenssegers\Mongodb\Eloquent\Model $user
@param \MoeenBasra\LaravelPassportMongoDB\Client $client
@return \MoeenBasra\LaravelPassportMongoDB\Token|null | [
"Get",
"a",
"valid",
"token",
"instance",
"for",
"the",
"given",
"user",
"and",
"client",
"."
] | 738261912672e39f9f4f4e5bf420b99dbe303ef8 | https://github.com/moeen-basra/laravel-passport-mongodb/blob/738261912672e39f9f4f4e5bf420b99dbe303ef8/src/TokenRepository.php#L62-L69 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.