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 |
|---|---|---|---|---|---|---|---|---|---|---|
meccado/acl-admin-control-panel | src/Http/Controllers/Admin/RoleController.php | RoleController.destroy | public function destroy($id)
{
$this->roles->findOrFail($id)->delete();
return \Redirect::route('admin.roles.index', [
])->withMessage(trans('acl::role.roles-controller-successfully_deleted'));
} | php | public function destroy($id)
{
$this->roles->findOrFail($id)->delete();
return \Redirect::route('admin.roles.index', [
])->withMessage(trans('acl::role.roles-controller-successfully_deleted'));
} | [
"public",
"function",
"destroy",
"(",
"$",
"id",
")",
"{",
"$",
"this",
"->",
"roles",
"->",
"findOrFail",
"(",
"$",
"id",
")",
"->",
"delete",
"(",
")",
";",
"return",
"\\",
"Redirect",
"::",
"route",
"(",
"'admin.roles.index'",
",",
"[",
"]",
")",
... | Remove the specified resource from storage.
@param int $id
@return \Illuminate\Http\RedirectResponse | [
"Remove",
"the",
"specified",
"resource",
"from",
"storage",
"."
] | train | https://github.com/meccado/acl-admin-control-panel/blob/50ac4c0dbf8bd49944ecad6a70708a70411b7378/src/Http/Controllers/Admin/RoleController.php#L110-L115 |
Ocramius/OcraDiCompiler | src/OcraDiCompiler/Mvc/Service/ControllerPluginManagerFactory.php | ControllerPluginManagerFactory.createService | public function createService(ServiceLocatorInterface $serviceLocator)
{
$pluginManagerClass = static::PLUGIN_MANAGER_CLASS;
$plugins = new $pluginManagerClass;
$plugins->setServiceLocator($serviceLocator);
$configuration = $serviceLocator->get('Config');
if (isset($confi... | php | public function createService(ServiceLocatorInterface $serviceLocator)
{
$pluginManagerClass = static::PLUGIN_MANAGER_CLASS;
$plugins = new $pluginManagerClass;
$plugins->setServiceLocator($serviceLocator);
$configuration = $serviceLocator->get('Config');
if (isset($confi... | [
"public",
"function",
"createService",
"(",
"ServiceLocatorInterface",
"$",
"serviceLocator",
")",
"{",
"$",
"pluginManagerClass",
"=",
"static",
"::",
"PLUGIN_MANAGER_CLASS",
";",
"$",
"plugins",
"=",
"new",
"$",
"pluginManagerClass",
";",
"$",
"plugins",
"->",
"... | Create and return the MVC controller plugin manager
@param ServiceLocatorInterface $serviceLocator
@return \Zend\Mvc\Controller\PluginManager | [
"Create",
"and",
"return",
"the",
"MVC",
"controller",
"plugin",
"manager"
] | train | https://github.com/Ocramius/OcraDiCompiler/blob/667f4b24771f27fb9c8d6c38ffaf72d9cd55ca4a/src/OcraDiCompiler/Mvc/Service/ControllerPluginManagerFactory.php#L32-L47 |
afrittella/back-project | src/app/Http/Requests/UserEdit.php | UserEdit.rules | public function rules()
{
//$userRepository = new UserRepository($this->app);
$user = $this->users->findBy('id', $this->route('user'));
return [
'username' => 'required|max:255|unique:users,username,'.$user->id,
'email' => 'required|email|max:255|unique:users,email,... | php | public function rules()
{
//$userRepository = new UserRepository($this->app);
$user = $this->users->findBy('id', $this->route('user'));
return [
'username' => 'required|max:255|unique:users,username,'.$user->id,
'email' => 'required|email|max:255|unique:users,email,... | [
"public",
"function",
"rules",
"(",
")",
"{",
"//$userRepository = new UserRepository($this->app);",
"$",
"user",
"=",
"$",
"this",
"->",
"users",
"->",
"findBy",
"(",
"'id'",
",",
"$",
"this",
"->",
"route",
"(",
"'user'",
")",
")",
";",
"return",
"[",
"'... | Get the validation rules that apply to the request.
@return array | [
"Get",
"the",
"validation",
"rules",
"that",
"apply",
"to",
"the",
"request",
"."
] | train | https://github.com/afrittella/back-project/blob/e1aa2e3ee03d453033f75a4b16f073c60b5f32d1/src/app/Http/Requests/UserEdit.php#L34-L44 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseUserRoleQuery.php | BaseUserRoleQuery.create | public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof UserRoleQuery) {
return $criteria;
}
$query = new UserRoleQuery(null, null, $modelAlias);
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
... | php | public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof UserRoleQuery) {
return $criteria;
}
$query = new UserRoleQuery(null, null, $modelAlias);
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
... | [
"public",
"static",
"function",
"create",
"(",
"$",
"modelAlias",
"=",
"null",
",",
"$",
"criteria",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"criteria",
"instanceof",
"UserRoleQuery",
")",
"{",
"return",
"$",
"criteria",
";",
"}",
"$",
"query",
"=",
"ne... | Returns a new UserRoleQuery object.
@param string $modelAlias The alias of a model in the query
@param UserRoleQuery|Criteria $criteria Optional Criteria to build the query from
@return UserRoleQuery | [
"Returns",
"a",
"new",
"UserRoleQuery",
"object",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUserRoleQuery.php#L77-L89 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseUserRoleQuery.php | BaseUserRoleQuery.filterByPrimaryKey | public function filterByPrimaryKey($key)
{
$this->addUsingAlias(UserRolePeer::USER_ID, $key[0], Criteria::EQUAL);
$this->addUsingAlias(UserRolePeer::ROLE_ID, $key[1], Criteria::EQUAL);
return $this;
} | php | public function filterByPrimaryKey($key)
{
$this->addUsingAlias(UserRolePeer::USER_ID, $key[0], Criteria::EQUAL);
$this->addUsingAlias(UserRolePeer::ROLE_ID, $key[1], Criteria::EQUAL);
return $this;
} | [
"public",
"function",
"filterByPrimaryKey",
"(",
"$",
"key",
")",
"{",
"$",
"this",
"->",
"addUsingAlias",
"(",
"UserRolePeer",
"::",
"USER_ID",
",",
"$",
"key",
"[",
"0",
"]",
",",
"Criteria",
"::",
"EQUAL",
")",
";",
"$",
"this",
"->",
"addUsingAlias",... | Filter the query by primary key
@param mixed $key Primary key to use for the query
@return UserRoleQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"by",
"primary",
"key"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUserRoleQuery.php#L211-L217 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseUserRoleQuery.php | BaseUserRoleQuery.filterByPrimaryKeys | public function filterByPrimaryKeys($keys)
{
if (empty($keys)) {
return $this->add(null, '1<>1', Criteria::CUSTOM);
}
foreach ($keys as $key) {
$cton0 = $this->getNewCriterion(UserRolePeer::USER_ID, $key[0], Criteria::EQUAL);
$cton1 = $this->getNewCriterio... | php | public function filterByPrimaryKeys($keys)
{
if (empty($keys)) {
return $this->add(null, '1<>1', Criteria::CUSTOM);
}
foreach ($keys as $key) {
$cton0 = $this->getNewCriterion(UserRolePeer::USER_ID, $key[0], Criteria::EQUAL);
$cton1 = $this->getNewCriterio... | [
"public",
"function",
"filterByPrimaryKeys",
"(",
"$",
"keys",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"keys",
")",
")",
"{",
"return",
"$",
"this",
"->",
"add",
"(",
"null",
",",
"'1<>1'",
",",
"Criteria",
"::",
"CUSTOM",
")",
";",
"}",
"foreach",
... | Filter the query by a list of primary keys
@param array $keys The list of primary key to use for the query
@return UserRoleQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"by",
"a",
"list",
"of",
"primary",
"keys"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUserRoleQuery.php#L226-L239 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseUserRoleQuery.php | BaseUserRoleQuery.filterByRoleId | public function filterByRoleId($roleId = null, $comparison = null)
{
if (is_array($roleId)) {
$useMinMax = false;
if (isset($roleId['min'])) {
$this->addUsingAlias(UserRolePeer::ROLE_ID, $roleId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
... | php | public function filterByRoleId($roleId = null, $comparison = null)
{
if (is_array($roleId)) {
$useMinMax = false;
if (isset($roleId['min'])) {
$this->addUsingAlias(UserRolePeer::ROLE_ID, $roleId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
... | [
"public",
"function",
"filterByRoleId",
"(",
"$",
"roleId",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"roleId",
")",
")",
"{",
"$",
"useMinMax",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"$",
"ro... | Filter the query on the role_id column
Example usage:
<code>
$query->filterByRoleId(1234); // WHERE role_id = 1234
$query->filterByRoleId(array(12, 34)); // WHERE role_id IN (12, 34)
$query->filterByRoleId(array('min' => 12)); // WHERE role_id >= 12
$query->filterByRoleId(array('max' => 12)); // WHERE role_id <= 12
</... | [
"Filter",
"the",
"query",
"on",
"the",
"role_id",
"column"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUserRoleQuery.php#L306-L327 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseUserRoleQuery.php | BaseUserRoleQuery.filterByRole | public function filterByRole($role, $comparison = null)
{
if ($role instanceof Role) {
return $this
->addUsingAlias(UserRolePeer::ROLE_ID, $role->getId(), $comparison);
} elseif ($role instanceof PropelObjectCollection) {
if (null === $comparison) {
... | php | public function filterByRole($role, $comparison = null)
{
if ($role instanceof Role) {
return $this
->addUsingAlias(UserRolePeer::ROLE_ID, $role->getId(), $comparison);
} elseif ($role instanceof PropelObjectCollection) {
if (null === $comparison) {
... | [
"public",
"function",
"filterByRole",
"(",
"$",
"role",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"role",
"instanceof",
"Role",
")",
"{",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"UserRolePeer",
"::",
"ROLE_ID",
",",
"$",
... | Filter the query by a related Role object
@param Role|PropelObjectCollection $role The related object(s) to use as filter
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return UserRoleQuery The current query, for fluid interface
@throws PropelEx... | [
"Filter",
"the",
"query",
"by",
"a",
"related",
"Role",
"object"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUserRoleQuery.php#L414-L429 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseUserRoleQuery.php | BaseUserRoleQuery.useRoleQuery | public function useRoleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinRole($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Role', '\Slashworks\BackendBundle\Model\RoleQuery');
} | php | public function useRoleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinRole($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Role', '\Slashworks\BackendBundle\Model\RoleQuery');
} | [
"public",
"function",
"useRoleQuery",
"(",
"$",
"relationAlias",
"=",
"null",
",",
"$",
"joinType",
"=",
"Criteria",
"::",
"INNER_JOIN",
")",
"{",
"return",
"$",
"this",
"->",
"joinRole",
"(",
"$",
"relationAlias",
",",
"$",
"joinType",
")",
"->",
"useQuer... | Use the Role relation Role object
@see useQuery()
@param string $relationAlias optional alias for the relation,
to be used as main alias in the secondary query
@param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
@return \Slashworks\BackendBundle\Model\RoleQuery A... | [
"Use",
"the",
"Role",
"relation",
"Role",
"object"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUserRoleQuery.php#L474-L479 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseUserRoleQuery.php | BaseUserRoleQuery.prune | public function prune($userRole = null)
{
if ($userRole) {
$this->addCond('pruneCond0', $this->getAliasedColName(UserRolePeer::USER_ID), $userRole->getUserId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond1', $this->getAliasedColName(UserRolePeer::ROLE_ID), $userRole->getRoleId(),... | php | public function prune($userRole = null)
{
if ($userRole) {
$this->addCond('pruneCond0', $this->getAliasedColName(UserRolePeer::USER_ID), $userRole->getUserId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond1', $this->getAliasedColName(UserRolePeer::ROLE_ID), $userRole->getRoleId(),... | [
"public",
"function",
"prune",
"(",
"$",
"userRole",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"userRole",
")",
"{",
"$",
"this",
"->",
"addCond",
"(",
"'pruneCond0'",
",",
"$",
"this",
"->",
"getAliasedColName",
"(",
"UserRolePeer",
"::",
"USER_ID",
")",
... | Exclude object from result
@param UserRole $userRole Object to remove from the list of results
@return UserRoleQuery The current query, for fluid interface | [
"Exclude",
"object",
"from",
"result"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUserRoleQuery.php#L488-L497 |
askupasoftware/amarkal | Log/Logger.php | Logger.log | public function log($level, $message, array $context = array())
{
$message = $this->formatMessage($level, $message, $context);
$this->write($message);
} | php | public function log($level, $message, array $context = array())
{
$message = $this->formatMessage($level, $message, $context);
$this->write($message);
} | [
"public",
"function",
"log",
"(",
"$",
"level",
",",
"$",
"message",
",",
"array",
"$",
"context",
"=",
"array",
"(",
")",
")",
"{",
"$",
"message",
"=",
"$",
"this",
"->",
"formatMessage",
"(",
"$",
"level",
",",
"$",
"message",
",",
"$",
"context... | Logs with an arbitrary level.
@param mixed $level
@param string $message
@param array $context
@return null | [
"Logs",
"with",
"an",
"arbitrary",
"level",
"."
] | train | https://github.com/askupasoftware/amarkal/blob/fe8283e2d6847ef697abec832da7ee741a85058c/Log/Logger.php#L100-L104 |
askupasoftware/amarkal | Log/Logger.php | Logger.write | public function write($message)
{
if (! is_null($this->fileHandle)) {
if (fwrite($this->fileHandle, $message) === false) {
throw new RuntimeException('The file could not be written to. Check that appropriate permissions have been set.');
}
}
} | php | public function write($message)
{
if (! is_null($this->fileHandle)) {
if (fwrite($this->fileHandle, $message) === false) {
throw new RuntimeException('The file could not be written to. Check that appropriate permissions have been set.');
}
}
} | [
"public",
"function",
"write",
"(",
"$",
"message",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"fileHandle",
")",
")",
"{",
"if",
"(",
"fwrite",
"(",
"$",
"this",
"->",
"fileHandle",
",",
"$",
"message",
")",
"===",
"false",
")",
... | Writes a line to the log without prepending a status or timestamp
@param string $line Line to write to the log
@return void | [
"Writes",
"a",
"line",
"to",
"the",
"log",
"without",
"prepending",
"a",
"status",
"or",
"timestamp"
] | train | https://github.com/askupasoftware/amarkal/blob/fe8283e2d6847ef697abec832da7ee741a85058c/Log/Logger.php#L112-L119 |
2amigos/yiifoundation | helpers/ArrayHelper.php | ArrayHelper.copy | public static function copy($names, $from, &$to)
{
if (is_array($from) && is_array($to)) {
foreach ($names as $key) {
if (isset($from[$key]) && !isset($to[$key])) {
$to[$key] = static::getValue($from, $key);
}
}
}
re... | php | public static function copy($names, $from, &$to)
{
if (is_array($from) && is_array($to)) {
foreach ($names as $key) {
if (isset($from[$key]) && !isset($to[$key])) {
$to[$key] = static::getValue($from, $key);
}
}
}
re... | [
"public",
"static",
"function",
"copy",
"(",
"$",
"names",
",",
"$",
"from",
",",
"&",
"$",
"to",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"from",
")",
"&&",
"is_array",
"(",
"$",
"to",
")",
")",
"{",
"foreach",
"(",
"$",
"names",
"as",
"$",
... | Copies the values from one option array to another.
@param array $names the items names to copy.
@param array $from the items to copy from.
@param array $to the items to copy to.
@return array with copied items. | [
"Copies",
"the",
"values",
"from",
"one",
"option",
"array",
"to",
"another",
"."
] | train | https://github.com/2amigos/yiifoundation/blob/49bed0d3ca1a9bac9299000e48a2661bdc8f9a29/helpers/ArrayHelper.php#L26-L36 |
2amigos/yiifoundation | helpers/ArrayHelper.php | ArrayHelper.move | public static function move($names, &$from, &$to)
{
if (is_array($from) && is_array($to)) {
foreach ($names as $key) {
if (isset($from[$key]) && !isset($to[$key])) {
$to[$key] = static::getValue($from, $key);
$moved[$key] = static::removeVa... | php | public static function move($names, &$from, &$to)
{
if (is_array($from) && is_array($to)) {
foreach ($names as $key) {
if (isset($from[$key]) && !isset($to[$key])) {
$to[$key] = static::getValue($from, $key);
$moved[$key] = static::removeVa... | [
"public",
"static",
"function",
"move",
"(",
"$",
"names",
",",
"&",
"$",
"from",
",",
"&",
"$",
"to",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"from",
")",
"&&",
"is_array",
"(",
"$",
"to",
")",
")",
"{",
"foreach",
"(",
"$",
"names",
"as",
... | Moves the item values from one array to another.
@param array $names the item names to move.
@param array $from the values to move from.
@param array $to the items to move to.
@return array with moved items. | [
"Moves",
"the",
"item",
"values",
"from",
"one",
"array",
"to",
"another",
"."
] | train | https://github.com/2amigos/yiifoundation/blob/49bed0d3ca1a9bac9299000e48a2661bdc8f9a29/helpers/ArrayHelper.php#L45-L56 |
2amigos/yiifoundation | helpers/ArrayHelper.php | ArrayHelper.addValue | public static function addValue($key, $value, &$array, $glue = ' ')
{
if (isset($array[$key])) {
if (!is_array($array[$key]))
$array[$key] = explode($glue, $array[$key]);
$array[$key][] = $value;
$array[$key] = array_unique($array[$key]);
$ar... | php | public static function addValue($key, $value, &$array, $glue = ' ')
{
if (isset($array[$key])) {
if (!is_array($array[$key]))
$array[$key] = explode($glue, $array[$key]);
$array[$key][] = $value;
$array[$key] = array_unique($array[$key]);
$ar... | [
"public",
"static",
"function",
"addValue",
"(",
"$",
"key",
",",
"$",
"value",
",",
"&",
"$",
"array",
",",
"$",
"glue",
"=",
"' '",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"array",
"[",
"$",
"key",
"]",
")",
")",
"{",
"if",
"(",
"!",
"is_ar... | Adds a new option to the given array. If the key does not exists, it will create one, if it exists it will append
the value and also makes sure the uniqueness of them.
@param string $key the key name at the array
@param string $value the value to add / append
@param array $array the options to modify
@param string $gl... | [
"Adds",
"a",
"new",
"option",
"to",
"the",
"given",
"array",
".",
"If",
"the",
"key",
"does",
"not",
"exists",
"it",
"will",
"create",
"one",
"if",
"it",
"exists",
"it",
"will",
"append",
"the",
"value",
"and",
"also",
"makes",
"sure",
"the",
"uniquene... | train | https://github.com/2amigos/yiifoundation/blob/49bed0d3ca1a9bac9299000e48a2661bdc8f9a29/helpers/ArrayHelper.php#L98-L109 |
2amigos/yiifoundation | helpers/ArrayHelper.php | ArrayHelper.getValue | public static function getValue($array, $key, $default = null)
{
if ($key instanceof \Closure) {
return $key($array, $default);
} elseif (is_array($array)) {
return isset($array[$key]) || array_key_exists($key, $array) ? $array[$key] : $default;
} else {
r... | php | public static function getValue($array, $key, $default = null)
{
if ($key instanceof \Closure) {
return $key($array, $default);
} elseif (is_array($array)) {
return isset($array[$key]) || array_key_exists($key, $array) ? $array[$key] : $default;
} else {
r... | [
"public",
"static",
"function",
"getValue",
"(",
"$",
"array",
",",
"$",
"key",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"key",
"instanceof",
"\\",
"Closure",
")",
"{",
"return",
"$",
"key",
"(",
"$",
"array",
",",
"$",
"default"... | Retrieves the value of an array element or object property with the given key or property name.
If the key does not exist in the array, the default value will be returned instead.
@param array|object $array array or object to extract value from
@param string|\Closure $key key name of the array element, or property nam... | [
"Retrieves",
"the",
"value",
"of",
"an",
"array",
"element",
"or",
"object",
"property",
"with",
"the",
"given",
"key",
"or",
"property",
"name",
".",
"If",
"the",
"key",
"does",
"not",
"exist",
"in",
"the",
"array",
"the",
"default",
"value",
"will",
"b... | train | https://github.com/2amigos/yiifoundation/blob/49bed0d3ca1a9bac9299000e48a2661bdc8f9a29/helpers/ArrayHelper.php#L122-L131 |
2amigos/yiifoundation | helpers/ArrayHelper.php | ArrayHelper.removeValue | public static function removeValue(&$array, $key, $default = null)
{
if (is_array($array)) {
$value = static::getValue($array, $key, $default);
unset($array[$key]);
return static::value($value);
}
return self::value($default);
} | php | public static function removeValue(&$array, $key, $default = null)
{
if (is_array($array)) {
$value = static::getValue($array, $key, $default);
unset($array[$key]);
return static::value($value);
}
return self::value($default);
} | [
"public",
"static",
"function",
"removeValue",
"(",
"&",
"$",
"array",
",",
"$",
"key",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"array",
")",
")",
"{",
"$",
"value",
"=",
"static",
"::",
"getValue",
"(",
"$",
... | Removes an item from the given options and returns the value.
If no key is found, then default value will be returned.
@param $array
@param $key
@param null $default
@return mixed|null | [
"Removes",
"an",
"item",
"from",
"the",
"given",
"options",
"and",
"returns",
"the",
"value",
"."
] | train | https://github.com/2amigos/yiifoundation/blob/49bed0d3ca1a9bac9299000e48a2661bdc8f9a29/helpers/ArrayHelper.php#L143-L151 |
2amigos/yiifoundation | helpers/ArrayHelper.php | ArrayHelper.pluck | public static function pluck($array, $key)
{
return array_map(
function ($v) use ($key) {
return is_object($v) ? $v->$key : $v[$key];
},
$array
);
} | php | public static function pluck($array, $key)
{
return array_map(
function ($v) use ($key) {
return is_object($v) ? $v->$key : $v[$key];
},
$array
);
} | [
"public",
"static",
"function",
"pluck",
"(",
"$",
"array",
",",
"$",
"key",
")",
"{",
"return",
"array_map",
"(",
"function",
"(",
"$",
"v",
")",
"use",
"(",
"$",
"key",
")",
"{",
"return",
"is_object",
"(",
"$",
"v",
")",
"?",
"$",
"v",
"->",
... | Pluck an array of values from an array.
@param array $array
@param string $key
@return array | [
"Pluck",
"an",
"array",
"of",
"values",
"from",
"an",
"array",
"."
] | train | https://github.com/2amigos/yiifoundation/blob/49bed0d3ca1a9bac9299000e48a2661bdc8f9a29/helpers/ArrayHelper.php#L182-L191 |
2amigos/yiifoundation | helpers/ArrayHelper.php | ArrayHelper.map | public static function map(array $array, $callback, $on_nonscalar = false)
{
foreach ($array as $key => $value) {
if (is_array($value)) {
$args = array($value, $callback, $on_nonscalar);
$array[$key] = call_user_func_array(array(__CLASS__, __FUNCTION__), $a... | php | public static function map(array $array, $callback, $on_nonscalar = false)
{
foreach ($array as $key => $value) {
if (is_array($value)) {
$args = array($value, $callback, $on_nonscalar);
$array[$key] = call_user_func_array(array(__CLASS__, __FUNCTION__), $a... | [
"public",
"static",
"function",
"map",
"(",
"array",
"$",
"array",
",",
"$",
"callback",
",",
"$",
"on_nonscalar",
"=",
"false",
")",
"{",
"foreach",
"(",
"$",
"array",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"is_array",
"(",
"$"... | Returns an array containing all the elements of arr1 after applying
the callback function to each one.
Credits to Util.php
@param array $array an array to run through the callback function
@param $callback Callback function to run for each element in each array
@param bool $on_nonscalar whether or not to call the cal... | [
"Returns",
"an",
"array",
"containing",
"all",
"the",
"elements",
"of",
"arr1",
"after",
"applying",
"the",
"callback",
"function",
"to",
"each",
"one",
"."
] | train | https://github.com/2amigos/yiifoundation/blob/49bed0d3ca1a9bac9299000e48a2661bdc8f9a29/helpers/ArrayHelper.php#L347-L361 |
yuncms/framework | src/helpers/DateHelper.php | DateHelper.getWeek | public static function getWeek($week = null): string
{
$week = $week ? $week : date('w');
switch ($week) {
case 'Sunday':
return Yii::t('yuncms', 'Sunday');
break;
case 'Monday':
return Yii::t('yuncms', 'Monday');
... | php | public static function getWeek($week = null): string
{
$week = $week ? $week : date('w');
switch ($week) {
case 'Sunday':
return Yii::t('yuncms', 'Sunday');
break;
case 'Monday':
return Yii::t('yuncms', 'Monday');
... | [
"public",
"static",
"function",
"getWeek",
"(",
"$",
"week",
"=",
"null",
")",
":",
"string",
"{",
"$",
"week",
"=",
"$",
"week",
"?",
"$",
"week",
":",
"date",
"(",
"'w'",
")",
";",
"switch",
"(",
"$",
"week",
")",
"{",
"case",
"'Sunday'",
":",
... | 获取星期
@param int $week 星期,默认为当前时间获取
@return string | [
"获取星期"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/helpers/DateHelper.php#L61-L88 |
yuncms/framework | src/helpers/DateHelper.php | DateHelper.isLeapYear | public static function isLeapYear($year = null): bool
{
$year = $year ? $year : date('Y');
return ($year % 4 == 0 && $year % 100 != 0 || $year % 400 == 0);
} | php | public static function isLeapYear($year = null): bool
{
$year = $year ? $year : date('Y');
return ($year % 4 == 0 && $year % 100 != 0 || $year % 400 == 0);
} | [
"public",
"static",
"function",
"isLeapYear",
"(",
"$",
"year",
"=",
"null",
")",
":",
"bool",
"{",
"$",
"year",
"=",
"$",
"year",
"?",
"$",
"year",
":",
"date",
"(",
"'Y'",
")",
";",
"return",
"(",
"$",
"year",
"%",
"4",
"==",
"0",
"&&",
"$",
... | 判断是否为闰年
@param int $year 年份,默认为当前年份
@return bool | [
"判断是否为闰年"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/helpers/DateHelper.php#L96-L100 |
yuncms/framework | src/helpers/DateHelper.php | DateHelper.getDaysInYear | public static function getDaysInYear($year = null): int
{
$year = $year ? $year : date('Y');
return self::isLeapYear($year) ? 366 : 365;
} | php | public static function getDaysInYear($year = null): int
{
$year = $year ? $year : date('Y');
return self::isLeapYear($year) ? 366 : 365;
} | [
"public",
"static",
"function",
"getDaysInYear",
"(",
"$",
"year",
"=",
"null",
")",
":",
"int",
"{",
"$",
"year",
"=",
"$",
"year",
"?",
"$",
"year",
":",
"date",
"(",
"'Y'",
")",
";",
"return",
"self",
"::",
"isLeapYear",
"(",
"$",
"year",
")",
... | 获取一年中有多少天
@param int $year 年份,默认为当前年份
@return int | [
"获取一年中有多少天"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/helpers/DateHelper.php#L108-L112 |
yuncms/framework | src/helpers/DateHelper.php | DateHelper.dateAdd | public static function dateAdd($interval, $value, $dateTime = null, $format = null): string
{
$dateTime = $dateTime ? $dateTime : date('Y-m-d H:i:s');
$date = getdate(self::getTimestamp($dateTime));
switch ($interval) {
case 'Y' : // 年
$date ['year'] += $value;
... | php | public static function dateAdd($interval, $value, $dateTime = null, $format = null): string
{
$dateTime = $dateTime ? $dateTime : date('Y-m-d H:i:s');
$date = getdate(self::getTimestamp($dateTime));
switch ($interval) {
case 'Y' : // 年
$date ['year'] += $value;
... | [
"public",
"static",
"function",
"dateAdd",
"(",
"$",
"interval",
",",
"$",
"value",
",",
"$",
"dateTime",
"=",
"null",
",",
"$",
"format",
"=",
"null",
")",
":",
"string",
"{",
"$",
"dateTime",
"=",
"$",
"dateTime",
"?",
"$",
"dateTime",
":",
"date",... | 返回指定日期在一段时间间隔时间后的日期
@param string $interval 时间间隔类型,(Y:年、Q:季度、M:月、W:星期、D:日期、H:时、N:分、S:秒)
@param int $value 时间间隔数值,数值为正数获取未来的时间,数值为负数获取过去的时间
@param string $dateTime 日期
@param string $format 返回的日期转换格式
@return string 返回追加后的日期 | [
"返回指定日期在一段时间间隔时间后的日期"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/helpers/DateHelper.php#L272-L304 |
yuncms/framework | src/helpers/DateHelper.php | DateHelper.getDaysByMonthsOfYear | public static function getDaysByMonthsOfYear($year = null): array
{
$year = $year ? $year : date('Y');
$months = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
if (self::isLeapYear($year)) $months [1] = 29;
return $months;
} | php | public static function getDaysByMonthsOfYear($year = null): array
{
$year = $year ? $year : date('Y');
$months = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
if (self::isLeapYear($year)) $months [1] = 29;
return $months;
} | [
"public",
"static",
"function",
"getDaysByMonthsOfYear",
"(",
"$",
"year",
"=",
"null",
")",
":",
"array",
"{",
"$",
"year",
"=",
"$",
"year",
"?",
"$",
"year",
":",
"date",
"(",
"'Y'",
")",
";",
"$",
"months",
"=",
"[",
"31",
",",
"28",
",",
"31... | 根据年份获取每个月的天数
@param int $year 年份
@return array 月份天数数组 | [
"根据年份获取每个月的天数"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/helpers/DateHelper.php#L312-L318 |
yuncms/framework | src/helpers/DateHelper.php | DateHelper.getDaysByMonth | public static function getDaysByMonth($month, $year): int
{
$months = self::getDaysByMonthsOfYear($year);
$value = $months [$month - 1];
return !$value ? 0 : $value;
} | php | public static function getDaysByMonth($month, $year): int
{
$months = self::getDaysByMonthsOfYear($year);
$value = $months [$month - 1];
return !$value ? 0 : $value;
} | [
"public",
"static",
"function",
"getDaysByMonth",
"(",
"$",
"month",
",",
"$",
"year",
")",
":",
"int",
"{",
"$",
"months",
"=",
"self",
"::",
"getDaysByMonthsOfYear",
"(",
"$",
"year",
")",
";",
"$",
"value",
"=",
"$",
"months",
"[",
"$",
"month",
"... | 返回某年的某个月有多少天
@param int $month 月份
@param int $year 年份
@return int 月份天数 | [
"返回某年的某个月有多少天"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/helpers/DateHelper.php#L327-L332 |
dandisy/laravel-generator | src/Common/CommandData.php | CommandData.addLogs | private function addLogs()
{
$createdBy = new GeneratorField();
$createdBy->name = 'created_by';
$createdBy->parseDBType('integer');
$createdBy->parseOptions('if,n');
$this->fields[] = $createdBy;
$updatedBy = new GeneratorField();
$updatedBy->name = 'updated... | php | private function addLogs()
{
$createdBy = new GeneratorField();
$createdBy->name = 'created_by';
$createdBy->parseDBType('integer');
$createdBy->parseOptions('if,n');
$this->fields[] = $createdBy;
$updatedBy = new GeneratorField();
$updatedBy->name = 'updated... | [
"private",
"function",
"addLogs",
"(",
")",
"{",
"$",
"createdBy",
"=",
"new",
"GeneratorField",
"(",
")",
";",
"$",
"createdBy",
"->",
"name",
"=",
"'created_by'",
";",
"$",
"createdBy",
"->",
"parseDBType",
"(",
"'integer'",
")",
";",
"$",
"createdBy",
... | added by dandisy | [
"added",
"by",
"dandisy"
] | train | https://github.com/dandisy/laravel-generator/blob/742797c8483bc88b54b6302a516a9a85eeb8579b/src/Common/CommandData.php#L184-L197 |
Sedona-Solutions/sedona-sbo | src/Sedona/SBORuntimeBundle/Form/Type/EntitySelect2Type.php | EntitySelect2Type.buildView | public function buildView(FormView $view, FormInterface $form, array $options)
{
$view->vars['attr']['autocomplete'] = 'off';
if (array_key_exists('searchRouteName', $options)) {
$view->vars['attr']['data-source'] = $this->router->generate($options['searchRouteName'], $options['searchRou... | php | public function buildView(FormView $view, FormInterface $form, array $options)
{
$view->vars['attr']['autocomplete'] = 'off';
if (array_key_exists('searchRouteName', $options)) {
$view->vars['attr']['data-source'] = $this->router->generate($options['searchRouteName'], $options['searchRou... | [
"public",
"function",
"buildView",
"(",
"FormView",
"$",
"view",
",",
"FormInterface",
"$",
"form",
",",
"array",
"$",
"options",
")",
"{",
"$",
"view",
"->",
"vars",
"[",
"'attr'",
"]",
"[",
"'autocomplete'",
"]",
"=",
"'off'",
";",
"if",
"(",
"array_... | {@inheritdoc} | [
"{"
] | train | https://github.com/Sedona-Solutions/sedona-sbo/blob/8548be4170d191cb1a3e263577aaaab49f04d5ce/src/Sedona/SBORuntimeBundle/Form/Type/EntitySelect2Type.php#L77-L106 |
uthando-cms/uthando-dompdf | src/UthandoDomPdf/Form/PdfTextLineFieldSet.php | PdfTextLineFieldSet.init | public function init()
{
$this->add([
'name' => 'text',
'type' => Text::class,
'options' => [
'label' => 'Line Text',
'twb-layout' => TwbBundleForm::LAYOUT_HORIZONTAL,
'column-size' => 'md-8',
'label_attribut... | php | public function init()
{
$this->add([
'name' => 'text',
'type' => Text::class,
'options' => [
'label' => 'Line Text',
'twb-layout' => TwbBundleForm::LAYOUT_HORIZONTAL,
'column-size' => 'md-8',
'label_attribut... | [
"public",
"function",
"init",
"(",
")",
"{",
"$",
"this",
"->",
"add",
"(",
"[",
"'name'",
"=>",
"'text'",
",",
"'type'",
"=>",
"Text",
"::",
"class",
",",
"'options'",
"=>",
"[",
"'label'",
"=>",
"'Line Text'",
",",
"'twb-layout'",
"=>",
"TwbBundleForm"... | Set up elements | [
"Set",
"up",
"elements"
] | train | https://github.com/uthando-cms/uthando-dompdf/blob/60a750058c2db9ed167476192b20c7f544c32007/src/UthandoDomPdf/Form/PdfTextLineFieldSet.php#L45-L89 |
webforge-labs/psc-cms | lib/Psc/Net/HTTP/Response.php | Response.output | public function output($flags = 0x00003) {
if (($flags & self::OUTPUT_HEADER) == self::OUTPUT_HEADER) {
$this->sendHeaders();
}
if ($this->outputClosure instanceof \Closure) {
$c = $this->outputClosure;
$c();
return;
}
if (($flags & self::OUTPUT_BODY) == self::OUTPU... | php | public function output($flags = 0x00003) {
if (($flags & self::OUTPUT_HEADER) == self::OUTPUT_HEADER) {
$this->sendHeaders();
}
if ($this->outputClosure instanceof \Closure) {
$c = $this->outputClosure;
$c();
return;
}
if (($flags & self::OUTPUT_BODY) == self::OUTPU... | [
"public",
"function",
"output",
"(",
"$",
"flags",
"=",
"0x00003",
")",
"{",
"if",
"(",
"(",
"$",
"flags",
"&",
"self",
"::",
"OUTPUT_HEADER",
")",
"==",
"self",
"::",
"OUTPUT_HEADER",
")",
"{",
"$",
"this",
"->",
"sendHeaders",
"(",
")",
";",
"}",
... | Sendet die Headers und gibt den Body aus
@param bitmap $flags Default: (self::OUTPUT_HEADER | self::OUTPUT_BODY) | [
"Sendet",
"die",
"Headers",
"und",
"gibt",
"den",
"Body",
"aus"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Net/HTTP/Response.php#L146-L160 |
phpmob/changmin | src/PhpMob/ChangMinBundle/Factory/TaxonFactory.php | TaxonFactory.createWidthParent | public function createWidthParent(?TaxonInterface $parent): TaxonInterface
{
$taxon = $this->createNew();
$taxon->setParent($parent);
return $taxon;
} | php | public function createWidthParent(?TaxonInterface $parent): TaxonInterface
{
$taxon = $this->createNew();
$taxon->setParent($parent);
return $taxon;
} | [
"public",
"function",
"createWidthParent",
"(",
"?",
"TaxonInterface",
"$",
"parent",
")",
":",
"TaxonInterface",
"{",
"$",
"taxon",
"=",
"$",
"this",
"->",
"createNew",
"(",
")",
";",
"$",
"taxon",
"->",
"setParent",
"(",
"$",
"parent",
")",
";",
"retur... | {@inheritdoc} | [
"{"
] | train | https://github.com/phpmob/changmin/blob/bfebb1561229094d1c138574abab75f2f1d17d66/src/PhpMob/ChangMinBundle/Factory/TaxonFactory.php#L60-L66 |
webtown-php/KunstmaanExtensionBundle | src/Form/PageParts/InsertPagePagePartAdminType.php | InsertPagePagePartAdminType.buildForm | public function buildForm(FormBuilderInterface $builder, array $options)
{
$locale = $this->requestStack->getMasterRequest()->getLocale();
/** @var EntityManager $em */
$em = $this->doctrine->getManager();
parent::buildForm($builder, $options);
$builder->add('node', 'Symfony... | php | public function buildForm(FormBuilderInterface $builder, array $options)
{
$locale = $this->requestStack->getMasterRequest()->getLocale();
/** @var EntityManager $em */
$em = $this->doctrine->getManager();
parent::buildForm($builder, $options);
$builder->add('node', 'Symfony... | [
"public",
"function",
"buildForm",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"array",
"$",
"options",
")",
"{",
"$",
"locale",
"=",
"$",
"this",
"->",
"requestStack",
"->",
"getMasterRequest",
"(",
")",
"->",
"getLocale",
"(",
")",
";",
"/** @var Ent... | Builds the form.
This method is called for each type in the hierarchy starting form the
top most type. Type extensions can further modify the form.
@param FormBuilderInterface $builder The form builder
@param array $options The options
@see FormTypeExtensionInterface::buildForm() | [
"Builds",
"the",
"form",
"."
] | train | https://github.com/webtown-php/KunstmaanExtensionBundle/blob/86c656c131295fe1f3f7694fd4da1e5e454076b9/src/Form/PageParts/InsertPagePagePartAdminType.php#L67-L87 |
webtown-php/KunstmaanExtensionBundle | src/Form/PageParts/InsertPagePagePartAdminType.php | InsertPagePagePartAdminType.finishView | public function finishView(FormView $view, FormInterface $form, array $options)
{
$data = $form->getData();
if ($data instanceof InsertPagePagePart) {
$this->validateParentPage();
$reflections = [];
$nodeFormView = $view->children['node'];
/** @var C... | php | public function finishView(FormView $view, FormInterface $form, array $options)
{
$data = $form->getData();
if ($data instanceof InsertPagePagePart) {
$this->validateParentPage();
$reflections = [];
$nodeFormView = $view->children['node'];
/** @var C... | [
"public",
"function",
"finishView",
"(",
"FormView",
"$",
"view",
",",
"FormInterface",
"$",
"form",
",",
"array",
"$",
"options",
")",
"{",
"$",
"data",
"=",
"$",
"form",
"->",
"getData",
"(",
")",
";",
"if",
"(",
"$",
"data",
"instanceof",
"InsertPag... | We want to set disable the parent page to prevent infinity insert cycle. If it is an edit page, we can disable this
from form's data.
@param FormView $view
@param FormInterface $form
@param array $options | [
"We",
"want",
"to",
"set",
"disable",
"the",
"parent",
"page",
"to",
"prevent",
"infinity",
"insert",
"cycle",
".",
"If",
"it",
"is",
"an",
"edit",
"page",
"we",
"can",
"disable",
"this",
"from",
"form",
"s",
"data",
"."
] | train | https://github.com/webtown-php/KunstmaanExtensionBundle/blob/86c656c131295fe1f3f7694fd4da1e5e454076b9/src/Form/PageParts/InsertPagePagePartAdminType.php#L97-L122 |
webtown-php/KunstmaanExtensionBundle | src/Form/PageParts/InsertPagePagePartAdminType.php | InsertPagePagePartAdminType.validateParentPage | protected function validateParentPage()
{
$request = $this->requestStack->getMasterRequest();
// the node which the pagepart belongs to
if ($request->query->has('pageid') && $request->query->has('pageclassname')) {
$repo = $this->doctrine->getManager()->getRepository('KunstmaanN... | php | protected function validateParentPage()
{
$request = $this->requestStack->getMasterRequest();
// the node which the pagepart belongs to
if ($request->query->has('pageid') && $request->query->has('pageclassname')) {
$repo = $this->doctrine->getManager()->getRepository('KunstmaanN... | [
"protected",
"function",
"validateParentPage",
"(",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"requestStack",
"->",
"getMasterRequest",
"(",
")",
";",
"// the node which the pagepart belongs to",
"if",
"(",
"$",
"request",
"->",
"query",
"->",
"has",
"("... | Check if the page part is insertable into the current page.
@throws \LogicException | [
"Check",
"if",
"the",
"page",
"part",
"is",
"insertable",
"into",
"the",
"current",
"page",
"."
] | train | https://github.com/webtown-php/KunstmaanExtensionBundle/blob/86c656c131295fe1f3f7694fd4da1e5e454076b9/src/Form/PageParts/InsertPagePagePartAdminType.php#L129-L169 |
yuncms/framework | src/sms/gateways/QcloudGateway.php | QcloudGateway.generateSign | protected function generateSign($params, $random)
{
ksort($params);
return hash('sha256', sprintf(
'appkey=%s&random=%s&time=%s&mobile=%s',
$this->appKey,
$random,
$params['time'],
$params['tel']['mobile']
), false);
} | php | protected function generateSign($params, $random)
{
ksort($params);
return hash('sha256', sprintf(
'appkey=%s&random=%s&time=%s&mobile=%s',
$this->appKey,
$random,
$params['time'],
$params['tel']['mobile']
), false);
} | [
"protected",
"function",
"generateSign",
"(",
"$",
"params",
",",
"$",
"random",
")",
"{",
"ksort",
"(",
"$",
"params",
")",
";",
"return",
"hash",
"(",
"'sha256'",
",",
"sprintf",
"(",
"'appkey=%s&random=%s&time=%s&mobile=%s'",
",",
"$",
"this",
"->",
"appK... | Generate Sign.
@param array $params
@param string $random
@return string | [
"Generate",
"Sign",
"."
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/sms/gateways/QcloudGateway.php#L106-L116 |
left-right/center | src/console/Refresh.php | Refresh.fire | public function fire()
{
$tables = config('center.tables');
$joining_tables = [];
//dd($tables);
foreach ($tables as $table) {
//create if doesn't exist, every table gets an id
if (!Schema::hasTable($table->name)) {
Schema::create($table->name, function($t) {
$t->increments('id');
}... | php | public function fire()
{
$tables = config('center.tables');
$joining_tables = [];
//dd($tables);
foreach ($tables as $table) {
//create if doesn't exist, every table gets an id
if (!Schema::hasTable($table->name)) {
Schema::create($table->name, function($t) {
$t->increments('id');
}... | [
"public",
"function",
"fire",
"(",
")",
"{",
"$",
"tables",
"=",
"config",
"(",
"'center.tables'",
")",
";",
"$",
"joining_tables",
"=",
"[",
"]",
";",
"//dd($tables);",
"foreach",
"(",
"$",
"tables",
"as",
"$",
"table",
")",
"{",
"//create if doesn't exis... | Execute the console command.
@return mixed | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/left-right/center/blob/47c225538475ca3e87fa49f31a323b6e6bd4eff2/src/console/Refresh.php#L41-L202 |
uthando-cms/uthando-dompdf | src/UthandoDomPdf/Form/DomPdfOptionsFieldSet.php | DomPdfOptionsFieldSet.init | public function init()
{
$this->add([
'name' => 'font_directory',
'type' => Text::class,
'options' => [
'label' => 'Font Directory',
'column-size' => 'md-8',
'label_attributes' => [
'class' => 'col-md-4',... | php | public function init()
{
$this->add([
'name' => 'font_directory',
'type' => Text::class,
'options' => [
'label' => 'Font Directory',
'column-size' => 'md-8',
'label_attributes' => [
'class' => 'col-md-4',... | [
"public",
"function",
"init",
"(",
")",
"{",
"$",
"this",
"->",
"add",
"(",
"[",
"'name'",
"=>",
"'font_directory'",
",",
"'type'",
"=>",
"Text",
"::",
"class",
",",
"'options'",
"=>",
"[",
"'label'",
"=>",
"'Font Directory'",
",",
"'column-size'",
"=>",
... | Set up form elements | [
"Set",
"up",
"form",
"elements"
] | train | https://github.com/uthando-cms/uthando-dompdf/blob/60a750058c2db9ed167476192b20c7f544c32007/src/UthandoDomPdf/Form/DomPdfOptionsFieldSet.php#L48-L656 |
webforge-labs/psc-cms | lib/Psc/CMS/Service/EntityService.php | EntityService.doResponsibleFor | protected function doResponsibleFor(ServiceRequest $request) {
$r = $this->initRequestMatcher($request);
// nach "entities/" kommt immer ein identifier
$entityPart = $r->qmatchRx('/[a-z0-9]+/i',0);
return TRUE;
} | php | protected function doResponsibleFor(ServiceRequest $request) {
$r = $this->initRequestMatcher($request);
// nach "entities/" kommt immer ein identifier
$entityPart = $r->qmatchRx('/[a-z0-9]+/i',0);
return TRUE;
} | [
"protected",
"function",
"doResponsibleFor",
"(",
"ServiceRequest",
"$",
"request",
")",
"{",
"$",
"r",
"=",
"$",
"this",
"->",
"initRequestMatcher",
"(",
"$",
"request",
")",
";",
"// nach \"entities/\" kommt immer ein identifier ",
"$",
"entityPart",
"=",
"$",
"... | Überprüft ob der Request zu diesem Service hört
wir sind jetzt ein gemeiner Service und behaupten, dass alles was mit "entities" anfängt zu uns gehört
das ist praktisch um z.B. abfangen zu können, dass ein AbstractEntityController fehlt (um ihn automatisch zu erstellen) | [
"Überprüft",
"ob",
"der",
"Request",
"zu",
"diesem",
"Service",
"hört"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Service/EntityService.php#L59-L66 |
webforge-labs/psc-cms | lib/Psc/CMS/Service/EntityService.php | EntityService.routeController | public function routeController(ServiceRequest $request) {
$r = $this->initRequestMatcher($request);
$entityPart = $r->qmatchRx('/^[a-z-0-9]+$/i',0);
if (mb_strpos($entityPart, '-') !== FALSE) {
$entityPart = Code::dashToCamelCase($entityPart);
}
// alle weiteren Parameter an den Contro... | php | public function routeController(ServiceRequest $request) {
$r = $this->initRequestMatcher($request);
$entityPart = $r->qmatchRx('/^[a-z-0-9]+$/i',0);
if (mb_strpos($entityPart, '-') !== FALSE) {
$entityPart = Code::dashToCamelCase($entityPart);
}
// alle weiteren Parameter an den Contro... | [
"public",
"function",
"routeController",
"(",
"ServiceRequest",
"$",
"request",
")",
"{",
"$",
"r",
"=",
"$",
"this",
"->",
"initRequestMatcher",
"(",
"$",
"request",
")",
";",
"$",
"entityPart",
"=",
"$",
"r",
"->",
"qmatchRx",
"(",
"'/^[a-z-0-9]+$/i'",
"... | Findet den Controller anhand des Requests
GET [/$prefix]/person/1
=>
\Project::getNamespace()\Controllers\PersonController::getEntity(1)
=>
\CoC\Controllers\PersonController::getEntity(1)
GET [/$prefix]/person/1/form
=>
\Project::getNamespace()\Controllers\PersonController::getEntity(1,'form')
GET [/$prefix]/persons... | [
"Findet",
"den",
"Controller",
"anhand",
"des",
"Requests"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Service/EntityService.php#L85-L163 |
webforge-labs/psc-cms | lib/Psc/CMS/Service/EntityService.php | EntityService.setResponseFromControllerResponse | protected function setResponseFromControllerResponse($controllerResponse, $status = Service::OK, $format = NULL) {
if ($controllerResponse instanceof \Psc\CMS\EntityFormPanel) {
$format = ServiceResponse::HTML;
} elseif ($controllerResponse instanceof \Psc\CMS\Entity) {
$format = ServiceRespon... | php | protected function setResponseFromControllerResponse($controllerResponse, $status = Service::OK, $format = NULL) {
if ($controllerResponse instanceof \Psc\CMS\EntityFormPanel) {
$format = ServiceResponse::HTML;
} elseif ($controllerResponse instanceof \Psc\CMS\Entity) {
$format = ServiceRespon... | [
"protected",
"function",
"setResponseFromControllerResponse",
"(",
"$",
"controllerResponse",
",",
"$",
"status",
"=",
"Service",
"::",
"OK",
",",
"$",
"format",
"=",
"NULL",
")",
"{",
"if",
"(",
"$",
"controllerResponse",
"instanceof",
"\\",
"Psc",
"\\",
"CMS... | Konvertiert die Responses der Controller in Responses für den RequestHandler | [
"Konvertiert",
"die",
"Responses",
"der",
"Controller",
"in",
"Responses",
"für",
"den",
"RequestHandler"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Service/EntityService.php#L175-L188 |
yuncms/framework | src/admin/controllers/UserAssignmentController.php | UserAssignmentController.actionIndex | public function actionIndex()
{
$searchModel = new UserAssignmentSearch;
$dataProvider = $searchModel->search(Yii::$app->getRequest()->getQueryParams(), $this->userClassName, $this->usernameField);
return $this->render('index', [
'dataProvider' => $dataProvider,
'sea... | php | public function actionIndex()
{
$searchModel = new UserAssignmentSearch;
$dataProvider = $searchModel->search(Yii::$app->getRequest()->getQueryParams(), $this->userClassName, $this->usernameField);
return $this->render('index', [
'dataProvider' => $dataProvider,
'sea... | [
"public",
"function",
"actionIndex",
"(",
")",
"{",
"$",
"searchModel",
"=",
"new",
"UserAssignmentSearch",
";",
"$",
"dataProvider",
"=",
"$",
"searchModel",
"->",
"search",
"(",
"Yii",
"::",
"$",
"app",
"->",
"getRequest",
"(",
")",
"->",
"getQueryParams",... | Lists all Assignment models.
@return mixed | [
"Lists",
"all",
"Assignment",
"models",
"."
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/admin/controllers/UserAssignmentController.php#L61-L73 |
yuncms/framework | src/admin/controllers/UserAssignmentController.php | UserAssignmentController.actionView | public function actionView($id)
{
$model = $this->findModel($id);
return $this->render('view', [
'model' => $model,
'idField' => $this->idField,
'usernameField' => $this->usernameField,
'fullNameField' => $this->fullNameField,
]);
} | php | public function actionView($id)
{
$model = $this->findModel($id);
return $this->render('view', [
'model' => $model,
'idField' => $this->idField,
'usernameField' => $this->usernameField,
'fullNameField' => $this->fullNameField,
]);
} | [
"public",
"function",
"actionView",
"(",
"$",
"id",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"findModel",
"(",
"$",
"id",
")",
";",
"return",
"$",
"this",
"->",
"render",
"(",
"'view'",
",",
"[",
"'model'",
"=>",
"$",
"model",
",",
"'idField... | Displays a single Assignment model.
@param integer $id
@return mixed
@throws NotFoundHttpException | [
"Displays",
"a",
"single",
"Assignment",
"model",
"."
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/admin/controllers/UserAssignmentController.php#L81-L90 |
anime-db/app-bundle | src/Service/PhpFinder.php | PhpFinder.getPath | public function getPath()
{
if (!$this->php_path) {
if (!($this->php_path = $this->finder->find())) {
throw new \RuntimeException(
'The php executable could not be found, add it to your PATH environment variable and try again'
);
}
... | php | public function getPath()
{
if (!$this->php_path) {
if (!($this->php_path = $this->finder->find())) {
throw new \RuntimeException(
'The php executable could not be found, add it to your PATH environment variable and try again'
);
}
... | [
"public",
"function",
"getPath",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"php_path",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"this",
"->",
"php_path",
"=",
"$",
"this",
"->",
"finder",
"->",
"find",
"(",
")",
")",
")",
"{",
"throw",
"new"... | @throws \RuntimeException
@return string | [
"@throws",
"\\",
"RuntimeException"
] | train | https://github.com/anime-db/app-bundle/blob/ca3b342081719d41ba018792a75970cbb1f1fe22/src/Service/PhpFinder.php#L38-L50 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseSystemSettings.php | BaseSystemSettings.setKey | public function setKey($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->key !== $v) {
$this->key = $v;
$this->modifiedColumns[] = SystemSettingsPeer::KEY;
}
return $this;
} | php | public function setKey($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->key !== $v) {
$this->key = $v;
$this->modifiedColumns[] = SystemSettingsPeer::KEY;
}
return $this;
} | [
"public",
"function",
"setKey",
"(",
"$",
"v",
")",
"{",
"if",
"(",
"$",
"v",
"!==",
"null",
")",
"{",
"$",
"v",
"=",
"(",
"string",
")",
"$",
"v",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"key",
"!==",
"$",
"v",
")",
"{",
"$",
"this",
"->... | Set the value of [key] column.
@param string $v new value
@return SystemSettings The current object (for fluent API support) | [
"Set",
"the",
"value",
"of",
"[",
"key",
"]",
"column",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseSystemSettings.php#L137-L150 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseSystemSettings.php | BaseSystemSettings.setValue | public function setValue($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->value !== $v) {
$this->value = $v;
$this->modifiedColumns[] = SystemSettingsPeer::VALUE;
}
return $this;
} | php | public function setValue($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->value !== $v) {
$this->value = $v;
$this->modifiedColumns[] = SystemSettingsPeer::VALUE;
}
return $this;
} | [
"public",
"function",
"setValue",
"(",
"$",
"v",
")",
"{",
"if",
"(",
"$",
"v",
"!==",
"null",
")",
"{",
"$",
"v",
"=",
"(",
"string",
")",
"$",
"v",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"value",
"!==",
"$",
"v",
")",
"{",
"$",
"this",
... | Set the value of [value] column.
@param string $v new value
@return SystemSettings The current object (for fluent API support) | [
"Set",
"the",
"value",
"of",
"[",
"value",
"]",
"column",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseSystemSettings.php#L158-L171 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseSystemSettings.php | BaseSystemSettings.doInsert | protected function doInsert(PropelPDO $con)
{
$modifiedColumns = array();
$index = 0;
$this->modifiedColumns[] = SystemSettingsPeer::ID;
if (null !== $this->id) {
throw new PropelException('Cannot insert a value for auto-increment primary key (' . SystemSettingsPeer::ID ... | php | protected function doInsert(PropelPDO $con)
{
$modifiedColumns = array();
$index = 0;
$this->modifiedColumns[] = SystemSettingsPeer::ID;
if (null !== $this->id) {
throw new PropelException('Cannot insert a value for auto-increment primary key (' . SystemSettingsPeer::ID ... | [
"protected",
"function",
"doInsert",
"(",
"PropelPDO",
"$",
"con",
")",
"{",
"$",
"modifiedColumns",
"=",
"array",
"(",
")",
";",
"$",
"index",
"=",
"0",
";",
"$",
"this",
"->",
"modifiedColumns",
"[",
"]",
"=",
"SystemSettingsPeer",
"::",
"ID",
";",
"... | Insert the row in the database.
@param PropelPDO $con
@throws PropelException
@see doSave() | [
"Insert",
"the",
"row",
"in",
"the",
"database",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseSystemSettings.php#L418-L474 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseSystemSettings.php | BaseSystemSettings.doValidate | protected function doValidate($columns = null)
{
if (!$this->alreadyInValidation) {
$this->alreadyInValidation = true;
$retval = null;
$failureMap = array();
if (($retval = SystemSettingsPeer::doValidate($this, $columns)) !== true) {
$failur... | php | protected function doValidate($columns = null)
{
if (!$this->alreadyInValidation) {
$this->alreadyInValidation = true;
$retval = null;
$failureMap = array();
if (($retval = SystemSettingsPeer::doValidate($this, $columns)) !== true) {
$failur... | [
"protected",
"function",
"doValidate",
"(",
"$",
"columns",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"alreadyInValidation",
")",
"{",
"$",
"this",
"->",
"alreadyInValidation",
"=",
"true",
";",
"$",
"retval",
"=",
"null",
";",
"$",
"fa... | This function performs the validation work for complex object models.
In addition to checking the current object, all related objects will
also be validated. If all pass then <code>true</code> is returned; otherwise
an aggregated array of ValidationFailed objects will be returned.
@param array $columns Array of colu... | [
"This",
"function",
"performs",
"the",
"validation",
"work",
"for",
"complex",
"object",
"models",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseSystemSettings.php#L543-L562 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseSystemSettings.php | BaseSystemSettings.getByPosition | public function getByPosition($pos)
{
switch ($pos) {
case 0:
return $this->getId();
break;
case 1:
return $this->getKey();
break;
case 2:
return $this->getValue();
break;
... | php | public function getByPosition($pos)
{
switch ($pos) {
case 0:
return $this->getId();
break;
case 1:
return $this->getKey();
break;
case 2:
return $this->getValue();
break;
... | [
"public",
"function",
"getByPosition",
"(",
"$",
"pos",
")",
"{",
"switch",
"(",
"$",
"pos",
")",
"{",
"case",
"0",
":",
"return",
"$",
"this",
"->",
"getId",
"(",
")",
";",
"break",
";",
"case",
"1",
":",
"return",
"$",
"this",
"->",
"getKey",
"... | Retrieves a field from the object by Position as specified in the xml schema.
Zero-based.
@param int $pos position in xml schema
@return mixed Value of field at $pos | [
"Retrieves",
"a",
"field",
"from",
"the",
"object",
"by",
"Position",
"as",
"specified",
"in",
"the",
"xml",
"schema",
".",
"Zero",
"-",
"based",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseSystemSettings.php#L589-L605 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseSystemSettings.php | BaseSystemSettings.toArray | public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array())
{
if (isset($alreadyDumpedObjects['SystemSettings'][$this->getPrimaryKey()])) {
return '*RECURSION*';
}
$alreadyDumpedObjects['SystemSettings'][$this->getPr... | php | public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array())
{
if (isset($alreadyDumpedObjects['SystemSettings'][$this->getPrimaryKey()])) {
return '*RECURSION*';
}
$alreadyDumpedObjects['SystemSettings'][$this->getPr... | [
"public",
"function",
"toArray",
"(",
"$",
"keyType",
"=",
"BasePeer",
"::",
"TYPE_PHPNAME",
",",
"$",
"includeLazyLoadColumns",
"=",
"true",
",",
"$",
"alreadyDumpedObjects",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"alreadyDumpedObje... | Exports the object as an array.
You can specify the key type of the array by passing one of the class
type constants.
@param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
Defau... | [
"Exports",
"the",
"object",
"as",
"an",
"array",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseSystemSettings.php#L621-L640 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseSystemSettings.php | BaseSystemSettings.setByPosition | public function setByPosition($pos, $value)
{
switch ($pos) {
case 0:
$this->setId($value);
break;
case 1:
$this->setKey($value);
break;
case 2:
$this->setValue($value);
break;... | php | public function setByPosition($pos, $value)
{
switch ($pos) {
case 0:
$this->setId($value);
break;
case 1:
$this->setKey($value);
break;
case 2:
$this->setValue($value);
break;... | [
"public",
"function",
"setByPosition",
"(",
"$",
"pos",
",",
"$",
"value",
")",
"{",
"switch",
"(",
"$",
"pos",
")",
"{",
"case",
"0",
":",
"$",
"this",
"->",
"setId",
"(",
"$",
"value",
")",
";",
"break",
";",
"case",
"1",
":",
"$",
"this",
"-... | Sets a field from the object by Position as specified in the xml schema.
Zero-based.
@param int $pos position in xml schema
@param mixed $value field value
@return void | [
"Sets",
"a",
"field",
"from",
"the",
"object",
"by",
"Position",
"as",
"specified",
"in",
"the",
"xml",
"schema",
".",
"Zero",
"-",
"based",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseSystemSettings.php#L668-L681 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseSystemSettings.php | BaseSystemSettings.fromArray | public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
{
$keys = SystemSettingsPeer::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setKey($arr[$keys[1]]);
if (array_key_exists($ke... | php | public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
{
$keys = SystemSettingsPeer::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setKey($arr[$keys[1]]);
if (array_key_exists($ke... | [
"public",
"function",
"fromArray",
"(",
"$",
"arr",
",",
"$",
"keyType",
"=",
"BasePeer",
"::",
"TYPE_PHPNAME",
")",
"{",
"$",
"keys",
"=",
"SystemSettingsPeer",
"::",
"getFieldNames",
"(",
"$",
"keyType",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",... | Populates the object using an array.
This is particularly useful when populating an object from one of the
request arrays (e.g. $_POST). This method goes through the column
names, checking to see whether a matching key exists in populated
array. If so the setByName() method is called for that column.
You can specify... | [
"Populates",
"the",
"object",
"using",
"an",
"array",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseSystemSettings.php#L700-L707 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseSystemSettings.php | BaseSystemSettings.buildCriteria | public function buildCriteria()
{
$criteria = new Criteria(SystemSettingsPeer::DATABASE_NAME);
if ($this->isColumnModified(SystemSettingsPeer::ID)) $criteria->add(SystemSettingsPeer::ID, $this->id);
if ($this->isColumnModified(SystemSettingsPeer::KEY)) $criteria->add(SystemSettingsPeer::KEY... | php | public function buildCriteria()
{
$criteria = new Criteria(SystemSettingsPeer::DATABASE_NAME);
if ($this->isColumnModified(SystemSettingsPeer::ID)) $criteria->add(SystemSettingsPeer::ID, $this->id);
if ($this->isColumnModified(SystemSettingsPeer::KEY)) $criteria->add(SystemSettingsPeer::KEY... | [
"public",
"function",
"buildCriteria",
"(",
")",
"{",
"$",
"criteria",
"=",
"new",
"Criteria",
"(",
"SystemSettingsPeer",
"::",
"DATABASE_NAME",
")",
";",
"if",
"(",
"$",
"this",
"->",
"isColumnModified",
"(",
"SystemSettingsPeer",
"::",
"ID",
")",
")",
"$",... | Build a Criteria object containing the values of all modified columns in this object.
@return Criteria The Criteria object containing all modified values. | [
"Build",
"a",
"Criteria",
"object",
"containing",
"the",
"values",
"of",
"all",
"modified",
"columns",
"in",
"this",
"object",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseSystemSettings.php#L714-L723 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseSystemSettings.php | BaseSystemSettings.copyInto | public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
{
$copyObj->setKey($this->getKey());
$copyObj->setValue($this->getValue());
if ($makeNew) {
$copyObj->setNew(true);
$copyObj->setId(NULL); // this is a auto-increment column, so set to default valu... | php | public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
{
$copyObj->setKey($this->getKey());
$copyObj->setValue($this->getValue());
if ($makeNew) {
$copyObj->setNew(true);
$copyObj->setId(NULL); // this is a auto-increment column, so set to default valu... | [
"public",
"function",
"copyInto",
"(",
"$",
"copyObj",
",",
"$",
"deepCopy",
"=",
"false",
",",
"$",
"makeNew",
"=",
"true",
")",
"{",
"$",
"copyObj",
"->",
"setKey",
"(",
"$",
"this",
"->",
"getKey",
"(",
")",
")",
";",
"$",
"copyObj",
"->",
"setV... | Sets contents of passed object to values from current object.
If desired, this method can also make copies of all associated (fkey referrers)
objects.
@param object $copyObj An object of SystemSettings (or compatible) type.
@param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row... | [
"Sets",
"contents",
"of",
"passed",
"object",
"to",
"values",
"from",
"current",
"object",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseSystemSettings.php#L782-L790 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseSystemSettings.php | BaseSystemSettings.clear | public function clear()
{
$this->id = null;
$this->key = null;
$this->value = null;
$this->alreadyInSave = false;
$this->alreadyInValidation = false;
$this->alreadyInClearAllReferencesDeep = false;
$this->clearAllReferences();
$this->resetModified();
... | php | public function clear()
{
$this->id = null;
$this->key = null;
$this->value = null;
$this->alreadyInSave = false;
$this->alreadyInValidation = false;
$this->alreadyInClearAllReferencesDeep = false;
$this->clearAllReferences();
$this->resetModified();
... | [
"public",
"function",
"clear",
"(",
")",
"{",
"$",
"this",
"->",
"id",
"=",
"null",
";",
"$",
"this",
"->",
"key",
"=",
"null",
";",
"$",
"this",
"->",
"value",
"=",
"null",
";",
"$",
"this",
"->",
"alreadyInSave",
"=",
"false",
";",
"$",
"this",... | Clears the current object and sets all attributes to their default values | [
"Clears",
"the",
"current",
"object",
"and",
"sets",
"all",
"attributes",
"to",
"their",
"default",
"values"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseSystemSettings.php#L835-L847 |
digitalkaoz/versioneye-php | src/Api/Github.php | Github.repos | public function repos($language = null, $private = null, $organization = null, $type = null, $imported = null)
{
return $this->request(sprintf('github?lang=%s&private=%b&org_name=%s&org_type=%s&page=%d&only_imported=%b',
$language, $private, $organization, $type, 1, $imported
));
} | php | public function repos($language = null, $private = null, $organization = null, $type = null, $imported = null)
{
return $this->request(sprintf('github?lang=%s&private=%b&org_name=%s&org_type=%s&page=%d&only_imported=%b',
$language, $private, $organization, $type, 1, $imported
));
} | [
"public",
"function",
"repos",
"(",
"$",
"language",
"=",
"null",
",",
"$",
"private",
"=",
"null",
",",
"$",
"organization",
"=",
"null",
",",
"$",
"type",
"=",
"null",
",",
"$",
"imported",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"req... | lists your's github repos.
@param string $language
@param bool $private
@param string $organization
@param string $type
@param bool $imported
@return array | [
"lists",
"your",
"s",
"github",
"repos",
"."
] | train | https://github.com/digitalkaoz/versioneye-php/blob/7b8eb9cdc83e01138dda0e709c07e3beb6aad136/src/Api/Github.php#L25-L30 |
digitalkaoz/versioneye-php | src/Api/Github.php | Github.import | public function import($repository, $branch = null, $file = null)
{
return $this->request(sprintf('github/%s?branch=%s&file=%s', $this->transform($repository), $branch, $file), 'POST');
} | php | public function import($repository, $branch = null, $file = null)
{
return $this->request(sprintf('github/%s?branch=%s&file=%s', $this->transform($repository), $branch, $file), 'POST');
} | [
"public",
"function",
"import",
"(",
"$",
"repository",
",",
"$",
"branch",
"=",
"null",
",",
"$",
"file",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"request",
"(",
"sprintf",
"(",
"'github/%s?branch=%s&file=%s'",
",",
"$",
"this",
"->",
"trans... | imports project file from github.
@param string $repository
@param string $branch
@param string $file
@return array | [
"imports",
"project",
"file",
"from",
"github",
"."
] | train | https://github.com/digitalkaoz/versioneye-php/blob/7b8eb9cdc83e01138dda0e709c07e3beb6aad136/src/Api/Github.php#L63-L66 |
yuncms/framework | src/oauth2/grant/types/QRCode.php | QRCode.getAccessToken | public function getAccessToken()
{
if (is_null($this->_accessToken)) {
if (empty($this->access_token)) {
$this->errorServer(Yii::t('yuncms', 'The request is missing "access_token" parameter'));
}
if (!$this->_accessToken = OAuth2AccessToken::findOne(['acce... | php | public function getAccessToken()
{
if (is_null($this->_accessToken)) {
if (empty($this->access_token)) {
$this->errorServer(Yii::t('yuncms', 'The request is missing "access_token" parameter'));
}
if (!$this->_accessToken = OAuth2AccessToken::findOne(['acce... | [
"public",
"function",
"getAccessToken",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"_accessToken",
")",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"access_token",
")",
")",
"{",
"$",
"this",
"->",
"errorServer",
"(",
"Yii... | 获取 AccessToken 实例
@return OAuth2AccessToken
@throws Exception | [
"获取",
"AccessToken",
"实例"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/oauth2/grant/types/QRCode.php#L124-L135 |
dunkelfrosch/phpcoverfish | src/PHPCoverFish/Common/CoverFishHelper.php | CoverFishHelper.getLastItemInFQNBlock | public function getLastItemInFQNBlock($fqn, $delimiter)
{
if (false === $fqnBlock = explode($delimiter, $fqn)) {
return $fqnBlock;
}
return (string) $fqnBlock[count($fqnBlock) - 1];
} | php | public function getLastItemInFQNBlock($fqn, $delimiter)
{
if (false === $fqnBlock = explode($delimiter, $fqn)) {
return $fqnBlock;
}
return (string) $fqnBlock[count($fqnBlock) - 1];
} | [
"public",
"function",
"getLastItemInFQNBlock",
"(",
"$",
"fqn",
",",
"$",
"delimiter",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"fqnBlock",
"=",
"explode",
"(",
"$",
"delimiter",
",",
"$",
"fqn",
")",
")",
"{",
"return",
"$",
"fqnBlock",
";",
"}",
"... | @param string $fqn
@param string $delimiter
@return string | [
"@param",
"string",
"$fqn",
"@param",
"string",
"$delimiter"
] | train | https://github.com/dunkelfrosch/phpcoverfish/blob/779bd399ec8f4cadb3b7854200695c5eb3f5a8ad/src/PHPCoverFish/Common/CoverFishHelper.php#L77-L84 |
dunkelfrosch/phpcoverfish | src/PHPCoverFish/Common/CoverFishHelper.php | CoverFishHelper.getClassFromUse | public function getClassFromUse($coverClassName, $usedClasses)
{
if (false === is_array($usedClasses)) {
return $coverClassName;
}
foreach ($usedClasses as $use) {
$this->getClassNameFromClassFQN($use);
if ($coverClassName === $this->getClassNameFromClass... | php | public function getClassFromUse($coverClassName, $usedClasses)
{
if (false === is_array($usedClasses)) {
return $coverClassName;
}
foreach ($usedClasses as $use) {
$this->getClassNameFromClassFQN($use);
if ($coverClassName === $this->getClassNameFromClass... | [
"public",
"function",
"getClassFromUse",
"(",
"$",
"coverClassName",
",",
"$",
"usedClasses",
")",
"{",
"if",
"(",
"false",
"===",
"is_array",
"(",
"$",
"usedClasses",
")",
")",
"{",
"return",
"$",
"coverClassName",
";",
"}",
"foreach",
"(",
"$",
"usedClas... | check for className in use statements, return className on missing use statement
@param string $coverClassName
@param array|null $usedClasses
@return string | [
"check",
"for",
"className",
"in",
"use",
"statements",
"return",
"className",
"on",
"missing",
"use",
"statement"
] | train | https://github.com/dunkelfrosch/phpcoverfish/blob/779bd399ec8f4cadb3b7854200695c5eb3f5a8ad/src/PHPCoverFish/Common/CoverFishHelper.php#L94-L108 |
dunkelfrosch/phpcoverfish | src/PHPCoverFish/Common/CoverFishHelper.php | CoverFishHelper.getUsedClassesInClass | public function getUsedClassesInClass($classFile)
{
$useResult = array();
$content = $this->getFileContent($classFile);
if (preg_match_all('/(use\s+)(.*)(;)/', $content, $useResult) && 4 === count($useResult)) {
// @todo: use keyName based result check instead of index!
... | php | public function getUsedClassesInClass($classFile)
{
$useResult = array();
$content = $this->getFileContent($classFile);
if (preg_match_all('/(use\s+)(.*)(;)/', $content, $useResult) && 4 === count($useResult)) {
// @todo: use keyName based result check instead of index!
... | [
"public",
"function",
"getUsedClassesInClass",
"(",
"$",
"classFile",
")",
"{",
"$",
"useResult",
"=",
"array",
"(",
")",
";",
"$",
"content",
"=",
"$",
"this",
"->",
"getFileContent",
"(",
"$",
"classFile",
")",
";",
"if",
"(",
"preg_match_all",
"(",
"'... | return all in file use statement defined classes
@param string $classFile absolute path of readable class file
@return array | [
"return",
"all",
"in",
"file",
"use",
"statement",
"defined",
"classes"
] | train | https://github.com/dunkelfrosch/phpcoverfish/blob/779bd399ec8f4cadb3b7854200695c5eb3f5a8ad/src/PHPCoverFish/Common/CoverFishHelper.php#L117-L127 |
dunkelfrosch/phpcoverfish | src/PHPCoverFish/Common/CoverFishHelper.php | CoverFishHelper.checkPath | public function checkPath($path)
{
$path = realpath($path);
return ($path !== false && is_dir($path)) ? $path : false;
} | php | public function checkPath($path)
{
$path = realpath($path);
return ($path !== false && is_dir($path)) ? $path : false;
} | [
"public",
"function",
"checkPath",
"(",
"$",
"path",
")",
"{",
"$",
"path",
"=",
"realpath",
"(",
"$",
"path",
")",
";",
"return",
"(",
"$",
"path",
"!==",
"false",
"&&",
"is_dir",
"(",
"$",
"path",
")",
")",
"?",
"$",
"path",
":",
"false",
";",
... | @param string $path
@return string|false | [
"@param",
"string",
"$path"
] | train | https://github.com/dunkelfrosch/phpcoverfish/blob/779bd399ec8f4cadb3b7854200695c5eb3f5a8ad/src/PHPCoverFish/Common/CoverFishHelper.php#L150-L155 |
dunkelfrosch/phpcoverfish | src/PHPCoverFish/Common/CoverFishHelper.php | CoverFishHelper.getAnnotationByKey | public function getAnnotationByKey($docBlock, $key)
{
/** @var array $classAnnotations */
$classAnnotations = $this->parseCoverAnnotationDocBlock($docBlock);
if (false === array_key_exists($key, $classAnnotations)) {
return array();
}
return $classAnnotations[$ke... | php | public function getAnnotationByKey($docBlock, $key)
{
/** @var array $classAnnotations */
$classAnnotations = $this->parseCoverAnnotationDocBlock($docBlock);
if (false === array_key_exists($key, $classAnnotations)) {
return array();
}
return $classAnnotations[$ke... | [
"public",
"function",
"getAnnotationByKey",
"(",
"$",
"docBlock",
",",
"$",
"key",
")",
"{",
"/** @var array $classAnnotations */",
"$",
"classAnnotations",
"=",
"$",
"this",
"->",
"parseCoverAnnotationDocBlock",
"(",
"$",
"docBlock",
")",
";",
"if",
"(",
"false",... | fetch annotation key value(s) as array from corresponding class docBlock directly
@param string $docBlock
@param string $key
@return array | [
"fetch",
"annotation",
"key",
"value",
"(",
"s",
")",
"as",
"array",
"from",
"corresponding",
"class",
"docBlock",
"directly"
] | train | https://github.com/dunkelfrosch/phpcoverfish/blob/779bd399ec8f4cadb3b7854200695c5eb3f5a8ad/src/PHPCoverFish/Common/CoverFishHelper.php#L209-L218 |
dunkelfrosch/phpcoverfish | src/PHPCoverFish/Common/CoverFishHelper.php | CoverFishHelper.getAttributeByKey | public function getAttributeByKey($key, array $classData)
{
if (false === array_key_exists($key, $classData)) {
return '';
}
return (string) $classData[$key];
} | php | public function getAttributeByKey($key, array $classData)
{
if (false === array_key_exists($key, $classData)) {
return '';
}
return (string) $classData[$key];
} | [
"public",
"function",
"getAttributeByKey",
"(",
"$",
"key",
",",
"array",
"$",
"classData",
")",
"{",
"if",
"(",
"false",
"===",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"classData",
")",
")",
"{",
"return",
"''",
";",
"}",
"return",
"(",
"string... | @param string $key
@param array $classData
@return string | [
"@param",
"string",
"$key",
"@param",
"array",
"$classData"
] | train | https://github.com/dunkelfrosch/phpcoverfish/blob/779bd399ec8f4cadb3b7854200695c5eb3f5a8ad/src/PHPCoverFish/Common/CoverFishHelper.php#L226-L233 |
dunkelfrosch/phpcoverfish | src/PHPCoverFish/Common/CoverFishHelper.php | CoverFishHelper.parseCoverAnnotationDocBlock | public function parseCoverAnnotationDocBlock($docBlock)
{
$annotations = array('covers' => array(), 'uses' => array());
$docBlock = substr($docBlock, 3, -2);
if (preg_match_all('/@(?P<name>[A-Za-z_-]+)(?:[ \t]+(?P<value>.*?))?[ \t]*\r?$/m', $docBlock, $matches)) {
$numMatches = c... | php | public function parseCoverAnnotationDocBlock($docBlock)
{
$annotations = array('covers' => array(), 'uses' => array());
$docBlock = substr($docBlock, 3, -2);
if (preg_match_all('/@(?P<name>[A-Za-z_-]+)(?:[ \t]+(?P<value>.*?))?[ \t]*\r?$/m', $docBlock, $matches)) {
$numMatches = c... | [
"public",
"function",
"parseCoverAnnotationDocBlock",
"(",
"$",
"docBlock",
")",
"{",
"$",
"annotations",
"=",
"array",
"(",
"'covers'",
"=>",
"array",
"(",
")",
",",
"'uses'",
"=>",
"array",
"(",
")",
")",
";",
"$",
"docBlock",
"=",
"substr",
"(",
"$",
... | @param string $docBlock
@return array | [
"@param",
"string",
"$docBlock"
] | train | https://github.com/dunkelfrosch/phpcoverfish/blob/779bd399ec8f4cadb3b7854200695c5eb3f5a8ad/src/PHPCoverFish/Common/CoverFishHelper.php#L250-L269 |
factorio-item-browser/export-data | src/Registry/ContentRegistry.php | ContentRegistry.set | public function set(string $hash, string $content): void
{
$this->saveContent($hash, $content);
} | php | public function set(string $hash, string $content): void
{
$this->saveContent($hash, $content);
} | [
"public",
"function",
"set",
"(",
"string",
"$",
"hash",
",",
"string",
"$",
"content",
")",
":",
"void",
"{",
"$",
"this",
"->",
"saveContent",
"(",
"$",
"hash",
",",
"$",
"content",
")",
";",
"}"
] | Sets content into the registry.
@param string $hash
@param string $content | [
"Sets",
"content",
"into",
"the",
"registry",
"."
] | train | https://github.com/factorio-item-browser/export-data/blob/1413b2eed0fbfed0521457ac7ef0d668ac30c212/src/Registry/ContentRegistry.php#L20-L23 |
gries/rcon | src/MessengerFactory.php | MessengerFactory.create | public static function create($host, $port, $password)
{
$connection = ConnectionFactory::create($host, $port, $password);
return new Messenger($connection);
} | php | public static function create($host, $port, $password)
{
$connection = ConnectionFactory::create($host, $port, $password);
return new Messenger($connection);
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"host",
",",
"$",
"port",
",",
"$",
"password",
")",
"{",
"$",
"connection",
"=",
"ConnectionFactory",
"::",
"create",
"(",
"$",
"host",
",",
"$",
"port",
",",
"$",
"password",
")",
";",
"return",
"... | Create a new RconMessenger
@param $host
@param $port
@param $password
@return \gries\Rcon\Messenger | [
"Create",
"a",
"new",
"RconMessenger"
] | train | https://github.com/gries/rcon/blob/7fada05b329d89542692af00ab80db02ad59d45d/src/MessengerFactory.php#L24-L29 |
slashworks/control-bundle | src/Slashworks/BackendBundle/DataFixtures/ORM/LoadUserData.php | LoadUserData.load | public function load(ObjectManager $manager)
{
$user = new User();
$user->setUsername("someuser");
$user->setSalt(md5(uniqid()));
$encoder = $this->container->get('security.encoder_factory')->getEncoder($user);
$user->setPassword($encoder->encodePassw... | php | public function load(ObjectManager $manager)
{
$user = new User();
$user->setUsername("someuser");
$user->setSalt(md5(uniqid()));
$encoder = $this->container->get('security.encoder_factory')->getEncoder($user);
$user->setPassword($encoder->encodePassw... | [
"public",
"function",
"load",
"(",
"ObjectManager",
"$",
"manager",
")",
"{",
"$",
"user",
"=",
"new",
"User",
"(",
")",
";",
"$",
"user",
"->",
"setUsername",
"(",
"\"someuser\"",
")",
";",
"$",
"user",
"->",
"setSalt",
"(",
"md5",
"(",
"uniqid",
"(... | {@inheritDoc} | [
"{"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/DataFixtures/ORM/LoadUserData.php#L33-L46 |
Nozemi/SlickBoard-Library | lib/SBLib/Utilities/Config.php | Config.get | public function get($name, $default = null, $file = null) {
$configVal = null;
if(is_array($this->config)) {
if($file === null) {
if(count(array_column($this->config, $name)) > 0) {
$configVal = array_column($this->config, $name)[0];
... | php | public function get($name, $default = null, $file = null) {
$configVal = null;
if(is_array($this->config)) {
if($file === null) {
if(count(array_column($this->config, $name)) > 0) {
$configVal = array_column($this->config, $name)[0];
... | [
"public",
"function",
"get",
"(",
"$",
"name",
",",
"$",
"default",
"=",
"null",
",",
"$",
"file",
"=",
"null",
")",
"{",
"$",
"configVal",
"=",
"null",
";",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"config",
")",
")",
"{",
"if",
"(",
"$"... | Gets a config value from the config array.
@param string $name
@param string $file
@param mixed $default
@return mixed | [
"Gets",
"a",
"config",
"value",
"from",
"the",
"config",
"array",
"."
] | train | https://github.com/Nozemi/SlickBoard-Library/blob/c9f0a26a30f8127c997f75d7232eac170972418d/lib/SBLib/Utilities/Config.php#L83-L107 |
matks/MarkdownBlogBundle | Blog/Register/YamlLibraryRegister.php | YamlLibraryRegister.validateRegisterFilepath | private function validateRegisterFilepath($registerFilepath)
{
if (false === file_exists($registerFilepath)) {
throw new \InvalidArgumentException("File $registerFilepath does not exist");
}
$yamlPattern = '#' . '(.*)\.yml$' . '#';
$isAYamlFile = preg_match($yamlPattern... | php | private function validateRegisterFilepath($registerFilepath)
{
if (false === file_exists($registerFilepath)) {
throw new \InvalidArgumentException("File $registerFilepath does not exist");
}
$yamlPattern = '#' . '(.*)\.yml$' . '#';
$isAYamlFile = preg_match($yamlPattern... | [
"private",
"function",
"validateRegisterFilepath",
"(",
"$",
"registerFilepath",
")",
"{",
"if",
"(",
"false",
"===",
"file_exists",
"(",
"$",
"registerFilepath",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\"File $registerFilepath does not ... | @param string $registerFilepath
@throws \InvalidArgumentException | [
"@param",
"string",
"$registerFilepath"
] | train | https://github.com/matks/MarkdownBlogBundle/blob/b3438f143ece5e926b891d8f481dba35948b05fb/Blog/Register/YamlLibraryRegister.php#L60-L72 |
kattsoftware/phassets | src/Phassets/Filters/CssCompactFilter.php | CssCompactFilter.filter | public function filter(Asset $asset)
{
if ($asset->getOutputExtension() !== 'css') {
throw new PhassetsInternalException('Only .css files can be filtered by ' . __CLASS__);
}
try {
$cssParser = new Parser($asset->getContents());
$result = $cssParser->par... | php | public function filter(Asset $asset)
{
if ($asset->getOutputExtension() !== 'css') {
throw new PhassetsInternalException('Only .css files can be filtered by ' . __CLASS__);
}
try {
$cssParser = new Parser($asset->getContents());
$result = $cssParser->par... | [
"public",
"function",
"filter",
"(",
"Asset",
"$",
"asset",
")",
"{",
"if",
"(",
"$",
"asset",
"->",
"getOutputExtension",
"(",
")",
"!==",
"'css'",
")",
"{",
"throw",
"new",
"PhassetsInternalException",
"(",
"'Only .css files can be filtered by '",
".",
"__CLAS... | Process the Asset received and using Asset::setContents(), update
the contents accordingly. If it fails, will throw PhassetsInternalException
@param Asset $asset Asset instance which will be updated via setContents()
@throws PhassetsInternalException in case of failure | [
"Process",
"the",
"Asset",
"received",
"and",
"using",
"Asset",
"::",
"setContents",
"()",
"update",
"the",
"contents",
"accordingly",
".",
"If",
"it",
"fails",
"will",
"throw",
"PhassetsInternalException"
] | train | https://github.com/kattsoftware/phassets/blob/cc982cf1941eb5776287d64f027218bd4835ed2b/src/Phassets/Filters/CssCompactFilter.php#L39-L64 |
digitalkaoz/versioneye-php | src/Http/Pager.php | Pager.valid | public function valid()
{
if (!isset($this->result[$this->offset]) && $this->offset < $this->max) {
++$this->current;
$url = preg_replace('/page=[0-9]+/', 'page=' . $this->current, $this->url);
$result = $this->client->request($this->method, $url, $this->params);
... | php | public function valid()
{
if (!isset($this->result[$this->offset]) && $this->offset < $this->max) {
++$this->current;
$url = preg_replace('/page=[0-9]+/', 'page=' . $this->current, $this->url);
$result = $this->client->request($this->method, $url, $this->params);
... | [
"public",
"function",
"valid",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"result",
"[",
"$",
"this",
"->",
"offset",
"]",
")",
"&&",
"$",
"this",
"->",
"offset",
"<",
"$",
"this",
"->",
"max",
")",
"{",
"++",
"$",
"this",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/digitalkaoz/versioneye-php/blob/7b8eb9cdc83e01138dda0e709c07e3beb6aad136/src/Http/Pager.php#L74-L87 |
dreamfactorysoftware/df-file | src/ServiceProvider.php | ServiceProvider.boot | public function boot()
{
// add our df config
$configPath = __DIR__ . '/../config/config.php';
if (function_exists('config_path')) {
$publishPath = config_path('df.php');
} else {
$publishPath = base_path('config/df.php');
}
$this->publishes([$... | php | public function boot()
{
// add our df config
$configPath = __DIR__ . '/../config/config.php';
if (function_exists('config_path')) {
$publishPath = config_path('df.php');
} else {
$publishPath = base_path('config/df.php');
}
$this->publishes([$... | [
"public",
"function",
"boot",
"(",
")",
"{",
"// add our df config",
"$",
"configPath",
"=",
"__DIR__",
".",
"'/../config/config.php'",
";",
"if",
"(",
"function_exists",
"(",
"'config_path'",
")",
")",
"{",
"$",
"publishPath",
"=",
"config_path",
"(",
"'df.php'... | Bootstrap the application events. | [
"Bootstrap",
"the",
"application",
"events",
"."
] | train | https://github.com/dreamfactorysoftware/df-file/blob/e78aaec3e1d6585b5e7fe9b7646af4b1180ecd66/src/ServiceProvider.php#L23-L42 |
dreamfactorysoftware/df-file | src/ServiceProvider.php | ServiceProvider.register | public function register()
{
// merge in df config, https://laravel.com/docs/5.4/packages#resources
$configPath = __DIR__ . '/../config/config.php';
$this->mergeConfigFrom($configPath, 'df');
// Add our service types.
$this->app->resolving('df.service', function (ServiceMana... | php | public function register()
{
// merge in df config, https://laravel.com/docs/5.4/packages#resources
$configPath = __DIR__ . '/../config/config.php';
$this->mergeConfigFrom($configPath, 'df');
// Add our service types.
$this->app->resolving('df.service', function (ServiceMana... | [
"public",
"function",
"register",
"(",
")",
"{",
"// merge in df config, https://laravel.com/docs/5.4/packages#resources",
"$",
"configPath",
"=",
"__DIR__",
".",
"'/../config/config.php'",
";",
"$",
"this",
"->",
"mergeConfigFrom",
"(",
"$",
"configPath",
",",
"'df'",
... | Register the service provider.
@return void | [
"Register",
"the",
"service",
"provider",
"."
] | train | https://github.com/dreamfactorysoftware/df-file/blob/e78aaec3e1d6585b5e7fe9b7646af4b1180ecd66/src/ServiceProvider.php#L49-L109 |
parsnick/steak | src/Console/ServeCommand.php | ServeCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$this->triggerInitialBuild($input, $output);
$this->startGulpWatcher($input, $output);
} | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$this->triggerInitialBuild($input, $output);
$this->startGulpWatcher($input, $output);
} | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"this",
"->",
"triggerInitialBuild",
"(",
"$",
"input",
",",
"$",
"output",
")",
";",
"$",
"this",
"->",
"startGulpWatcher",
"(",
... | Execute the command.
@param InputInterface $input
@param OutputInterface $output
@return void | [
"Execute",
"the",
"command",
"."
] | train | https://github.com/parsnick/steak/blob/461869189a640938438187330f6c50aca97c5ccc/src/Console/ServeCommand.php#L34-L38 |
nyeholt/silverstripe-external-content | code/model/ExternalContentSource.php | ExternalContentSource.getCMSFields | public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->removeByName('Sort');
$fields->removeByName('ParentID');
$fields->addFieldToTab('Root.Main', new TextField('Name', _t('ExternalContentSource.NAME', 'Name')));
$fields->addFieldToTab('Root.Main', new CheckboxField("ShowContentInMenu",... | php | public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->removeByName('Sort');
$fields->removeByName('ParentID');
$fields->addFieldToTab('Root.Main', new TextField('Name', _t('ExternalContentSource.NAME', 'Name')));
$fields->addFieldToTab('Root.Main', new CheckboxField("ShowContentInMenu",... | [
"public",
"function",
"getCMSFields",
"(",
")",
"{",
"$",
"fields",
"=",
"parent",
"::",
"getCMSFields",
"(",
")",
";",
"$",
"fields",
"->",
"removeByName",
"(",
"'Sort'",
")",
";",
"$",
"fields",
"->",
"removeByName",
"(",
"'ParentID'",
")",
";",
"$",
... | Child classes should provide connection details to the external
content source
@see sapphire/core/model/DataObject#getCMSFields($params)
@return FieldSet | [
"Child",
"classes",
"should",
"provide",
"connection",
"details",
"to",
"the",
"external",
"content",
"source"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/code/model/ExternalContentSource.php#L94-L103 |
nyeholt/silverstripe-external-content | code/model/ExternalContentSource.php | ExternalContentSource.stageChildren | public function stageChildren($showAll = false) {
// if we don't have an ID directly, we should load and return ALL the external content sources
if (!$this->ID) {
return DataObject::get('ExternalContentSource');
}
$children = new ArrayList();
return $children;
} | php | public function stageChildren($showAll = false) {
// if we don't have an ID directly, we should load and return ALL the external content sources
if (!$this->ID) {
return DataObject::get('ExternalContentSource');
}
$children = new ArrayList();
return $children;
} | [
"public",
"function",
"stageChildren",
"(",
"$",
"showAll",
"=",
"false",
")",
"{",
"// if we don't have an ID directly, we should load and return ALL the external content sources",
"if",
"(",
"!",
"$",
"this",
"->",
"ID",
")",
"{",
"return",
"DataObject",
"::",
"get",
... | Override to return the top level content items from the remote
content source.
Specific implementations should effectively query the remote
source for all items that are children of the 'root' node.
@param boolean $showAll
@return DataObjectSet | [
"Override",
"to",
"return",
"the",
"top",
"level",
"content",
"items",
"from",
"the",
"remote",
"content",
"source",
"."
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/code/model/ExternalContentSource.php#L210-L218 |
Double-Opt-in/php-client-api | src/Security/SlowAES/AES.php | AES.rotate | private static function rotate($word){
$c = $word[0];
for ($i = 0; $i < 3; $i++)
$word[$i] = $word[$i+1];
$word[3] = $c;
return $word;
} | php | private static function rotate($word){
$c = $word[0];
for ($i = 0; $i < 3; $i++)
$word[$i] = $word[$i+1];
$word[3] = $c;
return $word;
} | [
"private",
"static",
"function",
"rotate",
"(",
"$",
"word",
")",
"{",
"$",
"c",
"=",
"$",
"word",
"[",
"0",
"]",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"3",
";",
"$",
"i",
"++",
")",
"$",
"word",
"[",
"$",
"i",
"]",
"... | /* rotate the word eight bits to the left | [
"/",
"*",
"rotate",
"the",
"word",
"eight",
"bits",
"to",
"the",
"left"
] | train | https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Security/SlowAES/AES.php#L75-L82 |
Double-Opt-in/php-client-api | src/Security/SlowAES/AES.php | AES.core | private static function core($word,$iteration){
/* rotate the 32-bit word 8 bits to the left */
$word = self::rotate($word);
/* apply S-Box substitution on all 4 parts of the 32-bit word */
for ($i = 0; $i < 4; ++$i)
$word[$i] = self::$sbox[$word[$i]];
/* XOR the output of the rcon operation with i to the ... | php | private static function core($word,$iteration){
/* rotate the 32-bit word 8 bits to the left */
$word = self::rotate($word);
/* apply S-Box substitution on all 4 parts of the 32-bit word */
for ($i = 0; $i < 4; ++$i)
$word[$i] = self::$sbox[$word[$i]];
/* XOR the output of the rcon operation with i to the ... | [
"private",
"static",
"function",
"core",
"(",
"$",
"word",
",",
"$",
"iteration",
")",
"{",
"/* rotate the 32-bit word 8 bits to the left */",
"$",
"word",
"=",
"self",
"::",
"rotate",
"(",
"$",
"word",
")",
";",
"/* apply S-Box substitution on all 4 parts of the 32-b... | Key Schedule Core | [
"Key",
"Schedule",
"Core"
] | train | https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Security/SlowAES/AES.php#L259-L268 |
Double-Opt-in/php-client-api | src/Security/SlowAES/AES.php | AES.expandKey | private static function expandKey($key,$size)
{
$expandedKeySize = (16*(self::numberOfRounds($size)+1));
/* current expanded keySize, in bytes */
$currentSize = 0;
$rconIteration = 1;
$t = array(); // temporary 4-byte variable
$expandedKey = array();
for($i = 0;$i < $expandedKeySize;$i++)
$expande... | php | private static function expandKey($key,$size)
{
$expandedKeySize = (16*(self::numberOfRounds($size)+1));
/* current expanded keySize, in bytes */
$currentSize = 0;
$rconIteration = 1;
$t = array(); // temporary 4-byte variable
$expandedKey = array();
for($i = 0;$i < $expandedKeySize;$i++)
$expande... | [
"private",
"static",
"function",
"expandKey",
"(",
"$",
"key",
",",
"$",
"size",
")",
"{",
"$",
"expandedKeySize",
"=",
"(",
"16",
"*",
"(",
"self",
"::",
"numberOfRounds",
"(",
"$",
"size",
")",
"+",
"1",
")",
")",
";",
"/* current expanded keySize, in ... | /* Rijndael's key expansion
expands an 128,192,256 key into an 176,208,240 bytes key
expandedKey is a pointer to an char array of large enough size
key is a pointer to a non-expanded key | [
"/",
"*",
"Rijndael",
"s",
"key",
"expansion",
"expands",
"an",
"128",
"192",
"256",
"key",
"into",
"an",
"176",
"208",
"240",
"bytes",
"key"
] | train | https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Security/SlowAES/AES.php#L276-L320 |
Double-Opt-in/php-client-api | src/Security/SlowAES/AES.php | AES.addRoundKey | private static function addRoundKey($state,$roundKey){
for ($i = 0; $i < 16; $i++)
$state[$i] = $state[$i] ^ $roundKey[$i];
return $state;
} | php | private static function addRoundKey($state,$roundKey){
for ($i = 0; $i < 16; $i++)
$state[$i] = $state[$i] ^ $roundKey[$i];
return $state;
} | [
"private",
"static",
"function",
"addRoundKey",
"(",
"$",
"state",
",",
"$",
"roundKey",
")",
"{",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"16",
";",
"$",
"i",
"++",
")",
"$",
"state",
"[",
"$",
"i",
"]",
"=",
"$",
"state",
"[",
... | Adds (XORs) the round key to the state | [
"Adds",
"(",
"XORs",
")",
"the",
"round",
"key",
"to",
"the",
"state"
] | train | https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Security/SlowAES/AES.php#L323-L327 |
Double-Opt-in/php-client-api | src/Security/SlowAES/AES.php | AES.createRoundKey | private static function createRoundKey($expandedKey,$roundKeyPointer){
$roundKey = array();
for ($i = 0; $i < 4; $i++)
for ($j = 0; $j < 4; $j++)
$roundKey[$j*4+$i] = $expandedKey[$roundKeyPointer + $i*4 + $j];
return $roundKey;
} | php | private static function createRoundKey($expandedKey,$roundKeyPointer){
$roundKey = array();
for ($i = 0; $i < 4; $i++)
for ($j = 0; $j < 4; $j++)
$roundKey[$j*4+$i] = $expandedKey[$roundKeyPointer + $i*4 + $j];
return $roundKey;
} | [
"private",
"static",
"function",
"createRoundKey",
"(",
"$",
"expandedKey",
",",
"$",
"roundKeyPointer",
")",
"{",
"$",
"roundKey",
"=",
"array",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"4",
";",
"$",
"i",
"++",
")",
"f... | position within the expanded key. | [
"position",
"within",
"the",
"expanded",
"key",
"."
] | train | https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Security/SlowAES/AES.php#L331-L337 |
Double-Opt-in/php-client-api | src/Security/SlowAES/AES.php | AES.subBytes | private static function subBytes($state,$isInv){
for ($i = 0; $i < 16; $i++)
$state[$i] = $isInv?self::$rsbox[$state[$i]]:self::$sbox[$state[$i]];
return $state;
} | php | private static function subBytes($state,$isInv){
for ($i = 0; $i < 16; $i++)
$state[$i] = $isInv?self::$rsbox[$state[$i]]:self::$sbox[$state[$i]];
return $state;
} | [
"private",
"static",
"function",
"subBytes",
"(",
"$",
"state",
",",
"$",
"isInv",
")",
"{",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"16",
";",
"$",
"i",
"++",
")",
"$",
"state",
"[",
"$",
"i",
"]",
"=",
"$",
"isInv",
"?",
"self... | /* substitute all the values from the state with the value in the SBox
using the state value as index for the SBox | [
"/",
"*",
"substitute",
"all",
"the",
"values",
"from",
"the",
"state",
"with",
"the",
"value",
"in",
"the",
"SBox",
"using",
"the",
"state",
"value",
"as",
"index",
"for",
"the",
"SBox"
] | train | https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Security/SlowAES/AES.php#L342-L346 |
Double-Opt-in/php-client-api | src/Security/SlowAES/AES.php | AES.shiftRows | private static function shiftRows($state,$isInv){
for ($i = 0; $i < 4; $i++)
$state = self::shiftRow($state,$i*4, $i,$isInv);
return $state;
} | php | private static function shiftRows($state,$isInv){
for ($i = 0; $i < 4; $i++)
$state = self::shiftRow($state,$i*4, $i,$isInv);
return $state;
} | [
"private",
"static",
"function",
"shiftRows",
"(",
"$",
"state",
",",
"$",
"isInv",
")",
"{",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"4",
";",
"$",
"i",
"++",
")",
"$",
"state",
"=",
"self",
"::",
"shiftRow",
"(",
"$",
"state",
"... | /* iterate over the 4 rows and call shiftRow() with that row | [
"/",
"*",
"iterate",
"over",
"the",
"4",
"rows",
"and",
"call",
"shiftRow",
"()",
"with",
"that",
"row"
] | train | https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Security/SlowAES/AES.php#L349-L353 |
Double-Opt-in/php-client-api | src/Security/SlowAES/AES.php | AES.shiftRow | private static function shiftRow($state,$statePointer,$nbr,$isInv){
for ($i = 0; $i < $nbr; $i++)
{
if($isInv)
{
$tmp = $state[$statePointer + 3];
for ($j = 3; $j > 0; $j--)
$state[$statePointer + $j] = $state[$statePointer + $j-1];
$state[$statePointer] = $tmp;
}
else
{
$tmp = $... | php | private static function shiftRow($state,$statePointer,$nbr,$isInv){
for ($i = 0; $i < $nbr; $i++)
{
if($isInv)
{
$tmp = $state[$statePointer + 3];
for ($j = 3; $j > 0; $j--)
$state[$statePointer + $j] = $state[$statePointer + $j-1];
$state[$statePointer] = $tmp;
}
else
{
$tmp = $... | [
"private",
"static",
"function",
"shiftRow",
"(",
"$",
"state",
",",
"$",
"statePointer",
",",
"$",
"nbr",
",",
"$",
"isInv",
")",
"{",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"nbr",
";",
"$",
"i",
"++",
")",
"{",
"if",
"(",
... | /* each iteration shifts the row to the left by 1 | [
"/",
"*",
"each",
"iteration",
"shifts",
"the",
"row",
"to",
"the",
"left",
"by",
"1"
] | train | https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Security/SlowAES/AES.php#L356-L375 |
Double-Opt-in/php-client-api | src/Security/SlowAES/AES.php | AES.mixColumns | private static function mixColumns($state,$isInv){
$t = array();
if (!$isInv) {
for ($c = 0; $c < 4; $c++) {
$t[ $c] = self::$G2X[$state[$c]] ^ self::$G3X[$state[4+$c]] ^ $state[8+$c] ^ $state[12+$c];
$t[ 4+$c] = $state[$c] ^ self::$G2X[$state[4+$c]] ^ self::$G3X[$st... | php | private static function mixColumns($state,$isInv){
$t = array();
if (!$isInv) {
for ($c = 0; $c < 4; $c++) {
$t[ $c] = self::$G2X[$state[$c]] ^ self::$G3X[$state[4+$c]] ^ $state[8+$c] ^ $state[12+$c];
$t[ 4+$c] = $state[$c] ^ self::$G2X[$state[4+$c]] ^ self::$G3X[$st... | [
"private",
"static",
"function",
"mixColumns",
"(",
"$",
"state",
",",
"$",
"isInv",
")",
"{",
"$",
"t",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"$",
"isInv",
")",
"{",
"for",
"(",
"$",
"c",
"=",
"0",
";",
"$",
"c",
"<",
"4",
";",
"$",... | galois multipication of the 4x4 matrix | [
"galois",
"multipication",
"of",
"the",
"4x4",
"matrix"
] | train | https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Security/SlowAES/AES.php#L378-L398 |
Double-Opt-in/php-client-api | src/Security/SlowAES/AES.php | AES.round | private static function round($state, $roundKey){
$state = self::subBytes($state,false);
$state = self::shiftRows($state,false);
$state = self::mixColumns($state,false);
$state = self::addRoundKey($state, $roundKey);
return $state;
} | php | private static function round($state, $roundKey){
$state = self::subBytes($state,false);
$state = self::shiftRows($state,false);
$state = self::mixColumns($state,false);
$state = self::addRoundKey($state, $roundKey);
return $state;
} | [
"private",
"static",
"function",
"round",
"(",
"$",
"state",
",",
"$",
"roundKey",
")",
"{",
"$",
"state",
"=",
"self",
"::",
"subBytes",
"(",
"$",
"state",
",",
"false",
")",
";",
"$",
"state",
"=",
"self",
"::",
"shiftRows",
"(",
"$",
"state",
",... | applies the 4 operations of the forward round in sequence | [
"applies",
"the",
"4",
"operations",
"of",
"the",
"forward",
"round",
"in",
"sequence"
] | train | https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Security/SlowAES/AES.php#L401-L407 |
Double-Opt-in/php-client-api | src/Security/SlowAES/AES.php | AES.invRound | private static function invRound($state,$roundKey){
$state = self::shiftRows($state,true);
$state = self::subBytes($state,true);
$state = self::addRoundKey($state, $roundKey);
$state = self::mixColumns($state,true);
return $state;
} | php | private static function invRound($state,$roundKey){
$state = self::shiftRows($state,true);
$state = self::subBytes($state,true);
$state = self::addRoundKey($state, $roundKey);
$state = self::mixColumns($state,true);
return $state;
} | [
"private",
"static",
"function",
"invRound",
"(",
"$",
"state",
",",
"$",
"roundKey",
")",
"{",
"$",
"state",
"=",
"self",
"::",
"shiftRows",
"(",
"$",
"state",
",",
"true",
")",
";",
"$",
"state",
"=",
"self",
"::",
"subBytes",
"(",
"$",
"state",
... | applies the 4 operations of the inverse round in sequence | [
"applies",
"the",
"4",
"operations",
"of",
"the",
"inverse",
"round",
"in",
"sequence"
] | train | https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Security/SlowAES/AES.php#L410-L416 |
Double-Opt-in/php-client-api | src/Security/SlowAES/AES.php | AES.main | private static function main($state,$expandedKey,$nbrRounds){
$state = self::addRoundKey($state, self::createRoundKey($expandedKey,0));
for ($i = 1; $i < $nbrRounds; $i++)
$state = self::round($state, self::createRoundKey($expandedKey,16*$i));
$state = self::subBytes($state,false);
$state = self::shiftRows($... | php | private static function main($state,$expandedKey,$nbrRounds){
$state = self::addRoundKey($state, self::createRoundKey($expandedKey,0));
for ($i = 1; $i < $nbrRounds; $i++)
$state = self::round($state, self::createRoundKey($expandedKey,16*$i));
$state = self::subBytes($state,false);
$state = self::shiftRows($... | [
"private",
"static",
"function",
"main",
"(",
"$",
"state",
",",
"$",
"expandedKey",
",",
"$",
"nbrRounds",
")",
"{",
"$",
"state",
"=",
"self",
"::",
"addRoundKey",
"(",
"$",
"state",
",",
"self",
"::",
"createRoundKey",
"(",
"$",
"expandedKey",
",",
... | /*
Perform the initial operations, the standard round, and the final operations
of the forward aes, creating a round key for each round | [
"/",
"*",
"Perform",
"the",
"initial",
"operations",
"the",
"standard",
"round",
"and",
"the",
"final",
"operations",
"of",
"the",
"forward",
"aes",
"creating",
"a",
"round",
"key",
"for",
"each",
"round"
] | train | https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Security/SlowAES/AES.php#L422-L430 |
Double-Opt-in/php-client-api | src/Security/SlowAES/AES.php | AES.invMain | private static function invMain($state, $expandedKey, $nbrRounds){
$state = self::addRoundKey($state, self::createRoundKey($expandedKey,16*$nbrRounds));
for ($i = $nbrRounds-1; $i > 0; $i--)
$state = self::invRound($state, self::createRoundKey($expandedKey,16*i));
$state = self::shiftRows($state,true);
$stat... | php | private static function invMain($state, $expandedKey, $nbrRounds){
$state = self::addRoundKey($state, self::createRoundKey($expandedKey,16*$nbrRounds));
for ($i = $nbrRounds-1; $i > 0; $i--)
$state = self::invRound($state, self::createRoundKey($expandedKey,16*i));
$state = self::shiftRows($state,true);
$stat... | [
"private",
"static",
"function",
"invMain",
"(",
"$",
"state",
",",
"$",
"expandedKey",
",",
"$",
"nbrRounds",
")",
"{",
"$",
"state",
"=",
"self",
"::",
"addRoundKey",
"(",
"$",
"state",
",",
"self",
"::",
"createRoundKey",
"(",
"$",
"expandedKey",
",",... | /*
Perform the initial operations, the standard round, and the final operations
of the inverse aes, creating a round key for each round | [
"/",
"*",
"Perform",
"the",
"initial",
"operations",
"the",
"standard",
"round",
"and",
"the",
"final",
"operations",
"of",
"the",
"inverse",
"aes",
"creating",
"a",
"round",
"key",
"for",
"each",
"round"
] | train | https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Security/SlowAES/AES.php#L436-L444 |
Double-Opt-in/php-client-api | src/Security/SlowAES/AES.php | AES.encryptBlock | private static function encryptBlock($input,$key,$size){
$output = array();
$block = array(); /* the 128 bit block to encode */
$nbrRounds = self::numberOfRounds($size);
/* Set the block values, for the block:
* a0,0 a0,1 a0,2 a0,3
* a1,0 a1,1 a1,2 a1,3
* a2,0 a2,1 a2,2 a2,3
* a3,0 a3,1 a3,2 a3,3
... | php | private static function encryptBlock($input,$key,$size){
$output = array();
$block = array(); /* the 128 bit block to encode */
$nbrRounds = self::numberOfRounds($size);
/* Set the block values, for the block:
* a0,0 a0,1 a0,2 a0,3
* a1,0 a1,1 a1,2 a1,3
* a2,0 a2,1 a2,2 a2,3
* a3,0 a3,1 a3,2 a3,3
... | [
"private",
"static",
"function",
"encryptBlock",
"(",
"$",
"input",
",",
"$",
"key",
",",
"$",
"size",
")",
"{",
"$",
"output",
"=",
"array",
"(",
")",
";",
"$",
"block",
"=",
"array",
"(",
")",
";",
"/* the 128 bit block to encode */",
"$",
"nbrRounds",... | encrypts a 128 bit input block against the given key of size specified | [
"encrypts",
"a",
"128",
"bit",
"input",
"block",
"against",
"the",
"given",
"key",
"of",
"size",
"specified"
] | train | https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Security/SlowAES/AES.php#L467-L490 |
Double-Opt-in/php-client-api | src/Security/SlowAES/AES.php | AES.decryptBlock | private static function decryptBlock($input, $key, $size){
$output = array();
$block = array(); /* the 128 bit block to decode */
$nbrRounds = self::numberOfRounds($size);
/* Set the block values, for the block:
* a0,0 a0,1 a0,2 a0,3
* a1,0 a1,1 a1,2 a1,3
* a2,0 a2,1 a2,2 a2,3
* a3,0 a3,1 a3,2 a3,3
... | php | private static function decryptBlock($input, $key, $size){
$output = array();
$block = array(); /* the 128 bit block to decode */
$nbrRounds = self::numberOfRounds($size);
/* Set the block values, for the block:
* a0,0 a0,1 a0,2 a0,3
* a1,0 a1,1 a1,2 a1,3
* a2,0 a2,1 a2,2 a2,3
* a3,0 a3,1 a3,2 a3,3
... | [
"private",
"static",
"function",
"decryptBlock",
"(",
"$",
"input",
",",
"$",
"key",
",",
"$",
"size",
")",
"{",
"$",
"output",
"=",
"array",
"(",
")",
";",
"$",
"block",
"=",
"array",
"(",
")",
";",
"/* the 128 bit block to decode */",
"$",
"nbrRounds",... | decrypts a 128 bit input block against the given key of size specified | [
"decrypts",
"a",
"128",
"bit",
"input",
"block",
"against",
"the",
"given",
"key",
"of",
"size",
"specified"
] | train | https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Security/SlowAES/AES.php#L493-L515 |
Double-Opt-in/php-client-api | src/Security/SlowAES/AES.php | AES.getPaddedBlock | private static function getPaddedBlock($bytesIn,$start,$end,$mode){
if($end - $start > 16)
$end = $start + 16;
$xarray = array_slice($bytesIn, $start, $end-$start);
$cpad = 16 - count($xarray);
while(count($xarray) < 16){
array_push($xarray, $cpad);
}
return $xarray;
} | php | private static function getPaddedBlock($bytesIn,$start,$end,$mode){
if($end - $start > 16)
$end = $start + 16;
$xarray = array_slice($bytesIn, $start, $end-$start);
$cpad = 16 - count($xarray);
while(count($xarray) < 16){
array_push($xarray, $cpad);
}
return $xarray;
} | [
"private",
"static",
"function",
"getPaddedBlock",
"(",
"$",
"bytesIn",
",",
"$",
"start",
",",
"$",
"end",
",",
"$",
"mode",
")",
"{",
"if",
"(",
"$",
"end",
"-",
"$",
"start",
">",
"16",
")",
"$",
"end",
"=",
"$",
"start",
"+",
"16",
";",
"$"... | gets a properly padded block | [
"gets",
"a",
"properly",
"padded",
"block"
] | train | https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Security/SlowAES/AES.php#L529-L542 |
Double-Opt-in/php-client-api | src/Security/SlowAES/AES.php | AES.encrypt | public static function encrypt($bytesIn, $mode, $key, $size, $iv){
if(count($key)%$size)
{
throw new Exception('Key length does not match specified size.');
}
if(count($iv)%16)
{
throw new Exception('iv length must be 128 bits.');
}
// the AES input/output
$byteArray = array();
$input = array();... | php | public static function encrypt($bytesIn, $mode, $key, $size, $iv){
if(count($key)%$size)
{
throw new Exception('Key length does not match specified size.');
}
if(count($iv)%16)
{
throw new Exception('iv length must be 128 bits.');
}
// the AES input/output
$byteArray = array();
$input = array();... | [
"public",
"static",
"function",
"encrypt",
"(",
"$",
"bytesIn",
",",
"$",
"mode",
",",
"$",
"key",
",",
"$",
"size",
",",
"$",
"iv",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"key",
")",
"%",
"$",
"size",
")",
"{",
"throw",
"new",
"Exception",
"(... | /*
Mode of Operation Encryption
bytesIn - Input String as array of bytes
mode - mode of type modeOfOperation
key - a number array of length 'size'
size - the bit length of the key
iv - the 128 bit number array Initialization Vector | [
"/",
"*",
"Mode",
"of",
"Operation",
"Encryption",
"bytesIn",
"-",
"Input",
"String",
"as",
"array",
"of",
"bytes",
"mode",
"-",
"mode",
"of",
"type",
"modeOfOperation",
"key",
"-",
"a",
"number",
"array",
"of",
"length",
"size",
"size",
"-",
"the",
"bit... | train | https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Security/SlowAES/AES.php#L552-L621 |
Double-Opt-in/php-client-api | src/Security/SlowAES/AES.php | AES.decrypt | public static function decrypt($cipherIn,$originalsize,$mode,$key,$size,$iv)
{
if(count($key)%$size)
{
throw new Exception('Key length does not match specified size.');
return null;
}
if(count($iv)%16)
{
throw new Exception('iv length must be 128 bits.');
}
// the AES input/output
$ciphertext ... | php | public static function decrypt($cipherIn,$originalsize,$mode,$key,$size,$iv)
{
if(count($key)%$size)
{
throw new Exception('Key length does not match specified size.');
return null;
}
if(count($iv)%16)
{
throw new Exception('iv length must be 128 bits.');
}
// the AES input/output
$ciphertext ... | [
"public",
"static",
"function",
"decrypt",
"(",
"$",
"cipherIn",
",",
"$",
"originalsize",
",",
"$",
"mode",
",",
"$",
"key",
",",
"$",
"size",
",",
"$",
"iv",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"key",
")",
"%",
"$",
"size",
")",
"{",
"thr... | /*
Mode of Operation Decryption
cipherIn - Encrypted String as array of bytes
originalsize - The unencrypted string length - required for CBC
mode - mode of type modeOfOperation
key - a number array of length 'size'
size - the bit length of the key
iv - the 128 bit number array Initialization Vector | [
"/",
"*",
"Mode",
"of",
"Operation",
"Decryption",
"cipherIn",
"-",
"Encrypted",
"String",
"as",
"array",
"of",
"bytes",
"originalsize",
"-",
"The",
"unencrypted",
"string",
"length",
"-",
"required",
"for",
"CBC",
"mode",
"-",
"mode",
"of",
"type",
"modeOfO... | train | https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Security/SlowAES/AES.php#L632-L707 |
okitcom/ok-lib-php | src/Service/Cash.php | Cash.refund | public function refund($guid, Amount $refundAmount) {
return new Transaction(
$this->client->post('transactions/' . $guid . '/refunds', ["amount" => $refundAmount])
);
} | php | public function refund($guid, Amount $refundAmount) {
return new Transaction(
$this->client->post('transactions/' . $guid . '/refunds', ["amount" => $refundAmount])
);
} | [
"public",
"function",
"refund",
"(",
"$",
"guid",
",",
"Amount",
"$",
"refundAmount",
")",
"{",
"return",
"new",
"Transaction",
"(",
"$",
"this",
"->",
"client",
"->",
"post",
"(",
"'transactions/'",
".",
"$",
"guid",
".",
"'/refunds'",
",",
"[",
"\"amou... | Refunds a previously initiated and closed and captured transaction.
@param $guid string identifier of transaction
@param $refundAmount Amount amount to refund in cents
@return string
@throws NetworkException | [
"Refunds",
"a",
"previously",
"initiated",
"and",
"closed",
"and",
"captured",
"transaction",
"."
] | train | https://github.com/okitcom/ok-lib-php/blob/1f441f3d216af7c952788e864bfe66bc4f089467/src/Service/Cash.php#L101-L105 |
ClanCats/Core | src/bundles/Database/Model/Relation/HasOne.php | Model_Relation_HasOne.prepare_query | protected function prepare_query()
{
$this->query->where( $this->foreign_key, $this->local_model->{$this->local_key} )
->limit( 1 );
} | php | protected function prepare_query()
{
$this->query->where( $this->foreign_key, $this->local_model->{$this->local_key} )
->limit( 1 );
} | [
"protected",
"function",
"prepare_query",
"(",
")",
"{",
"$",
"this",
"->",
"query",
"->",
"where",
"(",
"$",
"this",
"->",
"foreign_key",
",",
"$",
"this",
"->",
"local_model",
"->",
"{",
"$",
"this",
"->",
"local_key",
"}",
")",
"->",
"limit",
"(",
... | Prepare the query object
@return void | [
"Prepare",
"the",
"query",
"object"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Model/Relation/HasOne.php#L19-L23 |
alanpich/slender | core-modules/event-manager/src/EventManager.php | EventManager.hook | public function hook($event, callable $callback, $priority = 10)
{
$this->app->hook($event, $callback, $priority);
} | php | public function hook($event, callable $callback, $priority = 10)
{
$this->app->hook($event, $callback, $priority);
} | [
"public",
"function",
"hook",
"(",
"$",
"event",
",",
"callable",
"$",
"callback",
",",
"$",
"priority",
"=",
"10",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"hook",
"(",
"$",
"event",
",",
"$",
"callback",
",",
"$",
"priority",
")",
";",
"}"
] | Hook an event
@param string $event Event/Hook name
@param callable $callback Event handler
@param int $priority 0 = high, 10 = low | [
"Hook",
"an",
"event"
] | train | https://github.com/alanpich/slender/blob/247f5c08af20cda95b116eb5d9f6f623d61e8a8a/core-modules/event-manager/src/EventManager.php#L65-L68 |
alanpich/slender | core-modules/event-manager/src/EventManager.php | EventManager.applyChain | public function applyChain($name, $hookArg = null)
{
$hooks = $this->app->getHooks();
if (!isset($hooks[$name])) {
$hooks[$name] = array(array());
}
if (!empty($hooks[$name])) {
// Sort by priority, low to high, if there's more than one priority
i... | php | public function applyChain($name, $hookArg = null)
{
$hooks = $this->app->getHooks();
if (!isset($hooks[$name])) {
$hooks[$name] = array(array());
}
if (!empty($hooks[$name])) {
// Sort by priority, low to high, if there's more than one priority
i... | [
"public",
"function",
"applyChain",
"(",
"$",
"name",
",",
"$",
"hookArg",
"=",
"null",
")",
"{",
"$",
"hooks",
"=",
"$",
"this",
"->",
"app",
"->",
"getHooks",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"hooks",
"[",
"$",
"name",
"]",
"... | Trigger a chained hook
- The first callback to return a non-null value
will be returned
@param string $name the hook name
@param mixed $hookArg (Optional) Argument for hooked functions
@return mixed|void | [
"Trigger",
"a",
"chained",
"hook",
"-",
"The",
"first",
"callback",
"to",
"return",
"a",
"non",
"-",
"null",
"value",
"will",
"be",
"returned"
] | train | https://github.com/alanpich/slender/blob/247f5c08af20cda95b116eb5d9f6f623d61e8a8a/core-modules/event-manager/src/EventManager.php#L104-L127 |
yuncms/framework | src/console/controllers/OAuth2Controller.php | OAuth2Controller.actionClear | public function actionClear()
{
OAuth2AuthorizationCode::deleteAll(['<', 'expires', time()]);
OAuth2RefreshToken::deleteAll(['<', 'expires', time()]);
OAuth2AccessToken::deleteAll(['<', 'expires', time()]);
} | php | public function actionClear()
{
OAuth2AuthorizationCode::deleteAll(['<', 'expires', time()]);
OAuth2RefreshToken::deleteAll(['<', 'expires', time()]);
OAuth2AccessToken::deleteAll(['<', 'expires', time()]);
} | [
"public",
"function",
"actionClear",
"(",
")",
"{",
"OAuth2AuthorizationCode",
"::",
"deleteAll",
"(",
"[",
"'<'",
",",
"'expires'",
",",
"time",
"(",
")",
"]",
")",
";",
"OAuth2RefreshToken",
"::",
"deleteAll",
"(",
"[",
"'<'",
",",
"'expires'",
",",
"tim... | Clean up expired token | [
"Clean",
"up",
"expired",
"token"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/console/controllers/OAuth2Controller.php#L23-L28 |
sparwelt/imgix-lib | src/Components/AttributeGenerator.php | AttributeGenerator.generateAttributeValue | public function generateAttributeValue($sourceImageUrl, $filters = [])
{
// ['1x' => ['w' => 123, 'h' => 200], '2x' = > [..]]
if (Utils::isMatrix($filters)) {
$srcset = [];
foreach ($filters as $format => $formatFilters) {
$srcset[] = sprintf(
... | php | public function generateAttributeValue($sourceImageUrl, $filters = [])
{
// ['1x' => ['w' => 123, 'h' => 200], '2x' = > [..]]
if (Utils::isMatrix($filters)) {
$srcset = [];
foreach ($filters as $format => $formatFilters) {
$srcset[] = sprintf(
... | [
"public",
"function",
"generateAttributeValue",
"(",
"$",
"sourceImageUrl",
",",
"$",
"filters",
"=",
"[",
"]",
")",
"{",
"// ['1x' => ['w' => 123, 'h' => 200], '2x' = > [..]]",
"if",
"(",
"Utils",
"::",
"isMatrix",
"(",
"$",
"filters",
")",
")",
"{",
"$",
"srcs... | @param string $sourceImageUrl
@param array|string $filters
@return string | [
"@param",
"string",
"$sourceImageUrl",
"@param",
"array|string",
"$filters"
] | train | https://github.com/sparwelt/imgix-lib/blob/330e1db2bed71bc283e5a2da6246528f240939ec/src/Components/AttributeGenerator.php#L35-L62 |
ClanCats/Core | src/classes/CCShipyard/Dbmodel.php | CCShipyard_Dbmodel.output | public function output()
{
$shema = \DB::fetch( "DESCRIBE {$this->table};", array(), null, 'assoc' );
if ( empty( $shema ) )
{
throw new CCException( 'CCShipyard - The given database table is invalid or does not exist.' );
}
$class = \CCShipyard::create( 'class', $this->name, "\\DB\\Model" );
... | php | public function output()
{
$shema = \DB::fetch( "DESCRIBE {$this->table};", array(), null, 'assoc' );
if ( empty( $shema ) )
{
throw new CCException( 'CCShipyard - The given database table is invalid or does not exist.' );
}
$class = \CCShipyard::create( 'class', $this->name, "\\DB\\Model" );
... | [
"public",
"function",
"output",
"(",
")",
"{",
"$",
"shema",
"=",
"\\",
"DB",
"::",
"fetch",
"(",
"\"DESCRIBE {$this->table};\"",
",",
"array",
"(",
")",
",",
"null",
",",
"'assoc'",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"shema",
")",
")",
"{",
"... | Get the current builder output
@return string | [
"Get",
"the",
"current",
"builder",
"output"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCShipyard/Dbmodel.php#L50-L139 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.