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 |
|---|---|---|---|---|---|---|---|---|---|---|
squareproton/Bond | src/Bond/Pg/Result.php | Result.getFetchOptions | public function getFetchOptions( &$humanReadable = null )
{
// aid to result fetching debugging
// get fetch options in a human readable format
if( func_num_args() ) {
$humanReadable = [];
$refl = new \ReflectionClass( __CLASS__ );
foreach( $refl->getConst... | php | public function getFetchOptions( &$humanReadable = null )
{
// aid to result fetching debugging
// get fetch options in a human readable format
if( func_num_args() ) {
$humanReadable = [];
$refl = new \ReflectionClass( __CLASS__ );
foreach( $refl->getConst... | [
"public",
"function",
"getFetchOptions",
"(",
"&",
"$",
"humanReadable",
"=",
"null",
")",
"{",
"// aid to result fetching debugging",
"// get fetch options in a human readable format",
"if",
"(",
"func_num_args",
"(",
")",
")",
"{",
"$",
"humanReadable",
"=",
"[",
"]... | Return the bitmask
@return | [
"Return",
"the",
"bitmask"
] | train | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Pg/Result.php#L255-L269 |
squareproton/Bond | src/Bond/Pg/Result.php | Result.fetch | public function fetch( $options = null, $keyResultsByColumn = null )
{
$this->setFetchOptions( $options );
// caching
if( $this->fetchOptions & self::CACHE ) {
// get a cache key for the passed options (we only care about those options that will modify the returned result)
... | php | public function fetch( $options = null, $keyResultsByColumn = null )
{
$this->setFetchOptions( $options );
// caching
if( $this->fetchOptions & self::CACHE ) {
// get a cache key for the passed options (we only care about those options that will modify the returned result)
... | [
"public",
"function",
"fetch",
"(",
"$",
"options",
"=",
"null",
",",
"$",
"keyResultsByColumn",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"setFetchOptions",
"(",
"$",
"options",
")",
";",
"// caching",
"if",
"(",
"$",
"this",
"->",
"fetchOptions",
"&",
... | Here be the magic!
@param int Bitmask of the options
@param mixed The column name we want our output to be keyed by
@return mixed | [
"Here",
"be",
"the",
"magic!"
] | train | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Pg/Result.php#L277-L344 |
squareproton/Bond | src/Bond/Pg/Result.php | Result.getFieldTypeCallbacks | public function getFieldTypeCallbacks()
{
$types = array();
$numFields = $this->numFields();
for( $i = 0; $i < $numFields; $i++ ) {
$types[pg_field_name( $this->resource, $i )] = TypeConversionFactory::get(
pg_field_type( $this->resource, $i ),
$t... | php | public function getFieldTypeCallbacks()
{
$types = array();
$numFields = $this->numFields();
for( $i = 0; $i < $numFields; $i++ ) {
$types[pg_field_name( $this->resource, $i )] = TypeConversionFactory::get(
pg_field_type( $this->resource, $i ),
$t... | [
"public",
"function",
"getFieldTypeCallbacks",
"(",
")",
"{",
"$",
"types",
"=",
"array",
"(",
")",
";",
"$",
"numFields",
"=",
"$",
"this",
"->",
"numFields",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"numFields",
"... | Return a array of php callbacks to be applied to a result set
@param array $types | [
"Return",
"a",
"array",
"of",
"php",
"callbacks",
"to",
"be",
"applied",
"to",
"a",
"result",
"set"
] | train | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Pg/Result.php#L350-L363 |
squareproton/Bond | src/Bond/Pg/Result.php | Result.numFields | public function numFields()
{
if( !isset( $this->numFields ) ) {
$this->numFields = pg_num_fields( $this->resource );
}
return $this->numFields;
} | php | public function numFields()
{
if( !isset( $this->numFields ) ) {
$this->numFields = pg_num_fields( $this->resource );
}
return $this->numFields;
} | [
"public",
"function",
"numFields",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"numFields",
")",
")",
"{",
"$",
"this",
"->",
"numFields",
"=",
"pg_num_fields",
"(",
"$",
"this",
"->",
"resource",
")",
";",
"}",
"return",
"$",
"... | Caching wrapper for pg_num_fields()
@return int | [
"Caching",
"wrapper",
"for",
"pg_num_fields",
"()"
] | train | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Pg/Result.php#L369-L375 |
squareproton/Bond | src/Bond/Pg/Result.php | Result.numRows | public function numRows()
{
if( !isset( $this->numRows ) ) {
$this->numRows = pg_num_rows( $this->resource );
}
return $this->numRows;
} | php | public function numRows()
{
if( !isset( $this->numRows ) ) {
$this->numRows = pg_num_rows( $this->resource );
}
return $this->numRows;
} | [
"public",
"function",
"numRows",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"numRows",
")",
")",
"{",
"$",
"this",
"->",
"numRows",
"=",
"pg_num_rows",
"(",
"$",
"this",
"->",
"resource",
")",
";",
"}",
"return",
"$",
"this",
... | Caching wrapper for pg_num_rows()
@return int | [
"Caching",
"wrapper",
"for",
"pg_num_rows",
"()"
] | train | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Pg/Result.php#L381-L387 |
squareproton/Bond | src/Bond/Pg/Result.php | Result.numAffectedRows | public function numAffectedRows()
{
if( !isset( $this->affectedRows ) ) {
$this->affectedRows = pg_affected_rows( $this->resource );
}
return $this->affectedRows;
} | php | public function numAffectedRows()
{
if( !isset( $this->affectedRows ) ) {
$this->affectedRows = pg_affected_rows( $this->resource );
}
return $this->affectedRows;
} | [
"public",
"function",
"numAffectedRows",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"affectedRows",
")",
")",
"{",
"$",
"this",
"->",
"affectedRows",
"=",
"pg_affected_rows",
"(",
"$",
"this",
"->",
"resource",
")",
";",
"}",
"retu... | Caching wrapper for pg_affected_rows()
This appears bugged in php 5.3 and postgres 9.1 returning the number of rows modified by a statement
@return int | [
"Caching",
"wrapper",
"for",
"pg_affected_rows",
"()",
"This",
"appears",
"bugged",
"in",
"php",
"5",
".",
"3",
"and",
"postgres",
"9",
".",
"1",
"returning",
"the",
"number",
"of",
"rows",
"modified",
"by",
"a",
"statement"
] | train | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Pg/Result.php#L403-L409 |
squareproton/Bond | src/Bond/Pg/Result.php | Result.current | public function current()
{
return call_user_func(
$this->fetchCallback,
pg_fetch_array( $this->resource, $this->fetchRowNumber, $this->fetchType )
);
} | php | public function current()
{
return call_user_func(
$this->fetchCallback,
pg_fetch_array( $this->resource, $this->fetchRowNumber, $this->fetchType )
);
} | [
"public",
"function",
"current",
"(",
")",
"{",
"return",
"call_user_func",
"(",
"$",
"this",
"->",
"fetchCallback",
",",
"pg_fetch_array",
"(",
"$",
"this",
"->",
"resource",
",",
"$",
"this",
"->",
"fetchRowNumber",
",",
"$",
"this",
"->",
"fetchType",
"... | Return the current element | [
"Return",
"the",
"current",
"element"
] | train | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Pg/Result.php#L426-L432 |
squareproton/Bond | src/Bond/Pg/Result.php | Result.offsetGet | public function offsetGet( $index )
{
return call_user_func(
$this->fetchCallback,
pg_fetch_array( $this->resource, $index, $this->fetchType )
);
} | php | public function offsetGet( $index )
{
return call_user_func(
$this->fetchCallback,
pg_fetch_array( $this->resource, $index, $this->fetchType )
);
} | [
"public",
"function",
"offsetGet",
"(",
"$",
"index",
")",
"{",
"return",
"call_user_func",
"(",
"$",
"this",
"->",
"fetchCallback",
",",
"pg_fetch_array",
"(",
"$",
"this",
"->",
"resource",
",",
"$",
"index",
",",
"$",
"this",
"->",
"fetchType",
")",
"... | Returns the value at the specified index. | [
"Returns",
"the",
"value",
"at",
"the",
"specified",
"index",
"."
] | train | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Pg/Result.php#L487-L493 |
swiftphp/config | src/internal/ObjectFactory.php | ObjectFactory.create | public function create($objectId)
{
//对象配置信息
$objInfo=$this->getObjInfo($objectId);
if($objInfo==null){
throw new \Exception("Call to undefined object '".$objectId."'");
}
//如果单例模式且对象已经存在,直接返回
if($objInfo->singleton && array_key_exists($objectId,... | php | public function create($objectId)
{
//对象配置信息
$objInfo=$this->getObjInfo($objectId);
if($objInfo==null){
throw new \Exception("Call to undefined object '".$objectId."'");
}
//如果单例模式且对象已经存在,直接返回
if($objInfo->singleton && array_key_exists($objectId,... | [
"public",
"function",
"create",
"(",
"$",
"objectId",
")",
"{",
"//对象配置信息\r",
"$",
"objInfo",
"=",
"$",
"this",
"->",
"getObjInfo",
"(",
"$",
"objectId",
")",
";",
"if",
"(",
"$",
"objInfo",
"==",
"null",
")",
"{",
"throw",
"new",
"\\",
"Exception",
... | 根据对象ID创建实例
@param string $objectId 对象ID | [
"根据对象ID创建实例"
] | train | https://github.com/swiftphp/config/blob/c93e1a45d0aa9fdcb7d583f3eadfc60785c039df/src/internal/ObjectFactory.php#L98-L139 |
swiftphp/config | src/internal/ObjectFactory.php | ObjectFactory.createByClass | public function createByClass($class,$constructorArgs=[],$singleton=true)
{
//使用类型名代替ID创建对象,异常代表类型未配置,无需抛出
try{
$obj=$this->create($class);
return $obj;
}catch (\Exception $ex){}
//单例模式下,尝试从缓存获取
if($singleton && array_key_exists($class, $this... | php | public function createByClass($class,$constructorArgs=[],$singleton=true)
{
//使用类型名代替ID创建对象,异常代表类型未配置,无需抛出
try{
$obj=$this->create($class);
return $obj;
}catch (\Exception $ex){}
//单例模式下,尝试从缓存获取
if($singleton && array_key_exists($class, $this... | [
"public",
"function",
"createByClass",
"(",
"$",
"class",
",",
"$",
"constructorArgs",
"=",
"[",
"]",
",",
"$",
"singleton",
"=",
"true",
")",
"{",
"//使用类型名代替ID创建对象,异常代表类型未配置,无需抛出\r",
"try",
"{",
"$",
"obj",
"=",
"$",
"this",
"->",
"create",
"(",
"$",
"c... | 根据类型名创建实例
@param string $class 类型名称
@param array $constructorArgs 构造参数(对于已配置的类型,该参数忽略)
@param bool $singleton 是否单例模式,默认为单例模式(对于已配置的类型,该参数忽略) | [
"根据类型名创建实例"
] | train | https://github.com/swiftphp/config/blob/c93e1a45d0aa9fdcb7d583f3eadfc60785c039df/src/internal/ObjectFactory.php#L147-L186 |
swiftphp/config | src/internal/ObjectFactory.php | ObjectFactory.newInstance | public function newInstance($forClass,$constructorArgs=[])
{
$class = new \ReflectionClass($forClass);
$constructor = $class->getConstructor();
//无构造函数
if($constructor==null){
return new $forClass();
}
//有构造函数
$parameters=$constructor-... | php | public function newInstance($forClass,$constructorArgs=[])
{
$class = new \ReflectionClass($forClass);
$constructor = $class->getConstructor();
//无构造函数
if($constructor==null){
return new $forClass();
}
//有构造函数
$parameters=$constructor-... | [
"public",
"function",
"newInstance",
"(",
"$",
"forClass",
",",
"$",
"constructorArgs",
"=",
"[",
"]",
")",
"{",
"$",
"class",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"forClass",
")",
";",
"$",
"constructor",
"=",
"$",
"class",
"->",
"getConstruct... | 创建对象实例
@param string $forClass 类名
@param array $constructorArgs 构造参数
@return object
@throws \Exception | [
"创建对象实例"
] | train | https://github.com/swiftphp/config/blob/c93e1a45d0aa9fdcb7d583f3eadfc60785c039df/src/internal/ObjectFactory.php#L195-L233 |
swiftphp/config | src/internal/ObjectFactory.php | ObjectFactory.getObjInfo | private function getObjInfo($objectId)
{
//映射不存在 ,则先创建
if(empty($this->m_objectInfoMap)){
$configData=$this->m_config->getConfigValues($this->m_configSection);
$this->m_objectInfoMap=$this->loadObjMap($configData);
}
//对象信息
if(array_key_exist... | php | private function getObjInfo($objectId)
{
//映射不存在 ,则先创建
if(empty($this->m_objectInfoMap)){
$configData=$this->m_config->getConfigValues($this->m_configSection);
$this->m_objectInfoMap=$this->loadObjMap($configData);
}
//对象信息
if(array_key_exist... | [
"private",
"function",
"getObjInfo",
"(",
"$",
"objectId",
")",
"{",
"//映射不存在 ,则先创建\r",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"m_objectInfoMap",
")",
")",
"{",
"$",
"configData",
"=",
"$",
"this",
"->",
"m_config",
"->",
"getConfigValues",
"(",
"$",
... | 根据ID获取对象消息
@param string $objectId 对象ID
@return ObjectInfo | [
"根据ID获取对象消息"
] | train | https://github.com/swiftphp/config/blob/c93e1a45d0aa9fdcb7d583f3eadfc60785c039df/src/internal/ObjectFactory.php#L240-L253 |
swiftphp/config | src/internal/ObjectFactory.php | ObjectFactory.loadObjMap | private function loadObjMap(array $configData)
{
$infos=[];
foreach ($configData as $cfg){
if(array_key_exists(self::OBJECT_CONFIG_KEY_CLASS, $cfg)){
$info=new ObjectInfo();
$info->class=$cfg[self::OBJECT_CONFIG_KEY_CLASS];
$info->id... | php | private function loadObjMap(array $configData)
{
$infos=[];
foreach ($configData as $cfg){
if(array_key_exists(self::OBJECT_CONFIG_KEY_CLASS, $cfg)){
$info=new ObjectInfo();
$info->class=$cfg[self::OBJECT_CONFIG_KEY_CLASS];
$info->id... | [
"private",
"function",
"loadObjMap",
"(",
"array",
"$",
"configData",
")",
"{",
"$",
"infos",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"configData",
"as",
"$",
"cfg",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"self",
"::",
"OBJECT_CONFIG_KEY_CLASS",
... | 加载对象信息
@param array $configData | [
"加载对象信息"
] | train | https://github.com/swiftphp/config/blob/c93e1a45d0aa9fdcb7d583f3eadfc60785c039df/src/internal/ObjectFactory.php#L259-L301 |
swiftphp/config | src/internal/ObjectFactory.php | ObjectFactory.setProperty | private function setProperty($obj,$name,$valueInfo)
{
//setter不存在,直接返回
$setter = "set" . ucfirst($name);
if (!method_exists($obj, $setter)) {
return;
}
$obj->$setter($this->getPropertyValue($valueInfo));
} | php | private function setProperty($obj,$name,$valueInfo)
{
//setter不存在,直接返回
$setter = "set" . ucfirst($name);
if (!method_exists($obj, $setter)) {
return;
}
$obj->$setter($this->getPropertyValue($valueInfo));
} | [
"private",
"function",
"setProperty",
"(",
"$",
"obj",
",",
"$",
"name",
",",
"$",
"valueInfo",
")",
"{",
"//setter不存在,直接返回\r",
"$",
"setter",
"=",
"\"set\"",
".",
"ucfirst",
"(",
"$",
"name",
")",
";",
"if",
"(",
"!",
"method_exists",
"(",
"$",
"obj",... | 设置对象属性
@param object $obj 对象
@param string $name 属性名
@param mixed $valueInfo 属性值描述
@param bool $singleton 是否为单态模式调用 | [
"设置对象属性"
] | train | https://github.com/swiftphp/config/blob/c93e1a45d0aa9fdcb7d583f3eadfc60785c039df/src/internal/ObjectFactory.php#L310-L318 |
swiftphp/config | src/internal/ObjectFactory.php | ObjectFactory.getPropertyValue | private function getPropertyValue($valueInfo)
{
//属性值类型
$value=$valueInfo;
//如果值为数组,则递归创建元素值
if(is_array($value)){
$values=[];
foreach ($value as $k => $v){
$key=$this->replacePlaceHolder($k);
$values[$key]=$this->get... | php | private function getPropertyValue($valueInfo)
{
//属性值类型
$value=$valueInfo;
//如果值为数组,则递归创建元素值
if(is_array($value)){
$values=[];
foreach ($value as $k => $v){
$key=$this->replacePlaceHolder($k);
$values[$key]=$this->get... | [
"private",
"function",
"getPropertyValue",
"(",
"$",
"valueInfo",
")",
"{",
"//属性值类型\r",
"$",
"value",
"=",
"$",
"valueInfo",
";",
"//如果值为数组,则递归创建元素值\r",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"$",
"values",
"=",
"[",
"]",
";",
"foreach... | 根据属性值描述创建属性
@param mixed $valueInfo 属性值描述 | [
"根据属性值描述创建属性"
] | train | https://github.com/swiftphp/config/blob/c93e1a45d0aa9fdcb7d583f3eadfc60785c039df/src/internal/ObjectFactory.php#L324-L352 |
swiftphp/config | src/internal/ObjectFactory.php | ObjectFactory.replacePlaceHolder | private function replacePlaceHolder($value)
{
$value=str_replace(self::OBJECT_CONFIG_BASE_DIR_PLACE_HOLDER, $this->m_config->getBaseDir(), $value);
$value=str_replace(self::OBJECT_CONFIG_USER_DIR_PLACE_HOLDER, $this->m_config->getUserDir(), $value);
$value=str_replace(self::OBJECT_CONFIG... | php | private function replacePlaceHolder($value)
{
$value=str_replace(self::OBJECT_CONFIG_BASE_DIR_PLACE_HOLDER, $this->m_config->getBaseDir(), $value);
$value=str_replace(self::OBJECT_CONFIG_USER_DIR_PLACE_HOLDER, $this->m_config->getUserDir(), $value);
$value=str_replace(self::OBJECT_CONFIG... | [
"private",
"function",
"replacePlaceHolder",
"(",
"$",
"value",
")",
"{",
"$",
"value",
"=",
"str_replace",
"(",
"self",
"::",
"OBJECT_CONFIG_BASE_DIR_PLACE_HOLDER",
",",
"$",
"this",
"->",
"m_config",
"->",
"getBaseDir",
"(",
")",
",",
"$",
"value",
")",
";... | 替换占位符
@param string $value | [
"替换占位符"
] | train | https://github.com/swiftphp/config/blob/c93e1a45d0aa9fdcb7d583f3eadfc60785c039df/src/internal/ObjectFactory.php#L358-L364 |
linpax/microphp-framework | src/cli/CliResolver.php | CliResolver.getOption | public function getOption($char = '', $name = '', $required = null)
{
if (!$char && !$name) {
return false;
}
if ($char && (1 < strlen($char) || 1 !== preg_match('/^\w$/', $char))) {
return false;
}
if ($name && (1 !== preg_match('/^\w+$/', $name))) {
... | php | public function getOption($char = '', $name = '', $required = null)
{
if (!$char && !$name) {
return false;
}
if ($char && (1 < strlen($char) || 1 !== preg_match('/^\w$/', $char))) {
return false;
}
if ($name && (1 !== preg_match('/^\w+$/', $name))) {
... | [
"public",
"function",
"getOption",
"(",
"$",
"char",
"=",
"''",
",",
"$",
"name",
"=",
"''",
",",
"$",
"required",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"char",
"&&",
"!",
"$",
"name",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"... | Get arguments from command line
@access public
@param string $char -a .. -z option char
@param string $name --optionName_string
@param bool|null $required Required value?
@return mixed | [
"Get",
"arguments",
"from",
"command",
"line"
] | train | https://github.com/linpax/microphp-framework/blob/11f3370f3f64c516cce9b84ecd8276c6e9ae8df9/src/cli/CliResolver.php#L58-L81 |
webignition/css-validator-output-parser | src/OutputParser.php | OutputParser.parse | public function parse(string $validatorOutput, int $flags = Flags::NONE): OutputInterface
{
$sanitizer = new Sanitizer();
$validatorOutput = trim($sanitizer->getSanitizedOutput($validatorOutput));
$headerBodyParts = explode("\n", $validatorOutput, 2);
$header = trim($headerBodyParts... | php | public function parse(string $validatorOutput, int $flags = Flags::NONE): OutputInterface
{
$sanitizer = new Sanitizer();
$validatorOutput = trim($sanitizer->getSanitizedOutput($validatorOutput));
$headerBodyParts = explode("\n", $validatorOutput, 2);
$header = trim($headerBodyParts... | [
"public",
"function",
"parse",
"(",
"string",
"$",
"validatorOutput",
",",
"int",
"$",
"flags",
"=",
"Flags",
"::",
"NONE",
")",
":",
"OutputInterface",
"{",
"$",
"sanitizer",
"=",
"new",
"Sanitizer",
"(",
")",
";",
"$",
"validatorOutput",
"=",
"trim",
"... | @param string $validatorOutput
@param int $flags
@return OutputInterface
@throws InvalidValidatorOutputException | [
"@param",
"string",
"$validatorOutput",
"@param",
"int",
"$flags"
] | train | https://github.com/webignition/css-validator-output-parser/blob/66cb21ca1c340ed017fe3bf29d1d99f0a1992acd/src/OutputParser.php#L20-L65 |
stubbles/stubbles-streams | src/main/php/filter/FilteredOutputStream.php | FilteredOutputStream.write | public function write(string $bytes): int
{
$isAcceptable = $this->predicate;
if ($isAcceptable($bytes)) {
return $this->outputStream->write($bytes);
}
return 0;
} | php | public function write(string $bytes): int
{
$isAcceptable = $this->predicate;
if ($isAcceptable($bytes)) {
return $this->outputStream->write($bytes);
}
return 0;
} | [
"public",
"function",
"write",
"(",
"string",
"$",
"bytes",
")",
":",
"int",
"{",
"$",
"isAcceptable",
"=",
"$",
"this",
"->",
"predicate",
";",
"if",
"(",
"$",
"isAcceptable",
"(",
"$",
"bytes",
")",
")",
"{",
"return",
"$",
"this",
"->",
"outputStr... | writes given bytes
@param string $bytes
@return int amount of written bytes | [
"writes",
"given",
"bytes"
] | train | https://github.com/stubbles/stubbles-streams/blob/99b0dace5fcf71584d1456b4b5408017b896bdf5/src/main/php/filter/FilteredOutputStream.php#L46-L54 |
stubbles/stubbles-streams | src/main/php/filter/FilteredOutputStream.php | FilteredOutputStream.writeLine | public function writeLine(string $bytes): int
{
$isAcceptable = $this->predicate;
if ($isAcceptable($bytes)) {
return $this->outputStream->writeLine($bytes);
}
return 0;
} | php | public function writeLine(string $bytes): int
{
$isAcceptable = $this->predicate;
if ($isAcceptable($bytes)) {
return $this->outputStream->writeLine($bytes);
}
return 0;
} | [
"public",
"function",
"writeLine",
"(",
"string",
"$",
"bytes",
")",
":",
"int",
"{",
"$",
"isAcceptable",
"=",
"$",
"this",
"->",
"predicate",
";",
"if",
"(",
"$",
"isAcceptable",
"(",
"$",
"bytes",
")",
")",
"{",
"return",
"$",
"this",
"->",
"outpu... | writes given bytes and appends a line break
@param string $bytes
@return int amount of written bytes | [
"writes",
"given",
"bytes",
"and",
"appends",
"a",
"line",
"break"
] | train | https://github.com/stubbles/stubbles-streams/blob/99b0dace5fcf71584d1456b4b5408017b896bdf5/src/main/php/filter/FilteredOutputStream.php#L62-L70 |
stubbles/stubbles-streams | src/main/php/filter/FilteredOutputStream.php | FilteredOutputStream.writeLines | public function writeLines(array $bytes): int
{
$bytesWritten = 0;
foreach ($bytes as $line) {
$bytesWritten += $this->writeLine($line);
}
return $bytesWritten;
} | php | public function writeLines(array $bytes): int
{
$bytesWritten = 0;
foreach ($bytes as $line) {
$bytesWritten += $this->writeLine($line);
}
return $bytesWritten;
} | [
"public",
"function",
"writeLines",
"(",
"array",
"$",
"bytes",
")",
":",
"int",
"{",
"$",
"bytesWritten",
"=",
"0",
";",
"foreach",
"(",
"$",
"bytes",
"as",
"$",
"line",
")",
"{",
"$",
"bytesWritten",
"+=",
"$",
"this",
"->",
"writeLine",
"(",
"$",
... | writes given bytes and appends a line break after each one
@param string[] $bytes
@return int amount of written bytes
@since 3.2.0 | [
"writes",
"given",
"bytes",
"and",
"appends",
"a",
"line",
"break",
"after",
"each",
"one"
] | train | https://github.com/stubbles/stubbles-streams/blob/99b0dace5fcf71584d1456b4b5408017b896bdf5/src/main/php/filter/FilteredOutputStream.php#L79-L87 |
Eden-PHP/Block | Field/Wysiwyg.php | Wysiwyg.getVariables | public function getVariables()
{
if(isset($this->attributes['class'])) {
$this->attributes['class'] = trim($this
->attributes['class'].' eden-field-wysiwyg form-control');
} else {
$this->attributes['class'] = 'eden-field-wysiwyg form-control';
}
$loaded = self::$loaded;
self::$loaded = true;
... | php | public function getVariables()
{
if(isset($this->attributes['class'])) {
$this->attributes['class'] = trim($this
->attributes['class'].' eden-field-wysiwyg form-control');
} else {
$this->attributes['class'] = 'eden-field-wysiwyg form-control';
}
$loaded = self::$loaded;
self::$loaded = true;
... | [
"public",
"function",
"getVariables",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"attributes",
"[",
"'class'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"attributes",
"[",
"'class'",
"]",
"=",
"trim",
"(",
"$",
"this",
"->",
"attributes"... | Returns the template variables in key value format
@param array data
@return array | [
"Returns",
"the",
"template",
"variables",
"in",
"key",
"value",
"format"
] | train | https://github.com/Eden-PHP/Block/blob/681b9f01dd118612d0fced84d2f702167b52109b/Field/Wysiwyg.php#L32-L49 |
Eden-PHP/Block | Field/Wysiwyg.php | Wysiwyg.setOptions | public function setOptions($option, $value = null)
{
Argument::i()
->test(1, 'array', 'string')
->test(2, 'scalar', 'null');
if(is_array($option)) {
$this->options = $option;
return $this;
}
$this->options[$option] = $value;
return $this;
} | php | public function setOptions($option, $value = null)
{
Argument::i()
->test(1, 'array', 'string')
->test(2, 'scalar', 'null');
if(is_array($option)) {
$this->options = $option;
return $this;
}
$this->options[$option] = $value;
return $this;
} | [
"public",
"function",
"setOptions",
"(",
"$",
"option",
",",
"$",
"value",
"=",
"null",
")",
"{",
"Argument",
"::",
"i",
"(",
")",
"->",
"test",
"(",
"1",
",",
"'array'",
",",
"'string'",
")",
"->",
"test",
"(",
"2",
",",
"'scalar'",
",",
"'null'",... | Set Options
@param string|array
@param scalar
@return this | [
"Set",
"Options"
] | train | https://github.com/Eden-PHP/Block/blob/681b9f01dd118612d0fced84d2f702167b52109b/Field/Wysiwyg.php#L69-L82 |
swiftphp/http | src/FilterChain.php | FilterChain.filter | public function filter(Context $context)
{
$this->index++;
if(empty($this->m_filters) || $this->index >= count($this->m_filters))
return;
$filter=$this->m_filters[$this->index];
return $filter->filter($context,$this);
} | php | public function filter(Context $context)
{
$this->index++;
if(empty($this->m_filters) || $this->index >= count($this->m_filters))
return;
$filter=$this->m_filters[$this->index];
return $filter->filter($context,$this);
} | [
"public",
"function",
"filter",
"(",
"Context",
"$",
"context",
")",
"{",
"$",
"this",
"->",
"index",
"++",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"m_filters",
")",
"||",
"$",
"this",
"->",
"index",
">=",
"count",
"(",
"$",
"this",
"->",
... | 执行过滤
@param Context $context | [
"执行过滤"
] | train | https://github.com/swiftphp/http/blob/8be9dc5b8bfad4736f6b086a1954e28637a46eb2/src/FilterChain.php#L45-L52 |
wobblecode/WobbleCodeUserBundle | Document/Organization.php | Organization.getContactName | public function getContactName()
{
$contactName = $this->getContact()->getName();
if (!$contactName) {
$contactName = $this->getOwner()->getContactName();
}
return $contactName;
} | php | public function getContactName()
{
$contactName = $this->getContact()->getName();
if (!$contactName) {
$contactName = $this->getOwner()->getContactName();
}
return $contactName;
} | [
"public",
"function",
"getContactName",
"(",
")",
"{",
"$",
"contactName",
"=",
"$",
"this",
"->",
"getContact",
"(",
")",
"->",
"getName",
"(",
")",
";",
"if",
"(",
"!",
"$",
"contactName",
")",
"{",
"$",
"contactName",
"=",
"$",
"this",
"->",
"getO... | Get contact Name
@Serializer\VirtualProperty
@Serializer\Type("string")
@Serializer\SerializedName("contact_name")
@Serializer\Groups({"ui", "ui-admin", "api"})
@return string | [
"Get",
"contact",
"Name"
] | train | https://github.com/wobblecode/WobbleCodeUserBundle/blob/7b8206f8b4a50fbc61f7bfe4f83eb466cad96440/Document/Organization.php#L224-L233 |
wobblecode/WobbleCodeUserBundle | Document/Organization.php | Organization.setCreatedBy | public function setCreatedBy(\WobbleCode\UserBundle\Document\User $createdBy)
{
$this->createdBy = $createdBy;
return $this;
} | php | public function setCreatedBy(\WobbleCode\UserBundle\Document\User $createdBy)
{
$this->createdBy = $createdBy;
return $this;
} | [
"public",
"function",
"setCreatedBy",
"(",
"\\",
"WobbleCode",
"\\",
"UserBundle",
"\\",
"Document",
"\\",
"User",
"$",
"createdBy",
")",
"{",
"$",
"this",
"->",
"createdBy",
"=",
"$",
"createdBy",
";",
"return",
"$",
"this",
";",
"}"
] | Set createdBy
@param WobbleCode\UserBundle\Document\User $createdBy
@return self | [
"Set",
"createdBy"
] | train | https://github.com/wobblecode/WobbleCodeUserBundle/blob/7b8206f8b4a50fbc61f7bfe4f83eb466cad96440/Document/Organization.php#L427-L431 |
wobblecode/WobbleCodeUserBundle | Document/Organization.php | Organization.setOwner | public function setOwner(\WobbleCode\UserBundle\Document\User $owner)
{
$this->owner = $owner;
return $this;
} | php | public function setOwner(\WobbleCode\UserBundle\Document\User $owner)
{
$this->owner = $owner;
return $this;
} | [
"public",
"function",
"setOwner",
"(",
"\\",
"WobbleCode",
"\\",
"UserBundle",
"\\",
"Document",
"\\",
"User",
"$",
"owner",
")",
"{",
"$",
"this",
"->",
"owner",
"=",
"$",
"owner",
";",
"return",
"$",
"this",
";",
"}"
] | Set owner
@param WobbleCode\UserBundle\Document\User $owner
@return self | [
"Set",
"owner"
] | train | https://github.com/wobblecode/WobbleCodeUserBundle/blob/7b8206f8b4a50fbc61f7bfe4f83eb466cad96440/Document/Organization.php#L493-L497 |
wobblecode/WobbleCodeUserBundle | Document/Organization.php | Organization.setInvitations | public function setInvitations(\WobbleCode\UserBundle\Document\Invitation $invitations)
{
$this->invitations = $invitations;
return $this;
} | php | public function setInvitations(\WobbleCode\UserBundle\Document\Invitation $invitations)
{
$this->invitations = $invitations;
return $this;
} | [
"public",
"function",
"setInvitations",
"(",
"\\",
"WobbleCode",
"\\",
"UserBundle",
"\\",
"Document",
"\\",
"Invitation",
"$",
"invitations",
")",
"{",
"$",
"this",
"->",
"invitations",
"=",
"$",
"invitations",
";",
"return",
"$",
"this",
";",
"}"
] | Set invitations
@param WobbleCode\UserBundle\Document\Invitation $invitations
@return self | [
"Set",
"invitations"
] | train | https://github.com/wobblecode/WobbleCodeUserBundle/blob/7b8206f8b4a50fbc61f7bfe4f83eb466cad96440/Document/Organization.php#L515-L519 |
wobblecode/WobbleCodeUserBundle | Document/Organization.php | Organization.setRoles | public function setRoles(\WobbleCode\UserBundle\Document\Role $roles)
{
$this->roles = $roles;
return $this;
} | php | public function setRoles(\WobbleCode\UserBundle\Document\Role $roles)
{
$this->roles = $roles;
return $this;
} | [
"public",
"function",
"setRoles",
"(",
"\\",
"WobbleCode",
"\\",
"UserBundle",
"\\",
"Document",
"\\",
"Role",
"$",
"roles",
")",
"{",
"$",
"this",
"->",
"roles",
"=",
"$",
"roles",
";",
"return",
"$",
"this",
";",
"}"
] | Set roles
@param WobbleCode\UserBundle\Document\Role $roles
@return self | [
"Set",
"roles"
] | train | https://github.com/wobblecode/WobbleCodeUserBundle/blob/7b8206f8b4a50fbc61f7bfe4f83eb466cad96440/Document/Organization.php#L537-L542 |
wobblecode/WobbleCodeUserBundle | Document/Organization.php | Organization.setContact | public function setContact(\WobbleCode\UserBundle\Document\Contact $contact)
{
$this->contact = $contact;
return $this;
} | php | public function setContact(\WobbleCode\UserBundle\Document\Contact $contact)
{
$this->contact = $contact;
return $this;
} | [
"public",
"function",
"setContact",
"(",
"\\",
"WobbleCode",
"\\",
"UserBundle",
"\\",
"Document",
"\\",
"Contact",
"$",
"contact",
")",
"{",
"$",
"this",
"->",
"contact",
"=",
"$",
"contact",
";",
"return",
"$",
"this",
";",
"}"
] | Set contact
@param WobbleCode\UserBundle\Document\Contact $contact
@return self | [
"Set",
"contact"
] | train | https://github.com/wobblecode/WobbleCodeUserBundle/blob/7b8206f8b4a50fbc61f7bfe4f83eb466cad96440/Document/Organization.php#L560-L565 |
wobblecode/WobbleCodeUserBundle | Document/Organization.php | Organization.setPaymentProfiles | public function setPaymentProfiles(\WobbleCode\BillingBundle\Document\PaymentProfile $paymentProfiles)
{
$this->paymentProfiles = $paymentProfiles;
return $this;
} | php | public function setPaymentProfiles(\WobbleCode\BillingBundle\Document\PaymentProfile $paymentProfiles)
{
$this->paymentProfiles = $paymentProfiles;
return $this;
} | [
"public",
"function",
"setPaymentProfiles",
"(",
"\\",
"WobbleCode",
"\\",
"BillingBundle",
"\\",
"Document",
"\\",
"PaymentProfile",
"$",
"paymentProfiles",
")",
"{",
"$",
"this",
"->",
"paymentProfiles",
"=",
"$",
"paymentProfiles",
";",
"return",
"$",
"this",
... | Set paymentProfiles
@param WobbleCode\BillingBundle\Document\PaymentProfile $paymentProfiles
@return self | [
"Set",
"paymentProfiles"
] | train | https://github.com/wobblecode/WobbleCodeUserBundle/blob/7b8206f8b4a50fbc61f7bfe4f83eb466cad96440/Document/Organization.php#L583-L587 |
wobblecode/WobbleCodeUserBundle | Document/Organization.php | Organization.setInvoiceProfile | public function setInvoiceProfile(\WobbleCode\BillingBundle\Document\InvoiceProfile $invoiceProfile)
{
$this->invoiceProfile = $invoiceProfile;
return $this;
} | php | public function setInvoiceProfile(\WobbleCode\BillingBundle\Document\InvoiceProfile $invoiceProfile)
{
$this->invoiceProfile = $invoiceProfile;
return $this;
} | [
"public",
"function",
"setInvoiceProfile",
"(",
"\\",
"WobbleCode",
"\\",
"BillingBundle",
"\\",
"Document",
"\\",
"InvoiceProfile",
"$",
"invoiceProfile",
")",
"{",
"$",
"this",
"->",
"invoiceProfile",
"=",
"$",
"invoiceProfile",
";",
"return",
"$",
"this",
";"... | Set invoiceProfile
@param WobbleCode\BillingBundle\Document\InvoiceProfile $invoiceProfile
@return self | [
"Set",
"invoiceProfile"
] | train | https://github.com/wobblecode/WobbleCodeUserBundle/blob/7b8206f8b4a50fbc61f7bfe4f83eb466cad96440/Document/Organization.php#L605-L609 |
wobblecode/WobbleCodeUserBundle | Document/Organization.php | Organization.setActiveUsers | public function setActiveUsers(\WobbleCode\UserBundle\Document\User $activeUsers)
{
$this->activeUsers = $activeUsers;
return $this;
} | php | public function setActiveUsers(\WobbleCode\UserBundle\Document\User $activeUsers)
{
$this->activeUsers = $activeUsers;
return $this;
} | [
"public",
"function",
"setActiveUsers",
"(",
"\\",
"WobbleCode",
"\\",
"UserBundle",
"\\",
"Document",
"\\",
"User",
"$",
"activeUsers",
")",
"{",
"$",
"this",
"->",
"activeUsers",
"=",
"$",
"activeUsers",
";",
"return",
"$",
"this",
";",
"}"
] | Set activeUsers
@param WobbleCode\UserBundle\Document\User $activeUsers
@return self | [
"Set",
"activeUsers"
] | train | https://github.com/wobblecode/WobbleCodeUserBundle/blob/7b8206f8b4a50fbc61f7bfe4f83eb466cad96440/Document/Organization.php#L627-L631 |
wobblecode/WobbleCodeUserBundle | Document/Organization.php | Organization.removeUser | public function removeUser(\WobbleCode\UserBundle\Document\User $user)
{
$this->users->removeElement($user);
} | php | public function removeUser(\WobbleCode\UserBundle\Document\User $user)
{
$this->users->removeElement($user);
} | [
"public",
"function",
"removeUser",
"(",
"\\",
"WobbleCode",
"\\",
"UserBundle",
"\\",
"Document",
"\\",
"User",
"$",
"user",
")",
"{",
"$",
"this",
"->",
"users",
"->",
"removeElement",
"(",
"$",
"user",
")",
";",
"}"
] | Remove user
@param WobbleCode\UserBundle\Document\User $user | [
"Remove",
"user"
] | train | https://github.com/wobblecode/WobbleCodeUserBundle/blob/7b8206f8b4a50fbc61f7bfe4f83eb466cad96440/Document/Organization.php#L658-L661 |
wobblecode/WobbleCodeUserBundle | Document/Organization.php | Organization.removeInvitation | public function removeInvitation(\WobbleCode\UserBundle\Document\Invitation $invitation)
{
$this->invitations->removeElement($invitation);
} | php | public function removeInvitation(\WobbleCode\UserBundle\Document\Invitation $invitation)
{
$this->invitations->removeElement($invitation);
} | [
"public",
"function",
"removeInvitation",
"(",
"\\",
"WobbleCode",
"\\",
"UserBundle",
"\\",
"Document",
"\\",
"Invitation",
"$",
"invitation",
")",
"{",
"$",
"this",
"->",
"invitations",
"->",
"removeElement",
"(",
"$",
"invitation",
")",
";",
"}"
] | Remove invitation
@param WobbleCode\UserBundle\Document\Invitation $invitation | [
"Remove",
"invitation"
] | train | https://github.com/wobblecode/WobbleCodeUserBundle/blob/7b8206f8b4a50fbc61f7bfe4f83eb466cad96440/Document/Organization.php#L688-L691 |
wobblecode/WobbleCodeUserBundle | Document/Organization.php | Organization.removeRole | public function removeRole(\WobbleCode\UserBundle\Document\Role $role)
{
$this->roles->removeElement($role);
} | php | public function removeRole(\WobbleCode\UserBundle\Document\Role $role)
{
$this->roles->removeElement($role);
} | [
"public",
"function",
"removeRole",
"(",
"\\",
"WobbleCode",
"\\",
"UserBundle",
"\\",
"Document",
"\\",
"Role",
"$",
"role",
")",
"{",
"$",
"this",
"->",
"roles",
"->",
"removeElement",
"(",
"$",
"role",
")",
";",
"}"
] | Remove role
@param WobbleCode\UserBundle\Document\Role $role | [
"Remove",
"role"
] | train | https://github.com/wobblecode/WobbleCodeUserBundle/blob/7b8206f8b4a50fbc61f7bfe4f83eb466cad96440/Document/Organization.php#L708-L711 |
wobblecode/WobbleCodeUserBundle | Document/Organization.php | Organization.removePaymentProfile | public function removePaymentProfile(\WobbleCode\BillingBundle\Document\PaymentProfile $paymentProfile)
{
$this->paymentProfiles->removeElement($paymentProfile);
} | php | public function removePaymentProfile(\WobbleCode\BillingBundle\Document\PaymentProfile $paymentProfile)
{
$this->paymentProfiles->removeElement($paymentProfile);
} | [
"public",
"function",
"removePaymentProfile",
"(",
"\\",
"WobbleCode",
"\\",
"BillingBundle",
"\\",
"Document",
"\\",
"PaymentProfile",
"$",
"paymentProfile",
")",
"{",
"$",
"this",
"->",
"paymentProfiles",
"->",
"removeElement",
"(",
"$",
"paymentProfile",
")",
"... | Remove paymentProfile
@param WobbleCode\BillingBundle\Document\PaymentProfile $paymentProfile | [
"Remove",
"paymentProfile"
] | train | https://github.com/wobblecode/WobbleCodeUserBundle/blob/7b8206f8b4a50fbc61f7bfe4f83eb466cad96440/Document/Organization.php#L728-L731 |
wobblecode/WobbleCodeUserBundle | Document/Organization.php | Organization.removeInvoiceProfile | public function removeInvoiceProfile(\WobbleCode\BillingBundle\Document\InvoiceProfile $invoiceProfile)
{
$this->invoiceProfile->removeElement($invoiceProfile);
} | php | public function removeInvoiceProfile(\WobbleCode\BillingBundle\Document\InvoiceProfile $invoiceProfile)
{
$this->invoiceProfile->removeElement($invoiceProfile);
} | [
"public",
"function",
"removeInvoiceProfile",
"(",
"\\",
"WobbleCode",
"\\",
"BillingBundle",
"\\",
"Document",
"\\",
"InvoiceProfile",
"$",
"invoiceProfile",
")",
"{",
"$",
"this",
"->",
"invoiceProfile",
"->",
"removeElement",
"(",
"$",
"invoiceProfile",
")",
";... | Remove invoiceProfile
@param WobbleCode\BillingBundle\Document\InvoiceProfile $invoiceProfile | [
"Remove",
"invoiceProfile"
] | train | https://github.com/wobblecode/WobbleCodeUserBundle/blob/7b8206f8b4a50fbc61f7bfe4f83eb466cad96440/Document/Organization.php#L748-L751 |
wobblecode/WobbleCodeUserBundle | Document/Organization.php | Organization.removeActiveUser | public function removeActiveUser(\WobbleCode\UserBundle\Document\User $activeUser)
{
$this->activeUsers->removeElement($activeUser);
} | php | public function removeActiveUser(\WobbleCode\UserBundle\Document\User $activeUser)
{
$this->activeUsers->removeElement($activeUser);
} | [
"public",
"function",
"removeActiveUser",
"(",
"\\",
"WobbleCode",
"\\",
"UserBundle",
"\\",
"Document",
"\\",
"User",
"$",
"activeUser",
")",
"{",
"$",
"this",
"->",
"activeUsers",
"->",
"removeElement",
"(",
"$",
"activeUser",
")",
";",
"}"
] | Remove activeUser
@param WobbleCode\UserBundle\Document\User $activeUser | [
"Remove",
"activeUser"
] | train | https://github.com/wobblecode/WobbleCodeUserBundle/blob/7b8206f8b4a50fbc61f7bfe4f83eb466cad96440/Document/Organization.php#L768-L771 |
gplcart/export | controllers/Settings.php | Settings.editSettings | public function editSettings()
{
$this->setTitleEditSettings();
$this->setBreadcrumbEditSettings();
$this->setData('settings', $this->module->getSettings('export'));
$this->submitSettings();
$this->setDataEditSettings();
$this->outputEditSettings();
} | php | public function editSettings()
{
$this->setTitleEditSettings();
$this->setBreadcrumbEditSettings();
$this->setData('settings', $this->module->getSettings('export'));
$this->submitSettings();
$this->setDataEditSettings();
$this->outputEditSettings();
} | [
"public",
"function",
"editSettings",
"(",
")",
"{",
"$",
"this",
"->",
"setTitleEditSettings",
"(",
")",
";",
"$",
"this",
"->",
"setBreadcrumbEditSettings",
"(",
")",
";",
"$",
"this",
"->",
"setData",
"(",
"'settings'",
",",
"$",
"this",
"->",
"module",... | Route page callback to display the module settings page | [
"Route",
"page",
"callback",
"to",
"display",
"the",
"module",
"settings",
"page"
] | train | https://github.com/gplcart/export/blob/b4d93c7a2bd6653f12231fb30d36601ea00fc926/controllers/Settings.php#L23-L32 |
gplcart/export | controllers/Settings.php | Settings.setDataEditSettings | protected function setDataEditSettings()
{
$header = $this->getData('settings.header');
if (is_array($header)) {
$string = '';
foreach ($header as $key => $value) {
$string .= "$key $value" . PHP_EOL;
}
$this->setData('settings.heade... | php | protected function setDataEditSettings()
{
$header = $this->getData('settings.header');
if (is_array($header)) {
$string = '';
foreach ($header as $key => $value) {
$string .= "$key $value" . PHP_EOL;
}
$this->setData('settings.heade... | [
"protected",
"function",
"setDataEditSettings",
"(",
")",
"{",
"$",
"header",
"=",
"$",
"this",
"->",
"getData",
"(",
"'settings.header'",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"header",
")",
")",
"{",
"$",
"string",
"=",
"''",
";",
"foreach",
"("... | Prepare data before rendering | [
"Prepare",
"data",
"before",
"rendering"
] | train | https://github.com/gplcart/export/blob/b4d93c7a2bd6653f12231fb30d36601ea00fc926/controllers/Settings.php#L37-L50 |
gplcart/export | controllers/Settings.php | Settings.submitSettings | protected function submitSettings()
{
if ($this->isPosted('reset')) {
$this->updateSettings(array());
} else if ($this->isPosted('save') && $this->validateSettings()) {
$this->updateSettings($this->getSubmitted());
}
} | php | protected function submitSettings()
{
if ($this->isPosted('reset')) {
$this->updateSettings(array());
} else if ($this->isPosted('save') && $this->validateSettings()) {
$this->updateSettings($this->getSubmitted());
}
} | [
"protected",
"function",
"submitSettings",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isPosted",
"(",
"'reset'",
")",
")",
"{",
"$",
"this",
"->",
"updateSettings",
"(",
"array",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"$",
"this",
"->",
"is... | Saves the submitted settings | [
"Saves",
"the",
"submitted",
"settings"
] | train | https://github.com/gplcart/export/blob/b4d93c7a2bd6653f12231fb30d36601ea00fc926/controllers/Settings.php#L84-L91 |
gplcart/export | controllers/Settings.php | Settings.validateSettings | protected function validateSettings()
{
$this->setSubmitted('settings');
$this->validateElement('limit', 'numeric');
$this->validateElement('limit', 'required');
$this->validateElement('multiple', 'required');
$this->validateElement('delimiter', 'required');
$this->... | php | protected function validateSettings()
{
$this->setSubmitted('settings');
$this->validateElement('limit', 'numeric');
$this->validateElement('limit', 'required');
$this->validateElement('multiple', 'required');
$this->validateElement('delimiter', 'required');
$this->... | [
"protected",
"function",
"validateSettings",
"(",
")",
"{",
"$",
"this",
"->",
"setSubmitted",
"(",
"'settings'",
")",
";",
"$",
"this",
"->",
"validateElement",
"(",
"'limit'",
",",
"'numeric'",
")",
";",
"$",
"this",
"->",
"validateElement",
"(",
"'limit'"... | Validate submitted module settings | [
"Validate",
"submitted",
"module",
"settings"
] | train | https://github.com/gplcart/export/blob/b4d93c7a2bd6653f12231fb30d36601ea00fc926/controllers/Settings.php#L96-L108 |
gplcart/export | controllers/Settings.php | Settings.validateHeaderSettings | protected function validateHeaderSettings()
{
$errors = $header = array();
$lines = gplcart_string_explode_multiline($this->getSubmitted('header', ''));
foreach ($lines as $pos => $line) {
$pos++;
$data = array_filter(array_map('trim', explode(' ', $line, 2)));
... | php | protected function validateHeaderSettings()
{
$errors = $header = array();
$lines = gplcart_string_explode_multiline($this->getSubmitted('header', ''));
foreach ($lines as $pos => $line) {
$pos++;
$data = array_filter(array_map('trim', explode(' ', $line, 2)));
... | [
"protected",
"function",
"validateHeaderSettings",
"(",
")",
"{",
"$",
"errors",
"=",
"$",
"header",
"=",
"array",
"(",
")",
";",
"$",
"lines",
"=",
"gplcart_string_explode_multiline",
"(",
"$",
"this",
"->",
"getSubmitted",
"(",
"'header'",
",",
"''",
")",
... | Validate header mapping | [
"Validate",
"header",
"mapping"
] | train | https://github.com/gplcart/export/blob/b4d93c7a2bd6653f12231fb30d36601ea00fc926/controllers/Settings.php#L113-L144 |
gplcart/export | controllers/Settings.php | Settings.updateSettings | protected function updateSettings(array $settings)
{
$this->controlAccess('module_edit');
$this->module->setSettings('export', $settings);
$this->redirect('', $this->text('Settings have been updated'), 'success');
} | php | protected function updateSettings(array $settings)
{
$this->controlAccess('module_edit');
$this->module->setSettings('export', $settings);
$this->redirect('', $this->text('Settings have been updated'), 'success');
} | [
"protected",
"function",
"updateSettings",
"(",
"array",
"$",
"settings",
")",
"{",
"$",
"this",
"->",
"controlAccess",
"(",
"'module_edit'",
")",
";",
"$",
"this",
"->",
"module",
"->",
"setSettings",
"(",
"'export'",
",",
"$",
"settings",
")",
";",
"$",
... | Update module settings
@param array $settings | [
"Update",
"module",
"settings"
] | train | https://github.com/gplcart/export/blob/b4d93c7a2bd6653f12231fb30d36601ea00fc926/controllers/Settings.php#L150-L156 |
sndsgd/http | src/http/request/BodyDecoder.php | BodyDecoder.addDecoder | public static function addDecoder(string $class, string ...$contentTypes)
{
$interface = decoder\DecoderInterface::class;
if (!is_subclass_of($class, $interface)) {
throw new \InvalidArgumentException(
"invalid value provided for 'class'; ".
"expecting the... | php | public static function addDecoder(string $class, string ...$contentTypes)
{
$interface = decoder\DecoderInterface::class;
if (!is_subclass_of($class, $interface)) {
throw new \InvalidArgumentException(
"invalid value provided for 'class'; ".
"expecting the... | [
"public",
"static",
"function",
"addDecoder",
"(",
"string",
"$",
"class",
",",
"string",
"...",
"$",
"contentTypes",
")",
"{",
"$",
"interface",
"=",
"decoder",
"\\",
"DecoderInterface",
"::",
"class",
";",
"if",
"(",
"!",
"is_subclass_of",
"(",
"$",
"cla... | Replace existing decoders, or add additional decoders
@param string $class The nme of the decoder class
@param string ...$contentTypes The content types the decoder can handle | [
"Replace",
"existing",
"decoders",
"or",
"add",
"additional",
"decoders"
] | train | https://github.com/sndsgd/http/blob/e7f82010a66c6d3241a24ea82baf4593130c723b/src/http/request/BodyDecoder.php#L27-L40 |
sndsgd/http | src/http/request/BodyDecoder.php | BodyDecoder.getDecoder | protected function getDecoder(
string $stream,
string $contentType,
int $contentLength,
decoder\DecoderOptions $options
)
{
$type = \sndsgd\Str::before($contentType, ";");
if (!isset(static::$decoders[$type])) {
throw new exception\BadRequestException(... | php | protected function getDecoder(
string $stream,
string $contentType,
int $contentLength,
decoder\DecoderOptions $options
)
{
$type = \sndsgd\Str::before($contentType, ";");
if (!isset(static::$decoders[$type])) {
throw new exception\BadRequestException(... | [
"protected",
"function",
"getDecoder",
"(",
"string",
"$",
"stream",
",",
"string",
"$",
"contentType",
",",
"int",
"$",
"contentLength",
",",
"decoder",
"\\",
"DecoderOptions",
"$",
"options",
")",
"{",
"$",
"type",
"=",
"\\",
"sndsgd",
"\\",
"Str",
"::",... | Stubbable method for creating a decoder instance
@param string $stream
@param string $contentType
@param int $contentLength
@param \sndsgd\http\data\DecoderOptions $options
@return \sndsgd\http\data\decoder\DecoderInterface
@throws \sndsgd\http\exception\BadRequestException | [
"Stubbable",
"method",
"for",
"creating",
"a",
"decoder",
"instance"
] | train | https://github.com/sndsgd/http/blob/e7f82010a66c6d3241a24ea82baf4593130c723b/src/http/request/BodyDecoder.php#L81-L98 |
sndsgd/http | src/http/request/BodyDecoder.php | BodyDecoder.parsePost | protected function parsePost()
{
$ret = $_POST ?: [];
if (isset($_FILES)) {
foreach ($_FILES as $name => $info) {
if (is_array($info["name"])) {
$len = count($info["name"]);
for ($i = 0; $i < $len; $i++) {
$f... | php | protected function parsePost()
{
$ret = $_POST ?: [];
if (isset($_FILES)) {
foreach ($_FILES as $name => $info) {
if (is_array($info["name"])) {
$len = count($info["name"]);
for ($i = 0; $i < $len; $i++) {
$f... | [
"protected",
"function",
"parsePost",
"(",
")",
"{",
"$",
"ret",
"=",
"$",
"_POST",
"?",
":",
"[",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"_FILES",
")",
")",
"{",
"foreach",
"(",
"$",
"_FILES",
"as",
"$",
"name",
"=>",
"$",
"info",
")",
"{",
... | Process the $_POST superglobal to spoof the results of a decoder
@return array | [
"Process",
"the",
"$_POST",
"superglobal",
"to",
"spoof",
"the",
"results",
"of",
"a",
"decoder"
] | train | https://github.com/sndsgd/http/blob/e7f82010a66c6d3241a24ea82baf4593130c723b/src/http/request/BodyDecoder.php#L105-L129 |
kherge-abandoned/php-cli-app | src/lib/Herrera/Cli/Provider/ConsoleServiceProvider.php | ConsoleServiceProvider.register | public function register(Container $container)
{
$container['console.defaults'] = $container->once(
function (Container $container) {
$defaults = array(
'app.name' => 'UNKNOWN',
'app.version' => 'UNKNOWN',
'console.auto_... | php | public function register(Container $container)
{
$container['console.defaults'] = $container->once(
function (Container $container) {
$defaults = array(
'app.name' => 'UNKNOWN',
'app.version' => 'UNKNOWN',
'console.auto_... | [
"public",
"function",
"register",
"(",
"Container",
"$",
"container",
")",
"{",
"$",
"container",
"[",
"'console.defaults'",
"]",
"=",
"$",
"container",
"->",
"once",
"(",
"function",
"(",
"Container",
"$",
"container",
")",
"{",
"$",
"defaults",
"=",
"arr... | {@inheritDoc} | [
"{"
] | train | https://github.com/kherge-abandoned/php-cli-app/blob/04ad5c4e805f4cf9e1282a1f869005504d42a9ee/src/lib/Herrera/Cli/Provider/ConsoleServiceProvider.php#L24-L110 |
ezra-obiwale/dSCore | src/Form/Filterer.php | Filterer.checkMessage | private function checkMessage($defMsg, array $options) {
if (is_array($options) && isset($options['message']))
return $options['message'] ? $options['message'] : null;
return $defMsg;
} | php | private function checkMessage($defMsg, array $options) {
if (is_array($options) && isset($options['message']))
return $options['message'] ? $options['message'] : null;
return $defMsg;
} | [
"private",
"function",
"checkMessage",
"(",
"$",
"defMsg",
",",
"array",
"$",
"options",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"options",
")",
"&&",
"isset",
"(",
"$",
"options",
"[",
"'message'",
"]",
")",
")",
"return",
"$",
"options",
"[",
"'... | Checks if a custom message exists or returns the default
@param string $defMsg Default message of the filter
@param array $options Element filter Options
@return string | [
"Checks",
"if",
"a",
"custom",
"message",
"exists",
"or",
"returns",
"the",
"default"
] | train | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Form/Filterer.php#L75-L80 |
ezra-obiwale/dSCore | src/Form/Filterer.php | Filterer.required | public function required($options) {
if ((is_array($options) || (!is_array($options) && $options))) {
if ((is_array($this->elementData) && (empty($this->elementData) || (empty($this->elementData[0]) && count($this->elementData) === 1))) ||
(!is_array($this->elementData) && trim($... | php | public function required($options) {
if ((is_array($options) || (!is_array($options) && $options))) {
if ((is_array($this->elementData) && (empty($this->elementData) || (empty($this->elementData[0]) && count($this->elementData) === 1))) ||
(!is_array($this->elementData) && trim($... | [
"public",
"function",
"required",
"(",
"$",
"options",
")",
"{",
"if",
"(",
"(",
"is_array",
"(",
"$",
"options",
")",
"||",
"(",
"!",
"is_array",
"(",
"$",
"options",
")",
"&&",
"$",
"options",
")",
")",
")",
"{",
"if",
"(",
"(",
"is_array",
"("... | Makes an element required
@param string $name Name of the element to filter
@param boolean|string|array $options Boolean indicates required or not.
String indicates required with custom message.
Array indicates required and has options
@return boolean | [
"Makes",
"an",
"element",
"required"
] | train | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Form/Filterer.php#L90-L105 |
ezra-obiwale/dSCore | src/Form/Filterer.php | Filterer.match | public function match(array $options) {
if (isset($options['element'])) {
if (isset($this->data[$options['element']])) {
if ($this->elementData == $this->data[$options['element']]) {
return true;
}
} else {
return true;
... | php | public function match(array $options) {
if (isset($options['element'])) {
if (isset($this->data[$options['element']])) {
if ($this->elementData == $this->data[$options['element']]) {
return true;
}
} else {
return true;
... | [
"public",
"function",
"match",
"(",
"array",
"$",
"options",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"'element'",
"]",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"$",
"options",
"[",
"'element'",
"]",
... | Checks if the value of the element matches the given option
@param string $name Name of the element to filter
@param array $options Keys may include [message]
@return boolean
@throws \Exception | [
"Checks",
"if",
"the",
"value",
"of",
"the",
"element",
"matches",
"the",
"given",
"option"
] | train | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Form/Filterer.php#L114-L131 |
ezra-obiwale/dSCore | src/Form/Filterer.php | Filterer.email | public function email(array $options) {
if (empty($this->elementData) || filter_var($this->elementData, FILTER_VALIDATE_EMAIL)) {
$this->elementData = filter_var($this->elementData, FILTER_SANITIZE_EMAIL);
return true;
}
$this->addError($this->checkMessage('Invalid email... | php | public function email(array $options) {
if (empty($this->elementData) || filter_var($this->elementData, FILTER_VALIDATE_EMAIL)) {
$this->elementData = filter_var($this->elementData, FILTER_SANITIZE_EMAIL);
return true;
}
$this->addError($this->checkMessage('Invalid email... | [
"public",
"function",
"email",
"(",
"array",
"$",
"options",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"elementData",
")",
"||",
"filter_var",
"(",
"$",
"this",
"->",
"elementData",
",",
"FILTER_VALIDATE_EMAIL",
")",
")",
"{",
"$",
"this",
... | Checks if the value of the element is a valid email address
@param string $name Name of the element to filter
@param array $options Keys may include [message]
@return boolean | [
"Checks",
"if",
"the",
"value",
"of",
"the",
"element",
"is",
"a",
"valid",
"email",
"address"
] | train | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Form/Filterer.php#L165-L173 |
ezra-obiwale/dSCore | src/Form/Filterer.php | Filterer.url | public function url(array $options) {
if (empty($this->elementData) || filter_var($this->elementData, FILTER_VALIDATE_URL)) {
$this->elementData = filter_var($this->elementData, FILTER_SANITIZE_URL);
return true;
}
$this->addError($this->checkMessage('Value is not a vali... | php | public function url(array $options) {
if (empty($this->elementData) || filter_var($this->elementData, FILTER_VALIDATE_URL)) {
$this->elementData = filter_var($this->elementData, FILTER_SANITIZE_URL);
return true;
}
$this->addError($this->checkMessage('Value is not a vali... | [
"public",
"function",
"url",
"(",
"array",
"$",
"options",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"elementData",
")",
"||",
"filter_var",
"(",
"$",
"this",
"->",
"elementData",
",",
"FILTER_VALIDATE_URL",
")",
")",
"{",
"$",
"this",
"->"... | Checks if the values of the element is a valid url
@param string $name Name of the element to filter
@param array $options Keys may include [message]
@return boolean | [
"Checks",
"if",
"the",
"values",
"of",
"the",
"element",
"is",
"a",
"valid",
"url"
] | train | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Form/Filterer.php#L181-L189 |
ezra-obiwale/dSCore | src/Form/Filterer.php | Filterer.alpha | public function alpha(array $options) {
if (!$options['regex'])
$options['regex'] = ($options['acceptSpace']) ? '/[^a-zA-Z\s]/' : '/[^a-zA-Z]/';
if (!preg_match($options['regex'], $this->elementData))
return true;
$this->addError($this->checkMessage('Value can only conta... | php | public function alpha(array $options) {
if (!$options['regex'])
$options['regex'] = ($options['acceptSpace']) ? '/[^a-zA-Z\s]/' : '/[^a-zA-Z]/';
if (!preg_match($options['regex'], $this->elementData))
return true;
$this->addError($this->checkMessage('Value can only conta... | [
"public",
"function",
"alpha",
"(",
"array",
"$",
"options",
")",
"{",
"if",
"(",
"!",
"$",
"options",
"[",
"'regex'",
"]",
")",
"$",
"options",
"[",
"'regex'",
"]",
"=",
"(",
"$",
"options",
"[",
"'acceptSpace'",
"]",
")",
"?",
"'/[^a-zA-Z\\s]/'",
"... | Checks if the contents of the element are all alphabets
@param string $name Name of the element to filter
@param array $options Keys may include [message]
@return boolean | [
"Checks",
"if",
"the",
"contents",
"of",
"the",
"element",
"are",
"all",
"alphabets"
] | train | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Form/Filterer.php#L197-L205 |
ezra-obiwale/dSCore | src/Form/Filterer.php | Filterer.decimal | public function decimal(array $options) {
if (ctype_digit($this->elementData))
return true;
$this->addError($this->checkMessage('Value can only contain numbers and a dot', $options));
return false;
} | php | public function decimal(array $options) {
if (ctype_digit($this->elementData))
return true;
$this->addError($this->checkMessage('Value can only contain numbers and a dot', $options));
return false;
} | [
"public",
"function",
"decimal",
"(",
"array",
"$",
"options",
")",
"{",
"if",
"(",
"ctype_digit",
"(",
"$",
"this",
"->",
"elementData",
")",
")",
"return",
"true",
";",
"$",
"this",
"->",
"addError",
"(",
"$",
"this",
"->",
"checkMessage",
"(",
"'Val... | Checks if the content of the element is decimal
@param string $name Name of the element to filter
@param array $options Keys may include [message]
@return boolean | [
"Checks",
"if",
"the",
"content",
"of",
"the",
"element",
"is",
"decimal"
] | train | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Form/Filterer.php#L229-L235 |
ezra-obiwale/dSCore | src/Form/Filterer.php | Filterer.greaterThan | public function greaterThan(array $options) {
if (isset($options['element'])) {
if (isset($this->data[$options['element']])) {
$than = ' "' . $this->cleanElement($options['element']) . '"';
if ($this->elementData > $this->data[$options['element']] || (empty($this->ele... | php | public function greaterThan(array $options) {
if (isset($options['element'])) {
if (isset($this->data[$options['element']])) {
$than = ' "' . $this->cleanElement($options['element']) . '"';
if ($this->elementData > $this->data[$options['element']] || (empty($this->ele... | [
"public",
"function",
"greaterThan",
"(",
"array",
"$",
"options",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"'element'",
"]",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"$",
"options",
"[",
"'element'",
"... | Checks if the value of the element is greater than the given value
@param string $name Name of the element to filter
@param array $options Keys may include [message]
@return boolean | [
"Checks",
"if",
"the",
"value",
"of",
"the",
"element",
"is",
"greater",
"than",
"the",
"given",
"value"
] | train | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Form/Filterer.php#L258-L275 |
ezra-obiwale/dSCore | src/Form/Filterer.php | Filterer.lessThan | public function lessThan(array $options) {
if (isset($options['element'])) {
if (isset($this->data[$options['element']])) {
$than = ' "' . $this->cleanElement($options['element']) . '"';
if ($this->elementData < $this->data[$options['element']]) {
... | php | public function lessThan(array $options) {
if (isset($options['element'])) {
if (isset($this->data[$options['element']])) {
$than = ' "' . $this->cleanElement($options['element']) . '"';
if ($this->elementData < $this->data[$options['element']]) {
... | [
"public",
"function",
"lessThan",
"(",
"array",
"$",
"options",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"'element'",
"]",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"$",
"options",
"[",
"'element'",
"]",... | Checks if the value of the element is less than the given value
@param string $name Name of the element to filter
@param array $options Keys may include [message]
@return boolean | [
"Checks",
"if",
"the",
"value",
"of",
"the",
"element",
"is",
"less",
"than",
"the",
"given",
"value"
] | train | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Form/Filterer.php#L283-L300 |
ezra-obiwale/dSCore | src/Form/Filterer.php | Filterer.minLength | public function minLength(array $options) {
if ($options['value'] && strlen($this->elementData) >= $options['value'])
return true;
$this->addError($this->checkMessage('Length must not be less than ' . $options['value'], $options));
return false;
} | php | public function minLength(array $options) {
if ($options['value'] && strlen($this->elementData) >= $options['value'])
return true;
$this->addError($this->checkMessage('Length must not be less than ' . $options['value'], $options));
return false;
} | [
"public",
"function",
"minLength",
"(",
"array",
"$",
"options",
")",
"{",
"if",
"(",
"$",
"options",
"[",
"'value'",
"]",
"&&",
"strlen",
"(",
"$",
"this",
"->",
"elementData",
")",
">=",
"$",
"options",
"[",
"'value'",
"]",
")",
"return",
"true",
"... | Checks if the length of the value of the element is not less than the required length
@param string $name Name of the element to filter
@param array $options Keys may include [message]
@return boolean | [
"Checks",
"if",
"the",
"length",
"of",
"the",
"value",
"of",
"the",
"element",
"is",
"not",
"less",
"than",
"the",
"required",
"length"
] | train | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Form/Filterer.php#L308-L314 |
CodeBlastr/queue | src/Shell/QueueShell.php | QueueShell.initialize | public function initialize()
{
$paths = App::path('Shell/Task', 'CodeBlastrQueue');
foreach ($paths as $path) {
$Folder = new Folder($path);
$res = array_merge($this->tasks, $Folder->find('Queue.+\.php'));
foreach ($res as &$r) {
$r = 'CodeBlastrQu... | php | public function initialize()
{
$paths = App::path('Shell/Task', 'CodeBlastrQueue');
foreach ($paths as $path) {
$Folder = new Folder($path);
$res = array_merge($this->tasks, $Folder->find('Queue.+\.php'));
foreach ($res as &$r) {
$r = 'CodeBlastrQu... | [
"public",
"function",
"initialize",
"(",
")",
"{",
"$",
"paths",
"=",
"App",
"::",
"path",
"(",
"'Shell/Task'",
",",
"'CodeBlastrQueue'",
")",
";",
"foreach",
"(",
"$",
"paths",
"as",
"$",
"path",
")",
"{",
"$",
"Folder",
"=",
"new",
"Folder",
"(",
"... | Initialize method | [
"Initialize",
"method"
] | train | https://github.com/CodeBlastr/queue/blob/8bc37c429406cce1b99c2c9e9dc1a83ad2b0b435/src/Shell/QueueShell.php#L33-L45 |
CodeBlastr/queue | src/Shell/QueueShell.php | QueueShell.main | public function main()
{
$this->out('CodeBlastr Queue Plugin:');
$this->hr();
$this->out('Usage:');
$this->out(' cake CodeBlastr.Queue help');
$this->out(' -> Display this Help message');
// $this->out(' cake Queue.Queue add <taskname>');
// $this->out(' -> Tr... | php | public function main()
{
$this->out('CodeBlastr Queue Plugin:');
$this->hr();
$this->out('Usage:');
$this->out(' cake CodeBlastr.Queue help');
$this->out(' -> Display this Help message');
// $this->out(' cake Queue.Queue add <taskname>');
// $this->out(' -> Tr... | [
"public",
"function",
"main",
"(",
")",
"{",
"$",
"this",
"->",
"out",
"(",
"'CodeBlastr Queue Plugin:'",
")",
";",
"$",
"this",
"->",
"hr",
"(",
")",
";",
"$",
"this",
"->",
"out",
"(",
"'Usage:'",
")",
";",
"$",
"this",
"->",
"out",
"(",
"'\tcake... | Output some basic usage Info.
@return void | [
"Output",
"some",
"basic",
"usage",
"Info",
"."
] | train | https://github.com/CodeBlastr/queue/blob/8bc37c429406cce1b99c2c9e9dc1a83ad2b0b435/src/Shell/QueueShell.php#L52-L74 |
spiral/console | src/Command.php | Command.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$container = ContainerScope::getContainer();
if (empty($container)) {
throw new ScopeException("Unable to run SpiralCommand outside of IoC scope.");
}
$reflection = new \ReflectionMethod($this, ... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$container = ContainerScope::getContainer();
if (empty($container)) {
throw new ScopeException("Unable to run SpiralCommand outside of IoC scope.");
}
$reflection = new \ReflectionMethod($this, ... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"container",
"=",
"ContainerScope",
"::",
"getContainer",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"container",
")",
")",
"{"... | {@inheritdoc}
Pass execution to "perform" method using container to resolve method dependencies. | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/spiral/console/blob/c3d99450ddd32bcc6f87e2b2ed40821054a93da3/src/Command.php#L46-L70 |
spiral/console | src/Command.php | Command.configure | protected function configure()
{
$this->setName(static::NAME);
$this->setDescription(static::DESCRIPTION);
foreach ($this->defineOptions() as $option) {
call_user_func_array([$this, 'addOption'], $option);
}
foreach ($this->defineArguments() as $argument) {
... | php | protected function configure()
{
$this->setName(static::NAME);
$this->setDescription(static::DESCRIPTION);
foreach ($this->defineOptions() as $option) {
call_user_func_array([$this, 'addOption'], $option);
}
foreach ($this->defineArguments() as $argument) {
... | [
"protected",
"function",
"configure",
"(",
")",
"{",
"$",
"this",
"->",
"setName",
"(",
"static",
"::",
"NAME",
")",
";",
"$",
"this",
"->",
"setDescription",
"(",
"static",
"::",
"DESCRIPTION",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"defineOptions... | Configures the command. | [
"Configures",
"the",
"command",
"."
] | train | https://github.com/spiral/console/blob/c3d99450ddd32bcc6f87e2b2ed40821054a93da3/src/Command.php#L75-L87 |
SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Image/GdImage.php | GdImage.dispose | public final function dispose()
{
if ( $this->disposed )
{
return;
}
if ( \is_resource( $this->r ) )
{
\imagedestroy( $this->r );
}
$this->r = null;
$this->size = null;
$this->colors = [];
$this->mimeType = null;
$thi... | php | public final function dispose()
{
if ( $this->disposed )
{
return;
}
if ( \is_resource( $this->r ) )
{
\imagedestroy( $this->r );
}
$this->r = null;
$this->size = null;
$this->colors = [];
$this->mimeType = null;
$thi... | [
"public",
"final",
"function",
"dispose",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"disposed",
")",
"{",
"return",
";",
"}",
"if",
"(",
"\\",
"is_resource",
"(",
"$",
"this",
"->",
"r",
")",
")",
"{",
"\\",
"imagedestroy",
"(",
"$",
"this",
"... | Disposes the current image resource. | [
"Disposes",
"the",
"current",
"image",
"resource",
"."
] | train | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Image/GdImage.php#L77-L97 |
SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Image/GdImage.php | GdImage.save | public final function save( string $file = null, int $quality = 75 )
{
if ( ! empty( $file ) )
{
$this->_file = $file;
}
if ( empty( $this->_file ) )
{
throw new IOError(
'Drawing.Image',
$file,
'Saving a GdImage instance fails! No... | php | public final function save( string $file = null, int $quality = 75 )
{
if ( ! empty( $file ) )
{
$this->_file = $file;
}
if ( empty( $this->_file ) )
{
throw new IOError(
'Drawing.Image',
$file,
'Saving a GdImage instance fails! No... | [
"public",
"final",
"function",
"save",
"(",
"string",
"$",
"file",
"=",
"null",
",",
"int",
"$",
"quality",
"=",
"75",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"file",
")",
")",
"{",
"$",
"this",
"->",
"_file",
"=",
"$",
"file",
";",
"}",
... | Saves the current image to defined image file. If no image file is defined the internally defined image file path
is used. If its also not defined a {@see \Beluga\IO\Exception} is thrown.
@param string $file Path of image file to save the current image instance. (Must be only defined if the
instance does not defi... | [
"Saves",
"the",
"current",
"image",
"to",
"defined",
"image",
"file",
".",
"If",
"no",
"image",
"file",
"is",
"defined",
"the",
"internally",
"defined",
"image",
"file",
"path",
"is",
"used",
".",
"If",
"its",
"also",
"not",
"defined",
"a",
"{",
"@see",
... | train | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Image/GdImage.php#L193-L236 |
SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Image/GdImage.php | GdImage.output | public final function output( int $quality = 60, string $filename = null )
{
\header( 'Expires: 0' );
\header( 'Cache-Control: private' );
\header( 'Pragma: cache' );
if ( empty( $filename ) )
{
$filename = \basename( $this->_file );
}
else
{
$filen... | php | public final function output( int $quality = 60, string $filename = null )
{
\header( 'Expires: 0' );
\header( 'Cache-Control: private' );
\header( 'Pragma: cache' );
if ( empty( $filename ) )
{
$filename = \basename( $this->_file );
}
else
{
$filen... | [
"public",
"final",
"function",
"output",
"(",
"int",
"$",
"quality",
"=",
"60",
",",
"string",
"$",
"filename",
"=",
"null",
")",
"{",
"\\",
"header",
"(",
"'Expires: 0'",
")",
";",
"\\",
"header",
"(",
"'Cache-Control: private'",
")",
";",
"\\",
"header... | Outputs the current image, including all required HTTP headers and exit the script.
@param integer $quality Image quality if it is an JPEG image. (1-100)
@param string $filename Output image file name for HTTP headers. | [
"Outputs",
"the",
"current",
"image",
"including",
"all",
"required",
"HTTP",
"headers",
"and",
"exit",
"the",
"script",
"."
] | train | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Image/GdImage.php#L244-L297 |
SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Image/GdImage.php | GdImage.rotateSquarely | public final function rotateSquarely( int $angle = 90, $fillColor = null, bool $internal = true ) : IImage
{
if ( ( $angle % 90 ) != 0 )
{
throw new ArgumentError(
'angle',
$angle,
'Drawing.Image',
'Only 90° and multiplications of it are allowed v... | php | public final function rotateSquarely( int $angle = 90, $fillColor = null, bool $internal = true ) : IImage
{
if ( ( $angle % 90 ) != 0 )
{
throw new ArgumentError(
'angle',
$angle,
'Drawing.Image',
'Only 90° and multiplications of it are allowed v... | [
"public",
"final",
"function",
"rotateSquarely",
"(",
"int",
"$",
"angle",
"=",
"90",
",",
"$",
"fillColor",
"=",
"null",
",",
"bool",
"$",
"internal",
"=",
"true",
")",
":",
"IImage",
"{",
"if",
"(",
"(",
"$",
"angle",
"%",
"90",
")",
"!=",
"0",
... | Rotate the image in 90° steps (90° or a multiple of it)
@param integer $angle 90, 180, 270, -90, -180, -270
@param string|\Beluga\Drawing\Color|\Beluga\Drawing\ColorGD $fillColor Fill collor by need
@param boolean $internal Dont create a... | [
"Rotate",
"the",
"image",
"in",
"90°",
"steps",
"(",
"90°",
"or",
"a",
"multiple",
"of",
"it",
")"
] | train | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Image/GdImage.php#L331-L369 |
SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Image/GdImage.php | GdImage.negate | public final function negate( bool $internal = false ) : GdImage
{
if ( ! $internal )
{
$clon = clone $this;
return $clon->negate( true );
}
$w = $this->getWidth();
$h = $this->getHeight();
$im = \imagecreatetruecolor( $w, $h );
for ( $y = 0; $y < $h; ++... | php | public final function negate( bool $internal = false ) : GdImage
{
if ( ! $internal )
{
$clon = clone $this;
return $clon->negate( true );
}
$w = $this->getWidth();
$h = $this->getHeight();
$im = \imagecreatetruecolor( $w, $h );
for ( $y = 0; $y < $h; ++... | [
"public",
"final",
"function",
"negate",
"(",
"bool",
"$",
"internal",
"=",
"false",
")",
":",
"GdImage",
"{",
"if",
"(",
"!",
"$",
"internal",
")",
"{",
"$",
"clon",
"=",
"clone",
"$",
"this",
";",
"return",
"$",
"clon",
"->",
"negate",
"(",
"true... | Creates a negative of current image.
@param boolean $internal Do not create a new instance?
@return \Beluga\Drawing\Image\GdImage | [
"Creates",
"a",
"negative",
"of",
"current",
"image",
"."
] | train | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Image/GdImage.php#L377-L413 |
SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Image/GdImage.php | GdImage.crop | public final function crop( int $width, int $height, int $gravity = Gravity::TOP_LEFT, bool $internal = true )
: IImage
{
// Check if width and height is valid, and regulate the finally used values
$this->cropCheck( $width, $height );
if ( $this->hasSameSize( $width, $height ) )
{
... | php | public final function crop( int $width, int $height, int $gravity = Gravity::TOP_LEFT, bool $internal = true )
: IImage
{
// Check if width and height is valid, and regulate the finally used values
$this->cropCheck( $width, $height );
if ( $this->hasSameSize( $width, $height ) )
{
... | [
"public",
"final",
"function",
"crop",
"(",
"int",
"$",
"width",
",",
"int",
"$",
"height",
",",
"int",
"$",
"gravity",
"=",
"Gravity",
"::",
"TOP_LEFT",
",",
"bool",
"$",
"internal",
"=",
"true",
")",
":",
"IImage",
"{",
"// Check if width and height is v... | Crops the defined image part.
@param integer $width The width
@param integer $height The height
@param integer $gravity The gravity. Use one of the constants from {@see \Beluga\Drawing\Gravity}.
@param boolean $internal Do not create a new instance?
@return \Beluga\Drawing\Image\IImage | [
"Crops",
"the",
"defined",
"image",
"part",
"."
] | train | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Image/GdImage.php#L429-L525 |
SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Image/GdImage.php | GdImage.crop2 | public final function crop2( int $width, int $height, ContentAlign $align, bool $internal = true )
: IImage
{
$this->cropCheck( $width, $height );
if ( $this->hasSameSize( $width, $height ) )
{
return $internal ? $this : clone $this;
}
$rect = null;
# <editor-fo... | php | public final function crop2( int $width, int $height, ContentAlign $align, bool $internal = true )
: IImage
{
$this->cropCheck( $width, $height );
if ( $this->hasSameSize( $width, $height ) )
{
return $internal ? $this : clone $this;
}
$rect = null;
# <editor-fo... | [
"public",
"final",
"function",
"crop2",
"(",
"int",
"$",
"width",
",",
"int",
"$",
"height",
",",
"ContentAlign",
"$",
"align",
",",
"bool",
"$",
"internal",
"=",
"true",
")",
":",
"IImage",
"{",
"$",
"this",
"->",
"cropCheck",
"(",
"$",
"width",
","... | Crops the defined image part.
@param integer $width
@param integer $height
@param ContentAlign $align
@param boolean $internal Do not create a new instance?
@return \Beluga\Drawing\Image\IImage
@throws \Beluga\ArgumentError If width and/or height is lower than 1 | [
"Crops",
"the",
"defined",
"image",
"part",
"."
] | train | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Image/GdImage.php#L537-L631 |
SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Image/GdImage.php | GdImage.cropRect | public final function cropRect( Rectangle $rect, bool $internal = true )
: IImage
{
$thumb = \imagecreatetruecolor( $rect->size->getWidth(), $rect->size->getHeight() );
if ( $this->mimeType == 'image/gif' || $this->mimeType == 'image/png')
{
\imagealphablending( $thumb, false );
... | php | public final function cropRect( Rectangle $rect, bool $internal = true )
: IImage
{
$thumb = \imagecreatetruecolor( $rect->size->getWidth(), $rect->size->getHeight() );
if ( $this->mimeType == 'image/gif' || $this->mimeType == 'image/png')
{
\imagealphablending( $thumb, false );
... | [
"public",
"final",
"function",
"cropRect",
"(",
"Rectangle",
"$",
"rect",
",",
"bool",
"$",
"internal",
"=",
"true",
")",
":",
"IImage",
"{",
"$",
"thumb",
"=",
"\\",
"imagecreatetruecolor",
"(",
"$",
"rect",
"->",
"size",
"->",
"getWidth",
"(",
")",
"... | Crop the defined image part and returns the current or new image instance.
@param \Beluga\Drawing\Rectangle $rect
@param boolean $internal Do not create a new instance?
@return \Beluga\Drawing\Image\IImage | [
"Crop",
"the",
"defined",
"image",
"part",
"and",
"returns",
"the",
"current",
"or",
"new",
"image",
"instance",
"."
] | train | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Image/GdImage.php#L640-L680 |
SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Image/GdImage.php | GdImage.cropQuadratic | public final function cropQuadratic( int $gravity = Gravity::MIDDLE_CENTER, bool $internal = true )
: IImage
{
if ( $this->size->isLandscape() )
{
return $this->crop( $this->getHeight(), $this->getHeight(), $gravity, $internal );
}
return $this->crop( $this->getWidth(), $this... | php | public final function cropQuadratic( int $gravity = Gravity::MIDDLE_CENTER, bool $internal = true )
: IImage
{
if ( $this->size->isLandscape() )
{
return $this->crop( $this->getHeight(), $this->getHeight(), $gravity, $internal );
}
return $this->crop( $this->getWidth(), $this... | [
"public",
"final",
"function",
"cropQuadratic",
"(",
"int",
"$",
"gravity",
"=",
"Gravity",
"::",
"MIDDLE_CENTER",
",",
"bool",
"$",
"internal",
"=",
"true",
")",
":",
"IImage",
"{",
"if",
"(",
"$",
"this",
"->",
"size",
"->",
"isLandscape",
"(",
")",
... | Crop the max usable quadratic image part from declared position and returns the current or new image instance.
@param integer|string $gravity The gravity. Use one of the constants from {@see \Beluga\Drawing\Gravity}.
@param boolean $internal Do not create a new instance?
@return \Beluga\Drawing\Image\IImage | [
"Crop",
"the",
"max",
"usable",
"quadratic",
"image",
"part",
"from",
"declared",
"position",
"and",
"returns",
"the",
"current",
"or",
"new",
"image",
"instance",
"."
] | train | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Image/GdImage.php#L689-L700 |
SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Image/GdImage.php | GdImage.cropQuadratic2 | public final function cropQuadratic2( ContentAlign $align, bool $internal = true )
: IImage
{
if ( $this->size->isLandscape() )
{
return $this->crop2( $this->getHeight(), $this->getHeight(), $align, $internal );
}
return $this->crop2( $this->getWidth(), $this->getWidth(), $al... | php | public final function cropQuadratic2( ContentAlign $align, bool $internal = true )
: IImage
{
if ( $this->size->isLandscape() )
{
return $this->crop2( $this->getHeight(), $this->getHeight(), $align, $internal );
}
return $this->crop2( $this->getWidth(), $this->getWidth(), $al... | [
"public",
"final",
"function",
"cropQuadratic2",
"(",
"ContentAlign",
"$",
"align",
",",
"bool",
"$",
"internal",
"=",
"true",
")",
":",
"IImage",
"{",
"if",
"(",
"$",
"this",
"->",
"size",
"->",
"isLandscape",
"(",
")",
")",
"{",
"return",
"$",
"this"... | Crop the max usable quadratic image part from declared position and returns the current or new image instance.
@param ContentAlign $align
@param boolean $internal Do not create a new instance?
@return \Beluga\Drawing\Image\IImage | [
"Crop",
"the",
"max",
"usable",
"quadratic",
"image",
"part",
"from",
"declared",
"position",
"and",
"returns",
"the",
"current",
"or",
"new",
"image",
"instance",
"."
] | train | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Image/GdImage.php#L709-L720 |
SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Image/GdImage.php | GdImage.contract | public final function contract( int $percent, bool $internal = true )
: IImage
{
if ( $percent < 1 || $percent >= 100 )
{
throw new ArgumentError(
'percent',
$percent,
'Drawing.Image',
'Image dimension contraction must produce a smaller, non... | php | public final function contract( int $percent, bool $internal = true )
: IImage
{
if ( $percent < 1 || $percent >= 100 )
{
throw new ArgumentError(
'percent',
$percent,
'Drawing.Image',
'Image dimension contraction must produce a smaller, non... | [
"public",
"final",
"function",
"contract",
"(",
"int",
"$",
"percent",
",",
"bool",
"$",
"internal",
"=",
"true",
")",
":",
"IImage",
"{",
"if",
"(",
"$",
"percent",
"<",
"1",
"||",
"$",
"percent",
">=",
"100",
")",
"{",
"throw",
"new",
"ArgumentErro... | Reduce the original image size by the specified percentage value.
@param int $percent The percentage value.
@param bool $internal Do not create a new instance?
@return \Beluga\Drawing\Image\IImage
@throws \Beluga\ArgumentError If $percent is lower than 1 oder greater than 99. | [
"Reduce",
"the",
"original",
"image",
"size",
"by",
"the",
"specified",
"percentage",
"value",
"."
] | train | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Image/GdImage.php#L735-L789 |
SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Image/GdImage.php | GdImage.contractToMaxSize | public final function contractToMaxSize( Size $maxsize, bool $internal = true )
: IImage
{
if ( $maxsize->getWidth() >= $this->size->getWidth() &&
$maxsize->getHeight() >= $this->size->getHeight() )
{
return $this->returnSelf( $internal );
}
$newSize = new Size( $... | php | public final function contractToMaxSize( Size $maxsize, bool $internal = true )
: IImage
{
if ( $maxsize->getWidth() >= $this->size->getWidth() &&
$maxsize->getHeight() >= $this->size->getHeight() )
{
return $this->returnSelf( $internal );
}
$newSize = new Size( $... | [
"public",
"final",
"function",
"contractToMaxSize",
"(",
"Size",
"$",
"maxsize",
",",
"bool",
"$",
"internal",
"=",
"true",
")",
":",
"IImage",
"{",
"if",
"(",
"$",
"maxsize",
"->",
"getWidth",
"(",
")",
">=",
"$",
"this",
"->",
"size",
"->",
"getWidth... | Reduce the original image size by holding the image size proportion, to fit best the declared
maximum size.
@param \Beluga\Drawing\Size $maxsize
@param bool $internal Do not create a new instance?
@return \Beluga\Drawing\Image\IImage
@throws \Beluga\ArgumentError If $maxsize is empty. or bigger than current image | [
"Reduce",
"the",
"original",
"image",
"size",
"by",
"holding",
"the",
"image",
"size",
"proportion",
"to",
"fit",
"best",
"the",
"declared",
"maximum",
"size",
"."
] | train | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Image/GdImage.php#L800-L815 |
SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Image/GdImage.php | GdImage.contractToMaxSide | public final function contractToMaxSide( int $maxSideLandscape, int $maxSidePortrait, bool $internal = true )
: IImage
{
$isPortrait = $this->size->isPortrait();
if ( ( $isPortrait && ( $this->size->getHeight() <= $maxSidePortrait ) ) ||
( ! $isPortrait && ( $this->size->getWidth() ... | php | public final function contractToMaxSide( int $maxSideLandscape, int $maxSidePortrait, bool $internal = true )
: IImage
{
$isPortrait = $this->size->isPortrait();
if ( ( $isPortrait && ( $this->size->getHeight() <= $maxSidePortrait ) ) ||
( ! $isPortrait && ( $this->size->getWidth() ... | [
"public",
"final",
"function",
"contractToMaxSide",
"(",
"int",
"$",
"maxSideLandscape",
",",
"int",
"$",
"maxSidePortrait",
",",
"bool",
"$",
"internal",
"=",
"true",
")",
":",
"IImage",
"{",
"$",
"isPortrait",
"=",
"$",
"this",
"->",
"size",
"->",
"isPor... | Reduce the original image size by holding the image size proportion.
The longer image side will be reduced to a length, defined by $maxSideLandscape or $maxSidePortrait,
depending to the format of the current image
@param int $maxSideLandscape The max. longer side length of landscape format images.
@param int $m... | [
"Reduce",
"the",
"original",
"image",
"size",
"by",
"holding",
"the",
"image",
"size",
"proportion",
".",
"The",
"longer",
"image",
"side",
"will",
"be",
"reduced",
"to",
"a",
"length",
"defined",
"by",
"$maxSideLandscape",
"or",
"$maxSidePortrait",
"depending",... | train | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Image/GdImage.php#L828-L845 |
SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Image/GdImage.php | GdImage.contractToMinSide | public final function contractToMinSide( int $maxSideLandscape, int $maxSidePortrait, bool $internal = true )
: IImage
{
$isPortrait = $this->size->isPortrait();
if ( ( $isPortrait && ( $this->size->getWidth() <= $maxSidePortrait ) ) ||
( ! $isPortrait && ( $this->size->getHeight() ... | php | public final function contractToMinSide( int $maxSideLandscape, int $maxSidePortrait, bool $internal = true )
: IImage
{
$isPortrait = $this->size->isPortrait();
if ( ( $isPortrait && ( $this->size->getWidth() <= $maxSidePortrait ) ) ||
( ! $isPortrait && ( $this->size->getHeight() ... | [
"public",
"final",
"function",
"contractToMinSide",
"(",
"int",
"$",
"maxSideLandscape",
",",
"int",
"$",
"maxSidePortrait",
",",
"bool",
"$",
"internal",
"=",
"true",
")",
":",
"IImage",
"{",
"$",
"isPortrait",
"=",
"$",
"this",
"->",
"size",
"->",
"isPor... | Reduce the original image size by holding the image size proportion.
The shorter image side will be reduced to a length, defined by $maxSideLandscape or $maxSidePortrait,
depending to the format of the current image
@param int $maxSideLandscape The max. shorter side length of landscape format images.
@param int ... | [
"Reduce",
"the",
"original",
"image",
"size",
"by",
"holding",
"the",
"image",
"size",
"proportion",
".",
"The",
"shorter",
"image",
"side",
"will",
"be",
"reduced",
"to",
"a",
"length",
"defined",
"by",
"$maxSideLandscape",
"or",
"$maxSidePortrait",
"depending"... | train | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Image/GdImage.php#L858-L875 |
SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Image/GdImage.php | GdImage.place | public final function place( IImage $placement, Point $point, int $opacity = 100, bool $internal = true )
: IImage
{
if ( ! ( $placement instanceof GdImage ) )
{
throw new ArgumentError(
'placement', $placement, 'Drawing.Image',
'Can not place an image that is not ... | php | public final function place( IImage $placement, Point $point, int $opacity = 100, bool $internal = true )
: IImage
{
if ( ! ( $placement instanceof GdImage ) )
{
throw new ArgumentError(
'placement', $placement, 'Drawing.Image',
'Can not place an image that is not ... | [
"public",
"final",
"function",
"place",
"(",
"IImage",
"$",
"placement",
",",
"Point",
"$",
"point",
",",
"int",
"$",
"opacity",
"=",
"100",
",",
"bool",
"$",
"internal",
"=",
"true",
")",
":",
"IImage",
"{",
"if",
"(",
"!",
"(",
"$",
"placement",
... | Places the defined $placement image inside the current image.
@param \Beluga\Drawing\Image\IImage $placement The image that should be placed
@param Point $point The top left point of the placement
@param int $opacity The opacity of the placement in % (1-100)
@param bool ... | [
"Places",
"the",
"defined",
"$placement",
"image",
"inside",
"the",
"current",
"image",
"."
] | train | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Image/GdImage.php#L892-L960 |
SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Image/GdImage.php | GdImage.placeWithGravity | public final function placeWithGravity(
IImage $placement, int $padding, $gravity = Gravity::MIDDLE_CENTER, int $opacity = 100, bool $internal = true )
: IImage
{
# <editor-fold desc="X + Y zuweisen">
switch ( $gravity )
{
case Gravity::TOP_LEFT:
$x = $padding;
... | php | public final function placeWithGravity(
IImage $placement, int $padding, $gravity = Gravity::MIDDLE_CENTER, int $opacity = 100, bool $internal = true )
: IImage
{
# <editor-fold desc="X + Y zuweisen">
switch ( $gravity )
{
case Gravity::TOP_LEFT:
$x = $padding;
... | [
"public",
"final",
"function",
"placeWithGravity",
"(",
"IImage",
"$",
"placement",
",",
"int",
"$",
"padding",
",",
"$",
"gravity",
"=",
"Gravity",
"::",
"MIDDLE_CENTER",
",",
"int",
"$",
"opacity",
"=",
"100",
",",
"bool",
"$",
"internal",
"=",
"true",
... | Places the defined $placement image inside the current image.
@param \Beluga\Drawing\Image\IImage $placement The image that should be placed
@param int $padding The min. padding around the placement
@param int $gravity The placement gravity inside the current im... | [
"Places",
"the",
"defined",
"$placement",
"image",
"inside",
"the",
"current",
"image",
"."
] | train | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Image/GdImage.php#L974-L1034 |
SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Image/GdImage.php | GdImage.placeWithContentAlign | public final function placeWithContentAlign(
IImage $placement, int $padding, ContentAlign $align, int $opacity = 100, bool $internal = true )
: IImage
{
# <editor-fold desc="X + Y">
switch ( $align->value )
{
case ContentAlign::TOP_LEFT:
$x = $padding;
... | php | public final function placeWithContentAlign(
IImage $placement, int $padding, ContentAlign $align, int $opacity = 100, bool $internal = true )
: IImage
{
# <editor-fold desc="X + Y">
switch ( $align->value )
{
case ContentAlign::TOP_LEFT:
$x = $padding;
... | [
"public",
"final",
"function",
"placeWithContentAlign",
"(",
"IImage",
"$",
"placement",
",",
"int",
"$",
"padding",
",",
"ContentAlign",
"$",
"align",
",",
"int",
"$",
"opacity",
"=",
"100",
",",
"bool",
"$",
"internal",
"=",
"true",
")",
":",
"IImage",
... | Places the defined $placement image inside the current image.
@param \Beluga\Drawing\Image\IImage $placement The image that should be placed
@param int $padding The min. padding around the placement
@param ContentAlign $align The placement align inside the current image
@param int ... | [
"Places",
"the",
"defined",
"$placement",
"image",
"inside",
"the",
"current",
"image",
"."
] | train | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Image/GdImage.php#L1047-L1107 |
SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Image/GdImage.php | GdImage.drawSingleBorder | public final function drawSingleBorder( $borderColor, bool $internal = true )
: IImage
{
$borderColor = $this->getGdColorObject( $borderColor, 'bordercolor' );
if ( $internal )
{
\imagerectangle( $this->r, 1, 1, $this->getWidth() - 2, $this->getHeight() - 2, $borderColor->getGdVal... | php | public final function drawSingleBorder( $borderColor, bool $internal = true )
: IImage
{
$borderColor = $this->getGdColorObject( $borderColor, 'bordercolor' );
if ( $internal )
{
\imagerectangle( $this->r, 1, 1, $this->getWidth() - 2, $this->getHeight() - 2, $borderColor->getGdVal... | [
"public",
"final",
"function",
"drawSingleBorder",
"(",
"$",
"borderColor",
",",
"bool",
"$",
"internal",
"=",
"true",
")",
":",
"IImage",
"{",
"$",
"borderColor",
"=",
"$",
"this",
"->",
"getGdColorObject",
"(",
"$",
"borderColor",
",",
"'bordercolor'",
")"... | Draws a single border with defined color around the image.
@param string|array|\Beluga\Drawing\ColorGD|\Beluga\Drawing\Color $borderColor
@param bool $internal Do not create a new instance?
@return \Beluga\Drawing\Image\IImage | [
"Draws",
"a",
"single",
"border",
"with",
"defined",
"color",
"around",
"the",
"image",
"."
] | train | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Image/GdImage.php#L1121-L1141 |
SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Image/GdImage.php | GdImage.drawDoubleBorder | public final function drawDoubleBorder( $innerBorderColor, $outerBorderColor, bool $internal = true)
: IImage
{
$innerBorderColor = $this->getGdColorObject( $innerBorderColor, 'bordercolor' );
$outerBorderColor = $this->getGdColorObject( $outerBorderColor, 'outerbordercolor' );
if ( $internal... | php | public final function drawDoubleBorder( $innerBorderColor, $outerBorderColor, bool $internal = true)
: IImage
{
$innerBorderColor = $this->getGdColorObject( $innerBorderColor, 'bordercolor' );
$outerBorderColor = $this->getGdColorObject( $outerBorderColor, 'outerbordercolor' );
if ( $internal... | [
"public",
"final",
"function",
"drawDoubleBorder",
"(",
"$",
"innerBorderColor",
",",
"$",
"outerBorderColor",
",",
"bool",
"$",
"internal",
"=",
"true",
")",
":",
"IImage",
"{",
"$",
"innerBorderColor",
"=",
"$",
"this",
"->",
"getGdColorObject",
"(",
"$",
... | Draws a double border with defined colors around the image.
@param string|array|\Beluga\Drawing\ColorGD|\Beluga\Drawing\Color $innerBorderColor
@param string|array|\Beluga\Drawing\ColorGD|\Beluga\Drawing\Color $outerBorderColor
@param bool $internal Do not creat... | [
"Draws",
"a",
"double",
"border",
"with",
"defined",
"colors",
"around",
"the",
"image",
"."
] | train | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Image/GdImage.php#L1151-L1166 |
SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Image/GdImage.php | GdImage.drawText | public final function drawText(
string $text, $font, $fontSize, $color, Point $point, bool $internal = true )
: IImage
{
$color = $this->getGdColorObject( $color, 'textcolor' );
if ( ! empty( $font ) && \file_exists( $font ) )
{
if ( $internal )
{
\imaget... | php | public final function drawText(
string $text, $font, $fontSize, $color, Point $point, bool $internal = true )
: IImage
{
$color = $this->getGdColorObject( $color, 'textcolor' );
if ( ! empty( $font ) && \file_exists( $font ) )
{
if ( $internal )
{
\imaget... | [
"public",
"final",
"function",
"drawText",
"(",
"string",
"$",
"text",
",",
"$",
"font",
",",
"$",
"fontSize",
",",
"$",
"color",
",",
"Point",
"$",
"point",
",",
"bool",
"$",
"internal",
"=",
"true",
")",
":",
"IImage",
"{",
"$",
"color",
"=",
"$"... | Draws a text at declared position into current image.
@param string $text The text that should be drawn.
@param string $font The font that should be used. For example: For GdImage you can define here
the path of the *.ttf font file or NULL. If you define null the parameter
$fontSize declares the size + f... | [
"Draws",
"a",
"text",
"at",
"declared",
"position",
"into",
"current",
"image",
"."
] | train | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Image/GdImage.php#L1187-L1217 |
SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Image/GdImage.php | GdImage.drawTextWithGravity | public final function drawTextWithGravity(
string $text, $font, $fontSize, $color, int $padding, int $gravity, bool $internal = true )
: IImage
{
if ( ! empty( $font ) && \file_exists( $font ) )
{
return $this->drawText(
$text,
$font,
$fontS... | php | public final function drawTextWithGravity(
string $text, $font, $fontSize, $color, int $padding, int $gravity, bool $internal = true )
: IImage
{
if ( ! empty( $font ) && \file_exists( $font ) )
{
return $this->drawText(
$text,
$font,
$fontS... | [
"public",
"final",
"function",
"drawTextWithGravity",
"(",
"string",
"$",
"text",
",",
"$",
"font",
",",
"$",
"fontSize",
",",
"$",
"color",
",",
"int",
"$",
"padding",
",",
"int",
"$",
"gravity",
",",
"bool",
"$",
"internal",
"=",
"true",
")",
":",
... | Draws a text by using {@see \Beluga\Drawing\Gravity} into current image.
@param string $text The text that should be drawn.
@param string $font The font that should be used. For example: For GdImage you can define here
the path of the *.ttf font file or NULL. If you define null the parameter
$fontSize de... | [
"Draws",
"a",
"text",
"by",
"using",
"{",
"@see",
"\\",
"Beluga",
"\\",
"Drawing",
"\\",
"Gravity",
"}",
"into",
"current",
"image",
"."
] | train | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Image/GdImage.php#L1234-L1332 |
SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Image/GdImage.php | GdImage.drawTextWithAlign | public final function drawTextWithAlign(
string $text, $font, $fontSize, $color, int $padding, ContentAlign $align, bool $internal = true )
: IImage
{
if ( ! empty( $font ) && \file_exists( $font ) )
{
return $this->drawText(
$text,
$font,
$fontSi... | php | public final function drawTextWithAlign(
string $text, $font, $fontSize, $color, int $padding, ContentAlign $align, bool $internal = true )
: IImage
{
if ( ! empty( $font ) && \file_exists( $font ) )
{
return $this->drawText(
$text,
$font,
$fontSi... | [
"public",
"final",
"function",
"drawTextWithAlign",
"(",
"string",
"$",
"text",
",",
"$",
"font",
",",
"$",
"fontSize",
",",
"$",
"color",
",",
"int",
"$",
"padding",
",",
"ContentAlign",
"$",
"align",
",",
"bool",
"$",
"internal",
"=",
"true",
")",
":... | Draws a text by using a gravity into current image.
@param string $text The text that should be drawn.
@param string $font The font that should be used. For example: For GdImage you can define here
the path of the *.ttf font file or NULL. If you define null the parameter
$fontSize declares the size + fon... | [
"Draws",
"a",
"text",
"by",
"using",
"a",
"gravity",
"into",
"current",
"image",
"."
] | train | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Image/GdImage.php#L1481-L1583 |
SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Image/GdImage.php | GdImage.Create | public static function Create(
int $width, int $height, $backColor, string $type = 'image/gif', bool $transparent = false )
: GdImage
{
$img = \imagecreatetruecolor( $width, $height );
if ( false === ( $rgb = ColorTool::Color2Rgb( $backColor ) ) )
{
$rgb = [ 0, 0, 0 ];
}
... | php | public static function Create(
int $width, int $height, $backColor, string $type = 'image/gif', bool $transparent = false )
: GdImage
{
$img = \imagecreatetruecolor( $width, $height );
if ( false === ( $rgb = ColorTool::Color2Rgb( $backColor ) ) )
{
$rgb = [ 0, 0, 0 ];
}
... | [
"public",
"static",
"function",
"Create",
"(",
"int",
"$",
"width",
",",
"int",
"$",
"height",
",",
"$",
"backColor",
",",
"string",
"$",
"type",
"=",
"'image/gif'",
",",
"bool",
"$",
"transparent",
"=",
"false",
")",
":",
"GdImage",
"{",
"$",
"img",
... | Creates a new image with defined dimension and the background color. If the image is a GIF or PNG image
tha background color is set to transparent, if $transparent is (bool) TRUE.
@param int $width The image width.
@param int $height The image height.
@param string|array $backColor Th... | [
"Creates",
"a",
"new",
"image",
"with",
"defined",
"dimension",
"and",
"the",
"background",
"color",
".",
"If",
"the",
"image",
"is",
"a",
"GIF",
"or",
"PNG",
"image",
"tha",
"background",
"color",
"is",
"set",
"to",
"transparent",
"if",
"$transparent",
"i... | train | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Image/GdImage.php#L1897-L1957 |
SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Image/GdImage.php | GdImage.LoadFile | public static function LoadFile( string $imageFile ) : GdImage
{
if ( ! \file_exists( $imageFile ) )
{
throw new FileNotFoundError(
'Drawing.Image', $imageFile, 'Loading a \Beluga\Drawing\Image\GdImage Resource from this file fails.'
);
}
$imageInfo = null;
... | php | public static function LoadFile( string $imageFile ) : GdImage
{
if ( ! \file_exists( $imageFile ) )
{
throw new FileNotFoundError(
'Drawing.Image', $imageFile, 'Loading a \Beluga\Drawing\Image\GdImage Resource from this file fails.'
);
}
$imageInfo = null;
... | [
"public",
"static",
"function",
"LoadFile",
"(",
"string",
"$",
"imageFile",
")",
":",
"GdImage",
"{",
"if",
"(",
"!",
"\\",
"file_exists",
"(",
"$",
"imageFile",
")",
")",
"{",
"throw",
"new",
"FileNotFoundError",
"(",
"'Drawing.Image'",
",",
"$",
"imageF... | Loads the defined image file to a new {@see \Beluga\Drawing\Image\GdImage} instance.
@param string $imageFile
@return \Beluga\Drawing\Image\GdImage
@throws \Beluga\IO\FileNotFoundError
@throws \Beluga\IO\FileAccessError | [
"Loads",
"the",
"defined",
"image",
"file",
"to",
"a",
"new",
"{",
"@see",
"\\",
"Beluga",
"\\",
"Drawing",
"\\",
"Image",
"\\",
"GdImage",
"}",
"instance",
"."
] | train | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Image/GdImage.php#L1967-L2023 |
net-tools/core | src/Containers/PersistentCache.php | PersistentCache.commit | public function commit()
{
if ( $this->_initialized && $this->_dirty )
{
$this->_saveCache();
$this->_dirty = false;
}
} | php | public function commit()
{
if ( $this->_initialized && $this->_dirty )
{
$this->_saveCache();
$this->_dirty = false;
}
} | [
"public",
"function",
"commit",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_initialized",
"&&",
"$",
"this",
"->",
"_dirty",
")",
"{",
"$",
"this",
"->",
"_saveCache",
"(",
")",
";",
"$",
"this",
"->",
"_dirty",
"=",
"false",
";",
"}",
"}"
] | Commit cache content updates to storage | [
"Commit",
"cache",
"content",
"updates",
"to",
"storage"
] | train | https://github.com/net-tools/core/blob/51446641cee22c0cf53d2b409c76cc8bd1a187e7/src/Containers/PersistentCache.php#L157-L164 |
k3ssen/BaseAdminBundle | Controller/CrudController.php | CrudController.redirectToRoute | protected function redirectToRoute(string $route, $parameters = [], int $status = 302): RedirectResponse
{
return $this->redirect($this->generateUrl($route, $parameters), $status);
} | php | protected function redirectToRoute(string $route, $parameters = [], int $status = 302): RedirectResponse
{
return $this->redirect($this->generateUrl($route, $parameters), $status);
} | [
"protected",
"function",
"redirectToRoute",
"(",
"string",
"$",
"route",
",",
"$",
"parameters",
"=",
"[",
"]",
",",
"int",
"$",
"status",
"=",
"302",
")",
":",
"RedirectResponse",
"{",
"return",
"$",
"this",
"->",
"redirect",
"(",
"$",
"this",
"->",
"... | Returns a RedirectResponse to the given route with the given parameters.
Overwrites Controller-trait to allow parameters as object as well. | [
"Returns",
"a",
"RedirectResponse",
"to",
"the",
"given",
"route",
"with",
"the",
"given",
"parameters",
".",
"Overwrites",
"Controller",
"-",
"trait",
"to",
"allow",
"parameters",
"as",
"object",
"as",
"well",
"."
] | train | https://github.com/k3ssen/BaseAdminBundle/blob/d0af699b097f48d92883713eafd36ee9069460bb/Controller/CrudController.php#L36-L39 |
k3ssen/BaseAdminBundle | Controller/CrudController.php | CrudController.isDeletable | protected function isDeletable($object): bool
{
$em = $this->getEntityManager();
$em->beginTransaction();
try {
// if an object is softdeleteable, then set 'deletedAt' first, so that a 'hard-delete' will be attempted.
if ($object instanceof SoftDeleteableInterface) {
... | php | protected function isDeletable($object): bool
{
$em = $this->getEntityManager();
$em->beginTransaction();
try {
// if an object is softdeleteable, then set 'deletedAt' first, so that a 'hard-delete' will be attempted.
if ($object instanceof SoftDeleteableInterface) {
... | [
"protected",
"function",
"isDeletable",
"(",
"$",
"object",
")",
":",
"bool",
"{",
"$",
"em",
"=",
"$",
"this",
"->",
"getEntityManager",
"(",
")",
";",
"$",
"em",
"->",
"beginTransaction",
"(",
")",
";",
"try",
"{",
"// if an object is softdeleteable, then ... | Tries to delete an object without actually deleting it.
Returns false if ForeignKeyConstraintViolationException would be thrown; true otherwise. | [
"Tries",
"to",
"delete",
"an",
"object",
"without",
"actually",
"deleting",
"it",
".",
"Returns",
"false",
"if",
"ForeignKeyConstraintViolationException",
"would",
"be",
"thrown",
";",
"true",
"otherwise",
"."
] | train | https://github.com/k3ssen/BaseAdminBundle/blob/d0af699b097f48d92883713eafd36ee9069460bb/Controller/CrudController.php#L111-L128 |
rutger-speksnijder/restphp | src/RestPHP/Configuration.php | Configuration.createFromFile | public function createFromFile($file)
{
// Check if the file exists
if (!$file || !file_exists($file)) {
throw new \Exception("Configuration file \"{$file}\" could not be found.");
}
// Include the file while suppressing warnings
// - so we can check if we could ... | php | public function createFromFile($file)
{
// Check if the file exists
if (!$file || !file_exists($file)) {
throw new \Exception("Configuration file \"{$file}\" could not be found.");
}
// Include the file while suppressing warnings
// - so we can check if we could ... | [
"public",
"function",
"createFromFile",
"(",
"$",
"file",
")",
"{",
"// Check if the file exists",
"if",
"(",
"!",
"$",
"file",
"||",
"!",
"file_exists",
"(",
"$",
"file",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"Configuration file \\\"{$file}... | Creates a configuration object by loading the parameters from a file.
This file has to be a PHP file returning an array with the parameters.
@param string $file The path to the file.
@throws Exception Throws an exception if the file can't be found.
@throws Exception Throws an exception if the file could not be includ... | [
"Creates",
"a",
"configuration",
"object",
"by",
"loading",
"the",
"parameters",
"from",
"a",
"file",
".",
"This",
"file",
"has",
"to",
"be",
"a",
"PHP",
"file",
"returning",
"an",
"array",
"with",
"the",
"parameters",
"."
] | train | https://github.com/rutger-speksnijder/restphp/blob/326a7c0d79b266bbdd8a27ff1c8021caf9d28a3d/src/RestPHP/Configuration.php#L123-L148 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Template.php | Template.get | public function get($name) {
if(isset($this->tVar[$name]))
return $this->tVar[$name];
else
return false;
} | php | public function get($name) {
if(isset($this->tVar[$name]))
return $this->tVar[$name];
else
return false;
} | [
"public",
"function",
"get",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"tVar",
"[",
"$",
"name",
"]",
")",
")",
"return",
"$",
"this",
"->",
"tVar",
"[",
"$",
"name",
"]",
";",
"else",
"return",
"false",
";",
"}"
] | 模板变量获取和设置 | [
"模板变量获取和设置"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Template.php#L55-L60 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Template.php | Template.compiler | protected function compiler($tmplContent) {
//模板解析
$tmplContent = $this->parse($tmplContent);
// 还原被替换的Literal标签
$tmplContent = preg_replace_callback('/<!--###literal(\d+)###-->/is', array($this, 'restoreLiteral'), $tmplContent);
// 添加安全代码
$tmplContent = '<?php if (!de... | php | protected function compiler($tmplContent) {
//模板解析
$tmplContent = $this->parse($tmplContent);
// 还原被替换的Literal标签
$tmplContent = preg_replace_callback('/<!--###literal(\d+)###-->/is', array($this, 'restoreLiteral'), $tmplContent);
// 添加安全代码
$tmplContent = '<?php if (!de... | [
"protected",
"function",
"compiler",
"(",
"$",
"tmplContent",
")",
"{",
"//模板解析",
"$",
"tmplContent",
"=",
"$",
"this",
"->",
"parse",
"(",
"$",
"tmplContent",
")",
";",
"// 还原被替换的Literal标签",
"$",
"tmplContent",
"=",
"preg_replace_callback",
"(",
"'/<!--###liter... | 编译模板文件内容
@access protected
@param mixed $tmplContent 模板内容
@return string | [
"编译模板文件内容"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Template.php#L124-L136 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Template.php | Template.parse | public function parse($content) {
// 内容为空不解析
if(empty($content)) return '';
$begin = $this->config['taglib_begin'];
$end = $this->config['taglib_end'];
// 检查include语法
$content = $this->parseInclude($content);
// 检查PHP语法
$content = ... | php | public function parse($content) {
// 内容为空不解析
if(empty($content)) return '';
$begin = $this->config['taglib_begin'];
$end = $this->config['taglib_end'];
// 检查include语法
$content = $this->parseInclude($content);
// 检查PHP语法
$content = ... | [
"public",
"function",
"parse",
"(",
"$",
"content",
")",
"{",
"// 内容为空不解析",
"if",
"(",
"empty",
"(",
"$",
"content",
")",
")",
"return",
"''",
";",
"$",
"begin",
"=",
"$",
"this",
"->",
"config",
"[",
"'taglib_begin'",
"]",
";",
"$",
"end",
"=",
"$... | 模板解析入口
支持普通标签和TagLib解析 支持自定义标签库
@access public
@param string $content 要解析的模板内容
@return string | [
"模板解析入口",
"支持普通标签和TagLib解析",
"支持自定义标签库"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Template.php#L145-L186 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Template.php | Template.parseLayout | protected function parseLayout($content) {
// 读取模板中的布局标签
$find = preg_match('/'.$this->config['taglib_begin'].'layout\s(.+?)\s*?\/'.$this->config['taglib_end'].'/is',$content,$matches);
if($find) {
//替换Layout标签
$content = str_replace($matches[0],'',$content);
... | php | protected function parseLayout($content) {
// 读取模板中的布局标签
$find = preg_match('/'.$this->config['taglib_begin'].'layout\s(.+?)\s*?\/'.$this->config['taglib_end'].'/is',$content,$matches);
if($find) {
//替换Layout标签
$content = str_replace($matches[0],'',$content);
... | [
"protected",
"function",
"parseLayout",
"(",
"$",
"content",
")",
"{",
"// 读取模板中的布局标签",
"$",
"find",
"=",
"preg_match",
"(",
"'/'",
".",
"$",
"this",
"->",
"config",
"[",
"'taglib_begin'",
"]",
".",
"'layout\\s(.+?)\\s*?\\/'",
".",
"$",
"this",
"->",
"config... | 解析模板中的布局标签 | [
"解析模板中的布局标签"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Template.php#L202-L221 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Template.php | Template.parseInclude | protected function parseInclude($content, $extend = true) {
// 解析继承
if($extend)
$content = $this->parseExtend($content);
// 解析布局
$content = $this->parseLayout($content);
// 读取模板中的include标签
$find = preg_match_all('/'.$this->config['taglib_begi... | php | protected function parseInclude($content, $extend = true) {
// 解析继承
if($extend)
$content = $this->parseExtend($content);
// 解析布局
$content = $this->parseLayout($content);
// 读取模板中的include标签
$find = preg_match_all('/'.$this->config['taglib_begi... | [
"protected",
"function",
"parseInclude",
"(",
"$",
"content",
",",
"$",
"extend",
"=",
"true",
")",
"{",
"// 解析继承",
"if",
"(",
"$",
"extend",
")",
"$",
"content",
"=",
"$",
"this",
"->",
"parseExtend",
"(",
"$",
"content",
")",
";",
"// 解析布局",
"$",
"... | 解析模板中的include标签 | [
"解析模板中的include标签"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Template.php#L224-L242 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Template.php | Template.parseExtend | protected function parseExtend($content) {
$begin = $this->config['taglib_begin'];
$end = $this->config['taglib_end'];
// 读取模板中的继承标签
$find = preg_match('/'.$begin.'extend\s(.+?)\s*?\/'.$end.'/is',$content,$matches);
if($find) {
//替换exte... | php | protected function parseExtend($content) {
$begin = $this->config['taglib_begin'];
$end = $this->config['taglib_end'];
// 读取模板中的继承标签
$find = preg_match('/'.$begin.'extend\s(.+?)\s*?\/'.$end.'/is',$content,$matches);
if($find) {
//替换exte... | [
"protected",
"function",
"parseExtend",
"(",
"$",
"content",
")",
"{",
"$",
"begin",
"=",
"$",
"this",
"->",
"config",
"[",
"'taglib_begin'",
"]",
";",
"$",
"end",
"=",
"$",
"this",
"->",
"config",
"[",
"'taglib_end'",
"]",
";",
"// 读取模板中的继承标签",
"$",
"... | 解析模板中的extend标签 | [
"解析模板中的extend标签"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Template.php#L245-L265 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Template.php | Template.parseXmlAttrs | private function parseXmlAttrs($attrs) {
$xml = '<tpl><tag '.$attrs.' /></tpl>';
$xml = simplexml_load_string($xml);
if(!$xml)
E(L('_XML_TAG_ERROR_'));
$xml = (array)($xml->tag->attributes());
$array = array_change_key_case($xml['@att... | php | private function parseXmlAttrs($attrs) {
$xml = '<tpl><tag '.$attrs.' /></tpl>';
$xml = simplexml_load_string($xml);
if(!$xml)
E(L('_XML_TAG_ERROR_'));
$xml = (array)($xml->tag->attributes());
$array = array_change_key_case($xml['@att... | [
"private",
"function",
"parseXmlAttrs",
"(",
"$",
"attrs",
")",
"{",
"$",
"xml",
"=",
"'<tpl><tag '",
".",
"$",
"attrs",
".",
"' /></tpl>'",
";",
"$",
"xml",
"=",
"simplexml_load_string",
"(",
"$",
"xml",
")",
";",
"if",
"(",
"!",
"$",
"xml",
")",
"E... | 分析XML属性
@access private
@param string $attrs XML属性字符串
@return array | [
"分析XML属性"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Template.php#L273-L281 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Template.php | Template.parseBlock | private function parseBlock($name,$content = '') {
if(is_array($name)){
$content = $name[2];
$name = $name[1];
}
$this->block[$name] = $content;
return '';
} | php | private function parseBlock($name,$content = '') {
if(is_array($name)){
$content = $name[2];
$name = $name[1];
}
$this->block[$name] = $content;
return '';
} | [
"private",
"function",
"parseBlock",
"(",
"$",
"name",
",",
"$",
"content",
"=",
"''",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"name",
")",
")",
"{",
"$",
"content",
"=",
"$",
"name",
"[",
"2",
"]",
";",
"$",
"name",
"=",
"$",
"name",
"[",
... | 记录当前页面中的block标签
@access private
@param string $name block名称
@param string $content 模板内容
@return string | [
"记录当前页面中的block标签"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Template.php#L321-L328 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Template.php | Template.getIncludeTagLib | public function getIncludeTagLib(& $content) {
//搜索是否有TagLib标签
$find = preg_match('/'.$this->config['taglib_begin'].'taglib\s(.+?)(\s*?)\/'.$this->config['taglib_end'].'\W/is',$content,$matches);
if($find) {
//替换TagLib标签
$content = str_replace($matches[0],'',$con... | php | public function getIncludeTagLib(& $content) {
//搜索是否有TagLib标签
$find = preg_match('/'.$this->config['taglib_begin'].'taglib\s(.+?)(\s*?)\/'.$this->config['taglib_end'].'\W/is',$content,$matches);
if($find) {
//替换TagLib标签
$content = str_replace($matches[0],'',$con... | [
"public",
"function",
"getIncludeTagLib",
"(",
"&",
"$",
"content",
")",
"{",
"//搜索是否有TagLib标签",
"$",
"find",
"=",
"preg_match",
"(",
"'/'",
".",
"$",
"this",
"->",
"config",
"[",
"'taglib_begin'",
"]",
".",
"'taglib\\s(.+?)(\\s*?)\\/'",
".",
"$",
"this",
"-... | 搜索模板页面中包含的TagLib库
并返回列表
@access public
@param string $content 模板内容
@return string|false | [
"搜索模板页面中包含的TagLib库",
"并返回列表"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Template.php#L367-L378 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.