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 |
|---|---|---|---|---|---|---|---|---|---|---|
lootils/archiver | src/Lootils/Archiver/TarArchive.php | TarArchive.contents | public function contents()
{
$files = array();
foreach ($this->tar->listContent() as $data) {
$files[$data['filename']] = $data;
}
return $files;
} | php | public function contents()
{
$files = array();
foreach ($this->tar->listContent() as $data) {
$files[$data['filename']] = $data;
}
return $files;
} | [
"public",
"function",
"contents",
"(",
")",
"{",
"$",
"files",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"tar",
"->",
"listContent",
"(",
")",
"as",
"$",
"data",
")",
"{",
"$",
"files",
"[",
"$",
"data",
"[",
"'filename'",
"... | Retrieve an array of the archive contents. | [
"Retrieve",
"an",
"array",
"of",
"the",
"archive",
"contents",
"."
] | train | https://github.com/lootils/archiver/blob/5b801bddfe15f7378a118c4094f04b37abb5a53e/src/Lootils/Archiver/TarArchive.php#L72-L80 |
yuncms/framework | src/sms/captcha/CaptchaAction.php | CaptchaAction.init | public function init()
{
parent::init();
$this->sessionKey = $this->getSessionKey();
$this->cache = Instance::ensure($this->cache, Cache::class);
} | php | public function init()
{
parent::init();
$this->sessionKey = $this->getSessionKey();
$this->cache = Instance::ensure($this->cache, Cache::class);
} | [
"public",
"function",
"init",
"(",
")",
"{",
"parent",
"::",
"init",
"(",
")",
";",
"$",
"this",
"->",
"sessionKey",
"=",
"$",
"this",
"->",
"getSessionKey",
"(",
")",
";",
"$",
"this",
"->",
"cache",
"=",
"Instance",
"::",
"ensure",
"(",
"$",
"thi... | 初始化组件
@throws \yii\base\InvalidConfigException | [
"初始化组件"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/sms/captcha/CaptchaAction.php#L85-L90 |
yuncms/framework | src/sms/captcha/CaptchaAction.php | CaptchaAction.getVerifyCode | public function getVerifyCode($regenerate = false)
{
if ($this->fixedVerifyCode !== null) {
return $this->fixedVerifyCode;
}
$verifyCode = $this->cache->get($this->sessionKey);
if ($verifyCode === null || $regenerate) {
$verifyCode = $this->generateVerifyCode(... | php | public function getVerifyCode($regenerate = false)
{
if ($this->fixedVerifyCode !== null) {
return $this->fixedVerifyCode;
}
$verifyCode = $this->cache->get($this->sessionKey);
if ($verifyCode === null || $regenerate) {
$verifyCode = $this->generateVerifyCode(... | [
"public",
"function",
"getVerifyCode",
"(",
"$",
"regenerate",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"fixedVerifyCode",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"fixedVerifyCode",
";",
"}",
"$",
"verifyCode",
"=",
"$",
"this"... | 获取验证码
@param boolean $regenerate 是否重新生成验证码
@return string 验证码 | [
"获取验证码"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/sms/captcha/CaptchaAction.php#L139-L158 |
yuncms/framework | src/sms/captcha/CaptchaAction.php | CaptchaAction.validate | public function validate($input, $caseSensitive)
{
$code = $this->getVerifyCode();
$valid = $caseSensitive ? ($input === $code) : strcasecmp($input, $code) === 0;
$count = $this->cache->get($this->sessionKey . 'count');
$count = $count + 1;
if ($valid || $count > $this->test... | php | public function validate($input, $caseSensitive)
{
$code = $this->getVerifyCode();
$valid = $caseSensitive ? ($input === $code) : strcasecmp($input, $code) === 0;
$count = $this->cache->get($this->sessionKey . 'count');
$count = $count + 1;
if ($valid || $count > $this->test... | [
"public",
"function",
"validate",
"(",
"$",
"input",
",",
"$",
"caseSensitive",
")",
"{",
"$",
"code",
"=",
"$",
"this",
"->",
"getVerifyCode",
"(",
")",
";",
"$",
"valid",
"=",
"$",
"caseSensitive",
"?",
"(",
"$",
"input",
"===",
"$",
"code",
")",
... | 验证输入,看看它是否与生成的代码相匹配
@param string $input user input
@param boolean $caseSensitive whether the comparison should be case-sensitive
@return boolean whether the input is valid | [
"验证输入,看看它是否与生成的代码相匹配"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/sms/captcha/CaptchaAction.php#L166-L179 |
yuncms/framework | src/sms/captcha/CaptchaAction.php | CaptchaAction.validateMobile | public function validateMobile($input)
{
$mobile = $this->cache->get($this->sessionKey . 'mobile');
$valid = strcasecmp($mobile, $input) === 0;
return $valid;
} | php | public function validateMobile($input)
{
$mobile = $this->cache->get($this->sessionKey . 'mobile');
$valid = strcasecmp($mobile, $input) === 0;
return $valid;
} | [
"public",
"function",
"validateMobile",
"(",
"$",
"input",
")",
"{",
"$",
"mobile",
"=",
"$",
"this",
"->",
"cache",
"->",
"get",
"(",
"$",
"this",
"->",
"sessionKey",
".",
"'mobile'",
")",
";",
"$",
"valid",
"=",
"strcasecmp",
"(",
"$",
"mobile",
",... | 验证提交的手机号时候和接收验证码的手机号一致
@param string $input user input
@return boolean whether the input is valid | [
"验证提交的手机号时候和接收验证码的手机号一致"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/sms/captcha/CaptchaAction.php#L186-L191 |
atkrad/data-tables | src/Request.php | Request.setColumns | public function setColumns(array $columns)
{
foreach ($columns as $column) {
$this->columns[] = new Request\Column($column);
}
return $this;
} | php | public function setColumns(array $columns)
{
foreach ($columns as $column) {
$this->columns[] = new Request\Column($column);
}
return $this;
} | [
"public",
"function",
"setColumns",
"(",
"array",
"$",
"columns",
")",
"{",
"foreach",
"(",
"$",
"columns",
"as",
"$",
"column",
")",
"{",
"$",
"this",
"->",
"columns",
"[",
"]",
"=",
"new",
"Request",
"\\",
"Column",
"(",
"$",
"column",
")",
";",
... | Set Columns
@param array $columns
@return Request | [
"Set",
"Columns"
] | train | https://github.com/atkrad/data-tables/blob/5afcc337ab624ca626e29d9674459c5105982b16/src/Request.php#L73-L80 |
atkrad/data-tables | src/Request.php | Request.setOrder | public function setOrder(array $orders)
{
foreach ($orders as $order) {
$this->order[] = new Order($order);
}
return $this;
} | php | public function setOrder(array $orders)
{
foreach ($orders as $order) {
$this->order[] = new Order($order);
}
return $this;
} | [
"public",
"function",
"setOrder",
"(",
"array",
"$",
"orders",
")",
"{",
"foreach",
"(",
"$",
"orders",
"as",
"$",
"order",
")",
"{",
"$",
"this",
"->",
"order",
"[",
"]",
"=",
"new",
"Order",
"(",
"$",
"order",
")",
";",
"}",
"return",
"$",
"thi... | Set Order
@param array $orders
@return Request | [
"Set",
"Order"
] | train | https://github.com/atkrad/data-tables/blob/5afcc337ab624ca626e29d9674459c5105982b16/src/Request.php#L89-L96 |
nexusnetsoftgmbh/nexuscli | src/Nexus/Dumper/DumperDependencyProvider.php | DumperDependencyProvider.addDockerFacade | private function addDockerFacade(DependencyContainerInterface $container): DependencyContainerInterface
{
$container[self::DOCKER_FACADE] = function(DependencyContainerInterface $container) {
return $container->getLocator()->dockerClient()->facade();
};
return $container;
} | php | private function addDockerFacade(DependencyContainerInterface $container): DependencyContainerInterface
{
$container[self::DOCKER_FACADE] = function(DependencyContainerInterface $container) {
return $container->getLocator()->dockerClient()->facade();
};
return $container;
} | [
"private",
"function",
"addDockerFacade",
"(",
"DependencyContainerInterface",
"$",
"container",
")",
":",
"DependencyContainerInterface",
"{",
"$",
"container",
"[",
"self",
"::",
"DOCKER_FACADE",
"]",
"=",
"function",
"(",
"DependencyContainerInterface",
"$",
"contain... | @param \Xervice\Core\Business\Model\Dependency\DependencyContainerInterface $container
@return \Xervice\Core\Business\Model\Dependency\DependencyContainerInterface | [
"@param",
"\\",
"Xervice",
"\\",
"Core",
"\\",
"Business",
"\\",
"Model",
"\\",
"Dependency",
"\\",
"DependencyContainerInterface",
"$container"
] | train | https://github.com/nexusnetsoftgmbh/nexuscli/blob/8416b43d31ad56ea379ae2b0bf85d456e78ba67a/src/Nexus/Dumper/DumperDependencyProvider.php#L65-L72 |
picamator/CacheManager | src/ObjectManager.php | ObjectManager.create | public function create(string $className, array $arguments = [])
{
if (empty($arguments)) {
return new $className();
}
// construction does not available
if (method_exists($className, '__construct') === false) {
throw new RuntimeException(sprintf('Class "%s" ... | php | public function create(string $className, array $arguments = [])
{
if (empty($arguments)) {
return new $className();
}
// construction does not available
if (method_exists($className, '__construct') === false) {
throw new RuntimeException(sprintf('Class "%s" ... | [
"public",
"function",
"create",
"(",
"string",
"$",
"className",
",",
"array",
"$",
"arguments",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"arguments",
")",
")",
"{",
"return",
"new",
"$",
"className",
"(",
")",
";",
"}",
"// constructio... | {@inheritdoc} | [
"{"
] | train | https://github.com/picamator/CacheManager/blob/5e5493910610b65ae31a362786d7963ba3e33806/src/ObjectManager.php#L25-L38 |
picamator/CacheManager | src/ObjectManager.php | ObjectManager.getReflection | private function getReflection(string $className) : \ReflectionClass
{
if (empty($this->reflectionContainer[$className])) {
$this->reflectionContainer[$className] = new \ReflectionClass($className);
}
return $this->reflectionContainer[$className];
} | php | private function getReflection(string $className) : \ReflectionClass
{
if (empty($this->reflectionContainer[$className])) {
$this->reflectionContainer[$className] = new \ReflectionClass($className);
}
return $this->reflectionContainer[$className];
} | [
"private",
"function",
"getReflection",
"(",
"string",
"$",
"className",
")",
":",
"\\",
"ReflectionClass",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"reflectionContainer",
"[",
"$",
"className",
"]",
")",
")",
"{",
"$",
"this",
"->",
"reflectionCon... | Retrieve reflection.
@param string $className
@return \ReflectionClass | [
"Retrieve",
"reflection",
"."
] | train | https://github.com/picamator/CacheManager/blob/5e5493910610b65ae31a362786d7963ba3e33806/src/ObjectManager.php#L47-L54 |
dashifen/wordpress-php7-plugin-boilerplate | src/Loader/Loader.php | Loader.addAction | public function addAction(string $hook, ComponentInterface $component, string $handler, int $priority = 10, int $argCount = 1): void {
$this->actions[] = new Hook($hook, $component, $handler, $priority, $argCount);
} | php | public function addAction(string $hook, ComponentInterface $component, string $handler, int $priority = 10, int $argCount = 1): void {
$this->actions[] = new Hook($hook, $component, $handler, $priority, $argCount);
} | [
"public",
"function",
"addAction",
"(",
"string",
"$",
"hook",
",",
"ComponentInterface",
"$",
"component",
",",
"string",
"$",
"handler",
",",
"int",
"$",
"priority",
"=",
"10",
",",
"int",
"$",
"argCount",
"=",
"1",
")",
":",
"void",
"{",
"$",
"this"... | @param string $hook
@param ComponentInterface $component
@param string $handler
@param int $priority
@param int $argCount
@return void | [
"@param",
"string",
"$hook",
"@param",
"ComponentInterface",
"$component",
"@param",
"string",
"$handler",
"@param",
"int",
"$priority",
"@param",
"int",
"$argCount"
] | train | https://github.com/dashifen/wordpress-php7-plugin-boilerplate/blob/c7875deb403d311efca72dc3c8beb566972a56cb/src/Loader/Loader.php#L39-L41 |
dashifen/wordpress-php7-plugin-boilerplate | src/Loader/Loader.php | Loader.getAttachmentArguments | protected function getAttachmentArguments(HookInterface $hook, bool $isShortcode): array {
// both shortcodes and non-shortcodes are attached using a hook and a
// callback to start. then, non-shortcodes also get a priority and an
// argument count. we can build that array as follows and return it
// to th... | php | protected function getAttachmentArguments(HookInterface $hook, bool $isShortcode): array {
// both shortcodes and non-shortcodes are attached using a hook and a
// callback to start. then, non-shortcodes also get a priority and an
// argument count. we can build that array as follows and return it
// to th... | [
"protected",
"function",
"getAttachmentArguments",
"(",
"HookInterface",
"$",
"hook",
",",
"bool",
"$",
"isShortcode",
")",
":",
"array",
"{",
"// both shortcodes and non-shortcodes are attached using a hook and a",
"// callback to start. then, non-shortcodes also get a priority and... | @param HookInterface $hook
@param bool $isShortcode
@return array | [
"@param",
"HookInterface",
"$hook",
"@param",
"bool",
"$isShortcode"
] | train | https://github.com/dashifen/wordpress-php7-plugin-boilerplate/blob/c7875deb403d311efca72dc3c8beb566972a56cb/src/Loader/Loader.php#L121-L145 |
Chill-project/Main | Form/Type/DataTransformer/MultipleObjectsToIdTransformer.php | MultipleObjectsToIdTransformer.reverseTransform | public function reverseTransform($array)
{
$ret = new ArrayCollection();
foreach ($array as $el) {
$ret->add(
$this->em
->getRepository($this->class)
->find($el)
);
}
return $ret;
} | php | public function reverseTransform($array)
{
$ret = new ArrayCollection();
foreach ($array as $el) {
$ret->add(
$this->em
->getRepository($this->class)
->find($el)
);
}
return $ret;
} | [
"public",
"function",
"reverseTransform",
"(",
"$",
"array",
")",
"{",
"$",
"ret",
"=",
"new",
"ArrayCollection",
"(",
")",
";",
"foreach",
"(",
"$",
"array",
"as",
"$",
"el",
")",
"{",
"$",
"ret",
"->",
"add",
"(",
"$",
"this",
"->",
"em",
"->",
... | Transforms a string (id) to an object (item).
@param string $id
@return ArrayCollection | [
"Transforms",
"a",
"string",
"(",
"id",
")",
"to",
"an",
"object",
"(",
"item",
")",
"."
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Form/Type/DataTransformer/MultipleObjectsToIdTransformer.php#L72-L84 |
yuncms/framework | src/helpers/ArrayHelper.php | ArrayHelper.filterByValue | public static function filterByValue($array, $key, $value, bool $strict = false): array
{
$result = [];
foreach ($array as $i => $element) {
$elementValue = static::getValue($element, $key);
/** @noinspection TypeUnsafeComparisonInspection */
if (($strict && $ele... | php | public static function filterByValue($array, $key, $value, bool $strict = false): array
{
$result = [];
foreach ($array as $i => $element) {
$elementValue = static::getValue($element, $key);
/** @noinspection TypeUnsafeComparisonInspection */
if (($strict && $ele... | [
"public",
"static",
"function",
"filterByValue",
"(",
"$",
"array",
",",
"$",
"key",
",",
"$",
"value",
",",
"bool",
"$",
"strict",
"=",
"false",
")",
":",
"array",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"array",
"as",
"$",
... | Filters an array to only the values where a given key (the name of a
sub-array key or sub-object property) is set to a given value.
Array keys are preserved.
@param array|\Traversable $array the array that needs to be indexed or grouped
@param string|\Closure $key the column name or anonymous function which result wi... | [
"Filters",
"an",
"array",
"to",
"only",
"the",
"values",
"where",
"a",
"given",
"key",
"(",
"the",
"name",
"of",
"a",
"sub",
"-",
"array",
"key",
"or",
"sub",
"-",
"object",
"property",
")",
"is",
"set",
"to",
"a",
"given",
"value",
"."
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/helpers/ArrayHelper.php#L484-L497 |
yuncms/framework | src/helpers/ArrayHelper.php | ArrayHelper.rename | public static function rename(array &$array, string $oldKey, string $newKey, $default = null)
{
if (!array_key_exists($newKey, $array) || array_key_exists($oldKey, $array)) {
$array[$newKey] = static::remove($array, $oldKey, $default);
}
} | php | public static function rename(array &$array, string $oldKey, string $newKey, $default = null)
{
if (!array_key_exists($newKey, $array) || array_key_exists($oldKey, $array)) {
$array[$newKey] = static::remove($array, $oldKey, $default);
}
} | [
"public",
"static",
"function",
"rename",
"(",
"array",
"&",
"$",
"array",
",",
"string",
"$",
"oldKey",
",",
"string",
"$",
"newKey",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"newKey",
",",
"$",
"arra... | 重命名数组中的项目。如果新Key已经存在于数组中,并且旧Key不存在,数组将保持不变。
@param array $array the array to extract value from
@param string $oldKey old key name of the array element
@param string $newKey new key name of the array element
@param mixed $default the default value to be set if the specified old key does not exist
@return void | [
"重命名数组中的项目。如果新Key已经存在于数组中,并且旧Key不存在,数组将保持不变。"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/helpers/ArrayHelper.php#L548-L553 |
steeffeen/FancyManiaLinks | FML/Elements/Dico.php | Dico.getEntry | public function getEntry($language, $entryId)
{
if (isset($this->entries[$language]) && isset($this->entries[$language][$entryId])) {
return $this->entries[$language][$entryId];
}
return null;
} | php | public function getEntry($language, $entryId)
{
if (isset($this->entries[$language]) && isset($this->entries[$language][$entryId])) {
return $this->entries[$language][$entryId];
}
return null;
} | [
"public",
"function",
"getEntry",
"(",
"$",
"language",
",",
"$",
"entryId",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"entries",
"[",
"$",
"language",
"]",
")",
"&&",
"isset",
"(",
"$",
"this",
"->",
"entries",
"[",
"$",
"language",
"]... | Get the translatable entry
@api
@param string $language Language id
@param string $entryId Entry id
@return string | [
"Get",
"the",
"translatable",
"entry"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Elements/Dico.php#L179-L185 |
steeffeen/FancyManiaLinks | FML/Elements/Dico.php | Dico.setEntry | public function setEntry($language, $entryId, $entryValue)
{
$language = (string)$language;
$entryId = (string)$entryId;
$entryValue = (string)$entryValue;
if (!isset($this->entries[$language]) && $entryValue) {
$this->entries[$language] = array();
}
... | php | public function setEntry($language, $entryId, $entryValue)
{
$language = (string)$language;
$entryId = (string)$entryId;
$entryValue = (string)$entryValue;
if (!isset($this->entries[$language]) && $entryValue) {
$this->entries[$language] = array();
}
... | [
"public",
"function",
"setEntry",
"(",
"$",
"language",
",",
"$",
"entryId",
",",
"$",
"entryValue",
")",
"{",
"$",
"language",
"=",
"(",
"string",
")",
"$",
"language",
";",
"$",
"entryId",
"=",
"(",
"string",
")",
"$",
"entryId",
";",
"$",
"entryVa... | Set the translatable entry for the specific language
@api
@param string $language Language id
@param string $entryId Entry id
@param string $entryValue Translated entry value
@return static | [
"Set",
"the",
"translatable",
"entry",
"for",
"the",
"specific",
"language"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Elements/Dico.php#L196-L212 |
steeffeen/FancyManiaLinks | FML/Elements/Dico.php | Dico.removeEntry | public function removeEntry($entryId, $language = null)
{
$entryId = (string)$entryId;
foreach ($this->entries as $languageKey => $entries) {
if ($language && $language !== $languageKey) {
continue;
}
if (isset($this->entries[$languageKey][$entryId... | php | public function removeEntry($entryId, $language = null)
{
$entryId = (string)$entryId;
foreach ($this->entries as $languageKey => $entries) {
if ($language && $language !== $languageKey) {
continue;
}
if (isset($this->entries[$languageKey][$entryId... | [
"public",
"function",
"removeEntry",
"(",
"$",
"entryId",
",",
"$",
"language",
"=",
"null",
")",
"{",
"$",
"entryId",
"=",
"(",
"string",
")",
"$",
"entryId",
";",
"foreach",
"(",
"$",
"this",
"->",
"entries",
"as",
"$",
"languageKey",
"=>",
"$",
"e... | Remove entries of the given id
@api
@param string $entryId Entry id that should be removed
@param string $language (optional) Only remove entry from the given language
@return static | [
"Remove",
"entries",
"of",
"the",
"given",
"id"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Elements/Dico.php#L222-L234 |
steeffeen/FancyManiaLinks | FML/Elements/Dico.php | Dico.removeLanguage | public function removeLanguage($language)
{
$language = (string)$language;
if (isset($this->entries[$language])) {
unset($this->entries[$language]);
}
return $this;
} | php | public function removeLanguage($language)
{
$language = (string)$language;
if (isset($this->entries[$language])) {
unset($this->entries[$language]);
}
return $this;
} | [
"public",
"function",
"removeLanguage",
"(",
"$",
"language",
")",
"{",
"$",
"language",
"=",
"(",
"string",
")",
"$",
"language",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"entries",
"[",
"$",
"language",
"]",
")",
")",
"{",
"unset",
"(",
"... | Remove entries of the given language
@api
@param string $language Language which entries should be removed
@return static | [
"Remove",
"entries",
"of",
"the",
"given",
"language"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Elements/Dico.php#L243-L250 |
steeffeen/FancyManiaLinks | FML/Elements/Dico.php | Dico.render | public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("dico");
foreach ($this->entries as $language => $entries) {
$languageElement = $domDocument->createElement("language");
$languageElement->setAttribute("id", $language);
... | php | public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("dico");
foreach ($this->entries as $language => $entries) {
$languageElement = $domDocument->createElement("language");
$languageElement->setAttribute("id", $language);
... | [
"public",
"function",
"render",
"(",
"\\",
"DOMDocument",
"$",
"domDocument",
")",
"{",
"$",
"domElement",
"=",
"$",
"domDocument",
"->",
"createElement",
"(",
"\"dico\"",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"entries",
"as",
"$",
"language",
"=>",... | Render the Dico
@param \DOMDocument $domDocument DOMDocument for which the Dico should be rendered
@return \DOMElement | [
"Render",
"the",
"Dico"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Elements/Dico.php#L283-L296 |
gries/rcon | src/ConnectionFactory.php | ConnectionFactory.create | public static function create($host, $port, $password)
{
$factory = new \Socket\Raw\Factory();
$socket = $factory->createClient(sprintf('%s:%s', $host, $port));
return new \gries\Rcon\Connection($socket, $password);
} | php | public static function create($host, $port, $password)
{
$factory = new \Socket\Raw\Factory();
$socket = $factory->createClient(sprintf('%s:%s', $host, $port));
return new \gries\Rcon\Connection($socket, $password);
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"host",
",",
"$",
"port",
",",
"$",
"password",
")",
"{",
"$",
"factory",
"=",
"new",
"\\",
"Socket",
"\\",
"Raw",
"\\",
"Factory",
"(",
")",
";",
"$",
"socket",
"=",
"$",
"factory",
"->",
"create... | Create a new RconConnection
@param $host
@param $port
@param $password
@return \gries\Rcon\Connection | [
"Create",
"a",
"new",
"RconConnection"
] | train | https://github.com/gries/rcon/blob/7fada05b329d89542692af00ab80db02ad59d45d/src/ConnectionFactory.php#L21-L27 |
periaptio/empress-generator | src/Commands/FactoryMakeCommand.php | FactoryMakeCommand.handle | public function handle()
{
parent::handle();
$this->comment('\nGenerating factory for : '. implode(',', $this->tables));
if ($this->option('models')) {
$this->models = explode(',', $this->option('models'));
}
$configData = $this->getConfigData();
$fact... | php | public function handle()
{
parent::handle();
$this->comment('\nGenerating factory for : '. implode(',', $this->tables));
if ($this->option('models')) {
$this->models = explode(',', $this->option('models'));
}
$configData = $this->getConfigData();
$fact... | [
"public",
"function",
"handle",
"(",
")",
"{",
"parent",
"::",
"handle",
"(",
")",
";",
"$",
"this",
"->",
"comment",
"(",
"'\\nGenerating factory for : '",
".",
"implode",
"(",
"','",
",",
"$",
"this",
"->",
"tables",
")",
")",
";",
"if",
"(",
"$",
... | Execute the command.
@return void | [
"Execute",
"the",
"command",
"."
] | train | https://github.com/periaptio/empress-generator/blob/749fb4b12755819e9c97377ebfb446ee0822168a/src/Commands/FactoryMakeCommand.php#L47-L75 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Controller/UserController.php | UserController.createAction | public function createAction(Request $request)
{
$oUser = new User();
$form = $this->createCreateForm($oUser);
$form->handleRequest($request);
if ($form->isValid()) {
$factory = $this->get('security.encoder_factory');
$encoder =... | php | public function createAction(Request $request)
{
$oUser = new User();
$form = $this->createCreateForm($oUser);
$form->handleRequest($request);
if ($form->isValid()) {
$factory = $this->get('security.encoder_factory');
$encoder =... | [
"public",
"function",
"createAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"oUser",
"=",
"new",
"User",
"(",
")",
";",
"$",
"form",
"=",
"$",
"this",
"->",
"createCreateForm",
"(",
"$",
"oUser",
")",
";",
"$",
"form",
"->",
"handleRequest",
... | Creates a new User entity.
@param \Symfony\Component\HttpFoundation\Request $request
@return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
@throws \Exception
@throws \PropelException | [
"Creates",
"a",
"new",
"User",
"entity",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Controller/UserController.php#L65-L86 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Controller/UserController.php | UserController.newAction | public function newAction()
{
$oUser = new User();
$form = $this->createCreateForm($oUser);
return $this->render('SlashworksBackendBundle:User:new.html.twig', array(
'entity' => $oUser,
'form' => $form->createView(),
));
... | php | public function newAction()
{
$oUser = new User();
$form = $this->createCreateForm($oUser);
return $this->render('SlashworksBackendBundle:User:new.html.twig', array(
'entity' => $oUser,
'form' => $form->createView(),
));
... | [
"public",
"function",
"newAction",
"(",
")",
"{",
"$",
"oUser",
"=",
"new",
"User",
"(",
")",
";",
"$",
"form",
"=",
"$",
"this",
"->",
"createCreateForm",
"(",
"$",
"oUser",
")",
";",
"return",
"$",
"this",
"->",
"render",
"(",
"'SlashworksBackendBund... | Displays a form to create a new User entity.
@return \Symfony\Component\HttpFoundation\Response | [
"Displays",
"a",
"form",
"to",
"create",
"a",
"new",
"User",
"entity",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Controller/UserController.php#L94-L103 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Controller/UserController.php | UserController.editAction | public function editAction($id)
{
/** @var User $oUser */
$oUser = UserQuery::create()->findOneById($id);
if (count($oUser) === 0) {
throw $this->createNotFoundException('Unable to find User entity.');
}
$editForm = $this->createEditF... | php | public function editAction($id)
{
/** @var User $oUser */
$oUser = UserQuery::create()->findOneById($id);
if (count($oUser) === 0) {
throw $this->createNotFoundException('Unable to find User entity.');
}
$editForm = $this->createEditF... | [
"public",
"function",
"editAction",
"(",
"$",
"id",
")",
"{",
"/** @var User $oUser */",
"$",
"oUser",
"=",
"UserQuery",
"::",
"create",
"(",
")",
"->",
"findOneById",
"(",
"$",
"id",
")",
";",
"if",
"(",
"count",
"(",
"$",
"oUser",
")",
"===",
"0",
... | Displays a form to edit an existing User entity.
@param $id
@return \Symfony\Component\HttpFoundation\Response | [
"Displays",
"a",
"form",
"to",
"edit",
"an",
"existing",
"User",
"entity",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Controller/UserController.php#L113-L133 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Controller/UserController.php | UserController.updateAction | public function updateAction(Request $request, $id)
{
/** @var User $oUser */
$oUser = UserQuery::create()->findOneById($id);
if (count($oUser) === 0) {
throw $this->createNotFoundException('Unable to find User entity.');
}
$deleteFo... | php | public function updateAction(Request $request, $id)
{
/** @var User $oUser */
$oUser = UserQuery::create()->findOneById($id);
if (count($oUser) === 0) {
throw $this->createNotFoundException('Unable to find User entity.');
}
$deleteFo... | [
"public",
"function",
"updateAction",
"(",
"Request",
"$",
"request",
",",
"$",
"id",
")",
"{",
"/** @var User $oUser */",
"$",
"oUser",
"=",
"UserQuery",
"::",
"create",
"(",
")",
"->",
"findOneById",
"(",
"$",
"id",
")",
";",
"if",
"(",
"count",
"(",
... | Edits an existing User entity.
@param \Symfony\Component\HttpFoundation\Request $request
@param $id
@return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response | [
"Edits",
"an",
"existing",
"User",
"entity",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Controller/UserController.php#L144-L193 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Controller/UserController.php | UserController.deleteAction | public function deleteAction(Request $request, $id)
{
/** @var User $oUser */
$oUser = UserQuery::create()->findOneById($id);
if (count($oUser) === 0) {
throw $this->createNotFoundException('Unable to find User entity.');
}
$oUser->de... | php | public function deleteAction(Request $request, $id)
{
/** @var User $oUser */
$oUser = UserQuery::create()->findOneById($id);
if (count($oUser) === 0) {
throw $this->createNotFoundException('Unable to find User entity.');
}
$oUser->de... | [
"public",
"function",
"deleteAction",
"(",
"Request",
"$",
"request",
",",
"$",
"id",
")",
"{",
"/** @var User $oUser */",
"$",
"oUser",
"=",
"UserQuery",
"::",
"create",
"(",
")",
"->",
"findOneById",
"(",
"$",
"id",
")",
";",
"if",
"(",
"count",
"(",
... | Deletes a User entity.
@param \Symfony\Component\HttpFoundation\Request $request
@param $id
@return \Symfony\Component\HttpFoundation\RedirectResponse
@throws \Exception
@throws \PropelException | [
"Deletes",
"a",
"User",
"entity",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Controller/UserController.php#L206-L218 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Controller/UserController.php | UserController.createEditForm | private function createEditForm(User $oUser)
{
$form = $this->createForm(new UserType(), $oUser, array(
'action' => $this->generateUrl('backend_system_user_update', array('id' => $oUser->getId())),
'method' => 'PUT',
));
$form->add('submit', '... | php | private function createEditForm(User $oUser)
{
$form = $this->createForm(new UserType(), $oUser, array(
'action' => $this->generateUrl('backend_system_user_update', array('id' => $oUser->getId())),
'method' => 'PUT',
));
$form->add('submit', '... | [
"private",
"function",
"createEditForm",
"(",
"User",
"$",
"oUser",
")",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"createForm",
"(",
"new",
"UserType",
"(",
")",
",",
"$",
"oUser",
",",
"array",
"(",
"'action'",
"=>",
"$",
"this",
"->",
"generateUrl",... | Creates a form to edit a User entity.
@param User $entity The entity
@return \Symfony\Component\Form\Form The form | [
"Creates",
"a",
"form",
"to",
"edit",
"a",
"User",
"entity",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Controller/UserController.php#L248-L258 |
Ocramius/OcraDiCompiler | src/OcraDiCompiler/Mvc/Service/ControllerLoaderFactory.php | ControllerLoaderFactory.createService | public function createService(ServiceLocatorInterface $serviceLocator)
{
$controllerLoader = new ControllerManager();
$controllerLoader->setServiceLocator($serviceLocator);
$controllerLoader->addPeeringServiceManager($serviceLocator);
$config = $serviceLocator->get('Config');
... | php | public function createService(ServiceLocatorInterface $serviceLocator)
{
$controllerLoader = new ControllerManager();
$controllerLoader->setServiceLocator($serviceLocator);
$controllerLoader->addPeeringServiceManager($serviceLocator);
$config = $serviceLocator->get('Config');
... | [
"public",
"function",
"createService",
"(",
"ServiceLocatorInterface",
"$",
"serviceLocator",
")",
"{",
"$",
"controllerLoader",
"=",
"new",
"ControllerManager",
"(",
")",
";",
"$",
"controllerLoader",
"->",
"setServiceLocator",
"(",
"$",
"serviceLocator",
")",
";",... | Create the controller loader service
Creates and returns an instance of Controller\ControllerManager. The
only controllers this manager will allow are those defined in the
application configuration's "controllers" array. If a controller is
matched, the scoped manager will attempt to load the controller.
Finally, it wi... | [
"Create",
"the",
"controller",
"loader",
"service"
] | train | https://github.com/Ocramius/OcraDiCompiler/blob/667f4b24771f27fb9c8d6c38ffaf72d9cd55ca4a/src/OcraDiCompiler/Mvc/Service/ControllerLoaderFactory.php#L51-L70 |
maniaplanet/maniaplanet-ws-sdk | libraries/Maniaplanet/WebServices/ManiaConnect/Client.php | Client.getLoginURL | function getLoginURL($scope = null, $redirectURI = null)
{
$redirectURI = $redirectURI ? : $this->getCurrentURI();
self::$persistance->setVariable('redirect_uri', $redirectURI);
return $this->getAuthorizationURL($redirectURI, $scope);
} | php | function getLoginURL($scope = null, $redirectURI = null)
{
$redirectURI = $redirectURI ? : $this->getCurrentURI();
self::$persistance->setVariable('redirect_uri', $redirectURI);
return $this->getAuthorizationURL($redirectURI, $scope);
} | [
"function",
"getLoginURL",
"(",
"$",
"scope",
"=",
"null",
",",
"$",
"redirectURI",
"=",
"null",
")",
"{",
"$",
"redirectURI",
"=",
"$",
"redirectURI",
"?",
":",
"$",
"this",
"->",
"getCurrentURI",
"(",
")",
";",
"self",
"::",
"$",
"persistance",
"->",... | When a user is not authentified, you need to create a link to the URL
returned by this method.
@param string $scope Space-separated list of scopes. Leave empty if you just need the basic one
@param string $redirectURI Where to redirect the user after auth. Leave empty for the current URI
@return string Login URL | [
"When",
"a",
"user",
"is",
"not",
"authentified",
"you",
"need",
"to",
"create",
"a",
"link",
"to",
"the",
"URL",
"returned",
"by",
"this",
"method",
"."
] | train | https://github.com/maniaplanet/maniaplanet-ws-sdk/blob/027a458388035fe66f2f56ff3ea1f85eff2a5a4e/libraries/Maniaplanet/WebServices/ManiaConnect/Client.php#L72-L77 |
maniaplanet/maniaplanet-ws-sdk | libraries/Maniaplanet/WebServices/ManiaConnect/Client.php | Client.getLogoutURL | function getLogoutURL($redirectURI = null)
{
$redirectURI = $redirectURI ? : $this->getCurrentURI();
return $this->logoutURL.'?'.http_build_query(array('redirect_uri' => $redirectURI),
'', '&');
} | php | function getLogoutURL($redirectURI = null)
{
$redirectURI = $redirectURI ? : $this->getCurrentURI();
return $this->logoutURL.'?'.http_build_query(array('redirect_uri' => $redirectURI),
'', '&');
} | [
"function",
"getLogoutURL",
"(",
"$",
"redirectURI",
"=",
"null",
")",
"{",
"$",
"redirectURI",
"=",
"$",
"redirectURI",
"?",
":",
"$",
"this",
"->",
"getCurrentURI",
"(",
")",
";",
"return",
"$",
"this",
"->",
"logoutURL",
".",
"'?'",
".",
"http_build_q... | If you want to place a "logout" button, you can use this link to log the
user out of the player page too. Don't forget to empty your sessions .
@see \Maniaplanet\WebServices\ManiaConnect\Client::logout()
@param string $redirectURI Where to redirect the user after he logged out. Leave empty for current URI
@return stri... | [
"If",
"you",
"want",
"to",
"place",
"a",
"logout",
"button",
"you",
"can",
"use",
"this",
"link",
"to",
"log",
"the",
"user",
"out",
"of",
"the",
"player",
"page",
"too",
".",
"Don",
"t",
"forget",
"to",
"empty",
"your",
"sessions",
"."
] | train | https://github.com/maniaplanet/maniaplanet-ws-sdk/blob/027a458388035fe66f2f56ff3ea1f85eff2a5a4e/libraries/Maniaplanet/WebServices/ManiaConnect/Client.php#L87-L92 |
maniaplanet/maniaplanet-ws-sdk | libraries/Maniaplanet/WebServices/ManiaConnect/Client.php | Client.getCurrentURI | protected function getCurrentURI()
{
$protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://';
$current_uri = $protocol.$_SERVER['HTTP_HOST'].$this->getRequestURI();
$parts = parse_url($current_uri);
$query = '';
if(!empty($parts['query']))
{
$params = array();
pars... | php | protected function getCurrentURI()
{
$protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://';
$current_uri = $protocol.$_SERVER['HTTP_HOST'].$this->getRequestURI();
$parts = parse_url($current_uri);
$query = '';
if(!empty($parts['query']))
{
$params = array();
pars... | [
"protected",
"function",
"getCurrentURI",
"(",
")",
"{",
"$",
"protocol",
"=",
"isset",
"(",
"$",
"_SERVER",
"[",
"'HTTPS'",
"]",
")",
"&&",
"$",
"_SERVER",
"[",
"'HTTPS'",
"]",
"==",
"'on'",
"?",
"'https://'",
":",
"'http://'",
";",
"$",
"current_uri",
... | Returns the Current URL.
@return string The current URL.
@see http://code.google.com/p/oauth2-php
@author Originally written by Naitik Shah <naitik@facebook.com>.
@author Update to draft v10 by Edison Wong <hswong3i@pantarei-design.com> | [
"Returns",
"the",
"Current",
"URL",
"."
] | train | https://github.com/maniaplanet/maniaplanet-ws-sdk/blob/027a458388035fe66f2f56ff3ea1f85eff2a5a4e/libraries/Maniaplanet/WebServices/ManiaConnect/Client.php#L111-L136 |
maniaplanet/maniaplanet-ws-sdk | libraries/Maniaplanet/WebServices/ManiaConnect/Client.php | Client.getAccessToken | protected function getAccessToken()
{
$token = self::$persistance->getVariable('token');
if(!$this->isAccessTokenExpired($token))
{
return $token->access_token;
}
else if ($token !== null && $token->refresh_token !== null)
{
$token = $this->getTokenFromRefreshToken($token->refresh_token);
return $... | php | protected function getAccessToken()
{
$token = self::$persistance->getVariable('token');
if(!$this->isAccessTokenExpired($token))
{
return $token->access_token;
}
else if ($token !== null && $token->refresh_token !== null)
{
$token = $this->getTokenFromRefreshToken($token->refresh_token);
return $... | [
"protected",
"function",
"getAccessToken",
"(",
")",
"{",
"$",
"token",
"=",
"self",
"::",
"$",
"persistance",
"->",
"getVariable",
"(",
"'token'",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"isAccessTokenExpired",
"(",
"$",
"token",
")",
")",
"{",
"... | Tries to get an access token.
If one is found in the session, it returns it.
If a code is found in the request, it tries to exchange it for an access
token on the OAuth2 Token Endpoint
Else it returns false
@return string An OAuth2 access token, or false if none is found | [
"Tries",
"to",
"get",
"an",
"access",
"token",
".",
"If",
"one",
"is",
"found",
"in",
"the",
"session",
"it",
"returns",
"it",
".",
"If",
"a",
"code",
"is",
"found",
"in",
"the",
"request",
"it",
"tries",
"to",
"exchange",
"it",
"for",
"an",
"access"... | train | https://github.com/maniaplanet/maniaplanet-ws-sdk/blob/027a458388035fe66f2f56ff3ea1f85eff2a5a4e/libraries/Maniaplanet/WebServices/ManiaConnect/Client.php#L193-L221 |
maniaplanet/maniaplanet-ws-sdk | libraries/Maniaplanet/WebServices/ManiaConnect/Client.php | Client.executeOAuth2 | protected function executeOAuth2($method, $ressource, array $params = array())
{
$this->headers['authorization'] = sprintf('Authorization: Bearer %s', $this->getAccessToken());
// We don't need auth since we are using an access token
$this->enableAuth = false;
try
{
$result = $this->execute($method, $ress... | php | protected function executeOAuth2($method, $ressource, array $params = array())
{
$this->headers['authorization'] = sprintf('Authorization: Bearer %s', $this->getAccessToken());
// We don't need auth since we are using an access token
$this->enableAuth = false;
try
{
$result = $this->execute($method, $ress... | [
"protected",
"function",
"executeOAuth2",
"(",
"$",
"method",
",",
"$",
"ressource",
",",
"array",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"headers",
"[",
"'authorization'",
"]",
"=",
"sprintf",
"(",
"'Authorization: Bearer %s'",
... | Executes an request on the API with an OAuth2 access token.
It works just like its parent execute() method.
@see \Maniaplanet\WebServices\HTTPClient::execute() | [
"Executes",
"an",
"request",
"on",
"the",
"API",
"with",
"an",
"OAuth2",
"access",
"token",
".",
"It",
"works",
"just",
"like",
"its",
"parent",
"execute",
"()",
"method",
"."
] | train | https://github.com/maniaplanet/maniaplanet-ws-sdk/blob/027a458388035fe66f2f56ff3ea1f85eff2a5a4e/libraries/Maniaplanet/WebServices/ManiaConnect/Client.php#L304-L320 |
digitalkaoz/versioneye-php | src/Output/Projects.php | Projects.all | public function all(OutputInterface $output, array $response)
{
$this->printTable($output,
['Key', 'Name', 'Type', 'Public', 'Dependencies', 'Outdated', 'Updated At', 'Bad Licenses', 'Unknown Licenses'],
['ids', 'name', 'project_type', 'public', 'dep_number', 'out_number', 'updated_a... | php | public function all(OutputInterface $output, array $response)
{
$this->printTable($output,
['Key', 'Name', 'Type', 'Public', 'Dependencies', 'Outdated', 'Updated At', 'Bad Licenses', 'Unknown Licenses'],
['ids', 'name', 'project_type', 'public', 'dep_number', 'out_number', 'updated_a... | [
"public",
"function",
"all",
"(",
"OutputInterface",
"$",
"output",
",",
"array",
"$",
"response",
")",
"{",
"$",
"this",
"->",
"printTable",
"(",
"$",
"output",
",",
"[",
"'Key'",
",",
"'Name'",
",",
"'Type'",
",",
"'Public'",
",",
"'Dependencies'",
","... | output for projects API.
@param OutputInterface $output
@param array $response | [
"output",
"for",
"projects",
"API",
"."
] | train | https://github.com/digitalkaoz/versioneye-php/blob/7b8eb9cdc83e01138dda0e709c07e3beb6aad136/src/Output/Projects.php#L20-L38 |
digitalkaoz/versioneye-php | src/Output/Projects.php | Projects.licenses | public function licenses(OutputInterface $output, array $response)
{
$table = $this->createTable($output);
$table->setHeaders(['license', 'name']);
foreach ($response['licenses'] as $license => $projects) {
foreach ($projects as $project) {
$name = $license ==... | php | public function licenses(OutputInterface $output, array $response)
{
$table = $this->createTable($output);
$table->setHeaders(['license', 'name']);
foreach ($response['licenses'] as $license => $projects) {
foreach ($projects as $project) {
$name = $license ==... | [
"public",
"function",
"licenses",
"(",
"OutputInterface",
"$",
"output",
",",
"array",
"$",
"response",
")",
"{",
"$",
"table",
"=",
"$",
"this",
"->",
"createTable",
"(",
"$",
"output",
")",
";",
"$",
"table",
"->",
"setHeaders",
"(",
"[",
"'license'",
... | output for licenses API.
@param OutputInterface $output
@param array $response | [
"output",
"for",
"licenses",
"API",
"."
] | train | https://github.com/digitalkaoz/versioneye-php/blob/7b8eb9cdc83e01138dda0e709c07e3beb6aad136/src/Output/Projects.php#L46-L61 |
digitalkaoz/versioneye-php | src/Output/Projects.php | Projects.output | private function output(OutputInterface $output, array $response)
{
$this->printList($output,
['Name', 'Key', 'Type', 'Public', 'Outdated', 'Updated At', 'Bad Licenses', 'Unknown Licenses'],
['name', 'id', 'project_type', 'public', 'out_number', 'updated_at', 'licenses_red', 'license... | php | private function output(OutputInterface $output, array $response)
{
$this->printList($output,
['Name', 'Key', 'Type', 'Public', 'Outdated', 'Updated At', 'Bad Licenses', 'Unknown Licenses'],
['name', 'id', 'project_type', 'public', 'out_number', 'updated_at', 'licenses_red', 'license... | [
"private",
"function",
"output",
"(",
"OutputInterface",
"$",
"output",
",",
"array",
"$",
"response",
")",
"{",
"$",
"this",
"->",
"printList",
"(",
"$",
"output",
",",
"[",
"'Name'",
",",
"'Key'",
",",
"'Type'",
",",
"'Public'",
",",
"'Outdated'",
",",... | default output for create/show/update.
@param OutputInterface $output
@param array $response | [
"default",
"output",
"for",
"create",
"/",
"show",
"/",
"update",
"."
] | train | https://github.com/digitalkaoz/versioneye-php/blob/7b8eb9cdc83e01138dda0e709c07e3beb6aad136/src/Output/Projects.php#L113-L154 |
lelivrescolaire/SQSBundle | Model/SQS.php | SQS.createQueue | public function createQueue(QueueInterface $queue)
{
$response = $this->getClient()->createQueue(array(
"QueueName" => $queue->getName()
));
$queue->setUrl(trim($response->get('QueueUrl')));
return $queue;
} | php | public function createQueue(QueueInterface $queue)
{
$response = $this->getClient()->createQueue(array(
"QueueName" => $queue->getName()
));
$queue->setUrl(trim($response->get('QueueUrl')));
return $queue;
} | [
"public",
"function",
"createQueue",
"(",
"QueueInterface",
"$",
"queue",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"getClient",
"(",
")",
"->",
"createQueue",
"(",
"array",
"(",
"\"QueueName\"",
"=>",
"$",
"queue",
"->",
"getName",
"(",
")",
")... | {@inheritDoc} | [
"{"
] | train | https://github.com/lelivrescolaire/SQSBundle/blob/bba3fa6d63d0ae1bddbc7b2fe3c2e737f49d6559/Model/SQS.php#L83-L92 |
lelivrescolaire/SQSBundle | Model/SQS.php | SQS.listQueues | public function listQueues($prefix = null)
{
$response = $this->getClient()->listQueues(array(
'QueueNamePrefix' => ($prefix ?: '')
));
$service = $this;
$queues = array_map(function ($queueUrl) use ($service) {
$queueName = $service->getQueueFactory()->getN... | php | public function listQueues($prefix = null)
{
$response = $this->getClient()->listQueues(array(
'QueueNamePrefix' => ($prefix ?: '')
));
$service = $this;
$queues = array_map(function ($queueUrl) use ($service) {
$queueName = $service->getQueueFactory()->getN... | [
"public",
"function",
"listQueues",
"(",
"$",
"prefix",
"=",
"null",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"getClient",
"(",
")",
"->",
"listQueues",
"(",
"array",
"(",
"'QueueNamePrefix'",
"=>",
"(",
"$",
"prefix",
"?",
":",
"''",
")",
... | {@inheritDoc} | [
"{"
] | train | https://github.com/lelivrescolaire/SQSBundle/blob/bba3fa6d63d0ae1bddbc7b2fe3c2e737f49d6559/Model/SQS.php#L109-L123 |
sebastiaanluca/laravel-unbreakable-migrations | src/TransactionalMigration.php | TransactionalMigration.executeInTransaction | protected function executeInTransaction(string $method) : void
{
try {
$this->database->beginTransaction();
$this->{$method}();
$this->database->commit();
} catch (Exception $exception) {
$this->database->rollBack();
$this->handleExcepti... | php | protected function executeInTransaction(string $method) : void
{
try {
$this->database->beginTransaction();
$this->{$method}();
$this->database->commit();
} catch (Exception $exception) {
$this->database->rollBack();
$this->handleExcepti... | [
"protected",
"function",
"executeInTransaction",
"(",
"string",
"$",
"method",
")",
":",
"void",
"{",
"try",
"{",
"$",
"this",
"->",
"database",
"->",
"beginTransaction",
"(",
")",
";",
"$",
"this",
"->",
"{",
"$",
"method",
"}",
"(",
")",
";",
"$",
... | Execute the migration command inside a transaction layer.
@param string $method
@return void | [
"Execute",
"the",
"migration",
"command",
"inside",
"a",
"transaction",
"layer",
"."
] | train | https://github.com/sebastiaanluca/laravel-unbreakable-migrations/blob/3c831b204770b80c97351c3b881dcbf924236a13/src/TransactionalMigration.php#L38-L51 |
datasift/php_webdriver | src/php/DataSift/WebDriver/WebDriverContainer.php | WebDriverContainer.getElement | public function getElement($using, $value)
{
// try to get the requested element from the open session
try {
$results = $this->curl(
'POST',
'/element',
array(
'using' => $using,
'value' => $value
... | php | public function getElement($using, $value)
{
// try to get the requested element from the open session
try {
$results = $this->curl(
'POST',
'/element',
array(
'using' => $using,
'value' => $value
... | [
"public",
"function",
"getElement",
"(",
"$",
"using",
",",
"$",
"value",
")",
"{",
"// try to get the requested element from the open session",
"try",
"{",
"$",
"results",
"=",
"$",
"this",
"->",
"curl",
"(",
"'POST'",
",",
"'/element'",
",",
"array",
"(",
"'... | retrieve an element from the currently loaded page
@param string $using the search strategy
@param string $value the term to search for
@return WebDriverElement the element that has been searched for | [
"retrieve",
"an",
"element",
"from",
"the",
"currently",
"loaded",
"page"
] | train | https://github.com/datasift/php_webdriver/blob/efca991198616b53c8f40b59ad05306e2b10e7f0/src/php/DataSift/WebDriver/WebDriverContainer.php#L51-L80 |
datasift/php_webdriver | src/php/DataSift/WebDriver/WebDriverContainer.php | WebDriverContainer.getElements | public function getElements($using, $value)
{
try {
$results = $this->curl(
'POST',
'/elements',
array(
'using' => $using,
'value' => $value
)
);
}
catch (E5xx_NoSu... | php | public function getElements($using, $value)
{
try {
$results = $this->curl(
'POST',
'/elements',
array(
'using' => $using,
'value' => $value
)
);
}
catch (E5xx_NoSu... | [
"public",
"function",
"getElements",
"(",
"$",
"using",
",",
"$",
"value",
")",
"{",
"try",
"{",
"$",
"results",
"=",
"$",
"this",
"->",
"curl",
"(",
"'POST'",
",",
"'/elements'",
",",
"array",
"(",
"'using'",
"=>",
"$",
"using",
",",
"'value'",
"=>"... | Find all occurances of an element on the current page
@param string $using the search strategy
@param string $value the term to search for
@return array(WebDriverElement) | [
"Find",
"all",
"occurances",
"of",
"an",
"element",
"on",
"the",
"current",
"page"
] | train | https://github.com/datasift/php_webdriver/blob/efca991198616b53c8f40b59ad05306e2b10e7f0/src/php/DataSift/WebDriver/WebDriverContainer.php#L90-L125 |
datasift/php_webdriver | src/php/DataSift/WebDriver/WebDriverContainer.php | WebDriverContainer.newWebDriverElement | protected function newWebDriverElement($value)
{
// is the returned element in the format we expect?
if (!array_key_exists('ELEMENT', (array) $value)) {
// no, it is not
return null;
}
return new WebDriverElement(
$this->getElementPath($value['ELE... | php | protected function newWebDriverElement($value)
{
// is the returned element in the format we expect?
if (!array_key_exists('ELEMENT', (array) $value)) {
// no, it is not
return null;
}
return new WebDriverElement(
$this->getElementPath($value['ELE... | [
"protected",
"function",
"newWebDriverElement",
"(",
"$",
"value",
")",
"{",
"// is the returned element in the format we expect?",
"if",
"(",
"!",
"array_key_exists",
"(",
"'ELEMENT'",
",",
"(",
"array",
")",
"$",
"value",
")",
")",
"{",
"// no, it is not",
"return... | helper method to wrap an element inside the WebDriverElement
object
@param array $value the raw element data returned from webdriver
@return WebDriverElement the WebDriverElement object for the raw
element | [
"helper",
"method",
"to",
"wrap",
"an",
"element",
"inside",
"the",
"WebDriverElement",
"object"
] | train | https://github.com/datasift/php_webdriver/blob/efca991198616b53c8f40b59ad05306e2b10e7f0/src/php/DataSift/WebDriver/WebDriverContainer.php#L136-L148 |
xinix-technology/norm | src/Norm/Collection.php | Collection.schema | public function schema($key = null, $value = null)
{
$numArgs = func_num_args();
if (0 === $numArgs) {
return $this->schema;
} elseif (1 === $numArgs) {
if (is_array($key)) {
$this->schema = new NObject($key);
} elseif ($this->schema->offse... | php | public function schema($key = null, $value = null)
{
$numArgs = func_num_args();
if (0 === $numArgs) {
return $this->schema;
} elseif (1 === $numArgs) {
if (is_array($key)) {
$this->schema = new NObject($key);
} elseif ($this->schema->offse... | [
"public",
"function",
"schema",
"(",
"$",
"key",
"=",
"null",
",",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"numArgs",
"=",
"func_num_args",
"(",
")",
";",
"if",
"(",
"0",
"===",
"$",
"numArgs",
")",
"{",
"return",
"$",
"this",
"->",
"schema",
"... | Getter and setter of collection schema. If there is no argument specified, the method will set and override schema. If argument specified, method will act as getter to specific field schema.
@param string $schema
@return mixed | [
"Getter",
"and",
"setter",
"of",
"collection",
"schema",
".",
"If",
"there",
"is",
"no",
"argument",
"specified",
"the",
"method",
"will",
"set",
"and",
"override",
"schema",
".",
"If",
"argument",
"specified",
"method",
"will",
"act",
"as",
"getter",
"to",
... | train | https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Collection.php#L172-L186 |
xinix-technology/norm | src/Norm/Collection.php | Collection.prepare | public function prepare($key, $value, $schema = null)
{
if (is_null($schema)) {
$schema = $this->schema($key);
if (is_null($schema)) {
return $value;
// throw new \Exception('Cannot prepare data to set. Schema not found for key ['.$key.'].');
... | php | public function prepare($key, $value, $schema = null)
{
if (is_null($schema)) {
$schema = $this->schema($key);
if (is_null($schema)) {
return $value;
// throw new \Exception('Cannot prepare data to set. Schema not found for key ['.$key.'].');
... | [
"public",
"function",
"prepare",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"schema",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"schema",
")",
")",
"{",
"$",
"schema",
"=",
"$",
"this",
"->",
"schema",
"(",
"$",
"key",
")",
";",... | Prepare data value for specific field name
@param string $key Field name
@param mixed $value Original data value
@param Norm\Schema\Field $schema If specified will override default schema
@return mixed Prepared data value | [
"Prepare",
"data",
"value",
"for",
"specific",
"field",
"name"
] | train | https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Collection.php#L197-L207 |
xinix-technology/norm | src/Norm/Collection.php | Collection.attach | public function attach($document)
{
if (isset($this->connection)) {
$document = $this->connection->unmarshall($document);
}
// wrap document as NObject instance to make sure it can be override by hooks
$document = new NObject($document);
$this->applyHook('attach... | php | public function attach($document)
{
if (isset($this->connection)) {
$document = $this->connection->unmarshall($document);
}
// wrap document as NObject instance to make sure it can be override by hooks
$document = new NObject($document);
$this->applyHook('attach... | [
"public",
"function",
"attach",
"(",
"$",
"document",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"connection",
")",
")",
"{",
"$",
"document",
"=",
"$",
"this",
"->",
"connection",
"->",
"unmarshall",
"(",
"$",
"document",
")",
";",
"}",
... | Attach document to Norm system as model.
@param mixed document Raw document data
@return Norm\Model Attached model | [
"Attach",
"document",
"to",
"Norm",
"system",
"as",
"model",
"."
] | train | https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Collection.php#L216-L241 |
xinix-technology/norm | src/Norm/Collection.php | Collection.find | public function find($criteria = array())
{
if (!is_array($criteria)) {
$criteria = array(
'$id' => $criteria,
);
}
// wrap criteria as NObject instance to make sure it can be override by hooks
$criteria = new NObject($criteria);
$thi... | php | public function find($criteria = array())
{
if (!is_array($criteria)) {
$criteria = array(
'$id' => $criteria,
);
}
// wrap criteria as NObject instance to make sure it can be override by hooks
$criteria = new NObject($criteria);
$thi... | [
"public",
"function",
"find",
"(",
"$",
"criteria",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"criteria",
")",
")",
"{",
"$",
"criteria",
"=",
"array",
"(",
"'$id'",
"=>",
"$",
"criteria",
",",
")",
";",
"}",
"// wra... | Find data with specified criteria
@param array $criteria
@return Norm\Cursor | [
"Find",
"data",
"with",
"specified",
"criteria"
] | train | https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Collection.php#L250-L266 |
xinix-technology/norm | src/Norm/Collection.php | Collection.findOne | public function findOne($criteria = array())
{
$model = $this->fetchCache($criteria);
if (is_null($model)) {
$cursor = $this->find($criteria);
$model = $cursor->getNext();
$this->rememberCache($criteria, $model);
}
return $model;
} | php | public function findOne($criteria = array())
{
$model = $this->fetchCache($criteria);
if (is_null($model)) {
$cursor = $this->find($criteria);
$model = $cursor->getNext();
$this->rememberCache($criteria, $model);
}
return $model;
} | [
"public",
"function",
"findOne",
"(",
"$",
"criteria",
"=",
"array",
"(",
")",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"fetchCache",
"(",
"$",
"criteria",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"model",
")",
")",
"{",
"$",
"cursor",
"=... | Find one document from collection
@param array|mixed $criteria Criteria to search
@return Norm\Model | [
"Find",
"one",
"document",
"from",
"collection"
] | train | https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Collection.php#L275-L286 |
xinix-technology/norm | src/Norm/Collection.php | Collection.newInstance | public function newInstance($cloned = array())
{
if ($cloned instanceof Model) {
$cloned = $cloned->toArray(Model::FETCH_PUBLISHED);
}
if (isset($this->options['model'])) {
$Model = $this->options['model'];
return new $Model($cloned, array('collection' =>... | php | public function newInstance($cloned = array())
{
if ($cloned instanceof Model) {
$cloned = $cloned->toArray(Model::FETCH_PUBLISHED);
}
if (isset($this->options['model'])) {
$Model = $this->options['model'];
return new $Model($cloned, array('collection' =>... | [
"public",
"function",
"newInstance",
"(",
"$",
"cloned",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"$",
"cloned",
"instanceof",
"Model",
")",
"{",
"$",
"cloned",
"=",
"$",
"cloned",
"->",
"toArray",
"(",
"Model",
"::",
"FETCH_PUBLISHED",
")",
";",
... | Create new instance of model
@param array|\Norm\Model $cloned Model to clone
@return \Norm\Model | [
"Create",
"new",
"instance",
"of",
"model"
] | train | https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Collection.php#L295-L307 |
xinix-technology/norm | src/Norm/Collection.php | Collection.filter | public function filter(Model $model, $key = null)
{
if (is_null($this->filter)) {
$this->filter = Filter::fromSchema($this->schema());
}
$this->applyHook('filtering', $model, $key);
$result = $this->filter->run($model, $key);
$this->applyHook('filtered', $model, ... | php | public function filter(Model $model, $key = null)
{
if (is_null($this->filter)) {
$this->filter = Filter::fromSchema($this->schema());
}
$this->applyHook('filtering', $model, $key);
$result = $this->filter->run($model, $key);
$this->applyHook('filtered', $model, ... | [
"public",
"function",
"filter",
"(",
"Model",
"$",
"model",
",",
"$",
"key",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"filter",
")",
")",
"{",
"$",
"this",
"->",
"filter",
"=",
"Filter",
"::",
"fromSchema",
"(",
"$",
"... | Filter model data with functions to cleanse, prepare and validate data. When key argument specified, filter will run partially for specified key only.
@param \Norm\Model $model
@param string $key Key field of model
@return bool True if success and false if fail | [
"Filter",
"model",
"data",
"with",
"functions",
"to",
"cleanse",
"prepare",
"and",
"validate",
"data",
".",
"When",
"key",
"argument",
"specified",
"filter",
"will",
"run",
"partially",
"for",
"specified",
"key",
"only",
"."
] | train | https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Collection.php#L318-L329 |
xinix-technology/norm | src/Norm/Collection.php | Collection.save | public function save(Model $model, $options = array())
{
$options = array_merge(array(
'filter' => true,
'observer' => true,
), $options);
if ($options['filter']) {
$this->filter($model);
}
if ($options['observer']) {
$this->a... | php | public function save(Model $model, $options = array())
{
$options = array_merge(array(
'filter' => true,
'observer' => true,
), $options);
if ($options['filter']) {
$this->filter($model);
}
if ($options['observer']) {
$this->a... | [
"public",
"function",
"save",
"(",
"Model",
"$",
"model",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"options",
"=",
"array_merge",
"(",
"array",
"(",
"'filter'",
"=>",
"true",
",",
"'observer'",
"=>",
"true",
",",
")",
",",
"$",
"... | Save model to persistent state
@param \Norm\Model $model
@param array $options
@return void | [
"Save",
"model",
"to",
"persistent",
"state"
] | train | https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Collection.php#L339-L363 |
xinix-technology/norm | src/Norm/Collection.php | Collection.remove | public function remove(Model $model = null)
{
if (func_num_args() === 0) {
$this->connection->remove($this);
} else {
// avoid remove empty model
if (is_null($model)) {
throw new \Exception('[Norm/Collection] Cannot remove null model');
... | php | public function remove(Model $model = null)
{
if (func_num_args() === 0) {
$this->connection->remove($this);
} else {
// avoid remove empty model
if (is_null($model)) {
throw new \Exception('[Norm/Collection] Cannot remove null model');
... | [
"public",
"function",
"remove",
"(",
"Model",
"$",
"model",
"=",
"null",
")",
"{",
"if",
"(",
"func_num_args",
"(",
")",
"===",
"0",
")",
"{",
"$",
"this",
"->",
"connection",
"->",
"remove",
"(",
"$",
"this",
")",
";",
"}",
"else",
"{",
"// avoid ... | Remove single model
@param \Norm\Model $model
@return void | [
"Remove",
"single",
"model"
] | train | https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Collection.php#L372-L391 |
xinix-technology/norm | src/Norm/Collection.php | Collection.observe | protected function observe($observer)
{
if (method_exists($observer, 'saving')) {
$this->hook('saving', array($observer, 'saving'));
}
if (method_exists($observer, 'saved')) {
$this->hook('saved', array($observer, 'saved'));
}
if (method_exists($obse... | php | protected function observe($observer)
{
if (method_exists($observer, 'saving')) {
$this->hook('saving', array($observer, 'saving'));
}
if (method_exists($observer, 'saved')) {
$this->hook('saved', array($observer, 'saved'));
}
if (method_exists($obse... | [
"protected",
"function",
"observe",
"(",
"$",
"observer",
")",
"{",
"if",
"(",
"method_exists",
"(",
"$",
"observer",
",",
"'saving'",
")",
")",
"{",
"$",
"this",
"->",
"hook",
"(",
"'saving'",
",",
"array",
"(",
"$",
"observer",
",",
"'saving'",
")",
... | Override this to add new functionality of observer to the collection, otherwise you are not necessarilly to know about this.
@param NObject $observer
@return void | [
"Override",
"this",
"to",
"add",
"new",
"functionality",
"of",
"observer",
"to",
"the",
"collection",
"otherwise",
"you",
"are",
"not",
"necessarilly",
"to",
"know",
"about",
"this",
".",
"@param",
"NObject",
"$observer"
] | train | https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Collection.php#L399-L444 |
xinix-technology/norm | src/Norm/Collection.php | Collection.rememberCache | protected function rememberCache($criteria, $model)
{
$ser = serialize($criteria);
$this->cache[$ser] = $model;
} | php | protected function rememberCache($criteria, $model)
{
$ser = serialize($criteria);
$this->cache[$ser] = $model;
} | [
"protected",
"function",
"rememberCache",
"(",
"$",
"criteria",
",",
"$",
"model",
")",
"{",
"$",
"ser",
"=",
"serialize",
"(",
"$",
"criteria",
")",
";",
"$",
"this",
"->",
"cache",
"[",
"$",
"ser",
"]",
"=",
"$",
"model",
";",
"}"
] | Put item in cache bags.
@method rememberCache
@param mixed $criteria
@param \Norm\Model $model [description]
@return void | [
"Put",
"item",
"in",
"cache",
"bags",
"."
] | train | https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Collection.php#L468-L473 |
xinix-technology/norm | src/Norm/Collection.php | Collection.fetchCache | protected function fetchCache($criteria)
{
$ser = serialize($criteria);
if (isset($this->cache[$ser])) {
return $this->cache[$ser];
}
} | php | protected function fetchCache($criteria)
{
$ser = serialize($criteria);
if (isset($this->cache[$ser])) {
return $this->cache[$ser];
}
} | [
"protected",
"function",
"fetchCache",
"(",
"$",
"criteria",
")",
"{",
"$",
"ser",
"=",
"serialize",
"(",
"$",
"criteria",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"cache",
"[",
"$",
"ser",
"]",
")",
")",
"{",
"return",
"$",
"this",
... | Get item from cache.
@method fetchCache
@param NObject $criteria
@return void|\Norm\Model | [
"Get",
"item",
"from",
"cache",
"."
] | train | https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Collection.php#L484-L491 |
silvercommerce/catalogue-frontend | src/control/ModelAsController.php | ModelAsController.controller_for_object | public static function controller_for_object($object, $action = null)
{
$controller = $object->getControllerName();
if ($action && class_exists($controller . '_' . ucfirst($action))) {
$controller = $controller . '_' . ucfirst($action);
}
return Injector::inst()->create... | php | public static function controller_for_object($object, $action = null)
{
$controller = $object->getControllerName();
if ($action && class_exists($controller . '_' . ucfirst($action))) {
$controller = $controller . '_' . ucfirst($action);
}
return Injector::inst()->create... | [
"public",
"static",
"function",
"controller_for_object",
"(",
"$",
"object",
",",
"$",
"action",
"=",
"null",
")",
"{",
"$",
"controller",
"=",
"$",
"object",
"->",
"getControllerName",
"(",
")",
";",
"if",
"(",
"$",
"action",
"&&",
"class_exists",
"(",
... | Get the appropriate {@link CatalogueProductController} or
{@link CatalogueProductController} for handling the relevent
object.
@param $object A {@link DataObject} with the getControllerName() method
@param string $action
@return CatalogueController | [
"Get",
"the",
"appropriate",
"{",
"@link",
"CatalogueProductController",
"}",
"or",
"{",
"@link",
"CatalogueProductController",
"}",
"for",
"handling",
"the",
"relevent",
"object",
"."
] | train | https://github.com/silvercommerce/catalogue-frontend/blob/671f1e32bf6bc6eb193c6608ae904cd055540cc4/src/control/ModelAsController.php#L28-L37 |
yuncms/framework | src/rest/controllers/PersonController.php | PersonController.actionExtra | public function actionExtra()
{
$user = $this->findModel(Yii::$app->user->id);
return $user->extra->toArray();
} | php | public function actionExtra()
{
$user = $this->findModel(Yii::$app->user->id);
return $user->extra->toArray();
} | [
"public",
"function",
"actionExtra",
"(",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"findModel",
"(",
"Yii",
"::",
"$",
"app",
"->",
"user",
"->",
"id",
")",
";",
"return",
"$",
"user",
"->",
"extra",
"->",
"toArray",
"(",
")",
";",
"}"
] | 读取用户扩展数据
@return array
@throws NotFoundHttpException | [
"读取用户扩展数据"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/rest/controllers/PersonController.php#L63-L67 |
yuncms/framework | src/rest/controllers/PersonController.php | PersonController.actionProfile | public function actionProfile()
{
if (($model = UserProfile::findOne(['user_id' => Yii::$app->user->identity->getId()])) !== null) {
if (!Yii::$app->request->isGet) {
$model->load(Yii::$app->getRequest()->getBodyParams(), '');
if ($model->save() === false && !$mod... | php | public function actionProfile()
{
if (($model = UserProfile::findOne(['user_id' => Yii::$app->user->identity->getId()])) !== null) {
if (!Yii::$app->request->isGet) {
$model->load(Yii::$app->getRequest()->getBodyParams(), '');
if ($model->save() === false && !$mod... | [
"public",
"function",
"actionProfile",
"(",
")",
"{",
"if",
"(",
"(",
"$",
"model",
"=",
"UserProfile",
"::",
"findOne",
"(",
"[",
"'user_id'",
"=>",
"Yii",
"::",
"$",
"app",
"->",
"user",
"->",
"identity",
"->",
"getId",
"(",
")",
"]",
")",
")",
"... | 获取个人扩展资料
@return UserProfile
@throws NotFoundHttpException
@throws ServerErrorHttpException
@throws \yii\base\InvalidConfigException | [
"获取个人扩展资料"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/rest/controllers/PersonController.php#L76-L89 |
yuncms/framework | src/rest/controllers/PersonController.php | PersonController.actionSocial | public function actionSocial()
{
$user = $this->findModel(Yii::$app->user->id);
return $user->getSocialAccounts();
} | php | public function actionSocial()
{
$user = $this->findModel(Yii::$app->user->id);
return $user->getSocialAccounts();
} | [
"public",
"function",
"actionSocial",
"(",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"findModel",
"(",
"Yii",
"::",
"$",
"app",
"->",
"user",
"->",
"id",
")",
";",
"return",
"$",
"user",
"->",
"getSocialAccounts",
"(",
")",
";",
"}"
] | 获取我绑定的社交媒体账户
@return \yuncms\user\models\UserSocialAccount[]
@throws NotFoundHttpException | [
"获取我绑定的社交媒体账户"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/rest/controllers/PersonController.php#L96-L100 |
yuncms/framework | src/rest/controllers/PersonController.php | PersonController.actionMe | public function actionMe()
{
$user = $this->findModel(Yii::$app->user->id);
return [
'id' => $user->id,
'username' => $user->username,
'nickname' => $user->nickname,
'email' => $user->email,
'mobile' => $user->mobile,
'mobile_co... | php | public function actionMe()
{
$user = $this->findModel(Yii::$app->user->id);
return [
'id' => $user->id,
'username' => $user->username,
'nickname' => $user->nickname,
'email' => $user->email,
'mobile' => $user->mobile,
'mobile_co... | [
"public",
"function",
"actionMe",
"(",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"findModel",
"(",
"Yii",
"::",
"$",
"app",
"->",
"user",
"->",
"id",
")",
";",
"return",
"[",
"'id'",
"=>",
"$",
"user",
"->",
"id",
",",
"'username'",
"=>",
"$... | 获取个人基本资料
@return array
@throws NotFoundHttpException | [
"获取个人基本资料"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/rest/controllers/PersonController.php#L107-L122 |
yuncms/framework | src/rest/controllers/PersonController.php | PersonController.actionPassword | public function actionPassword()
{
$model = new UserSettingsForm();
$model->load(Yii::$app->request->post(), '');
if ($model->save()) {
Yii::$app->getResponse()->setStatusCode(200);
return $model;
} elseif (!$model->hasErrors()) {
throw new ServerE... | php | public function actionPassword()
{
$model = new UserSettingsForm();
$model->load(Yii::$app->request->post(), '');
if ($model->save()) {
Yii::$app->getResponse()->setStatusCode(200);
return $model;
} elseif (!$model->hasErrors()) {
throw new ServerE... | [
"public",
"function",
"actionPassword",
"(",
")",
"{",
"$",
"model",
"=",
"new",
"UserSettingsForm",
"(",
")",
";",
"$",
"model",
"->",
"load",
"(",
"Yii",
"::",
"$",
"app",
"->",
"request",
"->",
"post",
"(",
")",
",",
"''",
")",
";",
"if",
"(",
... | 修改密码
@return UserSettingsForm
@throws ServerErrorHttpException | [
"修改密码"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/rest/controllers/PersonController.php#L212-L223 |
yuncms/framework | src/rest/controllers/PersonController.php | PersonController.actionRecovery | public function actionRecovery()
{
$model = new UserRecoveryForm();
$model->load(Yii::$app->getRequest()->getBodyParams(), '');
if ($model->resetPassword()) {
Yii::$app->getResponse()->setStatusCode(200);
} elseif (!$model->hasErrors()) {
throw new ServerError... | php | public function actionRecovery()
{
$model = new UserRecoveryForm();
$model->load(Yii::$app->getRequest()->getBodyParams(), '');
if ($model->resetPassword()) {
Yii::$app->getResponse()->setStatusCode(200);
} elseif (!$model->hasErrors()) {
throw new ServerError... | [
"public",
"function",
"actionRecovery",
"(",
")",
"{",
"$",
"model",
"=",
"new",
"UserRecoveryForm",
"(",
")",
";",
"$",
"model",
"->",
"load",
"(",
"Yii",
"::",
"$",
"app",
"->",
"getRequest",
"(",
")",
"->",
"getBodyParams",
"(",
")",
",",
"''",
")... | 重置密码
@return UserRecoveryForm
@throws ServerErrorHttpException
@throws \yii\base\Exception
@throws \yii\base\InvalidConfigException | [
"重置密码"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/rest/controllers/PersonController.php#L232-L242 |
yuncms/framework | src/rest/controllers/PersonController.php | PersonController.actionAvatar | public function actionAvatar()
{
$model = new AvatarForm();
$model->load(Yii::$app->getRequest()->getBodyParams(), '');
if (($model->save()) !== false) {
Yii::$app->getResponse()->setStatusCode(200);
return $model;
} elseif (!$model->hasErrors()) {
... | php | public function actionAvatar()
{
$model = new AvatarForm();
$model->load(Yii::$app->getRequest()->getBodyParams(), '');
if (($model->save()) !== false) {
Yii::$app->getResponse()->setStatusCode(200);
return $model;
} elseif (!$model->hasErrors()) {
... | [
"public",
"function",
"actionAvatar",
"(",
")",
"{",
"$",
"model",
"=",
"new",
"AvatarForm",
"(",
")",
";",
"$",
"model",
"->",
"load",
"(",
"Yii",
"::",
"$",
"app",
"->",
"getRequest",
"(",
")",
"->",
"getBodyParams",
"(",
")",
",",
"''",
")",
";"... | 上传头像
@return AvatarForm|bool
@throws ServerErrorHttpException
@throws \yii\base\InvalidConfigException | [
"上传头像"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/rest/controllers/PersonController.php#L250-L261 |
yuncms/framework | src/rest/controllers/PersonController.php | PersonController.actionBindMobile | public function actionBindMobile()
{
$model = new UserBindMobileForm();
$model->load(Yii::$app->getRequest()->getBodyParams(), '');
if (($user = $model->bind()) != false) {
Yii::$app->getResponse()->setStatusCode(200);
return $user;
} elseif (!$model->hasError... | php | public function actionBindMobile()
{
$model = new UserBindMobileForm();
$model->load(Yii::$app->getRequest()->getBodyParams(), '');
if (($user = $model->bind()) != false) {
Yii::$app->getResponse()->setStatusCode(200);
return $user;
} elseif (!$model->hasError... | [
"public",
"function",
"actionBindMobile",
"(",
")",
"{",
"$",
"model",
"=",
"new",
"UserBindMobileForm",
"(",
")",
";",
"$",
"model",
"->",
"load",
"(",
"Yii",
"::",
"$",
"app",
"->",
"getRequest",
"(",
")",
"->",
"getBodyParams",
"(",
")",
",",
"''",
... | 绑定手机号
@return bool|User|UserBindMobileForm
@throws ServerErrorHttpException
@throws \yii\base\InvalidConfigException | [
"绑定手机号"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/rest/controllers/PersonController.php#L269-L280 |
yuncms/framework | src/rest/controllers/PersonController.php | PersonController.actionIdentification | public function actionIdentification()
{
if (!class_exists('yuncms\identification\rest\models\Identification')) {
throw new InvalidConfigException('No identification module installed.');
} else {
if (Yii::$app->request->isPost) {
$model = \yuncms\identificatio... | php | public function actionIdentification()
{
if (!class_exists('yuncms\identification\rest\models\Identification')) {
throw new InvalidConfigException('No identification module installed.');
} else {
if (Yii::$app->request->isPost) {
$model = \yuncms\identificatio... | [
"public",
"function",
"actionIdentification",
"(",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"'yuncms\\identification\\rest\\models\\Identification'",
")",
")",
"{",
"throw",
"new",
"InvalidConfigException",
"(",
"'No identification module installed.'",
")",
";",
"}"... | 实名认证
@return \yuncms\identification\rest\models\Identification
@throws MethodNotAllowedHttpException
@throws ServerErrorHttpException
@throws \yii\base\InvalidConfigException | [
"实名认证"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/rest/controllers/PersonController.php#L289-L311 |
yuncms/framework | src/sms/gateways/AliyunGateway.php | AliyunGateway.init | public function init()
{
parent::init();
if (empty ($this->accessId)) {
throw new InvalidConfigException ('The "accessId" property must be set.');
}
if (empty ($this->accessKey)) {
throw new InvalidConfigException ('The "accessKey" property must be set.');
... | php | public function init()
{
parent::init();
if (empty ($this->accessId)) {
throw new InvalidConfigException ('The "accessId" property must be set.');
}
if (empty ($this->accessKey)) {
throw new InvalidConfigException ('The "accessKey" property must be set.');
... | [
"public",
"function",
"init",
"(",
")",
"{",
"parent",
"::",
"init",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"accessId",
")",
")",
"{",
"throw",
"new",
"InvalidConfigException",
"(",
"'The \"accessId\" property must be set.'",
")",
";",
... | 初始化短信
@throws InvalidConfigException | [
"初始化短信"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/sms/gateways/AliyunGateway.php#L53-L65 |
yuncms/framework | src/sms/gateways/AliyunGateway.php | AliyunGateway.generateSign | protected function generateSign($params)
{
ksort($params);
$stringToSign = 'GET&%2F&' . urlencode(http_build_query($params, null, '&', PHP_QUERY_RFC3986));
return base64_encode(hash_hmac('sha1', $stringToSign, $this->accessKey . '&', true));
} | php | protected function generateSign($params)
{
ksort($params);
$stringToSign = 'GET&%2F&' . urlencode(http_build_query($params, null, '&', PHP_QUERY_RFC3986));
return base64_encode(hash_hmac('sha1', $stringToSign, $this->accessKey . '&', true));
} | [
"protected",
"function",
"generateSign",
"(",
"$",
"params",
")",
"{",
"ksort",
"(",
"$",
"params",
")",
";",
"$",
"stringToSign",
"=",
"'GET&%2F&'",
".",
"urlencode",
"(",
"http_build_query",
"(",
"$",
"params",
",",
"null",
",",
"'&'",
",",
"PHP_QUERY_RF... | Generate Sign.
@param array $params
@return string | [
"Generate",
"Sign",
"."
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/sms/gateways/AliyunGateway.php#L115-L120 |
Josantonius/WP_Menu | src/class-wp-menu.php | WP_Menu.add | public static function add( $type, $data = [], $function = 0, $styles = 0, $scripts = 0 ) {
if ( ! is_admin() || ! self::required_params_exist( $type, $data ) ) {
return false;
}
$data = self::set_params( $data, $function, $styles, $scripts );
$slug = $data['slug'];
self::$data[ $type ][ $slug ] = $dat... | php | public static function add( $type, $data = [], $function = 0, $styles = 0, $scripts = 0 ) {
if ( ! is_admin() || ! self::required_params_exist( $type, $data ) ) {
return false;
}
$data = self::set_params( $data, $function, $styles, $scripts );
$slug = $data['slug'];
self::$data[ $type ][ $slug ] = $dat... | [
"public",
"static",
"function",
"add",
"(",
"$",
"type",
",",
"$",
"data",
"=",
"[",
"]",
",",
"$",
"function",
"=",
"0",
",",
"$",
"styles",
"=",
"0",
",",
"$",
"scripts",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"is_admin",
"(",
")",
"||",
"!",
... | Add menu or submenu.
@param string $type → menu | submenu.
@param array $data → settings.
@param mixed $function → method to be called to output page content.
@param mixed $styles → method to be called to load page styles.
@param mixed $scripts → method to be called to load page scripts.
@see https://github.co... | [
"Add",
"menu",
"or",
"submenu",
"."
] | train | https://github.com/Josantonius/WP_Menu/blob/90df3355007083cc156353dde94ee73d3fea0ce5/src/class-wp-menu.php#L40-L59 |
Josantonius/WP_Menu | src/class-wp-menu.php | WP_Menu.set_params | private static function set_params( $data, $function, $styles, $scripts ) {
$params = [ 'title', 'capability', 'icon_url', 'position' ];
foreach ( $params as $param ) {
if ( isset( $data[ $param ] ) ) {
continue;
}
switch ( $param ) {
case 'title':
$data[ $param ] = $data['name'];
br... | php | private static function set_params( $data, $function, $styles, $scripts ) {
$params = [ 'title', 'capability', 'icon_url', 'position' ];
foreach ( $params as $param ) {
if ( isset( $data[ $param ] ) ) {
continue;
}
switch ( $param ) {
case 'title':
$data[ $param ] = $data['name'];
br... | [
"private",
"static",
"function",
"set_params",
"(",
"$",
"data",
",",
"$",
"function",
",",
"$",
"styles",
",",
"$",
"scripts",
")",
"{",
"$",
"params",
"=",
"[",
"'title'",
",",
"'capability'",
",",
"'icon_url'",
",",
"'position'",
"]",
";",
"foreach",
... | Set menu/submenu parameters.
@since 1.0.4
@param array $data → settings.
@param mixed $function → method to be called to output page content.
@param mixed $styles → method to be called to load page styles.
@param mixed $scripts → method to be called to load page scripts.
@return array parameters | [
"Set",
"menu",
"/",
"submenu",
"parameters",
"."
] | train | https://github.com/Josantonius/WP_Menu/blob/90df3355007083cc156353dde94ee73d3fea0ce5/src/class-wp-menu.php#L73-L109 |
Josantonius/WP_Menu | src/class-wp-menu.php | WP_Menu.required_params_exist | private static function required_params_exist( $type, $data ) {
$required = [ 'name', 'slug' ];
if ( 'submenu' === $type ) {
array_push( $required, 'parent' );
}
foreach ( $required as $field ) {
if ( ! isset( $data[ $field ] ) || empty( $data[ $field ] ) ) {
return false;
}
}
return true;
... | php | private static function required_params_exist( $type, $data ) {
$required = [ 'name', 'slug' ];
if ( 'submenu' === $type ) {
array_push( $required, 'parent' );
}
foreach ( $required as $field ) {
if ( ! isset( $data[ $field ] ) || empty( $data[ $field ] ) ) {
return false;
}
}
return true;
... | [
"private",
"static",
"function",
"required_params_exist",
"(",
"$",
"type",
",",
"$",
"data",
")",
"{",
"$",
"required",
"=",
"[",
"'name'",
",",
"'slug'",
"]",
";",
"if",
"(",
"'submenu'",
"===",
"$",
"type",
")",
"{",
"array_push",
"(",
"$",
"require... | Validate if the required parameters exist.
@since 1.0.4
@param string $type → menu | submenu.
@param array $data → settings.
@return boolean | [
"Validate",
"if",
"the",
"required",
"parameters",
"exist",
"."
] | train | https://github.com/Josantonius/WP_Menu/blob/90df3355007083cc156353dde94ee73d3fea0ce5/src/class-wp-menu.php#L121-L136 |
Josantonius/WP_Menu | src/class-wp-menu.php | WP_Menu.set | private static function set( $type, $slug ) {
global $pagenow;
$data = self::$data[ $type ][ $slug ];
do_action( 'wp_menu_pre_add_' . $type . '_page' );
if ( 'menu' === $type ) {
$page = add_menu_page(
$data['title'],
$data['name'],
$data['capability'],
$data['slug'],
$data['function... | php | private static function set( $type, $slug ) {
global $pagenow;
$data = self::$data[ $type ][ $slug ];
do_action( 'wp_menu_pre_add_' . $type . '_page' );
if ( 'menu' === $type ) {
$page = add_menu_page(
$data['title'],
$data['name'],
$data['capability'],
$data['slug'],
$data['function... | [
"private",
"static",
"function",
"set",
"(",
"$",
"type",
",",
"$",
"slug",
")",
"{",
"global",
"$",
"pagenow",
";",
"$",
"data",
"=",
"self",
"::",
"$",
"data",
"[",
"$",
"type",
"]",
"[",
"$",
"slug",
"]",
";",
"do_action",
"(",
"'wp_menu_pre_add... | Set menu and submenu admin.
@since 1.0.1
@param string $type → menu|submenu.
@param string $slug → menu|submenu slug. | [
"Set",
"menu",
"and",
"submenu",
"admin",
"."
] | train | https://github.com/Josantonius/WP_Menu/blob/90df3355007083cc156353dde94ee73d3fea0ce5/src/class-wp-menu.php#L146-L184 |
Josantonius/WP_Menu | src/class-wp-menu.php | WP_Menu.validate_method | private static function validate_method( $method ) {
if ( $method && isset( $method[0] ) && isset( $method[1] ) ) {
if ( method_exists( $method[0], $method[1] ) ) {
return true;
}
}
return false;
} | php | private static function validate_method( $method ) {
if ( $method && isset( $method[0] ) && isset( $method[1] ) ) {
if ( method_exists( $method[0], $method[1] ) ) {
return true;
}
}
return false;
} | [
"private",
"static",
"function",
"validate_method",
"(",
"$",
"method",
")",
"{",
"if",
"(",
"$",
"method",
"&&",
"isset",
"(",
"$",
"method",
"[",
"0",
"]",
")",
"&&",
"isset",
"(",
"$",
"method",
"[",
"1",
"]",
")",
")",
"{",
"if",
"(",
"method... | Check if method exists.
@since 1.0.2
@param array $method → [class|object, method].
@return boolean | [
"Check",
"if",
"method",
"exists",
"."
] | train | https://github.com/Josantonius/WP_Menu/blob/90df3355007083cc156353dde94ee73d3fea0ce5/src/class-wp-menu.php#L195-L204 |
cohesion/cohesion-core | src/Structure/DTO.php | DTO.getVarsWithoutCircularReferences | private function getVarsWithoutCircularReferences($showNulls, &$previousDTOs = []) {
$previousDTOs[spl_object_hash($this)] = true;
$classProperties = $this->reflection->getProperties(\ReflectionProperty::IS_PROTECTED);
$vars = array();
foreach ($classProperties as $property) {
... | php | private function getVarsWithoutCircularReferences($showNulls, &$previousDTOs = []) {
$previousDTOs[spl_object_hash($this)] = true;
$classProperties = $this->reflection->getProperties(\ReflectionProperty::IS_PROTECTED);
$vars = array();
foreach ($classProperties as $property) {
... | [
"private",
"function",
"getVarsWithoutCircularReferences",
"(",
"$",
"showNulls",
",",
"&",
"$",
"previousDTOs",
"=",
"[",
"]",
")",
"{",
"$",
"previousDTOs",
"[",
"spl_object_hash",
"(",
"$",
"this",
")",
"]",
"=",
"true",
";",
"$",
"classProperties",
"=",
... | Export protected class parameters as an associative array.
This function will make sure that even if the object has a circular
reference it won't crash the system by calling the `getVars` function.
If there is a circular reference the later one will be left out of the
output | [
"Export",
"protected",
"class",
"parameters",
"as",
"an",
"associative",
"array",
"."
] | train | https://github.com/cohesion/cohesion-core/blob/c6352aef7336e06285f0943da68235dc45523998/src/Structure/DTO.php#L120-L158 |
aedart/laravel-helpers | src/Traits/Redis/RedisTrait.php | RedisTrait.getRedis | public function getRedis(): ?Connection
{
if (!$this->hasRedis()) {
$this->setRedis($this->getDefaultRedis());
}
return $this->redis;
} | php | public function getRedis(): ?Connection
{
if (!$this->hasRedis()) {
$this->setRedis($this->getDefaultRedis());
}
return $this->redis;
} | [
"public",
"function",
"getRedis",
"(",
")",
":",
"?",
"Connection",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasRedis",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setRedis",
"(",
"$",
"this",
"->",
"getDefaultRedis",
"(",
")",
")",
";",
"}",
"return",... | Get redis
If no redis has been set, this method will
set and return a default redis, if any such
value is available
@see getDefaultRedis()
@return Connection|null redis or null if none redis has been set | [
"Get",
"redis"
] | train | https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Redis/RedisTrait.php#L53-L59 |
aedart/laravel-helpers | src/Traits/Redis/RedisTrait.php | RedisTrait.getDefaultRedis | public function getDefaultRedis(): ?Connection
{
// From Laravel 5.4, the redis facade now returns the
// Redis Manager, which is why we must use it to obtain
// the default Redis connection. Thus, the
// "Illuminate\Contracts\Redis\Database" interface is no
// longer used.
... | php | public function getDefaultRedis(): ?Connection
{
// From Laravel 5.4, the redis facade now returns the
// Redis Manager, which is why we must use it to obtain
// the default Redis connection. Thus, the
// "Illuminate\Contracts\Redis\Database" interface is no
// longer used.
... | [
"public",
"function",
"getDefaultRedis",
"(",
")",
":",
"?",
"Connection",
"{",
"// From Laravel 5.4, the redis facade now returns the",
"// Redis Manager, which is why we must use it to obtain",
"// the default Redis connection. Thus, the",
"// \"Illuminate\\Contracts\\Redis\\Database\" int... | Get a default redis value, if any is available
@return Connection|null A default redis value or Null if no default value is available | [
"Get",
"a",
"default",
"redis",
"value",
"if",
"any",
"is",
"available"
] | train | https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Redis/RedisTrait.php#L76-L88 |
digitalkaoz/versioneye-php | src/Api/Projects.php | Projects.mergeGa | public function mergeGa($group, $artifact, $child)
{
return $this->request(sprintf('projects/%s/%s/merge_ga/%s', $group, $artifact, $child));
} | php | public function mergeGa($group, $artifact, $child)
{
return $this->request(sprintf('projects/%s/%s/merge_ga/%s', $group, $artifact, $child));
} | [
"public",
"function",
"mergeGa",
"(",
"$",
"group",
",",
"$",
"artifact",
",",
"$",
"child",
")",
"{",
"return",
"$",
"this",
"->",
"request",
"(",
"sprintf",
"(",
"'projects/%s/%s/merge_ga/%s'",
",",
"$",
"group",
",",
"$",
"artifact",
",",
"$",
"child"... | merge two projects together (only for maven projects).
@param string $group
@param string $artifact
@param string $child
@return array | [
"merge",
"two",
"projects",
"together",
"(",
"only",
"for",
"maven",
"projects",
")",
"."
] | train | https://github.com/digitalkaoz/versioneye-php/blob/7b8eb9cdc83e01138dda0e709c07e3beb6aad136/src/Api/Projects.php#L123-L126 |
steeffeen/FancyManiaLinks | FML/UniqueID.php | UniqueID.check | public static function check(Identifiable $element)
{
$elementId = $element->getId();
if (!$elementId) {
$element->setId(new static());
return $element->getId();
}
$dangerousCharacters = array(' ', '|', PHP_EOL);
$danger = false;
... | php | public static function check(Identifiable $element)
{
$elementId = $element->getId();
if (!$elementId) {
$element->setId(new static());
return $element->getId();
}
$dangerousCharacters = array(' ', '|', PHP_EOL);
$danger = false;
... | [
"public",
"static",
"function",
"check",
"(",
"Identifiable",
"$",
"element",
")",
"{",
"$",
"elementId",
"=",
"$",
"element",
"->",
"getId",
"(",
")",
";",
"if",
"(",
"!",
"$",
"elementId",
")",
"{",
"$",
"element",
"->",
"setId",
"(",
"new",
"stati... | Check and return the Id of an Identifable Element
@param Identifiable $element Identifable element
@return string | [
"Check",
"and",
"return",
"the",
"Id",
"of",
"an",
"Identifable",
"Element"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/UniqueID.php#L48-L73 |
tomphp/patch-builder | src/TomPHP/PatchBuilder/Buffer/LineBuffer.php | LineBuffer.getLines | public function getLines(LineRangeInterface $range)
{
$this->assertRangeIsInsideBuffer($range);
return array_slice(
$this->contents,
$range->getStart()->getNumber(),
$range->getLength()
);
} | php | public function getLines(LineRangeInterface $range)
{
$this->assertRangeIsInsideBuffer($range);
return array_slice(
$this->contents,
$range->getStart()->getNumber(),
$range->getLength()
);
} | [
"public",
"function",
"getLines",
"(",
"LineRangeInterface",
"$",
"range",
")",
"{",
"$",
"this",
"->",
"assertRangeIsInsideBuffer",
"(",
"$",
"range",
")",
";",
"return",
"array_slice",
"(",
"$",
"this",
"->",
"contents",
",",
"$",
"range",
"->",
"getStart"... | @param LineRangeInterface $range
@return string[] | [
"@param",
"LineRangeInterface",
"$range"
] | train | https://github.com/tomphp/patch-builder/blob/4419eaad23016c7db1deffc6cce3f539096c11ce/src/TomPHP/PatchBuilder/Buffer/LineBuffer.php#L44-L53 |
yoanm/symfony-jsonrpc-http-server-doc | src/Creator/HttpServerDocCreator.php | HttpServerDocCreator.create | public function create($host = null) : HttpServerDoc
{
$serverDoc = new HttpServerDoc();
if (null !== $this->jsonRpcEndpoint) {
$serverDoc->setEndpoint($this->jsonRpcEndpoint);
}
if (null !== $host) {
$serverDoc->setHost($host);
}
$this->appen... | php | public function create($host = null) : HttpServerDoc
{
$serverDoc = new HttpServerDoc();
if (null !== $this->jsonRpcEndpoint) {
$serverDoc->setEndpoint($this->jsonRpcEndpoint);
}
if (null !== $host) {
$serverDoc->setHost($host);
}
$this->appen... | [
"public",
"function",
"create",
"(",
"$",
"host",
"=",
"null",
")",
":",
"HttpServerDoc",
"{",
"$",
"serverDoc",
"=",
"new",
"HttpServerDoc",
"(",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"jsonRpcEndpoint",
")",
"{",
"$",
"serverDoc",
"->... | @param string|null $host
@return HttpServerDoc | [
"@param",
"string|null",
"$host"
] | train | https://github.com/yoanm/symfony-jsonrpc-http-server-doc/blob/7a59862f74fef29d0e2ad017188977419503ad94/src/Creator/HttpServerDocCreator.php#L39-L55 |
yoanm/symfony-jsonrpc-http-server-doc | src/Creator/HttpServerDocCreator.php | HttpServerDocCreator.addJsonRpcMethod | public function addJsonRpcMethod(string $methodName, JsonRpcMethodInterface $method) : void
{
$this->methodList[$methodName] = $method;
} | php | public function addJsonRpcMethod(string $methodName, JsonRpcMethodInterface $method) : void
{
$this->methodList[$methodName] = $method;
} | [
"public",
"function",
"addJsonRpcMethod",
"(",
"string",
"$",
"methodName",
",",
"JsonRpcMethodInterface",
"$",
"method",
")",
":",
"void",
"{",
"$",
"this",
"->",
"methodList",
"[",
"$",
"methodName",
"]",
"=",
"$",
"method",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/yoanm/symfony-jsonrpc-http-server-doc/blob/7a59862f74fef29d0e2ad017188977419503ad94/src/Creator/HttpServerDocCreator.php#L60-L63 |
simple-php-mvc/simple-php-mvc | src/MVC/Server/HttpRequest.php | HttpRequest.is | public function is($characteristic)
{
switch ( strtolower($characteristic) ) {
case "ajax":
return (
isset($this->_env['HTTP_X_REQUESTED_WITH']) &&
$this->_env['HTTP_X_REQUESTED_WITH'] == "XMLHttpRequest"
);
cas... | php | public function is($characteristic)
{
switch ( strtolower($characteristic) ) {
case "ajax":
return (
isset($this->_env['HTTP_X_REQUESTED_WITH']) &&
$this->_env['HTTP_X_REQUESTED_WITH'] == "XMLHttpRequest"
);
cas... | [
"public",
"function",
"is",
"(",
"$",
"characteristic",
")",
"{",
"switch",
"(",
"strtolower",
"(",
"$",
"characteristic",
")",
")",
"{",
"case",
"\"ajax\"",
":",
"return",
"(",
"isset",
"(",
"$",
"this",
"->",
"_env",
"[",
"'HTTP_X_REQUESTED_WITH'",
"]",
... | Checks for request characteristics.
The full list of request characteristics is as follows:
* "ajax" - XHR
* "delete" - DELETE REQUEST_METHOD
* "flash" - "Shockwave Flash" HTTP_USER_AGENT
* "get" - GET REQUEST_METHOD
* "head" - HEAD REQUEST_METHOD
* "mobile" - any one of the following HTTP_USER_AGENTS:
1. "Android"... | [
"Checks",
"for",
"request",
"characteristics",
"."
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/Server/HttpRequest.php#L277-L318 |
simple-php-mvc/simple-php-mvc | src/MVC/Server/HttpRequest.php | HttpRequest.parseUrl | protected function parseUrl($url = "")
{
$parsed = ($url) ? parse_url($url) : parse_url($this->_env['REQUEST_URI']);
if (preg_match('/[a-zA-Z0-9_]+\.php/i', $parsed['path'], $matches)) {
$parsed['path'] = preg_replace("/$matches[0]/", '/', $parsed['path']);
}
... | php | protected function parseUrl($url = "")
{
$parsed = ($url) ? parse_url($url) : parse_url($this->_env['REQUEST_URI']);
if (preg_match('/[a-zA-Z0-9_]+\.php/i', $parsed['path'], $matches)) {
$parsed['path'] = preg_replace("/$matches[0]/", '/', $parsed['path']);
}
... | [
"protected",
"function",
"parseUrl",
"(",
"$",
"url",
"=",
"\"\"",
")",
"{",
"$",
"parsed",
"=",
"(",
"$",
"url",
")",
"?",
"parse_url",
"(",
"$",
"url",
")",
":",
"parse_url",
"(",
"$",
"this",
"->",
"_env",
"[",
"'REQUEST_URI'",
"]",
")",
";",
... | Get parsed url
@param string $url Url to parse
@return array Parsed Url | [
"Get",
"parsed",
"url"
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/Server/HttpRequest.php#L396-L405 |
steeffeen/FancyManiaLinks | FML/Script/Features/ControlScript.php | ControlScript.setControl | public function setControl(Control $control)
{
$control->checkId();
$control->addScriptFeature($this);
$this->control = $control;
$this->updateScriptEvents();
return $this;
} | php | public function setControl(Control $control)
{
$control->checkId();
$control->addScriptFeature($this);
$this->control = $control;
$this->updateScriptEvents();
return $this;
} | [
"public",
"function",
"setControl",
"(",
"Control",
"$",
"control",
")",
"{",
"$",
"control",
"->",
"checkId",
"(",
")",
";",
"$",
"control",
"->",
"addScriptFeature",
"(",
"$",
"this",
")",
";",
"$",
"this",
"->",
"control",
"=",
"$",
"control",
";",
... | Set the Control
@api
@param Control $control Control
@return static | [
"Set",
"the",
"Control"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Features/ControlScript.php#L75-L82 |
steeffeen/FancyManiaLinks | FML/Script/Features/ControlScript.php | ControlScript.updateScriptEvents | protected function updateScriptEvents()
{
if (!$this->control || !ScriptLabel::isEventLabel($this->labelName)) {
return $this;
}
if ($this->control instanceof Scriptable) {
$this->control->setScriptEvents(true);
}
return $this;
} | php | protected function updateScriptEvents()
{
if (!$this->control || !ScriptLabel::isEventLabel($this->labelName)) {
return $this;
}
if ($this->control instanceof Scriptable) {
$this->control->setScriptEvents(true);
}
return $this;
} | [
"protected",
"function",
"updateScriptEvents",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"control",
"||",
"!",
"ScriptLabel",
"::",
"isEventLabel",
"(",
"$",
"this",
"->",
"labelName",
")",
")",
"{",
"return",
"$",
"this",
";",
"}",
"if",
"(",
... | Enable Script Events on the Control if needed
@return static | [
"Enable",
"Script",
"Events",
"on",
"the",
"Control",
"if",
"needed"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Features/ControlScript.php#L152-L161 |
steeffeen/FancyManiaLinks | FML/Script/Features/ControlScript.php | ControlScript.buildScriptText | protected function buildScriptText()
{
$controlId = Builder::escapeText($this->control->getId());
$scriptText = '';
$closeBlock = false;
if (ScriptLabel::isEventLabel($this->labelName)) {
$scriptText .= "
if (Event.ControlId == {$controlId}) {
declare Control <=> Event.C... | php | protected function buildScriptText()
{
$controlId = Builder::escapeText($this->control->getId());
$scriptText = '';
$closeBlock = false;
if (ScriptLabel::isEventLabel($this->labelName)) {
$scriptText .= "
if (Event.ControlId == {$controlId}) {
declare Control <=> Event.C... | [
"protected",
"function",
"buildScriptText",
"(",
")",
"{",
"$",
"controlId",
"=",
"Builder",
"::",
"escapeText",
"(",
"$",
"this",
"->",
"control",
"->",
"getId",
"(",
")",
")",
";",
"$",
"scriptText",
"=",
"''",
";",
"$",
"closeBlock",
"=",
"false",
"... | Build the script text for the Control
@return string | [
"Build",
"the",
"script",
"text",
"for",
"the",
"Control"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Features/ControlScript.php#L178-L203 |
yuncms/framework | src/services/Path.php | Path.getVendorPath | public function getVendorPath(): string
{
if ($this->_vendorPath !== null) {
return $this->_vendorPath;
}
$vendorPath = Yii::getAlias('@vendor');
if ($vendorPath === false) {
throw new Exception('There was a problem getting the vendor path.');
}
... | php | public function getVendorPath(): string
{
if ($this->_vendorPath !== null) {
return $this->_vendorPath;
}
$vendorPath = Yii::getAlias('@vendor');
if ($vendorPath === false) {
throw new Exception('There was a problem getting the vendor path.');
}
... | [
"public",
"function",
"getVendorPath",
"(",
")",
":",
"string",
"{",
"if",
"(",
"$",
"this",
"->",
"_vendorPath",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"_vendorPath",
";",
"}",
"$",
"vendorPath",
"=",
"Yii",
"::",
"getAlias",
"(",
"'@ve... | Returns the path to the `vendor/` directory.
@return string
@throws Exception | [
"Returns",
"the",
"path",
"to",
"the",
"vendor",
"/",
"directory",
"."
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/services/Path.php#L39-L52 |
yuncms/framework | src/services/Path.php | Path.getRuntimePath | public function getRuntimePath(): string
{
if ($this->_runtimePath !== null) {
return $this->_runtimePath;
}
$runtimePath = Yii::getAlias('@runtime');
if ($runtimePath === false) {
throw new Exception('There was a problem getting the vendor path.');
}... | php | public function getRuntimePath(): string
{
if ($this->_runtimePath !== null) {
return $this->_runtimePath;
}
$runtimePath = Yii::getAlias('@runtime');
if ($runtimePath === false) {
throw new Exception('There was a problem getting the vendor path.');
}... | [
"public",
"function",
"getRuntimePath",
"(",
")",
":",
"string",
"{",
"if",
"(",
"$",
"this",
"->",
"_runtimePath",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"_runtimePath",
";",
"}",
"$",
"runtimePath",
"=",
"Yii",
"::",
"getAlias",
"(",
"... | Returns the path to the `@runtime/` directory.
@return string
@throws Exception | [
"Returns",
"the",
"path",
"to",
"the",
"@runtime",
"/",
"directory",
"."
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/services/Path.php#L60-L71 |
yuncms/framework | src/services/Path.php | Path.getTempPath | public function getTempPath(): string
{
$path = $this->getRuntimePath() . DIRECTORY_SEPARATOR . 'temp';
FileHelper::createDirectory($path);
return $path;
} | php | public function getTempPath(): string
{
$path = $this->getRuntimePath() . DIRECTORY_SEPARATOR . 'temp';
FileHelper::createDirectory($path);
return $path;
} | [
"public",
"function",
"getTempPath",
"(",
")",
":",
"string",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"getRuntimePath",
"(",
")",
".",
"DIRECTORY_SEPARATOR",
".",
"'temp'",
";",
"FileHelper",
"::",
"createDirectory",
"(",
"$",
"path",
")",
";",
"return",... | Returns the path to the `@runtime/temp/` directory.
@return string
@throws Exception | [
"Returns",
"the",
"path",
"to",
"the",
"@runtime",
"/",
"temp",
"/",
"directory",
"."
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/services/Path.php#L79-L84 |
yuncms/framework | src/services/Path.php | Path.getLogPath | public function getLogPath(): string
{
$path = $this->getRuntimePath() . DIRECTORY_SEPARATOR . 'logs';
FileHelper::createDirectory($path);
return $path;
} | php | public function getLogPath(): string
{
$path = $this->getRuntimePath() . DIRECTORY_SEPARATOR . 'logs';
FileHelper::createDirectory($path);
return $path;
} | [
"public",
"function",
"getLogPath",
"(",
")",
":",
"string",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"getRuntimePath",
"(",
")",
".",
"DIRECTORY_SEPARATOR",
".",
"'logs'",
";",
"FileHelper",
"::",
"createDirectory",
"(",
"$",
"path",
")",
";",
"return",
... | Returns the path to the `@runtime/logs/` directory.
@return string
@throws Exception | [
"Returns",
"the",
"path",
"to",
"the",
"@runtime",
"/",
"logs",
"/",
"directory",
"."
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/services/Path.php#L92-L97 |
yuncms/framework | src/services/Path.php | Path.getSessionPath | public function getSessionPath(): string
{
$path = $this->getRuntimePath() . DIRECTORY_SEPARATOR . 'sessions';
FileHelper::createDirectory($path);
return $path;
} | php | public function getSessionPath(): string
{
$path = $this->getRuntimePath() . DIRECTORY_SEPARATOR . 'sessions';
FileHelper::createDirectory($path);
return $path;
} | [
"public",
"function",
"getSessionPath",
"(",
")",
":",
"string",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"getRuntimePath",
"(",
")",
".",
"DIRECTORY_SEPARATOR",
".",
"'sessions'",
";",
"FileHelper",
"::",
"createDirectory",
"(",
"$",
"path",
")",
";",
"r... | Returns the path to the `@runtime/sessions/` directory.
@return string
@throws Exception | [
"Returns",
"the",
"path",
"to",
"the",
"@runtime",
"/",
"sessions",
"/",
"directory",
"."
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/services/Path.php#L105-L110 |
yuncms/framework | src/services/Path.php | Path.getCachePath | public function getCachePath(): string
{
$path = $this->getRuntimePath() . DIRECTORY_SEPARATOR . 'cache';
FileHelper::createDirectory($path);
return $path;
} | php | public function getCachePath(): string
{
$path = $this->getRuntimePath() . DIRECTORY_SEPARATOR . 'cache';
FileHelper::createDirectory($path);
return $path;
} | [
"public",
"function",
"getCachePath",
"(",
")",
":",
"string",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"getRuntimePath",
"(",
")",
".",
"DIRECTORY_SEPARATOR",
".",
"'cache'",
";",
"FileHelper",
"::",
"createDirectory",
"(",
"$",
"path",
")",
";",
"return... | Returns the path to the file cache directory.
This will be located at `@runtime/cache/` by default, but that can be overridden with the 'cachePath'.
@return string
@throws Exception | [
"Returns",
"the",
"path",
"to",
"the",
"file",
"cache",
"directory",
"."
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/services/Path.php#L120-L125 |
aedart/laravel-helpers | src/Traits/Translation/LangTrait.php | LangTrait.getLang | public function getLang(): ?Translator
{
if (!$this->hasLang()) {
$this->setLang($this->getDefaultLang());
}
return $this->lang;
} | php | public function getLang(): ?Translator
{
if (!$this->hasLang()) {
$this->setLang($this->getDefaultLang());
}
return $this->lang;
} | [
"public",
"function",
"getLang",
"(",
")",
":",
"?",
"Translator",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasLang",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setLang",
"(",
"$",
"this",
"->",
"getDefaultLang",
"(",
")",
")",
";",
"}",
"return",
"... | Get lang
If no lang has been set, this method will
set and return a default lang, if any such
value is available
@see getDefaultLang()
@return Translator|null lang or null if none lang has been set | [
"Get",
"lang"
] | train | https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Translation/LangTrait.php#L53-L59 |
webforge-labs/psc-cms | lib/Psc/Code/Generate/GFunction.php | GFunction.php | public function php($baseIndent = 0) {
$php = NULL;
$cr = "\n";
$php .= $this->phpSignature($baseIndent);
$php .= $this->phpBody($baseIndent);
return $php;
} | php | public function php($baseIndent = 0) {
$php = NULL;
$cr = "\n";
$php .= $this->phpSignature($baseIndent);
$php .= $this->phpBody($baseIndent);
return $php;
} | [
"public",
"function",
"php",
"(",
"$",
"baseIndent",
"=",
"0",
")",
"{",
"$",
"php",
"=",
"NULL",
";",
"$",
"cr",
"=",
"\"\\n\"",
";",
"$",
"php",
".=",
"$",
"this",
"->",
"phpSignature",
"(",
"$",
"baseIndent",
")",
";",
"$",
"php",
".=",
"$",
... | Gibt den PHPCode für die Funktion zurück
nach der } ist kein LF | [
"Gibt",
"den",
"PHPCode",
"für",
"die",
"Funktion",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Code/Generate/GFunction.php#L87-L95 |
webforge-labs/psc-cms | lib/Psc/Code/Generate/GFunction.php | GFunction.setBodyCode | public function setBodyCode(Array $lines) {
$this->sourceCode = implode("\n",$lines); // indent egal, wird eh nicht geparsed, da wir ja schon bodyCode fertig haben
$this->body = array(); // cache reset
$this->bodyCode = $lines;
return $this;
} | php | public function setBodyCode(Array $lines) {
$this->sourceCode = implode("\n",$lines); // indent egal, wird eh nicht geparsed, da wir ja schon bodyCode fertig haben
$this->body = array(); // cache reset
$this->bodyCode = $lines;
return $this;
} | [
"public",
"function",
"setBodyCode",
"(",
"Array",
"$",
"lines",
")",
"{",
"$",
"this",
"->",
"sourceCode",
"=",
"implode",
"(",
"\"\\n\"",
",",
"$",
"lines",
")",
";",
"// indent egal, wird eh nicht geparsed, da wir ja schon bodyCode fertig haben",
"$",
"this",
"->... | Setzt den Body Code als Array (jede Zeile ein Eintrag im Array)
anders als setBody ist dies hier schneller, da bei setBody immer der Body-Code erneut geparsed werden muss (wegen indentation)
es ist aber zu gewährleisten, dass wirklich jede Zeile ein Eintag im Array ist | [
"Setzt",
"den",
"Body",
"Code",
"als",
"Array",
"(",
"jede",
"Zeile",
"ein",
"Eintrag",
"im",
"Array",
")"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Code/Generate/GFunction.php#L244-L249 |
webforge-labs/psc-cms | lib/Psc/Code/Generate/GFunction.php | GFunction.appendBodyLines | public function appendBodyLines(Array $codeLines) {
$this->bodyCode = array_merge($this->getBodyCode(), $codeLines);
return $this;
} | php | public function appendBodyLines(Array $codeLines) {
$this->bodyCode = array_merge($this->getBodyCode(), $codeLines);
return $this;
} | [
"public",
"function",
"appendBodyLines",
"(",
"Array",
"$",
"codeLines",
")",
"{",
"$",
"this",
"->",
"bodyCode",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"getBodyCode",
"(",
")",
",",
"$",
"codeLines",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Fügt dem Code der Funktion neue Zeilen am Ende hinzu
@param array $codeLines | [
"Fügt",
"dem",
"Code",
"der",
"Funktion",
"neue",
"Zeilen",
"am",
"Ende",
"hinzu"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Code/Generate/GFunction.php#L306-L309 |
PortaText/php-sdk | src/PortaText/Command/Api/NumberVerify.php | NumberVerify.getEndpoint | protected function getEndpoint($method)
{
$number = $this->getArgument("number");
if (is_null($number)) {
throw new \InvalidArgumentException("Number cant be null");
}
$this->delArgument("number");
$endpoint = "number_verify/$number";
$code = $this->getAr... | php | protected function getEndpoint($method)
{
$number = $this->getArgument("number");
if (is_null($number)) {
throw new \InvalidArgumentException("Number cant be null");
}
$this->delArgument("number");
$endpoint = "number_verify/$number";
$code = $this->getAr... | [
"protected",
"function",
"getEndpoint",
"(",
"$",
"method",
")",
"{",
"$",
"number",
"=",
"$",
"this",
"->",
"getArgument",
"(",
"\"number\"",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"number",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentExcept... | Returns a string with the endpoint for the given command.
@param string $method Method for this command.
@return string | [
"Returns",
"a",
"string",
"with",
"the",
"endpoint",
"for",
"the",
"given",
"command",
"."
] | train | https://github.com/PortaText/php-sdk/blob/dbe04ef043db5b251953f9de57aa4d0f1785dfcc/src/PortaText/Command/Api/NumberVerify.php#L76-L91 |
digitalkaoz/versioneye-php | src/Client.php | Client.api | public function api($name)
{
$this->initializeClient($this->url, $this->client);
$class = 'Rs\\VersionEye\\Api\\' . ucfirst($name);
if (class_exists($class)) {
return new $class($this->client);
} else {
throw new \InvalidArgumentException('unknown api "' . $... | php | public function api($name)
{
$this->initializeClient($this->url, $this->client);
$class = 'Rs\\VersionEye\\Api\\' . ucfirst($name);
if (class_exists($class)) {
return new $class($this->client);
} else {
throw new \InvalidArgumentException('unknown api "' . $... | [
"public",
"function",
"api",
"(",
"$",
"name",
")",
"{",
"$",
"this",
"->",
"initializeClient",
"(",
"$",
"this",
"->",
"url",
",",
"$",
"this",
"->",
"client",
")",
";",
"$",
"class",
"=",
"'Rs\\\\VersionEye\\\\Api\\\\'",
".",
"ucfirst",
"(",
"$",
"na... | returns an api.
@param string $name
@throws \InvalidArgumentException
@return Api | [
"returns",
"an",
"api",
"."
] | train | https://github.com/digitalkaoz/versioneye-php/blob/7b8eb9cdc83e01138dda0e709c07e3beb6aad136/src/Client.php#L46-L57 |
digitalkaoz/versioneye-php | src/Client.php | Client.initializeClient | private function initializeClient($url, HttpClient $client = null)
{
if ($client) {
return $this->client = $client;
}
return $this->client = $this->createDefaultHttpClient($url);
} | php | private function initializeClient($url, HttpClient $client = null)
{
if ($client) {
return $this->client = $client;
}
return $this->client = $this->createDefaultHttpClient($url);
} | [
"private",
"function",
"initializeClient",
"(",
"$",
"url",
",",
"HttpClient",
"$",
"client",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"client",
")",
"{",
"return",
"$",
"this",
"->",
"client",
"=",
"$",
"client",
";",
"}",
"return",
"$",
"this",
"->",... | initializes the http client.
@param string $url
@param HttpClient $client
@return HttpClient | [
"initializes",
"the",
"http",
"client",
"."
] | train | https://github.com/digitalkaoz/versioneye-php/blob/7b8eb9cdc83e01138dda0e709c07e3beb6aad136/src/Client.php#L77-L84 |
periaptio/empress-generator | src/Generators/ModelGenerator.php | ModelGenerator.getTemplateData | public function getTemplateData($schema, $data = [])
{
$importTraits = $traits = [];
if (isset($schema['deleted_at']) && $schema['deleted_at']['type'] === 'date') {
$importTraits[] = $variables['SOFT_DELETE_IMPORT'];
$traits[] = $variables['SOFT_DELETE_TRAIT'];
}
... | php | public function getTemplateData($schema, $data = [])
{
$importTraits = $traits = [];
if (isset($schema['deleted_at']) && $schema['deleted_at']['type'] === 'date') {
$importTraits[] = $variables['SOFT_DELETE_IMPORT'];
$traits[] = $variables['SOFT_DELETE_TRAIT'];
}
... | [
"public",
"function",
"getTemplateData",
"(",
"$",
"schema",
",",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"$",
"importTraits",
"=",
"$",
"traits",
"=",
"[",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"schema",
"[",
"'deleted_at'",
"]",
")",
"&&",
"$",
... | Fetch the template data
@return array | [
"Fetch",
"the",
"template",
"data"
] | train | https://github.com/periaptio/empress-generator/blob/749fb4b12755819e9c97377ebfb446ee0822168a/src/Generators/ModelGenerator.php#L91-L126 |
yuncms/framework | src/widgets/ActiveField.php | ActiveField.fileInput | public function fileInput($options = [])
{
$options = ArrayHelper::merge([
'class' => 'filestyle',
'data' => [
'buttonText' => Yii::t('yuncms', 'Choose file'),
]
], $options);
BootstrapFileStyleAsset::register(Yii::$app->view);
retu... | php | public function fileInput($options = [])
{
$options = ArrayHelper::merge([
'class' => 'filestyle',
'data' => [
'buttonText' => Yii::t('yuncms', 'Choose file'),
]
], $options);
BootstrapFileStyleAsset::register(Yii::$app->view);
retu... | [
"public",
"function",
"fileInput",
"(",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"=",
"ArrayHelper",
"::",
"merge",
"(",
"[",
"'class'",
"=>",
"'filestyle'",
",",
"'data'",
"=>",
"[",
"'buttonText'",
"=>",
"Yii",
"::",
"t",
"(",
"'yuncm... | 显示文件上传窗口
@param array $options
@return \yii\bootstrap\ActiveField | [
"显示文件上传窗口"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/widgets/ActiveField.php#L27-L37 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.