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 |
|---|---|---|---|---|---|---|---|---|---|---|
leedavis81/altr-ego | library/AltrEgo/Adapter/Php54.php | Php54._get | public function _get($name)
{
$object = $this->getObject();
$callable = function() use ($name, $object) {
if (!property_exists($object, $name) && !method_exists($object, '__get'))
{
throw new \Exception('Property ' . $name . ' doesn\'t exist on object of class ' . get_class($object));
}
if... | php | public function _get($name)
{
$object = $this->getObject();
$callable = function() use ($name, $object) {
if (!property_exists($object, $name) && !method_exists($object, '__get'))
{
throw new \Exception('Property ' . $name . ' doesn\'t exist on object of class ' . get_class($object));
}
if... | [
"public",
"function",
"_get",
"(",
"$",
"name",
")",
"{",
"$",
"object",
"=",
"$",
"this",
"->",
"getObject",
"(",
")",
";",
"$",
"callable",
"=",
"function",
"(",
")",
"use",
"(",
"$",
"name",
",",
"$",
"object",
")",
"{",
"if",
"(",
"!",
"pro... | (non-PHPdoc)
@see AltrEgo\Adapter.AdapterInterface::_get() | [
"(",
"non",
"-",
"PHPdoc",
")"
] | train | https://github.com/leedavis81/altr-ego/blob/1556556a33c2b6caddef94444522c5bbffc217c7/library/AltrEgo/Adapter/Php54.php#L63-L78 |
leedavis81/altr-ego | library/AltrEgo/Adapter/Php54.php | Php54._set | public function _set($name, $value)
{
$object = $this->getObject();
$callable = function() use ($name, $value, $object) {
if (!property_exists($object, $name) && !method_exists($object, '__set'))
{
throw new \Exception('Property ' . $name . ' doesn\'t exist on object of class ' . get_class($obje... | php | public function _set($name, $value)
{
$object = $this->getObject();
$callable = function() use ($name, $value, $object) {
if (!property_exists($object, $name) && !method_exists($object, '__set'))
{
throw new \Exception('Property ' . $name . ' doesn\'t exist on object of class ' . get_class($obje... | [
"public",
"function",
"_set",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"$",
"object",
"=",
"$",
"this",
"->",
"getObject",
"(",
")",
";",
"$",
"callable",
"=",
"function",
"(",
")",
"use",
"(",
"$",
"name",
",",
"$",
"value",
",",
"$",
"o... | (non-PHPdoc)
@see AltrEgo\Adapter.AdapterInterface::_set() | [
"(",
"non",
"-",
"PHPdoc",
")"
] | train | https://github.com/leedavis81/altr-ego/blob/1556556a33c2b6caddef94444522c5bbffc217c7/library/AltrEgo/Adapter/Php54.php#L83-L94 |
leedavis81/altr-ego | library/AltrEgo/Adapter/Php54.php | Php54._callStatic | public static function _callStatic($object, $name, $arguments)
{
if (is_object($object))
{
$class = ($object instanceof AltrEgo) ? get_class($object->getObject()) : get_class($object);
} elseif (!class_exists($object))
{
throw new \Exception('Static call (callStatic) to AltrEgo must be passed either a... | php | public static function _callStatic($object, $name, $arguments)
{
if (is_object($object))
{
$class = ($object instanceof AltrEgo) ? get_class($object->getObject()) : get_class($object);
} elseif (!class_exists($object))
{
throw new \Exception('Static call (callStatic) to AltrEgo must be passed either a... | [
"public",
"static",
"function",
"_callStatic",
"(",
"$",
"object",
",",
"$",
"name",
",",
"$",
"arguments",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"object",
")",
")",
"{",
"$",
"class",
"=",
"(",
"$",
"object",
"instanceof",
"AltrEgo",
")",
"?",... | (non-PHPdoc)
@see AltrEgo\Adapter.AdapterInterface::_callStatic() | [
"(",
"non",
"-",
"PHPdoc",
")"
] | train | https://github.com/leedavis81/altr-ego/blob/1556556a33c2b6caddef94444522c5bbffc217c7/library/AltrEgo/Adapter/Php54.php#L108-L121 |
spiral-modules/scaffolder | source/Scaffolder/AbstractCommand.php | AbstractCommand.createDeclaration | protected function createDeclaration(array $parameters = []): ClassDeclaration
{
return $this->container->get(FactoryInterface::class)->make(
$this->config->declarationClass(static::ELEMENT),
[
'name' => $this->getClass(),
'comment' => (string)$this... | php | protected function createDeclaration(array $parameters = []): ClassDeclaration
{
return $this->container->get(FactoryInterface::class)->make(
$this->config->declarationClass(static::ELEMENT),
[
'name' => $this->getClass(),
'comment' => (string)$this... | [
"protected",
"function",
"createDeclaration",
"(",
"array",
"$",
"parameters",
"=",
"[",
"]",
")",
":",
"ClassDeclaration",
"{",
"return",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"FactoryInterface",
"::",
"class",
")",
"->",
"make",
"(",
"$",
"th... | @param array $parameters
@return ClassDeclaration | [
"@param",
"array",
"$parameters"
] | train | https://github.com/spiral-modules/scaffolder/blob/9be9dd0da6e4b02232db24e797fe5c288afbbddf/source/Scaffolder/AbstractCommand.php#L56-L65 |
spiral-modules/scaffolder | source/Scaffolder/AbstractCommand.php | AbstractCommand.writeDeclaration | protected function writeDeclaration(ClassDeclaration $declaration, string $type = null)
{
$type = $type ?? static::ELEMENT;
$filename = $this->config->classFilename($type, $this->argument('name'));
$filename = $this->files->normalizePath($filename);
if ($this->files->exists($filena... | php | protected function writeDeclaration(ClassDeclaration $declaration, string $type = null)
{
$type = $type ?? static::ELEMENT;
$filename = $this->config->classFilename($type, $this->argument('name'));
$filename = $this->files->normalizePath($filename);
if ($this->files->exists($filena... | [
"protected",
"function",
"writeDeclaration",
"(",
"ClassDeclaration",
"$",
"declaration",
",",
"string",
"$",
"type",
"=",
"null",
")",
"{",
"$",
"type",
"=",
"$",
"type",
"??",
"static",
"::",
"ELEMENT",
";",
"$",
"filename",
"=",
"$",
"this",
"->",
"co... | Write declaration into file.
@param ClassDeclaration $declaration
@param string $type If null static::ELEMENT to be used. | [
"Write",
"declaration",
"into",
"file",
"."
] | train | https://github.com/spiral-modules/scaffolder/blob/9be9dd0da6e4b02232db24e797fe5c288afbbddf/source/Scaffolder/AbstractCommand.php#L86-L121 |
joomlatools/joomlatools-platform-legacy | code/table/session.php | JTableSession.insert | public function insert($sessionId, $clientId)
{
$this->session_id = $sessionId;
$this->client_id = $clientId;
$this->time = time();
$ret = $this->_db->insertObject($this->_tbl, $this, 'session_id');
if (!$ret)
{
$this->setError(JText::sprintf('JLIB_DATABASE_ERROR_STORE_FAILED', strtolower(get_class($t... | php | public function insert($sessionId, $clientId)
{
$this->session_id = $sessionId;
$this->client_id = $clientId;
$this->time = time();
$ret = $this->_db->insertObject($this->_tbl, $this, 'session_id');
if (!$ret)
{
$this->setError(JText::sprintf('JLIB_DATABASE_ERROR_STORE_FAILED', strtolower(get_class($t... | [
"public",
"function",
"insert",
"(",
"$",
"sessionId",
",",
"$",
"clientId",
")",
"{",
"$",
"this",
"->",
"session_id",
"=",
"$",
"sessionId",
";",
"$",
"this",
"->",
"client_id",
"=",
"$",
"clientId",
";",
"$",
"this",
"->",
"time",
"=",
"time",
"("... | Insert a session
@param string $sessionId The session id
@param integer $clientId The id of the client application
@return boolean True on success
@since 11.1
@deprecated 13.3 Use SQL queries to interact with the session table. | [
"Insert",
"a",
"session"
] | train | https://github.com/joomlatools/joomlatools-platform-legacy/blob/3a76944e2f2c415faa6504754c75321a3b478c06/code/table/session.php#L48-L66 |
joomlatools/joomlatools-platform-legacy | code/table/session.php | JTableSession.update | public function update($updateNulls = false)
{
$this->time = time();
$ret = $this->_db->updateObject($this->_tbl, $this, 'session_id', $updateNulls);
if (!$ret)
{
$this->setError(JText::sprintf('JLIB_DATABASE_ERROR_STORE_FAILED', strtolower(get_class($this)), $this->_db->stderr()));
return false;
}
... | php | public function update($updateNulls = false)
{
$this->time = time();
$ret = $this->_db->updateObject($this->_tbl, $this, 'session_id', $updateNulls);
if (!$ret)
{
$this->setError(JText::sprintf('JLIB_DATABASE_ERROR_STORE_FAILED', strtolower(get_class($this)), $this->_db->stderr()));
return false;
}
... | [
"public",
"function",
"update",
"(",
"$",
"updateNulls",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"time",
"=",
"time",
"(",
")",
";",
"$",
"ret",
"=",
"$",
"this",
"->",
"_db",
"->",
"updateObject",
"(",
"$",
"this",
"->",
"_tbl",
",",
"$",
"th... | Updates the session
@param boolean $updateNulls True to update fields even if they are null.
@return boolean True on success.
@since 11.1
@deprecated 13.3 Use SQL queries to interact with the session table. | [
"Updates",
"the",
"session"
] | train | https://github.com/joomlatools/joomlatools-platform-legacy/blob/3a76944e2f2c415faa6504754c75321a3b478c06/code/table/session.php#L78-L93 |
joomlatools/joomlatools-platform-legacy | code/table/session.php | JTableSession.destroy | public function destroy($userId, $clientIds = array())
{
$clientIds = implode(',', $clientIds);
$query = $this->_db->getQuery(true)
->delete($this->_db->quoteName($this->_tbl))
->where($this->_db->quoteName('userid') . ' = ' . $this->_db->quote($userId))
->where($this->_db->quoteName('client_id') . ' IN ... | php | public function destroy($userId, $clientIds = array())
{
$clientIds = implode(',', $clientIds);
$query = $this->_db->getQuery(true)
->delete($this->_db->quoteName($this->_tbl))
->where($this->_db->quoteName('userid') . ' = ' . $this->_db->quote($userId))
->where($this->_db->quoteName('client_id') . ' IN ... | [
"public",
"function",
"destroy",
"(",
"$",
"userId",
",",
"$",
"clientIds",
"=",
"array",
"(",
")",
")",
"{",
"$",
"clientIds",
"=",
"implode",
"(",
"','",
",",
"$",
"clientIds",
")",
";",
"$",
"query",
"=",
"$",
"this",
"->",
"_db",
"->",
"getQuer... | Destroys the pre-existing session
@param integer $userId Identifier of the user for this session.
@param array $clientIds Array of client ids for which session(s) will be destroyed
@return boolean True on success.
@since 11.1
@deprecated 13.3 Use SQL queries to interact with the session table. | [
"Destroys",
"the",
"pre",
"-",
"existing",
"session"
] | train | https://github.com/joomlatools/joomlatools-platform-legacy/blob/3a76944e2f2c415faa6504754c75321a3b478c06/code/table/session.php#L106-L124 |
joomlatools/joomlatools-platform-legacy | code/table/session.php | JTableSession.purge | public function purge($maxLifetime = 1440)
{
$past = time() - $maxLifetime;
$query = $this->_db->getQuery(true)
->delete($this->_db->quoteName($this->_tbl))
->where($this->_db->quoteName('time') . ' < ' . (int) $past);
$this->_db->setQuery($query);
return $this->_db->execute();
} | php | public function purge($maxLifetime = 1440)
{
$past = time() - $maxLifetime;
$query = $this->_db->getQuery(true)
->delete($this->_db->quoteName($this->_tbl))
->where($this->_db->quoteName('time') . ' < ' . (int) $past);
$this->_db->setQuery($query);
return $this->_db->execute();
} | [
"public",
"function",
"purge",
"(",
"$",
"maxLifetime",
"=",
"1440",
")",
"{",
"$",
"past",
"=",
"time",
"(",
")",
"-",
"$",
"maxLifetime",
";",
"$",
"query",
"=",
"$",
"this",
"->",
"_db",
"->",
"getQuery",
"(",
"true",
")",
"->",
"delete",
"(",
... | Purge old sessions
@param integer $maxLifetime Session age in seconds
@return mixed Resource on success, null on fail
@since 11.1
@deprecated 13.3 Use SQL queries to interact with the session table. | [
"Purge",
"old",
"sessions"
] | train | https://github.com/joomlatools/joomlatools-platform-legacy/blob/3a76944e2f2c415faa6504754c75321a3b478c06/code/table/session.php#L136-L145 |
joomlatools/joomlatools-platform-legacy | code/table/session.php | JTableSession.exists | public function exists($userid)
{
$query = $this->_db->getQuery(true)
->select('COUNT(userid)')
->from($this->_db->quoteName($this->_tbl))
->where($this->_db->quoteName('userid') . ' = ' . $this->_db->quote($userid));
$this->_db->setQuery($query);
if (!$result = $this->_db->loadResult())
{
$this->... | php | public function exists($userid)
{
$query = $this->_db->getQuery(true)
->select('COUNT(userid)')
->from($this->_db->quoteName($this->_tbl))
->where($this->_db->quoteName('userid') . ' = ' . $this->_db->quote($userid));
$this->_db->setQuery($query);
if (!$result = $this->_db->loadResult())
{
$this->... | [
"public",
"function",
"exists",
"(",
"$",
"userid",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"_db",
"->",
"getQuery",
"(",
"true",
")",
"->",
"select",
"(",
"'COUNT(userid)'",
")",
"->",
"from",
"(",
"$",
"this",
"->",
"_db",
"->",
"quoteName"... | Find out if a user has one or more active sessions
@param integer $userid The identifier of the user
@return boolean True if a session for this user exists
@since 11.1
@deprecated 13.3 Use SQL queries to interact with the session table. | [
"Find",
"out",
"if",
"a",
"user",
"has",
"one",
"or",
"more",
"active",
"sessions"
] | train | https://github.com/joomlatools/joomlatools-platform-legacy/blob/3a76944e2f2c415faa6504754c75321a3b478c06/code/table/session.php#L157-L173 |
joomlatools/joomlatools-platform-legacy | code/table/session.php | JTableSession.delete | public function delete($oid = null)
{
$k = $this->_tbl_key;
if ($oid)
{
$this->$k = $oid;
}
$query = $this->_db->getQuery(true)
->delete($this->_db->quoteName($this->_tbl))
->where($this->_db->quoteName($this->_tbl_key) . ' = ' . $this->_db->quote($this->$k));
$this->_db->setQuery($query);
$t... | php | public function delete($oid = null)
{
$k = $this->_tbl_key;
if ($oid)
{
$this->$k = $oid;
}
$query = $this->_db->getQuery(true)
->delete($this->_db->quoteName($this->_tbl))
->where($this->_db->quoteName($this->_tbl_key) . ' = ' . $this->_db->quote($this->$k));
$this->_db->setQuery($query);
$t... | [
"public",
"function",
"delete",
"(",
"$",
"oid",
"=",
"null",
")",
"{",
"$",
"k",
"=",
"$",
"this",
"->",
"_tbl_key",
";",
"if",
"(",
"$",
"oid",
")",
"{",
"$",
"this",
"->",
"$",
"k",
"=",
"$",
"oid",
";",
"}",
"$",
"query",
"=",
"$",
"thi... | Overloaded delete method
We must override it because of the non-integer primary key
@param integer $oid The object id (optional).
@return mixed True if successful otherwise an error message
@since 11.1
@deprecated 13.3 Use SQL queries to interact with the session table. | [
"Overloaded",
"delete",
"method"
] | train | https://github.com/joomlatools/joomlatools-platform-legacy/blob/3a76944e2f2c415faa6504754c75321a3b478c06/code/table/session.php#L187-L204 |
zhiyicx/thinksns-theme-stv1 | _static/js/um/php/Uploader.class.php | Uploader.upFile | private function upFile($base64)
{
//处理base64上传
if ('base64' == $base64) {
$content = $_POST[ $this->fileField ];
$this->base64ToImage($content);
return;
}
//处理普通上传
$file = $this->file = $_FILES[ $this->fileField ];
if (!$file) {
... | php | private function upFile($base64)
{
//处理base64上传
if ('base64' == $base64) {
$content = $_POST[ $this->fileField ];
$this->base64ToImage($content);
return;
}
//处理普通上传
$file = $this->file = $_FILES[ $this->fileField ];
if (!$file) {
... | [
"private",
"function",
"upFile",
"(",
"$",
"base64",
")",
"{",
"//处理base64上传",
"if",
"(",
"'base64'",
"==",
"$",
"base64",
")",
"{",
"$",
"content",
"=",
"$",
"_POST",
"[",
"$",
"this",
"->",
"fileField",
"]",
";",
"$",
"this",
"->",
"base64ToImage",
... | 上传文件的主处理方法
@param $base64
@return mixed | [
"上传文件的主处理方法"
] | train | https://github.com/zhiyicx/thinksns-theme-stv1/blob/e250d1eb7a6af9390cc657bc1c2f9072b81ac0c9/_static/js/um/php/Uploader.class.php#L56-L114 |
zhiyicx/thinksns-theme-stv1 | _static/js/um/php/Uploader.class.php | Uploader.base64ToImage | private function base64ToImage($base64Data)
{
$img = base64_decode($base64Data);
$this->fileName = time().rand(1, 10000).'.png';
$this->fullName = $this->getFolder().'/'.$this->fileName;
if (!file_put_contents($this->fullName, $img)) {
$this->stateInfo = $this->getStateIn... | php | private function base64ToImage($base64Data)
{
$img = base64_decode($base64Data);
$this->fileName = time().rand(1, 10000).'.png';
$this->fullName = $this->getFolder().'/'.$this->fileName;
if (!file_put_contents($this->fullName, $img)) {
$this->stateInfo = $this->getStateIn... | [
"private",
"function",
"base64ToImage",
"(",
"$",
"base64Data",
")",
"{",
"$",
"img",
"=",
"base64_decode",
"(",
"$",
"base64Data",
")",
";",
"$",
"this",
"->",
"fileName",
"=",
"time",
"(",
")",
".",
"rand",
"(",
"1",
",",
"10000",
")",
".",
"'.png'... | 处理base64编码的图片上传
@param $base64Data
@return mixed | [
"处理base64编码的图片上传"
] | train | https://github.com/zhiyicx/thinksns-theme-stv1/blob/e250d1eb7a6af9390cc657bc1c2f9072b81ac0c9/_static/js/um/php/Uploader.class.php#L121-L134 |
zhiyicx/thinksns-theme-stv1 | _static/js/um/php/Uploader.class.php | Uploader.getFolder | private function getFolder()
{
$pathStr = $this->config[ 'savePath' ];
if (strrchr($pathStr, '/') != '/') {
$pathStr .= '/';
}
$pathStr .= date('Ymd');
if (!file_exists($pathStr)) {
if (!mkdir($pathStr, 0777, true)) {
return false;
... | php | private function getFolder()
{
$pathStr = $this->config[ 'savePath' ];
if (strrchr($pathStr, '/') != '/') {
$pathStr .= '/';
}
$pathStr .= date('Ymd');
if (!file_exists($pathStr)) {
if (!mkdir($pathStr, 0777, true)) {
return false;
... | [
"private",
"function",
"getFolder",
"(",
")",
"{",
"$",
"pathStr",
"=",
"$",
"this",
"->",
"config",
"[",
"'savePath'",
"]",
";",
"if",
"(",
"strrchr",
"(",
"$",
"pathStr",
",",
"'/'",
")",
"!=",
"'/'",
")",
"{",
"$",
"pathStr",
".=",
"'/'",
";",
... | 按照日期自动创建存储文件夹
@return string | [
"按照日期自动创建存储文件夹"
] | train | https://github.com/zhiyicx/thinksns-theme-stv1/blob/e250d1eb7a6af9390cc657bc1c2f9072b81ac0c9/_static/js/um/php/Uploader.class.php#L202-L216 |
yuncms/framework | src/admin/models/UserSearch.php | UserSearch.search | public function search($params)
{
$query = User::find()->orderBy(['id' => SORT_DESC]);
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
if (!($this->load($params) && $this->validate())) {
return $dataProvider;
}
$query->andFil... | php | public function search($params)
{
$query = User::find()->orderBy(['id' => SORT_DESC]);
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
if (!($this->load($params) && $this->validate())) {
return $dataProvider;
}
$query->andFil... | [
"public",
"function",
"search",
"(",
"$",
"params",
")",
"{",
"$",
"query",
"=",
"User",
"::",
"find",
"(",
")",
"->",
"orderBy",
"(",
"[",
"'id'",
"=>",
"SORT_DESC",
"]",
")",
";",
"$",
"dataProvider",
"=",
"new",
"ActiveDataProvider",
"(",
"[",
"'q... | @param $params
@return ActiveDataProvider | [
"@param",
"$params"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/admin/models/UserSearch.php#L63-L89 |
yuncms/framework | src/admin/controllers/AssignmentController.php | AssignmentController.findModel | protected function findModel($id)
{
/** @var \yii\web\IdentityInterface $class */
$class = $this->userClassName;
if (($user = $class::findIdentity($id)) !== null) {
return new AdminAssignment($id, $user);
} else {
throw new NotFoundHttpException(Yii::t('yuncms... | php | protected function findModel($id)
{
/** @var \yii\web\IdentityInterface $class */
$class = $this->userClassName;
if (($user = $class::findIdentity($id)) !== null) {
return new AdminAssignment($id, $user);
} else {
throw new NotFoundHttpException(Yii::t('yuncms... | [
"protected",
"function",
"findModel",
"(",
"$",
"id",
")",
"{",
"/** @var \\yii\\web\\IdentityInterface $class */",
"$",
"class",
"=",
"$",
"this",
"->",
"userClassName",
";",
"if",
"(",
"(",
"$",
"user",
"=",
"$",
"class",
"::",
"findIdentity",
"(",
"$",
"i... | Finds the Assignment model based on its primary key value.
If the model is not found, a 404 HTTP exception will be thrown.
@param integer $id
@return AdminAssignment the loaded model
@throws NotFoundHttpException if the model cannot be found | [
"Finds",
"the",
"Assignment",
"model",
"based",
"on",
"its",
"primary",
"key",
"value",
".",
"If",
"the",
"model",
"is",
"not",
"found",
"a",
"404",
"HTTP",
"exception",
"will",
"be",
"thrown",
"."
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/admin/controllers/AssignmentController.php#L127-L136 |
steeffeen/FancyManiaLinks | FML/Controls/FrameInstance.php | FrameInstance.setModelId | public function setModelId($modelId)
{
$this->modelId = (string)$modelId;
$this->model = null;
return $this;
} | php | public function setModelId($modelId)
{
$this->modelId = (string)$modelId;
$this->model = null;
return $this;
} | [
"public",
"function",
"setModelId",
"(",
"$",
"modelId",
")",
"{",
"$",
"this",
"->",
"modelId",
"=",
"(",
"string",
")",
"$",
"modelId",
";",
"$",
"this",
"->",
"model",
"=",
"null",
";",
"return",
"$",
"this",
";",
"}"
] | Set the FrameModel id
@api
@param string $modelId FrameModel id
@return static | [
"Set",
"the",
"FrameModel",
"id"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Controls/FrameInstance.php#L74-L79 |
steeffeen/FancyManiaLinks | FML/Controls/FrameInstance.php | FrameInstance.setModel | public function setModel(FrameModel $frameModel)
{
$this->modelId = null;
$this->model = $frameModel;
return $this;
} | php | public function setModel(FrameModel $frameModel)
{
$this->modelId = null;
$this->model = $frameModel;
return $this;
} | [
"public",
"function",
"setModel",
"(",
"FrameModel",
"$",
"frameModel",
")",
"{",
"$",
"this",
"->",
"modelId",
"=",
"null",
";",
"$",
"this",
"->",
"model",
"=",
"$",
"frameModel",
";",
"return",
"$",
"this",
";",
"}"
] | Set the FrameModel
@api
@param FrameModel $frameModel FrameModel
@return static | [
"Set",
"the",
"FrameModel"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Controls/FrameInstance.php#L99-L104 |
steeffeen/FancyManiaLinks | FML/Script/Builder.php | Builder.escapeText | public static function escapeText($text, $addApostrophes = true)
{
$dangers = array('\\', '"', "\n");
$replacements = array('\\\\', '\\"', '\\n');
$escapedText = str_ireplace($dangers, $replacements, $text);
if ($addApostrophes) {
$escapedText = '"' . $escapedText .... | php | public static function escapeText($text, $addApostrophes = true)
{
$dangers = array('\\', '"', "\n");
$replacements = array('\\\\', '\\"', '\\n');
$escapedText = str_ireplace($dangers, $replacements, $text);
if ($addApostrophes) {
$escapedText = '"' . $escapedText .... | [
"public",
"static",
"function",
"escapeText",
"(",
"$",
"text",
",",
"$",
"addApostrophes",
"=",
"true",
")",
"{",
"$",
"dangers",
"=",
"array",
"(",
"'\\\\'",
",",
"'\"'",
",",
"\"\\n\"",
")",
";",
"$",
"replacements",
"=",
"array",
"(",
"'\\\\\\\\'",
... | Escape dangerous characters in the given text
@api
@param string $text Text to escape
@param bool $addApostrophes (optional) Add apostrophes before and after the text
@return string | [
"Escape",
"dangerous",
"characters",
"in",
"the",
"given",
"text"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Builder.php#L52-L61 |
steeffeen/FancyManiaLinks | FML/Script/Builder.php | Builder.getReal | public static function getReal($value)
{
$value = (float)$value;
$stringVal = (string)$value;
if (!fmod($value, 1)) {
$stringVal .= ".";
}
return $stringVal;
} | php | public static function getReal($value)
{
$value = (float)$value;
$stringVal = (string)$value;
if (!fmod($value, 1)) {
$stringVal .= ".";
}
return $stringVal;
} | [
"public",
"static",
"function",
"getReal",
"(",
"$",
"value",
")",
"{",
"$",
"value",
"=",
"(",
"float",
")",
"$",
"value",
";",
"$",
"stringVal",
"=",
"(",
"string",
")",
"$",
"value",
";",
"if",
"(",
"!",
"fmod",
"(",
"$",
"value",
",",
"1",
... | Get the 'Real' string representation of the given value
@api
@param float $value Float value to convert to a ManiaScript 'Real'
@return string | [
"Get",
"the",
"Real",
"string",
"representation",
"of",
"the",
"given",
"value"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Builder.php#L105-L113 |
steeffeen/FancyManiaLinks | FML/Script/Builder.php | Builder.getVec2 | public static function getVec2($valueX, $valueY = null)
{
if (is_array($valueX)) {
$valueY = (isset($valueX[1]) ? $valueX[1] : 0.);
$valueX = (isset($valueX[0]) ? $valueX[0] : 0.);
}
return "<" . static::getReal($valueX) . "," . static::getReal($valueY) . ">";
} | php | public static function getVec2($valueX, $valueY = null)
{
if (is_array($valueX)) {
$valueY = (isset($valueX[1]) ? $valueX[1] : 0.);
$valueX = (isset($valueX[0]) ? $valueX[0] : 0.);
}
return "<" . static::getReal($valueX) . "," . static::getReal($valueY) . ">";
} | [
"public",
"static",
"function",
"getVec2",
"(",
"$",
"valueX",
",",
"$",
"valueY",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"valueX",
")",
")",
"{",
"$",
"valueY",
"=",
"(",
"isset",
"(",
"$",
"valueX",
"[",
"1",
"]",
")",
"?",
"... | Get the Vec3 representation for the given values
@api
@param float|float[] $valueX Value X
@param float $valueY (optional) Value Y
@return string | [
"Get",
"the",
"Vec3",
"representation",
"for",
"the",
"given",
"values"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Builder.php#L139-L146 |
steeffeen/FancyManiaLinks | FML/Script/Builder.php | Builder.getVec3 | public static function getVec3($valueX, $valueY = null, $valueZ = null)
{
if (is_array($valueX)) {
$valueZ = (isset($valueX[2]) ? $valueX[2] : 0.);
$valueY = (isset($valueX[1]) ? $valueX[1] : 0.);
$valueX = (isset($valueX[0]) ? $valueX[0] : 0.);
}
return "... | php | public static function getVec3($valueX, $valueY = null, $valueZ = null)
{
if (is_array($valueX)) {
$valueZ = (isset($valueX[2]) ? $valueX[2] : 0.);
$valueY = (isset($valueX[1]) ? $valueX[1] : 0.);
$valueX = (isset($valueX[0]) ? $valueX[0] : 0.);
}
return "... | [
"public",
"static",
"function",
"getVec3",
"(",
"$",
"valueX",
",",
"$",
"valueY",
"=",
"null",
",",
"$",
"valueZ",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"valueX",
")",
")",
"{",
"$",
"valueZ",
"=",
"(",
"isset",
"(",
"$",
"valu... | Get the Vec3 representation for the given values
@api
@param float|float[] $valueX Value X
@param float $valueY (optional) Value Y
@param float $valueZ (optional) Value Z
@return string | [
"Get",
"the",
"Vec3",
"representation",
"for",
"the",
"given",
"values"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Builder.php#L157-L165 |
steeffeen/FancyManiaLinks | FML/Script/Builder.php | Builder.getArray | public static function getArray(array $array, $associative = true)
{
$arrayText = "[";
$index = 0;
$count = count($array);
foreach ($array as $key => $value) {
if ($associative) {
$arrayText .= static::getValue($key);
$arrayText .= ... | php | public static function getArray(array $array, $associative = true)
{
$arrayText = "[";
$index = 0;
$count = count($array);
foreach ($array as $key => $value) {
if ($associative) {
$arrayText .= static::getValue($key);
$arrayText .= ... | [
"public",
"static",
"function",
"getArray",
"(",
"array",
"$",
"array",
",",
"$",
"associative",
"=",
"true",
")",
"{",
"$",
"arrayText",
"=",
"\"[\"",
";",
"$",
"index",
"=",
"0",
";",
"$",
"count",
"=",
"count",
"(",
"$",
"array",
")",
";",
"fore... | Get the string representation of the given array
@api
@param array $array Array to convert to a ManiaScript array
@param bool $associative (optional) Whether the array should be associative
@return string | [
"Get",
"the",
"string",
"representation",
"of",
"the",
"given",
"array"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Builder.php#L175-L192 |
steeffeen/FancyManiaLinks | FML/Script/Builder.php | Builder.getValue | public static function getValue($value)
{
if (is_string($value)) {
return static::escapeText($value);
}
if (is_bool($value)) {
return static::getBoolean($value);
}
if (is_array($value)) {
return static::getArray($value);
}
r... | php | public static function getValue($value)
{
if (is_string($value)) {
return static::escapeText($value);
}
if (is_bool($value)) {
return static::getBoolean($value);
}
if (is_array($value)) {
return static::getArray($value);
}
r... | [
"public",
"static",
"function",
"getValue",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"return",
"static",
"::",
"escapeText",
"(",
"$",
"value",
")",
";",
"}",
"if",
"(",
"is_bool",
"(",
"$",
"value",
")... | Get the string representation for the given value
@api
@param mixed $value Value
@return string | [
"Get",
"the",
"string",
"representation",
"for",
"the",
"given",
"value"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Builder.php#L201-L213 |
steeffeen/FancyManiaLinks | FML/Script/Builder.php | Builder.getInclude | public static function getInclude($file, $namespace = null)
{
if (!$namespace && stripos($file, ".") === false) {
$namespace = $file;
}
$file = static::escapeText($file);
$includeText = "#Include {$file}";
if ($namespace) {
$includeText .= " as ... | php | public static function getInclude($file, $namespace = null)
{
if (!$namespace && stripos($file, ".") === false) {
$namespace = $file;
}
$file = static::escapeText($file);
$includeText = "#Include {$file}";
if ($namespace) {
$includeText .= " as ... | [
"public",
"static",
"function",
"getInclude",
"(",
"$",
"file",
",",
"$",
"namespace",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"namespace",
"&&",
"stripos",
"(",
"$",
"file",
",",
"\".\"",
")",
"===",
"false",
")",
"{",
"$",
"namespace",
"=",
"... | Get the include command for the given file and namespace
@api
@param string $file Include file
@param string $namespace (optional) Include namespace
@return string | [
"Get",
"the",
"include",
"command",
"for",
"the",
"given",
"file",
"and",
"namespace"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Builder.php#L223-L235 |
ppetermann/king23 | src/Mongo/MongoService.php | MongoService.getByCriteria | public function getByCriteria($collection, $criteria)
{
if ($data = $this->findOne($collection, $criteria)) {
/** @var MongoObject $obj */
$obj = $this->container->get(
$this->classMap->getClassForResult($collection, $data)
);
$obj->setCollect... | php | public function getByCriteria($collection, $criteria)
{
if ($data = $this->findOne($collection, $criteria)) {
/** @var MongoObject $obj */
$obj = $this->container->get(
$this->classMap->getClassForResult($collection, $data)
);
$obj->setCollect... | [
"public",
"function",
"getByCriteria",
"(",
"$",
"collection",
",",
"$",
"criteria",
")",
"{",
"if",
"(",
"$",
"data",
"=",
"$",
"this",
"->",
"findOne",
"(",
"$",
"collection",
",",
"$",
"criteria",
")",
")",
"{",
"/** @var MongoObject $obj */",
"$",
"o... | convenience method to retrieve object by criteria, should be used in
public static method by the derived class
@param string $collection
@param array $criteria
@return MongoObject
@throws \MongoException | [
"convenience",
"method",
"to",
"retrieve",
"object",
"by",
"criteria",
"should",
"be",
"used",
"in",
"public",
"static",
"method",
"by",
"the",
"derived",
"class"
] | train | https://github.com/ppetermann/king23/blob/603896083ec89f5ac4d744abd3b1b4db3e914c95/src/Mongo/MongoService.php#L92-L107 |
ppetermann/king23 | src/Mongo/MongoService.php | MongoService.aggregate | public function aggregate($collection, array $pipeline, $options = [])
{
$data = $this->dbConnection->selectCollection($collection)->aggregate($pipeline);
if ($data['ok'] != 1) {
throw new Exception("Tool Aggregation Error: ".$data['errmsg'], $data['code']);
}
return $da... | php | public function aggregate($collection, array $pipeline, $options = [])
{
$data = $this->dbConnection->selectCollection($collection)->aggregate($pipeline);
if ($data['ok'] != 1) {
throw new Exception("Tool Aggregation Error: ".$data['errmsg'], $data['code']);
}
return $da... | [
"public",
"function",
"aggregate",
"(",
"$",
"collection",
",",
"array",
"$",
"pipeline",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"dbConnection",
"->",
"selectCollection",
"(",
"$",
"collection",
")",
"->",
"a... | Run Aggregation through the Aggregation Pipeline
@param string $collection
@param array $pipeline
@param array $options
@return mixed
@throws Exception | [
"Run",
"Aggregation",
"through",
"the",
"Aggregation",
"Pipeline"
] | train | https://github.com/ppetermann/king23/blob/603896083ec89f5ac4d744abd3b1b4db3e914c95/src/Mongo/MongoService.php#L137-L145 |
ppetermann/king23 | src/Mongo/MongoService.php | MongoService.findOne | public function findOne($collection, array $criteria, array $fields = [])
{
return $this->dbConnection->selectCollection($collection)->findOne($criteria, $fields);
} | php | public function findOne($collection, array $criteria, array $fields = [])
{
return $this->dbConnection->selectCollection($collection)->findOne($criteria, $fields);
} | [
"public",
"function",
"findOne",
"(",
"$",
"collection",
",",
"array",
"$",
"criteria",
",",
"array",
"$",
"fields",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"dbConnection",
"->",
"selectCollection",
"(",
"$",
"collection",
")",
"->",
"findO... | returns the first found matching document
@param string $collection
@param array $criteria
@param array $fields
@return array
@throws \Exception | [
"returns",
"the",
"first",
"found",
"matching",
"document"
] | train | https://github.com/ppetermann/king23/blob/603896083ec89f5ac4d744abd3b1b4db3e914c95/src/Mongo/MongoService.php#L168-L171 |
ppetermann/king23 | src/Mongo/MongoService.php | MongoService.newObject | public function newObject($collection)
{
/** @var MongoObject $obj */
$obj =$this->container->get($this->classMap->getClassForResult($collection, []));
$obj->setCollection($collection);
return $obj;
} | php | public function newObject($collection)
{
/** @var MongoObject $obj */
$obj =$this->container->get($this->classMap->getClassForResult($collection, []));
$obj->setCollection($collection);
return $obj;
} | [
"public",
"function",
"newObject",
"(",
"$",
"collection",
")",
"{",
"/** @var MongoObject $obj */",
"$",
"obj",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"$",
"this",
"->",
"classMap",
"->",
"getClassForResult",
"(",
"$",
"collection",
",",
"["... | conveniant method to create new instances
@param string $collection
@return MongoObject
@throws \MongoException | [
"conveniant",
"method",
"to",
"create",
"new",
"instances"
] | train | https://github.com/ppetermann/king23/blob/603896083ec89f5ac4d744abd3b1b4db3e914c95/src/Mongo/MongoService.php#L179-L186 |
ruvents/ruwork-upload-bundle | Source/Handler/StringSourceHandler.php | StringSourceHandler.write | public function write($source, string $target): void
{
$this->filesystem->copy($source, $target, true);
} | php | public function write($source, string $target): void
{
$this->filesystem->copy($source, $target, true);
} | [
"public",
"function",
"write",
"(",
"$",
"source",
",",
"string",
"$",
"target",
")",
":",
"void",
"{",
"$",
"this",
"->",
"filesystem",
"->",
"copy",
"(",
"$",
"source",
",",
"$",
"target",
",",
"true",
")",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/ruvents/ruwork-upload-bundle/blob/8ad09cc2dce6ab389105c440d791346696da43af/Source/Handler/StringSourceHandler.php#L29-L32 |
aedart/laravel-helpers | src/Traits/Logging/LogTrait.php | LogTrait.getLog | public function getLog(): ?Log
{
if (!$this->hasLog()) {
$this->setLog($this->getDefaultLog());
}
return $this->log;
} | php | public function getLog(): ?Log
{
if (!$this->hasLog()) {
$this->setLog($this->getDefaultLog());
}
return $this->log;
} | [
"public",
"function",
"getLog",
"(",
")",
":",
"?",
"Log",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasLog",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setLog",
"(",
"$",
"this",
"->",
"getDefaultLog",
"(",
")",
")",
";",
"}",
"return",
"$",
"this... | Get log
If no log has been set, this method will
set and return a default log, if any such
value is available
@see getDefaultLog()
@return Log|null log or null if none log has been set | [
"Get",
"log"
] | train | https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Logging/LogTrait.php#L53-L59 |
shinjin/freezer | src/Storage/ChainStorage.php | ChainStorage.doStore | protected function doStore(array $frozenObject)
{
$result = null;
foreach ($this->storageChain as $storage) {
if (!$storage instanceof \Freezer\Storage) {
throw new \InvalidArgumentException(
'Storage chain contains invalid storage type'
... | php | protected function doStore(array $frozenObject)
{
$result = null;
foreach ($this->storageChain as $storage) {
if (!$storage instanceof \Freezer\Storage) {
throw new \InvalidArgumentException(
'Storage chain contains invalid storage type'
... | [
"protected",
"function",
"doStore",
"(",
"array",
"$",
"frozenObject",
")",
"{",
"$",
"result",
"=",
"null",
";",
"foreach",
"(",
"$",
"this",
"->",
"storageChain",
"as",
"$",
"storage",
")",
"{",
"if",
"(",
"!",
"$",
"storage",
"instanceof",
"\\",
"Fr... | {@inheritdoc} | [
"{"
] | train | https://github.com/shinjin/freezer/blob/f5955fb5476fa8ac456e27c0edafaae331d02cd3/src/Storage/ChainStorage.php#L35-L50 |
shinjin/freezer | src/Storage/ChainStorage.php | ChainStorage.doFetch | protected function doFetch($id, array &$objects = array())
{
foreach ($this->storageChain as $key => $storage) {
$frozenObject = $storage->doFetch($id, $objects);
if ($frozenObject !== false) {
$isDirty = &$frozenObject['objects'][$id]['isDirty'];
$is... | php | protected function doFetch($id, array &$objects = array())
{
foreach ($this->storageChain as $key => $storage) {
$frozenObject = $storage->doFetch($id, $objects);
if ($frozenObject !== false) {
$isDirty = &$frozenObject['objects'][$id]['isDirty'];
$is... | [
"protected",
"function",
"doFetch",
"(",
"$",
"id",
",",
"array",
"&",
"$",
"objects",
"=",
"array",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"storageChain",
"as",
"$",
"key",
"=>",
"$",
"storage",
")",
"{",
"$",
"frozenObject",
"=",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/shinjin/freezer/blob/f5955fb5476fa8ac456e27c0edafaae331d02cd3/src/Storage/ChainStorage.php#L55-L74 |
yuncms/framework | src/models/Task.php | Task.crontabValidate | public function crontabValidate()
{
if (!CronParseHelper::check($this->crontab_str)) {
$message = Yii::t('yuncms', 'Format verification failed.');
$this->addError('crontab_str', $message);
}
} | php | public function crontabValidate()
{
if (!CronParseHelper::check($this->crontab_str)) {
$message = Yii::t('yuncms', 'Format verification failed.');
$this->addError('crontab_str', $message);
}
} | [
"public",
"function",
"crontabValidate",
"(",
")",
"{",
"if",
"(",
"!",
"CronParseHelper",
"::",
"check",
"(",
"$",
"this",
"->",
"crontab_str",
")",
")",
"{",
"$",
"message",
"=",
"Yii",
"::",
"t",
"(",
"'yuncms'",
",",
"'Format verification failed.'",
")... | Validate balance | [
"Validate",
"balance"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/models/Task.php#L86-L92 |
teneleven/GeolocatorBundle | Extractor/AddressPropertyExtractor.php | AddressPropertyExtractor.extractAddress | public function extractAddress($object)
{
$accessor = $this->getPropertyAccessor();
$address = array();
try {
foreach ($this->addressProperties as $property) {
$address[] = trim($accessor->getValue($object, $property));
}
} catch (\Exception $... | php | public function extractAddress($object)
{
$accessor = $this->getPropertyAccessor();
$address = array();
try {
foreach ($this->addressProperties as $property) {
$address[] = trim($accessor->getValue($object, $property));
}
} catch (\Exception $... | [
"public",
"function",
"extractAddress",
"(",
"$",
"object",
")",
"{",
"$",
"accessor",
"=",
"$",
"this",
"->",
"getPropertyAccessor",
"(",
")",
";",
"$",
"address",
"=",
"array",
"(",
")",
";",
"try",
"{",
"foreach",
"(",
"$",
"this",
"->",
"addressPro... | {@inheritdoc} | [
"{"
] | train | https://github.com/teneleven/GeolocatorBundle/blob/4ead8e783a91577f2a67aa302b79641d4b9e99ad/Extractor/AddressPropertyExtractor.php#L62-L76 |
fyuze/framework | src/Fyuze/Http/Response.php | Response.send | public function send()
{
foreach ($this->headers as $key => $value) {
header("$key: " . implode(',', $value));
}
if($this->hasHeader('Content-Type') === false) {
header(vsprintf(
'Content-Type: %s',
$this->hasHeader('Content-Type') ? $... | php | public function send()
{
foreach ($this->headers as $key => $value) {
header("$key: " . implode(',', $value));
}
if($this->hasHeader('Content-Type') === false) {
header(vsprintf(
'Content-Type: %s',
$this->hasHeader('Content-Type') ? $... | [
"public",
"function",
"send",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"headers",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"header",
"(",
"\"$key: \"",
".",
"implode",
"(",
"','",
",",
"$",
"value",
")",
")",
";",
"}",
"if",
"(",
... | Sends the response | [
"Sends",
"the",
"response"
] | train | https://github.com/fyuze/framework/blob/89b3984f7225e24bfcdafb090ee197275b3222c9/src/Fyuze/Http/Response.php#L73-L96 |
OwlyCode/StreamingBird | src/Location/Collection.php | Collection.getBoundingBox | public function getBoundingBox()
{
$box = [];
foreach ($this->locations as $location) {
$box = array_merge($box, $location->getBoundingBox());
}
return $box;
} | php | public function getBoundingBox()
{
$box = [];
foreach ($this->locations as $location) {
$box = array_merge($box, $location->getBoundingBox());
}
return $box;
} | [
"public",
"function",
"getBoundingBox",
"(",
")",
"{",
"$",
"box",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"locations",
"as",
"$",
"location",
")",
"{",
"$",
"box",
"=",
"array_merge",
"(",
"$",
"box",
",",
"$",
"location",
"->",
"ge... | {@inheritDoc} | [
"{"
] | train | https://github.com/OwlyCode/StreamingBird/blob/177fc8a9dc8f911865a5abd9ac8d4ef85cef4003/src/Location/Collection.php#L23-L32 |
webforge-labs/psc-cms | lib/Psc/Net/HTTP/Header.php | Header.parseField | protected function parseField($name, $value) {
switch ($name) {
case 'Content-Disposition':
$this->assertNotEmpty($value, $name);
// @TODO das ist ganz schön stümperhaft aber geht erstmal
if (Preg::match($value, '/^(.*?);\s+filename="(.*)"$/', $match)) {
$value = (ob... | php | protected function parseField($name, $value) {
switch ($name) {
case 'Content-Disposition':
$this->assertNotEmpty($value, $name);
// @TODO das ist ganz schön stümperhaft aber geht erstmal
if (Preg::match($value, '/^(.*?);\s+filename="(.*)"$/', $match)) {
$value = (ob... | [
"protected",
"function",
"parseField",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"switch",
"(",
"$",
"name",
")",
"{",
"case",
"'Content-Disposition'",
":",
"$",
"this",
"->",
"assertNotEmpty",
"(",
"$",
"value",
",",
"$",
"name",
")",
";",
"// @T... | /* Parsing Funktionen um einen Header aus einem String zu erstellen | [
"/",
"*",
"Parsing",
"Funktionen",
"um",
"einen",
"Header",
"aus",
"einem",
"String",
"zu",
"erstellen"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Net/HTTP/Header.php#L125-L144 |
nexusnetsoftgmbh/nexuscli | src/Nexus/CustomCommand/Business/Model/Hydrator/CommandHydrator.php | CommandHydrator.hydrateCommands | public function hydrateCommands(array $commands): array
{
if ($this->commandFinder->isDir()) {
$commands = array_merge($commands, $this->getCommandsFromFinder());
}
return $commands;
} | php | public function hydrateCommands(array $commands): array
{
if ($this->commandFinder->isDir()) {
$commands = array_merge($commands, $this->getCommandsFromFinder());
}
return $commands;
} | [
"public",
"function",
"hydrateCommands",
"(",
"array",
"$",
"commands",
")",
":",
"array",
"{",
"if",
"(",
"$",
"this",
"->",
"commandFinder",
"->",
"isDir",
"(",
")",
")",
"{",
"$",
"commands",
"=",
"array_merge",
"(",
"$",
"commands",
",",
"$",
"this... | @param array $commands
@return array | [
"@param",
"array",
"$commands"
] | train | https://github.com/nexusnetsoftgmbh/nexuscli/blob/8416b43d31ad56ea379ae2b0bf85d456e78ba67a/src/Nexus/CustomCommand/Business/Model/Hydrator/CommandHydrator.php#L31-L38 |
CakeCMS/Core | src/View/Helper/AssetsHelper.php | AssetsHelper.imgAreaSelect | public function imgAreaSelect()
{
$this->jquery();
$this->Html->script('libs/img-area-select.min.js', $this->_setOptions([
'alias' => __FUNCTION__,
'weight' => self::WEIGHT_LIB
]));
return $this;
} | php | public function imgAreaSelect()
{
$this->jquery();
$this->Html->script('libs/img-area-select.min.js', $this->_setOptions([
'alias' => __FUNCTION__,
'weight' => self::WEIGHT_LIB
]));
return $this;
} | [
"public",
"function",
"imgAreaSelect",
"(",
")",
"{",
"$",
"this",
"->",
"jquery",
"(",
")",
";",
"$",
"this",
"->",
"Html",
"->",
"script",
"(",
"'libs/img-area-select.min.js'",
",",
"$",
"this",
"->",
"_setOptions",
"(",
"[",
"'alias'",
"=>",
"__FUNCTION... | Include jQuery imgAreaSelect plugin. See https://github.com/odyniec/imgareaselect
@return $this | [
"Include",
"jQuery",
"imgAreaSelect",
"plugin",
".",
"See",
"https",
":",
"//",
"github",
".",
"com",
"/",
"odyniec",
"/",
"imgareaselect"
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Helper/AssetsHelper.php#L136-L146 |
CakeCMS/Core | src/View/Helper/AssetsHelper.php | AssetsHelper.jquery | public function jquery()
{
$this->Html->script('libs/jquery.min.js', $this->_setOptions([
'alias' => __FUNCTION__,
'weight' => self::WEIGHT_CORE
]));
return $this;
} | php | public function jquery()
{
$this->Html->script('libs/jquery.min.js', $this->_setOptions([
'alias' => __FUNCTION__,
'weight' => self::WEIGHT_CORE
]));
return $this;
} | [
"public",
"function",
"jquery",
"(",
")",
"{",
"$",
"this",
"->",
"Html",
"->",
"script",
"(",
"'libs/jquery.min.js'",
",",
"$",
"this",
"->",
"_setOptions",
"(",
"[",
"'alias'",
"=>",
"__FUNCTION__",
",",
"'weight'",
"=>",
"self",
"::",
"WEIGHT_CORE",
"]"... | Include jquery lib.
@return $this | [
"Include",
"jquery",
"lib",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Helper/AssetsHelper.php#L153-L161 |
CakeCMS/Core | src/View/Helper/AssetsHelper.php | AssetsHelper.jqueryFactory | public function jqueryFactory()
{
$this->jquery();
$this->Html->script('libs/utils.min.js', $this->_setOptions([
'alias' => 'jquery-utils',
'weight' => self::WEIGHT_LIB
]));
$this->Html->script('libs/jquery-factory.min.js', $this->_setOptions([
... | php | public function jqueryFactory()
{
$this->jquery();
$this->Html->script('libs/utils.min.js', $this->_setOptions([
'alias' => 'jquery-utils',
'weight' => self::WEIGHT_LIB
]));
$this->Html->script('libs/jquery-factory.min.js', $this->_setOptions([
... | [
"public",
"function",
"jqueryFactory",
"(",
")",
"{",
"$",
"this",
"->",
"jquery",
"(",
")",
";",
"$",
"this",
"->",
"Html",
"->",
"script",
"(",
"'libs/utils.min.js'",
",",
"$",
"this",
"->",
"_setOptions",
"(",
"[",
"'alias'",
"=>",
"'jquery-utils'",
"... | Include jquery factory.
@return $this | [
"Include",
"jquery",
"factory",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Helper/AssetsHelper.php#L168-L183 |
CakeCMS/Core | src/View/Helper/AssetsHelper.php | AssetsHelper.loadPluginAssets | public function loadPluginAssets()
{
$plugin = (string) $this->request->getParam('plugin');
$prefix = ($this->request->getParam('prefix')) ? $this->request->getParam('prefix') . '/' : null;
$action = (string) $this->request->getParam('action');
$controller = (string) $this->request-... | php | public function loadPluginAssets()
{
$plugin = (string) $this->request->getParam('plugin');
$prefix = ($this->request->getParam('prefix')) ? $this->request->getParam('prefix') . '/' : null;
$action = (string) $this->request->getParam('action');
$controller = (string) $this->request-... | [
"public",
"function",
"loadPluginAssets",
"(",
")",
"{",
"$",
"plugin",
"=",
"(",
"string",
")",
"$",
"this",
"->",
"request",
"->",
"getParam",
"(",
"'plugin'",
")",
";",
"$",
"prefix",
"=",
"(",
"$",
"this",
"->",
"request",
"->",
"getParam",
"(",
... | Autoload plugin assets.
@return void
@throws \JBZoo\Less\Exception | [
"Autoload",
"plugin",
"assets",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Helper/AssetsHelper.php#L192-L208 |
CakeCMS/Core | src/View/Helper/AssetsHelper.php | AssetsHelper.materialize | public function materialize()
{
$this->jquery();
$this->Html->script('libs/materialize.min.js', $this->_setOptions([
'alias' => __FUNCTION__,
'weight' => self::WEIGHT_LIB
]));
$this->Html->css('libs/materialize.min.css', $this->_setOptions([
'al... | php | public function materialize()
{
$this->jquery();
$this->Html->script('libs/materialize.min.js', $this->_setOptions([
'alias' => __FUNCTION__,
'weight' => self::WEIGHT_LIB
]));
$this->Html->css('libs/materialize.min.css', $this->_setOptions([
'al... | [
"public",
"function",
"materialize",
"(",
")",
"{",
"$",
"this",
"->",
"jquery",
"(",
")",
";",
"$",
"this",
"->",
"Html",
"->",
"script",
"(",
"'libs/materialize.min.js'",
",",
"$",
"this",
"->",
"_setOptions",
"(",
"[",
"'alias'",
"=>",
"__FUNCTION__",
... | Include materialize design.
@return $this | [
"Include",
"materialize",
"design",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Helper/AssetsHelper.php#L215-L230 |
CakeCMS/Core | src/View/Helper/AssetsHelper.php | AssetsHelper.toggleField | public function toggleField($selector = '.jsToggleField', $widget = 'JBZoo.FieldToggle', array $options = [])
{
$this->jqueryFactory();
$this->Html->script('Core.admin/widget/field-toggle.js', $this->_setOptions([
'alias' => __FUNCTION__,
'weight' => self::WEIGHT_WIDGET
... | php | public function toggleField($selector = '.jsToggleField', $widget = 'JBZoo.FieldToggle', array $options = [])
{
$this->jqueryFactory();
$this->Html->script('Core.admin/widget/field-toggle.js', $this->_setOptions([
'alias' => __FUNCTION__,
'weight' => self::WEIGHT_WIDGET
... | [
"public",
"function",
"toggleField",
"(",
"$",
"selector",
"=",
"'.jsToggleField'",
",",
"$",
"widget",
"=",
"'JBZoo.FieldToggle'",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"jqueryFactory",
"(",
")",
";",
"$",
"this",
"->... | Include toggle field js widget.
@param string $selector
@param string $widget
@param array $options
@return $this | [
"Include",
"toggle",
"field",
"js",
"widget",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Helper/AssetsHelper.php#L296-L309 |
restruct/silverstripe-namedlinkfield | src/NamedLinkField.php | NamedLinkField.exists | public function exists()
{
return ($this->page_id > 0 || $this->file_id > 0 || $this->custom_url !== null
|| $this->shortcode !== null && $this->title !== null);
} | php | public function exists()
{
return ($this->page_id > 0 || $this->file_id > 0 || $this->custom_url !== null
|| $this->shortcode !== null && $this->title !== null);
} | [
"public",
"function",
"exists",
"(",
")",
"{",
"return",
"(",
"$",
"this",
"->",
"page_id",
">",
"0",
"||",
"$",
"this",
"->",
"file_id",
">",
"0",
"||",
"$",
"this",
"->",
"custom_url",
"!==",
"null",
"||",
"$",
"this",
"->",
"shortcode",
"!==",
"... | Determines if any of the properties in this field have a value,
meaning at least one of them is not NULL.
@return boolean | [
"Determines",
"if",
"any",
"of",
"the",
"properties",
"in",
"this",
"field",
"have",
"a",
"value",
"meaning",
"at",
"least",
"one",
"of",
"them",
"is",
"not",
"NULL",
"."
] | train | https://github.com/restruct/silverstripe-namedlinkfield/blob/567c49fdc1b24c219dec2e989fc2013b1c7951af/src/NamedLinkField.php#L321-L325 |
restruct/silverstripe-namedlinkfield | src/NamedLinkField.php | NamedLinkField.Page | public function Page()
{
if ($this->getPageID() && $page = DataObject::get_by_id('Page', $this->getPageID())) {
return $page;
}
return null;
} | php | public function Page()
{
if ($this->getPageID() && $page = DataObject::get_by_id('Page', $this->getPageID())) {
return $page;
}
return null;
} | [
"public",
"function",
"Page",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getPageID",
"(",
")",
"&&",
"$",
"page",
"=",
"DataObject",
"::",
"get_by_id",
"(",
"'Page'",
",",
"$",
"this",
"->",
"getPageID",
"(",
")",
")",
")",
"{",
"return",
"$",
... | } | [
"}"
] | train | https://github.com/restruct/silverstripe-namedlinkfield/blob/567c49fdc1b24c219dec2e989fc2013b1c7951af/src/NamedLinkField.php#L396-L402 |
webforge-labs/psc-cms | lib/Psc/JS/jQuery.php | jQuery.getIdSelector | public static function getIdSelector(\Psc\HTML\Tag $tag) {
if ($tag->getAttribute('id') == NULL) $tag->generateId();
return "jQuery('#".$tag->getAttribute('id')."')";
} | php | public static function getIdSelector(\Psc\HTML\Tag $tag) {
if ($tag->getAttribute('id') == NULL) $tag->generateId();
return "jQuery('#".$tag->getAttribute('id')."')";
} | [
"public",
"static",
"function",
"getIdSelector",
"(",
"\\",
"Psc",
"\\",
"HTML",
"\\",
"Tag",
"$",
"tag",
")",
"{",
"if",
"(",
"$",
"tag",
"->",
"getAttribute",
"(",
"'id'",
")",
"==",
"NULL",
")",
"$",
"tag",
"->",
"generateId",
"(",
")",
";",
"re... | /* Statische Funktionen (Helpers) | [
"/",
"*",
"Statische",
"Funktionen",
"(",
"Helpers",
")"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/JS/jQuery.php#L23-L27 |
webforge-labs/psc-cms | lib/Psc/JS/jQuery.php | jQuery.chain | public static function chain(\Psc\HTML\Tag $tag, Expression $code) {
if (isset($tag->templateContent->jQueryChain)) {
// append to previous created chain
$tag->templateContent->jQueryChain .= sprintf("\n .%s", $code->JS());
} else {
/*
* make something like:
... | php | public static function chain(\Psc\HTML\Tag $tag, Expression $code) {
if (isset($tag->templateContent->jQueryChain)) {
// append to previous created chain
$tag->templateContent->jQueryChain .= sprintf("\n .%s", $code->JS());
} else {
/*
* make something like:
... | [
"public",
"static",
"function",
"chain",
"(",
"\\",
"Psc",
"\\",
"HTML",
"\\",
"Tag",
"$",
"tag",
",",
"Expression",
"$",
"code",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"tag",
"->",
"templateContent",
"->",
"jQueryChain",
")",
")",
"{",
"// append to ... | Fügt dem JavaScript des Tags eine weitere Funktion hinzu
z. B. so:
<span id="element"></span>
<script type="text/javascript">$('#element').click({..})</script>
@param Expression $code wird mit einem . an das Javascript des Selectors angehängt $code darf also am Anfang keinen . haben | [
"Fügt",
"dem",
"JavaScript",
"des",
"Tags",
"eine",
"weitere",
"Funktion",
"hinzu"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/JS/jQuery.php#L51-L81 |
zircote/AMQP | library/AMQP/Wire/BufferedInput.php | BufferedInput.read | public function read($n)
{
if ($this->offset >= strlen($this->buffer)) {
if (!($rv = $this->populateBuffer())) {
return $rv;
}
}
return $this->readBuffer($n);
} | php | public function read($n)
{
if ($this->offset >= strlen($this->buffer)) {
if (!($rv = $this->populateBuffer())) {
return $rv;
}
}
return $this->readBuffer($n);
} | [
"public",
"function",
"read",
"(",
"$",
"n",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"offset",
">=",
"strlen",
"(",
"$",
"this",
"->",
"buffer",
")",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"rv",
"=",
"$",
"this",
"->",
"populateBuffer",
"(",
")",
... | @param $n
@return bool|string | [
"@param",
"$n"
] | train | https://github.com/zircote/AMQP/blob/b96777b372f556797db4fd0ba02edb18d4bf4a1e/library/AMQP/Wire/BufferedInput.php#L54-L62 |
zircote/AMQP | library/AMQP/Wire/BufferedInput.php | BufferedInput.readBuffer | protected function readBuffer($n)
{
$n = min($n, strlen($this->buffer) - $this->offset);
if ($n === 0) {
// substr('', 0, 0) => false, which screws up read loops that are
// expecting non-blocking reads to return ''. This avoids that edge
// case when the buffer i... | php | protected function readBuffer($n)
{
$n = min($n, strlen($this->buffer) - $this->offset);
if ($n === 0) {
// substr('', 0, 0) => false, which screws up read loops that are
// expecting non-blocking reads to return ''. This avoids that edge
// case when the buffer i... | [
"protected",
"function",
"readBuffer",
"(",
"$",
"n",
")",
"{",
"$",
"n",
"=",
"min",
"(",
"$",
"n",
",",
"strlen",
"(",
"$",
"this",
"->",
"buffer",
")",
"-",
"$",
"this",
"->",
"offset",
")",
";",
"if",
"(",
"$",
"n",
"===",
"0",
")",
"{",
... | @param $n
@return string | [
"@param",
"$n"
] | train | https://github.com/zircote/AMQP/blob/b96777b372f556797db4fd0ba02edb18d4bf4a1e/library/AMQP/Wire/BufferedInput.php#L78-L90 |
Swop/FilterExpressionParser | src/Parser/Parser.php | Parser.syntaxError | public function syntaxError($expected = '', $token = null)
{
if ($token === null) {
$token = $this->lexer->lookahead;
}
$tokenPos = (isset($token['position'])) ? $token['position'] : '-1';
$message = "line 0, col {$tokenPos}: Error: ";
$message .= ($expected !=... | php | public function syntaxError($expected = '', $token = null)
{
if ($token === null) {
$token = $this->lexer->lookahead;
}
$tokenPos = (isset($token['position'])) ? $token['position'] : '-1';
$message = "line 0, col {$tokenPos}: Error: ";
$message .= ($expected !=... | [
"public",
"function",
"syntaxError",
"(",
"$",
"expected",
"=",
"''",
",",
"$",
"token",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"token",
"===",
"null",
")",
"{",
"$",
"token",
"=",
"$",
"this",
"->",
"lexer",
"->",
"lookahead",
";",
"}",
"$",
"to... | Generates a new syntax error.
@param string $expected Expected string.
@param array|null $token Got token.
@return void
@throws ExpressionException | [
"Generates",
"a",
"new",
"syntax",
"error",
"."
] | train | https://github.com/Swop/FilterExpressionParser/blob/adcb4bec3588cba48a6928a329aba5b31f837b8c/src/Parser/Parser.php#L112-L125 |
Swop/FilterExpressionParser | src/Parser/Parser.php | Parser.semanticalError | public function semanticalError($message = '', $token = null)
{
if ($token === null) {
$token = $this->lexer->lookahead;
}
// Minimum exposed chars ahead of token
$distance = 12;
// Find a position of a final word to display in error string
$expression ... | php | public function semanticalError($message = '', $token = null)
{
if ($token === null) {
$token = $this->lexer->lookahead;
}
// Minimum exposed chars ahead of token
$distance = 12;
// Find a position of a final word to display in error string
$expression ... | [
"public",
"function",
"semanticalError",
"(",
"$",
"message",
"=",
"''",
",",
"$",
"token",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"token",
"===",
"null",
")",
"{",
"$",
"token",
"=",
"$",
"this",
"->",
"lexer",
"->",
"lookahead",
";",
"}",
"// Min... | Generates a new semantical error.
@param string $message Optional message.
@param array|null $token Optional token.
@return void
@throws ExpressionException | [
"Generates",
"a",
"new",
"semantical",
"error",
"."
] | train | https://github.com/Swop/FilterExpressionParser/blob/adcb4bec3588cba48a6928a329aba5b31f837b8c/src/Parser/Parser.php#L137-L160 |
Swop/FilterExpressionParser | src/Parser/Parser.php | Parser.filterLanguage | public function filterLanguage()
{
$this->lexer->moveNext();
$node = $this->filterNode();
// Check for end of string
if ($this->lexer->lookahead !== null) {
$this->syntaxError('end of string');
}
return $node;
} | php | public function filterLanguage()
{
$this->lexer->moveNext();
$node = $this->filterNode();
// Check for end of string
if ($this->lexer->lookahead !== null) {
$this->syntaxError('end of string');
}
return $node;
} | [
"public",
"function",
"filterLanguage",
"(",
")",
"{",
"$",
"this",
"->",
"lexer",
"->",
"moveNext",
"(",
")",
";",
"$",
"node",
"=",
"$",
"this",
"->",
"filterNode",
"(",
")",
";",
"// Check for end of string",
"if",
"(",
"$",
"this",
"->",
"lexer",
"... | filterLanguage ::= filterNode
@return FilterNode | [
"filterLanguage",
"::",
"=",
"filterNode"
] | train | https://github.com/Swop/FilterExpressionParser/blob/adcb4bec3588cba48a6928a329aba5b31f837b8c/src/Parser/Parser.php#L203-L215 |
Swop/FilterExpressionParser | src/Parser/Parser.php | Parser.conditionalExpression | public function conditionalExpression()
{
$conditionalTerms = array();
$conditionalTerms[] = $this->conditionalTerm();
while ($this->lexer->isNextToken(Lexer::T_OR)) {
$this->match(Lexer::T_OR);
$conditionalTerms[] = $this->conditionalTerm();
}
// P... | php | public function conditionalExpression()
{
$conditionalTerms = array();
$conditionalTerms[] = $this->conditionalTerm();
while ($this->lexer->isNextToken(Lexer::T_OR)) {
$this->match(Lexer::T_OR);
$conditionalTerms[] = $this->conditionalTerm();
}
// P... | [
"public",
"function",
"conditionalExpression",
"(",
")",
"{",
"$",
"conditionalTerms",
"=",
"array",
"(",
")",
";",
"$",
"conditionalTerms",
"[",
"]",
"=",
"$",
"this",
"->",
"conditionalTerm",
"(",
")",
";",
"while",
"(",
"$",
"this",
"->",
"lexer",
"->... | conditionalExpression ::= conditionalTerm {"OR" conditionalTerm}*
@return ConditionalExpressionNode | [
"conditionalExpression",
"::",
"=",
"conditionalTerm",
"{",
"OR",
"conditionalTerm",
"}",
"*"
] | train | https://github.com/Swop/FilterExpressionParser/blob/adcb4bec3588cba48a6928a329aba5b31f837b8c/src/Parser/Parser.php#L234-L252 |
Swop/FilterExpressionParser | src/Parser/Parser.php | Parser.conditionalTerm | public function conditionalTerm()
{
$conditionalFactors = array();
$conditionalFactors[] = $this->conditionalFactor();
while ($this->lexer->isNextToken(Lexer::T_AND)) {
$this->match(Lexer::T_AND);
$conditionalFactors[] = $this->conditionalFactor();
}
... | php | public function conditionalTerm()
{
$conditionalFactors = array();
$conditionalFactors[] = $this->conditionalFactor();
while ($this->lexer->isNextToken(Lexer::T_AND)) {
$this->match(Lexer::T_AND);
$conditionalFactors[] = $this->conditionalFactor();
}
... | [
"public",
"function",
"conditionalTerm",
"(",
")",
"{",
"$",
"conditionalFactors",
"=",
"array",
"(",
")",
";",
"$",
"conditionalFactors",
"[",
"]",
"=",
"$",
"this",
"->",
"conditionalFactor",
"(",
")",
";",
"while",
"(",
"$",
"this",
"->",
"lexer",
"->... | conditionalTerm ::= conditionalFactor {"AND" conditionalFactor}*
@return ConditionalTermNode | [
"conditionalTerm",
"::",
"=",
"conditionalFactor",
"{",
"AND",
"conditionalFactor",
"}",
"*"
] | train | https://github.com/Swop/FilterExpressionParser/blob/adcb4bec3588cba48a6928a329aba5b31f837b8c/src/Parser/Parser.php#L259-L277 |
Swop/FilterExpressionParser | src/Parser/Parser.php | Parser.conditionalFactor | public function conditionalFactor()
{
$not = false;
if ($this->lexer->isNextToken(Lexer::T_NOT)) {
$this->match(Lexer::T_NOT);
$not = true;
}
$conditionalPrimary = $this->conditionalPrimary();
// Phase 1 AST optimization: Prevent AST\ConditionalFac... | php | public function conditionalFactor()
{
$not = false;
if ($this->lexer->isNextToken(Lexer::T_NOT)) {
$this->match(Lexer::T_NOT);
$not = true;
}
$conditionalPrimary = $this->conditionalPrimary();
// Phase 1 AST optimization: Prevent AST\ConditionalFac... | [
"public",
"function",
"conditionalFactor",
"(",
")",
"{",
"$",
"not",
"=",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"lexer",
"->",
"isNextToken",
"(",
"Lexer",
"::",
"T_NOT",
")",
")",
"{",
"$",
"this",
"->",
"match",
"(",
"Lexer",
"::",
"T_NOT",
... | conditionalFactor ::= ["NOT"] conditionalPrimary
@return ConditionalFactorNode | [
"conditionalFactor",
"::",
"=",
"[",
"NOT",
"]",
"conditionalPrimary"
] | train | https://github.com/Swop/FilterExpressionParser/blob/adcb4bec3588cba48a6928a329aba5b31f837b8c/src/Parser/Parser.php#L284-L306 |
Swop/FilterExpressionParser | src/Parser/Parser.php | Parser.conditionalPrimary | public function conditionalPrimary()
{
$condPrimary = new ConditionalPrimaryNode();
if ( ! $this->lexer->isNextToken(Lexer::T_OPEN_PARENTHESIS)) {
$condPrimary->setSimpleConditionalExpression($this->simpleConditionalExpression());
return $condPrimary;
}
// ... | php | public function conditionalPrimary()
{
$condPrimary = new ConditionalPrimaryNode();
if ( ! $this->lexer->isNextToken(Lexer::T_OPEN_PARENTHESIS)) {
$condPrimary->setSimpleConditionalExpression($this->simpleConditionalExpression());
return $condPrimary;
}
// ... | [
"public",
"function",
"conditionalPrimary",
"(",
")",
"{",
"$",
"condPrimary",
"=",
"new",
"ConditionalPrimaryNode",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"lexer",
"->",
"isNextToken",
"(",
"Lexer",
"::",
"T_OPEN_PARENTHESIS",
")",
")",
"{",
"$... | conditionalPrimary ::= simpleConditionalExpression | "(" conditionalExpression ")"
@return ConditionalPrimaryNode | [
"conditionalPrimary",
"::",
"=",
"simpleConditionalExpression",
"|",
"(",
"conditionalExpression",
")"
] | train | https://github.com/Swop/FilterExpressionParser/blob/adcb4bec3588cba48a6928a329aba5b31f837b8c/src/Parser/Parser.php#L313-L338 |
Swop/FilterExpressionParser | src/Parser/Parser.php | Parser.simpleConditionalExpression | public function simpleConditionalExpression()
{
$token = $this->lexer->lookahead;
$lookahead = $token;
if ($this->lexer->isNextToken(Lexer::T_NOT)) {
$token = $this->lexer->glimpse();
}
if ($token['type'] === Lexer::T_IDENTIFIER) {
// Peek beyo... | php | public function simpleConditionalExpression()
{
$token = $this->lexer->lookahead;
$lookahead = $token;
if ($this->lexer->isNextToken(Lexer::T_NOT)) {
$token = $this->lexer->glimpse();
}
if ($token['type'] === Lexer::T_IDENTIFIER) {
// Peek beyo... | [
"public",
"function",
"simpleConditionalExpression",
"(",
")",
"{",
"$",
"token",
"=",
"$",
"this",
"->",
"lexer",
"->",
"lookahead",
";",
"$",
"lookahead",
"=",
"$",
"token",
";",
"if",
"(",
"$",
"this",
"->",
"lexer",
"->",
"isNextToken",
"(",
"Lexer",... | simpleConditionalExpression ::=
comparisonExpression | betweenExpression | likeExpression |
inExpression | nullComparisonExpression
@return BetweenExpressionNode|LikeExpressionNode|InExpressionNode|NullComparisonExpressionNode|ComparisonExpressionNode|Node | [
"simpleConditionalExpression",
"::",
"=",
"comparisonExpression",
"|",
"betweenExpression",
"|",
"likeExpression",
"|",
"inExpression",
"|",
"nullComparisonExpression"
] | train | https://github.com/Swop/FilterExpressionParser/blob/adcb4bec3588cba48a6928a329aba5b31f837b8c/src/Parser/Parser.php#L347-L402 |
Swop/FilterExpressionParser | src/Parser/Parser.php | Parser.betweenExpression | public function betweenExpression()
{
$not = false;
$arithExpr1 = $this->identificationVariable();
if ($this->lexer->isNextToken(Lexer::T_NOT)) {
$this->match(Lexer::T_NOT);
$not = true;
}
$this->match(Lexer::T_BETWEEN);
$arithExpr2 = $this->... | php | public function betweenExpression()
{
$not = false;
$arithExpr1 = $this->identificationVariable();
if ($this->lexer->isNextToken(Lexer::T_NOT)) {
$this->match(Lexer::T_NOT);
$not = true;
}
$this->match(Lexer::T_BETWEEN);
$arithExpr2 = $this->... | [
"public",
"function",
"betweenExpression",
"(",
")",
"{",
"$",
"not",
"=",
"false",
";",
"$",
"arithExpr1",
"=",
"$",
"this",
"->",
"identificationVariable",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"lexer",
"->",
"isNextToken",
"(",
"Lexer",
"::",
... | betweenExpression ::= identificationVariable ["NOT"] "BETWEEN" arithmeticPrimary "AND" arithmeticPrimary
@return BetweenExpressionNode | [
"betweenExpression",
"::",
"=",
"identificationVariable",
"[",
"NOT",
"]",
"BETWEEN",
"arithmeticPrimary",
"AND",
"arithmeticPrimary"
] | train | https://github.com/Swop/FilterExpressionParser/blob/adcb4bec3588cba48a6928a329aba5b31f837b8c/src/Parser/Parser.php#L409-L428 |
Swop/FilterExpressionParser | src/Parser/Parser.php | Parser.comparisonExpression | public function comparisonExpression()
{
$this->lexer->glimpse();
$leftExpr = $this->arithmeticPrimary();
$operator = $this->comparisonOperator();
$rightExpr = $this->arithmeticPrimary();
return new ComparisonExpressionNode($leftExpr, $operator, $rightExpr);
} | php | public function comparisonExpression()
{
$this->lexer->glimpse();
$leftExpr = $this->arithmeticPrimary();
$operator = $this->comparisonOperator();
$rightExpr = $this->arithmeticPrimary();
return new ComparisonExpressionNode($leftExpr, $operator, $rightExpr);
} | [
"public",
"function",
"comparisonExpression",
"(",
")",
"{",
"$",
"this",
"->",
"lexer",
"->",
"glimpse",
"(",
")",
";",
"$",
"leftExpr",
"=",
"$",
"this",
"->",
"arithmeticPrimary",
"(",
")",
";",
"$",
"operator",
"=",
"$",
"this",
"->",
"comparisonOper... | comparisonExpression ::= arithmeticPrimary comparisonOperator arithmeticPrimary
@return ComparisonExpressionNode | [
"comparisonExpression",
"::",
"=",
"arithmeticPrimary",
"comparisonOperator",
"arithmeticPrimary"
] | train | https://github.com/Swop/FilterExpressionParser/blob/adcb4bec3588cba48a6928a329aba5b31f837b8c/src/Parser/Parser.php#L435-L444 |
Swop/FilterExpressionParser | src/Parser/Parser.php | Parser.inExpression | public function inExpression()
{
$inExpression = new InExpressionNode($this->identificationVariable());
if ($this->lexer->isNextToken(Lexer::T_NOT)) {
$this->match(Lexer::T_NOT);
$inExpression->setNot(true);
}
$this->match(Lexer::T_IN);
$this->match(... | php | public function inExpression()
{
$inExpression = new InExpressionNode($this->identificationVariable());
if ($this->lexer->isNextToken(Lexer::T_NOT)) {
$this->match(Lexer::T_NOT);
$inExpression->setNot(true);
}
$this->match(Lexer::T_IN);
$this->match(... | [
"public",
"function",
"inExpression",
"(",
")",
"{",
"$",
"inExpression",
"=",
"new",
"InExpressionNode",
"(",
"$",
"this",
"->",
"identificationVariable",
"(",
")",
")",
";",
"if",
"(",
"$",
"this",
"->",
"lexer",
"->",
"isNextToken",
"(",
"Lexer",
"::",
... | inExpression ::= identificationVariable ["NOT"] "IN" "(" inParameter {"," inParameter}* ")"
@return InExpressionNode | [
"inExpression",
"::",
"=",
"identificationVariable",
"[",
"NOT",
"]",
"IN",
"(",
"inParameter",
"{",
"inParameter",
"}",
"*",
")"
] | train | https://github.com/Swop/FilterExpressionParser/blob/adcb4bec3588cba48a6928a329aba5b31f837b8c/src/Parser/Parser.php#L451-L476 |
Swop/FilterExpressionParser | src/Parser/Parser.php | Parser.likeExpression | public function likeExpression()
{
$stringExpr = $this->identificationVariable();
$not = false;
if ($this->lexer->isNextToken(Lexer::T_NOT)) {
$this->match(Lexer::T_NOT);
$not = true;
}
$this->match(Lexer::T_LIKE);
$stringPattern = $this->st... | php | public function likeExpression()
{
$stringExpr = $this->identificationVariable();
$not = false;
if ($this->lexer->isNextToken(Lexer::T_NOT)) {
$this->match(Lexer::T_NOT);
$not = true;
}
$this->match(Lexer::T_LIKE);
$stringPattern = $this->st... | [
"public",
"function",
"likeExpression",
"(",
")",
"{",
"$",
"stringExpr",
"=",
"$",
"this",
"->",
"identificationVariable",
"(",
")",
";",
"$",
"not",
"=",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"lexer",
"->",
"isNextToken",
"(",
"Lexer",
"::",
"T... | likeExpression ::= identificationVariable ["NOT"] "LIKE" stringExpression
@return LikeExpressionNode | [
"likeExpression",
"::",
"=",
"identificationVariable",
"[",
"NOT",
"]",
"LIKE",
"stringExpression"
] | train | https://github.com/Swop/FilterExpressionParser/blob/adcb4bec3588cba48a6928a329aba5b31f837b8c/src/Parser/Parser.php#L493-L511 |
Swop/FilterExpressionParser | src/Parser/Parser.php | Parser.nullComparisonExpression | public function nullComparisonExpression()
{
$expr = $this->identificationVariable();
$nullCompExpr = new NullComparisonExpressionNode($expr);
$this->match(Lexer::T_IS);
if ($this->lexer->isNextToken(Lexer::T_NOT)) {
$this->match(Lexer::T_NOT);
$nullCompEx... | php | public function nullComparisonExpression()
{
$expr = $this->identificationVariable();
$nullCompExpr = new NullComparisonExpressionNode($expr);
$this->match(Lexer::T_IS);
if ($this->lexer->isNextToken(Lexer::T_NOT)) {
$this->match(Lexer::T_NOT);
$nullCompEx... | [
"public",
"function",
"nullComparisonExpression",
"(",
")",
"{",
"$",
"expr",
"=",
"$",
"this",
"->",
"identificationVariable",
"(",
")",
";",
"$",
"nullCompExpr",
"=",
"new",
"NullComparisonExpressionNode",
"(",
"$",
"expr",
")",
";",
"$",
"this",
"->",
"ma... | nullComparisonExpression ::= identificationVariable "IS" ["NOT"] "NULL"
@return NullComparisonExpressionNode | [
"nullComparisonExpression",
"::",
"=",
"identificationVariable",
"IS",
"[",
"NOT",
"]",
"NULL"
] | train | https://github.com/Swop/FilterExpressionParser/blob/adcb4bec3588cba48a6928a329aba5b31f837b8c/src/Parser/Parser.php#L518-L535 |
Swop/FilterExpressionParser | src/Parser/Parser.php | Parser.comparisonOperator | public function comparisonOperator()
{
switch ($this->lexer->lookahead['value']) {
case '=':
$this->match(Lexer::T_EQUALS);
return '=';
case '<':
$this->match(Lexer::T_LOWER_THAN);
$operator = '<';
if (... | php | public function comparisonOperator()
{
switch ($this->lexer->lookahead['value']) {
case '=':
$this->match(Lexer::T_EQUALS);
return '=';
case '<':
$this->match(Lexer::T_LOWER_THAN);
$operator = '<';
if (... | [
"public",
"function",
"comparisonOperator",
"(",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"lexer",
"->",
"lookahead",
"[",
"'value'",
"]",
")",
"{",
"case",
"'='",
":",
"$",
"this",
"->",
"match",
"(",
"Lexer",
"::",
"T_EQUALS",
")",
";",
"return",
... | comparisonOperator ::= "=" | "<" | "<=" | "<>" | ">" | ">=" | "!="
@return string | [
"comparisonOperator",
"::",
"=",
"=",
"|",
"<",
"|",
"<",
"=",
"|",
"<",
">",
"|",
">",
"|",
">",
"=",
"|",
"!",
"="
] | train | https://github.com/Swop/FilterExpressionParser/blob/adcb4bec3588cba48a6928a329aba5b31f837b8c/src/Parser/Parser.php#L542-L585 |
Swop/FilterExpressionParser | src/Parser/Parser.php | Parser.arithmeticPrimary | public function arithmeticPrimary()
{
switch ($this->lexer->lookahead['type']) {
case Lexer::T_IDENTIFIER:
return $this->identificationVariable();
default:
return $this->literal();
}
} | php | public function arithmeticPrimary()
{
switch ($this->lexer->lookahead['type']) {
case Lexer::T_IDENTIFIER:
return $this->identificationVariable();
default:
return $this->literal();
}
} | [
"public",
"function",
"arithmeticPrimary",
"(",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"lexer",
"->",
"lookahead",
"[",
"'type'",
"]",
")",
"{",
"case",
"Lexer",
"::",
"T_IDENTIFIER",
":",
"return",
"$",
"this",
"->",
"identificationVariable",
"(",
")... | arithmeticPrimary ::= literal | identificationVariable | [
"arithmeticPrimary",
"::",
"=",
"literal",
"|",
"identificationVariable"
] | train | https://github.com/Swop/FilterExpressionParser/blob/adcb4bec3588cba48a6928a329aba5b31f837b8c/src/Parser/Parser.php#L590-L598 |
Swop/FilterExpressionParser | src/Parser/Parser.php | Parser.literal | public function literal()
{
switch ($this->lexer->lookahead['type']) {
case Lexer::T_STRING:
$this->match(Lexer::T_STRING);
return new LiteralNode(LiteralNode::STRING, $this->lexer->token['value']);
case Lexer::T_INTEGER:
case Lexer::T_FLO... | php | public function literal()
{
switch ($this->lexer->lookahead['type']) {
case Lexer::T_STRING:
$this->match(Lexer::T_STRING);
return new LiteralNode(LiteralNode::STRING, $this->lexer->token['value']);
case Lexer::T_INTEGER:
case Lexer::T_FLO... | [
"public",
"function",
"literal",
"(",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"lexer",
"->",
"lookahead",
"[",
"'type'",
"]",
")",
"{",
"case",
"Lexer",
"::",
"T_STRING",
":",
"$",
"this",
"->",
"match",
"(",
"Lexer",
"::",
"T_STRING",
")",
";",
... | Literal ::= string | char | integer | float | boolean
@return LiteralNode | [
"Literal",
"::",
"=",
"string",
"|",
"char",
"|",
"integer",
"|",
"float",
"|",
"boolean"
] | train | https://github.com/Swop/FilterExpressionParser/blob/adcb4bec3588cba48a6928a329aba5b31f837b8c/src/Parser/Parser.php#L605-L631 |
Swop/FilterExpressionParser | src/Parser/Parser.php | Parser.stringExpression | public function stringExpression()
{
$lookaheadType = $this->lexer->lookahead['type'];
switch ($lookaheadType) {
case Lexer::T_IDENTIFIER:
return $this->identificationVariable();
case Lexer::T_STRING:
$this->match(Lexer::T_STRING);
... | php | public function stringExpression()
{
$lookaheadType = $this->lexer->lookahead['type'];
switch ($lookaheadType) {
case Lexer::T_IDENTIFIER:
return $this->identificationVariable();
case Lexer::T_STRING:
$this->match(Lexer::T_STRING);
... | [
"public",
"function",
"stringExpression",
"(",
")",
"{",
"$",
"lookaheadType",
"=",
"$",
"this",
"->",
"lexer",
"->",
"lookahead",
"[",
"'type'",
"]",
";",
"switch",
"(",
"$",
"lookaheadType",
")",
"{",
"case",
"Lexer",
"::",
"T_IDENTIFIER",
":",
"return",... | stringExpression ::= identificationVariable | string
@return IdentificationVariableNode|LiteralNode | [
"stringExpression",
"::",
"=",
"identificationVariable",
"|",
"string"
] | train | https://github.com/Swop/FilterExpressionParser/blob/adcb4bec3588cba48a6928a329aba5b31f837b8c/src/Parser/Parser.php#L650-L668 |
helsingborg-stad/acf-export-manager | src/AcfExportManager.php | AcfExportManager.addGroupKeyToPostbox | public function addGroupKeyToPostbox($post)
{
if ($post->post_type !== 'acf-field-group') {
return;
}
// Check if aldready added
global $acfExportManagerHasGroupIdInSidebar;
if ($acfExportManagerHasGroupIdInSidebar) {
return;
}
$acfEx... | php | public function addGroupKeyToPostbox($post)
{
if ($post->post_type !== 'acf-field-group') {
return;
}
// Check if aldready added
global $acfExportManagerHasGroupIdInSidebar;
if ($acfExportManagerHasGroupIdInSidebar) {
return;
}
$acfEx... | [
"public",
"function",
"addGroupKeyToPostbox",
"(",
"$",
"post",
")",
"{",
"if",
"(",
"$",
"post",
"->",
"post_type",
"!==",
"'acf-field-group'",
")",
"{",
"return",
";",
"}",
"// Check if aldready added",
"global",
"$",
"acfExportManagerHasGroupIdInSidebar",
";",
... | Displays the fieldgroup key in misc publishing actions
@param WP_Post $post | [
"Displays",
"the",
"fieldgroup",
"key",
"in",
"misc",
"publishing",
"actions"
] | train | https://github.com/helsingborg-stad/acf-export-manager/blob/27e904a24eb013cac5c8f3d3c30e88b5b9b7859b/src/AcfExportManager.php#L31-L48 |
helsingborg-stad/acf-export-manager | src/AcfExportManager.php | AcfExportManager.import | public function import() : bool
{
$files = glob($this->exportFolder . 'php/' . '*.php');
if (empty($files)) {
return false;
}
foreach ($files as $file) {
$this->imported[] = $file;
require_once $file;
}
return true;
} | php | public function import() : bool
{
$files = glob($this->exportFolder . 'php/' . '*.php');
if (empty($files)) {
return false;
}
foreach ($files as $file) {
$this->imported[] = $file;
require_once $file;
}
return true;
} | [
"public",
"function",
"import",
"(",
")",
":",
"bool",
"{",
"$",
"files",
"=",
"glob",
"(",
"$",
"this",
"->",
"exportFolder",
".",
"'php/'",
".",
"'*.php'",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"files",
")",
")",
"{",
"return",
"false",
";",
... | Import (require) acf export files
@return boolean | [
"Import",
"(",
"require",
")",
"acf",
"export",
"files"
] | train | https://github.com/helsingborg-stad/acf-export-manager/blob/27e904a24eb013cac5c8f3d3c30e88b5b9b7859b/src/AcfExportManager.php#L54-L68 |
helsingborg-stad/acf-export-manager | src/AcfExportManager.php | AcfExportManager.deleteExport | public function deleteExport(array $fieldgroup) : bool
{
$filename = $this->getExportFilename($fieldgroup);
$this->maybeUnlink($this->exportFolder . 'php/' . $filename['php']);
$this->maybeUnlink($this->exportFolder . 'json/' . $filename['json']);
return true;
} | php | public function deleteExport(array $fieldgroup) : bool
{
$filename = $this->getExportFilename($fieldgroup);
$this->maybeUnlink($this->exportFolder . 'php/' . $filename['php']);
$this->maybeUnlink($this->exportFolder . 'json/' . $filename['json']);
return true;
} | [
"public",
"function",
"deleteExport",
"(",
"array",
"$",
"fieldgroup",
")",
":",
"bool",
"{",
"$",
"filename",
"=",
"$",
"this",
"->",
"getExportFilename",
"(",
"$",
"fieldgroup",
")",
";",
"$",
"this",
"->",
"maybeUnlink",
"(",
"$",
"this",
"->",
"expor... | Deletes export file for deleted fieldgroup
@param array $fieldgroup
@return boolean | [
"Deletes",
"export",
"file",
"for",
"deleted",
"fieldgroup"
] | train | https://github.com/helsingborg-stad/acf-export-manager/blob/27e904a24eb013cac5c8f3d3c30e88b5b9b7859b/src/AcfExportManager.php#L75-L83 |
helsingborg-stad/acf-export-manager | src/AcfExportManager.php | AcfExportManager.export | public function export(array $fieldgroup, bool $restrictToExportPosts = true, bool $translate = true) : array
{
global $locale;
$locale = "en_US";
// Bail if the fieldgroup shouldn't be exported
if ($restrictToExportPosts && !in_array($fieldgroup['key'], $this->exportPosts)) {
... | php | public function export(array $fieldgroup, bool $restrictToExportPosts = true, bool $translate = true) : array
{
global $locale;
$locale = "en_US";
// Bail if the fieldgroup shouldn't be exported
if ($restrictToExportPosts && !in_array($fieldgroup['key'], $this->exportPosts)) {
... | [
"public",
"function",
"export",
"(",
"array",
"$",
"fieldgroup",
",",
"bool",
"$",
"restrictToExportPosts",
"=",
"true",
",",
"bool",
"$",
"translate",
"=",
"true",
")",
":",
"array",
"{",
"global",
"$",
"locale",
";",
"$",
"locale",
"=",
"\"en_US\"",
";... | Does the actual export of the php fields
@param array $fieldgroup Fieldgroup data
@return array Paths to exported files | [
"Does",
"the",
"actual",
"export",
"of",
"the",
"php",
"fields"
] | train | https://github.com/helsingborg-stad/acf-export-manager/blob/27e904a24eb013cac5c8f3d3c30e88b5b9b7859b/src/AcfExportManager.php#L101-L139 |
helsingborg-stad/acf-export-manager | src/AcfExportManager.php | AcfExportManager.getJson | public function getJson(array $fieldgroup) : string
{
$json = json_encode($fieldgroup, JSON_PRETTY_PRINT);
// Remove translation stuff from json
$json = str_replace('!!__(!!\'', '', $json);
$json = str_replace("!!', !!'" . $this->textdomain . "!!')!!", '', $json);
return '[... | php | public function getJson(array $fieldgroup) : string
{
$json = json_encode($fieldgroup, JSON_PRETTY_PRINT);
// Remove translation stuff from json
$json = str_replace('!!__(!!\'', '', $json);
$json = str_replace("!!', !!'" . $this->textdomain . "!!')!!", '', $json);
return '[... | [
"public",
"function",
"getJson",
"(",
"array",
"$",
"fieldgroup",
")",
":",
"string",
"{",
"$",
"json",
"=",
"json_encode",
"(",
"$",
"fieldgroup",
",",
"JSON_PRETTY_PRINT",
")",
";",
"// Remove translation stuff from json",
"$",
"json",
"=",
"str_replace",
"(",... | Get fieldgroup as json
@param array $fieldgroup
@return string | [
"Get",
"fieldgroup",
"as",
"json"
] | train | https://github.com/helsingborg-stad/acf-export-manager/blob/27e904a24eb013cac5c8f3d3c30e88b5b9b7859b/src/AcfExportManager.php#L146-L155 |
helsingborg-stad/acf-export-manager | src/AcfExportManager.php | AcfExportManager.maybeCreateExportFolders | public function maybeCreateExportFolders()
{
if (!is_writable($this->exportFolder)) {
trigger_error('The export folder (' . $this->exportFolder .') is not writable. Exports will not be saved.', E_USER_ERROR);
}
if (!file_exists($this->exportFolder . 'json')) {
mkdir(... | php | public function maybeCreateExportFolders()
{
if (!is_writable($this->exportFolder)) {
trigger_error('The export folder (' . $this->exportFolder .') is not writable. Exports will not be saved.', E_USER_ERROR);
}
if (!file_exists($this->exportFolder . 'json')) {
mkdir(... | [
"public",
"function",
"maybeCreateExportFolders",
"(",
")",
"{",
"if",
"(",
"!",
"is_writable",
"(",
"$",
"this",
"->",
"exportFolder",
")",
")",
"{",
"trigger_error",
"(",
"'The export folder ('",
".",
"$",
"this",
"->",
"exportFolder",
".",
"') is not writable... | Creates export folders if needed
@return void | [
"Creates",
"export",
"folders",
"if",
"needed"
] | train | https://github.com/helsingborg-stad/acf-export-manager/blob/27e904a24eb013cac5c8f3d3c30e88b5b9b7859b/src/AcfExportManager.php#L161-L176 |
helsingborg-stad/acf-export-manager | src/AcfExportManager.php | AcfExportManager.getExportFilename | public function getExportFilename(array $fieldgroup) : array
{
if ($key = array_search($fieldgroup['key'], $this->exportPosts)) {
return array(
'php' => $key . '.php',
'json' => $key . '.json'
);
}
return array(
'php' => sa... | php | public function getExportFilename(array $fieldgroup) : array
{
if ($key = array_search($fieldgroup['key'], $this->exportPosts)) {
return array(
'php' => $key . '.php',
'json' => $key . '.json'
);
}
return array(
'php' => sa... | [
"public",
"function",
"getExportFilename",
"(",
"array",
"$",
"fieldgroup",
")",
":",
"array",
"{",
"if",
"(",
"$",
"key",
"=",
"array_search",
"(",
"$",
"fieldgroup",
"[",
"'key'",
"]",
",",
"$",
"this",
"->",
"exportPosts",
")",
")",
"{",
"return",
"... | Get filename for the export file
@param array $fieldgroup Fieldgroup data
@return array | [
"Get",
"filename",
"for",
"the",
"export",
"file"
] | train | https://github.com/helsingborg-stad/acf-export-manager/blob/27e904a24eb013cac5c8f3d3c30e88b5b9b7859b/src/AcfExportManager.php#L192-L205 |
helsingborg-stad/acf-export-manager | src/AcfExportManager.php | AcfExportManager.generatePhp | protected function generatePhp(int $fieldgroupId, bool $translate = true) : string
{
$strReplace = array(
" " => " ",
"!!\'" => "'",
"'!!" => "",
"!!'" => "",
"array (" => "array(",
" => \n" => " => "
);
... | php | protected function generatePhp(int $fieldgroupId, bool $translate = true) : string
{
$strReplace = array(
" " => " ",
"!!\'" => "'",
"'!!" => "",
"!!'" => "",
"array (" => "array(",
" => \n" => " => "
);
... | [
"protected",
"function",
"generatePhp",
"(",
"int",
"$",
"fieldgroupId",
",",
"bool",
"$",
"translate",
"=",
"true",
")",
":",
"string",
"{",
"$",
"strReplace",
"=",
"array",
"(",
"\" \"",
"=>",
"\" \"",
",",
"\"!!\\'\"",
"=>",
"\"'\"",
",",
"\"'!!\"",... | Generates PHP exportcode for a fieldgroup
@param int $fieldgroupId
@return string | [
"Generates",
"PHP",
"exportcode",
"for",
"a",
"fieldgroup"
] | train | https://github.com/helsingborg-stad/acf-export-manager/blob/27e904a24eb013cac5c8f3d3c30e88b5b9b7859b/src/AcfExportManager.php#L212-L242 |
helsingborg-stad/acf-export-manager | src/AcfExportManager.php | AcfExportManager.getFieldgroupParams | public function getFieldgroupParams(int $fieldgroupId, bool $translate = true) : array
{
// Get the fieldgroup
$fieldgroup = acf_get_field_group($fieldgroupId);
// Bail if fieldgroup is empty
if (empty($fieldgroup)) {
trigger_error('The fieldgroup with id "' . $fieldgrou... | php | public function getFieldgroupParams(int $fieldgroupId, bool $translate = true) : array
{
// Get the fieldgroup
$fieldgroup = acf_get_field_group($fieldgroupId);
// Bail if fieldgroup is empty
if (empty($fieldgroup)) {
trigger_error('The fieldgroup with id "' . $fieldgrou... | [
"public",
"function",
"getFieldgroupParams",
"(",
"int",
"$",
"fieldgroupId",
",",
"bool",
"$",
"translate",
"=",
"true",
")",
":",
"array",
"{",
"// Get the fieldgroup",
"$",
"fieldgroup",
"=",
"acf_get_field_group",
"(",
"$",
"fieldgroupId",
")",
";",
"// Bail... | Get exportable fieldgroup params
@param int $fieldgroupId
@return array | [
"Get",
"exportable",
"fieldgroup",
"params"
] | train | https://github.com/helsingborg-stad/acf-export-manager/blob/27e904a24eb013cac5c8f3d3c30e88b5b9b7859b/src/AcfExportManager.php#L249-L270 |
helsingborg-stad/acf-export-manager | src/AcfExportManager.php | AcfExportManager.translate | public function translate(array $fieldgroup) : array
{
foreach ($fieldgroup['fields'] as &$field) {
if (function_exists('\acf_translate_field')) {
$field = \acf_translate_field($field);
}
}
return $fieldgroup;
} | php | public function translate(array $fieldgroup) : array
{
foreach ($fieldgroup['fields'] as &$field) {
if (function_exists('\acf_translate_field')) {
$field = \acf_translate_field($field);
}
}
return $fieldgroup;
} | [
"public",
"function",
"translate",
"(",
"array",
"$",
"fieldgroup",
")",
":",
"array",
"{",
"foreach",
"(",
"$",
"fieldgroup",
"[",
"'fields'",
"]",
"as",
"&",
"$",
"field",
")",
"{",
"if",
"(",
"function_exists",
"(",
"'\\acf_translate_field'",
")",
")",
... | Translate fieldgroup
@param array $fieldgroup
@return array | [
"Translate",
"fieldgroup"
] | train | https://github.com/helsingborg-stad/acf-export-manager/blob/27e904a24eb013cac5c8f3d3c30e88b5b9b7859b/src/AcfExportManager.php#L277-L287 |
helsingborg-stad/acf-export-manager | src/AcfExportManager.php | AcfExportManager.translateFieldParams | public function translateFieldParams(array $field) : array
{
$keys = array('prepend', 'append', 'placeholder', 'default_value');
foreach ($keys as $key) {
if (!isset($field[$key])) {
continue;
}
$field[$key] = acf_translate($field[$key]);
... | php | public function translateFieldParams(array $field) : array
{
$keys = array('prepend', 'append', 'placeholder', 'default_value');
foreach ($keys as $key) {
if (!isset($field[$key])) {
continue;
}
$field[$key] = acf_translate($field[$key]);
... | [
"public",
"function",
"translateFieldParams",
"(",
"array",
"$",
"field",
")",
":",
"array",
"{",
"$",
"keys",
"=",
"array",
"(",
"'prepend'",
",",
"'append'",
",",
"'placeholder'",
",",
"'default_value'",
")",
";",
"foreach",
"(",
"$",
"keys",
"as",
"$",
... | Translate field params
@param array $field ACF Field params
@return array Translated ACF field params | [
"Translate",
"field",
"params"
] | train | https://github.com/helsingborg-stad/acf-export-manager/blob/27e904a24eb013cac5c8f3d3c30e88b5b9b7859b/src/AcfExportManager.php#L294-L316 |
helsingborg-stad/acf-export-manager | src/AcfExportManager.php | AcfExportManager.setExportFolder | public function setExportFolder(string $folder)
{
$folder = trailingslashit($folder);
if (!file_exists($folder)) {
if (!mkdir($folder)) {
trigger_error('The export folder (' . $folder .') can not be found. Exports will not be saved.', E_USER_WARNING);
} else ... | php | public function setExportFolder(string $folder)
{
$folder = trailingslashit($folder);
if (!file_exists($folder)) {
if (!mkdir($folder)) {
trigger_error('The export folder (' . $folder .') can not be found. Exports will not be saved.', E_USER_WARNING);
} else ... | [
"public",
"function",
"setExportFolder",
"(",
"string",
"$",
"folder",
")",
"{",
"$",
"folder",
"=",
"trailingslashit",
"(",
"$",
"folder",
")",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"folder",
")",
")",
"{",
"if",
"(",
"!",
"mkdir",
"(",
"$",... | Set exports folder
@param string $folder Path to exports folder
@return void | [
"Set",
"exports",
"folder"
] | train | https://github.com/helsingborg-stad/acf-export-manager/blob/27e904a24eb013cac5c8f3d3c30e88b5b9b7859b/src/AcfExportManager.php#L323-L336 |
helsingborg-stad/acf-export-manager | src/AcfExportManager.php | AcfExportManager.autoExport | public function autoExport(array $ids)
{
$this->exportPosts = array_replace($this->exportPosts, $ids);
$this->exportPosts = array_unique($this->exportPosts);
} | php | public function autoExport(array $ids)
{
$this->exportPosts = array_replace($this->exportPosts, $ids);
$this->exportPosts = array_unique($this->exportPosts);
} | [
"public",
"function",
"autoExport",
"(",
"array",
"$",
"ids",
")",
"{",
"$",
"this",
"->",
"exportPosts",
"=",
"array_replace",
"(",
"$",
"this",
"->",
"exportPosts",
",",
"$",
"ids",
")",
";",
"$",
"this",
"->",
"exportPosts",
"=",
"array_unique",
"(",
... | Sets which acf-fieldgroups postids to autoexport
@param array $ids
@return void | [
"Sets",
"which",
"acf",
"-",
"fieldgroups",
"postids",
"to",
"autoexport"
] | train | https://github.com/helsingborg-stad/acf-export-manager/blob/27e904a24eb013cac5c8f3d3c30e88b5b9b7859b/src/AcfExportManager.php#L343-L347 |
helsingborg-stad/acf-export-manager | src/AcfExportManager.php | AcfExportManager.handleBulkExport | public function handleBulkExport($redirectTo, $doaction, $postIds)
{
if ($doaction !== 'acfExportManager-export') {
return $redirectTo;
}
foreach ($postIds as $postId) {
$fieldgroup = acf_get_field_group($postId);
if (!in_array($fieldgroup['key'], $this... | php | public function handleBulkExport($redirectTo, $doaction, $postIds)
{
if ($doaction !== 'acfExportManager-export') {
return $redirectTo;
}
foreach ($postIds as $postId) {
$fieldgroup = acf_get_field_group($postId);
if (!in_array($fieldgroup['key'], $this... | [
"public",
"function",
"handleBulkExport",
"(",
"$",
"redirectTo",
",",
"$",
"doaction",
",",
"$",
"postIds",
")",
"{",
"if",
"(",
"$",
"doaction",
"!==",
"'acfExportManager-export'",
")",
"{",
"return",
"$",
"redirectTo",
";",
"}",
"foreach",
"(",
"$",
"po... | Handles bulk exporting
@param string $redirectTo Redirect
@param string $doaction The bulk action to do
@param array $postIds Selected posts
@return string The redirect | [
"Handles",
"bulk",
"exporting"
] | train | https://github.com/helsingborg-stad/acf-export-manager/blob/27e904a24eb013cac5c8f3d3c30e88b5b9b7859b/src/AcfExportManager.php#L375-L394 |
phpmob/changmin | src/PhpMob/MediaBundle/EventListener/UploadFileListener.php | UploadFileListener.postRemove | public function postRemove(LifecycleEventArgs $args)
{
$object = $args->getObject();
if (!$object instanceof FileInterface) {
return;
}
$this->removeFile($object->getPath());
} | php | public function postRemove(LifecycleEventArgs $args)
{
$object = $args->getObject();
if (!$object instanceof FileInterface) {
return;
}
$this->removeFile($object->getPath());
} | [
"public",
"function",
"postRemove",
"(",
"LifecycleEventArgs",
"$",
"args",
")",
"{",
"$",
"object",
"=",
"$",
"args",
"->",
"getObject",
"(",
")",
";",
"if",
"(",
"!",
"$",
"object",
"instanceof",
"FileInterface",
")",
"{",
"return",
";",
"}",
"$",
"t... | {@inheritdoc} | [
"{"
] | train | https://github.com/phpmob/changmin/blob/bfebb1561229094d1c138574abab75f2f1d17d66/src/PhpMob/MediaBundle/EventListener/UploadFileListener.php#L61-L70 |
controlabs/routify | src/Routify/RouteCollection.php | RouteCollection.add | public function add(Route $route)
{
// $this->routes[$route->method()][$route->uri()] = $route;
$this->routes[$route->method().$route->route()] = $route;
return $route;
} | php | public function add(Route $route)
{
// $this->routes[$route->method()][$route->uri()] = $route;
$this->routes[$route->method().$route->route()] = $route;
return $route;
} | [
"public",
"function",
"add",
"(",
"Route",
"$",
"route",
")",
"{",
"// $this->routes[$route->method()][$route->uri()] = $route;",
"$",
"this",
"->",
"routes",
"[",
"$",
"route",
"->",
"method",
"(",
")",
".",
"$",
"route",
"->",
"route",
"(",
")",
"]",
"=",
... | Add a Route instance to the collection.
@param \Controlabs\Routify\Route $route
@return \Controlabs\Routify\Route | [
"Add",
"a",
"Route",
"instance",
"to",
"the",
"collection",
"."
] | train | https://github.com/controlabs/routify/blob/a4e92000fc61ddc7f297984ef9924b6d9df508a4/src/Routify/RouteCollection.php#L25-L30 |
forkiss/pharest | src/Pharest/ExceptionHandler.php | ExceptionHandler.hasCustomHandler | public function hasCustomHandler()
{
if (!class_exists(\App\Exception\Handler::class)) {
return false;
}
if (!in_array(\Pharest\Exception\ExceptionHandler::class, class_implements(\App\Exception\Handler::class))) {
return false;
}
return true;
} | php | public function hasCustomHandler()
{
if (!class_exists(\App\Exception\Handler::class)) {
return false;
}
if (!in_array(\Pharest\Exception\ExceptionHandler::class, class_implements(\App\Exception\Handler::class))) {
return false;
}
return true;
} | [
"public",
"function",
"hasCustomHandler",
"(",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"\\",
"App",
"\\",
"Exception",
"\\",
"Handler",
"::",
"class",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"in_array",
"(",
"\\",
"Pharest",
... | Determine if the app has custom exception handler
@return bool | [
"Determine",
"if",
"the",
"app",
"has",
"custom",
"exception",
"handler"
] | train | https://github.com/forkiss/pharest/blob/f8b444f9bba446bf7994d98f27585529aefed565/src/Pharest/ExceptionHandler.php#L34-L45 |
ClanCats/Core | src/bundles/Session/Manager/Cookie.php | Manager_Cookie.read | public function read( $id )
{
if ( $this->has( $id ) )
{
return json_decode( \CCCrypter::decode( \CCCookie::get( $id.$this->cookie_suffix ), $this->crypt_salt ), true );
}
return array();
} | php | public function read( $id )
{
if ( $this->has( $id ) )
{
return json_decode( \CCCrypter::decode( \CCCookie::get( $id.$this->cookie_suffix ), $this->crypt_salt ), true );
}
return array();
} | [
"public",
"function",
"read",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"has",
"(",
"$",
"id",
")",
")",
"{",
"return",
"json_decode",
"(",
"\\",
"CCCrypter",
"::",
"decode",
"(",
"\\",
"CCCookie",
"::",
"get",
"(",
"$",
"id",
".",
... | Read data from the session dirver
@param string $id The session id key.
@return array | [
"Read",
"data",
"from",
"the",
"session",
"dirver"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Session/Manager/Cookie.php#L43-L51 |
ClanCats/Core | src/bundles/Session/Manager/Cookie.php | Manager_Cookie.write | public function write( $id, $data )
{
\CCCookie::set( $id.$this->cookie_suffix, \CCCrypter::encode( json_encode( $data ), $this->crypt_salt ) );
} | php | public function write( $id, $data )
{
\CCCookie::set( $id.$this->cookie_suffix, \CCCrypter::encode( json_encode( $data ), $this->crypt_salt ) );
} | [
"public",
"function",
"write",
"(",
"$",
"id",
",",
"$",
"data",
")",
"{",
"\\",
"CCCookie",
"::",
"set",
"(",
"$",
"id",
".",
"$",
"this",
"->",
"cookie_suffix",
",",
"\\",
"CCCrypter",
"::",
"encode",
"(",
"json_encode",
"(",
"$",
"data",
")",
",... | Check if a session with the given key already exists
@param string $id The session id key.
@param array $data
@return bool | [
"Check",
"if",
"a",
"session",
"with",
"the",
"given",
"key",
"already",
"exists"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Session/Manager/Cookie.php#L71-L74 |
transfer-framework/ezplatform | src/Transfer/EzPlatform/Repository/Manager/ContentManager.php | ContentManager.find | public function find(ValueObject $object)
{
try {
if ($object->getProperty('remote_id')) {
$content = $this->contentService->loadContentByRemoteId($object->getProperty('remote_id'));
}
} catch (NotFoundException $notFoundException) {
// We'll throw... | php | public function find(ValueObject $object)
{
try {
if ($object->getProperty('remote_id')) {
$content = $this->contentService->loadContentByRemoteId($object->getProperty('remote_id'));
}
} catch (NotFoundException $notFoundException) {
// We'll throw... | [
"public",
"function",
"find",
"(",
"ValueObject",
"$",
"object",
")",
"{",
"try",
"{",
"if",
"(",
"$",
"object",
"->",
"getProperty",
"(",
"'remote_id'",
")",
")",
"{",
"$",
"content",
"=",
"$",
"this",
"->",
"contentService",
"->",
"loadContentByRemoteId"... | {@inheritdoc} | [
"{"
] | train | https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/ContentManager.php#L93-L108 |
transfer-framework/ezplatform | src/Transfer/EzPlatform/Repository/Manager/ContentManager.php | ContentManager.create | public function create(ObjectInterface $object)
{
if (!$object instanceof ContentObject) {
throw new UnsupportedObjectOperationException(ContentObject::class, get_class($object));
}
$this->ensureDefaults($object);
$createStruct = $this->contentService->newContentCreateS... | php | public function create(ObjectInterface $object)
{
if (!$object instanceof ContentObject) {
throw new UnsupportedObjectOperationException(ContentObject::class, get_class($object));
}
$this->ensureDefaults($object);
$createStruct = $this->contentService->newContentCreateS... | [
"public",
"function",
"create",
"(",
"ObjectInterface",
"$",
"object",
")",
"{",
"if",
"(",
"!",
"$",
"object",
"instanceof",
"ContentObject",
")",
"{",
"throw",
"new",
"UnsupportedObjectOperationException",
"(",
"ContentObject",
"::",
"class",
",",
"get_class",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/ContentManager.php#L113-L151 |
transfer-framework/ezplatform | src/Transfer/EzPlatform/Repository/Manager/ContentManager.php | ContentManager.update | public function update(ObjectInterface $object)
{
if (!$object instanceof ContentObject) {
throw new UnsupportedObjectOperationException(ContentObject::class, get_class($object));
}
$this->ensureDefaults($object);
$existingContent = $this->find($object);
if (nul... | php | public function update(ObjectInterface $object)
{
if (!$object instanceof ContentObject) {
throw new UnsupportedObjectOperationException(ContentObject::class, get_class($object));
}
$this->ensureDefaults($object);
$existingContent = $this->find($object);
if (nul... | [
"public",
"function",
"update",
"(",
"ObjectInterface",
"$",
"object",
")",
"{",
"if",
"(",
"!",
"$",
"object",
"instanceof",
"ContentObject",
")",
"{",
"throw",
"new",
"UnsupportedObjectOperationException",
"(",
"ContentObject",
"::",
"class",
",",
"get_class",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/ContentManager.php#L156-L189 |
transfer-framework/ezplatform | src/Transfer/EzPlatform/Repository/Manager/ContentManager.php | ContentManager.remove | public function remove(ObjectInterface $object)
{
if (!$object instanceof ContentObject) {
throw new UnsupportedObjectOperationException(ContentObject::class, get_class($object));
}
try {
$content = $this->find($object);
$this->contentService->deleteConte... | php | public function remove(ObjectInterface $object)
{
if (!$object instanceof ContentObject) {
throw new UnsupportedObjectOperationException(ContentObject::class, get_class($object));
}
try {
$content = $this->find($object);
$this->contentService->deleteConte... | [
"public",
"function",
"remove",
"(",
"ObjectInterface",
"$",
"object",
")",
"{",
"if",
"(",
"!",
"$",
"object",
"instanceof",
"ContentObject",
")",
"{",
"throw",
"new",
"UnsupportedObjectOperationException",
"(",
"ContentObject",
"::",
"class",
",",
"get_class",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/ContentManager.php#L212-L226 |
transfer-framework/ezplatform | src/Transfer/EzPlatform/Repository/Manager/ContentManager.php | ContentManager.ensureDefaults | private function ensureDefaults(ContentObject $object)
{
$defaultProperties = ['main_language_code'];
foreach ($defaultProperties as $defaultOption) {
if (!$object->getProperty($defaultOption)) {
$object->setProperty($defaultOption, $this->options[$defaultOption]);
... | php | private function ensureDefaults(ContentObject $object)
{
$defaultProperties = ['main_language_code'];
foreach ($defaultProperties as $defaultOption) {
if (!$object->getProperty($defaultOption)) {
$object->setProperty($defaultOption, $this->options[$defaultOption]);
... | [
"private",
"function",
"ensureDefaults",
"(",
"ContentObject",
"$",
"object",
")",
"{",
"$",
"defaultProperties",
"=",
"[",
"'main_language_code'",
"]",
";",
"foreach",
"(",
"$",
"defaultProperties",
"as",
"$",
"defaultOption",
")",
"{",
"if",
"(",
"!",
"$",
... | @param ContentObject $object
@return ContentObject | [
"@param",
"ContentObject",
"$object"
] | train | https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/ContentManager.php#L233-L242 |
ClanCats/Core | src/classes/CCDate.php | CCDate.relative | public static function relative($ts)
{
if(!ctype_digit($ts))
$ts = strtotime($ts);
$diff = time() - $ts;
if($diff == 0)
return __('Core::common.date.now');
elseif($diff > 0)
{
$day_diff = floor($diff / 86400);
if($day_diff == 0)
{
if($diff < 60) return __('Core::common.date.just_now');
... | php | public static function relative($ts)
{
if(!ctype_digit($ts))
$ts = strtotime($ts);
$diff = time() - $ts;
if($diff == 0)
return __('Core::common.date.now');
elseif($diff > 0)
{
$day_diff = floor($diff / 86400);
if($day_diff == 0)
{
if($diff < 60) return __('Core::common.date.just_now');
... | [
"public",
"static",
"function",
"relative",
"(",
"$",
"ts",
")",
"{",
"if",
"(",
"!",
"ctype_digit",
"(",
"$",
"ts",
")",
")",
"$",
"ts",
"=",
"strtotime",
"(",
"$",
"ts",
")",
";",
"$",
"diff",
"=",
"time",
"(",
")",
"-",
"$",
"ts",
";",
"if... | to string relative string
@param int $ts
@return string | [
"to",
"string",
"relative",
"string"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCDate.php#L100-L143 |
ppetermann/king23 | src/TwigIntegration/TwigController.php | TwigController.render | protected function render($template, $context = [])
{
$context = array_merge($this->_context, $context);
$body = $this->twig->render($template, $context);
return $body;
} | php | protected function render($template, $context = [])
{
$context = array_merge($this->_context, $context);
$body = $this->twig->render($template, $context);
return $body;
} | [
"protected",
"function",
"render",
"(",
"$",
"template",
",",
"$",
"context",
"=",
"[",
"]",
")",
"{",
"$",
"context",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"_context",
",",
"$",
"context",
")",
";",
"$",
"body",
"=",
"$",
"this",
"->",
"twig... | render template with context, will merge context with allready known
context
@param string $template
@param array $context
@return string | [
"render",
"template",
"with",
"context",
"will",
"merge",
"context",
"with",
"allready",
"known",
"context"
] | train | https://github.com/ppetermann/king23/blob/603896083ec89f5ac4d744abd3b1b4db3e914c95/src/TwigIntegration/TwigController.php#L95-L100 |
iocaste/microservice-foundation | src/Seeder/Seeder.php | Seeder.truncateTables | public function truncateTables()
{
$dbName = env('DB_DATABASE');
// Get all tables list, except migrations table
$tables = DB::select('SHOW TABLES WHERE `Tables_in_'.$dbName.'` != ?', ['migrations']);
DB::statement('SET FOREIGN_KEY_CHECKS=0;');
foreach ($tables as $table) {... | php | public function truncateTables()
{
$dbName = env('DB_DATABASE');
// Get all tables list, except migrations table
$tables = DB::select('SHOW TABLES WHERE `Tables_in_'.$dbName.'` != ?', ['migrations']);
DB::statement('SET FOREIGN_KEY_CHECKS=0;');
foreach ($tables as $table) {... | [
"public",
"function",
"truncateTables",
"(",
")",
"{",
"$",
"dbName",
"=",
"env",
"(",
"'DB_DATABASE'",
")",
";",
"// Get all tables list, except migrations table",
"$",
"tables",
"=",
"DB",
"::",
"select",
"(",
"'SHOW TABLES WHERE `Tables_in_'",
".",
"$",
"dbName",... | Truncates all tables except migrations. | [
"Truncates",
"all",
"tables",
"except",
"migrations",
"."
] | train | https://github.com/iocaste/microservice-foundation/blob/274a154de4299e8a57314bab972e09f6d8cdae9e/src/Seeder/Seeder.php#L16-L28 |
joomlatools/joomlatools-platform-legacy | code/form/field/componentlayout.php | JFormFieldComponentlayout.getInput | protected function getInput()
{
// Get the client id.
$clientId = $this->element['client_id'];
if (is_null($clientId) && $this->form instanceof JForm)
{
$clientId = $this->form->getValue('client_id');
}
$clientId = (int) $clientId;
$client = JApplicationHelper::getClientInfo($clientId);
// Get t... | php | protected function getInput()
{
// Get the client id.
$clientId = $this->element['client_id'];
if (is_null($clientId) && $this->form instanceof JForm)
{
$clientId = $this->form->getValue('client_id');
}
$clientId = (int) $clientId;
$client = JApplicationHelper::getClientInfo($clientId);
// Get t... | [
"protected",
"function",
"getInput",
"(",
")",
"{",
"// Get the client id.",
"$",
"clientId",
"=",
"$",
"this",
"->",
"element",
"[",
"'client_id'",
"]",
";",
"if",
"(",
"is_null",
"(",
"$",
"clientId",
")",
"&&",
"$",
"this",
"->",
"form",
"instanceof",
... | Method to get the field input for a component layout field.
@return string The field input.
@since 11.1 | [
"Method",
"to",
"get",
"the",
"field",
"input",
"for",
"a",
"component",
"layout",
"field",
"."
] | train | https://github.com/joomlatools/joomlatools-platform-legacy/blob/3a76944e2f2c415faa6504754c75321a3b478c06/code/form/field/componentlayout.php#L37-L256 |
PeekAndPoke/psi | src/Operation/FullSet/UserSortOperation.php | UserSortOperation.apply | public function apply(\Iterator $set)
{
$data = iterator_to_array($set);
usort($data, $this->function);
return new \ArrayIterator($data);
} | php | public function apply(\Iterator $set)
{
$data = iterator_to_array($set);
usort($data, $this->function);
return new \ArrayIterator($data);
} | [
"public",
"function",
"apply",
"(",
"\\",
"Iterator",
"$",
"set",
")",
"{",
"$",
"data",
"=",
"iterator_to_array",
"(",
"$",
"set",
")",
";",
"usort",
"(",
"$",
"data",
",",
"$",
"this",
"->",
"function",
")",
";",
"return",
"new",
"\\",
"ArrayIterat... | {@inheritdoc} | [
"{"
] | train | https://github.com/PeekAndPoke/psi/blob/cfd45d995d3a2c2ea6ba5b1ce7b5fcc71179456f/src/Operation/FullSet/UserSortOperation.php#L23-L30 |
CakeCMS/Core | src/View/Form/EntityContext.php | EntityContext.val | public function val($field, $options = [])
{
$val = parent::val($field, $options);
if ($val === null) {
$parts = explode('.', $field);
$entity = $this->entity($parts);
if ($entity instanceof Data) {
$key = array_pop($parts);
$val ... | php | public function val($field, $options = [])
{
$val = parent::val($field, $options);
if ($val === null) {
$parts = explode('.', $field);
$entity = $this->entity($parts);
if ($entity instanceof Data) {
$key = array_pop($parts);
$val ... | [
"public",
"function",
"val",
"(",
"$",
"field",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"val",
"=",
"parent",
"::",
"val",
"(",
"$",
"field",
",",
"$",
"options",
")",
";",
"if",
"(",
"$",
"val",
"===",
"null",
")",
"{",
"$",
"part... | Get the value for a given path.
@param string $field
@param array $options
@return mixed | [
"Get",
"the",
"value",
"for",
"a",
"given",
"path",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Form/EntityContext.php#L36-L50 |
mremi/Flowdock | src/Mremi/Flowdock/Command/SendChatMessageCommand.php | SendChatMessageCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$push = new Push($input->getArgument('flow-api-token'));
$message = ChatMessage::create()
->setContent($input->getArgument('content'))
->setExternalUserName($input->getArgument('external-user-name')... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$push = new Push($input->getArgument('flow-api-token'));
$message = ChatMessage::create()
->setContent($input->getArgument('content'))
->setExternalUserName($input->getArgument('external-user-name')... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"push",
"=",
"new",
"Push",
"(",
"$",
"input",
"->",
"getArgument",
"(",
"'flow-api-token'",
")",
")",
";",
"$",
"message",
"=",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/mremi/Flowdock/blob/287bfdcef17529055f803f2316e3ad31826e79eb/src/Mremi/Flowdock/Command/SendChatMessageCommand.php#L51-L71 |
VincentChalnot/SidusAdminBundle | DependencyInjection/SidusAdminExtension.php | SidusAdminExtension.load | public function load(array $configs, ContainerBuilder $container): void
{
$this->globalConfig = $this->processConfiguration($this->createConfiguration(), $configs);
$container->setParameter(
'sidus_admin.templating.fallback_template_directory',
$this->globalConfig['fallback_... | php | public function load(array $configs, ContainerBuilder $container): void
{
$this->globalConfig = $this->processConfiguration($this->createConfiguration(), $configs);
$container->setParameter(
'sidus_admin.templating.fallback_template_directory',
$this->globalConfig['fallback_... | [
"public",
"function",
"load",
"(",
"array",
"$",
"configs",
",",
"ContainerBuilder",
"$",
"container",
")",
":",
"void",
"{",
"$",
"this",
"->",
"globalConfig",
"=",
"$",
"this",
"->",
"processConfiguration",
"(",
"$",
"this",
"->",
"createConfiguration",
"(... | {@inheritdoc}
@throws \Exception
@throws BadMethodCallException | [
"{"
] | train | https://github.com/VincentChalnot/SidusAdminBundle/blob/3366f3f1525435860cf275ed2f1f0b58cf6eea18/DependencyInjection/SidusAdminExtension.php#L36-L50 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.