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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
41,400 | czim/laravel-cms-core | src/Menu/MenuModulesInterpreter.php | MenuModulesInterpreter.normalizeConfiguredPresence | protected function normalizeConfiguredPresence($configured)
{
if ($configured instanceof MenuPresenceInterface) {
$configured->setChildren($this->normalizeConfiguredPresence($configured->children()));
$this->markExplicitKeysForMenuPresence($configured);
return [ $configured ];
}
if ( ! is_array($configured)) {
throw new UnexpectedValueException('Menu presence definition must be an array');
}
// Normalize if top layer is a presence definition, instead of an array of presences
if ($this->isArrayPresenceDefinition($configured)) {
$configured = [ $configured ];
}
foreach ($configured as &$value) {
if ($value instanceof MenuPresenceInterface) {
$value->setChildren($this->normalizeConfiguredPresence($value->children()));
$this->markExplicitKeysForMenuPresence($value);
continue;
}
if (false === $value) {
$value = [ 'mode' => MenuPresenceMode::DELETE ];
}
if ( ! is_array($value)) {
throw new UnexpectedValueException('Menu presence definition must be an array');
}
// Set the keys that were explicitly defined, to enable specific overrides only
$keys = array_keys($value);
if (array_key_exists('children', $value)) {
$value['children'] = $this->normalizeConfiguredPresence($value['children']);
}
$value = new MenuPresence($value);
$value->setExplicitKeys($keys);
}
unset ($value);
return $configured;
} | php | protected function normalizeConfiguredPresence($configured)
{
if ($configured instanceof MenuPresenceInterface) {
$configured->setChildren($this->normalizeConfiguredPresence($configured->children()));
$this->markExplicitKeysForMenuPresence($configured);
return [ $configured ];
}
if ( ! is_array($configured)) {
throw new UnexpectedValueException('Menu presence definition must be an array');
}
// Normalize if top layer is a presence definition, instead of an array of presences
if ($this->isArrayPresenceDefinition($configured)) {
$configured = [ $configured ];
}
foreach ($configured as &$value) {
if ($value instanceof MenuPresenceInterface) {
$value->setChildren($this->normalizeConfiguredPresence($value->children()));
$this->markExplicitKeysForMenuPresence($value);
continue;
}
if (false === $value) {
$value = [ 'mode' => MenuPresenceMode::DELETE ];
}
if ( ! is_array($value)) {
throw new UnexpectedValueException('Menu presence definition must be an array');
}
// Set the keys that were explicitly defined, to enable specific overrides only
$keys = array_keys($value);
if (array_key_exists('children', $value)) {
$value['children'] = $this->normalizeConfiguredPresence($value['children']);
}
$value = new MenuPresence($value);
$value->setExplicitKeys($keys);
}
unset ($value);
return $configured;
} | [
"protected",
"function",
"normalizeConfiguredPresence",
"(",
"$",
"configured",
")",
"{",
"if",
"(",
"$",
"configured",
"instanceof",
"MenuPresenceInterface",
")",
"{",
"$",
"configured",
"->",
"setChildren",
"(",
"$",
"this",
"->",
"normalizeConfiguredPresence",
"(... | Normalizes configured menu presence definitions.
@param mixed $configured
@return false|MenuPresenceInterface[] | [
"Normalizes",
"configured",
"menu",
"presence",
"definitions",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Menu/MenuModulesInterpreter.php#L339-L386 |
41,401 | czim/laravel-cms-core | src/Menu/MenuModulesInterpreter.php | MenuModulesInterpreter.normalizeMenuPresence | protected function normalizeMenuPresence($data)
{
if ( ! $data) {
return false;
}
if ($data instanceof MenuPresenceInterface) {
$data = [ $data ];
} elseif (is_array($data) && ! Arr::isAssoc($data)) {
$presences = [];
foreach ($data as $nestedData) {
if (is_array($nestedData)) {
$nestedData = new MenuPresence($nestedData);
}
if ( ! ($nestedData instanceof MenuPresenceInterface)) {
throw new UnexpectedValueException(
'Menu presence data from array provided by module is not an array or menu presence instance'
);
}
$presences[] = $nestedData;
}
$data = $presences;
} else {
$data = [ new MenuPresence($data) ];
}
/** @var MenuPresenceInterface[] $data */
// Now normalized to an array with one or more menu presences.
// Make sure the children of each menu presence are normalized aswell.
foreach ($data as $index => $presence) {
$children = $presence->children();
if ( ! empty($children)) {
$data[$index]->setChildren(
$this->normalizeMenuPresence($children)
);
}
}
return $data;
} | php | protected function normalizeMenuPresence($data)
{
if ( ! $data) {
return false;
}
if ($data instanceof MenuPresenceInterface) {
$data = [ $data ];
} elseif (is_array($data) && ! Arr::isAssoc($data)) {
$presences = [];
foreach ($data as $nestedData) {
if (is_array($nestedData)) {
$nestedData = new MenuPresence($nestedData);
}
if ( ! ($nestedData instanceof MenuPresenceInterface)) {
throw new UnexpectedValueException(
'Menu presence data from array provided by module is not an array or menu presence instance'
);
}
$presences[] = $nestedData;
}
$data = $presences;
} else {
$data = [ new MenuPresence($data) ];
}
/** @var MenuPresenceInterface[] $data */
// Now normalized to an array with one or more menu presences.
// Make sure the children of each menu presence are normalized aswell.
foreach ($data as $index => $presence) {
$children = $presence->children();
if ( ! empty($children)) {
$data[$index]->setChildren(
$this->normalizeMenuPresence($children)
);
}
}
return $data;
} | [
"protected",
"function",
"normalizeMenuPresence",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"$",
"data",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"data",
"instanceof",
"MenuPresenceInterface",
")",
"{",
"$",
"data",
"=",
"[",
"$",
"data... | Normalizes menu presence data to an array of MenuPresence instances.
@param $data
@return false|MenuPresenceInterface[] | [
"Normalizes",
"menu",
"presence",
"data",
"to",
"an",
"array",
"of",
"MenuPresence",
"instances",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Menu/MenuModulesInterpreter.php#L394-L446 |
41,402 | czim/laravel-cms-core | src/Menu/MenuModulesInterpreter.php | MenuModulesInterpreter.mergeMenuPresenceData | protected function mergeMenuPresenceData(MenuPresenceInterface $original, MenuPresenceInterface $new)
{
$keys = $new->explicitKeys();
foreach ($keys as $key) {
$original->{$key} = $new->{$key};
}
return $original;
} | php | protected function mergeMenuPresenceData(MenuPresenceInterface $original, MenuPresenceInterface $new)
{
$keys = $new->explicitKeys();
foreach ($keys as $key) {
$original->{$key} = $new->{$key};
}
return $original;
} | [
"protected",
"function",
"mergeMenuPresenceData",
"(",
"MenuPresenceInterface",
"$",
"original",
",",
"MenuPresenceInterface",
"$",
"new",
")",
"{",
"$",
"keys",
"=",
"$",
"new",
"->",
"explicitKeys",
"(",
")",
";",
"foreach",
"(",
"$",
"keys",
"as",
"$",
"k... | Merges configured new presence data into an original presence object.
@param MenuPresenceInterface $original
@param MenuPresenceInterface $new
@return MenuPresenceInterface | [
"Merges",
"configured",
"new",
"presence",
"data",
"into",
"an",
"original",
"presence",
"object",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Menu/MenuModulesInterpreter.php#L455-L464 |
41,403 | czim/laravel-cms-core | src/Menu/MenuModulesInterpreter.php | MenuModulesInterpreter.enrichConfiguredPresenceData | protected function enrichConfiguredPresenceData(MenuPresenceInterface $presence)
{
if ( ! $presence->type()) {
// If type is not set, it should be determined by the action or html value set
if ($presence->action()) {
if ($this->isStringUrl($presence->action())) {
$presence->type = MenuPresenceType::LINK;
} else {
$presence->type = MenuPresenceType::ACTION;
}
}
}
} | php | protected function enrichConfiguredPresenceData(MenuPresenceInterface $presence)
{
if ( ! $presence->type()) {
// If type is not set, it should be determined by the action or html value set
if ($presence->action()) {
if ($this->isStringUrl($presence->action())) {
$presence->type = MenuPresenceType::LINK;
} else {
$presence->type = MenuPresenceType::ACTION;
}
}
}
} | [
"protected",
"function",
"enrichConfiguredPresenceData",
"(",
"MenuPresenceInterface",
"$",
"presence",
")",
"{",
"if",
"(",
"!",
"$",
"presence",
"->",
"type",
"(",
")",
")",
"{",
"// If type is not set, it should be determined by the action or html value set",
"if",
"("... | Enriches a full, new presence data
@param MenuPresenceInterface|MenuPresence $presence | [
"Enriches",
"a",
"full",
"new",
"presence",
"data"
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Menu/MenuModulesInterpreter.php#L471-L485 |
41,404 | czim/laravel-cms-core | src/Menu/MenuModulesInterpreter.php | MenuModulesInterpreter.isMenuPresenceAlternative | protected function isMenuPresenceAlternative(MenuPresenceInterface $presence)
{
return $presence->type() !== MenuPresenceType::ACTION
&& $presence->type() !== MenuPresenceType::GROUP
&& $presence->type() !== MenuPresenceType::LINK;
} | php | protected function isMenuPresenceAlternative(MenuPresenceInterface $presence)
{
return $presence->type() !== MenuPresenceType::ACTION
&& $presence->type() !== MenuPresenceType::GROUP
&& $presence->type() !== MenuPresenceType::LINK;
} | [
"protected",
"function",
"isMenuPresenceAlternative",
"(",
"MenuPresenceInterface",
"$",
"presence",
")",
"{",
"return",
"$",
"presence",
"->",
"type",
"(",
")",
"!==",
"MenuPresenceType",
"::",
"ACTION",
"&&",
"$",
"presence",
"->",
"type",
"(",
")",
"!==",
"... | Returns whether a presence instance should be kept separate from the normal menu structure.
@param MenuPresenceInterface $presence
@return bool | [
"Returns",
"whether",
"a",
"presence",
"instance",
"should",
"be",
"kept",
"separate",
"from",
"the",
"normal",
"menu",
"structure",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Menu/MenuModulesInterpreter.php#L504-L509 |
41,405 | czim/laravel-cms-core | src/Console/Commands/CmsMigrationContextTrait.php | CmsMigrationContextTrait.getMigrationPaths | protected function getMigrationPaths()
{
if ($this->input->hasOption('path') && $this->option('path')) {
return [app()->basePath() . '/' . $this->option('path')];
}
// Do not use the migrator paths.
return [ $this->getMigrationPath() ];
} | php | protected function getMigrationPaths()
{
if ($this->input->hasOption('path') && $this->option('path')) {
return [app()->basePath() . '/' . $this->option('path')];
}
// Do not use the migrator paths.
return [ $this->getMigrationPath() ];
} | [
"protected",
"function",
"getMigrationPaths",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"input",
"->",
"hasOption",
"(",
"'path'",
")",
"&&",
"$",
"this",
"->",
"option",
"(",
"'path'",
")",
")",
"{",
"return",
"[",
"app",
"(",
")",
"->",
"basePat... | Overridden to block internal migrator paths.
@inheritdoc | [
"Overridden",
"to",
"block",
"internal",
"migrator",
"paths",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Console/Commands/CmsMigrationContextTrait.php#L57-L65 |
41,406 | czim/laravel-cms-core | src/Menu/MenuPermissionsFilter.php | MenuPermissionsFilter.buildPermissionsIndex | public function buildPermissionsIndex(MenuLayoutDataInterface $layout)
{
$this->permissionsIndex = new PermissionsIndexData;
$this->permissions = [];
$this->compileIndexForLayoutLayer($layout->layout());
$this->permissions = array_unique($this->permissions);
$this->permissionsIndex->permissions = $this->permissions;
return $this->permissionsIndex;
} | php | public function buildPermissionsIndex(MenuLayoutDataInterface $layout)
{
$this->permissionsIndex = new PermissionsIndexData;
$this->permissions = [];
$this->compileIndexForLayoutLayer($layout->layout());
$this->permissions = array_unique($this->permissions);
$this->permissionsIndex->permissions = $this->permissions;
return $this->permissionsIndex;
} | [
"public",
"function",
"buildPermissionsIndex",
"(",
"MenuLayoutDataInterface",
"$",
"layout",
")",
"{",
"$",
"this",
"->",
"permissionsIndex",
"=",
"new",
"PermissionsIndexData",
";",
"$",
"this",
"->",
"permissions",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"co... | Builds permissions index data for a given layout.
The purpose of the index is to allow for efficient presence filtering
based on changing user permissions.
@param MenuLayoutDataInterface $layout
@return MenuPermissionsIndexDataInterface | [
"Builds",
"permissions",
"index",
"data",
"for",
"a",
"given",
"layout",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Menu/MenuPermissionsFilter.php#L58-L69 |
41,407 | czim/laravel-cms-core | src/Menu/MenuPermissionsFilter.php | MenuPermissionsFilter.filterLayout | public function filterLayout(
MenuLayoutDataInterface $layout,
$user,
MenuPermissionsIndexDataInterface $permissionsIndex = null
) {
if ($user && ! ($user instanceof UserInterface)) {
throw new UnexpectedValueException("filterLayout expects UserInterface or boolean false");
}
if ($user && $user->isAdmin()) {
return $layout;
}
$this->userPermissions = [];
if (null !== $permissionsIndex) {
$this->permissionsIndex = $permissionsIndex;
}
if ( ! $this->permissionsIndex) {
throw new RuntimeException('FilterLayout requires permissions index data to be set');
}
// If user has all permissions, no need to walk though the tree
if ($this->userHasAllPermissions($this->permissionsIndex->permissions())) {
return $layout;
}
// Get access rights for all permissions
foreach ($this->permissionsIndex->permissions() as $permission) {
$this->userPermissions[ $permission] = $user && $user->can($permission);
}
$layout->setLayout($this->filterLayoutLayer($layout->layout()));
return $layout;
} | php | public function filterLayout(
MenuLayoutDataInterface $layout,
$user,
MenuPermissionsIndexDataInterface $permissionsIndex = null
) {
if ($user && ! ($user instanceof UserInterface)) {
throw new UnexpectedValueException("filterLayout expects UserInterface or boolean false");
}
if ($user && $user->isAdmin()) {
return $layout;
}
$this->userPermissions = [];
if (null !== $permissionsIndex) {
$this->permissionsIndex = $permissionsIndex;
}
if ( ! $this->permissionsIndex) {
throw new RuntimeException('FilterLayout requires permissions index data to be set');
}
// If user has all permissions, no need to walk though the tree
if ($this->userHasAllPermissions($this->permissionsIndex->permissions())) {
return $layout;
}
// Get access rights for all permissions
foreach ($this->permissionsIndex->permissions() as $permission) {
$this->userPermissions[ $permission] = $user && $user->can($permission);
}
$layout->setLayout($this->filterLayoutLayer($layout->layout()));
return $layout;
} | [
"public",
"function",
"filterLayout",
"(",
"MenuLayoutDataInterface",
"$",
"layout",
",",
"$",
"user",
",",
"MenuPermissionsIndexDataInterface",
"$",
"permissionsIndex",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"user",
"&&",
"!",
"(",
"$",
"user",
"instanceof",
... | Filters a given menu layout based on menu permissions.
@param MenuLayoutDataInterface $layout
@param UserInterface|false $user
@param MenuPermissionsIndexDataInterface|null $permissionsIndex
@return MenuLayoutDataInterface | [
"Filters",
"a",
"given",
"menu",
"layout",
"based",
"on",
"menu",
"permissions",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Menu/MenuPermissionsFilter.php#L79-L115 |
41,408 | czim/laravel-cms-core | src/Menu/MenuPermissionsFilter.php | MenuPermissionsFilter.compileIndexForLayoutLayer | protected function compileIndexForLayoutLayer(array $layout, $parentKeys = [])
{
$permissions = [];
$unconditional = false;
$mixed = false;
foreach ($layout as $key => $value) {
if ($value->type() === MenuPresenceType::GROUP) {
$childKeys = $parentKeys;
array_push($childKeys, $key);
$childPermissions = $this->compileIndexForLayoutLayer($value->children(), $childKeys);
// If the children of the group have unconditional presences,
// this layer becomes unconditionally displayable as well.
if (false === $childPermissions) {
$mixed = true;
} elseif (count($childPermissions)) {
$permissions = array_merge($permissions, $childPermissions);
}
continue;
}
// For non-group presences, check the permissions directly
if ( ! count($value->permissions())) {
$unconditional = true;
continue;
}
$permissions = array_merge($permissions, $value->permissions());
}
$this->permissions = array_merge($this->permissions, $permissions);
// This layer and its descendants have mixed con/unconditional presences when:
if ($mixed || count($permissions) && $unconditional) {
return false;
}
array_unique($permissions);
if (count($parentKeys)) {
$this->permissionsIndex->setForNode($parentKeys, $permissions);
}
return $permissions;
} | php | protected function compileIndexForLayoutLayer(array $layout, $parentKeys = [])
{
$permissions = [];
$unconditional = false;
$mixed = false;
foreach ($layout as $key => $value) {
if ($value->type() === MenuPresenceType::GROUP) {
$childKeys = $parentKeys;
array_push($childKeys, $key);
$childPermissions = $this->compileIndexForLayoutLayer($value->children(), $childKeys);
// If the children of the group have unconditional presences,
// this layer becomes unconditionally displayable as well.
if (false === $childPermissions) {
$mixed = true;
} elseif (count($childPermissions)) {
$permissions = array_merge($permissions, $childPermissions);
}
continue;
}
// For non-group presences, check the permissions directly
if ( ! count($value->permissions())) {
$unconditional = true;
continue;
}
$permissions = array_merge($permissions, $value->permissions());
}
$this->permissions = array_merge($this->permissions, $permissions);
// This layer and its descendants have mixed con/unconditional presences when:
if ($mixed || count($permissions) && $unconditional) {
return false;
}
array_unique($permissions);
if (count($parentKeys)) {
$this->permissionsIndex->setForNode($parentKeys, $permissions);
}
return $permissions;
} | [
"protected",
"function",
"compileIndexForLayoutLayer",
"(",
"array",
"$",
"layout",
",",
"$",
"parentKeys",
"=",
"[",
"]",
")",
"{",
"$",
"permissions",
"=",
"[",
"]",
";",
"$",
"unconditional",
"=",
"false",
";",
"$",
"mixed",
"=",
"false",
";",
"foreac... | Compiles data for the index for a nested node of the layout.
Only returns permissions list for nodes for which goes that ALL children
have permissions, or NONE do. Mixed conditional & unconditional must be
parsed no matter what, anyway.
@param MenuPresenceInterface[] $layout
@param array $parentKeys
@return string[]|false permissions, or false if the layer has mixed (un)conditional presences | [
"Compiles",
"data",
"for",
"the",
"index",
"for",
"a",
"nested",
"node",
"of",
"the",
"layout",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Menu/MenuPermissionsFilter.php#L129-L179 |
41,409 | czim/laravel-cms-core | src/Menu/MenuPermissionsFilter.php | MenuPermissionsFilter.userHasPermission | protected function userHasPermission(array $permissions)
{
if ( ! count($permissions)) {
return true;
}
return (bool) count(
array_filter($permissions, function ($permission) {
return array_get($this->userPermissions, $permission);
})
);
} | php | protected function userHasPermission(array $permissions)
{
if ( ! count($permissions)) {
return true;
}
return (bool) count(
array_filter($permissions, function ($permission) {
return array_get($this->userPermissions, $permission);
})
);
} | [
"protected",
"function",
"userHasPermission",
"(",
"array",
"$",
"permissions",
")",
"{",
"if",
"(",
"!",
"count",
"(",
"$",
"permissions",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"(",
"bool",
")",
"count",
"(",
"array_filter",
"(",
"$",
"... | Returns whether user has any of the given permissions.
@param string[] $permissions
@return bool | [
"Returns",
"whether",
"user",
"has",
"any",
"of",
"the",
"given",
"permissions",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Menu/MenuPermissionsFilter.php#L241-L252 |
41,410 | czim/laravel-cms-core | src/Menu/MenuPermissionsFilter.php | MenuPermissionsFilter.userHasAllPermissions | protected function userHasAllPermissions(array $permissions)
{
if ( ! count($permissions)) {
return true;
}
return ! count(
array_filter($permissions, function ($permission) {
return ! array_get($this->userPermissions, $permission);
})
);
} | php | protected function userHasAllPermissions(array $permissions)
{
if ( ! count($permissions)) {
return true;
}
return ! count(
array_filter($permissions, function ($permission) {
return ! array_get($this->userPermissions, $permission);
})
);
} | [
"protected",
"function",
"userHasAllPermissions",
"(",
"array",
"$",
"permissions",
")",
"{",
"if",
"(",
"!",
"count",
"(",
"$",
"permissions",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"!",
"count",
"(",
"array_filter",
"(",
"$",
"permissions",... | Returns whether user has all of the given permissions.
@param string[] $permissions
@return bool | [
"Returns",
"whether",
"user",
"has",
"all",
"of",
"the",
"given",
"permissions",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Menu/MenuPermissionsFilter.php#L260-L271 |
41,411 | czim/laravel-cms-core | src/Core/BasicNotifier.php | BasicNotifier.flash | public function flash($message, $level = null)
{
if (null === $level) {
$level = static::DEFAULT_LEVEL;
}
$messages = $this->core->session()->get(static::SESSION_FLASH_KEY, []);
$messages[] = [
'message' => $message,
'level' => $level,
];
$this->core->session()->put(static::SESSION_FLASH_KEY, $messages);
return $this;
} | php | public function flash($message, $level = null)
{
if (null === $level) {
$level = static::DEFAULT_LEVEL;
}
$messages = $this->core->session()->get(static::SESSION_FLASH_KEY, []);
$messages[] = [
'message' => $message,
'level' => $level,
];
$this->core->session()->put(static::SESSION_FLASH_KEY, $messages);
return $this;
} | [
"public",
"function",
"flash",
"(",
"$",
"message",
",",
"$",
"level",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"level",
")",
"{",
"$",
"level",
"=",
"static",
"::",
"DEFAULT_LEVEL",
";",
"}",
"$",
"messages",
"=",
"$",
"this",
"->",
... | Flashes a message to the session.
@param string $message
@param null|string $level
@return $this | [
"Flashes",
"a",
"message",
"to",
"the",
"session",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Core/BasicNotifier.php#L47-L63 |
41,412 | czim/laravel-cms-core | src/Core/BasicNotifier.php | BasicNotifier.getFlashed | public function getFlashed($clear = true)
{
$messages = $this->core->session()->get(static::SESSION_FLASH_KEY, []);
if ($clear) {
$this->core->session()->remove(static::SESSION_FLASH_KEY);
}
return $messages;
} | php | public function getFlashed($clear = true)
{
$messages = $this->core->session()->get(static::SESSION_FLASH_KEY, []);
if ($clear) {
$this->core->session()->remove(static::SESSION_FLASH_KEY);
}
return $messages;
} | [
"public",
"function",
"getFlashed",
"(",
"$",
"clear",
"=",
"true",
")",
"{",
"$",
"messages",
"=",
"$",
"this",
"->",
"core",
"->",
"session",
"(",
")",
"->",
"get",
"(",
"static",
"::",
"SESSION_FLASH_KEY",
",",
"[",
"]",
")",
";",
"if",
"(",
"$"... | Returns any previously flashed messages.
@param bool $clear whether to delete the flashed messages from the session
@return array set of associative arrays with message, level keys | [
"Returns",
"any",
"previously",
"flashed",
"messages",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Core/BasicNotifier.php#L71-L80 |
41,413 | czim/laravel-cms-core | src/Core/Cache.php | Cache.getCacheTags | protected function getCacheTags()
{
$tags = $this->core->config('cache.tags', false);
if (false === $tags || empty($tags)) {
return false;
}
return is_array($tags) ? $tags : [ $tags ];
} | php | protected function getCacheTags()
{
$tags = $this->core->config('cache.tags', false);
if (false === $tags || empty($tags)) {
return false;
}
return is_array($tags) ? $tags : [ $tags ];
} | [
"protected",
"function",
"getCacheTags",
"(",
")",
"{",
"$",
"tags",
"=",
"$",
"this",
"->",
"core",
"->",
"config",
"(",
"'cache.tags'",
",",
"false",
")",
";",
"if",
"(",
"false",
"===",
"$",
"tags",
"||",
"empty",
"(",
"$",
"tags",
")",
")",
"{"... | Returns the cacheTags to use, if any, or false if none set.
@return string[]|false | [
"Returns",
"the",
"cacheTags",
"to",
"use",
"if",
"any",
"or",
"false",
"if",
"none",
"set",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Core/Cache.php#L55-L64 |
41,414 | czim/laravel-cms-core | src/Support/Database/CmsMigration.php | CmsMigration.getConnection | public function getConnection()
{
$connection = parent::getConnection();
if ( ! app()->bound(Component::CORE)) {
// @codeCoverageIgnoreStart
return $connection;
// @codeCoverageIgnoreEnd
}
/** @var CoreInterface $core */
$core = app(Component::CORE);
$cmsConnection = $core->config('database.driver');
// If no separate database driver is configured for the CMS,
// we can use the normal driver and rely on the prefix alone.
if ( ! $cmsConnection) {
return $connection;
}
// If we're running tests, make sure we use the correct override
// for the CMS database connection/driver.
// N.B. This is ignored on purpose if the default connection is not overridden normally.
if (app()->runningUnitTests()) {
$cmsConnection = $core->config('database.testing.driver') ?: $cmsConnection;
}
return $cmsConnection;
} | php | public function getConnection()
{
$connection = parent::getConnection();
if ( ! app()->bound(Component::CORE)) {
// @codeCoverageIgnoreStart
return $connection;
// @codeCoverageIgnoreEnd
}
/** @var CoreInterface $core */
$core = app(Component::CORE);
$cmsConnection = $core->config('database.driver');
// If no separate database driver is configured for the CMS,
// we can use the normal driver and rely on the prefix alone.
if ( ! $cmsConnection) {
return $connection;
}
// If we're running tests, make sure we use the correct override
// for the CMS database connection/driver.
// N.B. This is ignored on purpose if the default connection is not overridden normally.
if (app()->runningUnitTests()) {
$cmsConnection = $core->config('database.testing.driver') ?: $cmsConnection;
}
return $cmsConnection;
} | [
"public",
"function",
"getConnection",
"(",
")",
"{",
"$",
"connection",
"=",
"parent",
"::",
"getConnection",
"(",
")",
";",
"if",
"(",
"!",
"app",
"(",
")",
"->",
"bound",
"(",
"Component",
"::",
"CORE",
")",
")",
"{",
"// @codeCoverageIgnoreStart",
"r... | Get the migration connection name.
@return string | [
"Get",
"the",
"migration",
"connection",
"name",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Support/Database/CmsMigration.php#L16-L44 |
41,415 | czim/laravel-cms-core | src/Core/Core.php | Core.log | public function log($level = null, $message = null, $extra = null)
{
/** @var LoggerInterface $logger */
$logger = $this->app[Component::LOG];
// If parameters are set, enter a log message before returning the logger
if (null !== $level || null !== $message) {
list($level, $message, $extra) = $this->normalizeMonologParameters($level, $message, $extra);
$logger->log($level, $message, $extra);
}
return $logger;
} | php | public function log($level = null, $message = null, $extra = null)
{
/** @var LoggerInterface $logger */
$logger = $this->app[Component::LOG];
// If parameters are set, enter a log message before returning the logger
if (null !== $level || null !== $message) {
list($level, $message, $extra) = $this->normalizeMonologParameters($level, $message, $extra);
$logger->log($level, $message, $extra);
}
return $logger;
} | [
"public",
"function",
"log",
"(",
"$",
"level",
"=",
"null",
",",
"$",
"message",
"=",
"null",
",",
"$",
"extra",
"=",
"null",
")",
"{",
"/** @var LoggerInterface $logger */",
"$",
"logger",
"=",
"$",
"this",
"->",
"app",
"[",
"Component",
"::",
"LOG",
... | With any parameters set, will record a CMS log entry.
Without parameters returns the CMS Logger instance.
@param null|string|array $level if $message is set as non-array, type, otherwise, if string, the message
@param null|string|array $message if an array and $type was the message, the extra data, otherwise the message
@param null|array $extra only used if neither $type nor $message are arrays
@return LoggerInterface | [
"With",
"any",
"parameters",
"set",
"will",
"record",
"a",
"CMS",
"log",
"entry",
".",
"Without",
"parameters",
"returns",
"the",
"CMS",
"Logger",
"instance",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Core/Core.php#L137-L151 |
41,416 | czim/laravel-cms-core | src/Core/Core.php | Core.normalizeMonologParameters | protected function normalizeMonologParameters($level = null, $message = null, $extra = [])
{
// Normalize the parameters so they're translated into sensible categories
if (null !== $level) {
if (is_array($level)) {
$extra = $level;
$level = null;
} elseif (null === $message || is_array($message)) {
$extra = is_array($message) ? $message : $extra;
$message = $level;
$level = null;
}
}
if (is_array($message)) {
$extra = $message;
$message = null;
}
if ( ! empty($extra) && ! is_array($extra)) {
$extra = (array) $extra;
}
if ($message instanceof \Exception) {
$level = 'error';
}
if ( ! $extra) {
$extra = [];
}
return [
$level ?: 'info',
$message ?: 'Data.',
$extra
];
} | php | protected function normalizeMonologParameters($level = null, $message = null, $extra = [])
{
// Normalize the parameters so they're translated into sensible categories
if (null !== $level) {
if (is_array($level)) {
$extra = $level;
$level = null;
} elseif (null === $message || is_array($message)) {
$extra = is_array($message) ? $message : $extra;
$message = $level;
$level = null;
}
}
if (is_array($message)) {
$extra = $message;
$message = null;
}
if ( ! empty($extra) && ! is_array($extra)) {
$extra = (array) $extra;
}
if ($message instanceof \Exception) {
$level = 'error';
}
if ( ! $extra) {
$extra = [];
}
return [
$level ?: 'info',
$message ?: 'Data.',
$extra
];
} | [
"protected",
"function",
"normalizeMonologParameters",
"(",
"$",
"level",
"=",
"null",
",",
"$",
"message",
"=",
"null",
",",
"$",
"extra",
"=",
"[",
"]",
")",
"{",
"// Normalize the parameters so they're translated into sensible categories",
"if",
"(",
"null",
"!==... | Normalizes typical monolog parameters to level, message, extra parameter set.
@param null|string|array $level if $message is set as non-array, type, otherwise, if string, the message
@param null|string|array $message if an array and $type was the message, the extra data, otherwise the message
@param array $extra only used if neither $type nor $message are arrays
@return array | [
"Normalizes",
"typical",
"monolog",
"parameters",
"to",
"level",
"message",
"extra",
"parameter",
"set",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Core/Core.php#L161-L197 |
41,417 | czim/laravel-cms-core | src/Core/Core.php | Core.route | public function route($name, $parameters = [], $absolute = true)
{
return app('url')->route($this->prefixRoute($name), $parameters, $absolute);
} | php | public function route($name, $parameters = [], $absolute = true)
{
return app('url')->route($this->prefixRoute($name), $parameters, $absolute);
} | [
"public",
"function",
"route",
"(",
"$",
"name",
",",
"$",
"parameters",
"=",
"[",
"]",
",",
"$",
"absolute",
"=",
"true",
")",
"{",
"return",
"app",
"(",
"'url'",
")",
"->",
"route",
"(",
"$",
"this",
"->",
"prefixRoute",
"(",
"$",
"name",
")",
... | Generate a URL to a named CMS route. This ensures that the
route name starts with the configured route name prefix.
@param string $name
@param array $parameters
@param bool $absolute
@return string | [
"Generate",
"a",
"URL",
"to",
"a",
"named",
"CMS",
"route",
".",
"This",
"ensures",
"that",
"the",
"route",
"name",
"starts",
"with",
"the",
"configured",
"route",
"name",
"prefix",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Core/Core.php#L265-L268 |
41,418 | czim/laravel-cms-core | src/Core/Core.php | Core.prefixRoute | public function prefixRoute($name)
{
$prefix = $this->config('route.name-prefix');
return starts_with($name, $prefix) ? $name : $prefix . $name;
} | php | public function prefixRoute($name)
{
$prefix = $this->config('route.name-prefix');
return starts_with($name, $prefix) ? $name : $prefix . $name;
} | [
"public",
"function",
"prefixRoute",
"(",
"$",
"name",
")",
"{",
"$",
"prefix",
"=",
"$",
"this",
"->",
"config",
"(",
"'route.name-prefix'",
")",
";",
"return",
"starts_with",
"(",
"$",
"name",
",",
"$",
"prefix",
")",
"?",
"$",
"name",
":",
"$",
"p... | Prefixes a route name with the standard CMS prefix, if required.
@param string $name
@return string | [
"Prefixes",
"a",
"route",
"name",
"with",
"the",
"standard",
"CMS",
"prefix",
"if",
"required",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Core/Core.php#L276-L281 |
41,419 | czim/laravel-cms-core | src/Core/Core.php | Core.apiRoute | public function apiRoute($name, $parameters = [], $absolute = true)
{
return app('url')->route($this->prefixApiRoute($name), $parameters, $absolute);
} | php | public function apiRoute($name, $parameters = [], $absolute = true)
{
return app('url')->route($this->prefixApiRoute($name), $parameters, $absolute);
} | [
"public",
"function",
"apiRoute",
"(",
"$",
"name",
",",
"$",
"parameters",
"=",
"[",
"]",
",",
"$",
"absolute",
"=",
"true",
")",
"{",
"return",
"app",
"(",
"'url'",
")",
"->",
"route",
"(",
"$",
"this",
"->",
"prefixApiRoute",
"(",
"$",
"name",
"... | Generate a URL to a named CMS API route. This ensures that the
route name starts with the configured API route name prefix.
@param string $name
@param array $parameters
@param bool $absolute
@return string | [
"Generate",
"a",
"URL",
"to",
"a",
"named",
"CMS",
"API",
"route",
".",
"This",
"ensures",
"that",
"the",
"route",
"name",
"starts",
"with",
"the",
"configured",
"API",
"route",
"name",
"prefix",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Core/Core.php#L292-L295 |
41,420 | czim/laravel-cms-core | src/Core/Core.php | Core.prefixApiRoute | public function prefixApiRoute($name)
{
$prefix = $this->apiConfig('route.name-prefix');
return starts_with($name, $prefix) ? $name : $prefix . $name;
} | php | public function prefixApiRoute($name)
{
$prefix = $this->apiConfig('route.name-prefix');
return starts_with($name, $prefix) ? $name : $prefix . $name;
} | [
"public",
"function",
"prefixApiRoute",
"(",
"$",
"name",
")",
"{",
"$",
"prefix",
"=",
"$",
"this",
"->",
"apiConfig",
"(",
"'route.name-prefix'",
")",
";",
"return",
"starts_with",
"(",
"$",
"name",
",",
"$",
"prefix",
")",
"?",
"$",
"name",
":",
"$"... | Prefixes a route name with the standard web CMS API prefix, if required.
@param string $name
@return string | [
"Prefixes",
"a",
"route",
"name",
"with",
"the",
"standard",
"web",
"CMS",
"API",
"prefix",
"if",
"required",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Core/Core.php#L303-L308 |
41,421 | czim/laravel-cms-core | src/Http/Controllers/LocaleController.php | LocaleController.setLocale | public function setLocale(SetLocaleRequest $request)
{
$locale = $request->input('locale');
if ( ! $this->repository->isAvailable($locale)) {
return redirect()->back()->withErrors("Locale {$locale} is not available");
}
session()->put($this->getSessionKey(), $locale);
return redirect()->back();
} | php | public function setLocale(SetLocaleRequest $request)
{
$locale = $request->input('locale');
if ( ! $this->repository->isAvailable($locale)) {
return redirect()->back()->withErrors("Locale {$locale} is not available");
}
session()->put($this->getSessionKey(), $locale);
return redirect()->back();
} | [
"public",
"function",
"setLocale",
"(",
"SetLocaleRequest",
"$",
"request",
")",
"{",
"$",
"locale",
"=",
"$",
"request",
"->",
"input",
"(",
"'locale'",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"repository",
"->",
"isAvailable",
"(",
"$",
"locale",
... | Sets and stores the locale in the session.
@param SetLocaleRequest $request
@return mixed | [
"Sets",
"and",
"stores",
"the",
"locale",
"in",
"the",
"session",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Http/Controllers/LocaleController.php#L33-L44 |
41,422 | czim/laravel-cms-core | src/Api/Response/RestResponseBuilder.php | RestResponseBuilder.response | public function response($content, $statusCode = 200)
{
return response()
->json($this->convertContent($content))
->setStatusCode($statusCode);
} | php | public function response($content, $statusCode = 200)
{
return response()
->json($this->convertContent($content))
->setStatusCode($statusCode);
} | [
"public",
"function",
"response",
"(",
"$",
"content",
",",
"$",
"statusCode",
"=",
"200",
")",
"{",
"return",
"response",
"(",
")",
"->",
"json",
"(",
"$",
"this",
"->",
"convertContent",
"(",
"$",
"content",
")",
")",
"->",
"setStatusCode",
"(",
"$",... | Returns API-formatted response based on given content.
@param mixed $content
@param int $statusCode
@return mixed | [
"Returns",
"API",
"-",
"formatted",
"response",
"based",
"on",
"given",
"content",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Api/Response/RestResponseBuilder.php#L71-L76 |
41,423 | czim/laravel-cms-core | src/Api/Response/RestResponseBuilder.php | RestResponseBuilder.transformContent | protected function transformContent(TransformContainerInterface $container)
{
if (null === $container->getTransformer()) {
return $container->getContent();
}
$transformer = $this->makeTransformerInstance($container->getTransformer());
$content = $container->getContent();
if ($container->isCollection()) {
// Detect pagination and convert apply it for Fractal
$paginator = null;
if ($content instanceof Paginator) {
$paginator = $content;
$content = $content->items();
}
/** @var FractalCollection $resource */
$resource = new FractalCollection($content, $transformer);
if ($paginator) {
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
}
} else {
/** @var FractalItem $resource */
$resource = new FractalItem($content, $transformer);
}
return $this->fractalManager->createData($resource)->toArray();
} | php | protected function transformContent(TransformContainerInterface $container)
{
if (null === $container->getTransformer()) {
return $container->getContent();
}
$transformer = $this->makeTransformerInstance($container->getTransformer());
$content = $container->getContent();
if ($container->isCollection()) {
// Detect pagination and convert apply it for Fractal
$paginator = null;
if ($content instanceof Paginator) {
$paginator = $content;
$content = $content->items();
}
/** @var FractalCollection $resource */
$resource = new FractalCollection($content, $transformer);
if ($paginator) {
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
}
} else {
/** @var FractalItem $resource */
$resource = new FractalItem($content, $transformer);
}
return $this->fractalManager->createData($resource)->toArray();
} | [
"protected",
"function",
"transformContent",
"(",
"TransformContainerInterface",
"$",
"container",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"container",
"->",
"getTransformer",
"(",
")",
")",
"{",
"return",
"$",
"container",
"->",
"getContent",
"(",
")",
";",
... | Transforms content wrapped in a transform container.
@param TransformContainerInterface $container
@return mixed | [
"Transforms",
"content",
"wrapped",
"in",
"a",
"transform",
"container",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Api/Response/RestResponseBuilder.php#L111-L143 |
41,424 | czim/laravel-cms-core | src/Api/Response/RestResponseBuilder.php | RestResponseBuilder.makeTransformerInstance | protected function makeTransformerInstance($transformerClass)
{
if ($transformerClass instanceof TransformerAbstract) {
return $transformerClass;
}
$instance = app($transformerClass);
if ( ! ($instance instanceof TransformerAbstract)) {
throw new \UnexpectedValueException("{$transformerClass} is not a TransformerAbstract");
}
return $instance;
} | php | protected function makeTransformerInstance($transformerClass)
{
if ($transformerClass instanceof TransformerAbstract) {
return $transformerClass;
}
$instance = app($transformerClass);
if ( ! ($instance instanceof TransformerAbstract)) {
throw new \UnexpectedValueException("{$transformerClass} is not a TransformerAbstract");
}
return $instance;
} | [
"protected",
"function",
"makeTransformerInstance",
"(",
"$",
"transformerClass",
")",
"{",
"if",
"(",
"$",
"transformerClass",
"instanceof",
"TransformerAbstract",
")",
"{",
"return",
"$",
"transformerClass",
";",
"}",
"$",
"instance",
"=",
"app",
"(",
"$",
"tr... | Makes an instance of a fractal transformer.
@param string|TransformerAbstract $transformerClass
@return TransformerAbstract | [
"Makes",
"an",
"instance",
"of",
"a",
"fractal",
"transformer",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Api/Response/RestResponseBuilder.php#L151-L164 |
41,425 | czim/laravel-cms-core | src/Api/Response/RestResponseBuilder.php | RestResponseBuilder.normalizeErrorResponse | protected function normalizeErrorResponse($content, $data = null)
{
if ($content instanceof Arrayable) {
$content = $content->toArray();
}
if ( ! is_array($content)) {
$content = [
'message' => $content,
];
}
if (null !== $data) {
$content['data'] = $data;
}
return $content;
} | php | protected function normalizeErrorResponse($content, $data = null)
{
if ($content instanceof Arrayable) {
$content = $content->toArray();
}
if ( ! is_array($content)) {
$content = [
'message' => $content,
];
}
if (null !== $data) {
$content['data'] = $data;
}
return $content;
} | [
"protected",
"function",
"normalizeErrorResponse",
"(",
"$",
"content",
",",
"$",
"data",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"content",
"instanceof",
"Arrayable",
")",
"{",
"$",
"content",
"=",
"$",
"content",
"->",
"toArray",
"(",
")",
";",
"}",
"... | Normalizes error response to array.
@param mixed $content
@param null|array $data extra data to provide in the error message
@return array | [
"Normalizes",
"error",
"response",
"to",
"array",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Api/Response/RestResponseBuilder.php#L201-L218 |
41,426 | czim/laravel-cms-core | src/Api/Response/RestResponseBuilder.php | RestResponseBuilder.formatExceptionError | protected function formatExceptionError(Exception $e, $fallbackMessage = null)
{
if ( (config('app.debug') || $this->core->config('debug'))
&& $this->core->apiConfig('debug.local-exception-trace', true)
) {
return $this->formatExceptionErrorForLocal($e, $fallbackMessage);
}
$message = $e->getMessage() ?: $fallbackMessage;
return [
'message' => $message,
];
} | php | protected function formatExceptionError(Exception $e, $fallbackMessage = null)
{
if ( (config('app.debug') || $this->core->config('debug'))
&& $this->core->apiConfig('debug.local-exception-trace', true)
) {
return $this->formatExceptionErrorForLocal($e, $fallbackMessage);
}
$message = $e->getMessage() ?: $fallbackMessage;
return [
'message' => $message,
];
} | [
"protected",
"function",
"formatExceptionError",
"(",
"Exception",
"$",
"e",
",",
"$",
"fallbackMessage",
"=",
"null",
")",
"{",
"if",
"(",
"(",
"config",
"(",
"'app.debug'",
")",
"||",
"$",
"this",
"->",
"core",
"->",
"config",
"(",
"'debug'",
")",
")",... | Formats an exception as a standardized error response.
@param Exception $e
@param null|string $fallbackMessage message to use if exception has none
@return mixed | [
"Formats",
"an",
"exception",
"as",
"a",
"standardized",
"error",
"response",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Api/Response/RestResponseBuilder.php#L227-L240 |
41,427 | czim/laravel-cms-core | src/Api/Response/RestResponseBuilder.php | RestResponseBuilder.formatExceptionErrorForLocal | protected function formatExceptionErrorForLocal(Exception $e, $fallbackMessage = null)
{
$message = $e->getMessage() ?: $fallbackMessage;
return [
'message' => $message,
'code' => $e->getCode(),
'file' => $e->getFile(),
'line' => $e->getLine(),
'trace' => array_map(function($trace) {
return trim(
(isset($trace['file']) ? $trace['file'] . ' : ' . $trace['line'] : '')
. ' '
. (isset($trace['function']) ? $trace['function']
. (isset($trace['class']) ? ' on ' . $trace['class'] : '')
: '')
);
}, $e->getTrace()),
];
} | php | protected function formatExceptionErrorForLocal(Exception $e, $fallbackMessage = null)
{
$message = $e->getMessage() ?: $fallbackMessage;
return [
'message' => $message,
'code' => $e->getCode(),
'file' => $e->getFile(),
'line' => $e->getLine(),
'trace' => array_map(function($trace) {
return trim(
(isset($trace['file']) ? $trace['file'] . ' : ' . $trace['line'] : '')
. ' '
. (isset($trace['function']) ? $trace['function']
. (isset($trace['class']) ? ' on ' . $trace['class'] : '')
: '')
);
}, $e->getTrace()),
];
} | [
"protected",
"function",
"formatExceptionErrorForLocal",
"(",
"Exception",
"$",
"e",
",",
"$",
"fallbackMessage",
"=",
"null",
")",
"{",
"$",
"message",
"=",
"$",
"e",
"->",
"getMessage",
"(",
")",
"?",
":",
"$",
"fallbackMessage",
";",
"return",
"[",
"'me... | Formats an exception as a standardized error response for local environment only.
@param Exception $e
@param null|string $fallbackMessage message to use if exception has none
@return mixed | [
"Formats",
"an",
"exception",
"as",
"a",
"standardized",
"error",
"response",
"for",
"local",
"environment",
"only",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Api/Response/RestResponseBuilder.php#L249-L268 |
41,428 | czim/laravel-cms-core | src/Providers/Api/ApiRouteServiceProvider.php | ApiRouteServiceProvider.buildRoutesForAuth | protected function buildRoutesForAuth(Router $router)
{
$auth = $this->core->auth();
$router->group(
[
'prefix' => 'auth',
],
function (Router $router) use ($auth) {
$router->{$this->getLoginMethod()}($this->getLoginPath(), $auth->getApiRouteLoginAction());
$router->{$this->getLogoutMethod()}($this->getLogoutPath(), $auth->getApiRouteLogoutAction());
}
);
} | php | protected function buildRoutesForAuth(Router $router)
{
$auth = $this->core->auth();
$router->group(
[
'prefix' => 'auth',
],
function (Router $router) use ($auth) {
$router->{$this->getLoginMethod()}($this->getLoginPath(), $auth->getApiRouteLoginAction());
$router->{$this->getLogoutMethod()}($this->getLogoutPath(), $auth->getApiRouteLogoutAction());
}
);
} | [
"protected",
"function",
"buildRoutesForAuth",
"(",
"Router",
"$",
"router",
")",
"{",
"$",
"auth",
"=",
"$",
"this",
"->",
"core",
"->",
"auth",
"(",
")",
";",
"$",
"router",
"->",
"group",
"(",
"[",
"'prefix'",
"=>",
"'auth'",
",",
"]",
",",
"funct... | Builds up routes for API authorization in the given router context.
@param Router $router | [
"Builds",
"up",
"routes",
"for",
"API",
"authorization",
"in",
"the",
"given",
"router",
"context",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Providers/Api/ApiRouteServiceProvider.php#L118-L132 |
41,429 | czim/laravel-cms-core | src/Providers/Api/ApiRouteServiceProvider.php | ApiRouteServiceProvider.buildRoutesForMetaData | protected function buildRoutesForMetaData(Router $router)
{
$router->group(
[
'prefix' => 'meta',
],
function (Router $router) {
// Menu information
$router->get('menu', [
'as' => 'menu.index',
'uses' => $this->core->apiConfig('controllers.menu') . '@index',
]);
// Module information
$moduleController = $this->core->apiConfig('controllers.modules');
$router->get('modules', [
'as' => 'modules.index',
'uses' => $moduleController . '@index',
]);
$router->get('modules/{key}', [
'as' =>'modules.show',
'uses' => $moduleController . '@show',
]);
// CMS version
$router->get('versions', [
'as' => 'versions.index',
'uses' => $this->core->apiConfig('controllers.version') . '@index',
]);
}
);
} | php | protected function buildRoutesForMetaData(Router $router)
{
$router->group(
[
'prefix' => 'meta',
],
function (Router $router) {
// Menu information
$router->get('menu', [
'as' => 'menu.index',
'uses' => $this->core->apiConfig('controllers.menu') . '@index',
]);
// Module information
$moduleController = $this->core->apiConfig('controllers.modules');
$router->get('modules', [
'as' => 'modules.index',
'uses' => $moduleController . '@index',
]);
$router->get('modules/{key}', [
'as' =>'modules.show',
'uses' => $moduleController . '@show',
]);
// CMS version
$router->get('versions', [
'as' => 'versions.index',
'uses' => $this->core->apiConfig('controllers.version') . '@index',
]);
}
);
} | [
"protected",
"function",
"buildRoutesForMetaData",
"(",
"Router",
"$",
"router",
")",
"{",
"$",
"router",
"->",
"group",
"(",
"[",
"'prefix'",
"=>",
"'meta'",
",",
"]",
",",
"function",
"(",
"Router",
"$",
"router",
")",
"{",
"// Menu information",
"$",
"r... | Builds up routes for accessing meta-data about the CMS and its modules.
@param Router $router | [
"Builds",
"up",
"routes",
"for",
"accessing",
"meta",
"-",
"data",
"about",
"the",
"CMS",
"and",
"its",
"modules",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Providers/Api/ApiRouteServiceProvider.php#L139-L176 |
41,430 | czim/laravel-cms-core | src/Providers/MigrationServiceProvider.php | MigrationServiceProvider.registerCmsMigrator | protected function registerCmsMigrator()
{
// Make sure that we do not use the same migrations table if CMS migrations
// share the database with the app.
$this->app->singleton('cms.migration-repository', function (Application $app) {
$table = $this->getCore()->config(
'database.migrations.table',
$app['config']['database.migrations']
);
return new DatabaseMigrationRepository($app['db'], $table);
});
// This CMS migrator uses the exact same binding setup as the normal migrator,
// except for this table configuration.
$this->app->singleton('cms.migrator', function ($app) {
return new Migrator($app['cms.migration-repository'], $app['db'], $app['files']);
});
// Bind the migrator contextually, so it will be set for the commands bound here.
$this->app->when(MigrateCommand::class)
->needs(Migrator::class)
->give('cms.migrator');
$this->app->when(MigrateInstallCommand::class)
->needs(MigrationRepositoryInterface::class)
->give('cms.migration-repository');
$this->app->when(MigrateRefreshCommand::class)
->needs(Migrator::class)
->give('cms.migrator');
$this->app->when(MigrateResetCommand::class)
->needs(Migrator::class)
->give('cms.migrator');
$this->app->when(MigrateRollbackCommand::class)
->needs(Migrator::class)
->give('cms.migrator');
$this->app->when(MigrateStatusCommand::class)
->needs(Migrator::class)
->give('cms.migrator');
return $this;
} | php | protected function registerCmsMigrator()
{
// Make sure that we do not use the same migrations table if CMS migrations
// share the database with the app.
$this->app->singleton('cms.migration-repository', function (Application $app) {
$table = $this->getCore()->config(
'database.migrations.table',
$app['config']['database.migrations']
);
return new DatabaseMigrationRepository($app['db'], $table);
});
// This CMS migrator uses the exact same binding setup as the normal migrator,
// except for this table configuration.
$this->app->singleton('cms.migrator', function ($app) {
return new Migrator($app['cms.migration-repository'], $app['db'], $app['files']);
});
// Bind the migrator contextually, so it will be set for the commands bound here.
$this->app->when(MigrateCommand::class)
->needs(Migrator::class)
->give('cms.migrator');
$this->app->when(MigrateInstallCommand::class)
->needs(MigrationRepositoryInterface::class)
->give('cms.migration-repository');
$this->app->when(MigrateRefreshCommand::class)
->needs(Migrator::class)
->give('cms.migrator');
$this->app->when(MigrateResetCommand::class)
->needs(Migrator::class)
->give('cms.migrator');
$this->app->when(MigrateRollbackCommand::class)
->needs(Migrator::class)
->give('cms.migrator');
$this->app->when(MigrateStatusCommand::class)
->needs(Migrator::class)
->give('cms.migrator');
return $this;
} | [
"protected",
"function",
"registerCmsMigrator",
"(",
")",
"{",
"// Make sure that we do not use the same migrations table if CMS migrations",
"// share the database with the app.",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'cms.migration-repository'",
",",
"function",
"(... | Registers the Migrator that the CMS should use for its Migrate commands.
@return $this | [
"Registers",
"the",
"Migrator",
"that",
"the",
"CMS",
"should",
"use",
"for",
"its",
"Migrate",
"commands",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Providers/MigrationServiceProvider.php#L37-L84 |
41,431 | czim/laravel-cms-core | src/Providers/MigrationServiceProvider.php | MigrationServiceProvider.registerMigrateCommands | protected function registerMigrateCommands()
{
$this->app->singleton('cms.commands.db-migrate', MigrateCommand::class);
$this->app->singleton('cms.commands.db-migrate-install', MigrateInstallCommand::class);
$this->app->singleton('cms.commands.db-migrate-refresh', MigrateRefreshCommand::class);
$this->app->singleton('cms.commands.db-migrate-reset', MigrateResetCommand::class);
$this->app->singleton('cms.commands.db-migrate-rollback', MigrateRollbackCommand::class);
$this->app->singleton('cms.commands.db-migrate-status', MigrateStatusCommand::class);
$this->commands([
'cms.commands.db-migrate',
'cms.commands.db-migrate-install',
'cms.commands.db-migrate-reset',
'cms.commands.db-migrate-refresh',
'cms.commands.db-migrate-rollback',
'cms.commands.db-migrate-status',
]);
return $this;
} | php | protected function registerMigrateCommands()
{
$this->app->singleton('cms.commands.db-migrate', MigrateCommand::class);
$this->app->singleton('cms.commands.db-migrate-install', MigrateInstallCommand::class);
$this->app->singleton('cms.commands.db-migrate-refresh', MigrateRefreshCommand::class);
$this->app->singleton('cms.commands.db-migrate-reset', MigrateResetCommand::class);
$this->app->singleton('cms.commands.db-migrate-rollback', MigrateRollbackCommand::class);
$this->app->singleton('cms.commands.db-migrate-status', MigrateStatusCommand::class);
$this->commands([
'cms.commands.db-migrate',
'cms.commands.db-migrate-install',
'cms.commands.db-migrate-reset',
'cms.commands.db-migrate-refresh',
'cms.commands.db-migrate-rollback',
'cms.commands.db-migrate-status',
]);
return $this;
} | [
"protected",
"function",
"registerMigrateCommands",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'cms.commands.db-migrate'",
",",
"MigrateCommand",
"::",
"class",
")",
";",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'cms.commands.db-... | Register Migration CMS commands
@return $this | [
"Register",
"Migration",
"CMS",
"commands"
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Providers/MigrationServiceProvider.php#L91-L110 |
41,432 | czim/laravel-cms-core | src/Providers/MiddlewareServiceProvider.php | MiddlewareServiceProvider.registerCmsWebGroupMiddleware | protected function registerCmsWebGroupMiddleware()
{
$this->router->middlewareGroup($this->getConfiguredWebGroupName(), []);
foreach ($this->getGlobalWebMiddleware() as $middleware) {
// Don't add if the middleware is already globally enabled in the kernel
if ($this->kernel->hasMiddleware($middleware)) {
// @codeCoverageIgnoreStart
continue;
// @codeCoverageIgnoreEnd
}
$this->router->pushMiddlewareToGroup($this->getConfiguredWebGroupName(), $middleware);
}
return $this;
} | php | protected function registerCmsWebGroupMiddleware()
{
$this->router->middlewareGroup($this->getConfiguredWebGroupName(), []);
foreach ($this->getGlobalWebMiddleware() as $middleware) {
// Don't add if the middleware is already globally enabled in the kernel
if ($this->kernel->hasMiddleware($middleware)) {
// @codeCoverageIgnoreStart
continue;
// @codeCoverageIgnoreEnd
}
$this->router->pushMiddlewareToGroup($this->getConfiguredWebGroupName(), $middleware);
}
return $this;
} | [
"protected",
"function",
"registerCmsWebGroupMiddleware",
"(",
")",
"{",
"$",
"this",
"->",
"router",
"->",
"middlewareGroup",
"(",
"$",
"this",
"->",
"getConfiguredWebGroupName",
"(",
")",
",",
"[",
"]",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getGlob... | Registers global middleware for the CMS
@return $this | [
"Registers",
"global",
"middleware",
"for",
"the",
"CMS"
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Providers/MiddlewareServiceProvider.php#L97-L114 |
41,433 | czim/laravel-cms-core | src/Providers/MiddlewareServiceProvider.php | MiddlewareServiceProvider.registerWebRouteMiddleware | protected function registerWebRouteMiddleware()
{
foreach ($this->getWebRouteMiddleware() as $key => $middleware) {
$this->router->aliasMiddleware($key, $middleware);
}
return $this;
} | php | protected function registerWebRouteMiddleware()
{
foreach ($this->getWebRouteMiddleware() as $key => $middleware) {
$this->router->aliasMiddleware($key, $middleware);
}
return $this;
} | [
"protected",
"function",
"registerWebRouteMiddleware",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getWebRouteMiddleware",
"(",
")",
"as",
"$",
"key",
"=>",
"$",
"middleware",
")",
"{",
"$",
"this",
"->",
"router",
"->",
"aliasMiddleware",
"(",
"$",
... | Registers route middleware for the CMS
@return $this | [
"Registers",
"route",
"middleware",
"for",
"the",
"CMS"
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Providers/MiddlewareServiceProvider.php#L121-L128 |
41,434 | czim/laravel-cms-core | src/Providers/MiddlewareServiceProvider.php | MiddlewareServiceProvider.registerCmsApiGroupMiddleware | protected function registerCmsApiGroupMiddleware()
{
$this->router->middlewareGroup($this->getConfiguredApiGroupName(), []);
foreach ($this->getGlobalApiMiddleware() as $middleware) {
// Don't add if the middleware is already globally enabled in the kernel
if ($this->kernel->hasMiddleware($middleware)) {
// @codeCoverageIgnoreStart
continue;
// @codeCoverageIgnoreEnd
}
$this->router->pushMiddlewareToGroup($this->getConfiguredApiGroupName(), $middleware);
}
return $this;
} | php | protected function registerCmsApiGroupMiddleware()
{
$this->router->middlewareGroup($this->getConfiguredApiGroupName(), []);
foreach ($this->getGlobalApiMiddleware() as $middleware) {
// Don't add if the middleware is already globally enabled in the kernel
if ($this->kernel->hasMiddleware($middleware)) {
// @codeCoverageIgnoreStart
continue;
// @codeCoverageIgnoreEnd
}
$this->router->pushMiddlewareToGroup($this->getConfiguredApiGroupName(), $middleware);
}
return $this;
} | [
"protected",
"function",
"registerCmsApiGroupMiddleware",
"(",
")",
"{",
"$",
"this",
"->",
"router",
"->",
"middlewareGroup",
"(",
"$",
"this",
"->",
"getConfiguredApiGroupName",
"(",
")",
",",
"[",
"]",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getGlob... | Registers global middleware for the CMS API.
@return $this | [
"Registers",
"global",
"middleware",
"for",
"the",
"CMS",
"API",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Providers/MiddlewareServiceProvider.php#L179-L196 |
41,435 | czim/laravel-cms-core | src/Providers/MiddlewareServiceProvider.php | MiddlewareServiceProvider.registerApiRouteMiddleware | protected function registerApiRouteMiddleware()
{
foreach ($this->getApiRouteMiddleware() as $key => $middleware) {
$this->router->aliasMiddleware($key, $middleware);
}
return $this;
} | php | protected function registerApiRouteMiddleware()
{
foreach ($this->getApiRouteMiddleware() as $key => $middleware) {
$this->router->aliasMiddleware($key, $middleware);
}
return $this;
} | [
"protected",
"function",
"registerApiRouteMiddleware",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getApiRouteMiddleware",
"(",
")",
"as",
"$",
"key",
"=>",
"$",
"middleware",
")",
"{",
"$",
"this",
"->",
"router",
"->",
"aliasMiddleware",
"(",
"$",
... | Registers route middleware for the CMS API.
@return $this | [
"Registers",
"route",
"middleware",
"for",
"the",
"CMS",
"API",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Providers/MiddlewareServiceProvider.php#L203-L210 |
41,436 | czim/laravel-cms-core | src/Support/Data/MenuPresence.php | MenuPresence.children | public function children()
{
$children = $this->getAttribute('children') ?: [];
if ($children && ! is_array($children) && ! ($children instanceof Collection)) {
return (array) $children;
}
return $children;
} | php | public function children()
{
$children = $this->getAttribute('children') ?: [];
if ($children && ! is_array($children) && ! ($children instanceof Collection)) {
return (array) $children;
}
return $children;
} | [
"public",
"function",
"children",
"(",
")",
"{",
"$",
"children",
"=",
"$",
"this",
"->",
"getAttribute",
"(",
"'children'",
")",
"?",
":",
"[",
"]",
";",
"if",
"(",
"$",
"children",
"&&",
"!",
"is_array",
"(",
"$",
"children",
")",
"&&",
"!",
"(",... | Returns child presences of this presence.
@return MenuPresenceInterface[] | [
"Returns",
"child",
"presences",
"of",
"this",
"presence",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Support/Data/MenuPresence.php#L77-L86 |
41,437 | czim/laravel-cms-core | src/Support/Data/MenuPresence.php | MenuPresence.isActive | public function isActive()
{
switch ($this->type) {
case MenuPresenceType::GROUP:
return false;
case MenuPresenceType::ACTION:
// Activity is based on named route match, unless specific match is defined
return false;
case MenuPresenceType::LINK:
// Activity is based on URL match, unless specific match is defined
return false;
// Default omitted on purpose
}
return false;
} | php | public function isActive()
{
switch ($this->type) {
case MenuPresenceType::GROUP:
return false;
case MenuPresenceType::ACTION:
// Activity is based on named route match, unless specific match is defined
return false;
case MenuPresenceType::LINK:
// Activity is based on URL match, unless specific match is defined
return false;
// Default omitted on purpose
}
return false;
} | [
"public",
"function",
"isActive",
"(",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"type",
")",
"{",
"case",
"MenuPresenceType",
"::",
"GROUP",
":",
"return",
"false",
";",
"case",
"MenuPresenceType",
"::",
"ACTION",
":",
"// Activity is based on named route mat... | Returns whether this menu item is active based on the current location.
@return bool
@codeCoverageIgnore
@todo | [
"Returns",
"whether",
"this",
"menu",
"item",
"is",
"active",
"based",
"on",
"the",
"current",
"location",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Support/Data/MenuPresence.php#L217-L236 |
41,438 | czim/laravel-cms-core | src/Support/Data/MenuPresence.php | MenuPresence.addChild | public function addChild(MenuPresenceInterface $presence)
{
$children = $this->children ?: [];
if ($children instanceof Collection) {
$children->push($presence);
} else {
$children[] = $presence;
}
$this->children = $children;
} | php | public function addChild(MenuPresenceInterface $presence)
{
$children = $this->children ?: [];
if ($children instanceof Collection) {
$children->push($presence);
} else {
$children[] = $presence;
}
$this->children = $children;
} | [
"public",
"function",
"addChild",
"(",
"MenuPresenceInterface",
"$",
"presence",
")",
"{",
"$",
"children",
"=",
"$",
"this",
"->",
"children",
"?",
":",
"[",
"]",
";",
"if",
"(",
"$",
"children",
"instanceof",
"Collection",
")",
"{",
"$",
"children",
"-... | Adds a child to the end of the child list.
@param MenuPresenceInterface $presence | [
"Adds",
"a",
"child",
"to",
"the",
"end",
"of",
"the",
"child",
"list",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Support/Data/MenuPresence.php#L266-L277 |
41,439 | czim/laravel-cms-core | src/Support/Data/MenuPresence.php | MenuPresence.shiftChild | public function shiftChild(MenuPresenceInterface $presence)
{
$children = $this->children ?: [];
if ($children instanceof Collection) {
$children->prepend($presence);
} else {
$children = array_prepend($children, $presence);
}
$this->children = $children;
} | php | public function shiftChild(MenuPresenceInterface $presence)
{
$children = $this->children ?: [];
if ($children instanceof Collection) {
$children->prepend($presence);
} else {
$children = array_prepend($children, $presence);
}
$this->children = $children;
} | [
"public",
"function",
"shiftChild",
"(",
"MenuPresenceInterface",
"$",
"presence",
")",
"{",
"$",
"children",
"=",
"$",
"this",
"->",
"children",
"?",
":",
"[",
"]",
";",
"if",
"(",
"$",
"children",
"instanceof",
"Collection",
")",
"{",
"$",
"children",
... | Adds a child to the front of the child list.
@param MenuPresenceInterface $presence | [
"Adds",
"a",
"child",
"to",
"the",
"front",
"of",
"the",
"child",
"list",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Support/Data/MenuPresence.php#L284-L295 |
41,440 | czim/laravel-cms-core | src/Core/BootChecker.php | BootChecker.shouldCmsRegister | public function shouldCmsRegister()
{
if (null !== $this->shouldRegister) {
// @codeCoverageIgnoreStart
return $this->shouldRegister;
// @codeCoverageIgnoreEnd
}
if ( ! $this->isCmsEnabled()) {
$this->shouldRegister = false;
return false;
}
if ($this->isConsole()) {
$this->shouldRegister = $this->isCmsEnabledArtisanCommand();
return $this->shouldRegister;
}
if ($this->isCmsBeingUnitTested()) {
$this->shouldRegister = true;
return true;
}
$this->shouldRegister = $this->isCmsWebRequest() || $this->isCmsApiRequest();
return $this->shouldRegister;
} | php | public function shouldCmsRegister()
{
if (null !== $this->shouldRegister) {
// @codeCoverageIgnoreStart
return $this->shouldRegister;
// @codeCoverageIgnoreEnd
}
if ( ! $this->isCmsEnabled()) {
$this->shouldRegister = false;
return false;
}
if ($this->isConsole()) {
$this->shouldRegister = $this->isCmsEnabledArtisanCommand();
return $this->shouldRegister;
}
if ($this->isCmsBeingUnitTested()) {
$this->shouldRegister = true;
return true;
}
$this->shouldRegister = $this->isCmsWebRequest() || $this->isCmsApiRequest();
return $this->shouldRegister;
} | [
"public",
"function",
"shouldCmsRegister",
"(",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"shouldRegister",
")",
"{",
"// @codeCoverageIgnoreStart",
"return",
"$",
"this",
"->",
"shouldRegister",
";",
"// @codeCoverageIgnoreEnd",
"}",
"if",
"(",
"!"... | Returns whether the CMS should perform any service providing.
@return bool | [
"Returns",
"whether",
"the",
"CMS",
"should",
"perform",
"any",
"service",
"providing",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Core/BootChecker.php#L41-L66 |
41,441 | czim/laravel-cms-core | src/Core/BootChecker.php | BootChecker.isCmsApiRequest | public function isCmsApiRequest()
{
if (app()->runningInConsole() || ! $this->isCmsApiEnabled()) {
return false;
}
return $this->requestRouteMatchesPrefix($this->getCmsApiRoutePrefix());
} | php | public function isCmsApiRequest()
{
if (app()->runningInConsole() || ! $this->isCmsApiEnabled()) {
return false;
}
return $this->requestRouteMatchesPrefix($this->getCmsApiRoutePrefix());
} | [
"public",
"function",
"isCmsApiRequest",
"(",
")",
"{",
"if",
"(",
"app",
"(",
")",
"->",
"runningInConsole",
"(",
")",
"||",
"!",
"$",
"this",
"->",
"isCmsApiEnabled",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->",
"re... | Returns whether performing a request to the CMS API, based on its routing.
@return bool | [
"Returns",
"whether",
"performing",
"a",
"request",
"to",
"the",
"CMS",
"API",
"based",
"on",
"its",
"routing",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Core/BootChecker.php#L199-L206 |
41,442 | czim/laravel-cms-core | src/Core/BootChecker.php | BootChecker.requestRouteMatchesPrefix | protected function requestRouteMatchesPrefix($prefix)
{
$prefixSegments = $this->splitPrefixSegments($prefix);
$request = request();
foreach ($prefixSegments as $index => $segment) {
if (strtolower($request->segment($index + 1)) !== $segment) {
return false;
}
}
return true;
} | php | protected function requestRouteMatchesPrefix($prefix)
{
$prefixSegments = $this->splitPrefixSegments($prefix);
$request = request();
foreach ($prefixSegments as $index => $segment) {
if (strtolower($request->segment($index + 1)) !== $segment) {
return false;
}
}
return true;
} | [
"protected",
"function",
"requestRouteMatchesPrefix",
"(",
"$",
"prefix",
")",
"{",
"$",
"prefixSegments",
"=",
"$",
"this",
"->",
"splitPrefixSegments",
"(",
"$",
"prefix",
")",
";",
"$",
"request",
"=",
"request",
"(",
")",
";",
"foreach",
"(",
"$",
"pre... | Returns whether a given route prefix matches the current request.
@param string $prefix
@return bool | [
"Returns",
"whether",
"a",
"given",
"route",
"prefix",
"matches",
"the",
"current",
"request",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Core/BootChecker.php#L214-L226 |
41,443 | czim/laravel-cms-core | src/Core/BootChecker.php | BootChecker.isCmsEnabledArtisanCommand | protected function isCmsEnabledArtisanCommand()
{
if (null !== $this->registeredConsoleCommand) {
// @codeCoverageIgnoreStart
return $this->registeredConsoleCommand;
// @codeCoverageIgnoreEnd
}
if ( ! $this->isConsole()) {
$this->registeredConsoleCommand = false;
return false;
}
$command = $this->getArtisanBaseCommand();
// If no command is given, the CMS will be loaded, to make
// sure that its commands will appear in the Artisan list.
if (empty($command)) {
$this->registeredConsoleCommand = true;
return true;
}
$patterns = $this->getCmsEnabledArtisanPatterns();
foreach ($patterns as $pattern) {
if ($command === $pattern || Str::is($pattern, $command)) {
$this->registeredConsoleCommand = true;
return true;
}
}
$this->registeredConsoleCommand = false;
return false;
} | php | protected function isCmsEnabledArtisanCommand()
{
if (null !== $this->registeredConsoleCommand) {
// @codeCoverageIgnoreStart
return $this->registeredConsoleCommand;
// @codeCoverageIgnoreEnd
}
if ( ! $this->isConsole()) {
$this->registeredConsoleCommand = false;
return false;
}
$command = $this->getArtisanBaseCommand();
// If no command is given, the CMS will be loaded, to make
// sure that its commands will appear in the Artisan list.
if (empty($command)) {
$this->registeredConsoleCommand = true;
return true;
}
$patterns = $this->getCmsEnabledArtisanPatterns();
foreach ($patterns as $pattern) {
if ($command === $pattern || Str::is($pattern, $command)) {
$this->registeredConsoleCommand = true;
return true;
}
}
$this->registeredConsoleCommand = false;
return false;
} | [
"protected",
"function",
"isCmsEnabledArtisanCommand",
"(",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"registeredConsoleCommand",
")",
"{",
"// @codeCoverageIgnoreStart",
"return",
"$",
"this",
"->",
"registeredConsoleCommand",
";",
"// @codeCoverageIgnoreE... | Returns whether running an Artisan command that requires full CMS registration.
@return bool | [
"Returns",
"whether",
"running",
"an",
"Artisan",
"command",
"that",
"requires",
"full",
"CMS",
"registration",
"."
] | 55a800c73e92390b4ef8268633ac96cd888e23b3 | https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Core/BootChecker.php#L248-L281 |
41,444 | widoz/twig-wordpress | src/Factory.php | Factory.create | public function create(): \Twig\Environment
{
$twig = new \Twig\Environment($this->loader, $this->options);
$modules = (new Provider($twig))->modules();
foreach ($modules as $module) {
if (!$module instanceof Module\Injectable) {
continue;
}
// Add the module into Twig.
$module->injectInto($twig);
}
return $twig;
} | php | public function create(): \Twig\Environment
{
$twig = new \Twig\Environment($this->loader, $this->options);
$modules = (new Provider($twig))->modules();
foreach ($modules as $module) {
if (!$module instanceof Module\Injectable) {
continue;
}
// Add the module into Twig.
$module->injectInto($twig);
}
return $twig;
} | [
"public",
"function",
"create",
"(",
")",
":",
"\\",
"Twig",
"\\",
"Environment",
"{",
"$",
"twig",
"=",
"new",
"\\",
"Twig",
"\\",
"Environment",
"(",
"$",
"this",
"->",
"loader",
",",
"$",
"this",
"->",
"options",
")",
";",
"$",
"modules",
"=",
"... | Create Instance of Twig Environment
@since 1.0.0
@return \Twig\Environment The new instance of the environment | [
"Create",
"Instance",
"of",
"Twig",
"Environment"
] | c9c01400f7b4c5e0f1a3d3754444d8f739655c8a | https://github.com/widoz/twig-wordpress/blob/c9c01400f7b4c5e0f1a3d3754444d8f739655c8a/src/Factory.php#L65-L80 |
41,445 | Jyxon/GDPR-Cookie-Compliance | src/Cookie/Manager.php | Manager.setCookie | public function setCookie(
string $scope,
string $name,
string $value = "",
int $expire = 0,
string $path = "",
string $domain = "",
bool $secure = false,
bool $httponly = false
): bool {
if ($this->canSet($scope)) {
return setcookie($name, $value, $expire, $path, $domain, $secure, $httponly);
}
if (isset($_COOKIE[$name])) {
return setcookie($name, "", time() - 360, $path, $domain, $secure, $httponly);
}
return false;
} | php | public function setCookie(
string $scope,
string $name,
string $value = "",
int $expire = 0,
string $path = "",
string $domain = "",
bool $secure = false,
bool $httponly = false
): bool {
if ($this->canSet($scope)) {
return setcookie($name, $value, $expire, $path, $domain, $secure, $httponly);
}
if (isset($_COOKIE[$name])) {
return setcookie($name, "", time() - 360, $path, $domain, $secure, $httponly);
}
return false;
} | [
"public",
"function",
"setCookie",
"(",
"string",
"$",
"scope",
",",
"string",
"$",
"name",
",",
"string",
"$",
"value",
"=",
"\"\"",
",",
"int",
"$",
"expire",
"=",
"0",
",",
"string",
"$",
"path",
"=",
"\"\"",
",",
"string",
"$",
"domain",
"=",
"... | Send a cookie if there is consent. Also deletes cookies for which is no longer consent.
@param string $scope
@param string $name
@param string $value
@param integer $expire
@param string $path
@param string $domain
@param boolean $secure
@param boolean $httponly
@return bool
@SuppressWarnings(PHPMD.Superglobals)
@SuppressWarnings(PHPMD.BooleanArgumentFlag) | [
"Send",
"a",
"cookie",
"if",
"there",
"is",
"consent",
".",
"Also",
"deletes",
"cookies",
"for",
"which",
"is",
"no",
"longer",
"consent",
"."
] | f71191ae3cf7fb06ada8946fc890bcbce874499c | https://github.com/Jyxon/GDPR-Cookie-Compliance/blob/f71191ae3cf7fb06ada8946fc890bcbce874499c/src/Cookie/Manager.php#L58-L77 |
41,446 | Jyxon/GDPR-Cookie-Compliance | src/Cookie/Manager.php | Manager.getCookie | public function getCookie(
string $scope,
string $name,
string $path = "",
string $domain = "",
bool $secure = false,
bool $httponly = false
) {
if (isset($_COOKIE[$name])) {
if ($this->canSet($scope)) {
return $_COOKIE[$name];
}
setcookie($name, "", time() - 360, $path, $domain, $secure, $httponly);
}
return null;
} | php | public function getCookie(
string $scope,
string $name,
string $path = "",
string $domain = "",
bool $secure = false,
bool $httponly = false
) {
if (isset($_COOKIE[$name])) {
if ($this->canSet($scope)) {
return $_COOKIE[$name];
}
setcookie($name, "", time() - 360, $path, $domain, $secure, $httponly);
}
return null;
} | [
"public",
"function",
"getCookie",
"(",
"string",
"$",
"scope",
",",
"string",
"$",
"name",
",",
"string",
"$",
"path",
"=",
"\"\"",
",",
"string",
"$",
"domain",
"=",
"\"\"",
",",
"bool",
"$",
"secure",
"=",
"false",
",",
"bool",
"$",
"httponly",
"=... | Fetch a cookie if there is consent. Also deletes cookies for which is no longer consent.
@param string $scope
@param string $name
@param string $path
@param string $domain
@param boolean $secure
@param boolean $httponly
@return mixed
@SuppressWarnings(PHPMD.Superglobals)
@SuppressWarnings(PHPMD.BooleanArgumentFlag) | [
"Fetch",
"a",
"cookie",
"if",
"there",
"is",
"consent",
".",
"Also",
"deletes",
"cookies",
"for",
"which",
"is",
"no",
"longer",
"consent",
"."
] | f71191ae3cf7fb06ada8946fc890bcbce874499c | https://github.com/Jyxon/GDPR-Cookie-Compliance/blob/f71191ae3cf7fb06ada8946fc890bcbce874499c/src/Cookie/Manager.php#L94-L111 |
41,447 | tasmanianfox/MpdfPortBundle | Service/MpdfService.php | MpdfService.getMpdf | public function getMpdf($constructorArgs = array())
{
$allConstructorArgs = $constructorArgs;
if($this->getAddDefaultConstructorArgs()) {
$allConstructorArgs = array(array_merge(array('utf-8', 'A4'), $allConstructorArgs));
}
$reflection = new \ReflectionClass('Mpdf\Mpdf');
$mpdf = $reflection->newInstanceArgs($allConstructorArgs);
return $mpdf;
} | php | public function getMpdf($constructorArgs = array())
{
$allConstructorArgs = $constructorArgs;
if($this->getAddDefaultConstructorArgs()) {
$allConstructorArgs = array(array_merge(array('utf-8', 'A4'), $allConstructorArgs));
}
$reflection = new \ReflectionClass('Mpdf\Mpdf');
$mpdf = $reflection->newInstanceArgs($allConstructorArgs);
return $mpdf;
} | [
"public",
"function",
"getMpdf",
"(",
"$",
"constructorArgs",
"=",
"array",
"(",
")",
")",
"{",
"$",
"allConstructorArgs",
"=",
"$",
"constructorArgs",
";",
"if",
"(",
"$",
"this",
"->",
"getAddDefaultConstructorArgs",
"(",
")",
")",
"{",
"$",
"allConstructo... | Get an instance of mPDF class
@param array $constructorArgs arguments for mPDF constror
@return \mPDF | [
"Get",
"an",
"instance",
"of",
"mPDF",
"class"
] | 5c12c67f90273fd3cff0a83576cc3cb3edfb85a5 | https://github.com/tasmanianfox/MpdfPortBundle/blob/5c12c67f90273fd3cff0a83576cc3cb3edfb85a5/Service/MpdfService.php#L16-L27 |
41,448 | tasmanianfox/MpdfPortBundle | Service/MpdfService.php | MpdfService.generatePdfResponse | public function generatePdfResponse($html, array $argOptions = array())
{
$response = new Response();
$response->headers->set('Content-Type', 'application/pdf');
$content = $this->generatePdf($html, $argOptions);
$response->setContent($content);
return $response;
} | php | public function generatePdfResponse($html, array $argOptions = array())
{
$response = new Response();
$response->headers->set('Content-Type', 'application/pdf');
$content = $this->generatePdf($html, $argOptions);
$response->setContent($content);
return $response;
} | [
"public",
"function",
"generatePdfResponse",
"(",
"$",
"html",
",",
"array",
"$",
"argOptions",
"=",
"array",
"(",
")",
")",
"{",
"$",
"response",
"=",
"new",
"Response",
"(",
")",
";",
"$",
"response",
"->",
"headers",
"->",
"set",
"(",
"'Content-Type'"... | Generates an instance of Response class with PDF document
@param string $html
@param array $argOptions | [
"Generates",
"an",
"instance",
"of",
"Response",
"class",
"with",
"PDF",
"document"
] | 5c12c67f90273fd3cff0a83576cc3cb3edfb85a5 | https://github.com/tasmanianfox/MpdfPortBundle/blob/5c12c67f90273fd3cff0a83576cc3cb3edfb85a5/Service/MpdfService.php#L77-L86 |
41,449 | captioning/captioning | src/Captioning/File.php | File.addCue | public function addCue($_mixed, $_start = null, $_stop = null)
{
$fileFormat = self::getFormat($this);
// if $_mixed is a Cue
if (is_object($_mixed) && class_exists(get_class($_mixed)) && class_exists(__NAMESPACE__.'\Cue') && is_subclass_of($_mixed, __NAMESPACE__.'\Cue')) {
$cueFormat = Cue::getFormat($_mixed);
if ($cueFormat !== $fileFormat) {
throw new \Exception("Can't add a $cueFormat cue in a $fileFormat file.");
}
$_mixed->setLineEnding($this->lineEnding);
$this->cues[] = $_mixed;
} else {
$cueClass = self::getExpectedCueClass($this);
$cue = new $cueClass($_start, $_stop, $_mixed);
$cue->setLineEnding($this->lineEnding);
$this->cues[] = $cue;
}
return $this;
} | php | public function addCue($_mixed, $_start = null, $_stop = null)
{
$fileFormat = self::getFormat($this);
// if $_mixed is a Cue
if (is_object($_mixed) && class_exists(get_class($_mixed)) && class_exists(__NAMESPACE__.'\Cue') && is_subclass_of($_mixed, __NAMESPACE__.'\Cue')) {
$cueFormat = Cue::getFormat($_mixed);
if ($cueFormat !== $fileFormat) {
throw new \Exception("Can't add a $cueFormat cue in a $fileFormat file.");
}
$_mixed->setLineEnding($this->lineEnding);
$this->cues[] = $_mixed;
} else {
$cueClass = self::getExpectedCueClass($this);
$cue = new $cueClass($_start, $_stop, $_mixed);
$cue->setLineEnding($this->lineEnding);
$this->cues[] = $cue;
}
return $this;
} | [
"public",
"function",
"addCue",
"(",
"$",
"_mixed",
",",
"$",
"_start",
"=",
"null",
",",
"$",
"_stop",
"=",
"null",
")",
"{",
"$",
"fileFormat",
"=",
"self",
"::",
"getFormat",
"(",
"$",
"this",
")",
";",
"// if $_mixed is a Cue",
"if",
"(",
"is_objec... | Add a cue
@param mixed $_mixed An cue instance or a string representing the text
@param string $_start A timecode
@param string $_stop A timecode
@throws \Exception
@return File | [
"Add",
"a",
"cue"
] | d830685b5a942b944d06d97a86eddc8de032e2c1 | https://github.com/captioning/captioning/blob/d830685b5a942b944d06d97a86eddc8de032e2c1/src/Captioning/File.php#L322-L342 |
41,450 | captioning/captioning | src/Captioning/File.php | File.removeCue | public function removeCue($_index)
{
if (isset($this->cues[$_index])) {
unset($this->cues[$_index]);
}
return $this;
} | php | public function removeCue($_index)
{
if (isset($this->cues[$_index])) {
unset($this->cues[$_index]);
}
return $this;
} | [
"public",
"function",
"removeCue",
"(",
"$",
"_index",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"cues",
"[",
"$",
"_index",
"]",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"cues",
"[",
"$",
"_index",
"]",
")",
";",
"}",
"retur... | Removes a cue
@param int $_index
@return File | [
"Removes",
"a",
"cue"
] | d830685b5a942b944d06d97a86eddc8de032e2c1 | https://github.com/captioning/captioning/blob/d830685b5a942b944d06d97a86eddc8de032e2c1/src/Captioning/File.php#L350-L357 |
41,451 | captioning/captioning | src/Captioning/File.php | File.changeFPS | public function changeFPS($_old_fps, $_new_fps)
{
$cuesCount = $this->getCuesCount();
for ($i = 0; $i < $cuesCount; $i++) {
$cue = $this->getCue($i);
$old_start = $cue->getStart();
$old_stop = $cue->getStop();
$new_start = $old_start * ($_new_fps / $_old_fps);
$new_stop = $old_stop * ($_new_fps / $_old_fps);
$cue->setStart($new_start);
$cue->setStop($new_stop);
}
return $this;
} | php | public function changeFPS($_old_fps, $_new_fps)
{
$cuesCount = $this->getCuesCount();
for ($i = 0; $i < $cuesCount; $i++) {
$cue = $this->getCue($i);
$old_start = $cue->getStart();
$old_stop = $cue->getStop();
$new_start = $old_start * ($_new_fps / $_old_fps);
$new_stop = $old_stop * ($_new_fps / $_old_fps);
$cue->setStart($new_start);
$cue->setStop($new_stop);
}
return $this;
} | [
"public",
"function",
"changeFPS",
"(",
"$",
"_old_fps",
",",
"$",
"_new_fps",
")",
"{",
"$",
"cuesCount",
"=",
"$",
"this",
"->",
"getCuesCount",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"cuesCount",
";",
"$",
"i",... | Converts timecodes based on the specified FPS ratio
@param float $_old_fps
@param float $_new_fps
@return File | [
"Converts",
"timecodes",
"based",
"on",
"the",
"specified",
"FPS",
"ratio"
] | d830685b5a942b944d06d97a86eddc8de032e2c1 | https://github.com/captioning/captioning/blob/d830685b5a942b944d06d97a86eddc8de032e2c1/src/Captioning/File.php#L393-L410 |
41,452 | captioning/captioning | src/Captioning/File.php | File.shift | public function shift($_time, $_startIndex = null, $_endIndex = null)
{
if (!is_int($_time)) {
return false;
}
if ($_time == 0) {
return true;
}
if (null === $_startIndex) {
$_startIndex = 0;
}
if (null === $_endIndex) {
$_endIndex = $this->getCuesCount() - 1;
}
$startCue = $this->getCue($_startIndex);
$endCue = $this->getCue($_endIndex);
//check subtitles do exist
if (!$startCue || !$endCue) {
return false;
}
for ($i = $_startIndex; $i <= $_endIndex; $i++) {
$cue = $this->getCue($i);
$cue->shift($_time);
}
return true;
} | php | public function shift($_time, $_startIndex = null, $_endIndex = null)
{
if (!is_int($_time)) {
return false;
}
if ($_time == 0) {
return true;
}
if (null === $_startIndex) {
$_startIndex = 0;
}
if (null === $_endIndex) {
$_endIndex = $this->getCuesCount() - 1;
}
$startCue = $this->getCue($_startIndex);
$endCue = $this->getCue($_endIndex);
//check subtitles do exist
if (!$startCue || !$endCue) {
return false;
}
for ($i = $_startIndex; $i <= $_endIndex; $i++) {
$cue = $this->getCue($i);
$cue->shift($_time);
}
return true;
} | [
"public",
"function",
"shift",
"(",
"$",
"_time",
",",
"$",
"_startIndex",
"=",
"null",
",",
"$",
"_endIndex",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_int",
"(",
"$",
"_time",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"_time"... | Shifts a range of subtitles a specified amount of time.
@param int $_time The time to use (ms), which can be positive or negative.
@param int $_startIndex The subtitle index the range begins with.
@param int $_endIndex The subtitle index the range ends with. | [
"Shifts",
"a",
"range",
"of",
"subtitles",
"a",
"specified",
"amount",
"of",
"time",
"."
] | d830685b5a942b944d06d97a86eddc8de032e2c1 | https://github.com/captioning/captioning/blob/d830685b5a942b944d06d97a86eddc8de032e2c1/src/Captioning/File.php#L436-L466 |
41,453 | captioning/captioning | src/Captioning/File.php | File.sync | public function sync($_startIndex, $_startTime, $_endIndex, $_endTime, $_syncLast = true)
{
//set first and last subtitles index
if (!$_startIndex) {
$_startIndex = 0;
}
if (!$_endIndex) {
$_endIndex = $this->getCuesCount() - 1;
}
if (!$_syncLast) {
$_endIndex--;
}
//check subtitles do exist
$startSubtitle = $this->getCue($_startIndex);
$endSubtitle = $this->getCue($_endIndex);
if (!$startSubtitle || !$endSubtitle || ($_startTime >= $_endTime)) {
return false;
}
$shift = $_startTime - $startSubtitle->getStartMS();
$factor = ($_endTime - $_startTime) / ($endSubtitle->getStartMS() - $startSubtitle->getStartMS());
/* Shift subtitles to the start point */
if ($shift) {
$this->shift($shift, $_startIndex, $_endIndex);
}
/* Sync timings with proportion */
for ($index = $_startIndex; $index <= $_endIndex; $index++) {
$cue = $this->getCue($index);
$cue->scale($_startTime, $factor);
}
return true;
} | php | public function sync($_startIndex, $_startTime, $_endIndex, $_endTime, $_syncLast = true)
{
//set first and last subtitles index
if (!$_startIndex) {
$_startIndex = 0;
}
if (!$_endIndex) {
$_endIndex = $this->getCuesCount() - 1;
}
if (!$_syncLast) {
$_endIndex--;
}
//check subtitles do exist
$startSubtitle = $this->getCue($_startIndex);
$endSubtitle = $this->getCue($_endIndex);
if (!$startSubtitle || !$endSubtitle || ($_startTime >= $_endTime)) {
return false;
}
$shift = $_startTime - $startSubtitle->getStartMS();
$factor = ($_endTime - $_startTime) / ($endSubtitle->getStartMS() - $startSubtitle->getStartMS());
/* Shift subtitles to the start point */
if ($shift) {
$this->shift($shift, $_startIndex, $_endIndex);
}
/* Sync timings with proportion */
for ($index = $_startIndex; $index <= $_endIndex; $index++) {
$cue = $this->getCue($index);
$cue->scale($_startTime, $factor);
}
return true;
} | [
"public",
"function",
"sync",
"(",
"$",
"_startIndex",
",",
"$",
"_startTime",
",",
"$",
"_endIndex",
",",
"$",
"_endTime",
",",
"$",
"_syncLast",
"=",
"true",
")",
"{",
"//set first and last subtitles index",
"if",
"(",
"!",
"$",
"_startIndex",
")",
"{",
... | Auto syncs a range of subtitles given their first and last correct times.
The subtitles are first shifted to the first subtitle's correct time, and then proportionally
adjusted using the last subtitle's correct time.
Based on gnome-subtitles (https://git.gnome.org/browse/gnome-subtitles/)
@param int $_startIndex The subtitle index to start the adjustment with.
@param int $_startTime The correct start time for the first subtitle.
@param int $_endIndex The subtitle index to end the adjustment with.
@param int $_endTime The correct start time for the last subtitle.
@param bool $_syncLast Whether to sync the last subtitle.
@return bool Whether the subtitles could be adjusted | [
"Auto",
"syncs",
"a",
"range",
"of",
"subtitles",
"given",
"their",
"first",
"and",
"last",
"correct",
"times",
".",
"The",
"subtitles",
"are",
"first",
"shifted",
"to",
"the",
"first",
"subtitle",
"s",
"correct",
"time",
"and",
"then",
"proportionally",
"ad... | d830685b5a942b944d06d97a86eddc8de032e2c1 | https://github.com/captioning/captioning/blob/d830685b5a942b944d06d97a86eddc8de032e2c1/src/Captioning/File.php#L482-L517 |
41,454 | captioning/captioning | src/Captioning/File.php | File.getStats | public function getStats()
{
$this->stats = array(
'tooSlow' => 0,
'slowAcceptable' => 0,
'aBitSlow' => 0,
'goodSlow' => 0,
'perfect' => 0,
'goodFast' => 0,
'aBitFast' => 0,
'fastAcceptable' => 0,
'tooFast' => 0
);
$cuesCount = $this->getCuesCount();
for ($i = 0; $i < $cuesCount; $i++) {
$rs = $this->getCue($i)->getReadingSpeed();
if ($rs < 5) {
$this->stats['tooSlow']++;
} elseif ($rs < 10) {
$this->stats['slowAcceptable']++;
} elseif ($rs < 13) {
$this->stats['aBitSlow']++;
} elseif ($rs < 15) {
$this->stats['goodSlow']++;
} elseif ($rs < 23) {
$this->stats['perfect']++;
} elseif ($rs < 27) {
$this->stats['goodFast']++;
} elseif ($rs < 31) {
$this->stats['aBitFast']++;
} elseif ($rs < 35) {
$this->stats['fastAcceptable']++;
} else {
$this->stats['tooFast']++;
}
}
return $this->stats;
} | php | public function getStats()
{
$this->stats = array(
'tooSlow' => 0,
'slowAcceptable' => 0,
'aBitSlow' => 0,
'goodSlow' => 0,
'perfect' => 0,
'goodFast' => 0,
'aBitFast' => 0,
'fastAcceptable' => 0,
'tooFast' => 0
);
$cuesCount = $this->getCuesCount();
for ($i = 0; $i < $cuesCount; $i++) {
$rs = $this->getCue($i)->getReadingSpeed();
if ($rs < 5) {
$this->stats['tooSlow']++;
} elseif ($rs < 10) {
$this->stats['slowAcceptable']++;
} elseif ($rs < 13) {
$this->stats['aBitSlow']++;
} elseif ($rs < 15) {
$this->stats['goodSlow']++;
} elseif ($rs < 23) {
$this->stats['perfect']++;
} elseif ($rs < 27) {
$this->stats['goodFast']++;
} elseif ($rs < 31) {
$this->stats['aBitFast']++;
} elseif ($rs < 35) {
$this->stats['fastAcceptable']++;
} else {
$this->stats['tooFast']++;
}
}
return $this->stats;
} | [
"public",
"function",
"getStats",
"(",
")",
"{",
"$",
"this",
"->",
"stats",
"=",
"array",
"(",
"'tooSlow'",
"=>",
"0",
",",
"'slowAcceptable'",
"=>",
"0",
",",
"'aBitSlow'",
"=>",
"0",
",",
"'goodSlow'",
"=>",
"0",
",",
"'perfect'",
"=>",
"0",
",",
... | Computes reading speed statistics | [
"Computes",
"reading",
"speed",
"statistics"
] | d830685b5a942b944d06d97a86eddc8de032e2c1 | https://github.com/captioning/captioning/blob/d830685b5a942b944d06d97a86eddc8de032e2c1/src/Captioning/File.php#L567-L607 |
41,455 | captioning/captioning | src/Captioning/File.php | File.encode | protected function encode()
{
if ($this->useIconv) {
$this->fileContent = iconv($this->encoding, 'UTF-8', $this->fileContent);
} else {
$this->fileContent = mb_convert_encoding($this->fileContent, 'UTF-8', $this->encoding);
}
} | php | protected function encode()
{
if ($this->useIconv) {
$this->fileContent = iconv($this->encoding, 'UTF-8', $this->fileContent);
} else {
$this->fileContent = mb_convert_encoding($this->fileContent, 'UTF-8', $this->encoding);
}
} | [
"protected",
"function",
"encode",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"useIconv",
")",
"{",
"$",
"this",
"->",
"fileContent",
"=",
"iconv",
"(",
"$",
"this",
"->",
"encoding",
",",
"'UTF-8'",
",",
"$",
"this",
"->",
"fileContent",
")",
";",... | Encode file content | [
"Encode",
"file",
"content"
] | d830685b5a942b944d06d97a86eddc8de032e2c1 | https://github.com/captioning/captioning/blob/d830685b5a942b944d06d97a86eddc8de032e2c1/src/Captioning/File.php#L661-L668 |
41,456 | captioning/captioning | src/Captioning/Format/SubripCue.php | SubripCue.getStrippedText | public function getStrippedText($_stripBasic = false, $_replacements = array())
{
$text = $this->text;
if ($_stripBasic) {
$text = strip_tags($text);
}
$patterns = "/{[^}]+}/";
$repl = "";
$text = preg_replace($patterns, $repl, $text);
if (count($_replacements) > 0) {
$text = str_replace(array_keys($_replacements), array_values($_replacements), $text);
$text = iconv('UTF-8', 'UTF-8//IGNORE', $text);
}
return $text;
} | php | public function getStrippedText($_stripBasic = false, $_replacements = array())
{
$text = $this->text;
if ($_stripBasic) {
$text = strip_tags($text);
}
$patterns = "/{[^}]+}/";
$repl = "";
$text = preg_replace($patterns, $repl, $text);
if (count($_replacements) > 0) {
$text = str_replace(array_keys($_replacements), array_values($_replacements), $text);
$text = iconv('UTF-8', 'UTF-8//IGNORE', $text);
}
return $text;
} | [
"public",
"function",
"getStrippedText",
"(",
"$",
"_stripBasic",
"=",
"false",
",",
"$",
"_replacements",
"=",
"array",
"(",
")",
")",
"{",
"$",
"text",
"=",
"$",
"this",
"->",
"text",
";",
"if",
"(",
"$",
"_stripBasic",
")",
"{",
"$",
"text",
"=",
... | Return the text without Advanced SSA tags
@param boolean $_stripBasic If true, <i>, <b> and <u> tags will be stripped
@param array $_replacements
@return string | [
"Return",
"the",
"text",
"without",
"Advanced",
"SSA",
"tags"
] | d830685b5a942b944d06d97a86eddc8de032e2c1 | https://github.com/captioning/captioning/blob/d830685b5a942b944d06d97a86eddc8de032e2c1/src/Captioning/Format/SubripCue.php#L46-L64 |
41,457 | captioning/captioning | src/Captioning/Format/SubripFile.php | SubripFile.cleanUpTimecode | private function cleanUpTimecode($timecode)
{
strpos($timecode, ',') ?: $timecode .= ',000';
$patternNoLeadingZeroes = '/(?:(?<=\:)|^)\d(?=(:|,))/';
return preg_replace_callback($patternNoLeadingZeroes, function($matches)
{
return sprintf('%02d', $matches[0]);
}, $timecode);
} | php | private function cleanUpTimecode($timecode)
{
strpos($timecode, ',') ?: $timecode .= ',000';
$patternNoLeadingZeroes = '/(?:(?<=\:)|^)\d(?=(:|,))/';
return preg_replace_callback($patternNoLeadingZeroes, function($matches)
{
return sprintf('%02d', $matches[0]);
}, $timecode);
} | [
"private",
"function",
"cleanUpTimecode",
"(",
"$",
"timecode",
")",
"{",
"strpos",
"(",
"$",
"timecode",
",",
"','",
")",
"?",
":",
"$",
"timecode",
".=",
"',000'",
";",
"$",
"patternNoLeadingZeroes",
"=",
"'/(?:(?<=\\:)|^)\\d(?=(:|,))/'",
";",
"return",
"pre... | Add milliseconds and leading zeroes if they are missing
@param $timecode
@return mixed | [
"Add",
"milliseconds",
"and",
"leading",
"zeroes",
"if",
"they",
"are",
"missing"
] | d830685b5a942b944d06d97a86eddc8de032e2c1 | https://github.com/captioning/captioning/blob/d830685b5a942b944d06d97a86eddc8de032e2c1/src/Captioning/Format/SubripFile.php#L254-L264 |
41,458 | Torann/remote-model | src/Torann/RemoteModel/Model.php | Model.getEndpoint | public function getEndpoint()
{
if (is_null($this->endpoint)) {
$this->endpoint = str_replace('\\', '', snake_case(str_plural(class_basename($this))));
}
return $this->endpoint;
} | php | public function getEndpoint()
{
if (is_null($this->endpoint)) {
$this->endpoint = str_replace('\\', '', snake_case(str_plural(class_basename($this))));
}
return $this->endpoint;
} | [
"public",
"function",
"getEndpoint",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"endpoint",
")",
")",
"{",
"$",
"this",
"->",
"endpoint",
"=",
"str_replace",
"(",
"'\\\\'",
",",
"''",
",",
"snake_case",
"(",
"str_plural",
"(",
"class_... | Get API endpoint.
@return string | [
"Get",
"API",
"endpoint",
"."
] | ac855fee4b4460297f0a5bbf86895c837188f8d3 | https://github.com/Torann/remote-model/blob/ac855fee4b4460297f0a5bbf86895c837188f8d3/src/Torann/RemoteModel/Model.php#L312-L319 |
41,459 | Torann/remote-model | src/Torann/RemoteModel/Model.php | Model.paginateHydrate | public function paginateHydrate($result, $modelClass = null)
{
// Get values
$pagination = array_get($result, 'pagination', []);
$items = array_get($result, 'items', []);
$page = LengthAwarePaginator::resolveCurrentPage();
// Set pagination
$perPage = array_get($pagination, 'perPage', array_get($pagination, 'per_page', 15));
$total = array_get($pagination, 'total', null);
// Set options
$options = is_array($result) ? array_except($result, [
'pagination',
'items',
'next',
'per_page',
'last'
]) : [];
return new LengthAwarePaginator($this->hydrate($items, $modelClass), $total, $perPage, $page,
array_merge($options, [
'path' => LengthAwarePaginator::resolveCurrentPath()
]));
} | php | public function paginateHydrate($result, $modelClass = null)
{
// Get values
$pagination = array_get($result, 'pagination', []);
$items = array_get($result, 'items', []);
$page = LengthAwarePaginator::resolveCurrentPage();
// Set pagination
$perPage = array_get($pagination, 'perPage', array_get($pagination, 'per_page', 15));
$total = array_get($pagination, 'total', null);
// Set options
$options = is_array($result) ? array_except($result, [
'pagination',
'items',
'next',
'per_page',
'last'
]) : [];
return new LengthAwarePaginator($this->hydrate($items, $modelClass), $total, $perPage, $page,
array_merge($options, [
'path' => LengthAwarePaginator::resolveCurrentPath()
]));
} | [
"public",
"function",
"paginateHydrate",
"(",
"$",
"result",
",",
"$",
"modelClass",
"=",
"null",
")",
"{",
"// Get values",
"$",
"pagination",
"=",
"array_get",
"(",
"$",
"result",
",",
"'pagination'",
",",
"[",
"]",
")",
";",
"$",
"items",
"=",
"array_... | Paginate items.
@param array $result
@param string $modelClass
@return \Illuminate\Pagination\LengthAwarePaginator | [
"Paginate",
"items",
"."
] | ac855fee4b4460297f0a5bbf86895c837188f8d3 | https://github.com/Torann/remote-model/blob/ac855fee4b4460297f0a5bbf86895c837188f8d3/src/Torann/RemoteModel/Model.php#L425-L449 |
41,460 | Torann/remote-model | src/Torann/RemoteModel/Model.php | Model.all | public static function all(array $params = [])
{
// Remove empty params
$params = array_filter($params);
$instance = new static([], static::getParentID());
// Make request
$result = $instance->makeRequest($instance->getEndpoint(), 'all', [$params]);
// Hydrate object
$result = $instance->paginateHydrate($result);
// Append search params
$result->appends($params);
return $result;
} | php | public static function all(array $params = [])
{
// Remove empty params
$params = array_filter($params);
$instance = new static([], static::getParentID());
// Make request
$result = $instance->makeRequest($instance->getEndpoint(), 'all', [$params]);
// Hydrate object
$result = $instance->paginateHydrate($result);
// Append search params
$result->appends($params);
return $result;
} | [
"public",
"static",
"function",
"all",
"(",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"// Remove empty params",
"$",
"params",
"=",
"array_filter",
"(",
"$",
"params",
")",
";",
"$",
"instance",
"=",
"new",
"static",
"(",
"[",
"]",
",",
"static"... | Make an all paginated request.
@param array $params
@return \Illuminate\Pagination\LengthAwarePaginator | [
"Make",
"an",
"all",
"paginated",
"request",
"."
] | ac855fee4b4460297f0a5bbf86895c837188f8d3 | https://github.com/Torann/remote-model/blob/ac855fee4b4460297f0a5bbf86895c837188f8d3/src/Torann/RemoteModel/Model.php#L486-L503 |
41,461 | Torann/remote-model | src/Torann/RemoteModel/Model.php | Model.findOrFail | public static function findOrFail($id, array $params = [])
{
$instance = new static([], static::getParentID());
// Make request
if (!is_null($result = $instance->request($instance->getEndpoint(), 'find', [$id, $params]))) {
return $result;
}
// Not found
throw new NotFoundException;
} | php | public static function findOrFail($id, array $params = [])
{
$instance = new static([], static::getParentID());
// Make request
if (!is_null($result = $instance->request($instance->getEndpoint(), 'find', [$id, $params]))) {
return $result;
}
// Not found
throw new NotFoundException;
} | [
"public",
"static",
"function",
"findOrFail",
"(",
"$",
"id",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"instance",
"=",
"new",
"static",
"(",
"[",
"]",
",",
"static",
"::",
"getParentID",
"(",
")",
")",
";",
"// Make request",
"if",... | Find a model by its primary key or throw an exception
@param string $id
@param array $params
@return mixed|static
@throws \Torann\RemoteModel\NotFoundException | [
"Find",
"a",
"model",
"by",
"its",
"primary",
"key",
"or",
"throw",
"an",
"exception"
] | ac855fee4b4460297f0a5bbf86895c837188f8d3 | https://github.com/Torann/remote-model/blob/ac855fee4b4460297f0a5bbf86895c837188f8d3/src/Torann/RemoteModel/Model.php#L542-L553 |
41,462 | Torann/remote-model | src/Torann/RemoteModel/Model.php | Model.performCreate | protected function performCreate(array $options = [])
{
if ($this->fireModelEvent('creating') === false) {
return false;
}
$params = $this->setKeysForSave();
$results = $this->makeRequest($this->getEndpoint(), 'create', [$params]);
// Creation failed
if (is_array($results) === false) {
return false;
}
// Fresh start
$this->attributes = [];
// Update model with new data
$this->fill($results);
// We will go ahead and set the exists property to true, so that it is set when
// the created event is fired, just in case the developer tries to update it
// during the event. This will allow them to do so and run an update here.
$this->exists = true;
$this->fireModelEvent('created', false);
return true;
} | php | protected function performCreate(array $options = [])
{
if ($this->fireModelEvent('creating') === false) {
return false;
}
$params = $this->setKeysForSave();
$results = $this->makeRequest($this->getEndpoint(), 'create', [$params]);
// Creation failed
if (is_array($results) === false) {
return false;
}
// Fresh start
$this->attributes = [];
// Update model with new data
$this->fill($results);
// We will go ahead and set the exists property to true, so that it is set when
// the created event is fired, just in case the developer tries to update it
// during the event. This will allow them to do so and run an update here.
$this->exists = true;
$this->fireModelEvent('created', false);
return true;
} | [
"protected",
"function",
"performCreate",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"fireModelEvent",
"(",
"'creating'",
")",
"===",
"false",
")",
"{",
"return",
"false",
";",
"}",
"$",
"params",
"=",
"$",
"... | Perform a model create operation.
@param array $options
@return bool | [
"Perform",
"a",
"model",
"create",
"operation",
"."
] | ac855fee4b4460297f0a5bbf86895c837188f8d3 | https://github.com/Torann/remote-model/blob/ac855fee4b4460297f0a5bbf86895c837188f8d3/src/Torann/RemoteModel/Model.php#L802-L831 |
41,463 | Torann/remote-model | src/Torann/RemoteModel/Model.php | Model.setKeysForSave | protected function setKeysForSave()
{
// Convert objects to array
$params = array_map(function($value) {
if (is_object($value)
&& !($value instanceof UploadedFile)
&& is_callable([$value, 'toApi'])) {
return $value->toApi();
}
return $value;
}, $this->toApi());
// Remove dynamic params
return array_except($params, array_merge([static::CREATED_AT, static::UPDATED_AT], [
'id',
'pagination',
]));
} | php | protected function setKeysForSave()
{
// Convert objects to array
$params = array_map(function($value) {
if (is_object($value)
&& !($value instanceof UploadedFile)
&& is_callable([$value, 'toApi'])) {
return $value->toApi();
}
return $value;
}, $this->toApi());
// Remove dynamic params
return array_except($params, array_merge([static::CREATED_AT, static::UPDATED_AT], [
'id',
'pagination',
]));
} | [
"protected",
"function",
"setKeysForSave",
"(",
")",
"{",
"// Convert objects to array",
"$",
"params",
"=",
"array_map",
"(",
"function",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"value",
")",
"&&",
"!",
"(",
"$",
"value",
"instanceo... | Set the keys for a save update request.
@return array | [
"Set",
"the",
"keys",
"for",
"a",
"save",
"update",
"request",
"."
] | ac855fee4b4460297f0a5bbf86895c837188f8d3 | https://github.com/Torann/remote-model/blob/ac855fee4b4460297f0a5bbf86895c837188f8d3/src/Torann/RemoteModel/Model.php#L857-L875 |
41,464 | Torann/remote-model | src/Torann/RemoteModel/Model.php | Model.request | protected function request($endpoint = null, $method, $params)
{
$results = $this->makeRequest($endpoint, $method, $params);
return $results ? $this->newInstance($results, true) : null;
} | php | protected function request($endpoint = null, $method, $params)
{
$results = $this->makeRequest($endpoint, $method, $params);
return $results ? $this->newInstance($results, true) : null;
} | [
"protected",
"function",
"request",
"(",
"$",
"endpoint",
"=",
"null",
",",
"$",
"method",
",",
"$",
"params",
")",
"{",
"$",
"results",
"=",
"$",
"this",
"->",
"makeRequest",
"(",
"$",
"endpoint",
",",
"$",
"method",
",",
"$",
"params",
")",
";",
... | Request through the API client.
@return mixed | [
"Request",
"through",
"the",
"API",
"client",
"."
] | ac855fee4b4460297f0a5bbf86895c837188f8d3 | https://github.com/Torann/remote-model/blob/ac855fee4b4460297f0a5bbf86895c837188f8d3/src/Torann/RemoteModel/Model.php#L1783-L1788 |
41,465 | Torann/remote-model | src/Torann/RemoteModel/Model.php | Model.makeRequest | protected function makeRequest($endpoint = null, $method, $params)
{
$endpoint = $endpoint ?: $this->getEndpoint();
// Prepend relationship, if one exists.
if (static::getParentID()) {
$params = array_merge([
static::getParentID()
], $params);
}
$results = call_user_func_array([static::$client->$endpoint(), $method], $params);
// Set errors from server...if any
$this->messageBag = static::$client->errors();
return $results;
} | php | protected function makeRequest($endpoint = null, $method, $params)
{
$endpoint = $endpoint ?: $this->getEndpoint();
// Prepend relationship, if one exists.
if (static::getParentID()) {
$params = array_merge([
static::getParentID()
], $params);
}
$results = call_user_func_array([static::$client->$endpoint(), $method], $params);
// Set errors from server...if any
$this->messageBag = static::$client->errors();
return $results;
} | [
"protected",
"function",
"makeRequest",
"(",
"$",
"endpoint",
"=",
"null",
",",
"$",
"method",
",",
"$",
"params",
")",
"{",
"$",
"endpoint",
"=",
"$",
"endpoint",
"?",
":",
"$",
"this",
"->",
"getEndpoint",
"(",
")",
";",
"// Prepend relationship, if one ... | Make request through the API client.
@return mixed | [
"Make",
"request",
"through",
"the",
"API",
"client",
"."
] | ac855fee4b4460297f0a5bbf86895c837188f8d3 | https://github.com/Torann/remote-model/blob/ac855fee4b4460297f0a5bbf86895c837188f8d3/src/Torann/RemoteModel/Model.php#L1795-L1812 |
41,466 | Torann/remote-model | src/Torann/RemoteModel/Model.php | Model.registerModelEvent | protected static function registerModelEvent($event, $callback, $priority = 0)
{
$name = get_called_class();
app('events')->listen("eloquent.{$event}: {$name}", $callback, $priority);
} | php | protected static function registerModelEvent($event, $callback, $priority = 0)
{
$name = get_called_class();
app('events')->listen("eloquent.{$event}: {$name}", $callback, $priority);
} | [
"protected",
"static",
"function",
"registerModelEvent",
"(",
"$",
"event",
",",
"$",
"callback",
",",
"$",
"priority",
"=",
"0",
")",
"{",
"$",
"name",
"=",
"get_called_class",
"(",
")",
";",
"app",
"(",
"'events'",
")",
"->",
"listen",
"(",
"\"eloquent... | Register a model event with the dispatcher.
@param string $event
@param \Closure|string $callback
@param int $priority
@return void | [
"Register",
"a",
"model",
"event",
"with",
"the",
"dispatcher",
"."
] | ac855fee4b4460297f0a5bbf86895c837188f8d3 | https://github.com/Torann/remote-model/blob/ac855fee4b4460297f0a5bbf86895c837188f8d3/src/Torann/RemoteModel/Model.php#L1822-L1827 |
41,467 | tyua07/laravel-upload | src/Cos/cos-php-sdk-v4/qcloudcos/auth.php | Auth.createSignature | private static function createSignature(
$appId, $secretId, $secretKey, $expiration, $bucket, $fileId) {
if (empty($secretId) || empty($secretKey)) {
return self::AUTH_SECRET_ID_KEY_ERROR;
}
$now = time();
$random = rand();
$plainText = "a=$appId&k=$secretId&e=$expiration&t=$now&r=$random&f=$fileId&b=$bucket";
$bin = hash_hmac('SHA1', $plainText, $secretKey, true);
$bin = $bin.$plainText;
$signature = base64_encode($bin);
return $signature;
} | php | private static function createSignature(
$appId, $secretId, $secretKey, $expiration, $bucket, $fileId) {
if (empty($secretId) || empty($secretKey)) {
return self::AUTH_SECRET_ID_KEY_ERROR;
}
$now = time();
$random = rand();
$plainText = "a=$appId&k=$secretId&e=$expiration&t=$now&r=$random&f=$fileId&b=$bucket";
$bin = hash_hmac('SHA1', $plainText, $secretKey, true);
$bin = $bin.$plainText;
$signature = base64_encode($bin);
return $signature;
} | [
"private",
"static",
"function",
"createSignature",
"(",
"$",
"appId",
",",
"$",
"secretId",
",",
"$",
"secretKey",
",",
"$",
"expiration",
",",
"$",
"bucket",
",",
"$",
"fileId",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"secretId",
")",
"||",
"empty",
... | A helper function for creating signature.
Return the signature on success.
Return error code if parameter is not valid. | [
"A",
"helper",
"function",
"for",
"creating",
"signature",
".",
"Return",
"the",
"signature",
"on",
"success",
".",
"Return",
"error",
"code",
"if",
"parameter",
"is",
"not",
"valid",
"."
] | d54bad8987c09cc8106e3959c38c1ef975e39013 | https://github.com/tyua07/laravel-upload/blob/d54bad8987c09cc8106e3959c38c1ef975e39013/src/Cos/cos-php-sdk-v4/qcloudcos/auth.php#L70-L85 |
41,468 | awps/font-awesome-php | src/AbstractFontAwesome.php | AbstractFontAwesome.getUnicodeKeys | public function getUnicodeKeys() {
$the_array = $this->icons_array;
if ( is_array( $the_array ) ) {
$temp = array();
foreach ( $the_array as $class => $unicode ) {
$temp[ $class ] = $unicode;
}
$the_array = $temp;
}
return $the_array;
} | php | public function getUnicodeKeys() {
$the_array = $this->icons_array;
if ( is_array( $the_array ) ) {
$temp = array();
foreach ( $the_array as $class => $unicode ) {
$temp[ $class ] = $unicode;
}
$the_array = $temp;
}
return $the_array;
} | [
"public",
"function",
"getUnicodeKeys",
"(",
")",
"{",
"$",
"the_array",
"=",
"$",
"this",
"->",
"icons_array",
";",
"if",
"(",
"is_array",
"(",
"$",
"the_array",
")",
")",
"{",
"$",
"temp",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"the_arra... | Get only the unicode keys
@return array|bool | [
"Get",
"only",
"the",
"unicode",
"keys"
] | 61cfa3f9715b62193d55fc4f4792d213787b9769 | https://github.com/awps/font-awesome-php/blob/61cfa3f9715b62193d55fc4f4792d213787b9769/src/AbstractFontAwesome.php#L83-L97 |
41,469 | awps/font-awesome-php | src/AbstractFontAwesome.php | AbstractFontAwesome.normalizeIconClass | protected function normalizeIconClass( $icon_class ) {
$icon_class = trim( $icon_class );
if ( stripos( $icon_class, 'fa-' ) === false ) {
$icon_class = 'fa-' . $icon_class;
}
return $icon_class;
} | php | protected function normalizeIconClass( $icon_class ) {
$icon_class = trim( $icon_class );
if ( stripos( $icon_class, 'fa-' ) === false ) {
$icon_class = 'fa-' . $icon_class;
}
return $icon_class;
} | [
"protected",
"function",
"normalizeIconClass",
"(",
"$",
"icon_class",
")",
"{",
"$",
"icon_class",
"=",
"trim",
"(",
"$",
"icon_class",
")",
";",
"if",
"(",
"stripos",
"(",
"$",
"icon_class",
",",
"'fa-'",
")",
"===",
"false",
")",
"{",
"$",
"icon_class... | Make sure to have a class that starts with `fa-`.
@param string $icon_class
@return string | [
"Make",
"sure",
"to",
"have",
"a",
"class",
"that",
"starts",
"with",
"fa",
"-",
"."
] | 61cfa3f9715b62193d55fc4f4792d213787b9769 | https://github.com/awps/font-awesome-php/blob/61cfa3f9715b62193d55fc4f4792d213787b9769/src/AbstractFontAwesome.php#L147-L155 |
41,470 | awps/font-awesome-php | src/AbstractFontAwesome.php | AbstractFontAwesome.getIconUnicode | public function getIconUnicode( $icon_class ) {
$icon_class = $this->normalizeIconClass( $icon_class );
$result = false;
if ( ! empty( $this->icons_array ) && array_key_exists( $icon_class, $this->icons_array ) ) {
$result = $this->icons_array[ $icon_class ];
}
return $result;
} | php | public function getIconUnicode( $icon_class ) {
$icon_class = $this->normalizeIconClass( $icon_class );
$result = false;
if ( ! empty( $this->icons_array ) && array_key_exists( $icon_class, $this->icons_array ) ) {
$result = $this->icons_array[ $icon_class ];
}
return $result;
} | [
"public",
"function",
"getIconUnicode",
"(",
"$",
"icon_class",
")",
"{",
"$",
"icon_class",
"=",
"$",
"this",
"->",
"normalizeIconClass",
"(",
"$",
"icon_class",
")",
";",
"$",
"result",
"=",
"false",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"-... | Get the unicode by icon class.
@param string|bool $icon_class
@return bool|string | [
"Get",
"the",
"unicode",
"by",
"icon",
"class",
"."
] | 61cfa3f9715b62193d55fc4f4792d213787b9769 | https://github.com/awps/font-awesome-php/blob/61cfa3f9715b62193d55fc4f4792d213787b9769/src/AbstractFontAwesome.php#L200-L209 |
41,471 | awps/font-awesome-php | src/AbstractFontAwesome.php | AbstractFontAwesome.getIconName | public function getIconName( $icon_class ) {
$icon_class = $this->normalizeIconClass( $icon_class );
$result = false;
if ( ! empty( $this->icons_array ) && array_key_exists( $icon_class, $this->icons_array ) ) {
$result = $this->generateName( $icon_class );
}
return $result;
} | php | public function getIconName( $icon_class ) {
$icon_class = $this->normalizeIconClass( $icon_class );
$result = false;
if ( ! empty( $this->icons_array ) && array_key_exists( $icon_class, $this->icons_array ) ) {
$result = $this->generateName( $icon_class );
}
return $result;
} | [
"public",
"function",
"getIconName",
"(",
"$",
"icon_class",
")",
"{",
"$",
"icon_class",
"=",
"$",
"this",
"->",
"normalizeIconClass",
"(",
"$",
"icon_class",
")",
";",
"$",
"result",
"=",
"false",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",... | Get the readable name by icon class.
@param string|bool $icon_class
@return bool|string | [
"Get",
"the",
"readable",
"name",
"by",
"icon",
"class",
"."
] | 61cfa3f9715b62193d55fc4f4792d213787b9769 | https://github.com/awps/font-awesome-php/blob/61cfa3f9715b62193d55fc4f4792d213787b9769/src/AbstractFontAwesome.php#L218-L227 |
41,472 | awps/font-awesome-php | src/AbstractFontAwesome.php | AbstractFontAwesome.getIcon | public function getIcon( $icon_class ) {
$icon_class = $this->normalizeIconClass( $icon_class );
$result = false;
$icons = $this->getAllData();
if ( ! empty( $icons ) && array_key_exists( $icon_class, $icons ) ) {
$result = $icons[ $icon_class ];
}
return $result;
} | php | public function getIcon( $icon_class ) {
$icon_class = $this->normalizeIconClass( $icon_class );
$result = false;
$icons = $this->getAllData();
if ( ! empty( $icons ) && array_key_exists( $icon_class, $icons ) ) {
$result = $icons[ $icon_class ];
}
return $result;
} | [
"public",
"function",
"getIcon",
"(",
"$",
"icon_class",
")",
"{",
"$",
"icon_class",
"=",
"$",
"this",
"->",
"normalizeIconClass",
"(",
"$",
"icon_class",
")",
";",
"$",
"result",
"=",
"false",
";",
"$",
"icons",
"=",
"$",
"this",
"->",
"getAllData",
... | Get icon data by icon class.
@param string|bool $icon_class
@return bool|string | [
"Get",
"icon",
"data",
"by",
"icon",
"class",
"."
] | 61cfa3f9715b62193d55fc4f4792d213787b9769 | https://github.com/awps/font-awesome-php/blob/61cfa3f9715b62193d55fc4f4792d213787b9769/src/AbstractFontAwesome.php#L236-L247 |
41,473 | awps/font-awesome-php | src/AbstractFontAwesome.php | AbstractFontAwesome.getIconByUnicode | public function getIconByUnicode( $unicode ) {
$unicode = $this->normalizeUnicode( $unicode );
$result = false;
$the_key = array_search( $unicode, $this->icons_array );
if ( ! empty( $the_key ) ) {
$result = $this->getIcon( $the_key );
}
return $result;
} | php | public function getIconByUnicode( $unicode ) {
$unicode = $this->normalizeUnicode( $unicode );
$result = false;
$the_key = array_search( $unicode, $this->icons_array );
if ( ! empty( $the_key ) ) {
$result = $this->getIcon( $the_key );
}
return $result;
} | [
"public",
"function",
"getIconByUnicode",
"(",
"$",
"unicode",
")",
"{",
"$",
"unicode",
"=",
"$",
"this",
"->",
"normalizeUnicode",
"(",
"$",
"unicode",
")",
";",
"$",
"result",
"=",
"false",
";",
"$",
"the_key",
"=",
"array_search",
"(",
"$",
"unicode"... | Get icon data by unicode.
@param string|bool $unicode
@return bool|string | [
"Get",
"icon",
"data",
"by",
"unicode",
"."
] | 61cfa3f9715b62193d55fc4f4792d213787b9769 | https://github.com/awps/font-awesome-php/blob/61cfa3f9715b62193d55fc4f4792d213787b9769/src/AbstractFontAwesome.php#L256-L267 |
41,474 | awps/font-awesome-php | src/FontAwesomeReader.php | FontAwesomeReader.readCss | protected static function readCss( $path, $class_prefix = 'fa-' ) {
//if path is incorrect or file does not exist, stop.
if ( ! file_exists( $path ) ) {
throw new \Exception( 'Can\'t read the CSS. File does not exists.' );
}
$css = file_get_contents( $path );
$pattern = '/\.(' . $class_prefix . '(?:\w+(?:-)?)+):before\s+{\s*content:\s*"(.+)";\s+}/';
preg_match_all( $pattern, $css, $matches, PREG_SET_ORDER );
$icons = array();
foreach ( $matches as $match ) {
$icons[ $match[1] ] = $match[2];
}
return $icons;
} | php | protected static function readCss( $path, $class_prefix = 'fa-' ) {
//if path is incorrect or file does not exist, stop.
if ( ! file_exists( $path ) ) {
throw new \Exception( 'Can\'t read the CSS. File does not exists.' );
}
$css = file_get_contents( $path );
$pattern = '/\.(' . $class_prefix . '(?:\w+(?:-)?)+):before\s+{\s*content:\s*"(.+)";\s+}/';
preg_match_all( $pattern, $css, $matches, PREG_SET_ORDER );
$icons = array();
foreach ( $matches as $match ) {
$icons[ $match[1] ] = $match[2];
}
return $icons;
} | [
"protected",
"static",
"function",
"readCss",
"(",
"$",
"path",
",",
"$",
"class_prefix",
"=",
"'fa-'",
")",
"{",
"//if path is incorrect or file does not exist, stop.",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"path",
")",
")",
"{",
"throw",
"new",
"\\",
"Exc... | Read the CSS file and return the array
@param string $path font awesome css file path
@param string $class_prefix change this if the class names does not start with `fa-`
@return array|bool
@throws \Exception | [
"Read",
"the",
"CSS",
"file",
"and",
"return",
"the",
"array"
] | 61cfa3f9715b62193d55fc4f4792d213787b9769 | https://github.com/awps/font-awesome-php/blob/61cfa3f9715b62193d55fc4f4792d213787b9769/src/FontAwesomeReader.php#L40-L57 |
41,475 | PaylineByMonext/payline-php-sdk | src/Payline/PaylineSDK.php | PaylineSDK.hideChars | protected function hideChars($inString, $n1, $n2)
{
$inStringLength = strlen($inString);
if ($inStringLength < ($n1 + $n2)) {
return $inString;
}
$outString = substr($inString, 0, $n1);
$outString .= substr("********************", 0, $inStringLength - ($n1 + $n2));
$outString .= substr($inString, - ($n2));
return $outString;
} | php | protected function hideChars($inString, $n1, $n2)
{
$inStringLength = strlen($inString);
if ($inStringLength < ($n1 + $n2)) {
return $inString;
}
$outString = substr($inString, 0, $n1);
$outString .= substr("********************", 0, $inStringLength - ($n1 + $n2));
$outString .= substr($inString, - ($n2));
return $outString;
} | [
"protected",
"function",
"hideChars",
"(",
"$",
"inString",
",",
"$",
"n1",
",",
"$",
"n2",
")",
"{",
"$",
"inStringLength",
"=",
"strlen",
"(",
"$",
"inString",
")",
";",
"if",
"(",
"$",
"inStringLength",
"<",
"(",
"$",
"n1",
"+",
"$",
"n2",
")",
... | Hide characters in a string
@param String $inString
the string to hide
@param int $n1
number of characters shown at the begining of the string
@param int $n2
number of characters shown at end begining of the string | [
"Hide",
"characters",
"in",
"a",
"string"
] | 19bd51153add5d785c8dabfbf2d44f53cd7f75d8 | https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L818-L828 |
41,476 | PaylineByMonext/payline-php-sdk | src/Payline/PaylineSDK.php | PaylineSDK.responseToArray | protected function responseToArray($node, $parent = null)
{
$array = array();
foreach ($node as $k => $v) {
if ($this->isChildFromList($k, $parent)) { // current value is a list
if ($v instanceof \Countable && count($v) == 1 && $k != '0') { // a list with 1 element. It's returned with a 0-index
$array[$k][0] = PaylineSDK::responseToArray($v, $k);
} elseif (is_object($v) || is_array($v)) { // a list with more than 1 element
$array[$k] = PaylineSDK::responseToArray($v, $k);
} else {
$array[$k] = $v;
}
} else {
if (is_object($v) || is_array($v)) {
$array[$k] = PaylineSDK::responseToArray($v, $k);
} else {
$array[$k] = $v;
}
}
}
return $array;
} | php | protected function responseToArray($node, $parent = null)
{
$array = array();
foreach ($node as $k => $v) {
if ($this->isChildFromList($k, $parent)) { // current value is a list
if ($v instanceof \Countable && count($v) == 1 && $k != '0') { // a list with 1 element. It's returned with a 0-index
$array[$k][0] = PaylineSDK::responseToArray($v, $k);
} elseif (is_object($v) || is_array($v)) { // a list with more than 1 element
$array[$k] = PaylineSDK::responseToArray($v, $k);
} else {
$array[$k] = $v;
}
} else {
if (is_object($v) || is_array($v)) {
$array[$k] = PaylineSDK::responseToArray($v, $k);
} else {
$array[$k] = $v;
}
}
}
return $array;
} | [
"protected",
"function",
"responseToArray",
"(",
"$",
"node",
",",
"$",
"parent",
"=",
"null",
")",
"{",
"$",
"array",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"node",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"if",
"(",
"$",
"this",
"... | make an array from a payline server response object.
@param object $node
response node from payline web service
@param string $parent
name of the node's parent
@return array representation of the object | [
"make",
"an",
"array",
"from",
"a",
"payline",
"server",
"response",
"object",
"."
] | 19bd51153add5d785c8dabfbf2d44f53cd7f75d8 | https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L854-L875 |
41,477 | PaylineByMonext/payline-php-sdk | src/Payline/PaylineSDK.php | PaylineSDK.addOrderDetail | public function addOrderDetail(array $newOrderDetail)
{
$orderDetail = new OrderDetail();
if ($newOrderDetail) {
foreach ($newOrderDetail as $k => $v) {
if (array_key_exists($k, $orderDetail) && (strlen($v))) {
$orderDetail->$k = $v;
}
}
}
$this->orderDetails[] = new \SoapVar($orderDetail, SOAP_ENC_OBJECT, self::SOAP_ORDERDETAIL, self::PAYLINE_NAMESPACE);
} | php | public function addOrderDetail(array $newOrderDetail)
{
$orderDetail = new OrderDetail();
if ($newOrderDetail) {
foreach ($newOrderDetail as $k => $v) {
if (array_key_exists($k, $orderDetail) && (strlen($v))) {
$orderDetail->$k = $v;
}
}
}
$this->orderDetails[] = new \SoapVar($orderDetail, SOAP_ENC_OBJECT, self::SOAP_ORDERDETAIL, self::PAYLINE_NAMESPACE);
} | [
"public",
"function",
"addOrderDetail",
"(",
"array",
"$",
"newOrderDetail",
")",
"{",
"$",
"orderDetail",
"=",
"new",
"OrderDetail",
"(",
")",
";",
"if",
"(",
"$",
"newOrderDetail",
")",
"{",
"foreach",
"(",
"$",
"newOrderDetail",
"as",
"$",
"k",
"=>",
... | Adds details about an order item
@param array $newOrderDetail
associative array containing details about an order item | [
"Adds",
"details",
"about",
"an",
"order",
"item"
] | 19bd51153add5d785c8dabfbf2d44f53cd7f75d8 | https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L1353-L1364 |
41,478 | PaylineByMonext/payline-php-sdk | src/Payline/PaylineSDK.php | PaylineSDK.addPrivateData | public function addPrivateData(array $array)
{
$private = new PrivateData();
if ($array) {
foreach ($array as $k => $v) {
if (array_key_exists($k, $private) && (strlen($v))) {
$private->$k = $v;
}
}
}
$this->privateData[] = new \SoapVar($private, SOAP_ENC_OBJECT, self::SOAP_PRIVATE_DATA, self::PAYLINE_NAMESPACE);
} | php | public function addPrivateData(array $array)
{
$private = new PrivateData();
if ($array) {
foreach ($array as $k => $v) {
if (array_key_exists($k, $private) && (strlen($v))) {
$private->$k = $v;
}
}
}
$this->privateData[] = new \SoapVar($private, SOAP_ENC_OBJECT, self::SOAP_PRIVATE_DATA, self::PAYLINE_NAMESPACE);
} | [
"public",
"function",
"addPrivateData",
"(",
"array",
"$",
"array",
")",
"{",
"$",
"private",
"=",
"new",
"PrivateData",
"(",
")",
";",
"if",
"(",
"$",
"array",
")",
"{",
"foreach",
"(",
"$",
"array",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"if... | Adds a privateData element
@param array $array
an array containing two indexes : key and value | [
"Adds",
"a",
"privateData",
"element"
] | 19bd51153add5d785c8dabfbf2d44f53cd7f75d8 | https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L1373-L1384 |
41,479 | PaylineByMonext/payline-php-sdk | src/Payline/PaylineSDK.php | PaylineSDK.doAuthorization | public function doAuthorization(array $array)
{
$this->formatRequest($array);
$WSRequest = array(
'payment' => $this->payment($array['payment']),
'card' => $this->card($array['card']),
'order' => $this->order($array['order']),
'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']),
'owner' => $this->owner($array['owner'], $array['ownerAddress']),
'privateDataList' => $this->privateData,
'authentication3DSecure' => $this->authentication3DSecure($array['3DSecure']),
'bankAccountData' => $this->bankAccountData($array['bankAccountData']),
'subMerchant' => $this->subMerchant($array['subMerchant']),
'asynchronousRetryTimeout' => $array['asynchronousRetryTimeout']
);
return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doAuthorization');
} | php | public function doAuthorization(array $array)
{
$this->formatRequest($array);
$WSRequest = array(
'payment' => $this->payment($array['payment']),
'card' => $this->card($array['card']),
'order' => $this->order($array['order']),
'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']),
'owner' => $this->owner($array['owner'], $array['ownerAddress']),
'privateDataList' => $this->privateData,
'authentication3DSecure' => $this->authentication3DSecure($array['3DSecure']),
'bankAccountData' => $this->bankAccountData($array['bankAccountData']),
'subMerchant' => $this->subMerchant($array['subMerchant']),
'asynchronousRetryTimeout' => $array['asynchronousRetryTimeout']
);
return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doAuthorization');
} | [
"public",
"function",
"doAuthorization",
"(",
"array",
"$",
"array",
")",
"{",
"$",
"this",
"->",
"formatRequest",
"(",
"$",
"array",
")",
";",
"$",
"WSRequest",
"=",
"array",
"(",
"'payment'",
"=>",
"$",
"this",
"->",
"payment",
"(",
"$",
"array",
"["... | calls doAuthorization web service
@param array $array
associative array containing doAuthorization parameters | [
"calls",
"doAuthorization",
"web",
"service"
] | 19bd51153add5d785c8dabfbf2d44f53cd7f75d8 | https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L1400-L1416 |
41,480 | PaylineByMonext/payline-php-sdk | src/Payline/PaylineSDK.php | PaylineSDK.doCapture | public function doCapture(array $array)
{
$WSRequest = array(
'transactionID' => $array['transactionID'],
'payment' => $this->payment($array['payment']),
'privateDataList' => $this->privateData,
'sequenceNumber' => $array['sequenceNumber']
);
return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doCapture');
} | php | public function doCapture(array $array)
{
$WSRequest = array(
'transactionID' => $array['transactionID'],
'payment' => $this->payment($array['payment']),
'privateDataList' => $this->privateData,
'sequenceNumber' => $array['sequenceNumber']
);
return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doCapture');
} | [
"public",
"function",
"doCapture",
"(",
"array",
"$",
"array",
")",
"{",
"$",
"WSRequest",
"=",
"array",
"(",
"'transactionID'",
"=>",
"$",
"array",
"[",
"'transactionID'",
"]",
",",
"'payment'",
"=>",
"$",
"this",
"->",
"payment",
"(",
"$",
"array",
"["... | calls doCapture web service
@param array $array
associative array containing doCapture parameters | [
"calls",
"doCapture",
"web",
"service"
] | 19bd51153add5d785c8dabfbf2d44f53cd7f75d8 | https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L1424-L1433 |
41,481 | PaylineByMonext/payline-php-sdk | src/Payline/PaylineSDK.php | PaylineSDK.doReAuthorization | public function doReAuthorization(array $array)
{
$WSRequest = array(
'transactionID' => $array['transactionID'],
'payment' => $this->payment($array['payment']),
'order' => $this->order($array['order']),
'privateDataList' => $this->privateData
);
return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doReAuthorization');
} | php | public function doReAuthorization(array $array)
{
$WSRequest = array(
'transactionID' => $array['transactionID'],
'payment' => $this->payment($array['payment']),
'order' => $this->order($array['order']),
'privateDataList' => $this->privateData
);
return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doReAuthorization');
} | [
"public",
"function",
"doReAuthorization",
"(",
"array",
"$",
"array",
")",
"{",
"$",
"WSRequest",
"=",
"array",
"(",
"'transactionID'",
"=>",
"$",
"array",
"[",
"'transactionID'",
"]",
",",
"'payment'",
"=>",
"$",
"this",
"->",
"payment",
"(",
"$",
"array... | calls doReAuthorization web service
@param array $array
associative array containing doReAuthorization parameters | [
"calls",
"doReAuthorization",
"web",
"service"
] | 19bd51153add5d785c8dabfbf2d44f53cd7f75d8 | https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L1441-L1450 |
41,482 | PaylineByMonext/payline-php-sdk | src/Payline/PaylineSDK.php | PaylineSDK.doDebit | public function doDebit(array $array)
{
$this->formatRequest($array);
$WSRequest = array(
'payment' => $this->payment($array['payment']),
'card' => $this->card($array['card']),
'order' => $this->order($array['order']),
'privateDataList' => $this->privateData,
'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']),
'authentication3DSecure' => $this->authentication3DSecure($array['3DSecure']),
'authorization' => $this->authorization($array['authorization']),
'subMerchant' => $this->subMerchant($array['subMerchant'])
);
return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doDebit');
} | php | public function doDebit(array $array)
{
$this->formatRequest($array);
$WSRequest = array(
'payment' => $this->payment($array['payment']),
'card' => $this->card($array['card']),
'order' => $this->order($array['order']),
'privateDataList' => $this->privateData,
'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']),
'authentication3DSecure' => $this->authentication3DSecure($array['3DSecure']),
'authorization' => $this->authorization($array['authorization']),
'subMerchant' => $this->subMerchant($array['subMerchant'])
);
return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doDebit');
} | [
"public",
"function",
"doDebit",
"(",
"array",
"$",
"array",
")",
"{",
"$",
"this",
"->",
"formatRequest",
"(",
"$",
"array",
")",
";",
"$",
"WSRequest",
"=",
"array",
"(",
"'payment'",
"=>",
"$",
"this",
"->",
"payment",
"(",
"$",
"array",
"[",
"'pa... | calls doDebit web service
@param array $array
associative array containing doDebit parameters | [
"calls",
"doDebit",
"web",
"service"
] | 19bd51153add5d785c8dabfbf2d44f53cd7f75d8 | https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L1458-L1472 |
41,483 | PaylineByMonext/payline-php-sdk | src/Payline/PaylineSDK.php | PaylineSDK.doRefund | public function doRefund($array)
{
$WSRequest = array(
'transactionID' => $array['transactionID'],
'payment' => $this->payment($array['payment']),
'comment' => $array['comment'],
'privateDataList' => $this->privateData,
'details' => $this->orderDetails,
'sequenceNumber' => $array['sequenceNumber']
);
return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doRefund');
} | php | public function doRefund($array)
{
$WSRequest = array(
'transactionID' => $array['transactionID'],
'payment' => $this->payment($array['payment']),
'comment' => $array['comment'],
'privateDataList' => $this->privateData,
'details' => $this->orderDetails,
'sequenceNumber' => $array['sequenceNumber']
);
return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doRefund');
} | [
"public",
"function",
"doRefund",
"(",
"$",
"array",
")",
"{",
"$",
"WSRequest",
"=",
"array",
"(",
"'transactionID'",
"=>",
"$",
"array",
"[",
"'transactionID'",
"]",
",",
"'payment'",
"=>",
"$",
"this",
"->",
"payment",
"(",
"$",
"array",
"[",
"'paymen... | calls doRefund web service
@param array $array
associative array containing doRefund parameters | [
"calls",
"doRefund",
"web",
"service"
] | 19bd51153add5d785c8dabfbf2d44f53cd7f75d8 | https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L1480-L1491 |
41,484 | PaylineByMonext/payline-php-sdk | src/Payline/PaylineSDK.php | PaylineSDK.doCredit | public function doCredit(array $array)
{
$this->formatRequest($array);
$WSRequest = array(
'payment' => $this->payment($array['payment']),
'card' => $this->card($array['card']),
'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']),
'privateDataList' => $this->privateData,
'order' => $this->order($array['order']),
'comment' => $array['comment'],
'subMerchant' => $this->subMerchant($array['subMerchant'])
);
return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doCredit');
} | php | public function doCredit(array $array)
{
$this->formatRequest($array);
$WSRequest = array(
'payment' => $this->payment($array['payment']),
'card' => $this->card($array['card']),
'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']),
'privateDataList' => $this->privateData,
'order' => $this->order($array['order']),
'comment' => $array['comment'],
'subMerchant' => $this->subMerchant($array['subMerchant'])
);
return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doCredit');
} | [
"public",
"function",
"doCredit",
"(",
"array",
"$",
"array",
")",
"{",
"$",
"this",
"->",
"formatRequest",
"(",
"$",
"array",
")",
";",
"$",
"WSRequest",
"=",
"array",
"(",
"'payment'",
"=>",
"$",
"this",
"->",
"payment",
"(",
"$",
"array",
"[",
"'p... | calls doCredit web service
@param array $array
associative array containing doCredit parameters | [
"calls",
"doCredit",
"web",
"service"
] | 19bd51153add5d785c8dabfbf2d44f53cd7f75d8 | https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L1514-L1527 |
41,485 | PaylineByMonext/payline-php-sdk | src/Payline/PaylineSDK.php | PaylineSDK.createWallet | public function createWallet(array $array)
{
$this->formatRequest($array);
$WSRequest = array(
'contractNumber' => $array['contractNumber'],
'wallet' => $this->wallet($array['wallet'], $array['address'], $array['card']),
'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']),
'owner' => $this->owner($array['owner'], $array['ownerAddress']),
'privateDataList' => $this->privateData,
'authentication3DSecure' => $this->authentication3DSecure($array['3DSecure']),
'contractNumberWalletList' => $array['walletContracts']
);
return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'createWallet');
} | php | public function createWallet(array $array)
{
$this->formatRequest($array);
$WSRequest = array(
'contractNumber' => $array['contractNumber'],
'wallet' => $this->wallet($array['wallet'], $array['address'], $array['card']),
'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']),
'owner' => $this->owner($array['owner'], $array['ownerAddress']),
'privateDataList' => $this->privateData,
'authentication3DSecure' => $this->authentication3DSecure($array['3DSecure']),
'contractNumberWalletList' => $array['walletContracts']
);
return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'createWallet');
} | [
"public",
"function",
"createWallet",
"(",
"array",
"$",
"array",
")",
"{",
"$",
"this",
"->",
"formatRequest",
"(",
"$",
"array",
")",
";",
"$",
"WSRequest",
"=",
"array",
"(",
"'contractNumber'",
"=>",
"$",
"array",
"[",
"'contractNumber'",
"]",
",",
"... | calls createWallet web service
@param array $array
associative array containing createWallet parameters | [
"calls",
"createWallet",
"web",
"service"
] | 19bd51153add5d785c8dabfbf2d44f53cd7f75d8 | https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L1535-L1548 |
41,486 | PaylineByMonext/payline-php-sdk | src/Payline/PaylineSDK.php | PaylineSDK.updateWallet | public function updateWallet(array $array)
{
$WSRequest = array(
'contractNumber' => $array['contractNumber'],
'cardInd' => $array['cardInd'],
'wallet' => $this->wallet($array['wallet'], $array['address'], $array['card']),
'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']),
'owner' => $this->owner($array['owner'], $array['ownerAddress']),
'privateDataList' => $this->privateData,
'authentication3DSecure' => $this->authentication3DSecure($array['3DSecure']),
'contractNumberWalletList' => $array['walletContracts']
);
return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'updateWallet');
} | php | public function updateWallet(array $array)
{
$WSRequest = array(
'contractNumber' => $array['contractNumber'],
'cardInd' => $array['cardInd'],
'wallet' => $this->wallet($array['wallet'], $array['address'], $array['card']),
'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']),
'owner' => $this->owner($array['owner'], $array['ownerAddress']),
'privateDataList' => $this->privateData,
'authentication3DSecure' => $this->authentication3DSecure($array['3DSecure']),
'contractNumberWalletList' => $array['walletContracts']
);
return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'updateWallet');
} | [
"public",
"function",
"updateWallet",
"(",
"array",
"$",
"array",
")",
"{",
"$",
"WSRequest",
"=",
"array",
"(",
"'contractNumber'",
"=>",
"$",
"array",
"[",
"'contractNumber'",
"]",
",",
"'cardInd'",
"=>",
"$",
"array",
"[",
"'cardInd'",
"]",
",",
"'walle... | calls updateWallet web service
@param array $array
associative array containing updateWallet parameters | [
"calls",
"updateWallet",
"web",
"service"
] | 19bd51153add5d785c8dabfbf2d44f53cd7f75d8 | https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L1556-L1569 |
41,487 | PaylineByMonext/payline-php-sdk | src/Payline/PaylineSDK.php | PaylineSDK.doImmediateWalletPayment | public function doImmediateWalletPayment(array $array)
{
$this->formatRequest($array);
$WSRequest = array(
'payment' => $this->payment($array['payment']),
'order' => $this->order($array['order']),
'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']),
'walletId' => $array['walletId'],
'cardInd' => $array['cardInd'],
'cvx' => $array['walletCvx'],
'privateDataList' => $this->privateData,
'authentication3DSecure' => $this->authentication3DSecure($array['3DSecure']),
'subMerchant' => $this->subMerchant($array['subMerchant'])
);
return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doImmediateWalletPayment');
} | php | public function doImmediateWalletPayment(array $array)
{
$this->formatRequest($array);
$WSRequest = array(
'payment' => $this->payment($array['payment']),
'order' => $this->order($array['order']),
'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']),
'walletId' => $array['walletId'],
'cardInd' => $array['cardInd'],
'cvx' => $array['walletCvx'],
'privateDataList' => $this->privateData,
'authentication3DSecure' => $this->authentication3DSecure($array['3DSecure']),
'subMerchant' => $this->subMerchant($array['subMerchant'])
);
return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doImmediateWalletPayment');
} | [
"public",
"function",
"doImmediateWalletPayment",
"(",
"array",
"$",
"array",
")",
"{",
"$",
"this",
"->",
"formatRequest",
"(",
"$",
"array",
")",
";",
"$",
"WSRequest",
"=",
"array",
"(",
"'payment'",
"=>",
"$",
"this",
"->",
"payment",
"(",
"$",
"arra... | calls doImmediateWalletPayment web service
@param array $array
associative array containing doImmediateWalletPayment parameters | [
"calls",
"doImmediateWalletPayment",
"web",
"service"
] | 19bd51153add5d785c8dabfbf2d44f53cd7f75d8 | https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L1641-L1656 |
41,488 | PaylineByMonext/payline-php-sdk | src/Payline/PaylineSDK.php | PaylineSDK.doScheduledWalletPayment | public function doScheduledWalletPayment(array $array)
{
$this->formatRequest($array);
$WSRequest = array(
'payment' => $this->payment($array['payment']),
'orderRef' => $array['orderRef'],
'orderDate' => $array['orderDate'],
'scheduledDate' => $array['scheduledDate'],
'walletId' => $array['walletId'],
'cardInd' => $array['cardInd'],
'order' => $this->order($array['order']),
'privateDataList' => $this->privateData,
'subMerchant' => $this->subMerchant($array['subMerchant'])
);
return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doScheduledWalletPayment');
} | php | public function doScheduledWalletPayment(array $array)
{
$this->formatRequest($array);
$WSRequest = array(
'payment' => $this->payment($array['payment']),
'orderRef' => $array['orderRef'],
'orderDate' => $array['orderDate'],
'scheduledDate' => $array['scheduledDate'],
'walletId' => $array['walletId'],
'cardInd' => $array['cardInd'],
'order' => $this->order($array['order']),
'privateDataList' => $this->privateData,
'subMerchant' => $this->subMerchant($array['subMerchant'])
);
return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doScheduledWalletPayment');
} | [
"public",
"function",
"doScheduledWalletPayment",
"(",
"array",
"$",
"array",
")",
"{",
"$",
"this",
"->",
"formatRequest",
"(",
"$",
"array",
")",
";",
"$",
"WSRequest",
"=",
"array",
"(",
"'payment'",
"=>",
"$",
"this",
"->",
"payment",
"(",
"$",
"arra... | calls doScheduledWalletPayment web service
@param array $array
associative array containing doScheduledWalletPayment parameters | [
"calls",
"doScheduledWalletPayment",
"web",
"service"
] | 19bd51153add5d785c8dabfbf2d44f53cd7f75d8 | https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L1664-L1679 |
41,489 | PaylineByMonext/payline-php-sdk | src/Payline/PaylineSDK.php | PaylineSDK.doRecurrentWalletPayment | public function doRecurrentWalletPayment(array $array)
{
$this->formatRequest($array);
$WSRequest = array(
'payment' => $this->payment($array['payment']),
'orderRef' => $array['orderRef'],
'orderDate' => $array['orderDate'],
'scheduledDate' => $array['scheduledDate'],
'walletId' => $array['walletId'],
'cardInd' => $array['cardInd'],
'recurring' => $this->recurring($array['recurring']),
'privateDataList' => $this->privateData,
'order' => $this->order($array['order'])
);
return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doRecurrentWalletPayment');
} | php | public function doRecurrentWalletPayment(array $array)
{
$this->formatRequest($array);
$WSRequest = array(
'payment' => $this->payment($array['payment']),
'orderRef' => $array['orderRef'],
'orderDate' => $array['orderDate'],
'scheduledDate' => $array['scheduledDate'],
'walletId' => $array['walletId'],
'cardInd' => $array['cardInd'],
'recurring' => $this->recurring($array['recurring']),
'privateDataList' => $this->privateData,
'order' => $this->order($array['order'])
);
return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doRecurrentWalletPayment');
} | [
"public",
"function",
"doRecurrentWalletPayment",
"(",
"array",
"$",
"array",
")",
"{",
"$",
"this",
"->",
"formatRequest",
"(",
"$",
"array",
")",
";",
"$",
"WSRequest",
"=",
"array",
"(",
"'payment'",
"=>",
"$",
"this",
"->",
"payment",
"(",
"$",
"arra... | calls doRecurrentWalletPayment web service
@param array $array
associative array containing doRecurrentWalletPayment parameters | [
"calls",
"doRecurrentWalletPayment",
"web",
"service"
] | 19bd51153add5d785c8dabfbf2d44f53cd7f75d8 | https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L1687-L1702 |
41,490 | PaylineByMonext/payline-php-sdk | src/Payline/PaylineSDK.php | PaylineSDK.verifyEnrollment | public function verifyEnrollment(array $array)
{
$this->formatRequest($array);
$WSRequest = array(
'payment' => $this->payment($array['payment']),
'card' => $this->card($array['card']),
'orderRef' => $array['orderRef'],
'userAgent' => $array['userAgent'],
'mdFieldValue' => $array['mdFieldValue'],
'walletId' => $array['walletId'],
'walletCardInd' => $array['walletCardInd'],
'merchantName' => $array['merchantName'],
'returnURL' => $array['returnURL']
);
if (isset($array['generateVirtualCvx'])) {
$WSRequest['generateVirtualCvx'] = $array['generateVirtualCvx'];
}
return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'verifyEnrollment');
} | php | public function verifyEnrollment(array $array)
{
$this->formatRequest($array);
$WSRequest = array(
'payment' => $this->payment($array['payment']),
'card' => $this->card($array['card']),
'orderRef' => $array['orderRef'],
'userAgent' => $array['userAgent'],
'mdFieldValue' => $array['mdFieldValue'],
'walletId' => $array['walletId'],
'walletCardInd' => $array['walletCardInd'],
'merchantName' => $array['merchantName'],
'returnURL' => $array['returnURL']
);
if (isset($array['generateVirtualCvx'])) {
$WSRequest['generateVirtualCvx'] = $array['generateVirtualCvx'];
}
return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'verifyEnrollment');
} | [
"public",
"function",
"verifyEnrollment",
"(",
"array",
"$",
"array",
")",
"{",
"$",
"this",
"->",
"formatRequest",
"(",
"$",
"array",
")",
";",
"$",
"WSRequest",
"=",
"array",
"(",
"'payment'",
"=>",
"$",
"this",
"->",
"payment",
"(",
"$",
"array",
"[... | calls verifyEnrollment web service
@param array $array
associative array containing verifyEnrollment parameters | [
"calls",
"verifyEnrollment",
"web",
"service"
] | 19bd51153add5d785c8dabfbf2d44f53cd7f75d8 | https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L1740-L1758 |
41,491 | PaylineByMonext/payline-php-sdk | src/Payline/PaylineSDK.php | PaylineSDK.doScoringCheque | public function doScoringCheque(array $array)
{
$WSRequest = array(
'payment' => $this->payment($array['payment']),
'cheque' => $this->cheque($array['cheque']),
'order' => $this->order($array['order']),
'privateDataList' => $this->privateData
);
return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doScoringCheque');
} | php | public function doScoringCheque(array $array)
{
$WSRequest = array(
'payment' => $this->payment($array['payment']),
'cheque' => $this->cheque($array['cheque']),
'order' => $this->order($array['order']),
'privateDataList' => $this->privateData
);
return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doScoringCheque');
} | [
"public",
"function",
"doScoringCheque",
"(",
"array",
"$",
"array",
")",
"{",
"$",
"WSRequest",
"=",
"array",
"(",
"'payment'",
"=>",
"$",
"this",
"->",
"payment",
"(",
"$",
"array",
"[",
"'payment'",
"]",
")",
",",
"'cheque'",
"=>",
"$",
"this",
"->"... | calls doScoringCheque web service
@param array $array
associative array containing doScoringCheque parameters | [
"calls",
"doScoringCheque",
"web",
"service"
] | 19bd51153add5d785c8dabfbf2d44f53cd7f75d8 | https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L1783-L1792 |
41,492 | PaylineByMonext/payline-php-sdk | src/Payline/PaylineSDK.php | PaylineSDK.doBankTransfer | public function doBankTransfer(array $array)
{
$this->formatRequest($array);
$WSRequest = array(
'payment' => $this->payment($array['payment']),
'creditor' => $this->creditor($array['creditor']),
'comment' => $array['comment'],
'transactionID' => $array['transactionID'],
'orderID' => $array['orderID']
);
return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doBankTransfer');
} | php | public function doBankTransfer(array $array)
{
$this->formatRequest($array);
$WSRequest = array(
'payment' => $this->payment($array['payment']),
'creditor' => $this->creditor($array['creditor']),
'comment' => $array['comment'],
'transactionID' => $array['transactionID'],
'orderID' => $array['orderID']
);
return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doBankTransfer');
} | [
"public",
"function",
"doBankTransfer",
"(",
"array",
"$",
"array",
")",
"{",
"$",
"this",
"->",
"formatRequest",
"(",
"$",
"array",
")",
";",
"$",
"WSRequest",
"=",
"array",
"(",
"'payment'",
"=>",
"$",
"this",
"->",
"payment",
"(",
"$",
"array",
"[",... | calls doBankTransfer web service
@param array $array
associative array containing doBankTransfer parameters | [
"calls",
"doBankTransfer",
"web",
"service"
] | 19bd51153add5d785c8dabfbf2d44f53cd7f75d8 | https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L1919-L1930 |
41,493 | PaylineByMonext/payline-php-sdk | src/Payline/PaylineSDK.php | PaylineSDK.isRegistered | public function isRegistered(array $array)
{
$this->formatRequest($array);
$WSRequest = array(
'payment' => $this->payment($array['payment']),
'order' => $this->order($array['order']),
'privateDataList' => $this->privateData,
'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']),
'miscData' => $array['miscData']
);
return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'isRegistered');
} | php | public function isRegistered(array $array)
{
$this->formatRequest($array);
$WSRequest = array(
'payment' => $this->payment($array['payment']),
'order' => $this->order($array['order']),
'privateDataList' => $this->privateData,
'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']),
'miscData' => $array['miscData']
);
return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'isRegistered');
} | [
"public",
"function",
"isRegistered",
"(",
"array",
"$",
"array",
")",
"{",
"$",
"this",
"->",
"formatRequest",
"(",
"$",
"array",
")",
";",
"$",
"WSRequest",
"=",
"array",
"(",
"'payment'",
"=>",
"$",
"this",
"->",
"payment",
"(",
"$",
"array",
"[",
... | calls isRegistered web service
@param array $array
associative array containing isRegistered parameters | [
"calls",
"isRegistered",
"web",
"service"
] | 19bd51153add5d785c8dabfbf2d44f53cd7f75d8 | https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L1938-L1949 |
41,494 | PaylineByMonext/payline-php-sdk | src/Payline/PaylineSDK.php | PaylineSDK.doWebPayment | public function doWebPayment(array $array)
{
$this->formatRequest($array);
$WSRequest = array(
'payment' => $this->payment($array['payment']),
'returnURL' => $array['returnURL'],
'cancelURL' => $array['cancelURL'],
'order' => $this->order($array['order']),
'notificationURL' => $array['notificationURL'],
'customPaymentTemplateURL' => $array['customPaymentTemplateURL'],
'selectedContractList' => $array['contracts'],
'secondSelectedContractList' => $array['secondContracts'],
'privateDataList' => $this->privateData,
'languageCode' => $array['languageCode'],
'customPaymentPageCode' => $array['customPaymentPageCode'],
'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']),
'owner' => $this->owner($array['owner'], $array['ownerAddress']),
'securityMode' => $array['securityMode'],
'contractNumberWalletList' => $array['walletContracts'],
'merchantName' => $array['merchantName'],
'subMerchant' => $this->subMerchant($array['subMerchant']),
'miscData' => $array['miscData'],
'asynchronousRetryTimeout' => $array['asynchronousRetryTimeout']
);
if (isset($array['payment']['mode'])) {
if (($array['payment']['mode'] == "REC") || ($array['payment']['mode'] == "NX")) {
$WSRequest['recurring'] = $this->recurring($array['recurring']);
}
}
return $this->webServiceRequest($array, $WSRequest, self::WEB_API, 'doWebPayment');
} | php | public function doWebPayment(array $array)
{
$this->formatRequest($array);
$WSRequest = array(
'payment' => $this->payment($array['payment']),
'returnURL' => $array['returnURL'],
'cancelURL' => $array['cancelURL'],
'order' => $this->order($array['order']),
'notificationURL' => $array['notificationURL'],
'customPaymentTemplateURL' => $array['customPaymentTemplateURL'],
'selectedContractList' => $array['contracts'],
'secondSelectedContractList' => $array['secondContracts'],
'privateDataList' => $this->privateData,
'languageCode' => $array['languageCode'],
'customPaymentPageCode' => $array['customPaymentPageCode'],
'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']),
'owner' => $this->owner($array['owner'], $array['ownerAddress']),
'securityMode' => $array['securityMode'],
'contractNumberWalletList' => $array['walletContracts'],
'merchantName' => $array['merchantName'],
'subMerchant' => $this->subMerchant($array['subMerchant']),
'miscData' => $array['miscData'],
'asynchronousRetryTimeout' => $array['asynchronousRetryTimeout']
);
if (isset($array['payment']['mode'])) {
if (($array['payment']['mode'] == "REC") || ($array['payment']['mode'] == "NX")) {
$WSRequest['recurring'] = $this->recurring($array['recurring']);
}
}
return $this->webServiceRequest($array, $WSRequest, self::WEB_API, 'doWebPayment');
} | [
"public",
"function",
"doWebPayment",
"(",
"array",
"$",
"array",
")",
"{",
"$",
"this",
"->",
"formatRequest",
"(",
"$",
"array",
")",
";",
"$",
"WSRequest",
"=",
"array",
"(",
"'payment'",
"=>",
"$",
"this",
"->",
"payment",
"(",
"$",
"array",
"[",
... | calls doWebPayment web service
@param array $array
associative array containing doWebPayment parameters | [
"calls",
"doWebPayment",
"web",
"service"
] | 19bd51153add5d785c8dabfbf2d44f53cd7f75d8 | https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L1965-L1996 |
41,495 | PaylineByMonext/payline-php-sdk | src/Payline/PaylineSDK.php | PaylineSDK.manageWebWallet | public function manageWebWallet(array $array)
{
$this->formatRequest($array);
$WSRequest = array(
'contractNumber' => $array['contractNumber'],
'selectedContractList' => $array['contracts'],
'updatePersonalDetails' => $array['updatePersonalDetails'],
'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']),
'owner' => $this->owner($array['owner'], $array['ownerAddress']),
'languageCode' => $array['languageCode'],
'customPaymentPageCode' => $array['customPaymentPageCode'],
'securityMode' => $array['securityMode'],
'returnURL' => $array['returnURL'],
'cancelURL' => $array['cancelURL'],
'notificationURL' => $array['notificationURL'],
'privateDataList' => $this->privateData,
'customPaymentTemplateURL' => $array['customPaymentTemplateURL'],
'contractNumberWalletList' => $array['walletContracts'],
'merchantName' => $array['merchantName']
);
return $this->webServiceRequest($array, $WSRequest, self::WEB_API, 'manageWebWallet');
} | php | public function manageWebWallet(array $array)
{
$this->formatRequest($array);
$WSRequest = array(
'contractNumber' => $array['contractNumber'],
'selectedContractList' => $array['contracts'],
'updatePersonalDetails' => $array['updatePersonalDetails'],
'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']),
'owner' => $this->owner($array['owner'], $array['ownerAddress']),
'languageCode' => $array['languageCode'],
'customPaymentPageCode' => $array['customPaymentPageCode'],
'securityMode' => $array['securityMode'],
'returnURL' => $array['returnURL'],
'cancelURL' => $array['cancelURL'],
'notificationURL' => $array['notificationURL'],
'privateDataList' => $this->privateData,
'customPaymentTemplateURL' => $array['customPaymentTemplateURL'],
'contractNumberWalletList' => $array['walletContracts'],
'merchantName' => $array['merchantName']
);
return $this->webServiceRequest($array, $WSRequest, self::WEB_API, 'manageWebWallet');
} | [
"public",
"function",
"manageWebWallet",
"(",
"array",
"$",
"array",
")",
"{",
"$",
"this",
"->",
"formatRequest",
"(",
"$",
"array",
")",
";",
"$",
"WSRequest",
"=",
"array",
"(",
"'contractNumber'",
"=>",
"$",
"array",
"[",
"'contractNumber'",
"]",
",",
... | calls manageWebWallet web service
@param array $array
associative array containing manageWebWallet parameters | [
"calls",
"manageWebWallet",
"web",
"service"
] | 19bd51153add5d785c8dabfbf2d44f53cd7f75d8 | https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L2015-L2036 |
41,496 | PaylineByMonext/payline-php-sdk | src/Payline/PaylineSDK.php | PaylineSDK.createWebWallet | public function createWebWallet(array $array)
{
$this->formatRequest($array);
$WSRequest = array(
'contractNumber' => $array['contractNumber'],
'selectedContractList' => $array['contracts'],
'updatePersonalDetails' => $array['updatePersonalDetails'],
'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']),
'languageCode' => $array['languageCode'],
'customPaymentPageCode' => $array['customPaymentPageCode'],
'securityMode' => $array['securityMode'],
'returnURL' => $array['returnURL'],
'cancelURL' => $array['cancelURL'],
'notificationURL' => $array['notificationURL'],
'privateDataList' => $this->privateData,
'customPaymentTemplateURL' => $array['customPaymentTemplateURL'],
'contractNumberWalletList' => $array['walletContracts']
);
return $this->webServiceRequest($array, $WSRequest, self::WEB_API, 'createWebWallet');
} | php | public function createWebWallet(array $array)
{
$this->formatRequest($array);
$WSRequest = array(
'contractNumber' => $array['contractNumber'],
'selectedContractList' => $array['contracts'],
'updatePersonalDetails' => $array['updatePersonalDetails'],
'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']),
'languageCode' => $array['languageCode'],
'customPaymentPageCode' => $array['customPaymentPageCode'],
'securityMode' => $array['securityMode'],
'returnURL' => $array['returnURL'],
'cancelURL' => $array['cancelURL'],
'notificationURL' => $array['notificationURL'],
'privateDataList' => $this->privateData,
'customPaymentTemplateURL' => $array['customPaymentTemplateURL'],
'contractNumberWalletList' => $array['walletContracts']
);
return $this->webServiceRequest($array, $WSRequest, self::WEB_API, 'createWebWallet');
} | [
"public",
"function",
"createWebWallet",
"(",
"array",
"$",
"array",
")",
"{",
"$",
"this",
"->",
"formatRequest",
"(",
"$",
"array",
")",
";",
"$",
"WSRequest",
"=",
"array",
"(",
"'contractNumber'",
"=>",
"$",
"array",
"[",
"'contractNumber'",
"]",
",",
... | calls createWebWallet web service
@param array $array
associative array containing createWebWallet parameters | [
"calls",
"createWebWallet",
"web",
"service"
] | 19bd51153add5d785c8dabfbf2d44f53cd7f75d8 | https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L2044-L2063 |
41,497 | PaylineByMonext/payline-php-sdk | src/Payline/PaylineSDK.php | PaylineSDK.getDecrypt | public function getDecrypt($message, $accessKey)
{
$cipher = "AES-256-ECB";
$opts = OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING;
$message = $this->base64_url_decode($message);
$decrypted = openssl_decrypt($message, $cipher, $accessKey, $opts);
$len = strlen($decrypted);
$pad = ord($decrypted[$len - 1]);
return substr($decrypted, 0, strlen($decrypted) - $pad);
} | php | public function getDecrypt($message, $accessKey)
{
$cipher = "AES-256-ECB";
$opts = OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING;
$message = $this->base64_url_decode($message);
$decrypted = openssl_decrypt($message, $cipher, $accessKey, $opts);
$len = strlen($decrypted);
$pad = ord($decrypted[$len - 1]);
return substr($decrypted, 0, strlen($decrypted) - $pad);
} | [
"public",
"function",
"getDecrypt",
"(",
"$",
"message",
",",
"$",
"accessKey",
")",
"{",
"$",
"cipher",
"=",
"\"AES-256-ECB\"",
";",
"$",
"opts",
"=",
"OPENSSL_RAW_DATA",
"|",
"OPENSSL_ZERO_PADDING",
";",
"$",
"message",
"=",
"$",
"this",
"->",
"base64_url_... | Decrypts message sent by getToken servlet
@param string $message
message to decrypt
@param string $accessKey
merchant access key (SHA256 encrypted) | [
"Decrypts",
"message",
"sent",
"by",
"getToken",
"servlet"
] | 19bd51153add5d785c8dabfbf2d44f53cd7f75d8 | https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L2246-L2257 |
41,498 | kevinkhill/php-duration | src/Duration.php | Duration.toSeconds | public function toSeconds($duration = null, $precision = false)
{
if (null !== $duration) {
$this->parse($duration);
}
$this->output = ($this->days * $this->hoursPerDay * 60 * 60) + ($this->hours * 60 * 60) + ($this->minutes * 60) + $this->seconds;
return $precision !== false ? round($this->output, $precision) : $this->output;
} | php | public function toSeconds($duration = null, $precision = false)
{
if (null !== $duration) {
$this->parse($duration);
}
$this->output = ($this->days * $this->hoursPerDay * 60 * 60) + ($this->hours * 60 * 60) + ($this->minutes * 60) + $this->seconds;
return $precision !== false ? round($this->output, $precision) : $this->output;
} | [
"public",
"function",
"toSeconds",
"(",
"$",
"duration",
"=",
"null",
",",
"$",
"precision",
"=",
"false",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"duration",
")",
"{",
"$",
"this",
"->",
"parse",
"(",
"$",
"duration",
")",
";",
"}",
"$",
"this",
... | Returns the duration as an amount of seconds.
For example, one hour and 42 minutes would be "6120"
@param int|float|string $duration A string or number, representing a duration
@param int|bool $precision Number of decimal digits to round to. If set to false, the number is not rounded.
@return int|float | [
"Returns",
"the",
"duration",
"as",
"an",
"amount",
"of",
"seconds",
"."
] | 2118a067359ffc96784b02fcd26f312e2bd886db | https://github.com/kevinkhill/php-duration/blob/2118a067359ffc96784b02fcd26f312e2bd886db/src/Duration.php#L139-L147 |
41,499 | kevinkhill/php-duration | src/Duration.php | Duration.toMinutes | public function toMinutes($duration = null, $precision = false)
{
if (null !== $duration) {
$this->parse($duration);
}
// backward compatibility, true = round to integer
if ($precision === true) {
$precision = 0;
}
$this->output = ($this->days * $this->hoursPerDay * 60 * 60) + ($this->hours * 60 * 60) + ($this->minutes * 60) + $this->seconds;
$result = intval($this->output()) / 60;
return $precision !== false ? round($result, $precision) : $result;
} | php | public function toMinutes($duration = null, $precision = false)
{
if (null !== $duration) {
$this->parse($duration);
}
// backward compatibility, true = round to integer
if ($precision === true) {
$precision = 0;
}
$this->output = ($this->days * $this->hoursPerDay * 60 * 60) + ($this->hours * 60 * 60) + ($this->minutes * 60) + $this->seconds;
$result = intval($this->output()) / 60;
return $precision !== false ? round($result, $precision) : $result;
} | [
"public",
"function",
"toMinutes",
"(",
"$",
"duration",
"=",
"null",
",",
"$",
"precision",
"=",
"false",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"duration",
")",
"{",
"$",
"this",
"->",
"parse",
"(",
"$",
"duration",
")",
";",
"}",
"// backward co... | Returns the duration as an amount of minutes.
For example, one hour and 42 minutes would be "102" minutes
@param int|float|string $duration A string or number, representing a duration
@param int|bool $precision Number of decimal digits to round to. If set to false, the number is not rounded.
@return int|float | [
"Returns",
"the",
"duration",
"as",
"an",
"amount",
"of",
"minutes",
"."
] | 2118a067359ffc96784b02fcd26f312e2bd886db | https://github.com/kevinkhill/php-duration/blob/2118a067359ffc96784b02fcd26f312e2bd886db/src/Duration.php#L158-L173 |
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.