repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
cartalyst/sentry
src/Cartalyst/Sentry/Facades/Native/Sentry.php
Sentry.guessIpAddress
public static function guessIpAddress() { foreach (array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR') as $key) { if (array_key_exists($key, $_SERVER) === true) { foreach (explode(',', $_SERVER[$key]) as $i...
php
public static function guessIpAddress() { foreach (array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR') as $key) { if (array_key_exists($key, $_SERVER) === true) { foreach (explode(',', $_SERVER[$key]) as $i...
[ "public", "static", "function", "guessIpAddress", "(", ")", "{", "foreach", "(", "array", "(", "'HTTP_CLIENT_IP'", ",", "'HTTP_X_FORWARDED_FOR'", ",", "'HTTP_X_FORWARDED'", ",", "'HTTP_X_CLUSTER_CLIENT_IP'", ",", "'HTTP_FORWARDED_FOR'", ",", "'HTTP_FORWARDED'", ",", "'R...
Looks through various server properties in an attempt to guess the client's IP address. @return string $ipAddress
[ "Looks", "through", "various", "server", "properties", "in", "an", "attempt", "to", "guess", "the", "client", "s", "IP", "address", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Facades/Native/Sentry.php#L100-L117
cartalyst/sentry
src/Cartalyst/Sentry/Cookies/NativeCookie.php
NativeCookie.setCookie
public function setCookie($value, $lifetime, $path = null, $domain = null, $secure = null, $httpOnly = null) { // Default parameters if ( ! isset($path)) $path = $this->defaults['path']; if ( ! isset($domain)) $domain = $this->defaults['domain']; if ( ! isset($secure)) $secure = $this->defaults...
php
public function setCookie($value, $lifetime, $path = null, $domain = null, $secure = null, $httpOnly = null) { // Default parameters if ( ! isset($path)) $path = $this->defaults['path']; if ( ! isset($domain)) $domain = $this->defaults['domain']; if ( ! isset($secure)) $secure = $this->defaults...
[ "public", "function", "setCookie", "(", "$", "value", ",", "$", "lifetime", ",", "$", "path", "=", "null", ",", "$", "domain", "=", "null", ",", "$", "secure", "=", "null", ",", "$", "httpOnly", "=", "null", ")", "{", "// Default parameters", "if", "...
Actually sets the cookie. @param mixed $value @param int $lifetime @param string $path @param string $domain @param bool $secure @param bool $httpOnly @return void
[ "Actually", "sets", "the", "cookie", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Cookies/NativeCookie.php#L141-L150
cartalyst/sentry
src/Cartalyst/Sentry/Users/Eloquent/Provider.php
Provider.findById
public function findById($id) { $model = $this->createModel(); if ( ! $user = $model->newQuery()->find($id)) { throw new UserNotFoundException("A user could not be found with ID [$id]."); } return $user; }
php
public function findById($id) { $model = $this->createModel(); if ( ! $user = $model->newQuery()->find($id)) { throw new UserNotFoundException("A user could not be found with ID [$id]."); } return $user; }
[ "public", "function", "findById", "(", "$", "id", ")", "{", "$", "model", "=", "$", "this", "->", "createModel", "(", ")", ";", "if", "(", "!", "$", "user", "=", "$", "model", "->", "newQuery", "(", ")", "->", "find", "(", "$", "id", ")", ")", ...
Finds a user by the given user ID. @param mixed $id @return \Cartalyst\Sentry\Users\UserInterface @throws \Cartalyst\Sentry\Users\UserNotFoundException
[ "Finds", "a", "user", "by", "the", "given", "user", "ID", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Users/Eloquent/Provider.php#L71-L81
cartalyst/sentry
src/Cartalyst/Sentry/Users/Eloquent/Provider.php
Provider.findByLogin
public function findByLogin($login) { $model = $this->createModel(); if ( ! $user = $model->newQuery()->where($model->getLoginName(), '=', $login)->first()) { throw new UserNotFoundException("A user could not be found with a login value of [$login]."); } return $user; }
php
public function findByLogin($login) { $model = $this->createModel(); if ( ! $user = $model->newQuery()->where($model->getLoginName(), '=', $login)->first()) { throw new UserNotFoundException("A user could not be found with a login value of [$login]."); } return $user; }
[ "public", "function", "findByLogin", "(", "$", "login", ")", "{", "$", "model", "=", "$", "this", "->", "createModel", "(", ")", ";", "if", "(", "!", "$", "user", "=", "$", "model", "->", "newQuery", "(", ")", "->", "where", "(", "$", "model", "-...
Finds a user by the login value. @param string $login @return \Cartalyst\Sentry\Users\UserInterface @throws \Cartalyst\Sentry\Users\UserNotFoundException
[ "Finds", "a", "user", "by", "the", "login", "value", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Users/Eloquent/Provider.php#L90-L100
cartalyst/sentry
src/Cartalyst/Sentry/Users/Eloquent/Provider.php
Provider.findByCredentials
public function findByCredentials(array $credentials) { $model = $this->createModel(); $loginName = $model->getLoginName(); if ( ! array_key_exists($loginName, $credentials)) { throw new \InvalidArgumentException("Login attribute [$loginName] was not provided."); } $passwordName = $model->getPassw...
php
public function findByCredentials(array $credentials) { $model = $this->createModel(); $loginName = $model->getLoginName(); if ( ! array_key_exists($loginName, $credentials)) { throw new \InvalidArgumentException("Login attribute [$loginName] was not provided."); } $passwordName = $model->getPassw...
[ "public", "function", "findByCredentials", "(", "array", "$", "credentials", ")", "{", "$", "model", "=", "$", "this", "->", "createModel", "(", ")", ";", "$", "loginName", "=", "$", "model", "->", "getLoginName", "(", ")", ";", "if", "(", "!", "array_...
Finds a user by the given credentials. @param array $credentials @return \Cartalyst\Sentry\Users\UserInterface @throws \Cartalyst\Sentry\Users\UserNotFoundException
[ "Finds", "a", "user", "by", "the", "given", "credentials", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Users/Eloquent/Provider.php#L109-L173
cartalyst/sentry
src/Cartalyst/Sentry/Users/Eloquent/Provider.php
Provider.findByActivationCode
public function findByActivationCode($code) { if ( ! $code) { throw new \InvalidArgumentException("No activation code passed."); } $model = $this->createModel(); $result = $model->newQuery()->where('activation_code', '=', $code)->get(); if (($count = $result->count()) > 1) { throw new \RuntimeEx...
php
public function findByActivationCode($code) { if ( ! $code) { throw new \InvalidArgumentException("No activation code passed."); } $model = $this->createModel(); $result = $model->newQuery()->where('activation_code', '=', $code)->get(); if (($count = $result->count()) > 1) { throw new \RuntimeEx...
[ "public", "function", "findByActivationCode", "(", "$", "code", ")", "{", "if", "(", "!", "$", "code", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "\"No activation code passed.\"", ")", ";", "}", "$", "model", "=", "$", "this", "->", "...
Finds a user by the given activation code. @param string $code @return \Cartalyst\Sentry\Users\UserInterface @throws \Cartalyst\Sentry\Users\UserNotFoundException @throws InvalidArgumentException @throws RuntimeException
[ "Finds", "a", "user", "by", "the", "given", "activation", "code", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Users/Eloquent/Provider.php#L184-L206
cartalyst/sentry
src/Cartalyst/Sentry/Users/Eloquent/Provider.php
Provider.create
public function create(array $credentials) { $user = $this->createModel(); $user->fill($credentials); $user->save(); return $user; }
php
public function create(array $credentials) { $user = $this->createModel(); $user->fill($credentials); $user->save(); return $user; }
[ "public", "function", "create", "(", "array", "$", "credentials", ")", "{", "$", "user", "=", "$", "this", "->", "createModel", "(", ")", ";", "$", "user", "->", "fill", "(", "$", "credentials", ")", ";", "$", "user", "->", "save", "(", ")", ";", ...
Creates a user. @param array $credentials @return \Cartalyst\Sentry\Users\UserInterface
[ "Creates", "a", "user", "." ]
train
https://github.com/cartalyst/sentry/blob/c679730b8848686f59125cd821bf94946fb16a94/src/Cartalyst/Sentry/Users/Eloquent/Provider.php#L293-L300
kaliop-uk/ezmigrationbundle
Core/DefinitionParser/AbstractDefinitionParser.php
AbstractDefinitionParser.parseMigrationDefinitionData
protected function parseMigrationDefinitionData($data, MigrationDefinition $definition, $format = 'Yaml') { // basic validation /// @todo move to using the Validator component... $status = MigrationDefinition::STATUS_PARSED; if (!is_array($data)) { $status = MigrationD...
php
protected function parseMigrationDefinitionData($data, MigrationDefinition $definition, $format = 'Yaml') { // basic validation /// @todo move to using the Validator component... $status = MigrationDefinition::STATUS_PARSED; if (!is_array($data)) { $status = MigrationD...
[ "protected", "function", "parseMigrationDefinitionData", "(", "$", "data", ",", "MigrationDefinition", "$", "definition", ",", "$", "format", "=", "'Yaml'", ")", "{", "// basic validation", "/// @todo move to using the Validator component...", "$", "status", "=", "Migrati...
Parses a migration definition in the form of an array of steps @param array $data @param MigrationDefinition $definition @param string $format @return MigrationDefinition
[ "Parses", "a", "migration", "definition", "in", "the", "form", "of", "an", "array", "of", "steps" ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/DefinitionParser/AbstractDefinitionParser.php#L18-L65
kaliop-uk/ezmigrationbundle
Core/Matcher/UserGroupMatcher.php
UserGroupMatcher.getConditionsFromKey
protected function getConditionsFromKey($key) { if (is_int($key) || ctype_digit($key)) { return array(self::MATCH_USERGROUP_ID => $key); } return array(self::MATCH_CONTENT_REMOTE_ID => $key); }
php
protected function getConditionsFromKey($key) { if (is_int($key) || ctype_digit($key)) { return array(self::MATCH_USERGROUP_ID => $key); } return array(self::MATCH_CONTENT_REMOTE_ID => $key); }
[ "protected", "function", "getConditionsFromKey", "(", "$", "key", ")", "{", "if", "(", "is_int", "(", "$", "key", ")", "||", "ctype_digit", "(", "$", "key", ")", ")", "{", "return", "array", "(", "self", "::", "MATCH_USERGROUP_ID", "=>", "$", "key", ")...
When matching by key, we accept user group Id and it's remote Id only @param int|string $key @return array
[ "When", "matching", "by", "key", "we", "accept", "user", "group", "Id", "and", "it", "s", "remote", "Id", "only" ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/Matcher/UserGroupMatcher.php#L76-L82
kaliop-uk/ezmigrationbundle
Core/Executor/ObjectStateManager.php
ObjectStateManager.create
protected function create($step) { foreach (array('object_state_group', 'names', 'identifier') as $key) { if (!isset($step->dsl[$key])) { throw new \Exception("The '$key' key is missing in a object state creation definition"); } } if (!count($step->ds...
php
protected function create($step) { foreach (array('object_state_group', 'names', 'identifier') as $key) { if (!isset($step->dsl[$key])) { throw new \Exception("The '$key' key is missing in a object state creation definition"); } } if (!count($step->ds...
[ "protected", "function", "create", "(", "$", "step", ")", "{", "foreach", "(", "array", "(", "'object_state_group'", ",", "'names'", ",", "'identifier'", ")", "as", "$", "key", ")", "{", "if", "(", "!", "isset", "(", "$", "step", "->", "dsl", "[", "$...
Handles the create step of object state migrations. @throws \Exception
[ "Handles", "the", "create", "step", "of", "object", "state", "migrations", "." ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/Executor/ObjectStateManager.php#L48-L84
kaliop-uk/ezmigrationbundle
Core/Executor/ObjectStateManager.php
ObjectStateManager.update
protected function update($step) { $stateCollection = $this->matchObjectStates('update', $step); if (count($stateCollection) > 1 && array_key_exists('references', $step->dsl)) { throw new \Exception("Can not execute Object State update because multiple states match, and a references sec...
php
protected function update($step) { $stateCollection = $this->matchObjectStates('update', $step); if (count($stateCollection) > 1 && array_key_exists('references', $step->dsl)) { throw new \Exception("Can not execute Object State update because multiple states match, and a references sec...
[ "protected", "function", "update", "(", "$", "step", ")", "{", "$", "stateCollection", "=", "$", "this", "->", "matchObjectStates", "(", "'update'", ",", "$", "step", ")", ";", "if", "(", "count", "(", "$", "stateCollection", ")", ">", "1", "&&", "arra...
Handles the update step of object state migrations. @throws \Exception
[ "Handles", "the", "update", "step", "of", "object", "state", "migrations", "." ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/Executor/ObjectStateManager.php#L100-L136
kaliop-uk/ezmigrationbundle
Core/Executor/ObjectStateManager.php
ObjectStateManager.delete
protected function delete($step) { $stateCollection = $this->matchObjectStates('delete', $step); $this->setReferences($stateCollection, $step); $objectStateService = $this->repository->getObjectStateService(); foreach ($stateCollection as $state) { $objectStateService-...
php
protected function delete($step) { $stateCollection = $this->matchObjectStates('delete', $step); $this->setReferences($stateCollection, $step); $objectStateService = $this->repository->getObjectStateService(); foreach ($stateCollection as $state) { $objectStateService-...
[ "protected", "function", "delete", "(", "$", "step", ")", "{", "$", "stateCollection", "=", "$", "this", "->", "matchObjectStates", "(", "'delete'", ",", "$", "step", ")", ";", "$", "this", "->", "setReferences", "(", "$", "stateCollection", ",", "$", "s...
Handles the deletion step of object state migrations.
[ "Handles", "the", "deletion", "step", "of", "object", "state", "migrations", "." ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/Executor/ObjectStateManager.php#L141-L154
kaliop-uk/ezmigrationbundle
Core/Executor/TrashManager.php
TrashManager.recover
protected function recover($step) { $itemsCollection = $this->matchItems('restore', $step); if (count($itemsCollection) > 1 && array_key_exists('references', $step->dsl)) { throw new \Exception("Can not execute Trash restore because multiple items match, and a references section is spec...
php
protected function recover($step) { $itemsCollection = $this->matchItems('restore', $step); if (count($itemsCollection) > 1 && array_key_exists('references', $step->dsl)) { throw new \Exception("Can not execute Trash restore because multiple items match, and a references section is spec...
[ "protected", "function", "recover", "(", "$", "step", ")", "{", "$", "itemsCollection", "=", "$", "this", "->", "matchItems", "(", "'restore'", ",", "$", "step", ")", ";", "if", "(", "count", "(", "$", "itemsCollection", ")", ">", "1", "&&", "array_key...
Handles the trash-restore migration action @todo support handling of restoration to custom locations
[ "Handles", "the", "trash", "-", "restore", "migration", "action" ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/Executor/TrashManager.php#L49-L66
kaliop-uk/ezmigrationbundle
Core/Executor/TrashManager.php
TrashManager.delete
protected function delete($step) { $itemsCollection = $this->matchItems('delete', $step); $this->setReferences($itemsCollection, $step); $trashService = $this->repository->getTrashService(); foreach ($itemsCollection as $key => $item) { $trashService->deleteTrashItem($i...
php
protected function delete($step) { $itemsCollection = $this->matchItems('delete', $step); $this->setReferences($itemsCollection, $step); $trashService = $this->repository->getTrashService(); foreach ($itemsCollection as $key => $item) { $trashService->deleteTrashItem($i...
[ "protected", "function", "delete", "(", "$", "step", ")", "{", "$", "itemsCollection", "=", "$", "this", "->", "matchItems", "(", "'delete'", ",", "$", "step", ")", ";", "$", "this", "->", "setReferences", "(", "$", "itemsCollection", ",", "$", "step", ...
Handles the trash-delete migration action
[ "Handles", "the", "trash", "-", "delete", "migration", "action" ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/Executor/TrashManager.php#L71-L85
kaliop-uk/ezmigrationbundle
Core/Matcher/ReferenceMatcher.php
ReferenceMatcher.validateConditions
protected function validateConditions(array $conditions) { foreach ($conditions as $key => $val) { if ($this->referenceResolver->isReference($key)) { return true; } } return parent::validateConditions($conditions); }
php
protected function validateConditions(array $conditions) { foreach ($conditions as $key => $val) { if ($this->referenceResolver->isReference($key)) { return true; } } return parent::validateConditions($conditions); }
[ "protected", "function", "validateConditions", "(", "array", "$", "conditions", ")", "{", "foreach", "(", "$", "conditions", "as", "$", "key", "=>", "$", "val", ")", "{", "if", "(", "$", "this", "->", "referenceResolver", "->", "isReference", "(", "$", "...
condition would be taken into account...
[ "condition", "would", "be", "taken", "into", "account", "..." ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/Matcher/ReferenceMatcher.php#L66-L75
kaliop-uk/ezmigrationbundle
Core/ReferenceResolver/EmbeddedRegexpReferenceResolverTrait.php
EmbeddedRegexpReferenceResolverTrait.resolveEmbeddedReferences
public function resolveEmbeddedReferences($string) { $regexp = $this->getEmbeddedRegexp(); $count = preg_match_all($regexp, $string, $matches); // $matches[0][] will have the matched full string eg.: [reference:example_reference] if ($count) { foreach ($matches[0] as $ref...
php
public function resolveEmbeddedReferences($string) { $regexp = $this->getEmbeddedRegexp(); $count = preg_match_all($regexp, $string, $matches); // $matches[0][] will have the matched full string eg.: [reference:example_reference] if ($count) { foreach ($matches[0] as $ref...
[ "public", "function", "resolveEmbeddedReferences", "(", "$", "string", ")", "{", "$", "regexp", "=", "$", "this", "->", "getEmbeddedRegexp", "(", ")", ";", "$", "count", "=", "preg_match_all", "(", "$", "regexp", ",", "$", "string", ",", "$", "matches", ...
Returns the $string with eventual refs resolved @param string $string @return string @todo q: if reference is an array, should we recurse on it ?
[ "Returns", "the", "$string", "with", "eventual", "refs", "resolved" ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/ReferenceResolver/EmbeddedRegexpReferenceResolverTrait.php#L31-L46
kaliop-uk/ezmigrationbundle
Core/ReferenceResolver/EmbeddedRegexpReferenceResolverTrait.php
EmbeddedRegexpReferenceResolverTrait.getEmbeddedRegexp
protected function getEmbeddedRegexp() { // we need to alter the regexp we usr for std ref resolving, as it will be used to match parts of text, not the whole string $regexp = substr($this->getRegexp(), 1, -1); return '/' . preg_quote($this->beginToken). preg_replace(array('/^\^/'), array(''...
php
protected function getEmbeddedRegexp() { // we need to alter the regexp we usr for std ref resolving, as it will be used to match parts of text, not the whole string $regexp = substr($this->getRegexp(), 1, -1); return '/' . preg_quote($this->beginToken). preg_replace(array('/^\^/'), array(''...
[ "protected", "function", "getEmbeddedRegexp", "(", ")", "{", "// we need to alter the regexp we usr for std ref resolving, as it will be used to match parts of text, not the whole string", "$", "regexp", "=", "substr", "(", "$", "this", "->", "getRegexp", "(", ")", ",", "1", ...
NB: here we assume that all regexp resolvers give us a regexp with a very specific format, notably using '/' as delimiter...... @return string @todo make the start and end tokens flexible (it probably wont work well if we use eg. '}}' as end token)
[ "NB", ":", "here", "we", "assume", "that", "all", "regexp", "resolvers", "give", "us", "a", "regexp", "with", "a", "very", "specific", "format", "notably", "using", "/", "as", "delimiter", "......" ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/ReferenceResolver/EmbeddedRegexpReferenceResolverTrait.php#L54-L59
kaliop-uk/ezmigrationbundle
Core/Executor/RoleManager.php
RoleManager.create
protected function create($step) { $roleService = $this->repository->getRoleService(); $userService = $this->repository->getUserService(); $roleName = $this->referenceResolver->resolveReference($step->dsl['name']); $roleCreateStruct = $roleService->newRoleCreateStruct($roleName); ...
php
protected function create($step) { $roleService = $this->repository->getRoleService(); $userService = $this->repository->getUserService(); $roleName = $this->referenceResolver->resolveReference($step->dsl['name']); $roleCreateStruct = $roleService->newRoleCreateStruct($roleName); ...
[ "protected", "function", "create", "(", "$", "step", ")", "{", "$", "roleService", "=", "$", "this", "->", "repository", "->", "getRoleService", "(", ")", ";", "$", "userService", "=", "$", "this", "->", "repository", "->", "getUserService", "(", ")", ";...
Method to handle the create operation of the migration instructions
[ "Method", "to", "handle", "the", "create", "operation", "of", "the", "migration", "instructions" ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/Executor/RoleManager.php#L35-L62
kaliop-uk/ezmigrationbundle
Core/Executor/RoleManager.php
RoleManager.update
protected function update($step) { $roleCollection = $this->matchRoles('update', $step); if (count($roleCollection) > 1 && isset($step->dsl['references'])) { throw new \Exception("Can not execute Role update because multiple roles match, and a references section is specified in the dsl....
php
protected function update($step) { $roleCollection = $this->matchRoles('update', $step); if (count($roleCollection) > 1 && isset($step->dsl['references'])) { throw new \Exception("Can not execute Role update because multiple roles match, and a references section is specified in the dsl....
[ "protected", "function", "update", "(", "$", "step", ")", "{", "$", "roleCollection", "=", "$", "this", "->", "matchRoles", "(", "'update'", ",", "$", "step", ")", ";", "if", "(", "count", "(", "$", "roleCollection", ")", ">", "1", "&&", "isset", "("...
Method to handle the update operation of the migration instructions
[ "Method", "to", "handle", "the", "update", "operation", "of", "the", "migration", "instructions" ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/Executor/RoleManager.php#L76-L127
kaliop-uk/ezmigrationbundle
Core/Executor/RoleManager.php
RoleManager.delete
protected function delete($step) { $roleCollection = $this->matchRoles('delete', $step); $this->setReferences($roleCollection, $step); $roleService = $this->repository->getRoleService(); foreach ($roleCollection as $role) { $roleService->deleteRole($role); } ...
php
protected function delete($step) { $roleCollection = $this->matchRoles('delete', $step); $this->setReferences($roleCollection, $step); $roleService = $this->repository->getRoleService(); foreach ($roleCollection as $role) { $roleService->deleteRole($role); } ...
[ "protected", "function", "delete", "(", "$", "step", ")", "{", "$", "roleCollection", "=", "$", "this", "->", "matchRoles", "(", "'delete'", ",", "$", "step", ")", ";", "$", "this", "->", "setReferences", "(", "$", "roleCollection", ",", "$", "step", "...
Method to handle the delete operation of the migration instructions
[ "Method", "to", "handle", "the", "delete", "operation", "of", "the", "migration", "instructions" ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/Executor/RoleManager.php#L132-L145
kaliop-uk/ezmigrationbundle
Core/Executor/RoleManager.php
RoleManager.createLimitation
protected function createLimitation(RoleService $roleService, array $limitation) { $limitationType = $roleService->getLimitationType($limitation['identifier']); $limitationValue = is_array($limitation['values']) ? $limitation['values'] : array($limitation['values']); foreach ($limitationVa...
php
protected function createLimitation(RoleService $roleService, array $limitation) { $limitationType = $roleService->getLimitationType($limitation['identifier']); $limitationValue = is_array($limitation['values']) ? $limitation['values'] : array($limitation['values']); foreach ($limitationVa...
[ "protected", "function", "createLimitation", "(", "RoleService", "$", "roleService", ",", "array", "$", "limitation", ")", "{", "$", "limitationType", "=", "$", "roleService", "->", "getLimitationType", "(", "$", "limitation", "[", "'identifier'", "]", ")", ";",...
Create a new Limitation object based on the type and value in the $limitation array. <pre> $limitation = array( 'identifier' => Type of the limitation 'values' => array(Values to base the limitation on) ) </pre> @param \eZ\Publish\API\Repository\RoleService $roleService @param array $limitation @return Limitation
[ "Create", "a", "new", "Limitation", "object", "based", "on", "the", "type", "and", "value", "in", "the", "$limitation", "array", "." ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/Executor/RoleManager.php#L301-L312
kaliop-uk/ezmigrationbundle
Core/Executor/RoleManager.php
RoleManager.assignRole
protected function assignRole(Role $role, RoleService $roleService, UserService $userService, array $assignments) { foreach ($assignments as $assign) { switch ($assign['type']) { case 'user': foreach ($assign['ids'] as $userId) { $userI...
php
protected function assignRole(Role $role, RoleService $roleService, UserService $userService, array $assignments) { foreach ($assignments as $assign) { switch ($assign['type']) { case 'user': foreach ($assign['ids'] as $userId) { $userI...
[ "protected", "function", "assignRole", "(", "Role", "$", "role", ",", "RoleService", "$", "roleService", ",", "UserService", "$", "userService", ",", "array", "$", "assignments", ")", "{", "foreach", "(", "$", "assignments", "as", "$", "assign", ")", "{", ...
Assign a role to users and groups in the assignment array. <pre> $assignments = array( array( 'type' => 'user', 'ids' => array(user ids), 'limitation' => array(limitations) ) ) </pre> @param \eZ\Publish\API\Repository\Values\User\Role $role @param \eZ\Publish\API\Repository\RoleService $roleService @param \eZ\Publish...
[ "Assign", "a", "role", "to", "users", "and", "groups", "in", "the", "assignment", "array", "." ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/Executor/RoleManager.php#L332-L376
kaliop-uk/ezmigrationbundle
Core/Executor/RoleManager.php
RoleManager.addPolicy
protected function addPolicy(Role $role, RoleService $roleService, array $policy) { $policyCreateStruct = $roleService->newPolicyCreateStruct($policy['module'], $policy['function']); if (array_key_exists('limitations', $policy)) { foreach ($policy['limitations'] as $limitation) { ...
php
protected function addPolicy(Role $role, RoleService $roleService, array $policy) { $policyCreateStruct = $roleService->newPolicyCreateStruct($policy['module'], $policy['function']); if (array_key_exists('limitations', $policy)) { foreach ($policy['limitations'] as $limitation) { ...
[ "protected", "function", "addPolicy", "(", "Role", "$", "role", ",", "RoleService", "$", "roleService", ",", "array", "$", "policy", ")", "{", "$", "policyCreateStruct", "=", "$", "roleService", "->", "newPolicyCreateStruct", "(", "$", "policy", "[", "'module'...
Add new policies to the $role Role. @param \eZ\Publish\API\Repository\Values\User\Role $role @param \eZ\Publish\API\Repository\RoleService $roleService @param array $policy
[ "Add", "new", "policies", "to", "the", "$role", "Role", "." ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/Executor/RoleManager.php#L385-L397
kaliop-uk/ezmigrationbundle
Command/AbstractCommand.php
AbstractCommand.writeln
protected function writeln($message, $verbosity = OutputInterface::VERBOSITY_NORMAL, $type = OutputInterface::OUTPUT_NORMAL) { if ($this->verbosity >= $verbosity) { $this->output->writeln($message, $type); } }
php
protected function writeln($message, $verbosity = OutputInterface::VERBOSITY_NORMAL, $type = OutputInterface::OUTPUT_NORMAL) { if ($this->verbosity >= $verbosity) { $this->output->writeln($message, $type); } }
[ "protected", "function", "writeln", "(", "$", "message", ",", "$", "verbosity", "=", "OutputInterface", "::", "VERBOSITY_NORMAL", ",", "$", "type", "=", "OutputInterface", "::", "OUTPUT_NORMAL", ")", "{", "if", "(", "$", "this", "->", "verbosity", ">=", "$",...
Small trick to allow us to: - lower verbosity between NORMAL and QUIET - have a decent writeln API, even with old SF versions @param string|array $message The message as an array of lines or a single string @param int $verbosity @param int $type
[ "Small", "trick", "to", "allow", "us", "to", ":", "-", "lower", "verbosity", "between", "NORMAL", "and", "QUIET", "-", "have", "a", "decent", "writeln", "API", "even", "with", "old", "SF", "versions" ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Command/AbstractCommand.php#L57-L62
kaliop-uk/ezmigrationbundle
Core/FieldHandler/EzImage.php
EzImage.hashToFieldValue
public function hashToFieldValue($fieldValue, array $context = array()) { $altText = ''; $fileName = ''; if ($fieldValue === null) { return new ImageValue(); } else if (is_string($fieldValue)) { $filePath = $fieldValue; } else { $filePath ...
php
public function hashToFieldValue($fieldValue, array $context = array()) { $altText = ''; $fileName = ''; if ($fieldValue === null) { return new ImageValue(); } else if (is_string($fieldValue)) { $filePath = $fieldValue; } else { $filePath ...
[ "public", "function", "hashToFieldValue", "(", "$", "fieldValue", ",", "array", "$", "context", "=", "array", "(", ")", ")", "{", "$", "altText", "=", "''", ";", "$", "fileName", "=", "''", ";", "if", "(", "$", "fieldValue", "===", "null", ")", "{", ...
Creates a value object to use as the field value when setting an image field type. @param array|string $fieldValue The path to the file or an array with 'path' and 'alt_text' keys @param array $context The context for execution of the current migrations. Contains f.e. the path to the migration @return ImageValue @tod...
[ "Creates", "a", "value", "object", "to", "use", "as", "the", "field", "value", "when", "setting", "an", "image", "field", "type", "." ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/FieldHandler/EzImage.php#L19-L54
kaliop-uk/ezmigrationbundle
Core/Matcher/LocationMatcher.php
LocationMatcher.getConditionsFromKey
protected function getConditionsFromKey($key) { if (is_int($key) || ctype_digit($key)) { return array(self::MATCH_LOCATION_ID => $key); } return array(self::MATCH_LOCATION_REMOTE_ID => $key); }
php
protected function getConditionsFromKey($key) { if (is_int($key) || ctype_digit($key)) { return array(self::MATCH_LOCATION_ID => $key); } return array(self::MATCH_LOCATION_REMOTE_ID => $key); }
[ "protected", "function", "getConditionsFromKey", "(", "$", "key", ")", "{", "if", "(", "is_int", "(", "$", "key", ")", "||", "ctype_digit", "(", "$", "key", ")", ")", "{", "return", "array", "(", "self", "::", "MATCH_LOCATION_ID", "=>", "$", "key", ")"...
When matching by key, we accept location Id and remote Id only @param int|string $key @return array
[ "When", "matching", "by", "key", "we", "accept", "location", "Id", "and", "remote", "Id", "only" ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/Matcher/LocationMatcher.php#L108-L114
kaliop-uk/ezmigrationbundle
Core/Matcher/LocationMatcher.php
LocationMatcher.findLocationsByContentIds
protected function findLocationsByContentIds(array $contentIds) { $locations = []; foreach ($contentIds as $contentId) { $content = $this->repository->getContentService()->loadContent($contentId); foreach($this->repository->getLocationService()->loadLocations($content->conte...
php
protected function findLocationsByContentIds(array $contentIds) { $locations = []; foreach ($contentIds as $contentId) { $content = $this->repository->getContentService()->loadContent($contentId); foreach($this->repository->getLocationService()->loadLocations($content->conte...
[ "protected", "function", "findLocationsByContentIds", "(", "array", "$", "contentIds", ")", "{", "$", "locations", "=", "[", "]", ";", "foreach", "(", "$", "contentIds", "as", "$", "contentId", ")", "{", "$", "content", "=", "$", "this", "->", "repository"...
Returns all locations of a set of objects @param int[] $contentIds @return Location[] @deprecated
[ "Returns", "all", "locations", "of", "a", "set", "of", "objects" ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/Matcher/LocationMatcher.php#L160-L172
kaliop-uk/ezmigrationbundle
Core/Matcher/LocationMatcher.php
LocationMatcher.findLocationsByContentRemoteIds
protected function findLocationsByContentRemoteIds(array $remoteContentIds) { $locations = []; foreach ($remoteContentIds as $remoteContentId) { $content = $this->repository->getContentService()->loadContentByRemoteId($remoteContentId); foreach($this->repository->getLocation...
php
protected function findLocationsByContentRemoteIds(array $remoteContentIds) { $locations = []; foreach ($remoteContentIds as $remoteContentId) { $content = $this->repository->getContentService()->loadContentByRemoteId($remoteContentId); foreach($this->repository->getLocation...
[ "protected", "function", "findLocationsByContentRemoteIds", "(", "array", "$", "remoteContentIds", ")", "{", "$", "locations", "=", "[", "]", ";", "foreach", "(", "$", "remoteContentIds", "as", "$", "remoteContentId", ")", "{", "$", "content", "=", "$", "this"...
Returns all locations of a set of objects @param int[] $remoteContentIds @return Location[] @deprecated
[ "Returns", "all", "locations", "of", "a", "set", "of", "objects" ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/Matcher/LocationMatcher.php#L181-L193
kaliop-uk/ezmigrationbundle
Core/DefinitionParser/PHPDefinitionParser.php
PHPDefinitionParser.parseMigrationDefinition
public function parseMigrationDefinition(MigrationDefinition $definition) { $status = MigrationDefinition::STATUS_PARSED; /// validate that php file is ok, contains a class with good interface $className = $this->getClassNameFromFile($definition->path); if ($className == '') { ...
php
public function parseMigrationDefinition(MigrationDefinition $definition) { $status = MigrationDefinition::STATUS_PARSED; /// validate that php file is ok, contains a class with good interface $className = $this->getClassNameFromFile($definition->path); if ($className == '') { ...
[ "public", "function", "parseMigrationDefinition", "(", "MigrationDefinition", "$", "definition", ")", "{", "$", "status", "=", "MigrationDefinition", "::", "STATUS_PARSED", ";", "/// validate that php file is ok, contains a class with good interface", "$", "className", "=", "...
Parses a migration definition file, and returns the list of actions to take @param MigrationDefinition $definition @return MigrationDefinition
[ "Parses", "a", "migration", "definition", "file", "and", "returns", "the", "list", "of", "actions", "to", "take" ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/DefinitionParser/PHPDefinitionParser.php#L32-L91
kaliop-uk/ezmigrationbundle
Core/ReferenceResolver/PrefixBasedResolver.php
PrefixBasedResolver.getReferenceIdentifierByPrefix
protected function getReferenceIdentifierByPrefix($stringIdentifier) { foreach ($this->referencePrefixes as $prefix) { $regexp = '/^' . preg_quote($prefix, '/') . '/'; if (preg_match($regexp, $stringIdentifier)) { return array('prefix' => $prefix, 'identifier' => preg...
php
protected function getReferenceIdentifierByPrefix($stringIdentifier) { foreach ($this->referencePrefixes as $prefix) { $regexp = '/^' . preg_quote($prefix, '/') . '/'; if (preg_match($regexp, $stringIdentifier)) { return array('prefix' => $prefix, 'identifier' => preg...
[ "protected", "function", "getReferenceIdentifierByPrefix", "(", "$", "stringIdentifier", ")", "{", "foreach", "(", "$", "this", "->", "referencePrefixes", "as", "$", "prefix", ")", "{", "$", "regexp", "=", "'/^'", ".", "preg_quote", "(", "$", "prefix", ",", ...
Useful for subclasses with many $referencePrefixes @param string $stringIdentifier @return array with 2 keys, 'prefix' and 'identifier' @throws \Exception
[ "Useful", "for", "subclasses", "with", "many", "$referencePrefixes" ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/ReferenceResolver/PrefixBasedResolver.php#L78-L87
kaliop-uk/ezmigrationbundle
Core/ReferenceResolver/CustomReferenceResolver.php
CustomReferenceResolver.getReferenceValue
public function getReferenceValue($identifier) { $identifier = $this->getReferenceIdentifier($identifier); if (!array_key_exists($identifier, $this->references)) { throw new \Exception("No reference set with identifier '$identifier'"); } return $this->references[$identif...
php
public function getReferenceValue($identifier) { $identifier = $this->getReferenceIdentifier($identifier); if (!array_key_exists($identifier, $this->references)) { throw new \Exception("No reference set with identifier '$identifier'"); } return $this->references[$identif...
[ "public", "function", "getReferenceValue", "(", "$", "identifier", ")", "{", "$", "identifier", "=", "$", "this", "->", "getReferenceIdentifier", "(", "$", "identifier", ")", ";", "if", "(", "!", "array_key_exists", "(", "$", "identifier", ",", "$", "this", ...
Get a stored reference @param string $identifier format: reference:<some_custom_identifier> @return mixed @throws \Exception When trying to retrieve an unset reference
[ "Get", "a", "stored", "reference" ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/ReferenceResolver/CustomReferenceResolver.php#L34-L42
kaliop-uk/ezmigrationbundle
Core/ReferenceResolver/CustomReferenceResolver.php
CustomReferenceResolver.addReference
public function addReference($identifier, $value, $overwrite = false) { if (array_key_exists($identifier, $this->references) && !$overwrite) { throw new \Exception("A reference with identifier '$identifier' already exists"); } $this->references[$identifier] = $value; re...
php
public function addReference($identifier, $value, $overwrite = false) { if (array_key_exists($identifier, $this->references) && !$overwrite) { throw new \Exception("A reference with identifier '$identifier' already exists"); } $this->references[$identifier] = $value; re...
[ "public", "function", "addReference", "(", "$", "identifier", ",", "$", "value", ",", "$", "overwrite", "=", "false", ")", "{", "if", "(", "array_key_exists", "(", "$", "identifier", ",", "$", "this", "->", "references", ")", "&&", "!", "$", "overwrite",...
Add a reference to be retrieved later. @param string $identifier The identifier of the reference @param mixed $value The value of the reference @param bool $overwrite do overwrite the existing ref if it exist without raising an exception @return bool true if the reference is accepted by this resolver, otherwise false ...
[ "Add", "a", "reference", "to", "be", "retrieved", "later", "." ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/ReferenceResolver/CustomReferenceResolver.php#L53-L62
kaliop-uk/ezmigrationbundle
Core/MigrationService.php
MigrationService.getMigrationsDefinitions
public function getMigrationsDefinitions(array $paths = array()) { // we try to be flexible in file types we support, and the same time avoid loading all files in a directory $handledDefinitions = array(); foreach ($this->loader->listAvailableDefinitions($paths) as $migrationName => $definit...
php
public function getMigrationsDefinitions(array $paths = array()) { // we try to be flexible in file types we support, and the same time avoid loading all files in a directory $handledDefinitions = array(); foreach ($this->loader->listAvailableDefinitions($paths) as $migrationName => $definit...
[ "public", "function", "getMigrationsDefinitions", "(", "array", "$", "paths", "=", "array", "(", ")", ")", "{", "// we try to be flexible in file types we support, and the same time avoid loading all files in a directory", "$", "handledDefinitions", "=", "array", "(", ")", ";...
NB: returns UNPARSED definitions @param string[] $paths @return MigrationDefinitionCollection key: migration name, value: migration definition as binary string
[ "NB", ":", "returns", "UNPARSED", "definitions" ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/MigrationService.php#L120-L138
kaliop-uk/ezmigrationbundle
Core/MigrationService.php
MigrationService.getMigrations
public function getMigrations($limit = null, $offset = null) { return $this->storageHandler->loadMigrations($limit, $offset); }
php
public function getMigrations($limit = null, $offset = null) { return $this->storageHandler->loadMigrations($limit, $offset); }
[ "public", "function", "getMigrations", "(", "$", "limit", "=", "null", ",", "$", "offset", "=", "null", ")", "{", "return", "$", "this", "->", "storageHandler", "->", "loadMigrations", "(", "$", "limit", ",", "$", "offset", ")", ";", "}" ]
Returns the list of all the migrations which where executed or attempted so far @param int $limit 0 or below will be treated as 'no limit' @param int $offset @return \Kaliop\eZMigrationBundle\API\Collection\MigrationCollection
[ "Returns", "the", "list", "of", "all", "the", "migrations", "which", "where", "executed", "or", "attempted", "so", "far" ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/MigrationService.php#L147-L150
kaliop-uk/ezmigrationbundle
Core/MigrationService.php
MigrationService.getMigrationsByStatus
public function getMigrationsByStatus($status, $limit = null, $offset = null) { return $this->storageHandler->loadMigrationsByStatus($status, $limit, $offset); }
php
public function getMigrationsByStatus($status, $limit = null, $offset = null) { return $this->storageHandler->loadMigrationsByStatus($status, $limit, $offset); }
[ "public", "function", "getMigrationsByStatus", "(", "$", "status", ",", "$", "limit", "=", "null", ",", "$", "offset", "=", "null", ")", "{", "return", "$", "this", "->", "storageHandler", "->", "loadMigrationsByStatus", "(", "$", "status", ",", "$", "limi...
Returns the list of all the migrations in a given status which where executed or attempted so far @param int $status @param int $limit 0 or below will be treated as 'no limit' @param int $offset @return \Kaliop\eZMigrationBundle\API\Collection\MigrationCollection
[ "Returns", "the", "list", "of", "all", "the", "migrations", "in", "a", "given", "status", "which", "where", "executed", "or", "attempted", "so", "far" ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/MigrationService.php#L160-L163
kaliop-uk/ezmigrationbundle
Core/MigrationService.php
MigrationService.parseMigrationDefinition
public function parseMigrationDefinition(MigrationDefinition $migrationDefinition) { foreach ($this->DefinitionParsers as $definitionParser) { if ($definitionParser->supports($migrationDefinition->name)) { // parse the source file $migrationDefinition = $definitio...
php
public function parseMigrationDefinition(MigrationDefinition $migrationDefinition) { foreach ($this->DefinitionParsers as $definitionParser) { if ($definitionParser->supports($migrationDefinition->name)) { // parse the source file $migrationDefinition = $definitio...
[ "public", "function", "parseMigrationDefinition", "(", "MigrationDefinition", "$", "migrationDefinition", ")", "{", "foreach", "(", "$", "this", "->", "DefinitionParsers", "as", "$", "definitionParser", ")", "{", "if", "(", "$", "definitionParser", "->", "supports",...
Parses a migration definition, return a parsed definition. If there is a parsing error, the definition status will be updated accordingly @param MigrationDefinition $migrationDefinition @return MigrationDefinition @throws \Exception if the migrationDefinition has no suitable parser for its source format
[ "Parses", "a", "migration", "definition", "return", "a", "parsed", "definition", ".", "If", "there", "is", "a", "parsing", "error", "the", "definition", "status", "will", "be", "updated", "accordingly" ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/MigrationService.php#L218-L244
kaliop-uk/ezmigrationbundle
Core/MigrationService.php
MigrationService.executeMigration
public function executeMigration(MigrationDefinition $migrationDefinition, $useTransaction = true, $defaultLanguageCode = null, $adminLogin = null, $force = false, $forceSigchildEnabled = null) { if ($migrationDefinition->status == MigrationDefinition::STATUS_TO_PARSE) { $migrationDefini...
php
public function executeMigration(MigrationDefinition $migrationDefinition, $useTransaction = true, $defaultLanguageCode = null, $adminLogin = null, $force = false, $forceSigchildEnabled = null) { if ($migrationDefinition->status == MigrationDefinition::STATUS_TO_PARSE) { $migrationDefini...
[ "public", "function", "executeMigration", "(", "MigrationDefinition", "$", "migrationDefinition", ",", "$", "useTransaction", "=", "true", ",", "$", "defaultLanguageCode", "=", "null", ",", "$", "adminLogin", "=", "null", ",", "$", "force", "=", "false", ",", ...
@param MigrationDefinition $migrationDefinition @param bool $useTransaction when set to false, no repo transaction will be used to wrap the migration @param string $defaultLanguageCode @param string|int|false|null $adminLogin when false, current user is used; when null, hardcoded admin account @param bool $force when t...
[ "@param", "MigrationDefinition", "$migrationDefinition", "@param", "bool", "$useTransaction", "when", "set", "to", "false", "no", "repo", "transaction", "will", "be", "used", "to", "wrap", "the", "migration", "@param", "string", "$defaultLanguageCode", "@param", "stri...
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/MigrationService.php#L259-L277
kaliop-uk/ezmigrationbundle
Core/MigrationService.php
MigrationService.resumeMigration
public function resumeMigration(Migration $migration, $useTransaction = true) { if ($migration->status != Migration::STATUS_SUSPENDED) { throw new \Exception("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': it is not in suspended status"); } $migrationD...
php
public function resumeMigration(Migration $migration, $useTransaction = true) { if ($migration->status != Migration::STATUS_SUSPENDED) { throw new \Exception("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': it is not in suspended status"); } $migrationD...
[ "public", "function", "resumeMigration", "(", "Migration", "$", "migration", ",", "$", "useTransaction", "=", "true", ")", "{", "if", "(", "$", "migration", "->", "status", "!=", "Migration", "::", "STATUS_SUSPENDED", ")", "{", "throw", "new", "\\", "Excepti...
@param Migration $migration @param bool $useTransaction @throws \Exception @todo add support for adminLogin ?
[ "@param", "Migration", "$migration", "@param", "bool", "$useTransaction", "@throws", "\\", "Exception" ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/MigrationService.php#L433-L473
kaliop-uk/ezmigrationbundle
Core/MigrationService.php
MigrationService.getFullExceptionMessage
protected function getFullExceptionMessage(\Exception $e) { $message = $e->getMessage(); if (is_a($e, '\eZ\Publish\API\Repository\Exceptions\ContentTypeFieldDefinitionValidationException') || is_a($e, '\eZ\Publish\API\Repository\Exceptions\LimitationValidationException') || i...
php
protected function getFullExceptionMessage(\Exception $e) { $message = $e->getMessage(); if (is_a($e, '\eZ\Publish\API\Repository\Exceptions\ContentTypeFieldDefinitionValidationException') || is_a($e, '\eZ\Publish\API\Repository\Exceptions\LimitationValidationException') || i...
[ "protected", "function", "getFullExceptionMessage", "(", "\\", "Exception", "$", "e", ")", "{", "$", "message", "=", "$", "e", "->", "getMessage", "(", ")", ";", "if", "(", "is_a", "(", "$", "e", ",", "'\\eZ\\Publish\\API\\Repository\\Exceptions\\ContentTypeFiel...
Turns eZPublish cryptic exceptions into something more palatable for random devs @todo should this be moved to a lower layer ? @param \Exception $e @return string
[ "Turns", "eZPublish", "cryptic", "exceptions", "into", "something", "more", "palatable", "for", "random", "devs", "@todo", "should", "this", "be", "moved", "to", "a", "lower", "layer", "?" ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/MigrationService.php#L529-L575
kaliop-uk/ezmigrationbundle
Core/FieldHandler/EzBinaryFile.php
EzBinaryFile.hashToFieldValue
public function hashToFieldValue($fieldValue, array $context = array()) { $mimeType = ''; $fileName = ''; if ($fieldValue === null) { return new BinaryFileValue(); } if (is_string($fieldValue)) { $filePath = $fieldValue; } else { $filePath...
php
public function hashToFieldValue($fieldValue, array $context = array()) { $mimeType = ''; $fileName = ''; if ($fieldValue === null) { return new BinaryFileValue(); } if (is_string($fieldValue)) { $filePath = $fieldValue; } else { $filePath...
[ "public", "function", "hashToFieldValue", "(", "$", "fieldValue", ",", "array", "$", "context", "=", "array", "(", ")", ")", "{", "$", "mimeType", "=", "''", ";", "$", "fileName", "=", "''", ";", "if", "(", "$", "fieldValue", "===", "null", ")", "{",...
@param array|string $fieldValue The path to the file or an array with 'path' key @param array $context The context for execution of the current migrations. Contains f.e. the path to the migration @return BinaryFileValue @todo resolve refs more
[ "@param", "array|string", "$fieldValue", "The", "path", "to", "the", "file", "or", "an", "array", "with", "path", "key", "@param", "array", "$context", "The", "context", "for", "execution", "of", "the", "current", "migrations", ".", "Contains", "f", ".", "e"...
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/FieldHandler/EzBinaryFile.php#L17-L52
kaliop-uk/ezmigrationbundle
Core/FieldHandler/EzBinaryFile.php
EzBinaryFile.fieldValueToHash
public function fieldValueToHash($fieldValue, array $context = array()) { if ($fieldValue->uri == null) { return null; } return array( 'path' => realpath($this->ioRootDir) . '/' . ($this->ioDecorator ? $this->ioDecorator->undecorate($fieldValue->uri) : $fieldValue->u...
php
public function fieldValueToHash($fieldValue, array $context = array()) { if ($fieldValue->uri == null) { return null; } return array( 'path' => realpath($this->ioRootDir) . '/' . ($this->ioDecorator ? $this->ioDecorator->undecorate($fieldValue->uri) : $fieldValue->u...
[ "public", "function", "fieldValueToHash", "(", "$", "fieldValue", ",", "array", "$", "context", "=", "array", "(", ")", ")", "{", "if", "(", "$", "fieldValue", "->", "uri", "==", "null", ")", "{", "return", "null", ";", "}", "return", "array", "(", "...
@param \eZ\Publish\Core\FieldType\BinaryFile\Value $fieldValue @param array $context @return array @todo check if this works in ezplatform
[ "@param", "\\", "eZ", "\\", "Publish", "\\", "Core", "\\", "FieldType", "\\", "BinaryFile", "\\", "Value", "$fieldValue", "@param", "array", "$context", "@return", "array" ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/FieldHandler/EzBinaryFile.php#L61-L72
kaliop-uk/ezmigrationbundle
MigrationVersions/20100101000200_MigrateV1ToV2.php
MigrateV1ToV2.getLegacyMigrationDefinition
private function getLegacyMigrationDefinition($version, $bundle) { if (!isset($this->activeBundles[$bundle])) { return false; } $versionsDir = $this->activeBundles[$bundle] . '/' . $this->legacyMigrationsDir; $versionDefinitions = glob($versionsDir . "/$version*"); ...
php
private function getLegacyMigrationDefinition($version, $bundle) { if (!isset($this->activeBundles[$bundle])) { return false; } $versionsDir = $this->activeBundles[$bundle] . '/' . $this->legacyMigrationsDir; $versionDefinitions = glob($versionsDir . "/$version*"); ...
[ "private", "function", "getLegacyMigrationDefinition", "(", "$", "version", ",", "$", "bundle", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "activeBundles", "[", "$", "bundle", "]", ")", ")", "{", "return", "false", ";", "}", "$", "versi...
Attempts to find the migration definition file. If more than one matches, the 1st found is returned @param string $version @param string $bundle @return string|false
[ "Attempts", "to", "find", "the", "migration", "definition", "file", ".", "If", "more", "than", "one", "matches", "the", "1st", "found", "is", "returned" ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/MigrationVersions/20100101000200_MigrateV1ToV2.php#L140-L164
kaliop-uk/ezmigrationbundle
Core/DefinitionParser/SQLDefinitionParser.php
SQLDefinitionParser.parseMigrationDefinition
public function parseMigrationDefinition(MigrationDefinition $definition) { $dbType = $this->getDBFromFile($definition->name); if (!in_array($dbType, $this->supportedDatabases)) { return new MigrationDefinition( $definition->name, $definition->pat...
php
public function parseMigrationDefinition(MigrationDefinition $definition) { $dbType = $this->getDBFromFile($definition->name); if (!in_array($dbType, $this->supportedDatabases)) { return new MigrationDefinition( $definition->name, $definition->pat...
[ "public", "function", "parseMigrationDefinition", "(", "MigrationDefinition", "$", "definition", ")", "{", "$", "dbType", "=", "$", "this", "->", "getDBFromFile", "(", "$", "definition", "->", "name", ")", ";", "if", "(", "!", "in_array", "(", "$", "dbType",...
Parses a migration definition file, and returns the list of actions to take @param MigrationDefinition $definition @return MigrationDefinition
[ "Parses", "a", "migration", "definition", "file", "and", "returns", "the", "list", "of", "actions", "to", "take" ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/DefinitionParser/SQLDefinitionParser.php#L39-L64
kaliop-uk/ezmigrationbundle
Core/DefinitionParser/SQLDefinitionParser.php
SQLDefinitionParser.getDBFromFile
protected function getDBFromFile($fileName) { $parts = explode('_', preg_replace('/\.sql$/', '', $fileName)); return isset($parts[1]) ? $parts[1] : null; }
php
protected function getDBFromFile($fileName) { $parts = explode('_', preg_replace('/\.sql$/', '', $fileName)); return isset($parts[1]) ? $parts[1] : null; }
[ "protected", "function", "getDBFromFile", "(", "$", "fileName", ")", "{", "$", "parts", "=", "explode", "(", "'_'", ",", "preg_replace", "(", "'/\\.sql$/'", ",", "''", ",", "$", "fileName", ")", ")", ";", "return", "isset", "(", "$", "parts", "[", "1",...
allow both aaaa_mysql_etc.sql and aaaa_mysql.sql
[ "allow", "both", "aaaa_mysql_etc", ".", "sql", "and", "aaaa_mysql", ".", "sql" ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/DefinitionParser/SQLDefinitionParser.php#L67-L71
kaliop-uk/ezmigrationbundle
Core/FieldHandler/EzXmlText.php
EzXmlText.hashToFieldValue
public function hashToFieldValue($fieldValue, array $context = array()) { if (is_string($fieldValue)) { $xmlText = $fieldValue; } else if (is_array($fieldValue) && isset($fieldValue['xml'])) { // native export format from eZ $xmlText = $fieldValue['xml']; ...
php
public function hashToFieldValue($fieldValue, array $context = array()) { if (is_string($fieldValue)) { $xmlText = $fieldValue; } else if (is_array($fieldValue) && isset($fieldValue['xml'])) { // native export format from eZ $xmlText = $fieldValue['xml']; ...
[ "public", "function", "hashToFieldValue", "(", "$", "fieldValue", ",", "array", "$", "context", "=", "array", "(", ")", ")", "{", "if", "(", "is_string", "(", "$", "fieldValue", ")", ")", "{", "$", "xmlText", "=", "$", "fieldValue", ";", "}", "else", ...
Replaces any references in an xml string to be used as the input data for an ezxmltext field. @param string|array $fieldValue The definition of teh field value, structured in the yml file. Either a string, or an array with key 'content' @param array $context The context for execution of the current migrations. Contain...
[ "Replaces", "any", "references", "in", "an", "xml", "string", "to", "be", "used", "as", "the", "input", "data", "for", "an", "ezxmltext", "field", "." ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/FieldHandler/EzXmlText.php#L29-L44
kaliop-uk/ezmigrationbundle
Command/MigrationCommand.php
MigrationCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { $this->setOutput($output); $this->setVerbosity($output->getVerbosity()); if (!$input->getOption('add') && !$input->getOption('delete') && !$input->getOption('skip') && !$input->getOption('info')) { thro...
php
protected function execute(InputInterface $input, OutputInterface $output) { $this->setOutput($output); $this->setVerbosity($output->getVerbosity()); if (!$input->getOption('add') && !$input->getOption('delete') && !$input->getOption('skip') && !$input->getOption('info')) { thro...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "this", "->", "setOutput", "(", "$", "output", ")", ";", "$", "this", "->", "setVerbosity", "(", "$", "output", "->", "getVerbosi...
Execute the command. @param InputInterface $input @param OutputInterface $output @return null|int null or 0 if everything went fine, or an error code
[ "Execute", "the", "command", "." ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Command/MigrationCommand.php#L55-L211
kaliop-uk/ezmigrationbundle
Core/Executor/UserManager.php
UserManager.create
protected function create($step) { if (!isset($step->dsl['groups'])) { throw new \Exception('No user groups set to create user in.'); } if (!is_array($step->dsl['groups'])) { $step->dsl['groups'] = array($step->dsl['groups']); } $userService = $this-...
php
protected function create($step) { if (!isset($step->dsl['groups'])) { throw new \Exception('No user groups set to create user in.'); } if (!is_array($step->dsl['groups'])) { $step->dsl['groups'] = array($step->dsl['groups']); } $userService = $this-...
[ "protected", "function", "create", "(", "$", "step", ")", "{", "if", "(", "!", "isset", "(", "$", "step", "->", "dsl", "[", "'groups'", "]", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "'No user groups set to create user in.'", ")", ";", "}", ...
Creates a user based on the DSL instructions. @todo allow setting extra profile attributes!
[ "Creates", "a", "user", "based", "on", "the", "DSL", "instructions", "." ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/Executor/UserManager.php#L33-L75
kaliop-uk/ezmigrationbundle
Core/Executor/UserManager.php
UserManager.update
protected function update($step) { $userCollection = $this->matchUsers('user', $step); if (count($userCollection) > 1 && isset($step->dsl['references'])) { throw new \Exception("Can not execute User update because multiple users match, and a references section is specified in the dsl. R...
php
protected function update($step) { $userCollection = $this->matchUsers('user', $step); if (count($userCollection) > 1 && isset($step->dsl['references'])) { throw new \Exception("Can not execute User update because multiple users match, and a references section is specified in the dsl. R...
[ "protected", "function", "update", "(", "$", "step", ")", "{", "$", "userCollection", "=", "$", "this", "->", "matchUsers", "(", "'user'", ",", "$", "step", ")", ";", "if", "(", "count", "(", "$", "userCollection", ")", ">", "1", "&&", "isset", "(", ...
Method to handle the update operation of the migration instructions @todo allow setting extra profile attributes!
[ "Method", "to", "handle", "the", "update", "operation", "of", "the", "migration", "instructions" ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/Executor/UserManager.php#L91-L164
kaliop-uk/ezmigrationbundle
Core/Executor/UserManager.php
UserManager.delete
protected function delete($step) { $userCollection = $this->matchUsers('delete', $step); $this->setReferences($userCollection, $step); $userService = $this->repository->getUserService(); foreach ($userCollection as $user) { $userService->deleteUser($user); } ...
php
protected function delete($step) { $userCollection = $this->matchUsers('delete', $step); $this->setReferences($userCollection, $step); $userService = $this->repository->getUserService(); foreach ($userCollection as $user) { $userService->deleteUser($user); } ...
[ "protected", "function", "delete", "(", "$", "step", ")", "{", "$", "userCollection", "=", "$", "this", "->", "matchUsers", "(", "'delete'", ",", "$", "step", ")", ";", "$", "this", "->", "setReferences", "(", "$", "userCollection", ",", "$", "step", "...
Method to handle the delete operation of the migration instructions
[ "Method", "to", "handle", "the", "delete", "operation", "of", "the", "migration", "instructions" ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/Executor/UserManager.php#L169-L182
kaliop-uk/ezmigrationbundle
Core/Executor/UserManager.php
UserManager.getReferencesValues
protected function getReferencesValues($user, array $references, $step) { $refs = array(); foreach ($references as $reference) { switch ($reference['attribute']) { case 'user_id': case 'id': $value = $user->id; bre...
php
protected function getReferencesValues($user, array $references, $step) { $refs = array(); foreach ($references as $reference) { switch ($reference['attribute']) { case 'user_id': case 'id': $value = $user->id; bre...
[ "protected", "function", "getReferencesValues", "(", "$", "user", ",", "array", "$", "references", ",", "$", "step", ")", "{", "$", "refs", "=", "array", "(", ")", ";", "foreach", "(", "$", "references", "as", "$", "reference", ")", "{", "switch", "(",...
@param User $user @param array $references the definitions of the references to set @throws \InvalidArgumentException When trying to assign a reference to an unsupported attribute @return array key: the reference names, values: the reference values @todo allow setting refs to all the attributes that can be gotten for ...
[ "@param", "User", "$user", "@param", "array", "$references", "the", "definitions", "of", "the", "references", "to", "set", "@throws", "\\", "InvalidArgumentException", "When", "trying", "to", "assign", "a", "reference", "to", "an", "unsupported", "attribute", "@re...
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/Executor/UserManager.php#L229-L265
kaliop-uk/ezmigrationbundle
Core/ReferenceResolver/ChainPrefixResolver.php
ChainPrefixResolver.getRegexp
public function getRegexp() { $regexps = array(); /** @var PrefixBasedResolverInterface $resolver */ foreach ($this->resolvers as $resolver) { $regexp = preg_replace('/^\^/', '', substr($resolver->getRegexp(), 1, -1)); if ($regexp !== '') { $regexps[] ...
php
public function getRegexp() { $regexps = array(); /** @var PrefixBasedResolverInterface $resolver */ foreach ($this->resolvers as $resolver) { $regexp = preg_replace('/^\^/', '', substr($resolver->getRegexp(), 1, -1)); if ($regexp !== '') { $regexps[] ...
[ "public", "function", "getRegexp", "(", ")", "{", "$", "regexps", "=", "array", "(", ")", ";", "/** @var PrefixBasedResolverInterface $resolver */", "foreach", "(", "$", "this", "->", "resolvers", "as", "$", "resolver", ")", "{", "$", "regexp", "=", "preg_repl...
NB: assumes that all the resolvers we chain use '/' as delimiter... @return string
[ "NB", ":", "assumes", "that", "all", "the", "resolvers", "we", "chain", "use", "/", "as", "delimiter", "..." ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/ReferenceResolver/ChainPrefixResolver.php#L22-L33
kaliop-uk/ezmigrationbundle
Core/FieldHandler/EzRelation.php
EzRelation.hashToFieldValue
public function hashToFieldValue($fieldValue, array $context = array()) { if (is_array($fieldValue) && array_key_exists('destinationContentId', $fieldValue)) { // fromHash format $id = $fieldValue['destinationContentId']; } else { // simplified format ...
php
public function hashToFieldValue($fieldValue, array $context = array()) { if (is_array($fieldValue) && array_key_exists('destinationContentId', $fieldValue)) { // fromHash format $id = $fieldValue['destinationContentId']; } else { // simplified format ...
[ "public", "function", "hashToFieldValue", "(", "$", "fieldValue", ",", "array", "$", "context", "=", "array", "(", ")", ")", "{", "if", "(", "is_array", "(", "$", "fieldValue", ")", "&&", "array_key_exists", "(", "'destinationContentId'", ",", "$", "fieldVal...
Creates a value object to use as the field value when setting an ez relation field type. @param array|string|int $fieldValue The definition of the field value, structured in the yml file @param array $context The context for execution of the current migrations. Contains f.e. the path to the migration @return Value
[ "Creates", "a", "value", "object", "to", "use", "as", "the", "field", "value", "when", "setting", "an", "ez", "relation", "field", "type", "." ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/FieldHandler/EzRelation.php#L26-L46
kaliop-uk/ezmigrationbundle
Core/FieldHandler/EzMedia.php
EzMedia.hashToFieldValue
public function hashToFieldValue($fieldValue, array $context = array()) { $fileName = ''; $mimeType = ''; $hasController = false; $autoPlay = false; $loop = false; $height = 0; $width = 0; if ($fieldValue === null) { return new MediaValue(...
php
public function hashToFieldValue($fieldValue, array $context = array()) { $fileName = ''; $mimeType = ''; $hasController = false; $autoPlay = false; $loop = false; $height = 0; $width = 0; if ($fieldValue === null) { return new MediaValue(...
[ "public", "function", "hashToFieldValue", "(", "$", "fieldValue", ",", "array", "$", "context", "=", "array", "(", ")", ")", "{", "$", "fileName", "=", "''", ";", "$", "mimeType", "=", "''", ";", "$", "hasController", "=", "false", ";", "$", "autoPlay"...
Creates a value object to use as the field value when setting a media field type. @param array|string $fieldValue The path to the file or an array with 'path' and many other keys @param array $context The context for execution of the current migrations. Contains f.e. the path to the migration @return MediaValue @todo...
[ "Creates", "a", "value", "object", "to", "use", "as", "the", "field", "value", "when", "setting", "a", "media", "field", "type", "." ]
train
https://github.com/kaliop-uk/ezmigrationbundle/blob/7dcdcf8a204f447db41fca16463881147f3eb4d9/Core/FieldHandler/EzMedia.php#L19-L94