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 |
|---|---|---|---|---|---|---|---|---|---|---|
mossphp/moss-storage | Moss/Storage/Schema/Schema.php | Schema.quoteIdentifier | protected function quoteIdentifier($identifier)
{
if (!is_array($identifier)) {
return $this->connection->quoteIdentifier($identifier);
}
foreach ($identifier as &$value) {
$value = $this->connection->quoteIdentifier($value);
unset($value);
}
... | php | protected function quoteIdentifier($identifier)
{
if (!is_array($identifier)) {
return $this->connection->quoteIdentifier($identifier);
}
foreach ($identifier as &$value) {
$value = $this->connection->quoteIdentifier($value);
unset($value);
}
... | [
"protected",
"function",
"quoteIdentifier",
"(",
"$",
"identifier",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"identifier",
")",
")",
"{",
"return",
"$",
"this",
"->",
"connection",
"->",
"quoteIdentifier",
"(",
"$",
"identifier",
")",
";",
"}",
"f... | Quotes SQL identifier or array of identifiers
@param string|array $identifier
@return string|array | [
"Quotes",
"SQL",
"identifier",
"or",
"array",
"of",
"identifiers"
] | train | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Schema/Schema.php#L249-L261 |
mossphp/moss-storage | Moss/Storage/Schema/Schema.php | Schema.buildDrop | protected function buildDrop(array $models)
{
$fromSchema = $this->connection->getSchemaManager()->createSchema();
$toSchema = clone $fromSchema;
foreach ($models as $model) {
if (!$toSchema->hasTable($model->table())) {
continue;
}
$toSc... | php | protected function buildDrop(array $models)
{
$fromSchema = $this->connection->getSchemaManager()->createSchema();
$toSchema = clone $fromSchema;
foreach ($models as $model) {
if (!$toSchema->hasTable($model->table())) {
continue;
}
$toSc... | [
"protected",
"function",
"buildDrop",
"(",
"array",
"$",
"models",
")",
"{",
"$",
"fromSchema",
"=",
"$",
"this",
"->",
"connection",
"->",
"getSchemaManager",
"(",
")",
"->",
"createSchema",
"(",
")",
";",
"$",
"toSchema",
"=",
"clone",
"$",
"fromSchema",... | Builds drop table query
@param ModelInterface[] $models | [
"Builds",
"drop",
"table",
"query"
] | train | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Schema/Schema.php#L268-L284 |
mossphp/moss-storage | Moss/Storage/Schema/Schema.php | Schema.execute | public function execute()
{
$result = [];
foreach ($this->queryString() as $query) {
$stmt = $this->connection->prepare($query);
$stmt->execute();
$result[] = $query;
}
$this->reset();
return $result;
} | php | public function execute()
{
$result = [];
foreach ($this->queryString() as $query) {
$stmt = $this->connection->prepare($query);
$stmt->execute();
$result[] = $query;
}
$this->reset();
return $result;
} | [
"public",
"function",
"execute",
"(",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"queryString",
"(",
")",
"as",
"$",
"query",
")",
"{",
"$",
"stmt",
"=",
"$",
"this",
"->",
"connection",
"->",
"prepare",
"(",
... | Executes query
After execution query is reset
@return mixed|null|void | [
"Executes",
"query",
"After",
"execution",
"query",
"is",
"reset"
] | train | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Schema/Schema.php#L292-L305 |
jabernardo/lollipop-php | Library/Cache/MemcachedAdapter.php | MemcachedAdapter.exists | public function exists($key) {
$key = $this->_encrypt($key);
$data = $this->_memcached->get($key);
return $data ? true : false;
} | php | public function exists($key) {
$key = $this->_encrypt($key);
$data = $this->_memcached->get($key);
return $data ? true : false;
} | [
"public",
"function",
"exists",
"(",
"$",
"key",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"_encrypt",
"(",
"$",
"key",
")",
";",
"$",
"data",
"=",
"$",
"this",
"->",
"_memcached",
"->",
"get",
"(",
"$",
"key",
")",
";",
"return",
"$",
"dat... | Check if cache exists
@access public
@param string $key Cache key
@return bool | [
"Check",
"if",
"cache",
"exists"
] | train | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/Cache/MemcachedAdapter.php#L72-L77 |
jabernardo/lollipop-php | Library/Cache/MemcachedAdapter.php | MemcachedAdapter.save | public function save($key, $data, $force = false, $ttl = 1440) {
$ttl = $ttl * 60; // Minutes to Seconds
// Store result from last query for checking if cache is existing
// This will avoid locked database error for sqlite3
$cache_exists = $this->exists($key);
if (!$cache_exists... | php | public function save($key, $data, $force = false, $ttl = 1440) {
$ttl = $ttl * 60; // Minutes to Seconds
// Store result from last query for checking if cache is existing
// This will avoid locked database error for sqlite3
$cache_exists = $this->exists($key);
if (!$cache_exists... | [
"public",
"function",
"save",
"(",
"$",
"key",
",",
"$",
"data",
",",
"$",
"force",
"=",
"false",
",",
"$",
"ttl",
"=",
"1440",
")",
"{",
"$",
"ttl",
"=",
"$",
"ttl",
"*",
"60",
";",
"// Minutes to Seconds",
"// Store result from last query for checking if... | Save cache
@access public
@param string $key Cache key
@param mixed $data Data to be saved
@param bool $force Force to override old data
@param int $ttl Time-to-leave (default to 24 Hrs)
@return bool | [
"Save",
"cache"
] | train | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/Cache/MemcachedAdapter.php#L90-L104 |
jabernardo/lollipop-php | Library/Cache/MemcachedAdapter.php | MemcachedAdapter.remove | public function remove($key) {
if ($this->exists($key)) {
$key = $this->_encrypt($key);
$this->_memcached->delete($key);
return true;
}
return false;
} | php | public function remove($key) {
if ($this->exists($key)) {
$key = $this->_encrypt($key);
$this->_memcached->delete($key);
return true;
}
return false;
} | [
"public",
"function",
"remove",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"exists",
"(",
"$",
"key",
")",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"_encrypt",
"(",
"$",
"key",
")",
";",
"$",
"this",
"->",
"_memcached",
"->",... | Remove cache
@access public
@param string $key
@return bool | [
"Remove",
"cache"
] | train | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/Cache/MemcachedAdapter.php#L126-L135 |
ZendExperts/phpids | lib/IDS/Caching/Apc.php | IDS_Caching_Apc.getInstance | public static function getInstance($type, $init)
{
if (!self::$cachingInstance) {
self::$cachingInstance = new IDS_Caching_Apc($type, $init);
}
return self::$cachingInstance;
} | php | public static function getInstance($type, $init)
{
if (!self::$cachingInstance) {
self::$cachingInstance = new IDS_Caching_Apc($type, $init);
}
return self::$cachingInstance;
} | [
"public",
"static",
"function",
"getInstance",
"(",
"$",
"type",
",",
"$",
"init",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"$",
"cachingInstance",
")",
"{",
"self",
"::",
"$",
"cachingInstance",
"=",
"new",
"IDS_Caching_Apc",
"(",
"$",
"type",
",",
"$"... | Returns an instance of this class
@param string $type caching type
@param object $init the IDS_Init object
@return object $this | [
"Returns",
"an",
"instance",
"of",
"this",
"class"
] | train | https://github.com/ZendExperts/phpids/blob/f30df04eea47b94d056e2ae9ec8fea1c626f1c03/lib/IDS/Caching/Apc.php#L104-L112 |
PowerSync/tnw-soap-client | src/Tnw/SoapClient/Result/DescribeSObjectResult.php | DescribeSObjectResult.getChildRelationship | public function getChildRelationship($name)
{
$result = array_filter($this->getChildRelationships(), function($input) use ($name) {
return $name === $input->getRelationshipName();
});
return reset($result);
} | php | public function getChildRelationship($name)
{
$result = array_filter($this->getChildRelationships(), function($input) use ($name) {
return $name === $input->getRelationshipName();
});
return reset($result);
} | [
"public",
"function",
"getChildRelationship",
"(",
"$",
"name",
")",
"{",
"$",
"result",
"=",
"array_filter",
"(",
"$",
"this",
"->",
"getChildRelationships",
"(",
")",
",",
"function",
"(",
"$",
"input",
")",
"use",
"(",
"$",
"name",
")",
"{",
"return",... | Get child relationship by name
@param string $name Relationship name
@return ChildRelationship | [
"Get",
"child",
"relationship",
"by",
"name"
] | train | https://github.com/PowerSync/tnw-soap-client/blob/cd936da20bdfbd6da99fe44ffa1a4761e0b56c23/src/Tnw/SoapClient/Result/DescribeSObjectResult.php#L54-L61 |
PowerSync/tnw-soap-client | src/Tnw/SoapClient/Result/DescribeSObjectResult.php | DescribeSObjectResult.getField | public function getField($field)
{
$result = array_filter($this->getFields(), function($input) use ($field) {
return $field === $input->getName();
});
return reset($result);
} | php | public function getField($field)
{
$result = array_filter($this->getFields(), function($input) use ($field) {
return $field === $input->getName();
});
return reset($result);
} | [
"public",
"function",
"getField",
"(",
"$",
"field",
")",
"{",
"$",
"result",
"=",
"array_filter",
"(",
"$",
"this",
"->",
"getFields",
"(",
")",
",",
"function",
"(",
"$",
"input",
")",
"use",
"(",
"$",
"field",
")",
"{",
"return",
"$",
"field",
"... | Get field description by field name
@param string $field Field name
@return Field | [
"Get",
"field",
"description",
"by",
"field",
"name"
] | train | https://github.com/PowerSync/tnw-soap-client/blob/cd936da20bdfbd6da99fe44ffa1a4761e0b56c23/src/Tnw/SoapClient/Result/DescribeSObjectResult.php#L126-L133 |
PowerSync/tnw-soap-client | src/Tnw/SoapClient/Result/DescribeSObjectResult.php | DescribeSObjectResult.getRelationshipField | public function getRelationshipField($name)
{
$result = array_filter($this->getRelationshipFields(), function($field) use ($name) {
return $name === $field->getName();
});
return reset($result);
} | php | public function getRelationshipField($name)
{
$result = array_filter($this->getRelationshipFields(), function($field) use ($name) {
return $name === $field->getName();
});
return reset($result);
} | [
"public",
"function",
"getRelationshipField",
"(",
"$",
"name",
")",
"{",
"$",
"result",
"=",
"array_filter",
"(",
"$",
"this",
"->",
"getRelationshipFields",
"(",
")",
",",
"function",
"(",
"$",
"field",
")",
"use",
"(",
"$",
"name",
")",
"{",
"return",... | Get a relationship field
@param string $name
@return Field | [
"Get",
"a",
"relationship",
"field"
] | train | https://github.com/PowerSync/tnw-soap-client/blob/cd936da20bdfbd6da99fe44ffa1a4761e0b56c23/src/Tnw/SoapClient/Result/DescribeSObjectResult.php#L257-L264 |
JurJean/SpraySerializer | src/Object/BoundClosureSerializer.php | BoundClosureSerializer.construct | public function construct($subject, &$data = array())
{
if (null === $this->constructed) {
$this->constructed = unserialize(
sprintf(
'O:%d:"%s":0:{}',
strlen($subject),
$subject
)
);
... | php | public function construct($subject, &$data = array())
{
if (null === $this->constructed) {
$this->constructed = unserialize(
sprintf(
'O:%d:"%s":0:{}',
strlen($subject),
$subject
)
);
... | [
"public",
"function",
"construct",
"(",
"$",
"subject",
",",
"&",
"$",
"data",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"constructed",
")",
"{",
"$",
"this",
"->",
"constructed",
"=",
"unserialize",
"(",
"sprintf... | Construct a new object.
By default a new empty object is deserialized and from then on cloned.
@param string $subject The class name of the object to create
@param array $data The data to deserialize
@return object | [
"Construct",
"a",
"new",
"object",
"."
] | train | https://github.com/JurJean/SpraySerializer/blob/4d2883efe489cc8716aea3334f622a576f650397/src/Object/BoundClosureSerializer.php#L65-L77 |
JurJean/SpraySerializer | src/Object/BoundClosureSerializer.php | BoundClosureSerializer.serializer | protected function serializer()
{
if (null === $this->serializer) {
$self = $this;
$this->serializer = Closure::bind($this->bindSerializer(), null, $this->class);
}
return $this->serializer;
} | php | protected function serializer()
{
if (null === $this->serializer) {
$self = $this;
$this->serializer = Closure::bind($this->bindSerializer(), null, $this->class);
}
return $this->serializer;
} | [
"protected",
"function",
"serializer",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"serializer",
")",
"{",
"$",
"self",
"=",
"$",
"this",
";",
"$",
"this",
"->",
"serializer",
"=",
"Closure",
"::",
"bind",
"(",
"$",
"this",
"->",
"b... | Get a reference to the bound serialization closure.
@return Closure | [
"Get",
"a",
"reference",
"to",
"the",
"bound",
"serialization",
"closure",
"."
] | train | https://github.com/JurJean/SpraySerializer/blob/4d2883efe489cc8716aea3334f622a576f650397/src/Object/BoundClosureSerializer.php#L84-L91 |
JurJean/SpraySerializer | src/Object/BoundClosureSerializer.php | BoundClosureSerializer.serialize | public function serialize($subject, &$data = array(), SerializerInterface $serializer = null)
{
$context = $this->serializer();
$context($subject, $data, $serializer);
return $data;
} | php | public function serialize($subject, &$data = array(), SerializerInterface $serializer = null)
{
$context = $this->serializer();
$context($subject, $data, $serializer);
return $data;
} | [
"public",
"function",
"serialize",
"(",
"$",
"subject",
",",
"&",
"$",
"data",
"=",
"array",
"(",
")",
",",
"SerializerInterface",
"$",
"serializer",
"=",
"null",
")",
"{",
"$",
"context",
"=",
"$",
"this",
"->",
"serializer",
"(",
")",
";",
"$",
"co... | Turn $subject (object) into $data (array).
@param object $subject
@param array $data
@param SerializerInterface $serializer
@return object | [
"Turn",
"$subject",
"(",
"object",
")",
"into",
"$data",
"(",
"array",
")",
"."
] | train | https://github.com/JurJean/SpraySerializer/blob/4d2883efe489cc8716aea3334f622a576f650397/src/Object/BoundClosureSerializer.php#L117-L122 |
JurJean/SpraySerializer | src/Object/BoundClosureSerializer.php | BoundClosureSerializer.deserializer | protected function deserializer()
{
if (null === $this->deserializer) {
$self = $this;
$this->deserializer = Closure::bind($this->bindDeserializer(), null, $this->class);
}
return $this->deserializer;
} | php | protected function deserializer()
{
if (null === $this->deserializer) {
$self = $this;
$this->deserializer = Closure::bind($this->bindDeserializer(), null, $this->class);
}
return $this->deserializer;
} | [
"protected",
"function",
"deserializer",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"deserializer",
")",
"{",
"$",
"self",
"=",
"$",
"this",
";",
"$",
"this",
"->",
"deserializer",
"=",
"Closure",
"::",
"bind",
"(",
"$",
"this",
"->"... | Get a reference to the bound deserialization closure.
@return Closure | [
"Get",
"a",
"reference",
"to",
"the",
"bound",
"deserialization",
"closure",
"."
] | train | https://github.com/JurJean/SpraySerializer/blob/4d2883efe489cc8716aea3334f622a576f650397/src/Object/BoundClosureSerializer.php#L129-L136 |
JurJean/SpraySerializer | src/Object/BoundClosureSerializer.php | BoundClosureSerializer.deserialize | public function deserialize($subject, &$data = array(), SerializerInterface $serializer = null)
{
$context = $this->deserializer();
$context($subject, $data, $serializer);
return $subject;
} | php | public function deserialize($subject, &$data = array(), SerializerInterface $serializer = null)
{
$context = $this->deserializer();
$context($subject, $data, $serializer);
return $subject;
} | [
"public",
"function",
"deserialize",
"(",
"$",
"subject",
",",
"&",
"$",
"data",
"=",
"array",
"(",
")",
",",
"SerializerInterface",
"$",
"serializer",
"=",
"null",
")",
"{",
"$",
"context",
"=",
"$",
"this",
"->",
"deserializer",
"(",
")",
";",
"$",
... | Turn $data (array) into $subject (object).
@param object $subject
@param array $data
@param SerializerInterface $serializer
@return object | [
"Turn",
"$data",
"(",
"array",
")",
"into",
"$subject",
"(",
"object",
")",
"."
] | train | https://github.com/JurJean/SpraySerializer/blob/4d2883efe489cc8716aea3334f622a576f650397/src/Object/BoundClosureSerializer.php#L162-L167 |
JurJean/SpraySerializer | src/Object/BoundClosureSerializer.php | BoundClosureSerializer.valueDeserializer | protected function valueDeserializer()
{
return function($subject, array $data, $property, $defaultValue) {
if (array_key_exists($property, $data)) {
return $data[$property];
}
if (null === $defaultValue) {
throw new MissingDataException(sp... | php | protected function valueDeserializer()
{
return function($subject, array $data, $property, $defaultValue) {
if (array_key_exists($property, $data)) {
return $data[$property];
}
if (null === $defaultValue) {
throw new MissingDataException(sp... | [
"protected",
"function",
"valueDeserializer",
"(",
")",
"{",
"return",
"function",
"(",
"$",
"subject",
",",
"array",
"$",
"data",
",",
"$",
"property",
",",
"$",
"defaultValue",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"property",
",",
"$",
"d... | @param mixed $value
@return closure
@throws MissingDataException | [
"@param",
"mixed",
"$value"
] | train | https://github.com/JurJean/SpraySerializer/blob/4d2883efe489cc8716aea3334f622a576f650397/src/Object/BoundClosureSerializer.php#L176-L192 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Model.php | Model._checkTableInfo | protected function _checkTableInfo() {
// 如果不是Model类 自动记录数据表信息
// 只在第一次执行记录
if(empty($this->fields)) {
// 如果数据表字段没有定义则自动获取
if(C('DB_FIELDS_CACHE')) {
$db = $this->dbName?:C('DB_NAME');
$fields = F('_fields/'.strtolower($db.'.'.$this->tab... | php | protected function _checkTableInfo() {
// 如果不是Model类 自动记录数据表信息
// 只在第一次执行记录
if(empty($this->fields)) {
// 如果数据表字段没有定义则自动获取
if(C('DB_FIELDS_CACHE')) {
$db = $this->dbName?:C('DB_NAME');
$fields = F('_fields/'.strtolower($db.'.'.$this->tab... | [
"protected",
"function",
"_checkTableInfo",
"(",
")",
"{",
"// 如果不是Model类 自动记录数据表信息",
"// 只在第一次执行记录",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"fields",
")",
")",
"{",
"// 如果数据表字段没有定义则自动获取",
"if",
"(",
"C",
"(",
"'DB_FIELDS_CACHE'",
")",
")",
"{",
"$",
"d... | 自动检测数据表信息
@access protected
@return void | [
"自动检测数据表信息"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Model.php#L105-L124 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Model.php | Model.flush | public function flush() {
// 缓存不存在则查询数据表信息
$this->db->setModel($this->name);
$fields = $this->db->getFields($this->getTableName());
if(!$fields) { // 无法获取字段信息
return false;
}
$this->fields = array_keys($fields);
unset($this->fields['_pk']);
... | php | public function flush() {
// 缓存不存在则查询数据表信息
$this->db->setModel($this->name);
$fields = $this->db->getFields($this->getTableName());
if(!$fields) { // 无法获取字段信息
return false;
}
$this->fields = array_keys($fields);
unset($this->fields['_pk']);
... | [
"public",
"function",
"flush",
"(",
")",
"{",
"// 缓存不存在则查询数据表信息",
"$",
"this",
"->",
"db",
"->",
"setModel",
"(",
"$",
"this",
"->",
"name",
")",
";",
"$",
"fields",
"=",
"$",
"this",
"->",
"db",
"->",
"getFields",
"(",
"$",
"this",
"->",
"getTableNa... | 获取字段信息并缓存
@access public
@return void | [
"获取字段信息并缓存"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Model.php#L131-L168 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Model.php | Model._facade | protected function _facade($data) {
// 检查数据字段合法性
if(!empty($this->fields)) {
if(!empty($this->options['field'])) {
$fields = $this->options['field'];
unset($this->options['field']);
if(is_string($fields)) {
$fields = ex... | php | protected function _facade($data) {
// 检查数据字段合法性
if(!empty($this->fields)) {
if(!empty($this->options['field'])) {
$fields = $this->options['field'];
unset($this->options['field']);
if(is_string($fields)) {
$fields = ex... | [
"protected",
"function",
"_facade",
"(",
"$",
"data",
")",
"{",
"// 检查数据字段合法性",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"fields",
")",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"options",
"[",
"'field'",
"]",
")",
")",
"... | 对保存到数据库的数据进行处理
@access protected
@param mixed $data 要操作的数据
@return boolean | [
"对保存到数据库的数据进行处理"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Model.php#L254-L287 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Model.php | Model.save | public function save($data='',$options=array()) {
if(empty($data)) {
// 没有传递数据,获取当前数据对象的值
if(!empty($this->data)) {
$data = $this->data;
// 重置数据
$this->data = array();
}else{
$this->error = ... | php | public function save($data='',$options=array()) {
if(empty($data)) {
// 没有传递数据,获取当前数据对象的值
if(!empty($this->data)) {
$data = $this->data;
// 重置数据
$this->data = array();
}else{
$this->error = ... | [
"public",
"function",
"save",
"(",
"$",
"data",
"=",
"''",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"data",
")",
")",
"{",
"// 没有传递数据,获取当前数据对象的值",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"data"... | 保存数据
@access public
@param mixed $data 数据
@param array $options 表达式
@return boolean | [
"保存数据"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Model.php#L396-L457 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Model.php | Model._parseType | protected function _parseType(&$data,$key) {
if(!isset($this->options['bind'][':'.$key]) && isset($this->fields['_type'][$key])){
$fieldType = strtolower($this->fields['_type'][$key]);
if(false !== strpos($fieldType,'enum')){
// 支持ENUM类型优先检测
}elseif(false === ... | php | protected function _parseType(&$data,$key) {
if(!isset($this->options['bind'][':'.$key]) && isset($this->fields['_type'][$key])){
$fieldType = strtolower($this->fields['_type'][$key]);
if(false !== strpos($fieldType,'enum')){
// 支持ENUM类型优先检测
}elseif(false === ... | [
"protected",
"function",
"_parseType",
"(",
"&",
"$",
"data",
",",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"options",
"[",
"'bind'",
"]",
"[",
"':'",
".",
"$",
"key",
"]",
")",
"&&",
"isset",
"(",
"$",
"this",
"->... | 数据类型检测
@access protected
@param mixed $data 数据
@param string $key 字段名
@return void | [
"数据类型检测"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Model.php#L680-L693 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Model.php | Model._read_data | protected function _read_data($data) {
// 检查字段映射
if(!empty($this->_map) && C('READ_DATA_MAP')) {
foreach ($this->_map as $key=>$val){
if(isset($data[$val])) {
$data[$key] = $data[$val];
unset($data[$val]);
}
... | php | protected function _read_data($data) {
// 检查字段映射
if(!empty($this->_map) && C('READ_DATA_MAP')) {
foreach ($this->_map as $key=>$val){
if(isset($data[$val])) {
$data[$key] = $data[$val];
unset($data[$val]);
}
... | [
"protected",
"function",
"_read_data",
"(",
"$",
"data",
")",
"{",
"// 检查字段映射",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"_map",
")",
"&&",
"C",
"(",
"'READ_DATA_MAP'",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_map",
"as",
"$",
"k... | 数据读取后的处理
@access protected
@param array $data 当前数据
@return array | [
"数据读取后的处理"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Model.php#L701-L712 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Model.php | Model.find | public function find($options=array()) {
if(is_numeric($options) || is_string($options)) {
$where[$this->getPk()] = $options;
$options = array();
$options['where'] = $where;
}
// 根据复合主键查找记录
$pk = $this->getPk();
if... | php | public function find($options=array()) {
if(is_numeric($options) || is_string($options)) {
$where[$this->getPk()] = $options;
$options = array();
$options['where'] = $where;
}
// 根据复合主键查找记录
$pk = $this->getPk();
if... | [
"public",
"function",
"find",
"(",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"options",
")",
"||",
"is_string",
"(",
"$",
"options",
")",
")",
"{",
"$",
"where",
"[",
"$",
"this",
"->",
"getPk",
"(",
")"... | 查询数据
@access public
@param mixed $options 表达式参数
@return mixed | [
"查询数据"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Model.php#L720-L781 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Model.php | Model.setField | public function setField($field,$value='') {
if(is_array($field)) {
$data = $field;
}else{
$data[$field] = $value;
}
return $this->save($data);
} | php | public function setField($field,$value='') {
if(is_array($field)) {
$data = $field;
}else{
$data[$field] = $value;
}
return $this->save($data);
} | [
"public",
"function",
"setField",
"(",
"$",
"field",
",",
"$",
"value",
"=",
"''",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"field",
")",
")",
"{",
"$",
"data",
"=",
"$",
"field",
";",
"}",
"else",
"{",
"$",
"data",
"[",
"$",
"field",
"]",
... | 设置记录的某个字段值
支持使用数据库字段和方法
@access public
@param string|array $field 字段名
@param string $value 字段值
@return boolean | [
"设置记录的某个字段值",
"支持使用数据库字段和方法"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Model.php#L835-L842 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Model.php | Model.lazyWrite | protected function lazyWrite($guid,$step,$lazyTime) {
if(false !== ($value = S($guid))) { // 存在缓存写入数据
if(NOW_TIME > S($guid.'_time')+$lazyTime) {
// 延时更新时间到了,删除缓存数据 并实际写入数据库
S($guid,NULL);
S($guid.'_time',NULL);
return $value+$step;
... | php | protected function lazyWrite($guid,$step,$lazyTime) {
if(false !== ($value = S($guid))) { // 存在缓存写入数据
if(NOW_TIME > S($guid.'_time')+$lazyTime) {
// 延时更新时间到了,删除缓存数据 并实际写入数据库
S($guid,NULL);
S($guid.'_time',NULL);
return $value+$step;
... | [
"protected",
"function",
"lazyWrite",
"(",
"$",
"guid",
",",
"$",
"step",
",",
"$",
"lazyTime",
")",
"{",
"if",
"(",
"false",
"!==",
"(",
"$",
"value",
"=",
"S",
"(",
"$",
"guid",
")",
")",
")",
"{",
"// 存在缓存写入数据",
"if",
"(",
"NOW_TIME",
">",
"S"... | 延时更新检查 返回false表示需要延时
否则返回实际写入的数值
@access public
@param string $guid 写入标识
@param integer $step 写入步进值
@param integer $lazyTime 延时时间(s)
@return false|integer | [
"延时更新检查",
"返回false表示需要延时",
"否则返回实际写入的数值"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Model.php#L897-L915 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Model.php | Model.create | public function create($data='',$type='') {
// 如果没有传值默认取POST数据
if(empty($data)) {
$data = I('post.');
}elseif(is_object($data)){
$data = get_object_vars($data);
}
// 验证数据
if(empty($data) || !is_array($data)) {
$this->error = L('... | php | public function create($data='',$type='') {
// 如果没有传值默认取POST数据
if(empty($data)) {
$data = I('post.');
}elseif(is_object($data)){
$data = get_object_vars($data);
}
// 验证数据
if(empty($data) || !is_array($data)) {
$this->error = L('... | [
"public",
"function",
"create",
"(",
"$",
"data",
"=",
"''",
",",
"$",
"type",
"=",
"''",
")",
"{",
"// 如果没有传值默认取POST数据",
"if",
"(",
"empty",
"(",
"$",
"data",
")",
")",
"{",
"$",
"data",
"=",
"I",
"(",
"'post.'",
")",
";",
"}",
"elseif",
"(",
... | 创建数据对象 但不保存到数据库
@access public
@param mixed $data 创建数据
@param string $type 状态
@return mixed | [
"创建数据对象",
"但不保存到数据库"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Model.php#L1001-L1069 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Model.php | Model.autoCheckToken | public function autoCheckToken($data) {
// 支持使用token(false) 关闭令牌验证
if(isset($this->options['token']) && !$this->options['token']) return true;
if(C('TOKEN_ON')){
$name = C('TOKEN_NAME', null, '__hash__');
if(!isset($data[$name]) || !isset($_SESSION[$name])) { // 令牌数据无效
... | php | public function autoCheckToken($data) {
// 支持使用token(false) 关闭令牌验证
if(isset($this->options['token']) && !$this->options['token']) return true;
if(C('TOKEN_ON')){
$name = C('TOKEN_NAME', null, '__hash__');
if(!isset($data[$name]) || !isset($_SESSION[$name])) { // 令牌数据无效
... | [
"public",
"function",
"autoCheckToken",
"(",
"$",
"data",
")",
"{",
"// 支持使用token(false) 关闭令牌验证",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"options",
"[",
"'token'",
"]",
")",
"&&",
"!",
"$",
"this",
"->",
"options",
"[",
"'token'",
"]",
")",
"return"... | TODO ajax无刷新多次提交暂不能满足 | [
"TODO",
"ajax无刷新多次提交暂不能满足"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Model.php#L1073-L1093 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Model.php | Model.regex | public function regex($value,$rule) {
$validate = array(
'require' => '/\S+/',
'email' => '/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/',
'url' => '/^http(s?):\/\/(?:[A-za-z0-9-]+\.)+[A-za-z]{2,4}(:\d+)?(?:[\/\?#][\/=\?%\-&~`@[\]\':+!\.#\w]*)?$/',
... | php | public function regex($value,$rule) {
$validate = array(
'require' => '/\S+/',
'email' => '/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/',
'url' => '/^http(s?):\/\/(?:[A-za-z0-9-]+\.)+[A-za-z]{2,4}(:\d+)?(?:[\/\?#][\/=\?%\-&~`@[\]\':+!\.#\w]*)?$/',
... | [
"public",
"function",
"regex",
"(",
"$",
"value",
",",
"$",
"rule",
")",
"{",
"$",
"validate",
"=",
"array",
"(",
"'require'",
"=>",
"'/\\S+/'",
",",
"'email'",
"=>",
"'/^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$/'",
",",
"'url'",
"=>",
"'/^http(s?):\\/\... | 使用正则验证数据
@access public
@param string $value 要验证的数据
@param string $rule 验证规则
@return boolean | [
"使用正则验证数据"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Model.php#L1102-L1118 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Model.php | Model.autoOperation | private function autoOperation(&$data,$type) {
if(false === $this->options['auto']){
// 关闭自动完成
return $data;
}
if(!empty($this->options['auto'])) {
$_auto = $this->options['auto'];
unset($this->options['auto']);
}elseif(!empty($this->_auto)){
... | php | private function autoOperation(&$data,$type) {
if(false === $this->options['auto']){
// 关闭自动完成
return $data;
}
if(!empty($this->options['auto'])) {
$_auto = $this->options['auto'];
unset($this->options['auto']);
}elseif(!empty($this->_auto)){
... | [
"private",
"function",
"autoOperation",
"(",
"&",
"$",
"data",
",",
"$",
"type",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"options",
"[",
"'auto'",
"]",
")",
"{",
"// 关闭自动完成",
"return",
"$",
"data",
";",
"}",
"if",
"(",
"!",
"empty",... | 自动表单处理
@access public
@param array $data 创建数据
@param string $type 创建类型
@return mixed | [
"自动表单处理"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Model.php#L1127-L1175 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Model.php | Model._validationFieldItem | protected function _validationFieldItem($data,$val) {
switch(strtolower(trim($val[4]))) {
case 'function':// 使用函数进行验证
case 'callback':// 调用方法进行验证
$args = isset($val[6])?(array)$val[6]:array();
if(is_string($val[0]) && strpos($val[0], ','))
... | php | protected function _validationFieldItem($data,$val) {
switch(strtolower(trim($val[4]))) {
case 'function':// 使用函数进行验证
case 'callback':// 调用方法进行验证
$args = isset($val[6])?(array)$val[6]:array();
if(is_string($val[0]) && strpos($val[0], ','))
... | [
"protected",
"function",
"_validationFieldItem",
"(",
"$",
"data",
",",
"$",
"val",
")",
"{",
"switch",
"(",
"strtolower",
"(",
"trim",
"(",
"$",
"val",
"[",
"4",
"]",
")",
")",
")",
"{",
"case",
"'function'",
":",
"// 使用函数进行验证",
"case",
"'callback'",
... | 根据验证因子验证字段
@access protected
@param array $data 创建数据
@param array $val 验证因子
@return boolean | [
"根据验证因子验证字段"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Model.php#L1263-L1305 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Model.php | Model.check | public function check($value,$rule,$type='regex'){
$type = strtolower(trim($type));
switch($type) {
case 'in': // 验证是否在某个指定范围之内 逗号分隔字符串或者数组
case 'notin':
$range = is_array($rule)? $rule : explode(',',$rule);
return $type == 'in' ? in_array($v... | php | public function check($value,$rule,$type='regex'){
$type = strtolower(trim($type));
switch($type) {
case 'in': // 验证是否在某个指定范围之内 逗号分隔字符串或者数组
case 'notin':
$range = is_array($rule)? $rule : explode(',',$rule);
return $type == 'in' ? in_array($v... | [
"public",
"function",
"check",
"(",
"$",
"value",
",",
"$",
"rule",
",",
"$",
"type",
"=",
"'regex'",
")",
"{",
"$",
"type",
"=",
"strtolower",
"(",
"trim",
"(",
"$",
"type",
")",
")",
";",
"switch",
"(",
"$",
"type",
")",
"{",
"case",
"'in'",
... | 验证数据 支持 in between equal length regex expire ip_allow ip_deny
@access public
@param string $value 验证数据
@param mixed $rule 验证表达式
@param string $type 验证方式 默认为正则验证
@return boolean | [
"验证数据",
"支持",
"in",
"between",
"equal",
"length",
"regex",
"expire",
"ip_allow",
"ip_deny"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Model.php#L1315-L1356 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Model.php | Model.query | public function query($sql,$parse=false) {
if(!is_bool($parse) && !is_array($parse)) {
$parse = func_get_args();
array_shift($parse);
}
$sql = $this->parseSql($sql,$parse);
return $this->db->query($sql);
} | php | public function query($sql,$parse=false) {
if(!is_bool($parse) && !is_array($parse)) {
$parse = func_get_args();
array_shift($parse);
}
$sql = $this->parseSql($sql,$parse);
return $this->db->query($sql);
} | [
"public",
"function",
"query",
"(",
"$",
"sql",
",",
"$",
"parse",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"is_bool",
"(",
"$",
"parse",
")",
"&&",
"!",
"is_array",
"(",
"$",
"parse",
")",
")",
"{",
"$",
"parse",
"=",
"func_get_args",
"(",
")",
... | SQL查询
@access public
@param string $sql SQL指令
@param mixed $parse 是否需要解析SQL
@return mixed | [
"SQL查询"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Model.php#L1376-L1383 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Model.php | Model.parseSql | protected function parseSql($sql,$parse) {
// 分析表达式
if(true === $parse) {
$options = $this->_parseOptions();
$sql = $this->db->parseSql($sql,$options);
}elseif(is_array($parse)){ // SQL预处理
$parse = array_map(array($this->db,'escapeString'),$parse);
... | php | protected function parseSql($sql,$parse) {
// 分析表达式
if(true === $parse) {
$options = $this->_parseOptions();
$sql = $this->db->parseSql($sql,$options);
}elseif(is_array($parse)){ // SQL预处理
$parse = array_map(array($this->db,'escapeString'),$parse);
... | [
"protected",
"function",
"parseSql",
"(",
"$",
"sql",
",",
"$",
"parse",
")",
"{",
"// 分析表达式",
"if",
"(",
"true",
"===",
"$",
"parse",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"_parseOptions",
"(",
")",
";",
"$",
"sql",
"=",
"$",
"this",
... | 解析SQL语句
@access public
@param string $sql SQL指令
@param boolean $parse 是否需要解析SQL
@return string | [
"解析SQL语句"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Model.php#L1408-L1423 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Model.php | Model.db | public function db($linkNum='',$config='',$force=false) {
if('' === $linkNum && $this->db) {
return $this->db;
}
if(!isset($this->_db[$linkNum]) || $force ) {
// 创建一个新的实例
if(!empty($config) && is_string($config) && false === strpos($config,'/')) { // 支持读取配置参数... | php | public function db($linkNum='',$config='',$force=false) {
if('' === $linkNum && $this->db) {
return $this->db;
}
if(!isset($this->_db[$linkNum]) || $force ) {
// 创建一个新的实例
if(!empty($config) && is_string($config) && false === strpos($config,'/')) { // 支持读取配置参数... | [
"public",
"function",
"db",
"(",
"$",
"linkNum",
"=",
"''",
",",
"$",
"config",
"=",
"''",
",",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"''",
"===",
"$",
"linkNum",
"&&",
"$",
"this",
"->",
"db",
")",
"{",
"return",
"$",
"this",
"->",
... | 切换当前的数据库连接
@access public
@param integer $linkNum 连接序号
@param mixed $config 数据库连接信息
@param boolean $force 强制重新连接
@return Model | [
"切换当前的数据库连接"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Model.php#L1433-L1456 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Model.php | Model.getModelName | public function getModelName() {
if(empty($this->name)){
$name = substr(get_class($this),0,-strlen(C('DEFAULT_M_LAYER')));
if ( $pos = strrpos($name,'\\') ) {//有命名空间
$this->name = substr($name,$pos+1);
}else{
$this->name = $name;
}
... | php | public function getModelName() {
if(empty($this->name)){
$name = substr(get_class($this),0,-strlen(C('DEFAULT_M_LAYER')));
if ( $pos = strrpos($name,'\\') ) {//有命名空间
$this->name = substr($name,$pos+1);
}else{
$this->name = $name;
}
... | [
"public",
"function",
"getModelName",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"name",
")",
")",
"{",
"$",
"name",
"=",
"substr",
"(",
"get_class",
"(",
"$",
"this",
")",
",",
"0",
",",
"-",
"strlen",
"(",
"C",
"(",
"'DEFAULT_M_... | 得到当前的数据对象名称
@access public
@return string | [
"得到当前的数据对象名称"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Model.php#L1465-L1475 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Model.php | Model.getTableName | public function getTableName() {
if(empty($this->trueTableName)) {
$tableName = !empty($this->tablePrefix) ? $this->tablePrefix : '';
if(!empty($this->tableName)) {
$tableName .= $this->tableName;
}else{
$tableName .= parse_name($this->name);
... | php | public function getTableName() {
if(empty($this->trueTableName)) {
$tableName = !empty($this->tablePrefix) ? $this->tablePrefix : '';
if(!empty($this->tableName)) {
$tableName .= $this->tableName;
}else{
$tableName .= parse_name($this->name);
... | [
"public",
"function",
"getTableName",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"trueTableName",
")",
")",
"{",
"$",
"tableName",
"=",
"!",
"empty",
"(",
"$",
"this",
"->",
"tablePrefix",
")",
"?",
"$",
"this",
"->",
"tablePrefix",
"... | 得到完整的数据表名
@access public
@return string | [
"得到完整的数据表名"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Model.php#L1482-L1493 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Model.php | Model.getDbFields | public function getDbFields(){
if(isset($this->options['table'])) {// 动态指定表名
if(is_array($this->options['table'])){
$table = key($this->options['table']);
}else{
$table = $this->options['table'];
if(strpos($table,')')){
... | php | public function getDbFields(){
if(isset($this->options['table'])) {// 动态指定表名
if(is_array($this->options['table'])){
$table = key($this->options['table']);
}else{
$table = $this->options['table'];
if(strpos($table,')')){
... | [
"public",
"function",
"getDbFields",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"options",
"[",
"'table'",
"]",
")",
")",
"{",
"// 动态指定表名",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"options",
"[",
"'table'",
"]",
")",
")",
"{"... | 获取数据表字段信息
@access public
@return array | [
"获取数据表字段信息"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Model.php#L1578-L1598 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Model.php | Model.data | public function data($data=''){
if('' === $data && !empty($this->data)) {
return $this->data;
}
if(is_object($data)){
$data = get_object_vars($data);
}elseif(is_string($data)){
parse_str($data,$data);
}elseif(!is_array($data)){
... | php | public function data($data=''){
if('' === $data && !empty($this->data)) {
return $this->data;
}
if(is_object($data)){
$data = get_object_vars($data);
}elseif(is_string($data)){
parse_str($data,$data);
}elseif(!is_array($data)){
... | [
"public",
"function",
"data",
"(",
"$",
"data",
"=",
"''",
")",
"{",
"if",
"(",
"''",
"===",
"$",
"data",
"&&",
"!",
"empty",
"(",
"$",
"this",
"->",
"data",
")",
")",
"{",
"return",
"$",
"this",
"->",
"data",
";",
"}",
"if",
"(",
"is_object",
... | 设置数据对象值
@access public
@param mixed $data 数据
@return Model | [
"设置数据对象值"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Model.php#L1606-L1619 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Model.php | Model.table | public function table($table) {
$prefix = $this->tablePrefix;
if(is_array($table)) {
$this->options['table'] = $table;
}elseif(!empty($table)) {
//将__TABLE_NAME__替换成带前缀的表名
$table = preg_replace_callback("/__([A-Z0-9_-]+)__/sU", function($match) use($prefi... | php | public function table($table) {
$prefix = $this->tablePrefix;
if(is_array($table)) {
$this->options['table'] = $table;
}elseif(!empty($table)) {
//将__TABLE_NAME__替换成带前缀的表名
$table = preg_replace_callback("/__([A-Z0-9_-]+)__/sU", function($match) use($prefi... | [
"public",
"function",
"table",
"(",
"$",
"table",
")",
"{",
"$",
"prefix",
"=",
"$",
"this",
"->",
"tablePrefix",
";",
"if",
"(",
"is_array",
"(",
"$",
"table",
")",
")",
"{",
"$",
"this",
"->",
"options",
"[",
"'table'",
"]",
"=",
"$",
"table",
... | 指定当前的数据表
@access public
@param mixed $table
@return Model | [
"指定当前的数据表"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Model.php#L1627-L1637 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Model.php | Model.using | public function using($using){
$prefix = $this->tablePrefix;
if(is_array($using)) {
$this->options['using'] = $using;
}elseif(!empty($using)) {
//将__TABLE_NAME__替换成带前缀的表名
$using = preg_replace_callback("/__([A-Z0-9_-]+)__/sU", function($match) use($prefix... | php | public function using($using){
$prefix = $this->tablePrefix;
if(is_array($using)) {
$this->options['using'] = $using;
}elseif(!empty($using)) {
//将__TABLE_NAME__替换成带前缀的表名
$using = preg_replace_callback("/__([A-Z0-9_-]+)__/sU", function($match) use($prefix... | [
"public",
"function",
"using",
"(",
"$",
"using",
")",
"{",
"$",
"prefix",
"=",
"$",
"this",
"->",
"tablePrefix",
";",
"if",
"(",
"is_array",
"(",
"$",
"using",
")",
")",
"{",
"$",
"this",
"->",
"options",
"[",
"'using'",
"]",
"=",
"$",
"using",
... | USING支持 用于多表删除
@access public
@param mixed $using
@return Model | [
"USING支持",
"用于多表删除"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Model.php#L1645-L1655 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Model.php | Model.join | public function join($join,$type='INNER') {
$prefix = $this->tablePrefix;
if(is_array($join)) {
foreach ($join as $key=>&$_join){
$_join = preg_replace_callback("/__([A-Z0-9_-]+)__/sU", function($match) use($prefix){ return $prefix.strtolower($match[1]);}, $_join);
... | php | public function join($join,$type='INNER') {
$prefix = $this->tablePrefix;
if(is_array($join)) {
foreach ($join as $key=>&$_join){
$_join = preg_replace_callback("/__([A-Z0-9_-]+)__/sU", function($match) use($prefix){ return $prefix.strtolower($match[1]);}, $_join);
... | [
"public",
"function",
"join",
"(",
"$",
"join",
",",
"$",
"type",
"=",
"'INNER'",
")",
"{",
"$",
"prefix",
"=",
"$",
"this",
"->",
"tablePrefix",
";",
"if",
"(",
"is_array",
"(",
"$",
"join",
")",
")",
"{",
"foreach",
"(",
"$",
"join",
"as",
"$",... | 查询SQL组装 join
@access public
@param mixed $join
@param string $type JOIN类型
@return Model | [
"查询SQL组装",
"join"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Model.php#L1664-L1678 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Model.php | Model.union | public function union($union,$all=false) {
if(empty($union)) return $this;
if($all) {
$this->options['union']['_all'] = true;
}
if(is_object($union)) {
$union = get_object_vars($union);
}
// 转换union表达式
if(is_string($union) ) {
... | php | public function union($union,$all=false) {
if(empty($union)) return $this;
if($all) {
$this->options['union']['_all'] = true;
}
if(is_object($union)) {
$union = get_object_vars($union);
}
// 转换union表达式
if(is_string($union) ) {
... | [
"public",
"function",
"union",
"(",
"$",
"union",
",",
"$",
"all",
"=",
"false",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"union",
")",
")",
"return",
"$",
"this",
";",
"if",
"(",
"$",
"all",
")",
"{",
"$",
"this",
"->",
"options",
"[",
"'union'... | 查询SQL组装 union
@access public
@param mixed $union
@param boolean $all
@return Model | [
"查询SQL组装",
"union"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Model.php#L1687-L1712 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Model.php | Model.cache | public function cache($key=true,$expire=null,$type=''){
// 增加快捷调用方式 cache(10) 等同于 cache(true, 10)
if(is_numeric($key) && is_null($expire)){
$expire = $key;
$key = true;
}
if(false !== $key)
$this->options['cache'] = array('key'=>$key,'expire'=>$ex... | php | public function cache($key=true,$expire=null,$type=''){
// 增加快捷调用方式 cache(10) 等同于 cache(true, 10)
if(is_numeric($key) && is_null($expire)){
$expire = $key;
$key = true;
}
if(false !== $key)
$this->options['cache'] = array('key'=>$key,'expire'=>$ex... | [
"public",
"function",
"cache",
"(",
"$",
"key",
"=",
"true",
",",
"$",
"expire",
"=",
"null",
",",
"$",
"type",
"=",
"''",
")",
"{",
"// 增加快捷调用方式 cache(10) 等同于 cache(true, 10)",
"if",
"(",
"is_numeric",
"(",
"$",
"key",
")",
"&&",
"is_null",
"(",
"$",
... | 查询缓存
@access public
@param mixed $key
@param integer $expire
@param string $type
@return Model | [
"查询缓存"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Model.php#L1722-L1731 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Model.php | Model.field | public function field($field,$except=false){
if(true === $field) {// 获取全部字段
$fields = $this->getDbFields();
$field = $fields?:'*';
}elseif($except) {// 字段排除
if(is_string($field)) {
$field = explode(',',$field);
}
$f... | php | public function field($field,$except=false){
if(true === $field) {// 获取全部字段
$fields = $this->getDbFields();
$field = $fields?:'*';
}elseif($except) {// 字段排除
if(is_string($field)) {
$field = explode(',',$field);
}
$f... | [
"public",
"function",
"field",
"(",
"$",
"field",
",",
"$",
"except",
"=",
"false",
")",
"{",
"if",
"(",
"true",
"===",
"$",
"field",
")",
"{",
"// 获取全部字段",
"$",
"fields",
"=",
"$",
"this",
"->",
"getDbFields",
"(",
")",
";",
"$",
"field",
"=",
"... | 指定查询字段 支持字段排除
@access public
@param mixed $field
@param boolean $except 是否排除
@return Model | [
"指定查询字段",
"支持字段排除"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Model.php#L1740-L1753 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Model.php | Model.where | public function where($where,$parse=null){
if(!is_null($parse) && is_string($where)) {
if(!is_array($parse)) {
$parse = func_get_args();
array_shift($parse);
}
$parse = array_map(array($this->db,'escapeString'),$parse);
$where = v... | php | public function where($where,$parse=null){
if(!is_null($parse) && is_string($where)) {
if(!is_array($parse)) {
$parse = func_get_args();
array_shift($parse);
}
$parse = array_map(array($this->db,'escapeString'),$parse);
$where = v... | [
"public",
"function",
"where",
"(",
"$",
"where",
",",
"$",
"parse",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"parse",
")",
"&&",
"is_string",
"(",
"$",
"where",
")",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"parse",
"... | 指定查询条件 支持安全过滤
@access public
@param mixed $where 条件表达式
@param mixed $parse 预处理参数
@return Model | [
"指定查询条件",
"支持安全过滤"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Model.php#L1797-L1820 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Model.php | Model.page | public function page($page,$listRows=null){
if(is_null($listRows) && strpos($page,',')){
list($page,$listRows) = explode(',',$page);
}
$this->options['page'] = array(intval($page),intval($listRows));
return $this;
} | php | public function page($page,$listRows=null){
if(is_null($listRows) && strpos($page,',')){
list($page,$listRows) = explode(',',$page);
}
$this->options['page'] = array(intval($page),intval($listRows));
return $this;
} | [
"public",
"function",
"page",
"(",
"$",
"page",
",",
"$",
"listRows",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"listRows",
")",
"&&",
"strpos",
"(",
"$",
"page",
",",
"','",
")",
")",
"{",
"list",
"(",
"$",
"page",
",",
"$",
"list... | 指定分页
@access public
@param mixed $page 页数
@param mixed $listRows 每页数量
@return Model | [
"指定分页"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Model.php#L1844-L1850 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Model.php | Model.bind | public function bind($key,$value=false) {
if(is_array($key)){
$this->options['bind'] = $key;
}else{
$num = func_num_args();
if($num>2){
$params = func_get_args();
array_shift($params);
$this->options['bind'][$key] ... | php | public function bind($key,$value=false) {
if(is_array($key)){
$this->options['bind'] = $key;
}else{
$num = func_num_args();
if($num>2){
$params = func_get_args();
array_shift($params);
$this->options['bind'][$key] ... | [
"public",
"function",
"bind",
"(",
"$",
"key",
",",
"$",
"value",
"=",
"false",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"key",
")",
")",
"{",
"$",
"this",
"->",
"options",
"[",
"'bind'",
"]",
"=",
"$",
"key",
";",
"}",
"else",
"{",
"$",
"n... | 参数绑定
@access public
@param string $key 参数名
@param mixed $value 绑定的变量及绑定参数
@return Model | [
"参数绑定"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Model.php#L1881-L1895 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Model.php | Model.setProperty | public function setProperty($name,$value) {
if(property_exists($this,$name))
$this->$name = $value;
return $this;
} | php | public function setProperty($name,$value) {
if(property_exists($this,$name))
$this->$name = $value;
return $this;
} | [
"public",
"function",
"setProperty",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"if",
"(",
"property_exists",
"(",
"$",
"this",
",",
"$",
"name",
")",
")",
"$",
"this",
"->",
"$",
"name",
"=",
"$",
"value",
";",
"return",
"$",
"this",
";",
"}... | 设置模型的属性值
@access public
@param string $name 名称
@param mixed $value 值
@return Model | [
"设置模型的属性值"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Model.php#L1904-L1908 |
gplcart/backup | Main.php | Main.hookModuleInstallBefore | public function hookModuleInstallBefore(&$result)
{
if (!class_exists('ZipArchive')) {
$result = $this->getTranslationModel()->text('Class ZipArchive does not exist');
} else {
try {
$this->db->importScheme('backup', $this->getDbScheme());
} catch... | php | public function hookModuleInstallBefore(&$result)
{
if (!class_exists('ZipArchive')) {
$result = $this->getTranslationModel()->text('Class ZipArchive does not exist');
} else {
try {
$this->db->importScheme('backup', $this->getDbScheme());
} catch... | [
"public",
"function",
"hookModuleInstallBefore",
"(",
"&",
"$",
"result",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"'ZipArchive'",
")",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"getTranslationModel",
"(",
")",
"->",
"text",
"(",
"'Class ZipAr... | Implements hook "module.install.before"
@param null|string $result | [
"Implements",
"hook",
"module",
".",
"install",
".",
"before"
] | train | https://github.com/gplcart/backup/blob/5838e2f47f0bb8c2e18b6697e20bec5682b71393/Main.php#L41-L53 |
gplcart/backup | Main.php | Main.getDbScheme | protected function getDbScheme()
{
return array(
'backup' => array(
'fields' => array(
'backup_id' => array('type' => 'int', 'length' => 10, 'auto_increment' => true, 'primary' => true),
'created' => array('type' => 'int', 'length' => 10, '... | php | protected function getDbScheme()
{
return array(
'backup' => array(
'fields' => array(
'backup_id' => array('type' => 'int', 'length' => 10, 'auto_increment' => true, 'primary' => true),
'created' => array('type' => 'int', 'length' => 10, '... | [
"protected",
"function",
"getDbScheme",
"(",
")",
"{",
"return",
"array",
"(",
"'backup'",
"=>",
"array",
"(",
"'fields'",
"=>",
"array",
"(",
"'backup_id'",
"=>",
"array",
"(",
"'type'",
"=>",
"'int'",
",",
"'length'",
"=>",
"10",
",",
"'auto_increment'",
... | Returns an array of database scheme
@return array | [
"Returns",
"an",
"array",
"of",
"database",
"scheme"
] | train | https://github.com/gplcart/backup/blob/5838e2f47f0bb8c2e18b6697e20bec5682b71393/Main.php#L159-L175 |
GetOlympus/olympus-html-field | src/Html/Html.php | Html.setVars | protected function setVars()
{
$this->getModel()->setFaIcon('fa-html5');
$this->getModel()->setHasId(false);
$this->getModel()->setTemplate('html.html.twig');
} | php | protected function setVars()
{
$this->getModel()->setFaIcon('fa-html5');
$this->getModel()->setHasId(false);
$this->getModel()->setTemplate('html.html.twig');
} | [
"protected",
"function",
"setVars",
"(",
")",
"{",
"$",
"this",
"->",
"getModel",
"(",
")",
"->",
"setFaIcon",
"(",
"'fa-html5'",
")",
";",
"$",
"this",
"->",
"getModel",
"(",
")",
"->",
"setHasId",
"(",
"false",
")",
";",
"$",
"this",
"->",
"getMode... | Prepare variables. | [
"Prepare",
"variables",
"."
] | train | https://github.com/GetOlympus/olympus-html-field/blob/cfc8d51a3e1e76385949e0c6dba348fcc1354fb9/src/Html/Html.php#L24-L29 |
GetOlympus/olympus-html-field | src/Html/Html.php | Html.getVars | protected function getVars($content, $details = [])
{
// Build defaults
$defaults = [
'data' => '',
];
// Build defaults data
$vars = array_merge($defaults, $content);
// Update vars
$this->getModel()->setVars($vars);
} | php | protected function getVars($content, $details = [])
{
// Build defaults
$defaults = [
'data' => '',
];
// Build defaults data
$vars = array_merge($defaults, $content);
// Update vars
$this->getModel()->setVars($vars);
} | [
"protected",
"function",
"getVars",
"(",
"$",
"content",
",",
"$",
"details",
"=",
"[",
"]",
")",
"{",
"// Build defaults",
"$",
"defaults",
"=",
"[",
"'data'",
"=>",
"''",
",",
"]",
";",
"// Build defaults data",
"$",
"vars",
"=",
"array_merge",
"(",
"$... | Prepare HTML component.
@param array $content
@param array $details
@since 0.0.1 | [
"Prepare",
"HTML",
"component",
"."
] | train | https://github.com/GetOlympus/olympus-html-field/blob/cfc8d51a3e1e76385949e0c6dba348fcc1354fb9/src/Html/Html.php#L39-L51 |
spryker/company-business-unit-data-import | src/Spryker/Zed/CompanyBusinessUnitDataImport/Business/Model/CompanyBusinessUnitWriterStep.php | CompanyBusinessUnitWriterStep.execute | public function execute(DataSetInterface $dataSet): void
{
$companyBusinessUnitEntity = SpyCompanyBusinessUnitQuery::create()
->filterByKey($dataSet[CompanyBusinessUnitDataSet::BUSINESS_UNIT_KEY])
->filterByFkCompany($dataSet[CompanyBusinessUnitDataSet::ID_COMPANY])
->fin... | php | public function execute(DataSetInterface $dataSet): void
{
$companyBusinessUnitEntity = SpyCompanyBusinessUnitQuery::create()
->filterByKey($dataSet[CompanyBusinessUnitDataSet::BUSINESS_UNIT_KEY])
->filterByFkCompany($dataSet[CompanyBusinessUnitDataSet::ID_COMPANY])
->fin... | [
"public",
"function",
"execute",
"(",
"DataSetInterface",
"$",
"dataSet",
")",
":",
"void",
"{",
"$",
"companyBusinessUnitEntity",
"=",
"SpyCompanyBusinessUnitQuery",
"::",
"create",
"(",
")",
"->",
"filterByKey",
"(",
"$",
"dataSet",
"[",
"CompanyBusinessUnitDataSe... | @param \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetInterface $dataSet
@return void | [
"@param",
"\\",
"Spryker",
"\\",
"Zed",
"\\",
"DataImport",
"\\",
"Business",
"\\",
"Model",
"\\",
"DataSet",
"\\",
"DataSetInterface",
"$dataSet"
] | train | https://github.com/spryker/company-business-unit-data-import/blob/8cf3af02dd354b9f0a3a37d048b8bda6a87d3f65/src/Spryker/Zed/CompanyBusinessUnitDataImport/Business/Model/CompanyBusinessUnitWriterStep.php#L22-L32 |
honey-comb/resources | src/database/migrations/2018_09_16_125204_add_width_height_fields_to_hc_resource_grab_property_table.php | AddWidthHeightFieldsToHcResourceGrabPropertyTable.up | public function up()
{
Schema::table('hc_resource_grab_property', function (Blueprint $table) {
$table->string('width')->default('0');
$table->string('height')->default('0');
$table->string('x')->change();
$table->string('y')->change();
});
} | php | public function up()
{
Schema::table('hc_resource_grab_property', function (Blueprint $table) {
$table->string('width')->default('0');
$table->string('height')->default('0');
$table->string('x')->change();
$table->string('y')->change();
});
} | [
"public",
"function",
"up",
"(",
")",
"{",
"Schema",
"::",
"table",
"(",
"'hc_resource_grab_property'",
",",
"function",
"(",
"Blueprint",
"$",
"table",
")",
"{",
"$",
"table",
"->",
"string",
"(",
"'width'",
")",
"->",
"default",
"(",
"'0'",
")",
";",
... | Run the migrations.
@return void | [
"Run",
"the",
"migrations",
"."
] | train | https://github.com/honey-comb/resources/blob/9b82eb2fd99be99edfdc4e76803d95caf981e14b/src/database/migrations/2018_09_16_125204_add_width_height_fields_to_hc_resource_grab_property_table.php#L14-L22 |
honey-comb/resources | src/database/migrations/2018_09_16_125204_add_width_height_fields_to_hc_resource_grab_property_table.php | AddWidthHeightFieldsToHcResourceGrabPropertyTable.down | public function down()
{
Schema::table('hc_resource_grab_property', function (Blueprint $table) {
$table->dropColumn(['width', 'height']);
$table->integer('x')->change();
$table->integer('y')->change();
});
} | php | public function down()
{
Schema::table('hc_resource_grab_property', function (Blueprint $table) {
$table->dropColumn(['width', 'height']);
$table->integer('x')->change();
$table->integer('y')->change();
});
} | [
"public",
"function",
"down",
"(",
")",
"{",
"Schema",
"::",
"table",
"(",
"'hc_resource_grab_property'",
",",
"function",
"(",
"Blueprint",
"$",
"table",
")",
"{",
"$",
"table",
"->",
"dropColumn",
"(",
"[",
"'width'",
",",
"'height'",
"]",
")",
";",
"$... | Reverse the migrations.
@return void | [
"Reverse",
"the",
"migrations",
"."
] | train | https://github.com/honey-comb/resources/blob/9b82eb2fd99be99edfdc4e76803d95caf981e14b/src/database/migrations/2018_09_16_125204_add_width_height_fields_to_hc_resource_grab_property_table.php#L29-L36 |
RocketPropelledTortoise/Core | src/Entities/FieldCollection.php | FieldCollection.initField | public static function initField($configuration = [])
{
if (!array_key_exists('type', $configuration) || !class_exists($configuration['type'])) {
throw new InvalidFieldTypeException('You did not specify a type on this class.');
}
$collection = new static();
$collection->... | php | public static function initField($configuration = [])
{
if (!array_key_exists('type', $configuration) || !class_exists($configuration['type'])) {
throw new InvalidFieldTypeException('You did not specify a type on this class.');
}
$collection = new static();
$collection->... | [
"public",
"static",
"function",
"initField",
"(",
"$",
"configuration",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"'type'",
",",
"$",
"configuration",
")",
"||",
"!",
"class_exists",
"(",
"$",
"configuration",
"[",
"'type'",
"]",
... | Initialize a collection with the configuration
@param array $configuration
@throws InvalidFieldTypeException
@return static | [
"Initialize",
"a",
"collection",
"with",
"the",
"configuration"
] | train | https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Entities/FieldCollection.php#L46-L61 |
RocketPropelledTortoise/Core | src/Entities/FieldCollection.php | FieldCollection.validateSet | protected function validateSet($key, $value)
{
$maxItems = $this->getMaxItems();
if ((is_null($key) || !array_key_exists($key, $this->items)) && $maxItems != 0 && $this->count() >= $maxItems) {
throw new ItemCountException('The maximum number of items has been reached on this field.');
... | php | protected function validateSet($key, $value)
{
$maxItems = $this->getMaxItems();
if ((is_null($key) || !array_key_exists($key, $this->items)) && $maxItems != 0 && $this->count() >= $maxItems) {
throw new ItemCountException('The maximum number of items has been reached on this field.');
... | [
"protected",
"function",
"validateSet",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$",
"maxItems",
"=",
"$",
"this",
"->",
"getMaxItems",
"(",
")",
";",
"if",
"(",
"(",
"is_null",
"(",
"$",
"key",
")",
"||",
"!",
"array_key_exists",
"(",
"$",
"... | Validate input of OffsetSet
@param $key
@param $value
@throws ItemCountException
@throws NullValueException | [
"Validate",
"input",
"of",
"OffsetSet"
] | train | https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Entities/FieldCollection.php#L71-L81 |
RocketPropelledTortoise/Core | src/Entities/FieldCollection.php | FieldCollection.getFieldInstance | protected function getFieldInstance($value)
{
if ($value instanceof Field) {
return $value;
}
$container = new $this->type();
$container->value = $value;
return $container;
} | php | protected function getFieldInstance($value)
{
if ($value instanceof Field) {
return $value;
}
$container = new $this->type();
$container->value = $value;
return $container;
} | [
"protected",
"function",
"getFieldInstance",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"instanceof",
"Field",
")",
"{",
"return",
"$",
"value",
";",
"}",
"$",
"container",
"=",
"new",
"$",
"this",
"->",
"type",
"(",
")",
";",
"$",
"contai... | Get a field from a value
@param Field|mixed $value
@return Field | [
"Get",
"a",
"field",
"from",
"a",
"value"
] | train | https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Entities/FieldCollection.php#L89-L99 |
RocketPropelledTortoise/Core | src/Entities/FieldCollection.php | FieldCollection.offsetSet | public function offsetSet($key, $value)
{
$this->validateSet($key, $value);
if (is_null($value)) {
$this->offsetUnset($key);
return;
}
if (is_null($key)) {
$this->items[] = $this->getFieldInstance($value);
return;
}
... | php | public function offsetSet($key, $value)
{
$this->validateSet($key, $value);
if (is_null($value)) {
$this->offsetUnset($key);
return;
}
if (is_null($key)) {
$this->items[] = $this->getFieldInstance($value);
return;
}
... | [
"public",
"function",
"offsetSet",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"validateSet",
"(",
"$",
"key",
",",
"$",
"value",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"value",
")",
")",
"{",
"$",
"this",
"->",
"offsetUns... | Set the item at a given offset.
@param mixed $key
@param mixed $value
@return void | [
"Set",
"the",
"item",
"at",
"a",
"given",
"offset",
"."
] | train | https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Entities/FieldCollection.php#L108-L129 |
RocketPropelledTortoise/Core | src/Entities/FieldCollection.php | FieldCollection.offsetUnset | public function offsetUnset($key)
{
if ($this->offsetExists($key)) {
$this->deleted[] = $this->items[$key];
}
parent::offsetUnset($key);
} | php | public function offsetUnset($key)
{
if ($this->offsetExists($key)) {
$this->deleted[] = $this->items[$key];
}
parent::offsetUnset($key);
} | [
"public",
"function",
"offsetUnset",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"offsetExists",
"(",
"$",
"key",
")",
")",
"{",
"$",
"this",
"->",
"deleted",
"[",
"]",
"=",
"$",
"this",
"->",
"items",
"[",
"$",
"key",
"]",
";",
"}... | Unset the item at a given offset.
@param string $key
@return void | [
"Unset",
"the",
"item",
"at",
"a",
"given",
"offset",
"."
] | train | https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Entities/FieldCollection.php#L148-L154 |
RocketPropelledTortoise/Core | src/Entities/FieldCollection.php | FieldCollection.clear | public function clear()
{
foreach ($this->items as $item) {
$this->deleted[] = $item;
}
$this->items = [];
} | php | public function clear()
{
foreach ($this->items as $item) {
$this->deleted[] = $item;
}
$this->items = [];
} | [
"public",
"function",
"clear",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"items",
"as",
"$",
"item",
")",
"{",
"$",
"this",
"->",
"deleted",
"[",
"]",
"=",
"$",
"item",
";",
"}",
"$",
"this",
"->",
"items",
"=",
"[",
"]",
";",
"}"
] | Remove all items in this collection
@return void | [
"Remove",
"all",
"items",
"in",
"this",
"collection"
] | train | https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Entities/FieldCollection.php#L179-L186 |
RocketPropelledTortoise/Core | src/Entities/FieldCollection.php | FieldCollection.toArray | public function toArray()
{
if ($this->getMaxItems() != 1) {
return parent::toArray();
}
if (!array_key_exists(0, $this->items)) {
return null;
}
return $this->get(0)->toArray();
} | php | public function toArray()
{
if ($this->getMaxItems() != 1) {
return parent::toArray();
}
if (!array_key_exists(0, $this->items)) {
return null;
}
return $this->get(0)->toArray();
} | [
"public",
"function",
"toArray",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getMaxItems",
"(",
")",
"!=",
"1",
")",
"{",
"return",
"parent",
"::",
"toArray",
"(",
")",
";",
"}",
"if",
"(",
"!",
"array_key_exists",
"(",
"0",
",",
"$",
"this",
"... | As we use a field collection even if we have only one value, we use it that way.
@return array|mixed|null | [
"As",
"we",
"use",
"a",
"field",
"collection",
"even",
"if",
"we",
"have",
"only",
"one",
"value",
"we",
"use",
"it",
"that",
"way",
"."
] | train | https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Entities/FieldCollection.php#L203-L214 |
struggle-for-php/SfpStreamView | src/SfpStreamView/View.php | View.getScriptPath | function getScriptPath()
{
$fileName = $this->stack->pop();
if ($this->baseDir) {
return $this->baseDir . \DIRECTORY_SEPARATOR . $fileName;
} else {
return (string)$fileName;
}
} | php | function getScriptPath()
{
$fileName = $this->stack->pop();
if ($this->baseDir) {
return $this->baseDir . \DIRECTORY_SEPARATOR . $fileName;
} else {
return (string)$fileName;
}
} | [
"function",
"getScriptPath",
"(",
")",
"{",
"$",
"fileName",
"=",
"$",
"this",
"->",
"stack",
"->",
"pop",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"baseDir",
")",
"{",
"return",
"$",
"this",
"->",
"baseDir",
".",
"\\",
"DIRECTORY_SEPARATOR",
"."... | Get script file path
@return string | [
"Get",
"script",
"file",
"path"
] | train | https://github.com/struggle-for-php/SfpStreamView/blob/1ee960e122e4e7754a90cf81452567668ea1b32d/src/SfpStreamView/View.php#L66-L74 |
struggle-for-php/SfpStreamView | src/SfpStreamView/View.php | View.assign | function assign($array)
{
if (!is_array($array) && !($array instanceof \Traversable)) {
throw new \InvalidArgumentException('$array must be array or Traversable.');
}
foreach ($array as $key => $value) {
$this->storage[$key] = $value;
}
} | php | function assign($array)
{
if (!is_array($array) && !($array instanceof \Traversable)) {
throw new \InvalidArgumentException('$array must be array or Traversable.');
}
foreach ($array as $key => $value) {
$this->storage[$key] = $value;
}
} | [
"function",
"assign",
"(",
"$",
"array",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"array",
")",
"&&",
"!",
"(",
"$",
"array",
"instanceof",
"\\",
"Traversable",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'$array must be... | assign view vars
@param array|\Traversable $array | [
"assign",
"view",
"vars"
] | train | https://github.com/struggle-for-php/SfpStreamView/blob/1ee960e122e4e7754a90cf81452567668ea1b32d/src/SfpStreamView/View.php#L89-L98 |
spryker/merchant-relationship-data-import | src/Spryker/Zed/MerchantRelationshipDataImport/Business/Model/Step/MerchantKeyToIdMerchantStep.php | MerchantKeyToIdMerchantStep.execute | public function execute(DataSetInterface $dataSet): void
{
$merchantKey = $dataSet[MerchantRelationshipDataSetInterface::MERCHANT_KEY];
if (!$merchantKey) {
throw new InvalidDataException('"' . MerchantRelationshipDataSetInterface::MERCHANT_KEY . '" is required.');
}
if ... | php | public function execute(DataSetInterface $dataSet): void
{
$merchantKey = $dataSet[MerchantRelationshipDataSetInterface::MERCHANT_KEY];
if (!$merchantKey) {
throw new InvalidDataException('"' . MerchantRelationshipDataSetInterface::MERCHANT_KEY . '" is required.');
}
if ... | [
"public",
"function",
"execute",
"(",
"DataSetInterface",
"$",
"dataSet",
")",
":",
"void",
"{",
"$",
"merchantKey",
"=",
"$",
"dataSet",
"[",
"MerchantRelationshipDataSetInterface",
"::",
"MERCHANT_KEY",
"]",
";",
"if",
"(",
"!",
"$",
"merchantKey",
")",
"{",... | @param \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetInterface $dataSet
@throws \Spryker\Zed\DataImport\Business\Exception\EntityNotFoundException
@throws \Spryker\Zed\DataImport\Business\Exception\InvalidDataException
@return void | [
"@param",
"\\",
"Spryker",
"\\",
"Zed",
"\\",
"DataImport",
"\\",
"Business",
"\\",
"Model",
"\\",
"DataSet",
"\\",
"DataSetInterface",
"$dataSet"
] | train | https://github.com/spryker/merchant-relationship-data-import/blob/085d48de67de3f241eaf0b704151129ddc09dc42/src/Spryker/Zed/MerchantRelationshipDataImport/Business/Model/Step/MerchantKeyToIdMerchantStep.php#L33-L53 |
eureka-framework/component-response | src/Response/Header/HttpCode.php | HttpCode.getText | public static function getText($code)
{
$code = (int) $code;
if (!self::exists($code)) {
throw new \DomainException('Http Code does not exist!');
}
return self::$httpCodes[$code];
} | php | public static function getText($code)
{
$code = (int) $code;
if (!self::exists($code)) {
throw new \DomainException('Http Code does not exist!');
}
return self::$httpCodes[$code];
} | [
"public",
"static",
"function",
"getText",
"(",
"$",
"code",
")",
"{",
"$",
"code",
"=",
"(",
"int",
")",
"$",
"code",
";",
"if",
"(",
"!",
"self",
"::",
"exists",
"(",
"$",
"code",
")",
")",
"{",
"throw",
"new",
"\\",
"DomainException",
"(",
"'H... | Return text for the specified http code.
@param int $code
@return string
@throws \DomainException | [
"Return",
"text",
"for",
"the",
"specified",
"http",
"code",
"."
] | train | https://github.com/eureka-framework/component-response/blob/f34aea3a0aa67b88c5e7f8a3b86af29c550fa99a/src/Response/Header/HttpCode.php#L98-L107 |
PenoaksDev/Milky-Framework | src/Milky/Console/Scheduling/CallbackEvent.php | CallbackEvent.run | public function run()
{
if ( $this->description )
touch( $this->mutexPath() );
try
{
UniversalBuilder::call( $this->callback, $this->parameters )
}
finally
{
$this->removeMutex();
}
parent::callAfterCallbacks();
return $response;
} | php | public function run()
{
if ( $this->description )
touch( $this->mutexPath() );
try
{
UniversalBuilder::call( $this->callback, $this->parameters )
}
finally
{
$this->removeMutex();
}
parent::callAfterCallbacks();
return $response;
} | [
"public",
"function",
"run",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"description",
")",
"touch",
"(",
"$",
"this",
"->",
"mutexPath",
"(",
")",
")",
";",
"try",
"{",
"UniversalBuilder",
"::",
"call",
"(",
"$",
"this",
"->",
"callback",
",",
"... | Run the given event.
@return mixed
@throws \Exception | [
"Run",
"the",
"given",
"event",
"."
] | train | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Console/Scheduling/CallbackEvent.php#L48-L65 |
PenoaksDev/Milky-Framework | src/Milky/Console/Scheduling/CallbackEvent.php | CallbackEvent.withoutOverlapping | public function withoutOverlapping()
{
if ( !isset( $this->description ) )
throw new LogicException( "A scheduled event name is required to prevent overlapping. Use the 'name' method before 'withoutOverlapping'." );
return $this->skip( function ()
{
return file_exists( $this->mutexPath() );
} );
} | php | public function withoutOverlapping()
{
if ( !isset( $this->description ) )
throw new LogicException( "A scheduled event name is required to prevent overlapping. Use the 'name' method before 'withoutOverlapping'." );
return $this->skip( function ()
{
return file_exists( $this->mutexPath() );
} );
} | [
"public",
"function",
"withoutOverlapping",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"description",
")",
")",
"throw",
"new",
"LogicException",
"(",
"\"A scheduled event name is required to prevent overlapping. Use the 'name' method before 'withoutOve... | Do not allow the event to overlap each other.
@return $this
@throws \LogicException | [
"Do",
"not",
"allow",
"the",
"event",
"to",
"overlap",
"each",
"other",
"."
] | train | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Console/Scheduling/CallbackEvent.php#L85-L94 |
PenoaksDev/Milky-Framework | src/Milky/Console/Scheduling/CallbackEvent.php | CallbackEvent.getSummaryForDisplay | public function getSummaryForDisplay()
{
if ( is_string( $this->description ) )
return $this->description;
return is_string( $this->callback ) ? $this->callback : 'Closure';
} | php | public function getSummaryForDisplay()
{
if ( is_string( $this->description ) )
return $this->description;
return is_string( $this->callback ) ? $this->callback : 'Closure';
} | [
"public",
"function",
"getSummaryForDisplay",
"(",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"this",
"->",
"description",
")",
")",
"return",
"$",
"this",
"->",
"description",
";",
"return",
"is_string",
"(",
"$",
"this",
"->",
"callback",
")",
"?",
"$... | Get the summary of the event for display.
@return string | [
"Get",
"the",
"summary",
"of",
"the",
"event",
"for",
"display",
"."
] | train | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Console/Scheduling/CallbackEvent.php#L111-L117 |
octolabot/Common | src/Doctrine/Migration/FileBasedMigration.php | FileBasedMigration.preDown | final public function preDown(Schema $schema)
{
$this->prepare(array_map(function (string $migration) : string {
return $this->getFullPath($migration);
}, $this->getDowngradeMigrations()));
} | php | final public function preDown(Schema $schema)
{
$this->prepare(array_map(function (string $migration) : string {
return $this->getFullPath($migration);
}, $this->getDowngradeMigrations()));
} | [
"final",
"public",
"function",
"preDown",
"(",
"Schema",
"$",
"schema",
")",
"{",
"$",
"this",
"->",
"prepare",
"(",
"array_map",
"(",
"function",
"(",
"string",
"$",
"migration",
")",
":",
"string",
"{",
"return",
"$",
"this",
"->",
"getFullPath",
"(",
... | @param Schema $schema
@api | [
"@param",
"Schema",
"$schema"
] | train | https://github.com/octolabot/Common/blob/fb41f9c6736139e651de5e3ed1a7f4bd422c8e5b/src/Doctrine/Migration/FileBasedMigration.php#L78-L83 |
octolabot/Common | src/Doctrine/Migration/FileBasedMigration.php | FileBasedMigration.preUp | final public function preUp(Schema $schema)
{
$this->prepare(array_map(function (string $value) : string {
return $this->getFullPath($value);
}, $this->getUpgradeMigrations()));
} | php | final public function preUp(Schema $schema)
{
$this->prepare(array_map(function (string $value) : string {
return $this->getFullPath($value);
}, $this->getUpgradeMigrations()));
} | [
"final",
"public",
"function",
"preUp",
"(",
"Schema",
"$",
"schema",
")",
"{",
"$",
"this",
"->",
"prepare",
"(",
"array_map",
"(",
"function",
"(",
"string",
"$",
"value",
")",
":",
"string",
"{",
"return",
"$",
"this",
"->",
"getFullPath",
"(",
"$",... | @param Schema $schema
@api | [
"@param",
"Schema",
"$schema"
] | train | https://github.com/octolabot/Common/blob/fb41f9c6736139e651de5e3ed1a7f4bd422c8e5b/src/Doctrine/Migration/FileBasedMigration.php#L90-L95 |
octolabot/Common | src/Doctrine/Migration/FileBasedMigration.php | FileBasedMigration.getFullPath | public function getFullPath(string $migration): string
{
return implode('/', array_merge(
[$this->getBasePath()],
array_filter(
[$this->getMajorVersion(), $this->getMinorVersion(), $this->getPatch()],
function (string $value) : bool {
... | php | public function getFullPath(string $migration): string
{
return implode('/', array_merge(
[$this->getBasePath()],
array_filter(
[$this->getMajorVersion(), $this->getMinorVersion(), $this->getPatch()],
function (string $value) : bool {
... | [
"public",
"function",
"getFullPath",
"(",
"string",
"$",
"migration",
")",
":",
"string",
"{",
"return",
"implode",
"(",
"'/'",
",",
"array_merge",
"(",
"[",
"$",
"this",
"->",
"getBasePath",
"(",
")",
"]",
",",
"array_filter",
"(",
"[",
"$",
"this",
"... | @param string $migration
@return string
@api | [
"@param",
"string",
"$migration"
] | train | https://github.com/octolabot/Common/blob/fb41f9c6736139e651de5e3ed1a7f4bd422c8e5b/src/Doctrine/Migration/FileBasedMigration.php#L114-L126 |
DeimosProject/Request | src/Request/RequestExtension.php | RequestExtension.json | public function json(array $data = array(), $options = JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)
{
if (!headers_sent())
{
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Tue, 19 May 1981 18:00:00 GMT');
header('Content-type: application/jso... | php | public function json(array $data = array(), $options = JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)
{
if (!headers_sent())
{
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Tue, 19 May 1981 18:00:00 GMT');
header('Content-type: application/jso... | [
"public",
"function",
"json",
"(",
"array",
"$",
"data",
"=",
"array",
"(",
")",
",",
"$",
"options",
"=",
"JSON_PRETTY_PRINT",
"|",
"JSON_UNESCAPED_UNICODE",
")",
"{",
"if",
"(",
"!",
"headers_sent",
"(",
")",
")",
"{",
"header",
"(",
"'Cache-Control: no-... | @param array $data
@param int|array $options
@return string | [
"@param",
"array",
"$data",
"@param",
"int|array",
"$options"
] | train | https://github.com/DeimosProject/Request/blob/3e45af0fdbfc3c47c27de27a98e8980ba42c3737/src/Request/RequestExtension.php#L19-L37 |
UWEnrollmentManagement/Connection | src/Connection.php | Connection.execGET | public function execGET($url, array $params = [])
{
$url = $this->baseUrl . $url;
// Build the query from the parameters
if ($params !== []) {
$url .= '?' . http_build_query($params);
}
// Set request options
$this->addOptions([
CURLOPT_URL =... | php | public function execGET($url, array $params = [])
{
$url = $this->baseUrl . $url;
// Build the query from the parameters
if ($params !== []) {
$url .= '?' . http_build_query($params);
}
// Set request options
$this->addOptions([
CURLOPT_URL =... | [
"public",
"function",
"execGET",
"(",
"$",
"url",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"baseUrl",
".",
"$",
"url",
";",
"// Build the query from the parameters",
"if",
"(",
"$",
"params",
"!==",
"[",... | Execute a GET request to a given URL, with optional parameters.
@param string $url
@param string[] $params Array of query parameter $key=>$value pairs.
@return ConnectionReturn The server's response | [
"Execute",
"a",
"GET",
"request",
"to",
"a",
"given",
"URL",
"with",
"optional",
"parameters",
"."
] | train | https://github.com/UWEnrollmentManagement/Connection/blob/56cadfd9003a3e2d875494a26d9cce69b9b0aa57/src/Connection.php#L103-L119 |
UWEnrollmentManagement/Connection | src/Connection.php | Connection.execPOST | public function execPOST($url, array $params = [])
{
$url = $this->baseUrl . $url;
$this->addOptions([
CURLOPT_URL => $url,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $params,
]);
return $this->exec();
} | php | public function execPOST($url, array $params = [])
{
$url = $this->baseUrl . $url;
$this->addOptions([
CURLOPT_URL => $url,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $params,
]);
return $this->exec();
} | [
"public",
"function",
"execPOST",
"(",
"$",
"url",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"baseUrl",
".",
"$",
"url",
";",
"$",
"this",
"->",
"addOptions",
"(",
"[",
"CURLOPT_URL",
"=>",
"$",
"ur... | Execute a POST request to a given URL, with optional parameters.
@param string $url
@param string[] $params Array of POST parameter $key=>$value pairs.
@return ConnectionReturn The server's response. | [
"Execute",
"a",
"POST",
"request",
"to",
"a",
"given",
"URL",
"with",
"optional",
"parameters",
"."
] | train | https://github.com/UWEnrollmentManagement/Connection/blob/56cadfd9003a3e2d875494a26d9cce69b9b0aa57/src/Connection.php#L128-L139 |
spiral/console | src/Config/ConsoleConfig.php | ConsoleConfig.configureSequence | public function configureSequence(): \Generator
{
$sequence = $this->config['configure'] ?? $this->config['configureSequence'] ?? [];
foreach ($sequence as $item) {
yield $this->parseSequence($item);
}
} | php | public function configureSequence(): \Generator
{
$sequence = $this->config['configure'] ?? $this->config['configureSequence'] ?? [];
foreach ($sequence as $item) {
yield $this->parseSequence($item);
}
} | [
"public",
"function",
"configureSequence",
"(",
")",
":",
"\\",
"Generator",
"{",
"$",
"sequence",
"=",
"$",
"this",
"->",
"config",
"[",
"'configure'",
"]",
"??",
"$",
"this",
"->",
"config",
"[",
"'configureSequence'",
"]",
"??",
"[",
"]",
";",
"foreac... | Get list of configure sequences.
@return \Generator|SequenceInterface[]
@throws ConfigException | [
"Get",
"list",
"of",
"configure",
"sequences",
"."
] | train | https://github.com/spiral/console/blob/c3d99450ddd32bcc6f87e2b2ed40821054a93da3/src/Config/ConsoleConfig.php#L69-L75 |
spiral/console | src/Config/ConsoleConfig.php | ConsoleConfig.updateSequence | public function updateSequence(): \Generator
{
$sequence = $this->config['update'] ?? $this->config['updateSequence'] ?? [];
foreach ($sequence as $item) {
yield $this->parseSequence($item);
}
} | php | public function updateSequence(): \Generator
{
$sequence = $this->config['update'] ?? $this->config['updateSequence'] ?? [];
foreach ($sequence as $item) {
yield $this->parseSequence($item);
}
} | [
"public",
"function",
"updateSequence",
"(",
")",
":",
"\\",
"Generator",
"{",
"$",
"sequence",
"=",
"$",
"this",
"->",
"config",
"[",
"'update'",
"]",
"??",
"$",
"this",
"->",
"config",
"[",
"'updateSequence'",
"]",
"??",
"[",
"]",
";",
"foreach",
"("... | Get list of all update sequences.
@return \Generator|SequenceInterface[]
@throws ConfigException | [
"Get",
"list",
"of",
"all",
"update",
"sequences",
"."
] | train | https://github.com/spiral/console/blob/c3d99450ddd32bcc6f87e2b2ed40821054a93da3/src/Config/ConsoleConfig.php#L84-L90 |
spiral/console | src/Config/ConsoleConfig.php | ConsoleConfig.parseSequence | protected function parseSequence($item): SequenceInterface
{
if ($item instanceof SequenceInterface) {
return $item;
}
if (is_string($item)) {
return new CallableSequence($item);
}
if (is_array($item) && isset($item['command'])) {
return ... | php | protected function parseSequence($item): SequenceInterface
{
if ($item instanceof SequenceInterface) {
return $item;
}
if (is_string($item)) {
return new CallableSequence($item);
}
if (is_array($item) && isset($item['command'])) {
return ... | [
"protected",
"function",
"parseSequence",
"(",
"$",
"item",
")",
":",
"SequenceInterface",
"{",
"if",
"(",
"$",
"item",
"instanceof",
"SequenceInterface",
")",
"{",
"return",
"$",
"item",
";",
"}",
"if",
"(",
"is_string",
"(",
"$",
"item",
")",
")",
"{",... | @param mixed $item
@return SequenceInterface
@throws ConfigException | [
"@param",
"mixed",
"$item",
"@return",
"SequenceInterface"
] | train | https://github.com/spiral/console/blob/c3d99450ddd32bcc6f87e2b2ed40821054a93da3/src/Config/ConsoleConfig.php#L98-L130 |
mcustiel/phiremock-server | src/Http/InputSources/InputSourceLocator.php | InputSourceLocator.locate | public function locate($inputSourceIdentifier)
{
if (InputSources::isValidInputSource($inputSourceIdentifier)) {
return $this->factory->{self::INPUT_SOURCE_FACTORY_METHOD_MAP[$inputSourceIdentifier]}();
} | php | public function locate($inputSourceIdentifier)
{
if (InputSources::isValidInputSource($inputSourceIdentifier)) {
return $this->factory->{self::INPUT_SOURCE_FACTORY_METHOD_MAP[$inputSourceIdentifier]}();
} | [
"public",
"function",
"locate",
"(",
"$",
"inputSourceIdentifier",
")",
"{",
"if",
"(",
"InputSources",
"::",
"isValidInputSource",
"(",
"$",
"inputSourceIdentifier",
")",
")",
"{",
"return",
"$",
"this",
"->",
"factory",
"->",
"{",
"self",
"::",
"INPUT_SOURCE... | @param string $inputSourceIdentifier
@throws \InvalidArgumentException
@return InputSourceInterface | [
"@param",
"string",
"$inputSourceIdentifier"
] | train | https://github.com/mcustiel/phiremock-server/blob/7be42ce7c5c4d441410d80e158477910924cfbd9/src/Http/InputSources/InputSourceLocator.php#L31-L35 |
ekyna/Table | Http/Handler/ExportHandler.php | ExportHandler.getAdapter | private function getAdapter(TableInterface $table, $format)
{
$adapters = $table->getConfig()->getExportAdapters();
foreach ($adapters as $adapter) {
if ($adapter->supports($format)) {
return $adapter;
}
}
return null;
} | php | private function getAdapter(TableInterface $table, $format)
{
$adapters = $table->getConfig()->getExportAdapters();
foreach ($adapters as $adapter) {
if ($adapter->supports($format)) {
return $adapter;
}
}
return null;
} | [
"private",
"function",
"getAdapter",
"(",
"TableInterface",
"$",
"table",
",",
"$",
"format",
")",
"{",
"$",
"adapters",
"=",
"$",
"table",
"->",
"getConfig",
"(",
")",
"->",
"getExportAdapters",
"(",
")",
";",
"foreach",
"(",
"$",
"adapters",
"as",
"$",... | Returns the adapter supporting the given format.
@param TableInterface $table
@param string $format
@return \Ekyna\Component\Table\Export\AdapterInterface|null | [
"Returns",
"the",
"adapter",
"supporting",
"the",
"given",
"format",
"."
] | train | https://github.com/ekyna/Table/blob/6f06e8fd8a3248d52f3a91f10508471344db311a/Http/Handler/ExportHandler.php#L64-L75 |
nguyenanhung/my-debug | src/Utils.php | Utils.slugify | public static function slugify($str = '')
{
if (!class_exists('\Cocur\Slugify\Slugify')) {
if (function_exists('log_message')) {
$message = 'Không tồn tại class Slugify';
log_message('error', $message);
}
return self::convert_vi_to_en($str... | php | public static function slugify($str = '')
{
if (!class_exists('\Cocur\Slugify\Slugify')) {
if (function_exists('log_message')) {
$message = 'Không tồn tại class Slugify';
log_message('error', $message);
}
return self::convert_vi_to_en($str... | [
"public",
"static",
"function",
"slugify",
"(",
"$",
"str",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"'\\Cocur\\Slugify\\Slugify'",
")",
")",
"{",
"if",
"(",
"function_exists",
"(",
"'log_message'",
")",
")",
"{",
"$",
"message",
"=",
"'... | Function slugify
Hàm chuyển đổi ký tự từ tiếng Việt,
và các ký tự đặc biệt sang ký tự không dấu
@author: 713uk13m <dev@nguyenanhung.com>
@time : 10/9/18 00:31
@param string $str Chuỗi ký tự đầu vào
@return mixed|null|string Đầu ra rà 1 chuỗi ký tự | [
"Function",
"slugify"
] | train | https://github.com/nguyenanhung/my-debug/blob/9dde293d6c04098ee68858035bd04076874f43d6/src/Utils.php#L47-L70 |
nguyenanhung/my-debug | src/Utils.php | Utils.convert_vi_to_en | public static function convert_vi_to_en($str = '')
{
$str = trim($str);
$str = function_exists('mb_strtolower') ? mb_strtolower($str) : strtolower($str);
$data = DataRepository::getData('convert_vi_to_en');
if (!empty($str)) {
$str = str_replace($data['vn_array'], $data... | php | public static function convert_vi_to_en($str = '')
{
$str = trim($str);
$str = function_exists('mb_strtolower') ? mb_strtolower($str) : strtolower($str);
$data = DataRepository::getData('convert_vi_to_en');
if (!empty($str)) {
$str = str_replace($data['vn_array'], $data... | [
"public",
"static",
"function",
"convert_vi_to_en",
"(",
"$",
"str",
"=",
"''",
")",
"{",
"$",
"str",
"=",
"trim",
"(",
"$",
"str",
")",
";",
"$",
"str",
"=",
"function_exists",
"(",
"'mb_strtolower'",
")",
"?",
"mb_strtolower",
"(",
"$",
"str",
")",
... | Function convert_vi_to_en
Hàm chuyển đổi ký tự từ tiếng Việt,
và các ký tự đặc biệt sang ký tự không dấu
Sử dụng trong trường hợp class slugify nó không chạy
@author: 713uk13m <dev@nguyenanhung.com>
@time : 10/13/18 01:17
@param string $str Chuỗi ký tự đầu vào
@return mixed|string Đầu ra rà 1 chuỗi ký tự | [
"Function",
"convert_vi_to_en"
] | train | https://github.com/nguyenanhung/my-debug/blob/9dde293d6c04098ee68858035bd04076874f43d6/src/Utils.php#L87-L105 |
jenskooij/cloudcontrol | src/util/DocumentSorter.php | DocumentSorter.sortDocumentsByField | public static function sortDocumentsByField($documents, $field, $order = 'ASC')
{
self::$orderByField = $field;
self::$order = strtoupper($order) === 'ASC' ? 'ASC' : 'DESC';
usort($documents, '\CloudControl\Cms\util\DocumentSorter::fieldCompare');
if ($order === 'DESC') {
... | php | public static function sortDocumentsByField($documents, $field, $order = 'ASC')
{
self::$orderByField = $field;
self::$order = strtoupper($order) === 'ASC' ? 'ASC' : 'DESC';
usort($documents, '\CloudControl\Cms\util\DocumentSorter::fieldCompare');
if ($order === 'DESC') {
... | [
"public",
"static",
"function",
"sortDocumentsByField",
"(",
"$",
"documents",
",",
"$",
"field",
",",
"$",
"order",
"=",
"'ASC'",
")",
"{",
"self",
"::",
"$",
"orderByField",
"=",
"$",
"field",
";",
"self",
"::",
"$",
"order",
"=",
"strtoupper",
"(",
... | Sorts an array of Document instances
@param array $documents
@param string $field
@param string $order
@return array | [
"Sorts",
"an",
"array",
"of",
"Document",
"instances"
] | train | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/util/DocumentSorter.php#L23-L32 |
jenskooij/cloudcontrol | src/util/DocumentSorter.php | DocumentSorter.fieldCompare | protected static function fieldCompare(Document $a, Document $b) {
$field = self::$orderByField;
if (property_exists('\CloudControl\Cms\storage\entities\Document', $field)) {
return strcasecmp($a->{$field}, $b->{$field});
}
if (!isset($a->fields->{$field}[0])) {
... | php | protected static function fieldCompare(Document $a, Document $b) {
$field = self::$orderByField;
if (property_exists('\CloudControl\Cms\storage\entities\Document', $field)) {
return strcasecmp($a->{$field}, $b->{$field});
}
if (!isset($a->fields->{$field}[0])) {
... | [
"protected",
"static",
"function",
"fieldCompare",
"(",
"Document",
"$",
"a",
",",
"Document",
"$",
"b",
")",
"{",
"$",
"field",
"=",
"self",
"::",
"$",
"orderByField",
";",
"if",
"(",
"property_exists",
"(",
"'\\CloudControl\\Cms\\storage\\entities\\Document'",
... | Compares two documents
@param Document $a
@param Document $b
@return int | [
"Compares",
"two",
"documents"
] | train | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/util/DocumentSorter.php#L40-L55 |
RhubarbPHP/Module.ImageProcessing | src/Image.php | Image.checkCacheValid | private function checkCacheValid( $cacheFile )
{
if ( file_exists( $cacheFile ) && ( filemtime( $cacheFile ) > filemtime( $this->filePath ) ) )
{
return true;
}
return false;
} | php | private function checkCacheValid( $cacheFile )
{
if ( file_exists( $cacheFile ) && ( filemtime( $cacheFile ) > filemtime( $this->filePath ) ) )
{
return true;
}
return false;
} | [
"private",
"function",
"checkCacheValid",
"(",
"$",
"cacheFile",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"cacheFile",
")",
"&&",
"(",
"filemtime",
"(",
"$",
"cacheFile",
")",
">",
"filemtime",
"(",
"$",
"this",
"->",
"filePath",
")",
")",
")",
"{... | Returns true if the cache file exists and is current.
@param mixed $cacheFile
@return bool | [
"Returns",
"true",
"if",
"the",
"cache",
"file",
"exists",
"and",
"is",
"current",
"."
] | train | https://github.com/RhubarbPHP/Module.ImageProcessing/blob/e980ae6b524ce60f550064257eb7318dce331c1a/src/Image.php#L163-L171 |
RhubarbPHP/Module.ImageProcessing | src/Image.php | Image.ApplyMetricsToCanvas | public function ApplyMetricsToCanvas()
{
$destinationCanvas = @imageCreateTrueColor( $this->_metrics->frameWidth, $this->_metrics->frameHeight );
$backColor = imagecolorallocate( $destinationCanvas, 255, 255, 255 );
if( $this->_metrics->sourceFormat == 3 )
{
$backColor = imagecolorallocatealpha( $destinat... | php | public function ApplyMetricsToCanvas()
{
$destinationCanvas = @imageCreateTrueColor( $this->_metrics->frameWidth, $this->_metrics->frameHeight );
$backColor = imagecolorallocate( $destinationCanvas, 255, 255, 255 );
if( $this->_metrics->sourceFormat == 3 )
{
$backColor = imagecolorallocatealpha( $destinat... | [
"public",
"function",
"ApplyMetricsToCanvas",
"(",
")",
"{",
"$",
"destinationCanvas",
"=",
"@",
"imageCreateTrueColor",
"(",
"$",
"this",
"->",
"_metrics",
"->",
"frameWidth",
",",
"$",
"this",
"->",
"_metrics",
"->",
"frameHeight",
")",
";",
"$",
"backColor"... | Makes sure that the current image metrics are applied to the canvas, essentially committing the
changes. | [
"Makes",
"sure",
"that",
"the",
"current",
"image",
"metrics",
"are",
"applied",
"to",
"the",
"canvas",
"essentially",
"committing",
"the",
"changes",
"."
] | train | https://github.com/RhubarbPHP/Module.ImageProcessing/blob/e980ae6b524ce60f550064257eb7318dce331c1a/src/Image.php#L188-L213 |
agentmedia/phine-core | src/Core/Logic/Access/Backend/UserGuard.php | UserGuard.HasAnyPageRight | private function HasAnyPageRight(BackendPageRights $pageRights)
{
return $pageRights->GetRemove() ||
$pageRights->GetCreateIn() ||
$pageRights->GetEdit() ||
$pageRights->GetMove();
} | php | private function HasAnyPageRight(BackendPageRights $pageRights)
{
return $pageRights->GetRemove() ||
$pageRights->GetCreateIn() ||
$pageRights->GetEdit() ||
$pageRights->GetMove();
} | [
"private",
"function",
"HasAnyPageRight",
"(",
"BackendPageRights",
"$",
"pageRights",
")",
"{",
"return",
"$",
"pageRights",
"->",
"GetRemove",
"(",
")",
"||",
"$",
"pageRights",
"->",
"GetCreateIn",
"(",
")",
"||",
"$",
"pageRights",
"->",
"GetEdit",
"(",
... | True if any of the page rights is true
@param BackendPageRights $pageRights The page right
@return boolean Returns true if any access action is allowed | [
"True",
"if",
"any",
"of",
"the",
"page",
"rights",
"is",
"true"
] | train | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Access/Backend/UserGuard.php#L222-L228 |
agentmedia/phine-core | src/Core/Logic/Access/Backend/UserGuard.php | UserGuard.HasAnyContentRight | private function HasAnyContentRight(BackendContentRights $contentRights)
{
return $contentRights->GetEdit() ||
$contentRights->GetRemove() ||
$contentRights->GetCreateIn() ||
$contentRights->GetMove();
} | php | private function HasAnyContentRight(BackendContentRights $contentRights)
{
return $contentRights->GetEdit() ||
$contentRights->GetRemove() ||
$contentRights->GetCreateIn() ||
$contentRights->GetMove();
} | [
"private",
"function",
"HasAnyContentRight",
"(",
"BackendContentRights",
"$",
"contentRights",
")",
"{",
"return",
"$",
"contentRights",
"->",
"GetEdit",
"(",
")",
"||",
"$",
"contentRights",
"->",
"GetRemove",
"(",
")",
"||",
"$",
"contentRights",
"->",
"GetCr... | True if any of the content rights is true
@param BackendContentRights $contentRights
@return boolean Returns true if any access action is allowed | [
"True",
"if",
"any",
"of",
"the",
"content",
"rights",
"is",
"true"
] | train | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Access/Backend/UserGuard.php#L247-L253 |
agentmedia/phine-core | src/Core/Logic/Access/Backend/UserGuard.php | UserGuard.GrantGroupOnContent | private function GrantGroupOnContent(Usergroup $group, Usergroup $contentGroup, BackendContentRights $contentRights, BackendAction $action)
{
if (!$group->Equals($contentGroup))
{
return GrantResult::NoAccess();
}
$allowed = false;
switch ($action)
{
... | php | private function GrantGroupOnContent(Usergroup $group, Usergroup $contentGroup, BackendContentRights $contentRights, BackendAction $action)
{
if (!$group->Equals($contentGroup))
{
return GrantResult::NoAccess();
}
$allowed = false;
switch ($action)
{
... | [
"private",
"function",
"GrantGroupOnContent",
"(",
"Usergroup",
"$",
"group",
",",
"Usergroup",
"$",
"contentGroup",
",",
"BackendContentRights",
"$",
"contentRights",
",",
"BackendAction",
"$",
"action",
")",
"{",
"if",
"(",
"!",
"$",
"group",
"->",
"Equals",
... | Calculates the grant result for a group on a content
@param Usergroup $group The evaluated group
@param Usergroup $contentGroup The group of the content
@param BackendContentRights $contentRights The rights of the content
@param BackendAction $action The action that shall be taken for the content
@return GrantResult Re... | [
"Calculates",
"the",
"grant",
"result",
"for",
"a",
"group",
"on",
"a",
"content"
] | train | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Access/Backend/UserGuard.php#L400-L431 |
agentmedia/phine-core | src/Core/Logic/Access/Backend/UserGuard.php | UserGuard.GrantCreateLayout | private function GrantCreateLayout()
{
$groups = $this->GetGroups();
foreach ($groups as $group)
{
if ($group->GetCreateLayouts())
{
return GrantResult::Allowed();
}
}
return GrantResult::NoAccess();
} | php | private function GrantCreateLayout()
{
$groups = $this->GetGroups();
foreach ($groups as $group)
{
if ($group->GetCreateLayouts())
{
return GrantResult::Allowed();
}
}
return GrantResult::NoAccess();
} | [
"private",
"function",
"GrantCreateLayout",
"(",
")",
"{",
"$",
"groups",
"=",
"$",
"this",
"->",
"GetGroups",
"(",
")",
";",
"foreach",
"(",
"$",
"groups",
"as",
"$",
"group",
")",
"{",
"if",
"(",
"$",
"group",
"->",
"GetCreateLayouts",
"(",
")",
")... | Grant access to create a new layout by common group settings
@return GrantResult | [
"Grant",
"access",
"to",
"create",
"a",
"new",
"layout",
"by",
"common",
"group",
"settings"
] | train | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Access/Backend/UserGuard.php#L437-L448 |
agentmedia/phine-core | src/Core/Logic/Access/Backend/UserGuard.php | UserGuard.GrantCreateSite | private function GrantCreateSite()
{
$groups = $this->GetGroups();
foreach ($groups as $group)
{
if ($group->GetCreateSites())
{
return GrantResult::Allowed();
}
}
return GrantResult::NoAccess();
} | php | private function GrantCreateSite()
{
$groups = $this->GetGroups();
foreach ($groups as $group)
{
if ($group->GetCreateSites())
{
return GrantResult::Allowed();
}
}
return GrantResult::NoAccess();
} | [
"private",
"function",
"GrantCreateSite",
"(",
")",
"{",
"$",
"groups",
"=",
"$",
"this",
"->",
"GetGroups",
"(",
")",
";",
"foreach",
"(",
"$",
"groups",
"as",
"$",
"group",
")",
"{",
"if",
"(",
"$",
"group",
"->",
"GetCreateSites",
"(",
")",
")",
... | Grant access to create a new site by common group settings
@return GrantResult | [
"Grant",
"access",
"to",
"create",
"a",
"new",
"site",
"by",
"common",
"group",
"settings"
] | train | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Access/Backend/UserGuard.php#L455-L466 |
agentmedia/phine-core | src/Core/Logic/Access/Backend/UserGuard.php | UserGuard.GrantCreateContainer | private function GrantCreateContainer()
{
$groups = $this->GetGroups();
foreach ($groups as $group)
{
if ($group->GetCreateContainers())
{
return GrantResult::Allowed();
}
}
return GrantResult::NoAccess();
} | php | private function GrantCreateContainer()
{
$groups = $this->GetGroups();
foreach ($groups as $group)
{
if ($group->GetCreateContainers())
{
return GrantResult::Allowed();
}
}
return GrantResult::NoAccess();
} | [
"private",
"function",
"GrantCreateContainer",
"(",
")",
"{",
"$",
"groups",
"=",
"$",
"this",
"->",
"GetGroups",
"(",
")",
";",
"foreach",
"(",
"$",
"groups",
"as",
"$",
"group",
")",
"{",
"if",
"(",
"$",
"group",
"->",
"GetCreateContainers",
"(",
")"... | Grant access to create a new site by common group settings
@return GrantResult | [
"Grant",
"access",
"to",
"create",
"a",
"new",
"site",
"by",
"common",
"group",
"settings"
] | train | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Access/Backend/UserGuard.php#L473-L484 |
agentmedia/phine-core | src/Core/Logic/Access/Backend/UserGuard.php | UserGuard.GrantOnContent | private function GrantOnContent(Content $content, BackendAction $action)
{
if ($this->GetUser()->Equals($content->GetUser()))
{
return GrantResult::Allowed();
}
$contentRights = RightsFinder::FindContentRights($content);
$contentGroup = GroupFinder::FindContentGro... | php | private function GrantOnContent(Content $content, BackendAction $action)
{
if ($this->GetUser()->Equals($content->GetUser()))
{
return GrantResult::Allowed();
}
$contentRights = RightsFinder::FindContentRights($content);
$contentGroup = GroupFinder::FindContentGro... | [
"private",
"function",
"GrantOnContent",
"(",
"Content",
"$",
"content",
",",
"BackendAction",
"$",
"action",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"GetUser",
"(",
")",
"->",
"Equals",
"(",
"$",
"content",
"->",
"GetUser",
"(",
")",
")",
")",
"{",
... | Calculates the grant result for a content
@param Content $content The content
@param BackendAction $action The action that shall be taken on the content
@return GrantResult Returns the calculated grant result | [
"Calculates",
"the",
"grant",
"result",
"for",
"a",
"content"
] | train | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Access/Backend/UserGuard.php#L491-L513 |
agentmedia/phine-core | src/Core/Logic/Access/Backend/UserGuard.php | UserGuard.GrantAddPageToSite | function GrantAddPageToSite(Site $site)
{
//Dummy page for evaluation
$page = new Page();
$page->SetUserGroup($site->GetUserGroup());
$siteRights = $site->GetUserGroupRights();
if ($siteRights)
{
$page->SetUserGroupRights($siteRights->GetPageRights());
... | php | function GrantAddPageToSite(Site $site)
{
//Dummy page for evaluation
$page = new Page();
$page->SetUserGroup($site->GetUserGroup());
$siteRights = $site->GetUserGroupRights();
if ($siteRights)
{
$page->SetUserGroupRights($siteRights->GetPageRights());
... | [
"function",
"GrantAddPageToSite",
"(",
"Site",
"$",
"site",
")",
"{",
"//Dummy page for evaluation",
"$",
"page",
"=",
"new",
"Page",
"(",
")",
";",
"$",
"page",
"->",
"SetUserGroup",
"(",
"$",
"site",
"->",
"GetUserGroup",
"(",
")",
")",
";",
"$",
"site... | Grant evaluation for adding a page on top of the site
@param Site $site The site
@return GrantResult The result | [
"Grant",
"evaluation",
"for",
"adding",
"a",
"page",
"on",
"top",
"of",
"the",
"site"
] | train | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Access/Backend/UserGuard.php#L610-L621 |
agentmedia/phine-core | src/Core/Logic/Access/Backend/UserGuard.php | UserGuard.GrantAddContentToPageArea | function GrantAddContentToPageArea(Page $page, Area $area)
{
$result = $this->Grant(BackendAction::Create(), $area);
if (!$result->ToBool())
{
return $result;
}
return $this->GrantAddContentToPage($page);
} | php | function GrantAddContentToPageArea(Page $page, Area $area)
{
$result = $this->Grant(BackendAction::Create(), $area);
if (!$result->ToBool())
{
return $result;
}
return $this->GrantAddContentToPage($page);
} | [
"function",
"GrantAddContentToPageArea",
"(",
"Page",
"$",
"page",
",",
"Area",
"$",
"area",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"Grant",
"(",
"BackendAction",
"::",
"Create",
"(",
")",
",",
"$",
"area",
")",
";",
"if",
"(",
"!",
"$",
... | Grant evaluation vor a page are
@param Page $page
@param Area $area
@return GrantResult | [
"Grant",
"evaluation",
"vor",
"a",
"page",
"are"
] | train | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Access/Backend/UserGuard.php#L628-L637 |
agentmedia/phine-core | src/Core/Logic/Access/Backend/UserGuard.php | UserGuard.GrantAddContentToPage | function GrantAddContentToPage(Page $page)
{
//dummy content for evaluation
$content = new Content();
$content->SetUserGroup(GroupFinder::FindPageGroup($page));
$pageRights = RightsFinder::FindPageRights($page);
if ($pageRights)
{
$content->SetUserGroupRig... | php | function GrantAddContentToPage(Page $page)
{
//dummy content for evaluation
$content = new Content();
$content->SetUserGroup(GroupFinder::FindPageGroup($page));
$pageRights = RightsFinder::FindPageRights($page);
if ($pageRights)
{
$content->SetUserGroupRig... | [
"function",
"GrantAddContentToPage",
"(",
"Page",
"$",
"page",
")",
"{",
"//dummy content for evaluation",
"$",
"content",
"=",
"new",
"Content",
"(",
")",
";",
"$",
"content",
"->",
"SetUserGroup",
"(",
"GroupFinder",
"::",
"FindPageGroup",
"(",
"$",
"page",
... | Grant evaluation for adding content on top of a page area
@param Page $page The page
@return GrantResult GrantResult Returns the grant result telling if creation is allowed | [
"Grant",
"evaluation",
"for",
"adding",
"content",
"on",
"top",
"of",
"a",
"page",
"area"
] | train | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Access/Backend/UserGuard.php#L643-L654 |
agentmedia/phine-core | src/Core/Logic/Access/Backend/UserGuard.php | UserGuard.GrantAddContentToLayoutArea | function GrantAddContentToLayoutArea(Area $area)
{
$result = $this->Grant(BackendAction::Create(), $area);
if (!$result->ToBool())
{
return $result;
}
return $this->GrantAddContentToLayout($area->GetLayout());
} | php | function GrantAddContentToLayoutArea(Area $area)
{
$result = $this->Grant(BackendAction::Create(), $area);
if (!$result->ToBool())
{
return $result;
}
return $this->GrantAddContentToLayout($area->GetLayout());
} | [
"function",
"GrantAddContentToLayoutArea",
"(",
"Area",
"$",
"area",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"Grant",
"(",
"BackendAction",
"::",
"Create",
"(",
")",
",",
"$",
"area",
")",
";",
"if",
"(",
"!",
"$",
"result",
"->",
"ToBool",
... | Grant evaluation for adding content to layout area
@param Area $area
@return GrantResult | [
"Grant",
"evaluation",
"for",
"adding",
"content",
"to",
"layout",
"area"
] | train | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Access/Backend/UserGuard.php#L660-L668 |
agentmedia/phine-core | src/Core/Logic/Access/Backend/UserGuard.php | UserGuard.GrantAddContentToLayout | function GrantAddContentToLayout(Layout $layout)
{
//dummy content for evaluation
$content = new Content();
$content->SetUserGroup($layout->GetUserGroup());
$layoutRights = $layout->GetUserGroupRights();
if ($layoutRights)
{
$content->SetUserGroupRights($l... | php | function GrantAddContentToLayout(Layout $layout)
{
//dummy content for evaluation
$content = new Content();
$content->SetUserGroup($layout->GetUserGroup());
$layoutRights = $layout->GetUserGroupRights();
if ($layoutRights)
{
$content->SetUserGroupRights($l... | [
"function",
"GrantAddContentToLayout",
"(",
"Layout",
"$",
"layout",
")",
"{",
"//dummy content for evaluation",
"$",
"content",
"=",
"new",
"Content",
"(",
")",
";",
"$",
"content",
"->",
"SetUserGroup",
"(",
"$",
"layout",
"->",
"GetUserGroup",
"(",
")",
")"... | Grant evaluation for adding content on top of a layout area
@param Layout $layout The layout
@return GrantResult Returns the grant result telling if creation is allowed | [
"Grant",
"evaluation",
"for",
"adding",
"content",
"on",
"top",
"of",
"a",
"layout",
"area"
] | train | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Access/Backend/UserGuard.php#L674-L685 |
agentmedia/phine-core | src/Core/Logic/Access/Backend/UserGuard.php | UserGuard.GrantAddContentToContainer | function GrantAddContentToContainer(Container $container)
{
//dummy content for evaluation
$content = new Content();
$content->SetUserGroup($container->GetUserGroup());
$containerRights = $container->GetUserGroupRights();
if ($containerRights)
{
$content->... | php | function GrantAddContentToContainer(Container $container)
{
//dummy content for evaluation
$content = new Content();
$content->SetUserGroup($container->GetUserGroup());
$containerRights = $container->GetUserGroupRights();
if ($containerRights)
{
$content->... | [
"function",
"GrantAddContentToContainer",
"(",
"Container",
"$",
"container",
")",
"{",
"//dummy content for evaluation",
"$",
"content",
"=",
"new",
"Content",
"(",
")",
";",
"$",
"content",
"->",
"SetUserGroup",
"(",
"$",
"container",
"->",
"GetUserGroup",
"(",
... | Grant evaluation for adding content on top of a container
@param Container $container The container
@return GrantResult Returns the grant result telling if creation is allowed | [
"Grant",
"evaluation",
"for",
"adding",
"content",
"on",
"top",
"of",
"a",
"container"
] | train | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Access/Backend/UserGuard.php#L716-L727 |
vaniocz/stdlib | src/UniversalJsonSerializer.php | UniversalJsonSerializer.serialize | public static function serialize($value): string
{
$serialized = json_encode(
self::encode($value, new SplObjectStorage()),
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES
);
if (json_last_error() !== JSON_ERROR_NONE) {
throw new \InvalidArgumentException... | php | public static function serialize($value): string
{
$serialized = json_encode(
self::encode($value, new SplObjectStorage()),
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES
);
if (json_last_error() !== JSON_ERROR_NONE) {
throw new \InvalidArgumentException... | [
"public",
"static",
"function",
"serialize",
"(",
"$",
"value",
")",
":",
"string",
"{",
"$",
"serialized",
"=",
"json_encode",
"(",
"self",
"::",
"encode",
"(",
"$",
"value",
",",
"new",
"SplObjectStorage",
"(",
")",
")",
",",
"JSON_UNESCAPED_UNICODE",
"|... | Serialize the given value into a JSON encoded string.
@param mixed $value The value to be serialized.
@return string The JSON encoded string. | [
"Serialize",
"the",
"given",
"value",
"into",
"a",
"JSON",
"encoded",
"string",
"."
] | train | https://github.com/vaniocz/stdlib/blob/06a8343c42829d8fdeecad2bb5c30946fbd73e74/src/UniversalJsonSerializer.php#L22-L34 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.