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 |
|---|---|---|---|---|---|---|---|---|---|---|
xiewulong/yii2-fileupload | Manager.php | Manager.getName | private function getName() {
if($this->name === false) {
$this->name = $this->pre . $this->getTime() . '_' . md5(mt_rand()) . $this->suf . '.' . $this->ext;
}
return $this->name;
} | php | private function getName() {
if($this->name === false) {
$this->name = $this->pre . $this->getTime() . '_' . md5(mt_rand()) . $this->suf . '.' . $this->ext;
}
return $this->name;
} | [
"private",
"function",
"getName",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"name",
"===",
"false",
")",
"{",
"$",
"this",
"->",
"name",
"=",
"$",
"this",
"->",
"pre",
".",
"$",
"this",
"->",
"getTime",
"(",
")",
".",
"'_'",
".",
"md5",
"(",... | 生成文件名
@method getName
@since 0.0.1
@return {string} | [
"生成文件名"
] | train | https://github.com/xiewulong/yii2-fileupload/blob/3e75b17a4a18dd8466e3f57c63136de03470ca82/Manager.php#L196-L201 |
xiewulong/yii2-fileupload | Manager.php | Manager.getPath | private function getPath() {
if($this->path === false) {
$this->path = $this->timepath ? date('Y/m/d', $this->getTime()) : '';
}
return $this->path;
} | php | private function getPath() {
if($this->path === false) {
$this->path = $this->timepath ? date('Y/m/d', $this->getTime()) : '';
}
return $this->path;
} | [
"private",
"function",
"getPath",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"path",
"===",
"false",
")",
"{",
"$",
"this",
"->",
"path",
"=",
"$",
"this",
"->",
"timepath",
"?",
"date",
"(",
"'Y/m/d'",
",",
"$",
"this",
"->",
"getTime",
"(",
"... | 获取存放路径
@method getPath
@since 0.0.1
@return {string} | [
"获取存放路径"
] | train | https://github.com/xiewulong/yii2-fileupload/blob/3e75b17a4a18dd8466e3f57c63136de03470ca82/Manager.php#L209-L215 |
rhosocial/yii2-user | models/UserUsernameTrait.php | UserUsernameTrait.hasEnabledUsername | public function hasEnabledUsername()
{
if ($this->usernameClass === false || !is_string($this->usernameClass) || !class_exists($this->usernameClass)) {
return false;
}
return true;
} | php | public function hasEnabledUsername()
{
if ($this->usernameClass === false || !is_string($this->usernameClass) || !class_exists($this->usernameClass)) {
return false;
}
return true;
} | [
"public",
"function",
"hasEnabledUsername",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"usernameClass",
"===",
"false",
"||",
"!",
"is_string",
"(",
"$",
"this",
"->",
"usernameClass",
")",
"||",
"!",
"class_exists",
"(",
"$",
"this",
"->",
"usernameClas... | Check whether this user enables the username feature or not.
@return boolean | [
"Check",
"whether",
"this",
"user",
"enables",
"the",
"username",
"feature",
"or",
"not",
"."
] | train | https://github.com/rhosocial/yii2-user/blob/96737a9d8ca7e9c42cd2b7736d6c0a90ede6e5bc/models/UserUsernameTrait.php#L33-L39 |
rhosocial/yii2-user | models/UserUsernameTrait.php | UserUsernameTrait.getUsername | public function getUsername()
{
if (!$this->hasEnabledUsername()) {
return null;
}
$usernameClass = $this->usernameClass;
$noInit = $usernameClass::buildNoInitModel();
/* @var $noInit Username */
return $this->hasOne($usernameClass, [$noInit->createdByAttr... | php | public function getUsername()
{
if (!$this->hasEnabledUsername()) {
return null;
}
$usernameClass = $this->usernameClass;
$noInit = $usernameClass::buildNoInitModel();
/* @var $noInit Username */
return $this->hasOne($usernameClass, [$noInit->createdByAttr... | [
"public",
"function",
"getUsername",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasEnabledUsername",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"usernameClass",
"=",
"$",
"this",
"->",
"usernameClass",
";",
"$",
"noInit",
"=",
"$",
... | Get username.
This method may return null, please consider processing the abnormal conditions.
@return BaseBlameableQuery | [
"Get",
"username",
".",
"This",
"method",
"may",
"return",
"null",
"please",
"consider",
"processing",
"the",
"abnormal",
"conditions",
"."
] | train | https://github.com/rhosocial/yii2-user/blob/96737a9d8ca7e9c42cd2b7736d6c0a90ede6e5bc/models/UserUsernameTrait.php#L46-L55 |
rhosocial/yii2-user | models/UserUsernameTrait.php | UserUsernameTrait.createUsername | public function createUsername($username)
{
if (!$this->hasEnabledUsername()) {
return null;
}
$usernameClass = $this->usernameClass;
$model = $usernameClass::findOne($this->getGUID());
if (!$model) {
$model = $this->create($usernameClass);
... | php | public function createUsername($username)
{
if (!$this->hasEnabledUsername()) {
return null;
}
$usernameClass = $this->usernameClass;
$model = $usernameClass::findOne($this->getGUID());
if (!$model) {
$model = $this->create($usernameClass);
... | [
"public",
"function",
"createUsername",
"(",
"$",
"username",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasEnabledUsername",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"usernameClass",
"=",
"$",
"this",
"->",
"usernameClass",
";",
"$",
"m... | Create or get username.
@param $username
@return null|Username | [
"Create",
"or",
"get",
"username",
"."
] | train | https://github.com/rhosocial/yii2-user/blob/96737a9d8ca7e9c42cd2b7736d6c0a90ede6e5bc/models/UserUsernameTrait.php#L62-L75 |
rhosocial/yii2-user | models/UserUsernameTrait.php | UserUsernameTrait.setUsername | public function setUsername($username = null)
{
if ($username === null && ($model = $this->getUsername()->one())) {
return $model->delete() > 0;
}
if ($username instanceof Username) {
$username = $username->content;
}
$model = $this->createUsername($us... | php | public function setUsername($username = null)
{
if ($username === null && ($model = $this->getUsername()->one())) {
return $model->delete() > 0;
}
if ($username instanceof Username) {
$username = $username->content;
}
$model = $this->createUsername($us... | [
"public",
"function",
"setUsername",
"(",
"$",
"username",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"username",
"===",
"null",
"&&",
"(",
"$",
"model",
"=",
"$",
"this",
"->",
"getUsername",
"(",
")",
"->",
"one",
"(",
")",
")",
")",
"{",
"return",
... | Set username.
@param string|Username $username
@return bool | [
"Set",
"username",
"."
] | train | https://github.com/rhosocial/yii2-user/blob/96737a9d8ca7e9c42cd2b7736d6c0a90ede6e5bc/models/UserUsernameTrait.php#L82-L92 |
Opifer/EavBundle | Form/Type/ValueProviderType.php | ValueProviderType.configureOptions | public function configureOptions(OptionsResolver $resolver)
{
$choices = [];
foreach ($this->providerPool->getValues() as $alias => $value) {
$choices[$alias] = $value->getLabel();
}
$resolver->setDefaults([
'label' => 'Type of value',
'choices... | php | public function configureOptions(OptionsResolver $resolver)
{
$choices = [];
foreach ($this->providerPool->getValues() as $alias => $value) {
$choices[$alias] = $value->getLabel();
}
$resolver->setDefaults([
'label' => 'Type of value',
'choices... | [
"public",
"function",
"configureOptions",
"(",
"OptionsResolver",
"$",
"resolver",
")",
"{",
"$",
"choices",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"providerPool",
"->",
"getValues",
"(",
")",
"as",
"$",
"alias",
"=>",
"$",
"value",
")",
... | {@inheritDoc} | [
"{"
] | train | https://github.com/Opifer/EavBundle/blob/4236fdc28b7574dac43f420704d0fc3c04905a4c/Form/Type/ValueProviderType.php#L33-L44 |
42mate/towel | src/Towel/Controller/User.php | User.profileShow | public function profileShow()
{
if (!$this->isAuthenticated()) {
return $this->redirect('/login');
}
$userModel = $this->session()->get('user');
return $this->twig()->render('User\profile.twig', array('user' => $userModel));
} | php | public function profileShow()
{
if (!$this->isAuthenticated()) {
return $this->redirect('/login');
}
$userModel = $this->session()->get('user');
return $this->twig()->render('User\profile.twig', array('user' => $userModel));
} | [
"public",
"function",
"profileShow",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isAuthenticated",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"redirect",
"(",
"'/login'",
")",
";",
"}",
"$",
"userModel",
"=",
"$",
"this",
"->",
"session"... | Shows the profile page.
@return string|\Symfony\Component\HttpFoundation\RedirectResponse | [
"Shows",
"the",
"profile",
"page",
"."
] | train | https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/Controller/User.php#L14-L22 |
42mate/towel | src/Towel/Controller/User.php | User.loginShow | public function loginShow()
{
if ($this->isAuthenticated()) {
$this->setMessage('warning', 'you are already logged in');
return $this->redirect('/');
}
return $this->twig()->render('user\login.twig');
} | php | public function loginShow()
{
if ($this->isAuthenticated()) {
$this->setMessage('warning', 'you are already logged in');
return $this->redirect('/');
}
return $this->twig()->render('user\login.twig');
} | [
"public",
"function",
"loginShow",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isAuthenticated",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setMessage",
"(",
"'warning'",
",",
"'you are already logged in'",
")",
";",
"return",
"$",
"this",
"->",
"redirect",... | Shows the login form.
@return string|\Symfony\Component\HttpFoundation\RedirectResponse | [
"Shows",
"the",
"login",
"form",
"."
] | train | https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/Controller/User.php#L29-L37 |
42mate/towel | src/Towel/Controller/User.php | User.loginAction | public function loginAction($request)
{
$data = $request->get('data');
$userModel = new ModelUser();
$validUser = $userModel->validateLogin($data['email'], $data['password']);
if (!$validUser) {
$this->setMessage('danger', 'Not valid user / password combination');
... | php | public function loginAction($request)
{
$data = $request->get('data');
$userModel = new ModelUser();
$validUser = $userModel->validateLogin($data['email'], $data['password']);
if (!$validUser) {
$this->setMessage('danger', 'Not valid user / password combination');
... | [
"public",
"function",
"loginAction",
"(",
"$",
"request",
")",
"{",
"$",
"data",
"=",
"$",
"request",
"->",
"get",
"(",
"'data'",
")",
";",
"$",
"userModel",
"=",
"new",
"ModelUser",
"(",
")",
";",
"$",
"validUser",
"=",
"$",
"userModel",
"->",
"vali... | Handles the login action.
@param $request
@return \Symfony\Component\HttpFoundation\RedirectResponse | [
"Handles",
"the",
"login",
"action",
"."
] | train | https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/Controller/User.php#L46-L60 |
42mate/towel | src/Towel/Controller/User.php | User.logoutAction | public function logoutAction()
{
if ($this->isAuthenticated()) {
$this->session()->set('user', null);
}
$this->setMessage('success', 'Bye Bye !');
return $this->redirect('/');
} | php | public function logoutAction()
{
if ($this->isAuthenticated()) {
$this->session()->set('user', null);
}
$this->setMessage('success', 'Bye Bye !');
return $this->redirect('/');
} | [
"public",
"function",
"logoutAction",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isAuthenticated",
"(",
")",
")",
"{",
"$",
"this",
"->",
"session",
"(",
")",
"->",
"set",
"(",
"'user'",
",",
"null",
")",
";",
"}",
"$",
"this",
"->",
"setMessage... | Handles the logout actions.
@return \Symfony\Component\HttpFoundation\RedirectResponse | [
"Handles",
"the",
"logout",
"actions",
"."
] | train | https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/Controller/User.php#L67-L75 |
42mate/towel | src/Towel/Controller/User.php | User.registerAction | public function registerAction($request)
{
$modelUser = new ModelUser();
$data = $request->get('data');
$error = false;
if ($this->isAuthenticated()) {
$this->setMessage('error', 'You are logged in');
$error = true;
}
if (!filter_var($data['m... | php | public function registerAction($request)
{
$modelUser = new ModelUser();
$data = $request->get('data');
$error = false;
if ($this->isAuthenticated()) {
$this->setMessage('error', 'You are logged in');
$error = true;
}
if (!filter_var($data['m... | [
"public",
"function",
"registerAction",
"(",
"$",
"request",
")",
"{",
"$",
"modelUser",
"=",
"new",
"ModelUser",
"(",
")",
";",
"$",
"data",
"=",
"$",
"request",
"->",
"get",
"(",
"'data'",
")",
";",
"$",
"error",
"=",
"false",
";",
"if",
"(",
"$"... | Shows register form.
@param $request
@return string|\Symfony\Component\HttpFoundation\RedirectResponse | [
"Shows",
"register",
"form",
"."
] | train | https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/Controller/User.php#L94-L150 |
42mate/towel | src/Towel/Controller/User.php | User.recoverAction | public function recoverAction($request)
{
$data = $request->get('data');
$modelUser = new ModelUser;
if ($this->isAuthenticated()) {
$this->setMessage('error', 'Your are already authenticated.');
return $this->redirect('/');
}
if (!filter_var($data['... | php | public function recoverAction($request)
{
$data = $request->get('data');
$modelUser = new ModelUser;
if ($this->isAuthenticated()) {
$this->setMessage('error', 'Your are already authenticated.');
return $this->redirect('/');
}
if (!filter_var($data['... | [
"public",
"function",
"recoverAction",
"(",
"$",
"request",
")",
"{",
"$",
"data",
"=",
"$",
"request",
"->",
"get",
"(",
"'data'",
")",
";",
"$",
"modelUser",
"=",
"new",
"ModelUser",
";",
"if",
"(",
"$",
"this",
"->",
"isAuthenticated",
"(",
")",
"... | Handles the recover action.
@param $request
@return string|\Symfony\Component\HttpFoundation\RedirectResponse | [
"Handles",
"the",
"recover",
"action",
"."
] | train | https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/Controller/User.php#L169-L197 |
buse974/JRpc | src/JRpc/Json/Server/Server.php | Server.handleRequest | protected function handleRequest()
{
try {
$request = $this->getRequest();
if ($request->isParseError() === true) {
throw new ParseErrorException();
}
$this->events->trigger('sendRequest.pre', $this, array('methode' => $request->getMethod()));
... | php | protected function handleRequest()
{
try {
$request = $this->getRequest();
if ($request->isParseError() === true) {
throw new ParseErrorException();
}
$this->events->trigger('sendRequest.pre', $this, array('methode' => $request->getMethod()));
... | [
"protected",
"function",
"handleRequest",
"(",
")",
"{",
"try",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
";",
"if",
"(",
"$",
"request",
"->",
"isParseError",
"(",
")",
"===",
"true",
")",
"{",
"throw",
"new",
"ParseErrorExc... | (non-PHPdoc).
@see \Zend\Json\Server\Server::_handle() | [
"(",
"non",
"-",
"PHPdoc",
")",
"."
] | train | https://github.com/buse974/JRpc/blob/c6100a5984d20a1ea00c43d41d3a022f2878b17f/src/JRpc/Json/Server/Server.php#L76-L98 |
buse974/JRpc | src/JRpc/Json/Server/Server.php | Server._dispatch | public function _dispatch(\Zend\Server\Method\Definition $invocable, array $params)
{
return call_user_func_array(array($this->container->get($invocable->getNameSm()),$invocable->getCallback()->getMethod()), $params);
} | php | public function _dispatch(\Zend\Server\Method\Definition $invocable, array $params)
{
return call_user_func_array(array($this->container->get($invocable->getNameSm()),$invocable->getCallback()->getMethod()), $params);
} | [
"public",
"function",
"_dispatch",
"(",
"\\",
"Zend",
"\\",
"Server",
"\\",
"Method",
"\\",
"Definition",
"$",
"invocable",
",",
"array",
"$",
"params",
")",
"{",
"return",
"call_user_func_array",
"(",
"array",
"(",
"$",
"this",
"->",
"container",
"->",
"g... | (non-PHPdoc).
@see \Zend\Server\AbstractServer::_dispatch() | [
"(",
"non",
"-",
"PHPdoc",
")",
"."
] | train | https://github.com/buse974/JRpc/blob/c6100a5984d20a1ea00c43d41d3a022f2878b17f/src/JRpc/Json/Server/Server.php#L117-L120 |
buse974/JRpc | src/JRpc/Json/Server/Server.php | Server.initializeClass | public function initializeClass()
{
if (!isset($this->options['services']) || !is_array($this->options['services'])) {
return;
}
if ($this->getPersistence() && $this->getCache() !== null && ($definition = $this->getCache()->getItem('jrpc-definition')) !== null && ($servi... | php | public function initializeClass()
{
if (!isset($this->options['services']) || !is_array($this->options['services'])) {
return;
}
if ($this->getPersistence() && $this->getCache() !== null && ($definition = $this->getCache()->getItem('jrpc-definition')) !== null && ($servi... | [
"public",
"function",
"initializeClass",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"options",
"[",
"'services'",
"]",
")",
"||",
"!",
"is_array",
"(",
"$",
"this",
"->",
"options",
"[",
"'services'",
"]",
")",
")",
"{",
"return"... | Initialize all class. | [
"Initialize",
"all",
"class",
"."
] | train | https://github.com/buse974/JRpc/blob/c6100a5984d20a1ea00c43d41d3a022f2878b17f/src/JRpc/Json/Server/Server.php#L125-L146 |
buse974/JRpc | src/JRpc/Json/Server/Server.php | Server.setClass | public function setClass($class, $namespace = '', $argv = null)
{
if (2 < func_num_args()) {
$argv = func_get_args();
$argv = array_slice($argv, 2);
}
$methods = [];
if (is_array($class)) {
$methods = $class['methods'];
$class ... | php | public function setClass($class, $namespace = '', $argv = null)
{
if (2 < func_num_args()) {
$argv = func_get_args();
$argv = array_slice($argv, 2);
}
$methods = [];
if (is_array($class)) {
$methods = $class['methods'];
$class ... | [
"public",
"function",
"setClass",
"(",
"$",
"class",
",",
"$",
"namespace",
"=",
"''",
",",
"$",
"argv",
"=",
"null",
")",
"{",
"if",
"(",
"2",
"<",
"func_num_args",
"(",
")",
")",
"{",
"$",
"argv",
"=",
"func_get_args",
"(",
")",
";",
"$",
"argv... | (non-PHPdoc).
@see \Zend\Json\Server\Server::setClass() | [
"(",
"non",
"-",
"PHPdoc",
")",
"."
] | train | https://github.com/buse974/JRpc/blob/c6100a5984d20a1ea00c43d41d3a022f2878b17f/src/JRpc/Json/Server/Server.php#L195-L224 |
buse974/JRpc | src/JRpc/Json/Server/Server.php | Server._buildSignature | protected function _buildSignature(Reflection\AbstractFunction $reflection, $class = null)
{
$ns = $reflection->getNamespace();
$name = $reflection->getName();
$shortName = $reflection->getDeclaringClass()->getShortName();
$method = empty($ns) ? strtolower($shortName) . '.' . $name :... | php | protected function _buildSignature(Reflection\AbstractFunction $reflection, $class = null)
{
$ns = $reflection->getNamespace();
$name = $reflection->getName();
$shortName = $reflection->getDeclaringClass()->getShortName();
$method = empty($ns) ? strtolower($shortName) . '.' . $name :... | [
"protected",
"function",
"_buildSignature",
"(",
"Reflection",
"\\",
"AbstractFunction",
"$",
"reflection",
",",
"$",
"class",
"=",
"null",
")",
"{",
"$",
"ns",
"=",
"$",
"reflection",
"->",
"getNamespace",
"(",
")",
";",
"$",
"name",
"=",
"$",
"reflection... | (non-PHPdoc).
@see \Zend\Server\AbstractServer::_buildSignature() | [
"(",
"non",
"-",
"PHPdoc",
")",
"."
] | train | https://github.com/buse974/JRpc/blob/c6100a5984d20a1ea00c43d41d3a022f2878b17f/src/JRpc/Json/Server/Server.php#L231-L277 |
buse974/JRpc | src/JRpc/Json/Server/Server.php | Server.getPersistence | public function getPersistence()
{
if (null === $this->persistence) {
$this->persistence = (isset($this->options['persistence']) && $this->options['persistence'] == true);
}
return $this->persistence;
} | php | public function getPersistence()
{
if (null === $this->persistence) {
$this->persistence = (isset($this->options['persistence']) && $this->options['persistence'] == true);
}
return $this->persistence;
} | [
"public",
"function",
"getPersistence",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"persistence",
")",
"{",
"$",
"this",
"->",
"persistence",
"=",
"(",
"isset",
"(",
"$",
"this",
"->",
"options",
"[",
"'persistence'",
"]",
")",
"&&",
... | Check persistance.
@return bool | [
"Check",
"persistance",
"."
] | train | https://github.com/buse974/JRpc/blob/c6100a5984d20a1ea00c43d41d3a022f2878b17f/src/JRpc/Json/Server/Server.php#L296-L303 |
buse974/JRpc | src/JRpc/Json/Server/Server.php | Server.getCache | public function getCache()
{
if (null === $this->cache) {
if (isset($this->options['cache']) && is_string($this->options['cache'])) {
$this->cache = $this->container->get($this->options['cache']);
}
}
return $this->cache;
} | php | public function getCache()
{
if (null === $this->cache) {
if (isset($this->options['cache']) && is_string($this->options['cache'])) {
$this->cache = $this->container->get($this->options['cache']);
}
}
return $this->cache;
} | [
"public",
"function",
"getCache",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"cache",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"options",
"[",
"'cache'",
"]",
")",
"&&",
"is_string",
"(",
"$",
"this",
"->",
"options",
... | Get Storage if define in config.
@return \Zend\Cache\Storage\StorageInterface|null | [
"Get",
"Storage",
"if",
"define",
"in",
"config",
"."
] | train | https://github.com/buse974/JRpc/blob/c6100a5984d20a1ea00c43d41d3a022f2878b17f/src/JRpc/Json/Server/Server.php#L310-L319 |
buse974/JRpc | src/JRpc/Json/Server/Server.php | Server.setEventManager | public function setEventManager(\Zend\EventManager\EventManagerInterface $events)
{
$this->events = $events;
$this->events->setIdentifiers([__CLASS__,get_called_class()]);
return $this;
} | php | public function setEventManager(\Zend\EventManager\EventManagerInterface $events)
{
$this->events = $events;
$this->events->setIdentifiers([__CLASS__,get_called_class()]);
return $this;
} | [
"public",
"function",
"setEventManager",
"(",
"\\",
"Zend",
"\\",
"EventManager",
"\\",
"EventManagerInterface",
"$",
"events",
")",
"{",
"$",
"this",
"->",
"events",
"=",
"$",
"events",
";",
"$",
"this",
"->",
"events",
"->",
"setIdentifiers",
"(",
"[",
"... | Inject an EventManager instance.
@param \Zend\EventManager\EventManagerInterface $eventManager | [
"Inject",
"an",
"EventManager",
"instance",
"."
] | train | https://github.com/buse974/JRpc/blob/c6100a5984d20a1ea00c43d41d3a022f2878b17f/src/JRpc/Json/Server/Server.php#L326-L332 |
rhosocial/yii2-user | User.php | User.getCacheTag | public function getCacheTag()
{
return $this->cacheTagPrefix .
($this->isAttributeChanged($this->idAttribute) ? $this->getOldAttribute($this->idAttribute) : $this->getID());
} | php | public function getCacheTag()
{
return $this->cacheTagPrefix .
($this->isAttributeChanged($this->idAttribute) ? $this->getOldAttribute($this->idAttribute) : $this->getID());
} | [
"public",
"function",
"getCacheTag",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"cacheTagPrefix",
".",
"(",
"$",
"this",
"->",
"isAttributeChanged",
"(",
"$",
"this",
"->",
"idAttribute",
")",
"?",
"$",
"this",
"->",
"getOldAttribute",
"(",
"$",
"this",
... | Get cache tag.
The cache tag ends with the user ID, but after the user ID is modified, the old ID will prevail.
@return string | [
"Get",
"cache",
"tag",
".",
"The",
"cache",
"tag",
"ends",
"with",
"the",
"user",
"ID",
"but",
"after",
"the",
"user",
"ID",
"is",
"modified",
"the",
"old",
"ID",
"will",
"prevail",
"."
] | train | https://github.com/rhosocial/yii2-user/blob/96737a9d8ca7e9c42cd2b7736d6c0a90ede6e5bc/User.php#L199-L203 |
rhosocial/yii2-user | User.php | User.createProfile | public function createProfile($config = [])
{
$profileClass = $this->profileClass;
if (empty($profileClass) || !is_string($this->profileClass)) {
return null;
}
$profile = $profileClass::findOne($this->getGUID());
if (!$profile) {
$profile = $this->cre... | php | public function createProfile($config = [])
{
$profileClass = $this->profileClass;
if (empty($profileClass) || !is_string($this->profileClass)) {
return null;
}
$profile = $profileClass::findOne($this->getGUID());
if (!$profile) {
$profile = $this->cre... | [
"public",
"function",
"createProfile",
"(",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"$",
"profileClass",
"=",
"$",
"this",
"->",
"profileClass",
";",
"if",
"(",
"empty",
"(",
"$",
"profileClass",
")",
"||",
"!",
"is_string",
"(",
"$",
"this",
"->",
"... | Create profile.
If profile of this user exists, it will be returned instead of creating it.
Meanwhile, the $config parameter will be skipped.
@param array $config Profile configuration. Skipped if it exists.
@return Profile | [
"Create",
"profile",
".",
"If",
"profile",
"of",
"this",
"user",
"exists",
"it",
"will",
"be",
"returned",
"instead",
"of",
"creating",
"it",
".",
"Meanwhile",
"the",
"$config",
"parameter",
"will",
"be",
"skipped",
"."
] | train | https://github.com/rhosocial/yii2-user/blob/96737a9d8ca7e9c42cd2b7736d6c0a90ede6e5bc/User.php#L228-L240 |
rhosocial/yii2-user | User.php | User.getProfile | public function getProfile()
{
if (!$this->hasProfile()) {
return null;
}
$profileClass = $this->profileClass;
$profileModel = $profileClass::buildNoInitModel();
return $this->hasOne($profileClass,
[$profileModel->createdByAttribute => $this->guidA... | php | public function getProfile()
{
if (!$this->hasProfile()) {
return null;
}
$profileClass = $this->profileClass;
$profileModel = $profileClass::buildNoInitModel();
return $this->hasOne($profileClass,
[$profileModel->createdByAttribute => $this->guidA... | [
"public",
"function",
"getProfile",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasProfile",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"profileClass",
"=",
"$",
"this",
"->",
"profileClass",
";",
"$",
"profileModel",
"=",
"$",
"prof... | Get Profile query.
If you want to get profile model, please access this method in magic property way,
like following:
```php
$user->profile;
```
@return BaseBlameableQuery | [
"Get",
"Profile",
"query",
".",
"If",
"you",
"want",
"to",
"get",
"profile",
"model",
"please",
"access",
"this",
"method",
"in",
"magic",
"property",
"way",
"like",
"following",
":"
] | train | https://github.com/rhosocial/yii2-user/blob/96737a9d8ca7e9c42cd2b7736d6c0a90ede6e5bc/User.php#L265-L274 |
zicht/z | src/Zicht/Tool/Configuration/ConfigurationLoader.php | ConfigurationLoader.fromEnv | public static function fromEnv($configFilename, Version $version)
{
if (null === $configFilename) {
$configFilename = getenv('ZFILE') ? getenv('ZFILE') : 'z.yml';
}
return new self(
$configFilename,
new PathDefaultFileLocator('ZPATH', array(getcwd(), gete... | php | public static function fromEnv($configFilename, Version $version)
{
if (null === $configFilename) {
$configFilename = getenv('ZFILE') ? getenv('ZFILE') : 'z.yml';
}
return new self(
$configFilename,
new PathDefaultFileLocator('ZPATH', array(getcwd(), gete... | [
"public",
"static",
"function",
"fromEnv",
"(",
"$",
"configFilename",
",",
"Version",
"$",
"version",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"configFilename",
")",
"{",
"$",
"configFilename",
"=",
"getenv",
"(",
"'ZFILE'",
")",
"?",
"getenv",
"(",
"'Z... | Create the configuration loader based the current shell environment variables.
@param string $configFilename
@param Version $version
@return ConfigurationLoader
@codeCoverageIgnore | [
"Create",
"the",
"configuration",
"loader",
"based",
"the",
"current",
"shell",
"environment",
"variables",
"."
] | train | https://github.com/zicht/z/blob/6a1731dad20b018555a96b726a61d4bf8ec8c886/src/Zicht/Tool/Configuration/ConfigurationLoader.php#L29-L46 |
zicht/z | src/Zicht/Tool/Configuration/ConfigurationLoader.php | ConfigurationLoader.processConfiguration | public function processConfiguration()
{
Debug::enterScope('config');
Debug::enterScope('load');
try {
$zfiles = (array)$this->configLocator->locate($this->configFilename, null, false);
} catch (\InvalidArgumentException $e) {
$zfiles = array();
}
... | php | public function processConfiguration()
{
Debug::enterScope('config');
Debug::enterScope('load');
try {
$zfiles = (array)$this->configLocator->locate($this->configFilename, null, false);
} catch (\InvalidArgumentException $e) {
$zfiles = array();
}
... | [
"public",
"function",
"processConfiguration",
"(",
")",
"{",
"Debug",
"::",
"enterScope",
"(",
"'config'",
")",
";",
"Debug",
"::",
"enterScope",
"(",
"'load'",
")",
";",
"try",
"{",
"$",
"zfiles",
"=",
"(",
"array",
")",
"$",
"this",
"->",
"configLocato... | Processes the configuration contents
@return array
@throws \UnexpectedValueException | [
"Processes",
"the",
"configuration",
"contents"
] | train | https://github.com/zicht/z/blob/6a1731dad20b018555a96b726a61d4bf8ec8c886/src/Zicht/Tool/Configuration/ConfigurationLoader.php#L89-L121 |
zicht/z | src/Zicht/Tool/Configuration/ConfigurationLoader.php | ConfigurationLoader.loadPlugin | protected function loadPlugin($name, $file)
{
require_once $file;
$className = sprintf('Zicht\Tool\Plugin\%s\Plugin', ucfirst(basename($name)));
$class = new \ReflectionClass($className);
if (!$class->implementsInterface('Zicht\Tool\PluginInterface')) {
throw new \Une... | php | protected function loadPlugin($name, $file)
{
require_once $file;
$className = sprintf('Zicht\Tool\Plugin\%s\Plugin', ucfirst(basename($name)));
$class = new \ReflectionClass($className);
if (!$class->implementsInterface('Zicht\Tool\PluginInterface')) {
throw new \Une... | [
"protected",
"function",
"loadPlugin",
"(",
"$",
"name",
",",
"$",
"file",
")",
"{",
"require_once",
"$",
"file",
";",
"$",
"className",
"=",
"sprintf",
"(",
"'Zicht\\Tool\\Plugin\\%s\\Plugin'",
",",
"ucfirst",
"(",
"basename",
"(",
"$",
"name",
")",
")",
... | Load the specified plugin instance.
@param string $name
@param string $file
@return void
@throws \UnexpectedValueException | [
"Load",
"the",
"specified",
"plugin",
"instance",
"."
] | train | https://github.com/zicht/z/blob/6a1731dad20b018555a96b726a61d4bf8ec8c886/src/Zicht/Tool/Configuration/ConfigurationLoader.php#L133-L142 |
Erdiko/core | src/Layout.php | Layout.getTemplateFile | public function getTemplateFile($filename, $data)
{
$data['getRegion'] = function($name) {
return $this->getRegion($name);
}; // This is for mustache compatibility
// Push the data into regions and then pass a pointer to this class to the layout
// $this->setRegion... | php | public function getTemplateFile($filename, $data)
{
$data['getRegion'] = function($name) {
return $this->getRegion($name);
}; // This is for mustache compatibility
// Push the data into regions and then pass a pointer to this class to the layout
// $this->setRegion... | [
"public",
"function",
"getTemplateFile",
"(",
"$",
"filename",
",",
"$",
"data",
")",
"{",
"$",
"data",
"[",
"'getRegion'",
"]",
"=",
"function",
"(",
"$",
"name",
")",
"{",
"return",
"$",
"this",
"->",
"getRegion",
"(",
"$",
"name",
")",
";",
"}",
... | Get template file
@param string $filename
@param mixed $data Typically a string, Container object or other object
@return string
@todo array merge regions with data | [
"Get",
"template",
"file"
] | train | https://github.com/Erdiko/core/blob/c7947ee973b0ad2fd05a6d1d8ce45696618c8fa6/src/Layout.php#L73-L82 |
Erdiko/core | src/Layout.php | Layout.getRegion | public function getRegion($name)
{
if(array_key_exists($name, $this->_regions)) {
$html = (is_subclass_of($this->_regions[$name], 'erdiko\core\Container')) ?
$this->_regions[$name]->toHtml() : $this->_regions[$name];
} else {
throw new \Exception("Template reg... | php | public function getRegion($name)
{
if(array_key_exists($name, $this->_regions)) {
$html = (is_subclass_of($this->_regions[$name], 'erdiko\core\Container')) ?
$this->_regions[$name]->toHtml() : $this->_regions[$name];
} else {
throw new \Exception("Template reg... | [
"public",
"function",
"getRegion",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"_regions",
")",
")",
"{",
"$",
"html",
"=",
"(",
"is_subclass_of",
"(",
"$",
"this",
"->",
"_regions",
"[",
"$",
... | get rendered region
@param string $name
@return mixed $content, typically a string, Container object or other object | [
"get",
"rendered",
"region"
] | train | https://github.com/Erdiko/core/blob/c7947ee973b0ad2fd05a6d1d8ce45696618c8fa6/src/Layout.php#L169-L179 |
Erdiko/core | src/Layout.php | Layout.toHtml | public function toHtml()
{
$filename = $this->getTemplateFolder().$this->getTemplate();
// $data = (is_subclass_of($this->_data, 'erdiko\core\Container')) ? $this->_data->toHtml() : $this->_data;
return $this->getTemplateFile($filename, $this->_data);
} | php | public function toHtml()
{
$filename = $this->getTemplateFolder().$this->getTemplate();
// $data = (is_subclass_of($this->_data, 'erdiko\core\Container')) ? $this->_data->toHtml() : $this->_data;
return $this->getTemplateFile($filename, $this->_data);
} | [
"public",
"function",
"toHtml",
"(",
")",
"{",
"$",
"filename",
"=",
"$",
"this",
"->",
"getTemplateFolder",
"(",
")",
".",
"$",
"this",
"->",
"getTemplate",
"(",
")",
";",
"// $data = (is_subclass_of($this->_data, 'erdiko\\core\\Container')) ? $this->_data->toHtml() : ... | Render container to HTML
@return string $html | [
"Render",
"container",
"to",
"HTML"
] | train | https://github.com/Erdiko/core/blob/c7947ee973b0ad2fd05a6d1d8ce45696618c8fa6/src/Layout.php#L186-L192 |
antaresproject/notifications | src/NotificationsServiceProvider.php | NotificationsServiceProvider.register | public function register()
{
$this->bindContracts();
$this->app->singleton('notifications.contents', function () {
return new Contents();
});
$this->commands([
NotificationCategoriesCommand::class,
NotificationSeveritiesCommand::class,
... | php | public function register()
{
$this->bindContracts();
$this->app->singleton('notifications.contents', function () {
return new Contents();
});
$this->commands([
NotificationCategoriesCommand::class,
NotificationSeveritiesCommand::class,
... | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"bindContracts",
"(",
")",
";",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'notifications.contents'",
",",
"function",
"(",
")",
"{",
"return",
"new",
"Contents",
"(",
")",
";",
... | Register service provider.
@return void | [
"Register",
"service",
"provider",
"."
] | train | https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/NotificationsServiceProvider.php#L67-L79 |
antaresproject/notifications | src/NotificationsServiceProvider.php | NotificationsServiceProvider.bootExtensionComponents | public function bootExtensionComponents()
{
$path = __DIR__ . '/../';
$this->addConfigComponent('antares/notifications', 'antares/notifications', "{$path}/resources/config");
$this->addLanguageComponent('antares/notifications', 'antares/notifications', "{$path}/resources/lang");
$thi... | php | public function bootExtensionComponents()
{
$path = __DIR__ . '/../';
$this->addConfigComponent('antares/notifications', 'antares/notifications', "{$path}/resources/config");
$this->addLanguageComponent('antares/notifications', 'antares/notifications', "{$path}/resources/lang");
$thi... | [
"public",
"function",
"bootExtensionComponents",
"(",
")",
"{",
"$",
"path",
"=",
"__DIR__",
".",
"'/../'",
";",
"$",
"this",
"->",
"addConfigComponent",
"(",
"'antares/notifications'",
",",
"'antares/notifications'",
",",
"\"{$path}/resources/config\"",
")",
";",
"... | Boot the service provider.
@return void | [
"Boot",
"the",
"service",
"provider",
"."
] | train | https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/NotificationsServiceProvider.php#L105-L120 |
juskiewicz/Geolocation | src/Geolocation.php | Geolocation.getAddresses | public function getAddresses(CoordinatesInterface $coordinates) : AddressCollection
{
$url = $this->coordinatesQuery($coordinates);
$json = $this->fetchUrl($url);
// convert google data to address collection
$results = [];
foreach ($json->results as $result) {
$a... | php | public function getAddresses(CoordinatesInterface $coordinates) : AddressCollection
{
$url = $this->coordinatesQuery($coordinates);
$json = $this->fetchUrl($url);
// convert google data to address collection
$results = [];
foreach ($json->results as $result) {
$a... | [
"public",
"function",
"getAddresses",
"(",
"CoordinatesInterface",
"$",
"coordinates",
")",
":",
"AddressCollection",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"coordinatesQuery",
"(",
"$",
"coordinates",
")",
";",
"$",
"json",
"=",
"$",
"this",
"->",
"fetchU... | Get possible addresses using CoordinatesInterface
@param CoordinatesInterface $coordinates
@return AddressCollection | [
"Get",
"possible",
"addresses",
"using",
"CoordinatesInterface"
] | train | https://github.com/juskiewicz/Geolocation/blob/5d3cd393961b92bdfbe2dfe631fbfb62c72dc36d/src/Geolocation.php#L69-L83 |
juskiewicz/Geolocation | src/Geolocation.php | Geolocation.getCoordinatesByObject | public function getCoordinatesByObject(AddressInterface $address) : CoordinatesInterface
{
$url = $this->addressQuery($address->getFormattedAddress());
$json = $this->fetchUrl($url);
// convert google data to coordinates
$coordinates = CoordinatesBuild::create($json->results[0]);
... | php | public function getCoordinatesByObject(AddressInterface $address) : CoordinatesInterface
{
$url = $this->addressQuery($address->getFormattedAddress());
$json = $this->fetchUrl($url);
// convert google data to coordinates
$coordinates = CoordinatesBuild::create($json->results[0]);
... | [
"public",
"function",
"getCoordinatesByObject",
"(",
"AddressInterface",
"$",
"address",
")",
":",
"CoordinatesInterface",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"addressQuery",
"(",
"$",
"address",
"->",
"getFormattedAddress",
"(",
")",
")",
";",
"$",
"json... | Get coordinates using AddressInterface
@param AddressInterface $address
@return CoordinatesInterface | [
"Get",
"coordinates",
"using",
"AddressInterface"
] | train | https://github.com/juskiewicz/Geolocation/blob/5d3cd393961b92bdfbe2dfe631fbfb62c72dc36d/src/Geolocation.php#L91-L100 |
juskiewicz/Geolocation | src/Geolocation.php | Geolocation.getCoordinatesByString | public function getCoordinatesByString(string $address) : CoordinatesInterface
{
$url = $this->addressQuery($address);
$json = $this->fetchUrl($url);
// convert google data to coordinates
$coordinates = CoordinatesBuild::create($json->results[0]);
return $coordinates;
} | php | public function getCoordinatesByString(string $address) : CoordinatesInterface
{
$url = $this->addressQuery($address);
$json = $this->fetchUrl($url);
// convert google data to coordinates
$coordinates = CoordinatesBuild::create($json->results[0]);
return $coordinates;
} | [
"public",
"function",
"getCoordinatesByString",
"(",
"string",
"$",
"address",
")",
":",
"CoordinatesInterface",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"addressQuery",
"(",
"$",
"address",
")",
";",
"$",
"json",
"=",
"$",
"this",
"->",
"fetchUrl",
"(",
... | Get coordinates using string
@param string $address
@return CoordinatesInterface | [
"Get",
"coordinates",
"using",
"string"
] | train | https://github.com/juskiewicz/Geolocation/blob/5d3cd393961b92bdfbe2dfe631fbfb62c72dc36d/src/Geolocation.php#L108-L117 |
juskiewicz/Geolocation | src/Geolocation.php | Geolocation.coordinatesQuery | private function coordinatesQuery(CoordinatesInterface $coordinates) : string
{
$url = sprintf(self::API_COORDINATES_URL_SSL, $coordinates->getLatitude(), $coordinates->getLongitude());
$url = $this->buildQuery($url, $this->apiKey, $this->locale, $this->region);
return $url;
} | php | private function coordinatesQuery(CoordinatesInterface $coordinates) : string
{
$url = sprintf(self::API_COORDINATES_URL_SSL, $coordinates->getLatitude(), $coordinates->getLongitude());
$url = $this->buildQuery($url, $this->apiKey, $this->locale, $this->region);
return $url;
} | [
"private",
"function",
"coordinatesQuery",
"(",
"CoordinatesInterface",
"$",
"coordinates",
")",
":",
"string",
"{",
"$",
"url",
"=",
"sprintf",
"(",
"self",
"::",
"API_COORDINATES_URL_SSL",
",",
"$",
"coordinates",
"->",
"getLatitude",
"(",
")",
",",
"$",
"co... | Build coordinates query
@param CoordinatesInterface $coordinates
@return string | [
"Build",
"coordinates",
"query"
] | train | https://github.com/juskiewicz/Geolocation/blob/5d3cd393961b92bdfbe2dfe631fbfb62c72dc36d/src/Geolocation.php#L125-L131 |
juskiewicz/Geolocation | src/Geolocation.php | Geolocation.addressQuery | private function addressQuery(string $formattedAddress) : string
{
$url = sprintf(self::API_ADDRESS_URL_SSL, rawurlencode($formattedAddress));
$url = $this->buildQuery($url, $this->apiKey, $this->locale, $this->region);
return $url;
} | php | private function addressQuery(string $formattedAddress) : string
{
$url = sprintf(self::API_ADDRESS_URL_SSL, rawurlencode($formattedAddress));
$url = $this->buildQuery($url, $this->apiKey, $this->locale, $this->region);
return $url;
} | [
"private",
"function",
"addressQuery",
"(",
"string",
"$",
"formattedAddress",
")",
":",
"string",
"{",
"$",
"url",
"=",
"sprintf",
"(",
"self",
"::",
"API_ADDRESS_URL_SSL",
",",
"rawurlencode",
"(",
"$",
"formattedAddress",
")",
")",
";",
"$",
"url",
"=",
... | Build address query
@param string $formattedAddress
@return string | [
"Build",
"address",
"query"
] | train | https://github.com/juskiewicz/Geolocation/blob/5d3cd393961b92bdfbe2dfe631fbfb62c72dc36d/src/Geolocation.php#L139-L145 |
juskiewicz/Geolocation | src/Geolocation.php | Geolocation.buildQuery | private function buildQuery(string $url, string $apiKey, string $locale = null, string $region = null) : string
{
if (null !== $apiKey) {
$url = sprintf('%s&key=%s', $url, $apiKey);
}
if (null !== $locale) {
$url = sprintf('%s&language=%s', $url, $locale);
}
... | php | private function buildQuery(string $url, string $apiKey, string $locale = null, string $region = null) : string
{
if (null !== $apiKey) {
$url = sprintf('%s&key=%s', $url, $apiKey);
}
if (null !== $locale) {
$url = sprintf('%s&language=%s', $url, $locale);
}
... | [
"private",
"function",
"buildQuery",
"(",
"string",
"$",
"url",
",",
"string",
"$",
"apiKey",
",",
"string",
"$",
"locale",
"=",
"null",
",",
"string",
"$",
"region",
"=",
"null",
")",
":",
"string",
"{",
"if",
"(",
"null",
"!==",
"$",
"apiKey",
")",... | build query with extra params
@param string $url
@param string $locale
@param string $region
@param string $apiKey
@return string | [
"build",
"query",
"with",
"extra",
"params"
] | train | https://github.com/juskiewicz/Geolocation/blob/5d3cd393961b92bdfbe2dfe631fbfb62c72dc36d/src/Geolocation.php#L157-L170 |
zhouyl/mellivora | Mellivora/View/Compilers/Concerns/CompilesInjections.php | CompilesInjections.compileInject | protected function compileInject($expression)
{
$segments = explode(',', preg_replace("/[\\(\\)\\\"\\']/", '', $expression));
$variable = trim($segments[0]);
$service = trim($segments[1]);
return "<?php \${$variable} = app('{$service}'); ?>";
} | php | protected function compileInject($expression)
{
$segments = explode(',', preg_replace("/[\\(\\)\\\"\\']/", '', $expression));
$variable = trim($segments[0]);
$service = trim($segments[1]);
return "<?php \${$variable} = app('{$service}'); ?>";
} | [
"protected",
"function",
"compileInject",
"(",
"$",
"expression",
")",
"{",
"$",
"segments",
"=",
"explode",
"(",
"','",
",",
"preg_replace",
"(",
"\"/[\\\\(\\\\)\\\\\\\"\\\\']/\"",
",",
"''",
",",
"$",
"expression",
")",
")",
";",
"$",
"variable",
"=",
"tri... | Compile the inject statements into valid PHP.
@param string $expression
@return string | [
"Compile",
"the",
"inject",
"statements",
"into",
"valid",
"PHP",
"."
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/View/Compilers/Concerns/CompilesInjections.php#L14-L23 |
VincentChalnot/SidusDataGridBundle | DependencyInjection/Configuration.php | Configuration.getConfigTreeBuilder | public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root($this->root);
$rootNode
->children()
->scalarNode('default_form_theme')->defaultNull()->end()
->scalarNode('default_datagrid_template')
->... | php | public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root($this->root);
$rootNode
->children()
->scalarNode('default_form_theme')->defaultNull()->end()
->scalarNode('default_datagrid_template')
->... | [
"public",
"function",
"getConfigTreeBuilder",
"(",
")",
"{",
"$",
"treeBuilder",
"=",
"new",
"TreeBuilder",
"(",
")",
";",
"$",
"rootNode",
"=",
"$",
"treeBuilder",
"->",
"root",
"(",
"$",
"this",
"->",
"root",
")",
";",
"$",
"rootNode",
"->",
"children"... | {@inheritdoc}
@throws \RuntimeException | [
"{"
] | train | https://github.com/VincentChalnot/SidusDataGridBundle/blob/aa929113e2208ed335f514d2891affaf7fddf3f6/DependencyInjection/Configuration.php#L52-L75 |
VincentChalnot/SidusDataGridBundle | DependencyInjection/Configuration.php | Configuration.getDataGridConfigTreeBuilder | protected function getDataGridConfigTreeBuilder(): NodeDefinition
{
$builder = new TreeBuilder();
$node = $builder->root('configurations');
$dataGridDefinition = $node
->useAttributeAsKey('code')
->prototype('array')
->performNoDeepMerging()
->... | php | protected function getDataGridConfigTreeBuilder(): NodeDefinition
{
$builder = new TreeBuilder();
$node = $builder->root('configurations');
$dataGridDefinition = $node
->useAttributeAsKey('code')
->prototype('array')
->performNoDeepMerging()
->... | [
"protected",
"function",
"getDataGridConfigTreeBuilder",
"(",
")",
":",
"NodeDefinition",
"{",
"$",
"builder",
"=",
"new",
"TreeBuilder",
"(",
")",
";",
"$",
"node",
"=",
"$",
"builder",
"->",
"root",
"(",
"'configurations'",
")",
";",
"$",
"dataGridDefinition... | @throws \RuntimeException
@return NodeDefinition | [
"@throws",
"\\",
"RuntimeException"
] | train | https://github.com/VincentChalnot/SidusDataGridBundle/blob/aa929113e2208ed335f514d2891affaf7fddf3f6/DependencyInjection/Configuration.php#L82-L100 |
wenbinye/PhalconX | src/Validation/Validation.php | Validation.validate | public function validate($model, $validators = null)
{
if (isset($validators) && is_array($validators)) {
$validation = $this->validateArray($model, $validators);
} else {
$validation = $this->validateModel($model);
}
if ($validation) {
$errors = $... | php | public function validate($model, $validators = null)
{
if (isset($validators) && is_array($validators)) {
$validation = $this->validateArray($model, $validators);
} else {
$validation = $this->validateModel($model);
}
if ($validation) {
$errors = $... | [
"public",
"function",
"validate",
"(",
"$",
"model",
",",
"$",
"validators",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"validators",
")",
"&&",
"is_array",
"(",
"$",
"validators",
")",
")",
"{",
"$",
"validation",
"=",
"$",
"this",
"->",
... | Validate model object
@param object|array $model
@param array $validators
@throws ValidationException | [
"Validate",
"model",
"object"
] | train | https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Validation/Validation.php#L66-L79 |
wenbinye/PhalconX | src/Validation/Validation.php | Validation.createForm | public function createForm($model, $formClass = null)
{
if (is_string($model)) {
return $this->createFormInternal($model, new $model, $formClass);
} else {
return $this->createFormInternal(get_class($model), $model, $formClass);
}
} | php | public function createForm($model, $formClass = null)
{
if (is_string($model)) {
return $this->createFormInternal($model, new $model, $formClass);
} else {
return $this->createFormInternal(get_class($model), $model, $formClass);
}
} | [
"public",
"function",
"createForm",
"(",
"$",
"model",
",",
"$",
"formClass",
"=",
"null",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"model",
")",
")",
"{",
"return",
"$",
"this",
"->",
"createFormInternal",
"(",
"$",
"model",
",",
"new",
"$",
"mod... | Create form object
@param string|object $model model class or object
@param string $formClass form class, default use Phalcon\Forms\Form
@return Phalcon\Forms\Form | [
"Create",
"form",
"object"
] | train | https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Validation/Validation.php#L88-L95 |
wenbinye/PhalconX | src/Validation/Validation.php | Validation.getLabels | private function getLabels($annotations)
{
$it = $this->getAnnotations()->filter($annotations)
->is(Label::class)
->onProperties();
$labels = [];
foreach ($it as $annotation) {
$labels[$annotation->getPropertyName()] = $annotation->value;
}
... | php | private function getLabels($annotations)
{
$it = $this->getAnnotations()->filter($annotations)
->is(Label::class)
->onProperties();
$labels = [];
foreach ($it as $annotation) {
$labels[$annotation->getPropertyName()] = $annotation->value;
}
... | [
"private",
"function",
"getLabels",
"(",
"$",
"annotations",
")",
"{",
"$",
"it",
"=",
"$",
"this",
"->",
"getAnnotations",
"(",
")",
"->",
"filter",
"(",
"$",
"annotations",
")",
"->",
"is",
"(",
"Label",
"::",
"class",
")",
"->",
"onProperties",
"(",... | Gets property labels
@return array | [
"Gets",
"property",
"labels"
] | train | https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Validation/Validation.php#L131-L141 |
wenbinye/PhalconX | src/Validation/Validation.php | Validation.getValidators | private function getValidators($annotations, $class)
{
$validators = [];
$it = $this->getAnnotations()->filter($annotations)
->is(ValidatorInterface::class)
->onProperties();
foreach ($it as $annotation) {
$property = $annotation->getPropertyName();
... | php | private function getValidators($annotations, $class)
{
$validators = [];
$it = $this->getAnnotations()->filter($annotations)
->is(ValidatorInterface::class)
->onProperties();
foreach ($it as $annotation) {
$property = $annotation->getPropertyName();
... | [
"private",
"function",
"getValidators",
"(",
"$",
"annotations",
",",
"$",
"class",
")",
"{",
"$",
"validators",
"=",
"[",
"]",
";",
"$",
"it",
"=",
"$",
"this",
"->",
"getAnnotations",
"(",
")",
"->",
"filter",
"(",
"$",
"annotations",
")",
"->",
"i... | Gets all validators
@return array | [
"Gets",
"all",
"validators"
] | train | https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Validation/Validation.php#L177-L197 |
wenbinye/PhalconX | src/Validation/Validation.php | Validation.getElements | private function getElements($annotations, $formClass)
{
$labels = $this->getLabels($annotations);
$reflection = new \ReflectionClass($formClass);
$defaultValues = $reflection->getDefaultProperties();
$elements = [];
$it = $this->getAnnotations()->filter($annotations)
... | php | private function getElements($annotations, $formClass)
{
$labels = $this->getLabels($annotations);
$reflection = new \ReflectionClass($formClass);
$defaultValues = $reflection->getDefaultProperties();
$elements = [];
$it = $this->getAnnotations()->filter($annotations)
... | [
"private",
"function",
"getElements",
"(",
"$",
"annotations",
",",
"$",
"formClass",
")",
"{",
"$",
"labels",
"=",
"$",
"this",
"->",
"getLabels",
"(",
"$",
"annotations",
")",
";",
"$",
"reflection",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"form... | Gets all form elements
@return array key is property, value is Phalcon\Form\Element object | [
"Gets",
"all",
"form",
"elements"
] | train | https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Validation/Validation.php#L204-L234 |
wenbinye/PhalconX | src/Validation/Validation.php | Validation.getValue | private function getValue($form, $name)
{
if (is_array($form)) {
return isset($form[$name]) ? $form[$name] : null;
} elseif (is_object($form)) {
$method = 'get' . $name;
if (method_exists($form, $method)) {
return $form->$method();
} el... | php | private function getValue($form, $name)
{
if (is_array($form)) {
return isset($form[$name]) ? $form[$name] : null;
} elseif (is_object($form)) {
$method = 'get' . $name;
if (method_exists($form, $method)) {
return $form->$method();
} el... | [
"private",
"function",
"getValue",
"(",
"$",
"form",
",",
"$",
"name",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"form",
")",
")",
"{",
"return",
"isset",
"(",
"$",
"form",
"[",
"$",
"name",
"]",
")",
"?",
"$",
"form",
"[",
"$",
"name",
"]",
... | Gets the value in the array/object data source
@return mixed | [
"Gets",
"the",
"value",
"in",
"the",
"array",
"/",
"object",
"data",
"source"
] | train | https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Validation/Validation.php#L241-L253 |
gedex/php-janrain-api | lib/Janrain/Api/Capture/Settings.php | Settings.getSingle | public function getSingle($key, $forClientId = null)
{
$params = array('key' => $key);
if ($forClientId) {
$params['for_client_id'] = $forClientId;
}
return $this->post('settings/get', $params);
} | php | public function getSingle($key, $forClientId = null)
{
$params = array('key' => $key);
if ($forClientId) {
$params['for_client_id'] = $forClientId;
}
return $this->post('settings/get', $params);
} | [
"public",
"function",
"getSingle",
"(",
"$",
"key",
",",
"$",
"forClientId",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"'key'",
"=>",
"$",
"key",
")",
";",
"if",
"(",
"$",
"forClientId",
")",
"{",
"$",
"params",
"[",
"'for_client_id'",... | Get the value associated with a key for a particular `client_id`. If the key
has not value for that client, then return the key's default value for the
application, or if they key has not default value, then return null.
@param string $key The key whose value you want to retrieve. To find out the
values available, use... | [
"Get",
"the",
"value",
"associated",
"with",
"a",
"key",
"for",
"a",
"particular",
"client_id",
".",
"If",
"the",
"key",
"has",
"not",
"value",
"for",
"that",
"client",
"then",
"return",
"the",
"key",
"s",
"default",
"value",
"for",
"the",
"application",
... | train | https://github.com/gedex/php-janrain-api/blob/6283f68454e0ad5211ac620f1d337df38cd49597/lib/Janrain/Api/Capture/Settings.php#L23-L32 |
gedex/php-janrain-api | lib/Janrain/Api/Capture/Settings.php | Settings.getMulti | public function getMulti(array $keys, $forClientId = null)
{
$params = array(
'keys' => json_encode(array_values($keys)),
);
if ($forClientId) {
$params['for_client_id'] = $forClientId;
}
return $this->post('settings/get_multi', $params);
} | php | public function getMulti(array $keys, $forClientId = null)
{
$params = array(
'keys' => json_encode(array_values($keys)),
);
if ($forClientId) {
$params['for_client_id'] = $forClientId;
}
return $this->post('settings/get_multi', $params);
} | [
"public",
"function",
"getMulti",
"(",
"array",
"$",
"keys",
",",
"$",
"forClientId",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"'keys'",
"=>",
"json_encode",
"(",
"array_values",
"(",
"$",
"keys",
")",
")",
",",
")",
";",
"if",
"(",
... | Look up multiple keys. Each value is retrieved, as in the 'settings/get'
command, by first looking at the client-specific setting, and then falling
back to the application default setting.
@param array $keys Array of the keys to retrieve
@param string $forClientId The client identifier whose keys will be retrieved.
I... | [
"Look",
"up",
"multiple",
"keys",
".",
"Each",
"value",
"is",
"retrieved",
"as",
"in",
"the",
"settings",
"/",
"get",
"command",
"by",
"first",
"looking",
"at",
"the",
"client",
"-",
"specific",
"setting",
"and",
"then",
"falling",
"back",
"to",
"the",
"... | train | https://github.com/gedex/php-janrain-api/blob/6283f68454e0ad5211ac620f1d337df38cd49597/lib/Janrain/Api/Capture/Settings.php#L47-L58 |
gedex/php-janrain-api | lib/Janrain/Api/Capture/Settings.php | Settings.items | public function items($forClientId = null)
{
$params = array();
if ($forClientId) {
$params['for_client_id'] = $forClientId;
}
return $this->post('settings/items', $params);
} | php | public function items($forClientId = null)
{
$params = array();
if ($forClientId) {
$params['for_client_id'] = $forClientId;
}
return $this->post('settings/items', $params);
} | [
"public",
"function",
"items",
"(",
"$",
"forClientId",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"forClientId",
")",
"{",
"$",
"params",
"[",
"'for_client_id'",
"]",
"=",
"$",
"forClientId",
";",
"}",
"return... | Get all settings for a particular client, including those from the application-
wide default settings. If a key is defined in both the client and application
settings, only the client-specific value is returned.
@param string $forClientId The client identifier whose settings will be
retrieved. If you do not enter a va... | [
"Get",
"all",
"settings",
"for",
"a",
"particular",
"client",
"including",
"those",
"from",
"the",
"application",
"-",
"wide",
"default",
"settings",
".",
"If",
"a",
"key",
"is",
"defined",
"in",
"both",
"the",
"client",
"and",
"application",
"settings",
"on... | train | https://github.com/gedex/php-janrain-api/blob/6283f68454e0ad5211ac620f1d337df38cd49597/lib/Janrain/Api/Capture/Settings.php#L70-L78 |
gedex/php-janrain-api | lib/Janrain/Api/Capture/Settings.php | Settings.keys | public function keys($forClientId = null)
{
$params = array();
if ($forClientId) {
$params['for_client_id'] = $forClientId;
}
return $this->post('settings/keys', $params);
} | php | public function keys($forClientId = null)
{
$params = array();
if ($forClientId) {
$params['for_client_id'] = $forClientId;
}
return $this->post('settings/keys', $params);
} | [
"public",
"function",
"keys",
"(",
"$",
"forClientId",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"forClientId",
")",
"{",
"$",
"params",
"[",
"'for_client_id'",
"]",
"=",
"$",
"forClientId",
";",
"}",
"return"... | Get all keys for a particular client, including those from the application-
wide default settings. Returns an array of the keys.
@param string $forClientId The client identifier whose setting will be
modified. If you do not enter a value for this
parameter, it defaults to the value of the
`client_id`, that is, you are... | [
"Get",
"all",
"keys",
"for",
"a",
"particular",
"client",
"including",
"those",
"from",
"the",
"application",
"-",
"wide",
"default",
"settings",
".",
"Returns",
"an",
"array",
"of",
"the",
"keys",
"."
] | train | https://github.com/gedex/php-janrain-api/blob/6283f68454e0ad5211ac620f1d337df38cd49597/lib/Janrain/Api/Capture/Settings.php#L90-L98 |
gedex/php-janrain-api | lib/Janrain/Api/Capture/Settings.php | Settings.set | public function set($key, $value, $forClientId = null)
{
$params = array('key' => $key, 'value' => $value);
if (is_array($value)) {
$params['value'] = json_encode($value);
}
if ($forClientId) {
$params['for_client_id'] = $forClientId;
}
return $this->post('settings/set', $params);
} | php | public function set($key, $value, $forClientId = null)
{
$params = array('key' => $key, 'value' => $value);
if (is_array($value)) {
$params['value'] = json_encode($value);
}
if ($forClientId) {
$params['for_client_id'] = $forClientId;
}
return $this->post('settings/set', $params);
} | [
"public",
"function",
"set",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"forClientId",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"'key'",
"=>",
"$",
"key",
",",
"'value'",
"=>",
"$",
"value",
")",
";",
"if",
"(",
"is_array",
"("... | Assign a key-value pair for a particular `client_id`. If the key does not
exist, it will be created. If they key already exists, this call overwrites
the existing value.
Returns a boolean that indicates whether the key already existed. True
indicates the key has been overwritten. False indicates that a new key has
bee... | [
"Assign",
"a",
"key",
"-",
"value",
"pair",
"for",
"a",
"particular",
"client_id",
".",
"If",
"the",
"key",
"does",
"not",
"exist",
"it",
"will",
"be",
"created",
".",
"If",
"they",
"key",
"already",
"exists",
"this",
"call",
"overwrites",
"the",
"existi... | train | https://github.com/gedex/php-janrain-api/blob/6283f68454e0ad5211ac620f1d337df38cd49597/lib/Janrain/Api/Capture/Settings.php#L121-L133 |
gedex/php-janrain-api | lib/Janrain/Api/Capture/Settings.php | Settings.setMulti | public function setMulti(array $items, $forClientId = null)
{
$params = array('items' => json_encode($items));
if ($forClientId) {
$params['for_client_id'] = $forClientId;
}
return $this->post('settings/set_multi', $params);
} | php | public function setMulti(array $items, $forClientId = null)
{
$params = array('items' => json_encode($items));
if ($forClientId) {
$params['for_client_id'] = $forClientId;
}
return $this->post('settings/set_multi', $params);
} | [
"public",
"function",
"setMulti",
"(",
"array",
"$",
"items",
",",
"$",
"forClientId",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"'items'",
"=>",
"json_encode",
"(",
"$",
"items",
")",
")",
";",
"if",
"(",
"$",
"forClientId",
")",
"{",... | Assign multiple settings for a particular `client_id`. Returns a JSON
object in which each key is mapped to a boolean that indicates whether the
key already existed. True indicates that a previous key did exist and has
been overwritten. False indicates that there were no previous key and a new
key has been created. Doe... | [
"Assign",
"multiple",
"settings",
"for",
"a",
"particular",
"client_id",
".",
"Returns",
"a",
"JSON",
"object",
"in",
"which",
"each",
"key",
"is",
"mapped",
"to",
"a",
"boolean",
"that",
"indicates",
"whether",
"the",
"key",
"already",
"existed",
".",
"True... | train | https://github.com/gedex/php-janrain-api/blob/6283f68454e0ad5211ac620f1d337df38cd49597/lib/Janrain/Api/Capture/Settings.php#L151-L160 |
gedex/php-janrain-api | lib/Janrain/Api/Capture/Settings.php | Settings.setDefault | public function setDefault($key, $value)
{
$params = array('key' => $key, 'value' => $value);
if (is_array($value)) {
$params['value'] = json_encode($value);
}
return $this->post('settings/set_default', $params);
} | php | public function setDefault($key, $value)
{
$params = array('key' => $key, 'value' => $value);
if (is_array($value)) {
$params['value'] = json_encode($value);
}
return $this->post('settings/set_default', $params);
} | [
"public",
"function",
"setDefault",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"'key'",
"=>",
"$",
"key",
",",
"'value'",
"=>",
"$",
"value",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
... | Set the application-wide default value for a key. This will create a new
key with a default value, if the key does not yet exist in the application.
If the key does exist, the value will be overwritten.
Returns a boolean that indicates whether the key already existed. "True"
indicates the key has been overwritten. "Fa... | [
"Set",
"the",
"application",
"-",
"wide",
"default",
"value",
"for",
"a",
"key",
".",
"This",
"will",
"create",
"a",
"new",
"key",
"with",
"a",
"default",
"value",
"if",
"the",
"key",
"does",
"not",
"yet",
"exist",
"in",
"the",
"application",
".",
"If"... | train | https://github.com/gedex/php-janrain-api/blob/6283f68454e0ad5211ac620f1d337df38cd49597/lib/Janrain/Api/Capture/Settings.php#L187-L195 |
gedex/php-janrain-api | lib/Janrain/Api/Capture/Settings.php | Settings.delete | public function delete($key, $forClientId = null)
{
$params = array('key' => $key);
if ($forClientId) {
$params['for_client_id'] = $forClientId;
}
return $this->post('settings/delete', $params);
} | php | public function delete($key, $forClientId = null)
{
$params = array('key' => $key);
if ($forClientId) {
$params['for_client_id'] = $forClientId;
}
return $this->post('settings/delete', $params);
} | [
"public",
"function",
"delete",
"(",
"$",
"key",
",",
"$",
"forClientId",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"'key'",
"=>",
"$",
"key",
")",
";",
"if",
"(",
"$",
"forClientId",
")",
"{",
"$",
"params",
"[",
"'for_client_id'",
... | Delete a key from the settings for a particular client. Returns a boolean
indicating whether the key existed. This does not modify the application-
wide default value for a key.
@param string $key The key to delete from the client settings. To find out
the values available, use the 'settings/keys' API call
first.
@pa... | [
"Delete",
"a",
"key",
"from",
"the",
"settings",
"for",
"a",
"particular",
"client",
".",
"Returns",
"a",
"boolean",
"indicating",
"whether",
"the",
"key",
"existed",
".",
"This",
"does",
"not",
"modify",
"the",
"application",
"-",
"wide",
"default",
"value"... | train | https://github.com/gedex/php-janrain-api/blob/6283f68454e0ad5211ac620f1d337df38cd49597/lib/Janrain/Api/Capture/Settings.php#L212-L221 |
Eresus/EresusCMS | src/core/lib/mysql.php | MySQL.init | public function init($server, $username, $password, $source, $prefix = '')
{
Eresus_Kernel::log(__METHOD__, LOG_NOTICE, 'This method is deprecated');
$dsn = "mysql://$username:$password@$server/$source?charset=utf8";
$db = Eresus_DB::connect($dsn);
$options = new ezcDbOptions(array('tableNam... | php | public function init($server, $username, $password, $source, $prefix = '')
{
Eresus_Kernel::log(__METHOD__, LOG_NOTICE, 'This method is deprecated');
$dsn = "mysql://$username:$password@$server/$source?charset=utf8";
$db = Eresus_DB::connect($dsn);
$options = new ezcDbOptions(array('tableNam... | [
"public",
"function",
"init",
"(",
"$",
"server",
",",
"$",
"username",
",",
"$",
"password",
",",
"$",
"source",
",",
"$",
"prefix",
"=",
"''",
")",
"{",
"Eresus_Kernel",
"::",
"log",
"(",
"__METHOD__",
",",
"LOG_NOTICE",
",",
"'This method is deprecated'... | Открывает соединение сервером данных и выбирает источник
@param string $server Сервер данных
@param string $username Имя пользователя для доступа к серверу
@param string $password Пароль пользователя
@param string $source Имя источника данных
@param string $prefix
@throws Eresus_DB_Exception
@return bool Ре... | [
"Открывает",
"соединение",
"сервером",
"данных",
"и",
"выбирает",
"источник"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/lib/mysql.php#L90-L99 |
Eresus/EresusCMS | src/core/lib/mysql.php | MySQL.getSchema | public function getSchema()
{
if (!$this->dbSchema)
{
$db = Eresus_DB::getHandler();
$options = new ezcDbSchemaOptions(array('tableNamePrefix' => $db->options->tableNamePrefix));
ezcDbSchema::setOptions($options);
$this->dbSchema = ezcDbSchema::createFromDb($db);
}
return $this->dbSchema;
} | php | public function getSchema()
{
if (!$this->dbSchema)
{
$db = Eresus_DB::getHandler();
$options = new ezcDbSchemaOptions(array('tableNamePrefix' => $db->options->tableNamePrefix));
ezcDbSchema::setOptions($options);
$this->dbSchema = ezcDbSchema::createFromDb($db);
}
return $this->dbSchema;
} | [
"public",
"function",
"getSchema",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"dbSchema",
")",
"{",
"$",
"db",
"=",
"Eresus_DB",
"::",
"getHandler",
"(",
")",
";",
"$",
"options",
"=",
"new",
"ezcDbSchemaOptions",
"(",
"array",
"(",
"'tableNameP... | Возвращает объект-одиночку схемы БД
@return ezcDbSchema | [
"Возвращает",
"объект",
"-",
"одиночку",
"схемы",
"БД"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/lib/mysql.php#L105-L117 |
Eresus/EresusCMS | src/core/lib/mysql.php | MySQL.query | public function query($query)
{
Eresus_Kernel::log(__METHOD__, LOG_NOTICE, 'This method is deprecated');
$db = Eresus_DB::getHandler();
Eresus_Kernel::log(__METHOD__, LOG_DEBUG, $query);
$db->exec($query);
return true;
} | php | public function query($query)
{
Eresus_Kernel::log(__METHOD__, LOG_NOTICE, 'This method is deprecated');
$db = Eresus_DB::getHandler();
Eresus_Kernel::log(__METHOD__, LOG_DEBUG, $query);
$db->exec($query);
return true;
} | [
"public",
"function",
"query",
"(",
"$",
"query",
")",
"{",
"Eresus_Kernel",
"::",
"log",
"(",
"__METHOD__",
",",
"LOG_NOTICE",
",",
"'This method is deprecated'",
")",
";",
"$",
"db",
"=",
"Eresus_DB",
"::",
"getHandler",
"(",
")",
";",
"Eresus_Kernel",
"::... | Выполняет запрос к источнику
@param string $query Запрос в формате источника
@return mixed Результат запроса. Тип зависит от источника, запроса и результата
@deprecated | [
"Выполняет",
"запрос",
"к",
"источнику"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/lib/mysql.php#L127-L134 |
Eresus/EresusCMS | src/core/lib/mysql.php | MySQL.query_array | public function query_array($query)
{
Eresus_Kernel::log(__METHOD__, LOG_NOTICE, 'This method is deprecated');
$db = Eresus_DB::getHandler();
$stmt = $db->prepare($query);
if (!$stmt->execute())
{
return false;
}
$values = $stmt->fetchAll(PDO::FETCH_ASSOC);
return $values;
} | php | public function query_array($query)
{
Eresus_Kernel::log(__METHOD__, LOG_NOTICE, 'This method is deprecated');
$db = Eresus_DB::getHandler();
$stmt = $db->prepare($query);
if (!$stmt->execute())
{
return false;
}
$values = $stmt->fetchAll(PDO::FETCH_ASSOC);
return $values;
} | [
"public",
"function",
"query_array",
"(",
"$",
"query",
")",
"{",
"Eresus_Kernel",
"::",
"log",
"(",
"__METHOD__",
",",
"LOG_NOTICE",
",",
"'This method is deprecated'",
")",
";",
"$",
"db",
"=",
"Eresus_DB",
"::",
"getHandler",
"(",
")",
";",
"$",
"stmt",
... | Выполняет запрос к источнику и возвращает ассоциативный массив значений
@param string $query Запрос в формате источника
@return array|bool Ответ в виде массива или FALSE в случае ошибки
@deprecated | [
"Выполняет",
"запрос",
"к",
"источнику",
"и",
"возвращает",
"ассоциативный",
"массив",
"значений"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/lib/mysql.php#L144-L156 |
Eresus/EresusCMS | src/core/lib/mysql.php | MySQL.create | public function create($name, $structure, $options = '')
{
Eresus_Kernel::log(__METHOD__, LOG_NOTICE, 'This method is deprecated');
$db = Eresus_DB::getHandler();
$name = $db->options->tableNamePrefix . $name;
$query = "CREATE TABLE `$name` ($structure) $options";
$result = $this->query($query);
if ... | php | public function create($name, $structure, $options = '')
{
Eresus_Kernel::log(__METHOD__, LOG_NOTICE, 'This method is deprecated');
$db = Eresus_DB::getHandler();
$name = $db->options->tableNamePrefix . $name;
$query = "CREATE TABLE `$name` ($structure) $options";
$result = $this->query($query);
if ... | [
"public",
"function",
"create",
"(",
"$",
"name",
",",
"$",
"structure",
",",
"$",
"options",
"=",
"''",
")",
"{",
"Eresus_Kernel",
"::",
"log",
"(",
"__METHOD__",
",",
"LOG_NOTICE",
",",
"'This method is deprecated'",
")",
";",
"$",
"db",
"=",
"Eresus_DB"... | Создание новой таблицы
@param string $name Имя таблицы
@param string $structure Описание структуры
@param string $options Опции
@return bool Результат
@deprecated | [
"Создание",
"новой",
"таблицы"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/lib/mysql.php#L169-L184 |
Eresus/EresusCMS | src/core/lib/mysql.php | MySQL.select | public function select($tables, $condition = '', $order = '', $fields = '', $limit = 0,
$offset = 0, $group = '', $distinct = false)
{
Eresus_Kernel::log(__METHOD__, LOG_NOTICE, 'This method is deprecated');
$db = Eresus_DB::getHandler();
$q = $db->createSelectQuery();
$e = $q->expr;
if (empty($fiel... | php | public function select($tables, $condition = '', $order = '', $fields = '', $limit = 0,
$offset = 0, $group = '', $distinct = false)
{
Eresus_Kernel::log(__METHOD__, LOG_NOTICE, 'This method is deprecated');
$db = Eresus_DB::getHandler();
$q = $db->createSelectQuery();
$e = $q->expr;
if (empty($fiel... | [
"public",
"function",
"select",
"(",
"$",
"tables",
",",
"$",
"condition",
"=",
"''",
",",
"$",
"order",
"=",
"''",
",",
"$",
"fields",
"=",
"''",
",",
"$",
"limit",
"=",
"0",
",",
"$",
"offset",
"=",
"0",
",",
"$",
"group",
"=",
"''",
",",
"... | Производит выборку данных из источника
@param string $tables Список таблиц из которых проводится выборка
@param string $condition Условие для выборки (WHERE)
@param string $order Поля для сортировки (ORDER BY)
@param string $fields Список полей для получения
@param int $limit Макси... | [
"Производит",
"выборку",
"данных",
"из",
"источника"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/lib/mysql.php#L228-L297 |
Eresus/EresusCMS | src/core/lib/mysql.php | MySQL.insert | public function insert($table, $item)
{
Eresus_Kernel::log(__METHOD__, LOG_NOTICE, 'This method is deprecated');
$fields = $this->fields($table);
if (!$table)
{
return false;
}
$q = Eresus_DB::getHandler()->createInsertQuery();
$q->insertInto($table);
foreach ($fields as $field)
{
if (i... | php | public function insert($table, $item)
{
Eresus_Kernel::log(__METHOD__, LOG_NOTICE, 'This method is deprecated');
$fields = $this->fields($table);
if (!$table)
{
return false;
}
$q = Eresus_DB::getHandler()->createInsertQuery();
$q->insertInto($table);
foreach ($fields as $field)
{
if (i... | [
"public",
"function",
"insert",
"(",
"$",
"table",
",",
"$",
"item",
")",
"{",
"Eresus_Kernel",
"::",
"log",
"(",
"__METHOD__",
",",
"LOG_NOTICE",
",",
"'This method is deprecated'",
")",
";",
"$",
"fields",
"=",
"$",
"this",
"->",
"fields",
"(",
"$",
"t... | Вставка элемента в БД
@param string $table Таблица, в которую надо вставтиь элемент
@param array $item Ассоциативный массив значений
@return mixed Результат выполнения операции
@deprecated | [
"Вставка",
"элемента",
"в",
"БД"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/lib/mysql.php#L308-L330 |
Eresus/EresusCMS | src/core/lib/mysql.php | MySQL.update | public function update($table, $set, $condition)
{
Eresus_Kernel::log(__METHOD__, LOG_NOTICE, 'This method is deprecated');
$q = Eresus_DB::getHandler()->createUpdateQuery();
$q->update($table)
->where($condition);
$set = explode(',', $set);
foreach ($set as $each)
{
list($key, $value) = explo... | php | public function update($table, $set, $condition)
{
Eresus_Kernel::log(__METHOD__, LOG_NOTICE, 'This method is deprecated');
$q = Eresus_DB::getHandler()->createUpdateQuery();
$q->update($table)
->where($condition);
$set = explode(',', $set);
foreach ($set as $each)
{
list($key, $value) = explo... | [
"public",
"function",
"update",
"(",
"$",
"table",
",",
"$",
"set",
",",
"$",
"condition",
")",
"{",
"Eresus_Kernel",
"::",
"log",
"(",
"__METHOD__",
",",
"LOG_NOTICE",
",",
"'This method is deprecated'",
")",
";",
"$",
"q",
"=",
"Eresus_DB",
"::",
"getHan... | Выполняет обновление информации в источнике
@param string $table Таблица
@param mixed $set Изменения
@param string $condition Условие
@return void
@deprecated | [
"Выполняет",
"обновление",
"информации",
"в",
"источнике"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/lib/mysql.php#L342-L359 |
Eresus/EresusCMS | src/core/lib/mysql.php | MySQL.delete | public function delete($table, $condition)
{
Eresus_Kernel::log(__METHOD__, LOG_NOTICE, 'This method is deprecated');
$q = Eresus_DB::getHandler()->createDeleteQuery();
$q->deleteFrom($table)
->where($condition);
$q->execute();
return null;
} | php | public function delete($table, $condition)
{
Eresus_Kernel::log(__METHOD__, LOG_NOTICE, 'This method is deprecated');
$q = Eresus_DB::getHandler()->createDeleteQuery();
$q->deleteFrom($table)
->where($condition);
$q->execute();
return null;
} | [
"public",
"function",
"delete",
"(",
"$",
"table",
",",
"$",
"condition",
")",
"{",
"Eresus_Kernel",
"::",
"log",
"(",
"__METHOD__",
",",
"LOG_NOTICE",
",",
"'This method is deprecated'",
")",
";",
"$",
"q",
"=",
"Eresus_DB",
"::",
"getHandler",
"(",
")",
... | Выполняет запрос DELETE к базе данных
@param string $table таблица, из которой требуется удалить записи
@param string $condition признаки удаляемых записей
@return mixed
@deprecated | [
"Выполняет",
"запрос",
"DELETE",
"к",
"базе",
"данных"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/lib/mysql.php#L369-L377 |
Eresus/EresusCMS | src/core/lib/mysql.php | MySQL.fields | public function fields($table, $info = false)
{
Eresus_Kernel::log(__METHOD__, LOG_NOTICE, 'This method is deprecated');
$schm = $this->getSchema()->getSchema();
if ($schm[$table]->fields)
{
return array_keys($schm[$table]->fields);
}
else
{
return false;
}
} | php | public function fields($table, $info = false)
{
Eresus_Kernel::log(__METHOD__, LOG_NOTICE, 'This method is deprecated');
$schm = $this->getSchema()->getSchema();
if ($schm[$table]->fields)
{
return array_keys($schm[$table]->fields);
}
else
{
return false;
}
} | [
"public",
"function",
"fields",
"(",
"$",
"table",
",",
"$",
"info",
"=",
"false",
")",
"{",
"Eresus_Kernel",
"::",
"log",
"(",
"__METHOD__",
",",
"LOG_NOTICE",
",",
"'This method is deprecated'",
")",
";",
"$",
"schm",
"=",
"$",
"this",
"->",
"getSchema",... | Получение списка полей таблицы
@param string $table Имя таблицы
@param bool $info [optional]
@return array|bool Список полей, с описанием, если $info = true
@deprecated с 2.14 | [
"Получение",
"списка",
"полей",
"таблицы"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/lib/mysql.php#L388-L400 |
Eresus/EresusCMS | src/core/lib/mysql.php | MySQL.selectItem | public function selectItem($table, $condition, $fields = '')
{
Eresus_Kernel::log(__METHOD__, LOG_NOTICE, 'This method is deprecated');
$q = Eresus_DB::getHandler()->createSelectQuery();
if ($fields == '')
{
$fields = '*';
}
$q->select($fields);
$q->from($table);
$q->where($condi... | php | public function selectItem($table, $condition, $fields = '')
{
Eresus_Kernel::log(__METHOD__, LOG_NOTICE, 'This method is deprecated');
$q = Eresus_DB::getHandler()->createSelectQuery();
if ($fields == '')
{
$fields = '*';
}
$q->select($fields);
$q->from($table);
$q->where($condi... | [
"public",
"function",
"selectItem",
"(",
"$",
"table",
",",
"$",
"condition",
",",
"$",
"fields",
"=",
"''",
")",
"{",
"Eresus_Kernel",
"::",
"log",
"(",
"__METHOD__",
",",
"LOG_NOTICE",
",",
"'This method is deprecated'",
")",
";",
"$",
"q",
"=",
"Eresus_... | Выбрать одну запись из БД
@param string $table Имя таблицы
@param string $condition SQL-условие
@param string $fields Выбираемые поля
@return array|bool
@deprecated | [
"Выбрать",
"одну",
"запись",
"из",
"БД"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/lib/mysql.php#L411-L429 |
Eresus/EresusCMS | src/core/lib/mysql.php | MySQL.updateItem | public function updateItem($table, $item, $condition)
{
Eresus_Kernel::log(__METHOD__, LOG_NOTICE, 'This method is deprecated');
$fields = $this->fields($table);
if (!$table)
{
return false;
}
$q = Eresus_DB::getHandler()->createUpdateQuery();
$q->update($table)
->where($condition);
forea... | php | public function updateItem($table, $item, $condition)
{
Eresus_Kernel::log(__METHOD__, LOG_NOTICE, 'This method is deprecated');
$fields = $this->fields($table);
if (!$table)
{
return false;
}
$q = Eresus_DB::getHandler()->createUpdateQuery();
$q->update($table)
->where($condition);
forea... | [
"public",
"function",
"updateItem",
"(",
"$",
"table",
",",
"$",
"item",
",",
"$",
"condition",
")",
"{",
"Eresus_Kernel",
"::",
"log",
"(",
"__METHOD__",
",",
"LOG_NOTICE",
",",
"'This method is deprecated'",
")",
";",
"$",
"fields",
"=",
"$",
"this",
"->... | Обновляет одну запись
@param string $table
@param array $item
@param string $condition
@return bool
@deprecated | [
"Обновляет",
"одну",
"запись"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/lib/mysql.php#L440-L463 |
Eresus/EresusCMS | src/core/lib/mysql.php | MySQL.count | public function count($table, $condition = false, $group = false, $rows = false)
{
Eresus_Kernel::log(__METHOD__, LOG_NOTICE, 'This method is deprecated');
$q = Eresus_DB::getHandler()->createSelectQuery();
$e = $q->expr;
$q->select($q->alias($e->count('*'), 'count'));
$q->from($table);
if ($... | php | public function count($table, $condition = false, $group = false, $rows = false)
{
Eresus_Kernel::log(__METHOD__, LOG_NOTICE, 'This method is deprecated');
$q = Eresus_DB::getHandler()->createSelectQuery();
$e = $q->expr;
$q->select($q->alias($e->count('*'), 'count'));
$q->from($table);
if ($... | [
"public",
"function",
"count",
"(",
"$",
"table",
",",
"$",
"condition",
"=",
"false",
",",
"$",
"group",
"=",
"false",
",",
"$",
"rows",
"=",
"false",
")",
"{",
"Eresus_Kernel",
"::",
"log",
"(",
"__METHOD__",
",",
"LOG_NOTICE",
",",
"'This method is de... | Возвращает количество записей в таблице
@param string $table таблица, для которой требуется посчитать кол-во записей
@param string $condition
@param string $group
@param bool $rows
@return int
@deprecated | [
"Возвращает",
"количество",
"записей",
"в",
"таблице"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/lib/mysql.php#L475-L503 |
Eresus/EresusCMS | src/core/lib/mysql.php | MySQL.getInsertedID | public function getInsertedID()
{
Eresus_Kernel::log(__METHOD__, LOG_NOTICE, 'This method is deprecated');
$db = Eresus_DB::getHandler();
return $db->lastInsertId();
} | php | public function getInsertedID()
{
Eresus_Kernel::log(__METHOD__, LOG_NOTICE, 'This method is deprecated');
$db = Eresus_DB::getHandler();
return $db->lastInsertId();
} | [
"public",
"function",
"getInsertedID",
"(",
")",
"{",
"Eresus_Kernel",
"::",
"log",
"(",
"__METHOD__",
",",
"LOG_NOTICE",
",",
"'This method is deprecated'",
")",
";",
"$",
"db",
"=",
"Eresus_DB",
"::",
"getHandler",
"(",
")",
";",
"return",
"$",
"db",
"->",... | Возвращает идентификатор последней вставленной записи
@return mixed
@deprecated | [
"Возвращает",
"идентификатор",
"последней",
"вставленной",
"записи"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/lib/mysql.php#L512-L517 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Translation/src/backends/ts_backend.php | ezcTranslationTsBackend.setOptions | public function setOptions( $options )
{
if ( is_array( $options ) )
{
$this->options->merge( $options );
}
else if ( $options instanceof ezcTranslationTsBackendOptions )
{
$this->options = $options;
}
else
{
thr... | php | public function setOptions( $options )
{
if ( is_array( $options ) )
{
$this->options->merge( $options );
}
else if ( $options instanceof ezcTranslationTsBackendOptions )
{
$this->options = $options;
}
else
{
thr... | [
"public",
"function",
"setOptions",
"(",
"$",
"options",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"options",
")",
")",
"{",
"$",
"this",
"->",
"options",
"->",
"merge",
"(",
"$",
"options",
")",
";",
"}",
"else",
"if",
"(",
"$",
"options",
"insta... | Set new options.
This method allows you to change the options of the translation backend.
@param ezcTranslationTsBackendOptions $options The options to set.
@throws ezcBaseSettingNotFoundException
If you tried to set a non-existent option value.
@throws ezcBaseSettingValueException
If the value is not valid for the d... | [
"Set",
"new",
"options",
".",
"This",
"method",
"allows",
"you",
"to",
"change",
"the",
"options",
"of",
"the",
"translation",
"backend",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Translation/src/backends/ts_backend.php#L162-L176 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Translation/src/backends/ts_backend.php | ezcTranslationTsBackend.buildTranslationFileName | public function buildTranslationFileName( $locale )
{
$filename = $this->options->location . $this->options->format;
$filename = str_replace( '[LOCALE]', $locale, $filename );
return $filename;
} | php | public function buildTranslationFileName( $locale )
{
$filename = $this->options->location . $this->options->format;
$filename = str_replace( '[LOCALE]', $locale, $filename );
return $filename;
} | [
"public",
"function",
"buildTranslationFileName",
"(",
"$",
"locale",
")",
"{",
"$",
"filename",
"=",
"$",
"this",
"->",
"options",
"->",
"location",
".",
"$",
"this",
"->",
"options",
"->",
"format",
";",
"$",
"filename",
"=",
"str_replace",
"(",
"'[LOCAL... | Returns the filename for the translation file using the locale $locale.
This function uses the <i>location</i> and <i>format</i> options,
combined with the $locale parameter to form a filename that contains the
translation belonging to the specified locale.
@param string $locale
@return string | [
"Returns",
"the",
"filename",
"for",
"the",
"translation",
"file",
"using",
"the",
"locale",
"$locale",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Translation/src/backends/ts_backend.php#L199-L204 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Translation/src/backends/ts_backend.php | ezcTranslationTsBackend.openTranslationFile | public function openTranslationFile( $locale, $returnClass = 'SimpleXMLElement' )
{
$filename = $this->buildTranslationFileName( $locale );
if ( !file_exists( $filename ) )
{
throw new ezcTranslationMissingTranslationFileException( $filename );
}
return simplexml_... | php | public function openTranslationFile( $locale, $returnClass = 'SimpleXMLElement' )
{
$filename = $this->buildTranslationFileName( $locale );
if ( !file_exists( $filename ) )
{
throw new ezcTranslationMissingTranslationFileException( $filename );
}
return simplexml_... | [
"public",
"function",
"openTranslationFile",
"(",
"$",
"locale",
",",
"$",
"returnClass",
"=",
"'SimpleXMLElement'",
")",
"{",
"$",
"filename",
"=",
"$",
"this",
"->",
"buildTranslationFileName",
"(",
"$",
"locale",
")",
";",
"if",
"(",
"!",
"file_exists",
"... | Creates an SimpleXML parser object for the locale $locale.
You can set the class of the returned object through the $returnClass
parameter. That class should extend the SimpleXMLElement class.
This function checks if the <i>location</i> setting is made, if the file
with the filename as returned by buildTranslationFil... | [
"Creates",
"an",
"SimpleXML",
"parser",
"object",
"for",
"the",
"locale",
"$locale",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Translation/src/backends/ts_backend.php#L226-L234 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Translation/src/backends/ts_backend.php | ezcTranslationTsBackend.openTranslationFileForWriting | public function openTranslationFileForWriting( $locale )
{
$filename = $this->buildTranslationFileName( $locale );
if ( !file_exists( $filename ) )
{
$dom = new DOMDocument( '1.0', 'UTF-8' );
$dom->formatOutput = true;
$root = $dom->createElement( 'TS' );
... | php | public function openTranslationFileForWriting( $locale )
{
$filename = $this->buildTranslationFileName( $locale );
if ( !file_exists( $filename ) )
{
$dom = new DOMDocument( '1.0', 'UTF-8' );
$dom->formatOutput = true;
$root = $dom->createElement( 'TS' );
... | [
"public",
"function",
"openTranslationFileForWriting",
"(",
"$",
"locale",
")",
"{",
"$",
"filename",
"=",
"$",
"this",
"->",
"buildTranslationFileName",
"(",
"$",
"locale",
")",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"filename",
")",
")",
"{",
"$",... | Creates a DOM parser object for the locale $locale.
This function checks if the <i>location</i> setting is made, if the file
with the filename as returned by buildTranslationFileName() exists and
creates a DOM parser object for this file. If the setting
is not made, it throws an exception. IF the file does not exist, ... | [
"Creates",
"a",
"DOM",
"parser",
"object",
"for",
"the",
"locale",
"$locale",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Translation/src/backends/ts_backend.php#L248-L268 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Translation/src/backends/ts_backend.php | ezcTranslationTsBackend.parseSimpleXMLMessage | private function parseSimpleXMLMessage( SimpleXMLElement $message )
{
$status = ezcTranslationData::TRANSLATED;
if ( $message->translation['type'] == 'unfinished' )
{
$status = ezcTranslationData::UNFINISHED;
}
else if ( $message->translation['type'] == 'obsolete'... | php | private function parseSimpleXMLMessage( SimpleXMLElement $message )
{
$status = ezcTranslationData::TRANSLATED;
if ( $message->translation['type'] == 'unfinished' )
{
$status = ezcTranslationData::UNFINISHED;
}
else if ( $message->translation['type'] == 'obsolete'... | [
"private",
"function",
"parseSimpleXMLMessage",
"(",
"SimpleXMLElement",
"$",
"message",
")",
"{",
"$",
"status",
"=",
"ezcTranslationData",
"::",
"TRANSLATED",
";",
"if",
"(",
"$",
"message",
"->",
"translation",
"[",
"'type'",
"]",
"==",
"'unfinished'",
")",
... | Returns the data from the XML element $message as an
ezcTranslationData object.
@param SimpleXMLElement $message
@return ezcTranslationData | [
"Returns",
"the",
"data",
"from",
"the",
"XML",
"element",
"$message",
"as",
"an",
"ezcTranslationData",
"object",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Translation/src/backends/ts_backend.php#L277-L313 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Translation/src/backends/ts_backend.php | ezcTranslationTsBackend.getContext | public function getContext( $locale, $context )
{
$ts = $this->openTranslationFile( $locale );
$contextElements = array();
foreach ( $ts as $trContext )
{
if ( (string) $trContext->name == $context )
{
foreach ( $trContext as $message )
... | php | public function getContext( $locale, $context )
{
$ts = $this->openTranslationFile( $locale );
$contextElements = array();
foreach ( $ts as $trContext )
{
if ( (string) $trContext->name == $context )
{
foreach ( $trContext as $message )
... | [
"public",
"function",
"getContext",
"(",
"$",
"locale",
",",
"$",
"context",
")",
"{",
"$",
"ts",
"=",
"$",
"this",
"->",
"openTranslationFile",
"(",
"$",
"locale",
")",
";",
"$",
"contextElements",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"... | Returns a array containing a translation map for the locale $locale
and the context $context.
This method returns an array containing the translation map for the
specified $locale and $context. It uses the location and
format options to locate the file, unless caching is
enabled.
@throws ezcTranslationContextNotAvail... | [
"Returns",
"a",
"array",
"containing",
"a",
"translation",
"map",
"for",
"the",
"locale",
"$locale",
"and",
"the",
"context",
"$context",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Translation/src/backends/ts_backend.php#L335-L359 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Translation/src/backends/ts_backend.php | ezcTranslationTsBackend.getContextNames | public function getContextNames( $locale )
{
$ts = $this->openTranslationFile( $locale );
$contextNames = array();
foreach ( $ts as $trContext )
{
$contextNames[] = (string) $trContext->name;
}
return $contextNames;
} | php | public function getContextNames( $locale )
{
$ts = $this->openTranslationFile( $locale );
$contextNames = array();
foreach ( $ts as $trContext )
{
$contextNames[] = (string) $trContext->name;
}
return $contextNames;
} | [
"public",
"function",
"getContextNames",
"(",
"$",
"locale",
")",
"{",
"$",
"ts",
"=",
"$",
"this",
"->",
"openTranslationFile",
"(",
"$",
"locale",
")",
";",
"$",
"contextNames",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"ts",
"as",
"$",
"tr... | Returns a list with all context names for the locale $locale.
@throws ezcTranslationMissingTranslationFileException if the translation
file does not exist.
@throws ezcTranslationNotConfiguredException if the option <i>format</i>
is not set before this method is called.
@param string $locale
@return array(string) | [
"Returns",
"a",
"list",
"with",
"all",
"context",
"names",
"for",
"the",
"locale",
"$locale",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Translation/src/backends/ts_backend.php#L371-L380 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Translation/src/backends/ts_backend.php | ezcTranslationTsBackend.initReader | public function initReader( $locale )
{
$this->xmlParser = $this->openTranslationFile( $locale, 'SimpleXMLIterator' );
$this->xmlParser->rewind();
} | php | public function initReader( $locale )
{
$this->xmlParser = $this->openTranslationFile( $locale, 'SimpleXMLIterator' );
$this->xmlParser->rewind();
} | [
"public",
"function",
"initReader",
"(",
"$",
"locale",
")",
"{",
"$",
"this",
"->",
"xmlParser",
"=",
"$",
"this",
"->",
"openTranslationFile",
"(",
"$",
"locale",
",",
"'SimpleXMLIterator'",
")",
";",
"$",
"this",
"->",
"xmlParser",
"->",
"rewind",
"(",
... | Initializes the reader to read from locale $locale.
Opens the translation file.
@throws ezcTranslationNotConfiguredException if the option <i>format</i>
is not set before this method is called.
@param string $locale
@return void | [
"Initializes",
"the",
"reader",
"to",
"read",
"from",
"locale",
"$locale",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Translation/src/backends/ts_backend.php#L393-L397 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Translation/src/backends/ts_backend.php | ezcTranslationTsBackend.storeContext | public function storeContext( $context, array $data )
{
if ( is_null( $this->dom ) )
{
throw new ezcTranslationWriterNotInitializedException();
}
$dom = $this->dom;
$root = $dom->getElementsByTagName( 'TS' )->item( 0 );
// find the context element
... | php | public function storeContext( $context, array $data )
{
if ( is_null( $this->dom ) )
{
throw new ezcTranslationWriterNotInitializedException();
}
$dom = $this->dom;
$root = $dom->getElementsByTagName( 'TS' )->item( 0 );
// find the context element
... | [
"public",
"function",
"storeContext",
"(",
"$",
"context",
",",
"array",
"$",
"data",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"dom",
")",
")",
"{",
"throw",
"new",
"ezcTranslationWriterNotInitializedException",
"(",
")",
";",
"}",
"$",
"d... | Stores a context.
This method stores the context that it received to the backend specified
storage place.
@throws ezcTranslationWriterNotInitializedException when the writer is
not initialized with initWriter().
@param string $context The context's name
@param array(ezcTranslationData) $data The context's translatio... | [
"Stores",
"a",
"context",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Translation/src/backends/ts_backend.php#L426-L500 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Translation/src/backends/ts_backend.php | ezcTranslationTsBackend.initWriter | public function initWriter( $locale )
{
$this->dom = $this->openTranslationFileForWriting( $locale );
$this->writeLocale = $locale;
} | php | public function initWriter( $locale )
{
$this->dom = $this->openTranslationFileForWriting( $locale );
$this->writeLocale = $locale;
} | [
"public",
"function",
"initWriter",
"(",
"$",
"locale",
")",
"{",
"$",
"this",
"->",
"dom",
"=",
"$",
"this",
"->",
"openTranslationFileForWriting",
"(",
"$",
"locale",
")",
";",
"$",
"this",
"->",
"writeLocale",
"=",
"$",
"locale",
";",
"}"
] | Initializes the writer to write to locale $locale.
Opens the translation file.
@throws ezcTranslationNotConfiguredException if the option <i>format</i>
is not set before this method is called.
@param string $locale
@return void | [
"Initializes",
"the",
"writer",
"to",
"write",
"to",
"locale",
"$locale",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Translation/src/backends/ts_backend.php#L513-L517 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Translation/src/backends/ts_backend.php | ezcTranslationTsBackend.deinitWriter | public function deinitWriter()
{
if ( is_null( $this->dom ) )
{
throw new ezcTranslationWriterNotInitializedException();
}
$filename = $this->buildTranslationFileName( $this->writeLocale );
$this->dom->save( $filename );
} | php | public function deinitWriter()
{
if ( is_null( $this->dom ) )
{
throw new ezcTranslationWriterNotInitializedException();
}
$filename = $this->buildTranslationFileName( $this->writeLocale );
$this->dom->save( $filename );
} | [
"public",
"function",
"deinitWriter",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"dom",
")",
")",
"{",
"throw",
"new",
"ezcTranslationWriterNotInitializedException",
"(",
")",
";",
"}",
"$",
"filename",
"=",
"$",
"this",
"->",
"buildTrans... | Deinitializes the writer
@return void | [
"Deinitializes",
"the",
"writer"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Translation/src/backends/ts_backend.php#L524-L532 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Translation/src/backends/ts_backend.php | ezcTranslationTsBackend.next | public function next()
{
if ( is_null( $this->xmlParser ) )
{
throw new ezcTranslationReaderNotInitializedException();
}
$valid = $this->xmlParser->valid();
if ( $valid )
{
$newContext = array( trim( $this->xmlParser->getChildren()->name), arr... | php | public function next()
{
if ( is_null( $this->xmlParser ) )
{
throw new ezcTranslationReaderNotInitializedException();
}
$valid = $this->xmlParser->valid();
if ( $valid )
{
$newContext = array( trim( $this->xmlParser->getChildren()->name), arr... | [
"public",
"function",
"next",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"xmlParser",
")",
")",
"{",
"throw",
"new",
"ezcTranslationReaderNotInitializedException",
"(",
")",
";",
"}",
"$",
"valid",
"=",
"$",
"this",
"->",
"xmlParser",
"... | Advanced to the next context.
This method parses a little bit more of the XML file to be able to
return the next context. If no more contexts are available it sets the
$currentContext member variable to null, so that the valid() method can
pick this up. If there are more contexts available it reads the context
from ... | [
"Advanced",
"to",
"the",
"next",
"context",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Translation/src/backends/ts_backend.php#L548-L577 |
eloquent/cosmos | src/Eloquent/Cosmos/ClassName.php | ClassName.fromString | public static function fromString($className)
{
$atoms = explode(static::NAMESPACE_SEPARATOR, $className);
$isAbsolute = false;
if ('' === $atoms[0]) {
$isAbsolute = true;
array_shift($atoms);
}
return static::fromAtoms($atoms, $isAbsolute);
} | php | public static function fromString($className)
{
$atoms = explode(static::NAMESPACE_SEPARATOR, $className);
$isAbsolute = false;
if ('' === $atoms[0]) {
$isAbsolute = true;
array_shift($atoms);
}
return static::fromAtoms($atoms, $isAbsolute);
} | [
"public",
"static",
"function",
"fromString",
"(",
"$",
"className",
")",
"{",
"$",
"atoms",
"=",
"explode",
"(",
"static",
"::",
"NAMESPACE_SEPARATOR",
",",
"$",
"className",
")",
";",
"$",
"isAbsolute",
"=",
"false",
";",
"if",
"(",
"''",
"===",
"$",
... | @param string $className
@return ClassName | [
"@param",
"string",
"$className"
] | train | https://github.com/eloquent/cosmos/blob/0226b7aa39c629cdbb41bde759adff59d932d16d/src/Eloquent/Cosmos/ClassName.php#L24-L34 |
eloquent/cosmos | src/Eloquent/Cosmos/ClassName.php | ClassName.isEqualTo | public function isEqualTo(ClassName $className, Comparator $comparator = null)
{
if (null === $comparator) {
$comparator = new Comparator;
}
return $comparator->equals($this, $className);
} | php | public function isEqualTo(ClassName $className, Comparator $comparator = null)
{
if (null === $comparator) {
$comparator = new Comparator;
}
return $comparator->equals($this, $className);
} | [
"public",
"function",
"isEqualTo",
"(",
"ClassName",
"$",
"className",
",",
"Comparator",
"$",
"comparator",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparator",
")",
"{",
"$",
"comparator",
"=",
"new",
"Comparator",
";",
"}",
"return",
"$... | @param ClassName $className
@param Comparator|null $comparator
@return boolean | [
"@param",
"ClassName",
"$className",
"@param",
"Comparator|null",
"$comparator"
] | train | https://github.com/eloquent/cosmos/blob/0226b7aa39c629cdbb41bde759adff59d932d16d/src/Eloquent/Cosmos/ClassName.php#L76-L83 |
eloquent/cosmos | src/Eloquent/Cosmos/ClassName.php | ClassName.join | public function join(ClassName $className)
{
if ($className->isAbsolute()) {
throw new Exception\AbsoluteJoinException($className);
}
return static::joinAtomsArray($className->atoms());
} | php | public function join(ClassName $className)
{
if ($className->isAbsolute()) {
throw new Exception\AbsoluteJoinException($className);
}
return static::joinAtomsArray($className->atoms());
} | [
"public",
"function",
"join",
"(",
"ClassName",
"$",
"className",
")",
"{",
"if",
"(",
"$",
"className",
"->",
"isAbsolute",
"(",
")",
")",
"{",
"throw",
"new",
"Exception",
"\\",
"AbsoluteJoinException",
"(",
"$",
"className",
")",
";",
"}",
"return",
"... | @param ClassName $className
@return ClassName | [
"@param",
"ClassName",
"$className"
] | train | https://github.com/eloquent/cosmos/blob/0226b7aa39c629cdbb41bde759adff59d932d16d/src/Eloquent/Cosmos/ClassName.php#L100-L107 |
eloquent/cosmos | src/Eloquent/Cosmos/ClassName.php | ClassName.hasDescendant | public function hasDescendant(ClassName $className, Comparator $comparator = null)
{
if ($this->isAbsolute() !== $className->isAbsolute()) {
return false;
}
if (null === $comparator) {
$comparator = new Comparator;
}
while ($className->hasParent()) {... | php | public function hasDescendant(ClassName $className, Comparator $comparator = null)
{
if ($this->isAbsolute() !== $className->isAbsolute()) {
return false;
}
if (null === $comparator) {
$comparator = new Comparator;
}
while ($className->hasParent()) {... | [
"public",
"function",
"hasDescendant",
"(",
"ClassName",
"$",
"className",
",",
"Comparator",
"$",
"comparator",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isAbsolute",
"(",
")",
"!==",
"$",
"className",
"->",
"isAbsolute",
"(",
")",
")",
"{",... | @param ClassName $className
@param Comparator|null $comparator
@return boolean | [
"@param",
"ClassName",
"$className",
"@param",
"Comparator|null",
"$comparator"
] | train | https://github.com/eloquent/cosmos/blob/0226b7aa39c629cdbb41bde759adff59d932d16d/src/Eloquent/Cosmos/ClassName.php#L197-L215 |
eloquent/cosmos | src/Eloquent/Cosmos/ClassName.php | ClassName.stripNamespace | public function stripNamespace(ClassName $namespaceName)
{
if (!$namespaceName->hasDescendant($this)) {
throw new Exception\NamespaceMismatchException(
$this,
$namespaceName
);
}
$atoms = $this->atoms();
array_splice($atoms, 0,... | php | public function stripNamespace(ClassName $namespaceName)
{
if (!$namespaceName->hasDescendant($this)) {
throw new Exception\NamespaceMismatchException(
$this,
$namespaceName
);
}
$atoms = $this->atoms();
array_splice($atoms, 0,... | [
"public",
"function",
"stripNamespace",
"(",
"ClassName",
"$",
"namespaceName",
")",
"{",
"if",
"(",
"!",
"$",
"namespaceName",
"->",
"hasDescendant",
"(",
"$",
"this",
")",
")",
"{",
"throw",
"new",
"Exception",
"\\",
"NamespaceMismatchException",
"(",
"$",
... | @param ClassName $namespaceName
@return ClassName | [
"@param",
"ClassName",
"$namespaceName"
] | train | https://github.com/eloquent/cosmos/blob/0226b7aa39c629cdbb41bde759adff59d932d16d/src/Eloquent/Cosmos/ClassName.php#L222-L235 |
eloquent/cosmos | src/Eloquent/Cosmos/ClassName.php | ClassName.exists | public function exists($useAutoload = null, Isolator $isolator = null)
{
if (null === $useAutoload) {
$useAutoload = true;
}
$isolator = Isolator::get($isolator);
return $isolator->class_exists($this->string(), $useAutoload);
} | php | public function exists($useAutoload = null, Isolator $isolator = null)
{
if (null === $useAutoload) {
$useAutoload = true;
}
$isolator = Isolator::get($isolator);
return $isolator->class_exists($this->string(), $useAutoload);
} | [
"public",
"function",
"exists",
"(",
"$",
"useAutoload",
"=",
"null",
",",
"Isolator",
"$",
"isolator",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"useAutoload",
")",
"{",
"$",
"useAutoload",
"=",
"true",
";",
"}",
"$",
"isolator",
"=",
"I... | @param boolean|null $useAutoload
@param Isolator $isolator
@return boolean | [
"@param",
"boolean|null",
"$useAutoload",
"@param",
"Isolator",
"$isolator"
] | train | https://github.com/eloquent/cosmos/blob/0226b7aa39c629cdbb41bde759adff59d932d16d/src/Eloquent/Cosmos/ClassName.php#L243-L251 |
frdl/webfan | .ApplicationComposer/lib/frdl/aSQL/Engines/Terminal/CLI.php | CLI.state | public function state($state = null){
if($state !== null)$this->force_state($state);
return $this->state;
} | php | public function state($state = null){
if($state !== null)$this->force_state($state);
return $this->state;
} | [
"public",
"function",
"state",
"(",
"$",
"state",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"state",
"!==",
"null",
")",
"$",
"this",
"->",
"force_state",
"(",
"$",
"state",
")",
";",
"return",
"$",
"this",
"->",
"state",
";",
"}"
] | Core | [
"Core"
] | train | https://github.com/frdl/webfan/blob/84d270377685224e891cd9d571b103b36f05b845/.ApplicationComposer/lib/frdl/aSQL/Engines/Terminal/CLI.php#L127-L130 |
GreenCape/joomla-cli | src/GreenCape/JoomlaCLI/Driver/Factory.php | DriverFactory.create | public function create($basePath)
{
$parts = explode('.', $this->loadVersion($basePath)->getShortVersion());
while (!empty($parts))
{
$version = implode('Dot', $parts);
$classname = __NAMESPACE__ . '\\Joomla' . $version . 'Driver';
if (class_exists($classname))
{
return new $classname;
}
ar... | php | public function create($basePath)
{
$parts = explode('.', $this->loadVersion($basePath)->getShortVersion());
while (!empty($parts))
{
$version = implode('Dot', $parts);
$classname = __NAMESPACE__ . '\\Joomla' . $version . 'Driver';
if (class_exists($classname))
{
return new $classname;
}
ar... | [
"public",
"function",
"create",
"(",
"$",
"basePath",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"'.'",
",",
"$",
"this",
"->",
"loadVersion",
"(",
"$",
"basePath",
")",
"->",
"getShortVersion",
"(",
")",
")",
";",
"while",
"(",
"!",
"empty",
"(",
... | Create a version specific driver to Joomla
@param string $basePath The Joomla base path (same as JPATH_BASE within Joomla)
@return JoomlaDriver
@throws \RuntimeException | [
"Create",
"a",
"version",
"specific",
"driver",
"to",
"Joomla"
] | train | https://github.com/GreenCape/joomla-cli/blob/74a6940f27b1f66c99330d4f9e2c5ac314cdd369/src/GreenCape/JoomlaCLI/Driver/Factory.php#L52-L66 |
GreenCape/joomla-cli | src/GreenCape/JoomlaCLI/Driver/Factory.php | DriverFactory.loadVersion | private function loadVersion($basePath)
{
static $locations = array(
'/libraries/cms/version/version.php',
'/libraries/joomla/version.php',
);
define('_JEXEC', 1);
foreach ($locations as $location)
{
if (file_exists($basePath . $location))
{
$code = file_get_contents($basePath . $location);... | php | private function loadVersion($basePath)
{
static $locations = array(
'/libraries/cms/version/version.php',
'/libraries/joomla/version.php',
);
define('_JEXEC', 1);
foreach ($locations as $location)
{
if (file_exists($basePath . $location))
{
$code = file_get_contents($basePath . $location);... | [
"private",
"function",
"loadVersion",
"(",
"$",
"basePath",
")",
"{",
"static",
"$",
"locations",
"=",
"array",
"(",
"'/libraries/cms/version/version.php'",
",",
"'/libraries/joomla/version.php'",
",",
")",
";",
"define",
"(",
"'_JEXEC'",
",",
"1",
")",
";",
"fo... | Load the Joomla version
@param string $basePath The Joomla base path (same as JPATH_BASE within Joomla)
@return \JVersion
@throws \RuntimeException | [
"Load",
"the",
"Joomla",
"version"
] | train | https://github.com/GreenCape/joomla-cli/blob/74a6940f27b1f66c99330d4f9e2c5ac314cdd369/src/GreenCape/JoomlaCLI/Driver/Factory.php#L77-L98 |
nblum/silverstripe-flexible-content | code/ContentElement.php | ContentElement.LastChange | public function LastChange()
{
$today = new \DateTime(); // This object represents current date/time
$today->setTime(0, 0, 0); // reset time part, to prevent partial comparison
$dateTime = \DateTime::createFromFormat('Y-m-d H:i:s', $this->Changed);
if (!($dateTime instanceof \DateTi... | php | public function LastChange()
{
$today = new \DateTime(); // This object represents current date/time
$today->setTime(0, 0, 0); // reset time part, to prevent partial comparison
$dateTime = \DateTime::createFromFormat('Y-m-d H:i:s', $this->Changed);
if (!($dateTime instanceof \DateTi... | [
"public",
"function",
"LastChange",
"(",
")",
"{",
"$",
"today",
"=",
"new",
"\\",
"DateTime",
"(",
")",
";",
"// This object represents current date/time",
"$",
"today",
"->",
"setTime",
"(",
"0",
",",
"0",
",",
"0",
")",
";",
"// reset time part, to prevent ... | returns a readable last change/edit date
@return string|null | [
"returns",
"a",
"readable",
"last",
"change",
"/",
"edit",
"date"
] | train | https://github.com/nblum/silverstripe-flexible-content/blob/e20a06ee98b7f884965a951653d98af11eb6bc67/code/ContentElement.php#L177-L203 |
nblum/silverstripe-flexible-content | code/ContentElement.php | ContentElement.getReadableIdentifier | public function getReadableIdentifier()
{
return sprintf(
'%s%s',
$this->getField('ID'),
!empty(trim($this->getField('Title'))) ? '-' . urlencode(strtolower(trim($this->getField('Title')))) : ''
);
} | php | public function getReadableIdentifier()
{
return sprintf(
'%s%s',
$this->getField('ID'),
!empty(trim($this->getField('Title'))) ? '-' . urlencode(strtolower(trim($this->getField('Title')))) : ''
);
} | [
"public",
"function",
"getReadableIdentifier",
"(",
")",
"{",
"return",
"sprintf",
"(",
"'%s%s'",
",",
"$",
"this",
"->",
"getField",
"(",
"'ID'",
")",
",",
"!",
"empty",
"(",
"trim",
"(",
"$",
"this",
"->",
"getField",
"(",
"'Title'",
")",
")",
")",
... | creates a readable (page) unique identifier for the current content element | [
"creates",
"a",
"readable",
"(",
"page",
")",
"unique",
"identifier",
"for",
"the",
"current",
"content",
"element"
] | train | https://github.com/nblum/silverstripe-flexible-content/blob/e20a06ee98b7f884965a951653d98af11eb6bc67/code/ContentElement.php#L241-L248 |
nblum/silverstripe-flexible-content | code/ContentElement.php | ContentElement.getSiblings | public function getSiblings($active = '1')
{
$stage = \Nblum\FlexibleContent\FlexibleContentVersionedDataObject::get_live_stage();
$results = \Nblum\FlexibleContent\FlexibleContentVersionedDataObject::get_by_stage(
\ContentElement::class,
$stage
, [
'A... | php | public function getSiblings($active = '1')
{
$stage = \Nblum\FlexibleContent\FlexibleContentVersionedDataObject::get_live_stage();
$results = \Nblum\FlexibleContent\FlexibleContentVersionedDataObject::get_by_stage(
\ContentElement::class,
$stage
, [
'A... | [
"public",
"function",
"getSiblings",
"(",
"$",
"active",
"=",
"'1'",
")",
"{",
"$",
"stage",
"=",
"\\",
"Nblum",
"\\",
"FlexibleContent",
"\\",
"FlexibleContentVersionedDataObject",
"::",
"get_live_stage",
"(",
")",
";",
"$",
"results",
"=",
"\\",
"Nblum",
"... | returns all content element of the same page
@param string $active
@return DataList | [
"returns",
"all",
"content",
"element",
"of",
"the",
"same",
"page"
] | train | https://github.com/nblum/silverstripe-flexible-content/blob/e20a06ee98b7f884965a951653d98af11eb6bc67/code/ContentElement.php#L255-L268 |
nblum/silverstripe-flexible-content | code/ContentElement.php | ContentElement.forTemplate | public function forTemplate()
{
$template = $this->getClassName();
if (\SSViewer::hasTemplate($template)) {
return $this->renderWith($template);
}
return _t('ContentElement.missingTemplate', 'Missing Template for {template}', [
'template' => $template
... | php | public function forTemplate()
{
$template = $this->getClassName();
if (\SSViewer::hasTemplate($template)) {
return $this->renderWith($template);
}
return _t('ContentElement.missingTemplate', 'Missing Template for {template}', [
'template' => $template
... | [
"public",
"function",
"forTemplate",
"(",
")",
"{",
"$",
"template",
"=",
"$",
"this",
"->",
"getClassName",
"(",
")",
";",
"if",
"(",
"\\",
"SSViewer",
"::",
"hasTemplate",
"(",
"$",
"template",
")",
")",
"{",
"return",
"$",
"this",
"->",
"renderWith"... | @return \HTMLText | [
"@return",
"\\",
"HTMLText"
] | train | https://github.com/nblum/silverstripe-flexible-content/blob/e20a06ee98b7f884965a951653d98af11eb6bc67/code/ContentElement.php#L275-L286 |
neyaoz/laravel-view-control | src/ViewControl/ViewControlServiceProvider.php | ViewControlServiceProvider.bindInstancesInContainer | protected function bindInstancesInContainer()
{
$this->app->instance("view-control.path", $this->path());
$this->app->instance("view-control.path.base", $this->basePath());
} | php | protected function bindInstancesInContainer()
{
$this->app->instance("view-control.path", $this->path());
$this->app->instance("view-control.path.base", $this->basePath());
} | [
"protected",
"function",
"bindInstancesInContainer",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"instance",
"(",
"\"view-control.path\"",
",",
"$",
"this",
"->",
"path",
"(",
")",
")",
";",
"$",
"this",
"->",
"app",
"->",
"instance",
"(",
"\"view-contr... | Bind all of the instances in the container.
@return void | [
"Bind",
"all",
"of",
"the",
"instances",
"in",
"the",
"container",
"."
] | train | https://github.com/neyaoz/laravel-view-control/blob/2f49777a5cd81223cd36da2ef4385ccd036a4b1e/src/ViewControl/ViewControlServiceProvider.php#L42-L46 |
neyaoz/laravel-view-control | src/ViewControl/ViewControlServiceProvider.php | ViewControlServiceProvider.basePath | public function basePath($path = '')
{
return $this->getFilesystem()->dirname($this->path()) . ($path ? DIRECTORY_SEPARATOR . $path : $path);
} | php | public function basePath($path = '')
{
return $this->getFilesystem()->dirname($this->path()) . ($path ? DIRECTORY_SEPARATOR . $path : $path);
} | [
"public",
"function",
"basePath",
"(",
"$",
"path",
"=",
"''",
")",
"{",
"return",
"$",
"this",
"->",
"getFilesystem",
"(",
")",
"->",
"dirname",
"(",
"$",
"this",
"->",
"path",
"(",
")",
")",
".",
"(",
"$",
"path",
"?",
"DIRECTORY_SEPARATOR",
".",
... | Get the base path of the plugin installation.
@param string $path
@return string | [
"Get",
"the",
"base",
"path",
"of",
"the",
"plugin",
"installation",
"."
] | train | https://github.com/neyaoz/laravel-view-control/blob/2f49777a5cd81223cd36da2ef4385ccd036a4b1e/src/ViewControl/ViewControlServiceProvider.php#L123-L126 |
gedex/php-janrain-api | lib/Janrain/HttpClient/Listener/ErrorListener.php | ErrorListener.onRequestError | public function onRequestError(Event $event)
{
/** @var $request \Guzzle\Http\Message\Request */
$request = $event['request'];
$response = $request->getResponse();
$content = ResponseMediator::getContent($response);
if ($response->isClientError() || $response->isServerError() || (isset($content['stat']) &... | php | public function onRequestError(Event $event)
{
/** @var $request \Guzzle\Http\Message\Request */
$request = $event['request'];
$response = $request->getResponse();
$content = ResponseMediator::getContent($response);
if ($response->isClientError() || $response->isServerError() || (isset($content['stat']) &... | [
"public",
"function",
"onRequestError",
"(",
"Event",
"$",
"event",
")",
"{",
"/** @var $request \\Guzzle\\Http\\Message\\Request */",
"$",
"request",
"=",
"$",
"event",
"[",
"'request'",
"]",
";",
"$",
"response",
"=",
"$",
"request",
"->",
"getResponse",
"(",
... | {@inheritDoc} | [
"{"
] | train | https://github.com/gedex/php-janrain-api/blob/6283f68454e0ad5211ac620f1d337df38cd49597/lib/Janrain/HttpClient/Listener/ErrorListener.php#L34-L53 |
wenbinye/PhalconX | src/Mvc/RoleManager.php | RoleManager.checkAccess | public function checkAccess($user_id, $roles)
{
if ($this->isRoot($user_id)) {
return true;
}
if (is_array($roles)) {
return $this->hasRoles($user_id, $roles);
} elseif (strpos($roles, '|') !== false) {
return $this->hasAnyRole($user_id, explode('|... | php | public function checkAccess($user_id, $roles)
{
if ($this->isRoot($user_id)) {
return true;
}
if (is_array($roles)) {
return $this->hasRoles($user_id, $roles);
} elseif (strpos($roles, '|') !== false) {
return $this->hasAnyRole($user_id, explode('|... | [
"public",
"function",
"checkAccess",
"(",
"$",
"user_id",
",",
"$",
"roles",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isRoot",
"(",
"$",
"user_id",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"is_array",
"(",
"$",
"roles",
")",
")",
"{"... | 检查用户是否包含指定的所有权限
@param string $user_id
@param string|array $roles | 表示或,&表示与
@return bool | [
"检查用户是否包含指定的所有权限"
] | train | https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Mvc/RoleManager.php#L191-L203 |
Isset/pushnotification | src/PushNotification/Type/Android/AndroidConnection.php | AndroidConnection.sendAndReceive | public function sendAndReceive(Message $message): Response
{
/* @var AndroidMessage $message */
$data = $message->getMessage();
if ($this->dryRun) {
$data['dry_run'] = true;
}
$response = new ConnectionResponseImpl();
try {
$requestData = json_... | php | public function sendAndReceive(Message $message): Response
{
/* @var AndroidMessage $message */
$data = $message->getMessage();
if ($this->dryRun) {
$data['dry_run'] = true;
}
$response = new ConnectionResponseImpl();
try {
$requestData = json_... | [
"public",
"function",
"sendAndReceive",
"(",
"Message",
"$",
"message",
")",
":",
"Response",
"{",
"/* @var AndroidMessage $message */",
"$",
"data",
"=",
"$",
"message",
"->",
"getMessage",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"dryRun",
")",
"{",
... | @param Message $message
@return Response | [
"@param",
"Message",
"$message"
] | train | https://github.com/Isset/pushnotification/blob/5e7634dc6b1cf4f7c371d1890243a25252db0d85/src/PushNotification/Type/Android/AndroidConnection.php#L88-L109 |
gdbots/iam-php | src/Validator/UserValidator.php | UserValidator.ensureEmailIsAvailable | protected function ensureEmailIsAvailable(PbjxEvent $pbjxEvent, NodeRef $nodeRef, string $email): void
{
$pbjx = $pbjxEvent::getPbjx();
$command = $pbjxEvent->getMessage();
try {
$request = $this->createGetUserRequest($command, $nodeRef, $pbjx)
->set('consistent_... | php | protected function ensureEmailIsAvailable(PbjxEvent $pbjxEvent, NodeRef $nodeRef, string $email): void
{
$pbjx = $pbjxEvent::getPbjx();
$command = $pbjxEvent->getMessage();
try {
$request = $this->createGetUserRequest($command, $nodeRef, $pbjx)
->set('consistent_... | [
"protected",
"function",
"ensureEmailIsAvailable",
"(",
"PbjxEvent",
"$",
"pbjxEvent",
",",
"NodeRef",
"$",
"nodeRef",
",",
"string",
"$",
"email",
")",
":",
"void",
"{",
"$",
"pbjx",
"=",
"$",
"pbjxEvent",
"::",
"getPbjx",
"(",
")",
";",
"$",
"command",
... | @param PbjxEvent $pbjxEvent
@param NodeRef $nodeRef
@param string $email
@throws UserAlreadyExists
@throws \Throwable | [
"@param",
"PbjxEvent",
"$pbjxEvent",
"@param",
"NodeRef",
"$nodeRef",
"@param",
"string",
"$email"
] | train | https://github.com/gdbots/iam-php/blob/3dbfa602de183a7ac5fb5140304e8cf4c4b15ab3/src/Validator/UserValidator.php#L84-L122 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.