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 |
|---|---|---|---|---|---|---|---|---|---|---|
fond-of/spryker-brand | src/FondOfSpryker/Zed/Brand/Business/Brand/Brand.php | Brand.update | public function update(BrandTransfer $brandTransfer): BrandResponseTransfer
{
$brandEntity = $this->getBrand($brandTransfer);
$brandEntity->fromArray($brandTransfer->modifiedToArray());
$brandEntity->save();
$brandResponseTransfer = new BrandResponseTransfer();
$brandRespons... | php | public function update(BrandTransfer $brandTransfer): BrandResponseTransfer
{
$brandEntity = $this->getBrand($brandTransfer);
$brandEntity->fromArray($brandTransfer->modifiedToArray());
$brandEntity->save();
$brandResponseTransfer = new BrandResponseTransfer();
$brandRespons... | [
"public",
"function",
"update",
"(",
"BrandTransfer",
"$",
"brandTransfer",
")",
":",
"BrandResponseTransfer",
"{",
"$",
"brandEntity",
"=",
"$",
"this",
"->",
"getBrand",
"(",
"$",
"brandTransfer",
")",
";",
"$",
"brandEntity",
"->",
"fromArray",
"(",
"$",
... | @param \Generated\Shared\Transfer\BrandTransfer $brandTransfer
@return \Generated\Shared\Transfer\BrandResponseTransfer | [
"@param",
"\\",
"Generated",
"\\",
"Shared",
"\\",
"Transfer",
"\\",
"BrandTransfer",
"$brandTransfer"
] | train | https://github.com/fond-of/spryker-brand/blob/0ae25c381649b70845016606de9cf4e7dfdccffa/src/FondOfSpryker/Zed/Brand/Business/Brand/Brand.php#L123-L133 |
fond-of/spryker-brand | src/FondOfSpryker/Zed/Brand/Business/Brand/Brand.php | Brand.findById | public function findById(BrandTransfer $brandTransfer): ?BrandTransfer
{
try {
$brandTransfer->requireIdBrand();
return $this->get($brandTransfer);
} catch (BrandNotFoundException $e) {
return null;
}
} | php | public function findById(BrandTransfer $brandTransfer): ?BrandTransfer
{
try {
$brandTransfer->requireIdBrand();
return $this->get($brandTransfer);
} catch (BrandNotFoundException $e) {
return null;
}
} | [
"public",
"function",
"findById",
"(",
"BrandTransfer",
"$",
"brandTransfer",
")",
":",
"?",
"BrandTransfer",
"{",
"try",
"{",
"$",
"brandTransfer",
"->",
"requireIdBrand",
"(",
")",
";",
"return",
"$",
"this",
"->",
"get",
"(",
"$",
"brandTransfer",
")",
... | @param \Generated\Shared\Transfer\BrandTransfer $brandTransfer $brandTransfer
@return \Generated\Shared\Transfer\BrandTransfer|null $brandTransfer|null | [
"@param",
"\\",
"Generated",
"\\",
"Shared",
"\\",
"Transfer",
"\\",
"BrandTransfer",
"$brandTransfer",
"$brandTransfer"
] | train | https://github.com/fond-of/spryker-brand/blob/0ae25c381649b70845016606de9cf4e7dfdccffa/src/FondOfSpryker/Zed/Brand/Business/Brand/Brand.php#L140-L148 |
fond-of/spryker-brand | src/FondOfSpryker/Zed/Brand/Business/Brand/Brand.php | Brand.findByName | public function findByName(BrandTransfer $brandTransfer): ?BrandTransfer
{
try {
$brandTransfer->requireName();
return $this->get($brandTransfer);
} catch (BrandNotFoundException $e) {
return null;
}
} | php | public function findByName(BrandTransfer $brandTransfer): ?BrandTransfer
{
try {
$brandTransfer->requireName();
return $this->get($brandTransfer);
} catch (BrandNotFoundException $e) {
return null;
}
} | [
"public",
"function",
"findByName",
"(",
"BrandTransfer",
"$",
"brandTransfer",
")",
":",
"?",
"BrandTransfer",
"{",
"try",
"{",
"$",
"brandTransfer",
"->",
"requireName",
"(",
")",
";",
"return",
"$",
"this",
"->",
"get",
"(",
"$",
"brandTransfer",
")",
"... | @param \Generated\Shared\Transfer\BrandTransfer $brandTransfer $brandTransfer
@return \Generated\Shared\Transfer\BrandTransfer|null | [
"@param",
"\\",
"Generated",
"\\",
"Shared",
"\\",
"Transfer",
"\\",
"BrandTransfer",
"$brandTransfer",
"$brandTransfer"
] | train | https://github.com/fond-of/spryker-brand/blob/0ae25c381649b70845016606de9cf4e7dfdccffa/src/FondOfSpryker/Zed/Brand/Business/Brand/Brand.php#L155-L163 |
fond-of/spryker-brand | src/FondOfSpryker/Zed/Brand/Business/Brand/Brand.php | Brand.hasBrand | public function hasBrand(BrandTransfer $brandTransfer): bool
{
try {
$this->getBrand($brandTransfer);
return true;
} catch (BrandNotFoundException $e) {
return false;
}
} | php | public function hasBrand(BrandTransfer $brandTransfer): bool
{
try {
$this->getBrand($brandTransfer);
return true;
} catch (BrandNotFoundException $e) {
return false;
}
} | [
"public",
"function",
"hasBrand",
"(",
"BrandTransfer",
"$",
"brandTransfer",
")",
":",
"bool",
"{",
"try",
"{",
"$",
"this",
"->",
"getBrand",
"(",
"$",
"brandTransfer",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"BrandNotFoundException",
"$",
"e... | @param \Generated\Shared\Transfer\BrandTransfer $brandTransfer
@return bool | [
"@param",
"\\",
"Generated",
"\\",
"Shared",
"\\",
"Transfer",
"\\",
"BrandTransfer",
"$brandTransfer"
] | train | https://github.com/fond-of/spryker-brand/blob/0ae25c381649b70845016606de9cf4e7dfdccffa/src/FondOfSpryker/Zed/Brand/Business/Brand/Brand.php#L170-L178 |
fond-of/spryker-brand | src/FondOfSpryker/Zed/Brand/Business/Brand/Brand.php | Brand.getBrand | protected function getBrand(BrandTransfer $brandTransfer): FosBrand
{
$brandEntity = null;
if ($brandTransfer->getIdBrand()) {
$brandEntity = $this->queryContainer->queryBrandById($brandTransfer->getIdBrand())
->findOne();
} elseif ($brandTransfer->getName()) {
... | php | protected function getBrand(BrandTransfer $brandTransfer): FosBrand
{
$brandEntity = null;
if ($brandTransfer->getIdBrand()) {
$brandEntity = $this->queryContainer->queryBrandById($brandTransfer->getIdBrand())
->findOne();
} elseif ($brandTransfer->getName()) {
... | [
"protected",
"function",
"getBrand",
"(",
"BrandTransfer",
"$",
"brandTransfer",
")",
":",
"FosBrand",
"{",
"$",
"brandEntity",
"=",
"null",
";",
"if",
"(",
"$",
"brandTransfer",
"->",
"getIdBrand",
"(",
")",
")",
"{",
"$",
"brandEntity",
"=",
"$",
"this",... | @param \Generated\Shared\Transfer\BrandTransfer $brandTransfer
@throws \FondOfSpryker\Zed\Brand\Business\Exception\BrandNotFoundException
@return \Orm\Zed\Brand\Persistence\FosBrand | [
"@param",
"\\",
"Generated",
"\\",
"Shared",
"\\",
"Transfer",
"\\",
"BrandTransfer",
"$brandTransfer"
] | train | https://github.com/fond-of/spryker-brand/blob/0ae25c381649b70845016606de9cf4e7dfdccffa/src/FondOfSpryker/Zed/Brand/Business/Brand/Brand.php#L187-L204 |
redaigbaria/oauth2 | src/Entity/AccessTokenEntity.php | AccessTokenEntity.getSession | public function getSession()
{
if ($this->session instanceof SessionEntity) {
return $this->session;
}
$this->session = $this->server->getSessionStorage()->getByAccessToken($this);
return $this->session;
} | php | public function getSession()
{
if ($this->session instanceof SessionEntity) {
return $this->session;
}
$this->session = $this->server->getSessionStorage()->getByAccessToken($this);
return $this->session;
} | [
"public",
"function",
"getSession",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"session",
"instanceof",
"SessionEntity",
")",
"{",
"return",
"$",
"this",
"->",
"session",
";",
"}",
"$",
"this",
"->",
"session",
"=",
"$",
"this",
"->",
"server",
"->",... | Get session
@return \League\OAuth2\Server\Entity\SessionEntity | [
"Get",
"session"
] | train | https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/src/Entity/AccessTokenEntity.php#L24-L33 |
redaigbaria/oauth2 | src/Entity/AccessTokenEntity.php | AccessTokenEntity.getScopes | public function getScopes()
{
if ($this->scopes === null) {
$this->scopes = $this->formatScopes(
$this->server->getAccessTokenStorage()->getScopes($this)
);
}
return $this->scopes;
} | php | public function getScopes()
{
if ($this->scopes === null) {
$this->scopes = $this->formatScopes(
$this->server->getAccessTokenStorage()->getScopes($this)
);
}
return $this->scopes;
} | [
"public",
"function",
"getScopes",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"scopes",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"scopes",
"=",
"$",
"this",
"->",
"formatScopes",
"(",
"$",
"this",
"->",
"server",
"->",
"getAccessTokenStorage",
"("... | Return all scopes associated with the access token
@return \League\OAuth2\Server\Entity\ScopeEntity[] | [
"Return",
"all",
"scopes",
"associated",
"with",
"the",
"access",
"token"
] | train | https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/src/Entity/AccessTokenEntity.php#L56-L65 |
redaigbaria/oauth2 | src/Entity/AccessTokenEntity.php | AccessTokenEntity.save | public function save()
{
$this->server->getAccessTokenStorage()->create(
$this->getId(),
$this->getExpireTime(),
$this->getSession()->getId()
);
// Associate the scope with the token
foreach ($this->getScopes() as $scope) {
$this->serv... | php | public function save()
{
$this->server->getAccessTokenStorage()->create(
$this->getId(),
$this->getExpireTime(),
$this->getSession()->getId()
);
// Associate the scope with the token
foreach ($this->getScopes() as $scope) {
$this->serv... | [
"public",
"function",
"save",
"(",
")",
"{",
"$",
"this",
"->",
"server",
"->",
"getAccessTokenStorage",
"(",
")",
"->",
"create",
"(",
"$",
"this",
"->",
"getId",
"(",
")",
",",
"$",
"this",
"->",
"getExpireTime",
"(",
")",
",",
"$",
"this",
"->",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/src/Entity/AccessTokenEntity.php#L70-L84 |
rayrutjes/domain-foundation | src/UnitOfWork/Listener/UnitOfWorkListenerCollection.php | UnitOfWorkListenerCollection.onEventRegistration | public function onEventRegistration(UnitOfWork $unitOfWork, Event $event)
{
foreach ($this->listeners as $listener) {
$event = $listener->onEventRegistration($unitOfWork, $event);
}
return $event;
} | php | public function onEventRegistration(UnitOfWork $unitOfWork, Event $event)
{
foreach ($this->listeners as $listener) {
$event = $listener->onEventRegistration($unitOfWork, $event);
}
return $event;
} | [
"public",
"function",
"onEventRegistration",
"(",
"UnitOfWork",
"$",
"unitOfWork",
",",
"Event",
"$",
"event",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"listeners",
"as",
"$",
"listener",
")",
"{",
"$",
"event",
"=",
"$",
"listener",
"->",
"onEventRegi... | @param UnitOfWork $unitOfWork
@param Event $event
@return Event | [
"@param",
"UnitOfWork",
"$unitOfWork",
"@param",
"Event",
"$event"
] | train | https://github.com/rayrutjes/domain-foundation/blob/2bce7cd6a6612f718e70e3176589c1abf39d1a3e/src/UnitOfWork/Listener/UnitOfWorkListenerCollection.php#L52-L59 |
CakeCMS/Core | src/View/Helper/NavHelper.php | NavHelper.render | public function render($key, array $items = [], array $options = [], $level = 1)
{
$i = 0;
$output = [];
$options = Hash::merge($this->_default, $options);
$sorted = Hash::sort($items, '{s}.weight', 'ASC');
$itemCount = count($sorted);
foreach ($sorted as $it... | php | public function render($key, array $items = [], array $options = [], $level = 1)
{
$i = 0;
$output = [];
$options = Hash::merge($this->_default, $options);
$sorted = Hash::sort($items, '{s}.weight', 'ASC');
$itemCount = count($sorted);
foreach ($sorted as $it... | [
"public",
"function",
"render",
"(",
"$",
"key",
",",
"array",
"$",
"items",
"=",
"[",
"]",
",",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"$",
"level",
"=",
"1",
")",
"{",
"$",
"i",
"=",
"0",
";",
"$",
"output",
"=",
"[",
"]",
";",
"$",... | Render menu.
@param string $key
@param array $items
@param array $options
@param int $level
@return string
@SuppressWarnings(PHPMD.ShortVariable) | [
"Render",
"menu",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Helper/NavHelper.php#L73-L113 |
CakeCMS/Core | src/View/Helper/NavHelper.php | NavHelper._getCurrentMenuElement | protected function _getCurrentMenuElement(array $options = [], $level = 1)
{
if ($level > 1) {
$levelElement = $this->_getLevelElement($options, $level);
if ($this->_View->elementExists($levelElement)) {
return $levelElement;
}
return $options... | php | protected function _getCurrentMenuElement(array $options = [], $level = 1)
{
if ($level > 1) {
$levelElement = $this->_getLevelElement($options, $level);
if ($this->_View->elementExists($levelElement)) {
return $levelElement;
}
return $options... | [
"protected",
"function",
"_getCurrentMenuElement",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"$",
"level",
"=",
"1",
")",
"{",
"if",
"(",
"$",
"level",
">",
"1",
")",
"{",
"$",
"levelElement",
"=",
"$",
"this",
"->",
"_getLevelElement",
"(",
... | Get current menu element.
@param array $options
@param int $level
@return string | [
"Get",
"current",
"menu",
"element",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Helper/NavHelper.php#L122-L134 |
CakeCMS/Core | src/View/Helper/NavHelper.php | NavHelper._getLevelElement | protected function _getLevelElement(array $options, $level)
{
$levelElement = 'menu_child_' . $level;
$element = $options['childMenuAttr']['element'];
list($plugin, $path) = $this->_View->pluginSplit($element);
$path = FS::clean($path, '/');
$details = explode('/', $... | php | protected function _getLevelElement(array $options, $level)
{
$levelElement = 'menu_child_' . $level;
$element = $options['childMenuAttr']['element'];
list($plugin, $path) = $this->_View->pluginSplit($element);
$path = FS::clean($path, '/');
$details = explode('/', $... | [
"protected",
"function",
"_getLevelElement",
"(",
"array",
"$",
"options",
",",
"$",
"level",
")",
"{",
"$",
"levelElement",
"=",
"'menu_child_'",
".",
"$",
"level",
";",
"$",
"element",
"=",
"$",
"options",
"[",
"'childMenuAttr'",
"]",
"[",
"'element'",
"... | Get current menu level element.
@param array $options
@param int $level
@return string | [
"Get",
"current",
"menu",
"level",
"element",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Helper/NavHelper.php#L143-L156 |
CakeCMS/Core | src/View/Helper/NavHelper.php | NavHelper._setFirstLast | protected function _setFirstLast($i, $itemCount, array $item = [])
{
$item = array_merge(['last' => false, 'first' => false], $item);
if ($i == 1) {
$item['first'] = true;
}
if ($i == $itemCount) {
$item['last'] = true;
}
return $item;
} | php | protected function _setFirstLast($i, $itemCount, array $item = [])
{
$item = array_merge(['last' => false, 'first' => false], $item);
if ($i == 1) {
$item['first'] = true;
}
if ($i == $itemCount) {
$item['last'] = true;
}
return $item;
} | [
"protected",
"function",
"_setFirstLast",
"(",
"$",
"i",
",",
"$",
"itemCount",
",",
"array",
"$",
"item",
"=",
"[",
"]",
")",
"{",
"$",
"item",
"=",
"array_merge",
"(",
"[",
"'last'",
"=>",
"false",
",",
"'first'",
"=>",
"false",
"]",
",",
"$",
"i... | Setup first last item params.
@param int $i
@param int $itemCount
@param array $item
@return array
@SuppressWarnings(PHPMD.ShortVariable) | [
"Setup",
"first",
"last",
"item",
"params",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Helper/NavHelper.php#L167-L179 |
CakeCMS/Core | src/View/Helper/NavHelper.php | NavHelper.getLiAttr | public function getLiAttr()
{
$params = self::$_itemParams;
$attr = ['class' => 'li-item'];
if (isset($params['item']['liClass'])) {
$attr = $this->addClass($attr, $params['item']['liClass']);
}
if ($params['item']['last']) {
$attr = $this->addClas... | php | public function getLiAttr()
{
$params = self::$_itemParams;
$attr = ['class' => 'li-item'];
if (isset($params['item']['liClass'])) {
$attr = $this->addClass($attr, $params['item']['liClass']);
}
if ($params['item']['last']) {
$attr = $this->addClas... | [
"public",
"function",
"getLiAttr",
"(",
")",
"{",
"$",
"params",
"=",
"self",
"::",
"$",
"_itemParams",
";",
"$",
"attr",
"=",
"[",
"'class'",
"=>",
"'li-item'",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"params",
"[",
"'item'",
"]",
"[",
"'liClass'",
... | Get default li attributes.
@return array | [
"Get",
"default",
"li",
"attributes",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Helper/NavHelper.php#L186-L204 |
CakeCMS/Core | src/View/Helper/NavHelper.php | NavHelper._setActive | protected function _setActive(array $attr = [])
{
if ($this->Url->build(self::$_itemParams['item']['url']) == env('REQUEST_URI')) {
$attr = $this->addClass($attr, 'active');
}
return $attr;
} | php | protected function _setActive(array $attr = [])
{
if ($this->Url->build(self::$_itemParams['item']['url']) == env('REQUEST_URI')) {
$attr = $this->addClass($attr, 'active');
}
return $attr;
} | [
"protected",
"function",
"_setActive",
"(",
"array",
"$",
"attr",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"Url",
"->",
"build",
"(",
"self",
"::",
"$",
"_itemParams",
"[",
"'item'",
"]",
"[",
"'url'",
"]",
")",
"==",
"env",
"(",
"'... | Set active item link.
@param array $attr
@return array | [
"Set",
"active",
"item",
"link",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Helper/NavHelper.php#L212-L219 |
yuncms/framework | src/behaviors/PolymorphicRelation.php | PolymorphicRelation.getPolymorphicRelation | public function getPolymorphicRelation()
{
if ($this->_cached !== null) {
return $this->_cached;
}
$className = $this->owner->getAttribute($this->classAttribute);
if ($className == "") {
return null;
}
if (!class_exists($className)) {
... | php | public function getPolymorphicRelation()
{
if ($this->_cached !== null) {
return $this->_cached;
}
$className = $this->owner->getAttribute($this->classAttribute);
if ($className == "") {
return null;
}
if (!class_exists($className)) {
... | [
"public",
"function",
"getPolymorphicRelation",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_cached",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"_cached",
";",
"}",
"$",
"className",
"=",
"$",
"this",
"->",
"owner",
"->",
"getAttribute",
... | Returns the Underlying Object
@return mixed | [
"Returns",
"the",
"Underlying",
"Object"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/behaviors/PolymorphicRelation.php#L50-L70 |
yuncms/framework | src/behaviors/PolymorphicRelation.php | PolymorphicRelation.validateUnderlyingObjectType | private function validateUnderlyingObjectType($object)
{
if (count($this->mustBeInstanceOf) == 0) {
return true;
}
foreach ($this->mustBeInstanceOf as $instance) {
if ($object instanceof $instance) { //|| $object->asa($instance) !== null
return true;
... | php | private function validateUnderlyingObjectType($object)
{
if (count($this->mustBeInstanceOf) == 0) {
return true;
}
foreach ($this->mustBeInstanceOf as $instance) {
if ($object instanceof $instance) { //|| $object->asa($instance) !== null
return true;
... | [
"private",
"function",
"validateUnderlyingObjectType",
"(",
"$",
"object",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"mustBeInstanceOf",
")",
"==",
"0",
")",
"{",
"return",
"true",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"mustBeInstanceOf"... | Validates if given object is of allowed type
@param mixed $object
@return boolean | [
"Validates",
"if",
"given",
"object",
"is",
"of",
"allowed",
"type"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/behaviors/PolymorphicRelation.php#L98-L110 |
webforge-labs/psc-cms | lib/PHPWord/PHPWord/Shared/String.php | PHPWord_Shared_String.getIsIconvEnabled | public static function getIsIconvEnabled()
{
if (isset(self::$_isIconvEnabled)) {
return self::$_isIconvEnabled;
}
self::$_isIconvEnabled = function_exists('iconv') ?
true : false;
return self::$_isIconvEnabled;
} | php | public static function getIsIconvEnabled()
{
if (isset(self::$_isIconvEnabled)) {
return self::$_isIconvEnabled;
}
self::$_isIconvEnabled = function_exists('iconv') ?
true : false;
return self::$_isIconvEnabled;
} | [
"public",
"static",
"function",
"getIsIconvEnabled",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"_isIconvEnabled",
")",
")",
"{",
"return",
"self",
"::",
"$",
"_isIconvEnabled",
";",
"}",
"self",
"::",
"$",
"_isIconvEnabled",
"=",
"function... | Get whether iconv extension is available
@return boolean | [
"Get",
"whether",
"iconv",
"extension",
"is",
"available"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/PHPWord/PHPWord/Shared/String.php#L87-L97 |
webforge-labs/psc-cms | lib/PHPWord/PHPWord/Shared/String.php | PHPWord_Shared_String.ControlCharacterOOXML2PHP | public static function ControlCharacterOOXML2PHP($value = '') {
if(empty(self::$_controlCharacters)) {
self::_buildControlCharacters();
}
return str_replace( array_keys(self::$_controlCharacters), array_values(self::$_controlCharacters), $value );
} | php | public static function ControlCharacterOOXML2PHP($value = '') {
if(empty(self::$_controlCharacters)) {
self::_buildControlCharacters();
}
return str_replace( array_keys(self::$_controlCharacters), array_values(self::$_controlCharacters), $value );
} | [
"public",
"static",
"function",
"ControlCharacterOOXML2PHP",
"(",
"$",
"value",
"=",
"''",
")",
"{",
"if",
"(",
"empty",
"(",
"self",
"::",
"$",
"_controlCharacters",
")",
")",
"{",
"self",
"::",
"_buildControlCharacters",
"(",
")",
";",
"}",
"return",
"st... | Convert from OpenXML escaped control character to PHP control character
Excel 2007 team:
----------------
That's correct, control characters are stored directly in the shared-strings table.
We do encode characters that cannot be represented in XML using the following escape sequence:
_xHHHH_ where H represents a hexad... | [
"Convert",
"from",
"OpenXML",
"escaped",
"control",
"character",
"to",
"PHP",
"control",
"character"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/PHPWord/PHPWord/Shared/String.php#L113-L119 |
webforge-labs/psc-cms | lib/PHPWord/PHPWord/Shared/String.php | PHPWord_Shared_String.UTF8toBIFF8UnicodeLong | public static function UTF8toBIFF8UnicodeLong($value)
{
// character count
$ln = self::CountCharacters($value, 'UTF-8');
// option flags
$opt = (self::getIsMbstringEnabled() || self::getIsIconvEnabled()) ?
0x0001 : 0x0000;
// characters
$chars = self::ConvertEncoding($value, 'UTF-16LE', 'UTF-8');
... | php | public static function UTF8toBIFF8UnicodeLong($value)
{
// character count
$ln = self::CountCharacters($value, 'UTF-8');
// option flags
$opt = (self::getIsMbstringEnabled() || self::getIsIconvEnabled()) ?
0x0001 : 0x0000;
// characters
$chars = self::ConvertEncoding($value, 'UTF-16LE', 'UTF-8');
... | [
"public",
"static",
"function",
"UTF8toBIFF8UnicodeLong",
"(",
"$",
"value",
")",
"{",
"// character count",
"$",
"ln",
"=",
"self",
"::",
"CountCharacters",
"(",
"$",
"value",
",",
"'UTF-8'",
")",
";",
"// option flags",
"$",
"opt",
"=",
"(",
"self",
"::",
... | Converts a UTF-8 string into BIFF8 Unicode string data (16-bit string length)
Writes the string using uncompressed notation, no rich text, no Asian phonetics
If mbstring extension is not available, ASCII is assumed, and compressed notation is used
although this will give wrong results for non-ASCII strings
see OpenOffi... | [
"Converts",
"a",
"UTF",
"-",
"8",
"string",
"into",
"BIFF8",
"Unicode",
"string",
"data",
"(",
"16",
"-",
"bit",
"string",
"length",
")",
"Writes",
"the",
"string",
"using",
"uncompressed",
"notation",
"no",
"rich",
"text",
"no",
"Asian",
"phonetics",
"If"... | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/PHPWord/PHPWord/Shared/String.php#L199-L213 |
webforge-labs/psc-cms | lib/PHPWord/PHPWord/Shared/String.php | PHPWord_Shared_String.ConvertEncoding | public static function ConvertEncoding($value, $to, $from)
{
if (self::getIsMbstringEnabled()) {
$value = mb_convert_encoding($value, $to, $from);
return $value;
}
if (self::getIsIconvEnabled()) {
$value = iconv($from, $to, $value);
return $value;
}
// else, no conversion
return $value;
} | php | public static function ConvertEncoding($value, $to, $from)
{
if (self::getIsMbstringEnabled()) {
$value = mb_convert_encoding($value, $to, $from);
return $value;
}
if (self::getIsIconvEnabled()) {
$value = iconv($from, $to, $value);
return $value;
}
// else, no conversion
return $value;
} | [
"public",
"static",
"function",
"ConvertEncoding",
"(",
"$",
"value",
",",
"$",
"to",
",",
"$",
"from",
")",
"{",
"if",
"(",
"self",
"::",
"getIsMbstringEnabled",
"(",
")",
")",
"{",
"$",
"value",
"=",
"mb_convert_encoding",
"(",
"$",
"value",
",",
"$"... | Convert string from one encoding to another. First try mbstring, then iconv, or no convertion
@param string $value
@param string $to Encoding to convert to, e.g. 'UTF-8'
@param string $from Encoding to convert from, e.g. 'UTF-16LE'
@return string | [
"Convert",
"string",
"from",
"one",
"encoding",
"to",
"another",
".",
"First",
"try",
"mbstring",
"then",
"iconv",
"or",
"no",
"convertion"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/PHPWord/PHPWord/Shared/String.php#L223-L237 |
webforge-labs/psc-cms | lib/PHPWord/PHPWord/Shared/String.php | PHPWord_Shared_String.CountCharacters | public static function CountCharacters($value, $enc = 'UTF-8')
{
if (self::getIsMbstringEnabled()) {
$count = mb_strlen($value, $enc);
return $count;
}
if (self::getIsIconvEnabled()) {
$count = iconv_strlen($value, $enc);
return $count;
}
// else strlen
$count = strlen($value);
return $coun... | php | public static function CountCharacters($value, $enc = 'UTF-8')
{
if (self::getIsMbstringEnabled()) {
$count = mb_strlen($value, $enc);
return $count;
}
if (self::getIsIconvEnabled()) {
$count = iconv_strlen($value, $enc);
return $count;
}
// else strlen
$count = strlen($value);
return $coun... | [
"public",
"static",
"function",
"CountCharacters",
"(",
"$",
"value",
",",
"$",
"enc",
"=",
"'UTF-8'",
")",
"{",
"if",
"(",
"self",
"::",
"getIsMbstringEnabled",
"(",
")",
")",
"{",
"$",
"count",
"=",
"mb_strlen",
"(",
"$",
"value",
",",
"$",
"enc",
... | Get character count. First try mbstring, then iconv, finally strlen
@param string $value
@param string $enc Encoding
@return int Character count | [
"Get",
"character",
"count",
".",
"First",
"try",
"mbstring",
"then",
"iconv",
"finally",
"strlen"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/PHPWord/PHPWord/Shared/String.php#L246-L261 |
Craftsware/scissor | src/Lib/Database.php | Database.max | public function max($table, $inc = null)
{
return $this->select($table, ['MAX(id)'])[0]['MAX(id)'] + (isset($inc) ? $inc : 0);
} | php | public function max($table, $inc = null)
{
return $this->select($table, ['MAX(id)'])[0]['MAX(id)'] + (isset($inc) ? $inc : 0);
} | [
"public",
"function",
"max",
"(",
"$",
"table",
",",
"$",
"inc",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"select",
"(",
"$",
"table",
",",
"[",
"'MAX(id)'",
"]",
")",
"[",
"0",
"]",
"[",
"'MAX(id)'",
"]",
"+",
"(",
"isset",
"(",
"$"... | Get Maximum ID of a table
@param $table String
@param $add Int | [
"Get",
"Maximum",
"ID",
"of",
"a",
"table"
] | train | https://github.com/Craftsware/scissor/blob/644e4a8ea9859fc30fee36705e54784acd8d43e2/src/Lib/Database.php#L53-L56 |
Craftsware/scissor | src/Lib/Database.php | Database.fetch | public function fetch($query)
{
$db = $this->connection();
if(method_exists($result = $db->query(rtrim(preg_replace('/\s\s/', ' ', $query), ' ')), 'rowCount')) {
if($result->rowCount() && $result->setFetchMode($db::FETCH_ASSOC)) {
return $result->fetchAll();
... | php | public function fetch($query)
{
$db = $this->connection();
if(method_exists($result = $db->query(rtrim(preg_replace('/\s\s/', ' ', $query), ' ')), 'rowCount')) {
if($result->rowCount() && $result->setFetchMode($db::FETCH_ASSOC)) {
return $result->fetchAll();
... | [
"public",
"function",
"fetch",
"(",
"$",
"query",
")",
"{",
"$",
"db",
"=",
"$",
"this",
"->",
"connection",
"(",
")",
";",
"if",
"(",
"method_exists",
"(",
"$",
"result",
"=",
"$",
"db",
"->",
"query",
"(",
"rtrim",
"(",
"preg_replace",
"(",
"'/\\... | Get Data from the table
@param $query String | [
"Get",
"Data",
"from",
"the",
"table"
] | train | https://github.com/Craftsware/scissor/blob/644e4a8ea9859fc30fee36705e54784acd8d43e2/src/Lib/Database.php#L78-L91 |
Craftsware/scissor | src/Lib/Database.php | Database.migrate | public function migrate($dir)
{
$migrate = [];
if(file_exists($directory = '../App/'. $dir)) {
foreach(array_reverse(glob($directory .'/*.php')) as $path) {
$namespace = str_replace('/', '\\', 'App'. explode('.php', explode('App', $path)[1])[0]);
if(m... | php | public function migrate($dir)
{
$migrate = [];
if(file_exists($directory = '../App/'. $dir)) {
foreach(array_reverse(glob($directory .'/*.php')) as $path) {
$namespace = str_replace('/', '\\', 'App'. explode('.php', explode('App', $path)[1])[0]);
if(m... | [
"public",
"function",
"migrate",
"(",
"$",
"dir",
")",
"{",
"$",
"migrate",
"=",
"[",
"]",
";",
"if",
"(",
"file_exists",
"(",
"$",
"directory",
"=",
"'../App/'",
".",
"$",
"dir",
")",
")",
"{",
"foreach",
"(",
"array_reverse",
"(",
"glob",
"(",
"$... | Migrate
@param array $tables
@return JSON $migrate | [
"Migrate"
] | train | https://github.com/Craftsware/scissor/blob/644e4a8ea9859fc30fee36705e54784acd8d43e2/src/Lib/Database.php#L169-L203 |
yuncms/framework | src/oauth2/actions/QRCode.php | QRCode.init | public function init()
{
$this->controller->enableCsrfValidation = false;
Yii::$app->response->format = $this->format;
} | php | public function init()
{
$this->controller->enableCsrfValidation = false;
Yii::$app->response->format = $this->format;
} | [
"public",
"function",
"init",
"(",
")",
"{",
"$",
"this",
"->",
"controller",
"->",
"enableCsrfValidation",
"=",
"false",
";",
"Yii",
"::",
"$",
"app",
"->",
"response",
"->",
"format",
"=",
"$",
"this",
"->",
"format",
";",
"}"
] | 初始化 | [
"初始化"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/oauth2/actions/QRCode.php#L40-L44 |
yuncms/framework | src/oauth2/actions/QRCode.php | QRCode.run | public function run($code = null)
{
if (empty($code)) {
$code = Yii::$app->security->generateRandomString(40);
}
$attributes = Yii::$app->cache->getOrSet([self::CACHE_PREFIX, 'code' => $code], function ($cache) use ($code) {
return [
'code' => $code,
... | php | public function run($code = null)
{
if (empty($code)) {
$code = Yii::$app->security->generateRandomString(40);
}
$attributes = Yii::$app->cache->getOrSet([self::CACHE_PREFIX, 'code' => $code], function ($cache) use ($code) {
return [
'code' => $code,
... | [
"public",
"function",
"run",
"(",
"$",
"code",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"code",
")",
")",
"{",
"$",
"code",
"=",
"Yii",
"::",
"$",
"app",
"->",
"security",
"->",
"generateRandomString",
"(",
"40",
")",
";",
"}",
"$",
... | run
@param string $code
@throws \yii\base\Exception | [
"run"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/oauth2/actions/QRCode.php#L51-L64 |
vorbind/influx-analytics | src/Connection.php | Connection.getDatabase | public function getDatabase($name) {
try {
if (!isset($name)) {
throw InvalidArgumentException::invalidType('"db name" driver option', $name, 'string');
}
if (null == $this->client) {
$this->client = new \InfluxDB\Client($this->host, $this->po... | php | public function getDatabase($name) {
try {
if (!isset($name)) {
throw InvalidArgumentException::invalidType('"db name" driver option', $name, 'string');
}
if (null == $this->client) {
$this->client = new \InfluxDB\Client($this->host, $this->po... | [
"public",
"function",
"getDatabase",
"(",
"$",
"name",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"InvalidArgumentException",
"::",
"invalidType",
"(",
"'\"db name\" driver option'",
",",
"$",
"name",
",",
"'st... | Get database
@param string $name
@return InfluxDB\Database $db
@throws AnalyticsException | [
"Get",
"database"
] | train | https://github.com/vorbind/influx-analytics/blob/8c0c150351f045ccd3d57063f2b3b50a2c926e3e/src/Connection.php#L53-L71 |
egeloen/IvorySerializerBundle | IvorySerializerBundle.php | IvorySerializerBundle.build | public function build(ContainerBuilder $container)
{
$container
->addCompilerPass(new RegisterCachePoolPass())
->addCompilerPass(new RegisterClassMetadataLoaderPass())
->addCompilerPass(new RegisterListenerPass())
->addCompilerPass(new RegisterFOSServicePass()... | php | public function build(ContainerBuilder $container)
{
$container
->addCompilerPass(new RegisterCachePoolPass())
->addCompilerPass(new RegisterClassMetadataLoaderPass())
->addCompilerPass(new RegisterListenerPass())
->addCompilerPass(new RegisterFOSServicePass()... | [
"public",
"function",
"build",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"container",
"->",
"addCompilerPass",
"(",
"new",
"RegisterCachePoolPass",
"(",
")",
")",
"->",
"addCompilerPass",
"(",
"new",
"RegisterClassMetadataLoaderPass",
"(",
")",
")"... | {@inheritdoc} | [
"{"
] | train | https://github.com/egeloen/IvorySerializerBundle/blob/a2bdd912bf715c61b823cf7257ee232d5c823dd3/IvorySerializerBundle.php#L31-L40 |
ClanCats/Core | src/classes/CCError/Trace.php | CCError_Trace.file | public function file( $cut = true )
{
if ( empty( $this->file ) )
{
return null;
}
if ( $cut )
{
return str_replace( CCROOT, '', $this->file );
}
return $this->file;
} | php | public function file( $cut = true )
{
if ( empty( $this->file ) )
{
return null;
}
if ( $cut )
{
return str_replace( CCROOT, '', $this->file );
}
return $this->file;
} | [
"public",
"function",
"file",
"(",
"$",
"cut",
"=",
"true",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"file",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"$",
"cut",
")",
"{",
"return",
"str_replace",
"(",
"CCROOT",
",",
"... | get file path
@param bool $cut Cut
@return string | [
"get",
"file",
"path"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCError/Trace.php#L90-L103 |
ClanCats/Core | src/classes/CCError/Trace.php | CCError_Trace.args_string | public function args_string()
{
if ( !isset( $this->args ) || !is_array( $this->args ) )
{
return null;
}
$args = $this->args;
foreach( $args as $key => $arg )
{
if ( is_array( $arg ) )
{
$args[$key] = 'Array';
}
else
{
$args[$key] = var_export( $arg, true );
}
}
... | php | public function args_string()
{
if ( !isset( $this->args ) || !is_array( $this->args ) )
{
return null;
}
$args = $this->args;
foreach( $args as $key => $arg )
{
if ( is_array( $arg ) )
{
$args[$key] = 'Array';
}
else
{
$args[$key] = var_export( $arg, true );
}
}
... | [
"public",
"function",
"args_string",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"args",
")",
"||",
"!",
"is_array",
"(",
"$",
"this",
"->",
"args",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"args",
"=",
"$",
"this",
"... | create an argument string
@return string | [
"create",
"an",
"argument",
"string"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCError/Trace.php#L160-L182 |
ClanCats/Core | src/classes/CCError/Trace.php | CCError_Trace.parse_source | private function parse_source()
{
if ( !$this->file() )
{
return null;
}
// get the file
$lines = file( $this->file );
/*
* parse the relevant source
*/
$size = 10;
$start = $this->line - ( $size / 2 );
$end = $this->line + ( $size / 2 );
// check if start is in the middle of a... | php | private function parse_source()
{
if ( !$this->file() )
{
return null;
}
// get the file
$lines = file( $this->file );
/*
* parse the relevant source
*/
$size = 10;
$start = $this->line - ( $size / 2 );
$end = $this->line + ( $size / 2 );
// check if start is in the middle of a... | [
"private",
"function",
"parse_source",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"file",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"// get the file",
"$",
"lines",
"=",
"file",
"(",
"$",
"this",
"->",
"file",
")",
";",
"/*\n\t\t * parse... | parse the source file
@return void | [
"parse",
"the",
"source",
"file"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCError/Trace.php#L189-L224 |
ClanCats/Core | src/classes/CCError/Trace.php | CCError_Trace.reflection_file | public function reflection_file()
{
if ( is_null( $this->reflection_file ) )
{
if ( is_null( $reflection = $this->reflection() ) )
{
return null;
}
$this->reflection_file = file( $reflection->getFileName() );
}
return $this->reflection_file;
} | php | public function reflection_file()
{
if ( is_null( $this->reflection_file ) )
{
if ( is_null( $reflection = $this->reflection() ) )
{
return null;
}
$this->reflection_file = file( $reflection->getFileName() );
}
return $this->reflection_file;
} | [
"public",
"function",
"reflection_file",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"reflection_file",
")",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"reflection",
"=",
"$",
"this",
"->",
"reflection",
"(",
")",
")",
")",
"{",
"retu... | get the source code of the reflected file
@return string | [
"get",
"the",
"source",
"code",
"of",
"the",
"reflected",
"file"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCError/Trace.php#L261-L274 |
ClanCats/Core | src/classes/CCError/Trace.php | CCError_Trace.reflection_function_info | public function reflection_function_info( $function = null )
{
if ( is_null( $lines = $this->reflection_file() ) )
{
return null;
}
if ( is_null( $function ) )
{
if ( is_null( $function = $this->function_name() ) )
{
return null;
}
}
$info = array(
'message' => '',
);
for... | php | public function reflection_function_info( $function = null )
{
if ( is_null( $lines = $this->reflection_file() ) )
{
return null;
}
if ( is_null( $function ) )
{
if ( is_null( $function = $this->function_name() ) )
{
return null;
}
}
$info = array(
'message' => '',
);
for... | [
"public",
"function",
"reflection_function_info",
"(",
"$",
"function",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"lines",
"=",
"$",
"this",
"->",
"reflection_file",
"(",
")",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"is_null"... | get the source code where the trace happend
@return string | [
"get",
"the",
"source",
"code",
"where",
"the",
"trace",
"happend"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCError/Trace.php#L281-L367 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Feed/Builder/Header.php | Zend_Feed_Builder_Header.setEmail | public function setEmail($email)
{
/**
* @see Zend_Validate_EmailAddress
*/
require_once 'Zend/Validate/EmailAddress.php';
$validate = new Zend_Validate_EmailAddress();
if (!$validate->isValid($email)) {
/**
* @see Zend_Feed_Builder_Exceptio... | php | public function setEmail($email)
{
/**
* @see Zend_Validate_EmailAddress
*/
require_once 'Zend/Validate/EmailAddress.php';
$validate = new Zend_Validate_EmailAddress();
if (!$validate->isValid($email)) {
/**
* @see Zend_Feed_Builder_Exceptio... | [
"public",
"function",
"setEmail",
"(",
"$",
"email",
")",
"{",
"/**\n * @see Zend_Validate_EmailAddress\n */",
"require_once",
"'Zend/Validate/EmailAddress.php'",
";",
"$",
"validate",
"=",
"new",
"Zend_Validate_EmailAddress",
"(",
")",
";",
"if",
"(",
"!"... | Sets the author's email
@param string $email
@return Zend_Feed_Builder_Header
@throws Zend_Feed_Builder_Exception | [
"Sets",
"the",
"author",
"s",
"email"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed/Builder/Header.php#L170-L186 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Feed/Builder/Header.php | Zend_Feed_Builder_Header.setWebmaster | public function setWebmaster($webmaster)
{
/**
* @see Zend_Validate_EmailAddress
*/
require_once 'Zend/Validate/EmailAddress.php';
$validate = new Zend_Validate_EmailAddress();
if (!$validate->isValid($webmaster)) {
/**
* @see Zend_Feed_Buil... | php | public function setWebmaster($webmaster)
{
/**
* @see Zend_Validate_EmailAddress
*/
require_once 'Zend/Validate/EmailAddress.php';
$validate = new Zend_Validate_EmailAddress();
if (!$validate->isValid($webmaster)) {
/**
* @see Zend_Feed_Buil... | [
"public",
"function",
"setWebmaster",
"(",
"$",
"webmaster",
")",
"{",
"/**\n * @see Zend_Validate_EmailAddress\n */",
"require_once",
"'Zend/Validate/EmailAddress.php'",
";",
"$",
"validate",
"=",
"new",
"Zend_Validate_EmailAddress",
"(",
")",
";",
"if",
"(... | Email address for person responsible for technical issues
Ignored if atom is used
@param string $webmaster
@return Zend_Feed_Builder_Header
@throws Zend_Feed_Builder_Exception | [
"Email",
"address",
"for",
"person",
"responsible",
"for",
"technical",
"issues",
"Ignored",
"if",
"atom",
"is",
"used"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed/Builder/Header.php#L244-L260 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Feed/Builder/Header.php | Zend_Feed_Builder_Header.setTtl | public function setTtl($ttl)
{
/**
* @see Zend_Validate_Int
*/
require_once 'Zend/Validate/Int.php';
$validate = new Zend_Validate_Int();
if (!$validate->isValid($ttl)) {
/**
* @see Zend_Feed_Builder_Exception
*/
req... | php | public function setTtl($ttl)
{
/**
* @see Zend_Validate_Int
*/
require_once 'Zend/Validate/Int.php';
$validate = new Zend_Validate_Int();
if (!$validate->isValid($ttl)) {
/**
* @see Zend_Feed_Builder_Exception
*/
req... | [
"public",
"function",
"setTtl",
"(",
"$",
"ttl",
")",
"{",
"/**\n * @see Zend_Validate_Int\n */",
"require_once",
"'Zend/Validate/Int.php'",
";",
"$",
"validate",
"=",
"new",
"Zend_Validate_Int",
"(",
")",
";",
"if",
"(",
"!",
"$",
"validate",
"->",
... | How long in minutes a feed can be cached before refreshing
Ignored if atom is used
@param int $ttl
@return Zend_Feed_Builder_Header
@throws Zend_Feed_Builder_Exception | [
"How",
"long",
"in",
"minutes",
"a",
"feed",
"can",
"be",
"cached",
"before",
"refreshing",
"Ignored",
"if",
"atom",
"is",
"used"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed/Builder/Header.php#L270-L286 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Feed/Builder/Header.php | Zend_Feed_Builder_Header.setCloud | public function setCloud($uri, $procedure, $protocol)
{
if (is_string($uri) && Zend_Uri_Http::check($uri)) {
$uri = Zend_Uri::factory($uri);
}
if (!$uri instanceof Zend_Uri_Http) {
/**
* @see Zend_Feed_Builder_Exception
*/
require... | php | public function setCloud($uri, $procedure, $protocol)
{
if (is_string($uri) && Zend_Uri_Http::check($uri)) {
$uri = Zend_Uri::factory($uri);
}
if (!$uri instanceof Zend_Uri_Http) {
/**
* @see Zend_Feed_Builder_Exception
*/
require... | [
"public",
"function",
"setCloud",
"(",
"$",
"uri",
",",
"$",
"procedure",
",",
"$",
"protocol",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"uri",
")",
"&&",
"Zend_Uri_Http",
"::",
"check",
"(",
"$",
"uri",
")",
")",
"{",
"$",
"uri",
"=",
"Zend_Uri... | Cloud to be notified of updates of the feed
Ignored if atom is used
@param string|Zend_Uri_Http $uri
@param string $procedure procedure to call, e.g. myCloud.rssPleaseNotify
@param string $protocol protocol to use, e.g. soap or xml-rpc
@return Zend_Feed_Builder_Header
@throws Zend_Feed_... | [
"Cloud",
"to",
"be",
"notified",
"of",
"updates",
"of",
"the",
"feed",
"Ignored",
"if",
"atom",
"is",
"used"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed/Builder/Header.php#L311-L330 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Feed/Builder/Header.php | Zend_Feed_Builder_Header.setTextInput | public function setTextInput($title, $description, $name, $link)
{
$this->offsetSet('textInput', array('title' => $title,
'description' => $description,
'name' => $name,
'link'... | php | public function setTextInput($title, $description, $name, $link)
{
$this->offsetSet('textInput', array('title' => $title,
'description' => $description,
'name' => $name,
'link'... | [
"public",
"function",
"setTextInput",
"(",
"$",
"title",
",",
"$",
"description",
",",
"$",
"name",
",",
"$",
"link",
")",
"{",
"$",
"this",
"->",
"offsetSet",
"(",
"'textInput'",
",",
"array",
"(",
"'title'",
"=>",
"$",
"title",
",",
"'description'",
... | A text input box that can be displayed with the feed
Ignored if atom is used
@param string $title the label of the Submit button in the text input area
@param string $description explains the text input area
@param string $name the name of the text object in the text input area
@param string $link ... | [
"A",
"text",
"input",
"box",
"that",
"can",
"be",
"displayed",
"with",
"the",
"feed",
"Ignored",
"if",
"atom",
"is",
"used"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed/Builder/Header.php#L342-L349 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Feed/Builder/Header.php | Zend_Feed_Builder_Header.setSkipHours | public function setSkipHours(array $hours)
{
if (count($hours) > 24) {
/**
* @see Zend_Feed_Builder_Exception
*/
require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("you can not have more than 24 rows in the skip... | php | public function setSkipHours(array $hours)
{
if (count($hours) > 24) {
/**
* @see Zend_Feed_Builder_Exception
*/
require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("you can not have more than 24 rows in the skip... | [
"public",
"function",
"setSkipHours",
"(",
"array",
"$",
"hours",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"hours",
")",
">",
"24",
")",
"{",
"/**\n * @see Zend_Feed_Builder_Exception\n */",
"require_once",
"'Zend/Feed/Builder/Exception.php'",
";"... | Hint telling aggregators which hours they can skip
Ignored if atom is used
@param array $hours list of hours in 24 format
@return Zend_Feed_Builder_Header
@throws Zend_Feed_Builder_Exception | [
"Hint",
"telling",
"aggregators",
"which",
"hours",
"they",
"can",
"skip",
"Ignored",
"if",
"atom",
"is",
"used"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed/Builder/Header.php#L359-L379 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Feed/Builder/Header.php | Zend_Feed_Builder_Header.setSkipDays | public function setSkipDays(array $days)
{
if (count($days) > 7) {
/**
* @see Zend_Feed_Builder_Exception
*/
require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("you can not have more than 7 days in the skipDays ... | php | public function setSkipDays(array $days)
{
if (count($days) > 7) {
/**
* @see Zend_Feed_Builder_Exception
*/
require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("you can not have more than 7 days in the skipDays ... | [
"public",
"function",
"setSkipDays",
"(",
"array",
"$",
"days",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"days",
")",
">",
"7",
")",
"{",
"/**\n * @see Zend_Feed_Builder_Exception\n */",
"require_once",
"'Zend/Feed/Builder/Exception.php'",
";",
... | Hint telling aggregators which days they can skip
Ignored if atom is used
@param array $days list of days to skip, e.g. Monday
@return Zend_Feed_Builder_Header
@throws Zend_Feed_Builder_Exception | [
"Hint",
"telling",
"aggregators",
"which",
"days",
"they",
"can",
"skip",
"Ignored",
"if",
"atom",
"is",
"used"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed/Builder/Header.php#L389-L410 |
sebastiaanluca/laravel-unbreakable-migrations | src/Commands/GenerateMigration.php | GenerateMigration.handle | public function handle() : void
{
if ($module = $this->option('module')) {
$this->input->setOption('path', 'modules/' . $module . '/database/migrations');
}
parent::handle();
} | php | public function handle() : void
{
if ($module = $this->option('module')) {
$this->input->setOption('path', 'modules/' . $module . '/database/migrations');
}
parent::handle();
} | [
"public",
"function",
"handle",
"(",
")",
":",
"void",
"{",
"if",
"(",
"$",
"module",
"=",
"$",
"this",
"->",
"option",
"(",
"'module'",
")",
")",
"{",
"$",
"this",
"->",
"input",
"->",
"setOption",
"(",
"'path'",
",",
"'modules/'",
".",
"$",
"modu... | Execute the console command.
@return void | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/sebastiaanluca/laravel-unbreakable-migrations/blob/3c831b204770b80c97351c3b881dcbf924236a13/src/Commands/GenerateMigration.php#L46-L53 |
nyeholt/silverstripe-external-content | code/cache/CacheService.php | CacheService.store | public function store($key, $value, $expiry=0) {
if ($expiry == 0) {
$expiry = $this->expiry;
}
$entry = new CacheItem();
$entry->value = serialize($value);
$entry->expireAt = time() + $expiry;
$data = serialize($entry);
$this->store->store($key, $data);
$this->items[$key] = $entry;
} | php | public function store($key, $value, $expiry=0) {
if ($expiry == 0) {
$expiry = $this->expiry;
}
$entry = new CacheItem();
$entry->value = serialize($value);
$entry->expireAt = time() + $expiry;
$data = serialize($entry);
$this->store->store($key, $data);
$this->items[$key] = $entry;
} | [
"public",
"function",
"store",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"expiry",
"=",
"0",
")",
"{",
"if",
"(",
"$",
"expiry",
"==",
"0",
")",
"{",
"$",
"expiry",
"=",
"$",
"this",
"->",
"expiry",
";",
"}",
"$",
"entry",
"=",
"new",
"Ca... | Cache an item
@param string $key
@param mixed $value
@param int $expiry
How many seconds to cache this object for (no value uses the configured default) | [
"Cache",
"an",
"item"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/code/cache/CacheService.php#L67-L80 |
nyeholt/silverstripe-external-content | code/cache/CacheService.php | CacheService.get | public function get($key) {
$entry = null;
if (isset($this->items[$key])) {
$entry = $this->items[$key];
} else {
$data = $this->store->get($key);
if ($data) {
$entry = unserialize($data);
}
}
if (!$entry) {
return $entry;
}
// if the expire time is in the future
if ($entry->expir... | php | public function get($key) {
$entry = null;
if (isset($this->items[$key])) {
$entry = $this->items[$key];
} else {
$data = $this->store->get($key);
if ($data) {
$entry = unserialize($data);
}
}
if (!$entry) {
return $entry;
}
// if the expire time is in the future
if ($entry->expir... | [
"public",
"function",
"get",
"(",
"$",
"key",
")",
"{",
"$",
"entry",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"items",
"[",
"$",
"key",
"]",
")",
")",
"{",
"$",
"entry",
"=",
"$",
"this",
"->",
"items",
"[",
"$",
"key",
... | Gets a cached value for a given key
@param String $key
The key to retrieve data for | [
"Gets",
"a",
"cached",
"value",
"for",
"a",
"given",
"key"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/code/cache/CacheService.php#L87-L113 |
Chill-project/Main | Export/Formatter/CSVListFormatter.php | CSVListFormatter.buildForm | public function buildForm(
FormBuilderInterface $builder,
$exportAlias,
array $aggregatorAliases
){
$builder->add('numerotation', ChoiceType::class, array(
'choices' => array(
'yes' => true,
'no' => false
),
'expa... | php | public function buildForm(
FormBuilderInterface $builder,
$exportAlias,
array $aggregatorAliases
){
$builder->add('numerotation', ChoiceType::class, array(
'choices' => array(
'yes' => true,
'no' => false
),
'expa... | [
"public",
"function",
"buildForm",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"$",
"exportAlias",
",",
"array",
"$",
"aggregatorAliases",
")",
"{",
"$",
"builder",
"->",
"add",
"(",
"'numerotation'",
",",
"ChoiceType",
"::",
"class",
",",
"array",
"(",
... | build a form, which will be used to collect data required for the execution
of this formatter.
@uses appendAggregatorForm
@param FormBuilderInterface $builder
@param type $exportAlias
@param array $aggregatorAliases | [
"build",
"a",
"form",
"which",
"will",
"be",
"used",
"to",
"collect",
"data",
"required",
"for",
"the",
"execution",
"of",
"this",
"formatter",
"."
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Export/Formatter/CSVListFormatter.php#L93-L109 |
Chill-project/Main | Export/Formatter/CSVListFormatter.php | CSVListFormatter.getResponse | public function getResponse(
$result,
$formatterData,
$exportAlias,
array $exportData,
array $filtersData,
array $aggregatorsData
) {
$this->result = $result;
$this->exportAlias = $exportAlias;
$this->exportData = $exportData;
$thi... | php | public function getResponse(
$result,
$formatterData,
$exportAlias,
array $exportData,
array $filtersData,
array $aggregatorsData
) {
$this->result = $result;
$this->exportAlias = $exportAlias;
$this->exportData = $exportData;
$thi... | [
"public",
"function",
"getResponse",
"(",
"$",
"result",
",",
"$",
"formatterData",
",",
"$",
"exportAlias",
",",
"array",
"$",
"exportData",
",",
"array",
"$",
"filtersData",
",",
"array",
"$",
"aggregatorsData",
")",
"{",
"$",
"this",
"->",
"result",
"="... | Generate a response from the data collected on differents ExportElementInterface
@param mixed[] $result The result, as given by the ExportInterface
@param mixed[] $formatterData collected from the current form
@param string $exportAlias the id of the current export
@param array $filtersData an array containing the fil... | [
"Generate",
"a",
"response",
"from",
"the",
"data",
"collected",
"on",
"differents",
"ExportElementInterface"
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Export/Formatter/CSVListFormatter.php#L121-L166 |
Chill-project/Main | Export/Formatter/CSVListFormatter.php | CSVListFormatter.prepareHeaders | protected function prepareHeaders($output)
{
$keys = $this->exportManager->getExport($this->exportAlias)->getQueryKeys($this->exportData);
// we want to keep the order of the first row. So we will iterate on the first row of the results
$first_row = count($this->result) > 0 ? $this->result[0... | php | protected function prepareHeaders($output)
{
$keys = $this->exportManager->getExport($this->exportAlias)->getQueryKeys($this->exportData);
// we want to keep the order of the first row. So we will iterate on the first row of the results
$first_row = count($this->result) > 0 ? $this->result[0... | [
"protected",
"function",
"prepareHeaders",
"(",
"$",
"output",
")",
"{",
"$",
"keys",
"=",
"$",
"this",
"->",
"exportManager",
"->",
"getExport",
"(",
"$",
"this",
"->",
"exportAlias",
")",
"->",
"getQueryKeys",
"(",
"$",
"this",
"->",
"exportData",
")",
... | add the headers to the csv file
@param resource $output | [
"add",
"the",
"headers",
"to",
"the",
"csv",
"file"
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Export/Formatter/CSVListFormatter.php#L173-L191 |
Chill-project/Main | Export/Formatter/CSVListFormatter.php | CSVListFormatter.getLabel | protected function getLabel($key, $value)
{
if ($this->labelsCache === null) {
$this->prepareCacheLabels();
}
return $this->labelsCache[$key]($value);
} | php | protected function getLabel($key, $value)
{
if ($this->labelsCache === null) {
$this->prepareCacheLabels();
}
return $this->labelsCache[$key]($value);
} | [
"protected",
"function",
"getLabel",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"labelsCache",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"prepareCacheLabels",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"labels... | Give the label corresponding to the given key and value.
@param string $key
@param string $value
@return string
@throws \LogicException if the label is not found | [
"Give",
"the",
"label",
"corresponding",
"to",
"the",
"given",
"key",
"and",
"value",
"."
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Export/Formatter/CSVListFormatter.php#L201-L209 |
Chill-project/Main | Export/Formatter/CSVListFormatter.php | CSVListFormatter.prepareCacheLabels | protected function prepareCacheLabels()
{
$export = $this->exportManager->getExport($this->exportAlias);
$keys = $export->getQueryKeys($this->exportData);
foreach($keys as $key) {
// get an array with all values for this key if possible
$values = \array_map(f... | php | protected function prepareCacheLabels()
{
$export = $this->exportManager->getExport($this->exportAlias);
$keys = $export->getQueryKeys($this->exportData);
foreach($keys as $key) {
// get an array with all values for this key if possible
$values = \array_map(f... | [
"protected",
"function",
"prepareCacheLabels",
"(",
")",
"{",
"$",
"export",
"=",
"$",
"this",
"->",
"exportManager",
"->",
"getExport",
"(",
"$",
"this",
"->",
"exportAlias",
")",
";",
"$",
"keys",
"=",
"$",
"export",
"->",
"getQueryKeys",
"(",
"$",
"th... | Prepare the label cache which will be used by getLabel. This function
should be called only once in the generation lifecycle. | [
"Prepare",
"the",
"label",
"cache",
"which",
"will",
"be",
"used",
"by",
"getLabel",
".",
"This",
"function",
"should",
"be",
"called",
"only",
"once",
"in",
"the",
"generation",
"lifecycle",
"."
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Export/Formatter/CSVListFormatter.php#L215-L226 |
hackzilla/ticket-message | Component/TicketFeatures.php | TicketFeatures.hasFeature | public function hasFeature($feature)
{
$feature = strtoupper($feature);
if (!isset($this->features[$feature])) {
return null;
}
return $this->features[$feature];
} | php | public function hasFeature($feature)
{
$feature = strtoupper($feature);
if (!isset($this->features[$feature])) {
return null;
}
return $this->features[$feature];
} | [
"public",
"function",
"hasFeature",
"(",
"$",
"feature",
")",
"{",
"$",
"feature",
"=",
"strtoupper",
"(",
"$",
"feature",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"features",
"[",
"$",
"feature",
"]",
")",
")",
"{",
"return",
"nu... | Check if feature exists and enabled.
@param string $feature
@return bool|null | [
"Check",
"if",
"feature",
"exists",
"and",
"enabled",
"."
] | train | https://github.com/hackzilla/ticket-message/blob/043950aa95f322cfaae145ce3c7781a4b0618a18/Component/TicketFeatures.php#L32-L41 |
webforge-labs/psc-cms | lib/Psc/URL/Service/Request.php | Request.infer | public static function infer($GET = NULL, $POST = NULL, $COOKIE = NULL, $SERVER = NULL) {
$merged = array();
$merged['GET'] = $GET !== NULL ? $GET : $_GET;
$merged['POST'] = $POST !== NULL ? $POST : $_POST;
$merged['COOKIE']= $COOKIE !== NULL ? $COOKIE : $_COOKIE;
$merged['SERVER'] = $SERVER !== NUL... | php | public static function infer($GET = NULL, $POST = NULL, $COOKIE = NULL, $SERVER = NULL) {
$merged = array();
$merged['GET'] = $GET !== NULL ? $GET : $_GET;
$merged['POST'] = $POST !== NULL ? $POST : $_POST;
$merged['COOKIE']= $COOKIE !== NULL ? $COOKIE : $_COOKIE;
$merged['SERVER'] = $SERVER !== NUL... | [
"public",
"static",
"function",
"infer",
"(",
"$",
"GET",
"=",
"NULL",
",",
"$",
"POST",
"=",
"NULL",
",",
"$",
"COOKIE",
"=",
"NULL",
",",
"$",
"SERVER",
"=",
"NULL",
")",
"{",
"$",
"merged",
"=",
"array",
"(",
")",
";",
"$",
"merged",
"[",
"'... | Erstellt einen Request aus den Umgebungsvariablen
wird eine Umgebungsvariable mit NULL übergeben (oder ausgelassen), wird die global Umgebungsvariable genommen
infer() ist also äquivalent mit:
infer($_GET, $_POST, $_COOKIE, $_SERVER)
ist $_GET['mod_rewrite_request'] gesetzt wird dies als resource genommen | [
"Erstellt",
"einen",
"Request",
"aus",
"den",
"Umgebungsvariablen"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/URL/Service/Request.php#L58-L106 |
redaigbaria/oauth2 | src/AbstractServer.php | AbstractServer.setEventEmitter | public function setEventEmitter($emitter = null)
{
if ($emitter === null) {
$this->eventEmitter = new Emitter();
} else {
$this->eventEmitter = $emitter;
}
} | php | public function setEventEmitter($emitter = null)
{
if ($emitter === null) {
$this->eventEmitter = new Emitter();
} else {
$this->eventEmitter = $emitter;
}
} | [
"public",
"function",
"setEventEmitter",
"(",
"$",
"emitter",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"emitter",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"eventEmitter",
"=",
"new",
"Emitter",
"(",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"... | Set an event emitter
@param object $emitter Event emitter object | [
"Set",
"an",
"event",
"emitter"
] | train | https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/src/AbstractServer.php#L111-L118 |
redaigbaria/oauth2 | src/AbstractServer.php | AbstractServer.addEventListener | public function addEventListener($eventName, callable $listener, $priority = Emitter::P_NORMAL)
{
$this->eventEmitter->addListener($eventName, $listener, $priority);
} | php | public function addEventListener($eventName, callable $listener, $priority = Emitter::P_NORMAL)
{
$this->eventEmitter->addListener($eventName, $listener, $priority);
} | [
"public",
"function",
"addEventListener",
"(",
"$",
"eventName",
",",
"callable",
"$",
"listener",
",",
"$",
"priority",
"=",
"Emitter",
"::",
"P_NORMAL",
")",
"{",
"$",
"this",
"->",
"eventEmitter",
"->",
"addListener",
"(",
"$",
"eventName",
",",
"$",
"l... | Add an event listener to the event emitter
@param string $eventName Event name
@param callable $listener Callable function or method
@param int $priority Priority of event listener | [
"Add",
"an",
"event",
"listener",
"to",
"the",
"event",
"emitter"
] | train | https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/src/AbstractServer.php#L127-L130 |
redaigbaria/oauth2 | src/AbstractServer.php | AbstractServer.getRequest | public function getRequest()
{
if ($this->request === null) {
$this->request = Request::createFromGlobals();
}
return $this->request;
} | php | public function getRequest()
{
if ($this->request === null) {
$this->request = Request::createFromGlobals();
}
return $this->request;
} | [
"public",
"function",
"getRequest",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"request",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"request",
"=",
"Request",
"::",
"createFromGlobals",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"request",
... | Gets the Request object. It will create one from the globals if one is not set.
@return \Symfony\Component\HttpFoundation\Request | [
"Gets",
"the",
"Request",
"object",
".",
"It",
"will",
"create",
"one",
"from",
"the",
"globals",
"if",
"one",
"is",
"not",
"set",
"."
] | train | https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/src/AbstractServer.php#L161-L168 |
redaigbaria/oauth2 | src/AbstractServer.php | AbstractServer.setClientStorage | public function setClientStorage(ClientInterface $storage)
{
$storage->setServer($this);
$this->clientStorage = $storage;
return $this;
} | php | public function setClientStorage(ClientInterface $storage)
{
$storage->setServer($this);
$this->clientStorage = $storage;
return $this;
} | [
"public",
"function",
"setClientStorage",
"(",
"ClientInterface",
"$",
"storage",
")",
"{",
"$",
"storage",
"->",
"setServer",
"(",
"$",
"this",
")",
";",
"$",
"this",
"->",
"clientStorage",
"=",
"$",
"storage",
";",
"return",
"$",
"this",
";",
"}"
] | Set the client storage
@param \League\OAuth2\Server\Storage\ClientInterface $storage
@return self | [
"Set",
"the",
"client",
"storage"
] | train | https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/src/AbstractServer.php#L177-L183 |
redaigbaria/oauth2 | src/AbstractServer.php | AbstractServer.setSessionStorage | public function setSessionStorage(SessionInterface $storage)
{
$storage->setServer($this);
$this->sessionStorage = $storage;
return $this;
} | php | public function setSessionStorage(SessionInterface $storage)
{
$storage->setServer($this);
$this->sessionStorage = $storage;
return $this;
} | [
"public",
"function",
"setSessionStorage",
"(",
"SessionInterface",
"$",
"storage",
")",
"{",
"$",
"storage",
"->",
"setServer",
"(",
"$",
"this",
")",
";",
"$",
"this",
"->",
"sessionStorage",
"=",
"$",
"storage",
";",
"return",
"$",
"this",
";",
"}"
] | Set the session storage
@param \League\OAuth2\Server\Storage\SessionInterface $storage
@return self | [
"Set",
"the",
"session",
"storage"
] | train | https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/src/AbstractServer.php#L192-L198 |
redaigbaria/oauth2 | src/AbstractServer.php | AbstractServer.setAccessTokenStorage | public function setAccessTokenStorage(AccessTokenInterface $storage)
{
$storage->setServer($this);
$this->accessTokenStorage = $storage;
return $this;
} | php | public function setAccessTokenStorage(AccessTokenInterface $storage)
{
$storage->setServer($this);
$this->accessTokenStorage = $storage;
return $this;
} | [
"public",
"function",
"setAccessTokenStorage",
"(",
"AccessTokenInterface",
"$",
"storage",
")",
"{",
"$",
"storage",
"->",
"setServer",
"(",
"$",
"this",
")",
";",
"$",
"this",
"->",
"accessTokenStorage",
"=",
"$",
"storage",
";",
"return",
"$",
"this",
";"... | Set the access token storage
@param \League\OAuth2\Server\Storage\AccessTokenInterface $storage
@return self | [
"Set",
"the",
"access",
"token",
"storage"
] | train | https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/src/AbstractServer.php#L207-L213 |
redaigbaria/oauth2 | src/AbstractServer.php | AbstractServer.setRefreshTokenStorage | public function setRefreshTokenStorage(RefreshTokenInterface $storage)
{
$storage->setServer($this);
$this->refreshTokenStorage = $storage;
return $this;
} | php | public function setRefreshTokenStorage(RefreshTokenInterface $storage)
{
$storage->setServer($this);
$this->refreshTokenStorage = $storage;
return $this;
} | [
"public",
"function",
"setRefreshTokenStorage",
"(",
"RefreshTokenInterface",
"$",
"storage",
")",
"{",
"$",
"storage",
"->",
"setServer",
"(",
"$",
"this",
")",
";",
"$",
"this",
"->",
"refreshTokenStorage",
"=",
"$",
"storage",
";",
"return",
"$",
"this",
... | Set the refresh token storage
@param \League\OAuth2\Server\Storage\RefreshTokenInterface $storage
@return self | [
"Set",
"the",
"refresh",
"token",
"storage"
] | train | https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/src/AbstractServer.php#L222-L228 |
redaigbaria/oauth2 | src/AbstractServer.php | AbstractServer.setAuthCodeStorage | public function setAuthCodeStorage(AuthCodeInterface $storage)
{
$storage->setServer($this);
$this->authCodeStorage = $storage;
return $this;
} | php | public function setAuthCodeStorage(AuthCodeInterface $storage)
{
$storage->setServer($this);
$this->authCodeStorage = $storage;
return $this;
} | [
"public",
"function",
"setAuthCodeStorage",
"(",
"AuthCodeInterface",
"$",
"storage",
")",
"{",
"$",
"storage",
"->",
"setServer",
"(",
"$",
"this",
")",
";",
"$",
"this",
"->",
"authCodeStorage",
"=",
"$",
"storage",
";",
"return",
"$",
"this",
";",
"}"
] | Set the auth code storage
@param \League\OAuth2\Server\Storage\AuthCodeInterface $storage
@return self | [
"Set",
"the",
"auth",
"code",
"storage"
] | train | https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/src/AbstractServer.php#L237-L243 |
redaigbaria/oauth2 | src/AbstractServer.php | AbstractServer.setScopeStorage | public function setScopeStorage(ScopeInterface $storage)
{
$storage->setServer($this);
$this->scopeStorage = $storage;
return $this;
} | php | public function setScopeStorage(ScopeInterface $storage)
{
$storage->setServer($this);
$this->scopeStorage = $storage;
return $this;
} | [
"public",
"function",
"setScopeStorage",
"(",
"ScopeInterface",
"$",
"storage",
")",
"{",
"$",
"storage",
"->",
"setServer",
"(",
"$",
"this",
")",
";",
"$",
"this",
"->",
"scopeStorage",
"=",
"$",
"storage",
";",
"return",
"$",
"this",
";",
"}"
] | Set the scope storage
@param \League\OAuth2\Server\Storage\ScopeInterface $storage
@return self | [
"Set",
"the",
"scope",
"storage"
] | train | https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/src/AbstractServer.php#L252-L258 |
slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseLicensePeer.php | BaseLicensePeer.getFieldNames | public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, LicensePeer::$fieldNames)) {
throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, Ba... | php | public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, LicensePeer::$fieldNames)) {
throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, Ba... | [
"public",
"static",
"function",
"getFieldNames",
"(",
"$",
"type",
"=",
"BasePeer",
"::",
"TYPE_PHPNAME",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"type",
",",
"LicensePeer",
"::",
"$",
"fieldNames",
")",
")",
"{",
"throw",
"new",
"PropelExc... | Returns an array of field names.
@param string $type The type of fieldnames to return:
One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
@return array A list of field names
@throws PropelException - i... | [
"Returns",
"an",
"array",
"of",
"field",
"names",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseLicensePeer.php#L127-L134 |
slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseLicensePeer.php | BaseLicensePeer.addSelectColumns | public static function addSelectColumns(Criteria $criteria, $alias = null)
{
if (null === $alias) {
$criteria->addSelectColumn(LicensePeer::ID);
$criteria->addSelectColumn(LicensePeer::MAX_CLIENTS);
$criteria->addSelectColumn(LicensePeer::DOMAIN);
$criteria->a... | php | public static function addSelectColumns(Criteria $criteria, $alias = null)
{
if (null === $alias) {
$criteria->addSelectColumn(LicensePeer::ID);
$criteria->addSelectColumn(LicensePeer::MAX_CLIENTS);
$criteria->addSelectColumn(LicensePeer::DOMAIN);
$criteria->a... | [
"public",
"static",
"function",
"addSelectColumns",
"(",
"Criteria",
"$",
"criteria",
",",
"$",
"alias",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"alias",
")",
"{",
"$",
"criteria",
"->",
"addSelectColumn",
"(",
"LicensePeer",
"::",
"ID",
")... | Add all the columns needed to create a new object.
Note: any columns that were marked with lazyLoad="true" in the
XML schema will not be added to the select list and only loaded
on demand.
@param Criteria $criteria object containing the columns to add.
@param string $alias optional table alias
@throws ... | [
"Add",
"all",
"the",
"columns",
"needed",
"to",
"create",
"a",
"new",
"object",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseLicensePeer.php#L165-L180 |
slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseLicensePeer.php | BaseLicensePeer.doSelectStmt | public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(LicensePeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
if (!$criteria->hasSelectClause()) {
$criteria = clone $criteria;
Li... | php | public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(LicensePeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
if (!$criteria->hasSelectClause()) {
$criteria = clone $criteria;
Li... | [
"public",
"static",
"function",
"doSelectStmt",
"(",
"Criteria",
"$",
"criteria",
",",
"PropelPDO",
"$",
"con",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"con",
"===",
"null",
")",
"{",
"$",
"con",
"=",
"Propel",
"::",
"getConnection",
"(",
"LicensePeer",
... | Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
Use this method directly if you want to work with an executed statement directly (for example
to perform your own object hydration).
@param Criteria $criteria The Criteria object used to build the SELECT statement.
@par... | [
"Prepares",
"the",
"Criteria",
"object",
"and",
"uses",
"the",
"parent",
"doSelect",
"()",
"method",
"to",
"execute",
"a",
"PDOStatement",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseLicensePeer.php#L272-L288 |
slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseLicensePeer.php | BaseLicensePeer.addInstanceToPool | public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getId();
} // if key === null
LicensePeer::$instances[$key] = $obj;
}
} | php | public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getId();
} // if key === null
LicensePeer::$instances[$key] = $obj;
}
} | [
"public",
"static",
"function",
"addInstanceToPool",
"(",
"$",
"obj",
",",
"$",
"key",
"=",
"null",
")",
"{",
"if",
"(",
"Propel",
"::",
"isInstancePoolingEnabled",
"(",
")",
")",
"{",
"if",
"(",
"$",
"key",
"===",
"null",
")",
"{",
"$",
"key",
"=",
... | Adds an object to the instance pool.
Propel keeps cached copies of objects in an instance pool when they are retrieved
from the database. In some cases -- especially when you override doSelect*()
methods in your stub classes -- you may need to explicitly add objects
to the cache in order to ensure that the same objec... | [
"Adds",
"an",
"object",
"to",
"the",
"instance",
"pool",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseLicensePeer.php#L301-L309 |
slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseLicensePeer.php | BaseLicensePeer.getInstanceFromPool | public static function getInstanceFromPool($key)
{
if (Propel::isInstancePoolingEnabled()) {
if (isset(LicensePeer::$instances[$key])) {
return LicensePeer::$instances[$key];
}
}
return null; // just to be explicit
} | php | public static function getInstanceFromPool($key)
{
if (Propel::isInstancePoolingEnabled()) {
if (isset(LicensePeer::$instances[$key])) {
return LicensePeer::$instances[$key];
}
}
return null; // just to be explicit
} | [
"public",
"static",
"function",
"getInstanceFromPool",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"Propel",
"::",
"isInstancePoolingEnabled",
"(",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"LicensePeer",
"::",
"$",
"instances",
"[",
"$",
"key",
"]",
")",
")",
... | Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
For tables with a single-column primary key, that simple pkey value will be returned. For tables with
a multi-column primary key, a serialize()d version of the primary key will be returne... | [
"Retrieves",
"a",
"string",
"version",
"of",
"the",
"primary",
"key",
"from",
"the",
"DB",
"resultset",
"row",
"that",
"can",
"be",
"used",
"to",
"uniquely",
"identify",
"a",
"row",
"in",
"this",
"table",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseLicensePeer.php#L351-L360 |
slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseLicensePeer.php | BaseLicensePeer.buildTableMap | public static function buildTableMap()
{
$dbMap = Propel::getDatabaseMap(BaseLicensePeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseLicensePeer::TABLE_NAME)) {
$dbMap->addTableObject(new \Slashworks\AppBundle\Model\map\LicenseTableMap());
}
} | php | public static function buildTableMap()
{
$dbMap = Propel::getDatabaseMap(BaseLicensePeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseLicensePeer::TABLE_NAME)) {
$dbMap->addTableObject(new \Slashworks\AppBundle\Model\map\LicenseTableMap());
}
} | [
"public",
"static",
"function",
"buildTableMap",
"(",
")",
"{",
"$",
"dbMap",
"=",
"Propel",
"::",
"getDatabaseMap",
"(",
"BaseLicensePeer",
"::",
"DATABASE_NAME",
")",
";",
"if",
"(",
"!",
"$",
"dbMap",
"->",
"hasTable",
"(",
"BaseLicensePeer",
"::",
"TABLE... | Add a TableMap instance to the database for this peer class. | [
"Add",
"a",
"TableMap",
"instance",
"to",
"the",
"database",
"for",
"this",
"peer",
"class",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseLicensePeer.php#L494-L500 |
yuncms/framework | src/admin/controllers/AdminController.php | AdminController.actionDelete | public function actionDelete($id)
{
if (Admin::find()->count() == 1) {
Yii::$app->getSession()->setFlash('success', Yii::t('yuncms', 'This is the last administrator, delete can not manage the system, it can not be deleted!'));
return $this->redirect(['index']);
}
$thi... | php | public function actionDelete($id)
{
if (Admin::find()->count() == 1) {
Yii::$app->getSession()->setFlash('success', Yii::t('yuncms', 'This is the last administrator, delete can not manage the system, it can not be deleted!'));
return $this->redirect(['index']);
}
$thi... | [
"public",
"function",
"actionDelete",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"Admin",
"::",
"find",
"(",
")",
"->",
"count",
"(",
")",
"==",
"1",
")",
"{",
"Yii",
"::",
"$",
"app",
"->",
"getSession",
"(",
")",
"->",
"setFlash",
"(",
"'success'",
"... | Deletes an existing Admin model.
If deletion is successful, the browser will be redirected to the 'index' page.
@param integer $id
@return mixed
@throws NotFoundHttpException
@throws \Exception
@throws \Throwable
@throws \yii\db\StaleObjectException | [
"Deletes",
"an",
"existing",
"Admin",
"model",
".",
"If",
"deletion",
"is",
"successful",
"the",
"browser",
"will",
"be",
"redirected",
"to",
"the",
"index",
"page",
"."
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/admin/controllers/AdminController.php#L102-L111 |
okitcom/ok-lib-php | src/Model/Attributes.php | Attributes.init | public static function init(array $attributes) {
$obj = new Attributes;
foreach ($attributes as $attribute) {
$obj->{$attribute->key} = $attribute;
}
return $obj;
} | php | public static function init(array $attributes) {
$obj = new Attributes;
foreach ($attributes as $attribute) {
$obj->{$attribute->key} = $attribute;
}
return $obj;
} | [
"public",
"static",
"function",
"init",
"(",
"array",
"$",
"attributes",
")",
"{",
"$",
"obj",
"=",
"new",
"Attributes",
";",
"foreach",
"(",
"$",
"attributes",
"as",
"$",
"attribute",
")",
"{",
"$",
"obj",
"->",
"{",
"$",
"attribute",
"->",
"key",
"... | Initialize from list of attributes.
@param Attribute[] $attributes
@return Attributes | [
"Initialize",
"from",
"list",
"of",
"attributes",
"."
] | train | https://github.com/okitcom/ok-lib-php/blob/1f441f3d216af7c952788e864bfe66bc4f089467/src/Model/Attributes.php#L62-L68 |
steeffeen/FancyManiaLinks | FML/Script/Features/ActionTrigger.php | ActionTrigger.getScriptText | protected function getScriptText()
{
$actionName = Builder::escapeText($this->actionName);
if ($this->control) {
// Control event
$controlId = Builder::escapeText($this->control->getId());
$scriptText = "
if (Event.Control.ControlId == {$controlId}) {
TriggerPag... | php | protected function getScriptText()
{
$actionName = Builder::escapeText($this->actionName);
if ($this->control) {
// Control event
$controlId = Builder::escapeText($this->control->getId());
$scriptText = "
if (Event.Control.ControlId == {$controlId}) {
TriggerPag... | [
"protected",
"function",
"getScriptText",
"(",
")",
"{",
"$",
"actionName",
"=",
"Builder",
"::",
"escapeText",
"(",
"$",
"this",
"->",
"actionName",
")",
";",
"if",
"(",
"$",
"this",
"->",
"control",
")",
"{",
"// Control event",
"$",
"controlId",
"=",
... | Get the script text
@return string | [
"Get",
"the",
"script",
"text"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Features/ActionTrigger.php#L149-L165 |
ClanCats/Core | src/bundles/Session/Manager/Database.php | Manager_Database.read | public function read( $id )
{
$this->inital_session_id = $id;
if ( $data = \DB::select( $this->table )->where( 'id', $id )->one( $this->database ) )
{
$session_data = unserialize( $data->content );
foreach( $this->index_fields as $field )
{
$session_data[$field] = $data->$field;
}
... | php | public function read( $id )
{
$this->inital_session_id = $id;
if ( $data = \DB::select( $this->table )->where( 'id', $id )->one( $this->database ) )
{
$session_data = unserialize( $data->content );
foreach( $this->index_fields as $field )
{
$session_data[$field] = $data->$field;
}
... | [
"public",
"function",
"read",
"(",
"$",
"id",
")",
"{",
"$",
"this",
"->",
"inital_session_id",
"=",
"$",
"id",
";",
"if",
"(",
"$",
"data",
"=",
"\\",
"DB",
"::",
"select",
"(",
"$",
"this",
"->",
"table",
")",
"->",
"where",
"(",
"'id'",
",",
... | Read data from the session dirver
@param string $id The session id key.
@return array | [
"Read",
"data",
"from",
"the",
"session",
"dirver"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Session/Manager/Database.php#L61-L78 |
ClanCats/Core | src/bundles/Session/Manager/Database.php | Manager_Database.has | public function has( $id )
{
return \DB::select( $this->table )
->where( 'id', $id )
->column( 'id', $this->database ) == $id;
} | php | public function has( $id )
{
return \DB::select( $this->table )
->where( 'id', $id )
->column( 'id', $this->database ) == $id;
} | [
"public",
"function",
"has",
"(",
"$",
"id",
")",
"{",
"return",
"\\",
"DB",
"::",
"select",
"(",
"$",
"this",
"->",
"table",
")",
"->",
"where",
"(",
"'id'",
",",
"$",
"id",
")",
"->",
"column",
"(",
"'id'",
",",
"$",
"this",
"->",
"database",
... | Check if a session with the given key already exists
@param string $id The session id key.
@return boool | [
"Check",
"if",
"a",
"session",
"with",
"the",
"given",
"key",
"already",
"exists"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Session/Manager/Database.php#L86-L91 |
ClanCats/Core | src/bundles/Session/Manager/Database.php | Manager_Database.write | public function write( $id, $data )
{
$columns = array();
foreach( $this->index_fields as $field )
{
$columns[$field] = $data[$field]; unset( $data[$field] );
}
$columns['content'] = serialize( $data );
// When the session id didnt change we will do an update
if ( $id == $this->inital_sessio... | php | public function write( $id, $data )
{
$columns = array();
foreach( $this->index_fields as $field )
{
$columns[$field] = $data[$field]; unset( $data[$field] );
}
$columns['content'] = serialize( $data );
// When the session id didnt change we will do an update
if ( $id == $this->inital_sessio... | [
"public",
"function",
"write",
"(",
"$",
"id",
",",
"$",
"data",
")",
"{",
"$",
"columns",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"index_fields",
"as",
"$",
"field",
")",
"{",
"$",
"columns",
"[",
"$",
"field",
"]",
"=",
... | Check if a session with the given key already exists
@param string $id The session id key.
@param array $data
@return bool | [
"Check",
"if",
"a",
"session",
"with",
"the",
"given",
"key",
"already",
"exists"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Session/Manager/Database.php#L100-L140 |
ClanCats/Core | src/bundles/Session/Manager/Database.php | Manager_Database.gc | public function gc( $time )
{
// if we don't have the last active key we cannot execute
// the garbage collection
if ( !in_array( 'last_active', $this->index_fields ) )
{
return false;
}
\DB::delete( $this->table )
->where( 'last_active', '<', time() - $time )
->run( $this->database );
} | php | public function gc( $time )
{
// if we don't have the last active key we cannot execute
// the garbage collection
if ( !in_array( 'last_active', $this->index_fields ) )
{
return false;
}
\DB::delete( $this->table )
->where( 'last_active', '<', time() - $time )
->run( $this->database );
} | [
"public",
"function",
"gc",
"(",
"$",
"time",
")",
"{",
"// if we don't have the last active key we cannot execute ",
"// the garbage collection",
"if",
"(",
"!",
"in_array",
"(",
"'last_active'",
",",
"$",
"this",
"->",
"index_fields",
")",
")",
"{",
"return",
"fal... | Delete session that are older than the given time in secounds
@param int $time
@return void | [
"Delete",
"session",
"that",
"are",
"older",
"than",
"the",
"given",
"time",
"in",
"secounds"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Session/Manager/Database.php#L148-L160 |
iocaste/microservice-foundation | src/Repository/Preloadable.php | Preloadable.getIncludes | protected function getIncludes($includes)
{
if ($includes === null) {
return [];
}
$fractal = app(Manager::class);
return $fractal->parseIncludes($includes)->getRequestedIncludes();
} | php | protected function getIncludes($includes)
{
if ($includes === null) {
return [];
}
$fractal = app(Manager::class);
return $fractal->parseIncludes($includes)->getRequestedIncludes();
} | [
"protected",
"function",
"getIncludes",
"(",
"$",
"includes",
")",
"{",
"if",
"(",
"$",
"includes",
"===",
"null",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",
"fractal",
"=",
"app",
"(",
"Manager",
"::",
"class",
")",
";",
"return",
"$",
"fractal",
... | @param $includes
@return array|null | [
"@param",
"$includes"
] | train | https://github.com/iocaste/microservice-foundation/blob/274a154de4299e8a57314bab972e09f6d8cdae9e/src/Repository/Preloadable.php#L69-L78 |
boekkooi/tactician-amqp | src/Exception/FailedToPublishException.php | FailedToPublishException.fromException | public static function fromException(Message $message, \AMQPException $exception)
{
$exception = new static('A AMQP exception occured while publishing the message', 0, $exception);
$exception->tacticianMessage = $message;
return $exception;
} | php | public static function fromException(Message $message, \AMQPException $exception)
{
$exception = new static('A AMQP exception occured while publishing the message', 0, $exception);
$exception->tacticianMessage = $message;
return $exception;
} | [
"public",
"static",
"function",
"fromException",
"(",
"Message",
"$",
"message",
",",
"\\",
"AMQPException",
"$",
"exception",
")",
"{",
"$",
"exception",
"=",
"new",
"static",
"(",
"'A AMQP exception occured while publishing the message'",
",",
"0",
",",
"$",
"ex... | @param \AMQPException $exception
@param Message $message
@return static | [
"@param",
"\\",
"AMQPException",
"$exception",
"@param",
"Message",
"$message"
] | train | https://github.com/boekkooi/tactician-amqp/blob/55cbb8b9e20aab7891e6a6090b248377c599360e/src/Exception/FailedToPublishException.php#L40-L46 |
ClanCats/Core | src/bundles/Session/Manager/Json.php | Manager_Json.read | public function read( $id )
{
if ( $this->has( $id ) )
{
return \CCJson::read( $this->file_path( $id ) );
}
return array();
} | php | public function read( $id )
{
if ( $this->has( $id ) )
{
return \CCJson::read( $this->file_path( $id ) );
}
return array();
} | [
"public",
"function",
"read",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"has",
"(",
"$",
"id",
")",
")",
"{",
"return",
"\\",
"CCJson",
"::",
"read",
"(",
"$",
"this",
"->",
"file_path",
"(",
"$",
"id",
")",
")",
";",
"}",
"retu... | Read data from the session dirver
@param string $id The session id key.
@return array | [
"Read",
"data",
"from",
"the",
"session",
"dirver"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Session/Manager/Json.php#L20-L28 |
ClanCats/Core | src/bundles/Session/Manager/Json.php | Manager_Json.write | public function write( $id, $data )
{
\CCJson::write( $this->file_path( $id ), $data, true );
} | php | public function write( $id, $data )
{
\CCJson::write( $this->file_path( $id ), $data, true );
} | [
"public",
"function",
"write",
"(",
"$",
"id",
",",
"$",
"data",
")",
"{",
"\\",
"CCJson",
"::",
"write",
"(",
"$",
"this",
"->",
"file_path",
"(",
"$",
"id",
")",
",",
"$",
"data",
",",
"true",
")",
";",
"}"
] | Check if a session with the given key already exists
@param string $id The session id key.
@param array $data
@return bool | [
"Check",
"if",
"a",
"session",
"with",
"the",
"given",
"key",
"already",
"exists"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Session/Manager/Json.php#L48-L51 |
loadsys/CakePHP-CreatorModifier | src/Model/Behavior/CreatorModifierBehavior.php | CreatorModifierBehavior.handleEvent | public function handleEvent(Event $event, Entity $entity) {
$eventName = $event->name();
$events = $this->_config['events'];
$new = $entity->isNew() !== false;
foreach ($events[$eventName] as $field => $when) {
if (!in_array($when, ['always', 'new', 'existing'])) {
throw new UnexpectedValueException(
... | php | public function handleEvent(Event $event, Entity $entity) {
$eventName = $event->name();
$events = $this->_config['events'];
$new = $entity->isNew() !== false;
foreach ($events[$eventName] as $field => $when) {
if (!in_array($when, ['always', 'new', 'existing'])) {
throw new UnexpectedValueException(
... | [
"public",
"function",
"handleEvent",
"(",
"Event",
"$",
"event",
",",
"Entity",
"$",
"entity",
")",
"{",
"$",
"eventName",
"=",
"$",
"event",
"->",
"name",
"(",
")",
";",
"$",
"events",
"=",
"$",
"this",
"->",
"_config",
"[",
"'events'",
"]",
";",
... | There is only one event handler, it can be configured to be called for any event
@param \Cake\Event\Event $event Event instance.
@param \Cake\ORM\Entity $entity Entity instance.
@throws \UnexpectedValueException if a field's when value is misdefined
@return true (irrespective of the behavior logic, the save will not b... | [
"There",
"is",
"only",
"one",
"event",
"handler",
"it",
"can",
"be",
"configured",
"to",
"be",
"called",
"for",
"any",
"event"
] | train | https://github.com/loadsys/CakePHP-CreatorModifier/blob/42a87eda9413beff82b4eb9cab77d2d5bd5536a0/src/Model/Behavior/CreatorModifierBehavior.php#L78-L100 |
loadsys/CakePHP-CreatorModifier | src/Model/Behavior/CreatorModifierBehavior.php | CreatorModifierBehavior.createdOrModifed | public function createdOrModifed(Entity $entity, $eventName = 'Model.beforeSave') {
$events = $this->_config['events'];
if (empty($events[$eventName])) {
return false;
}
$return = false;
foreach ($events[$eventName] as $field => $when) {
if (in_array($when, ['always', 'existing'])) {
$return = tru... | php | public function createdOrModifed(Entity $entity, $eventName = 'Model.beforeSave') {
$events = $this->_config['events'];
if (empty($events[$eventName])) {
return false;
}
$return = false;
foreach ($events[$eventName] as $field => $when) {
if (in_array($when, ['always', 'existing'])) {
$return = tru... | [
"public",
"function",
"createdOrModifed",
"(",
"Entity",
"$",
"entity",
",",
"$",
"eventName",
"=",
"'Model.beforeSave'",
")",
"{",
"$",
"events",
"=",
"$",
"this",
"->",
"_config",
"[",
"'events'",
"]",
";",
"if",
"(",
"empty",
"(",
"$",
"events",
"[",
... | Modifies the Creator/Modifier fields for the entity in the beforeSave callback.
@param \Cake\ORM\Entity $entity Entity instance.
@param string $eventName Event name.
@return bool true if a field is updated, false if no action performed | [
"Modifies",
"the",
"Creator",
"/",
"Modifier",
"fields",
"for",
"the",
"entity",
"in",
"the",
"beforeSave",
"callback",
"."
] | train | https://github.com/loadsys/CakePHP-CreatorModifier/blob/42a87eda9413beff82b4eb9cab77d2d5bd5536a0/src/Model/Behavior/CreatorModifierBehavior.php#L130-L147 |
loadsys/CakePHP-CreatorModifier | src/Model/Behavior/CreatorModifierBehavior.php | CreatorModifierBehavior.updateField | protected function updateField(Entity $entity, $field) {
if ($entity->dirty($field)) {
return;
}
$entity->set($field, $this->getUserId());
} | php | protected function updateField(Entity $entity, $field) {
if ($entity->dirty($field)) {
return;
}
$entity->set($field, $this->getUserId());
} | [
"protected",
"function",
"updateField",
"(",
"Entity",
"$",
"entity",
",",
"$",
"field",
")",
"{",
"if",
"(",
"$",
"entity",
"->",
"dirty",
"(",
"$",
"field",
")",
")",
"{",
"return",
";",
"}",
"$",
"entity",
"->",
"set",
"(",
"$",
"field",
",",
... | Update a field, if it hasn't been updated already
@param \Cake\ORM\Entity $entity Entity instance.
@param string $field Field name
@return void | [
"Update",
"a",
"field",
"if",
"it",
"hasn",
"t",
"been",
"updated",
"already"
] | train | https://github.com/loadsys/CakePHP-CreatorModifier/blob/42a87eda9413beff82b4eb9cab77d2d5bd5536a0/src/Model/Behavior/CreatorModifierBehavior.php#L156-L162 |
loadsys/CakePHP-CreatorModifier | src/Model/Behavior/CreatorModifierBehavior.php | CreatorModifierBehavior.sessionUserId | protected function sessionUserId() {
$userId = null;
$request = $this->newRequest();
if ($request->session()->started()) {
$userId = $request->session()->read($this->_config['sessionUserIdKey']);
} else {
$this->log('The Session is not started. This typically means a User is not logged in. In this case t... | php | protected function sessionUserId() {
$userId = null;
$request = $this->newRequest();
if ($request->session()->started()) {
$userId = $request->session()->read($this->_config['sessionUserIdKey']);
} else {
$this->log('The Session is not started. This typically means a User is not logged in. In this case t... | [
"protected",
"function",
"sessionUserId",
"(",
")",
"{",
"$",
"userId",
"=",
"null",
";",
"$",
"request",
"=",
"$",
"this",
"->",
"newRequest",
"(",
")",
";",
"if",
"(",
"$",
"request",
"->",
"session",
"(",
")",
"->",
"started",
"(",
")",
")",
"{"... | Return the User.id grabbed from the Session information.
@return string The string representing the current logged in user. | [
"Return",
"the",
"User",
".",
"id",
"grabbed",
"from",
"the",
"Session",
"information",
"."
] | train | https://github.com/loadsys/CakePHP-CreatorModifier/blob/42a87eda9413beff82b4eb9cab77d2d5bd5536a0/src/Model/Behavior/CreatorModifierBehavior.php#L169-L185 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Feed.php | Zend_Feed.lookupNamespace | public static function lookupNamespace($prefix)
{
return isset(self::$_namespaces[$prefix]) ?
self::$_namespaces[$prefix] :
$prefix;
} | php | public static function lookupNamespace($prefix)
{
return isset(self::$_namespaces[$prefix]) ?
self::$_namespaces[$prefix] :
$prefix;
} | [
"public",
"static",
"function",
"lookupNamespace",
"(",
"$",
"prefix",
")",
"{",
"return",
"isset",
"(",
"self",
"::",
"$",
"_namespaces",
"[",
"$",
"prefix",
"]",
")",
"?",
"self",
"::",
"$",
"_namespaces",
"[",
"$",
"prefix",
"]",
":",
"$",
"prefix",... | Get the full version of a namespace prefix
Looks up a prefix (atom:, etc.) in the list of registered
namespaces and returns the full namespace URI if
available. Returns the prefix, unmodified, if it's not
registered.
@return string | [
"Get",
"the",
"full",
"version",
"of",
"a",
"namespace",
"prefix"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed.php#L135-L140 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Feed.php | Zend_Feed.import | public static function import($uri)
{
$client = self::getHttpClient();
$client->setUri($uri);
$response = $client->request('GET');
if ($response->getStatus() !== 200) {
/**
* @see Zend_Feed_Exception
*/
require_once 'Zend/Feed/Excepti... | php | public static function import($uri)
{
$client = self::getHttpClient();
$client->setUri($uri);
$response = $client->request('GET');
if ($response->getStatus() !== 200) {
/**
* @see Zend_Feed_Exception
*/
require_once 'Zend/Feed/Excepti... | [
"public",
"static",
"function",
"import",
"(",
"$",
"uri",
")",
"{",
"$",
"client",
"=",
"self",
"::",
"getHttpClient",
"(",
")",
";",
"$",
"client",
"->",
"setUri",
"(",
"$",
"uri",
")",
";",
"$",
"response",
"=",
"$",
"client",
"->",
"request",
"... | Imports a feed located at $uri.
@param string $uri
@throws Zend_Feed_Exception
@return Zend_Feed_Abstract | [
"Imports",
"a",
"feed",
"located",
"at",
"$uri",
"."
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed.php#L167-L181 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Feed.php | Zend_Feed.importString | public static function importString($string)
{
// Load the feed as an XML DOMDocument object
@ini_set('track_errors', 1);
$doc = new DOMDocument;
$status = @$doc->loadXML($string);
@ini_restore('track_errors');
if (!$status) {
// prevent the class to gene... | php | public static function importString($string)
{
// Load the feed as an XML DOMDocument object
@ini_set('track_errors', 1);
$doc = new DOMDocument;
$status = @$doc->loadXML($string);
@ini_restore('track_errors');
if (!$status) {
// prevent the class to gene... | [
"public",
"static",
"function",
"importString",
"(",
"$",
"string",
")",
"{",
"// Load the feed as an XML DOMDocument object",
"@",
"ini_set",
"(",
"'track_errors'",
",",
"1",
")",
";",
"$",
"doc",
"=",
"new",
"DOMDocument",
";",
"$",
"status",
"=",
"@",
"$",
... | Imports a feed represented by $string.
@param string $string
@throws Zend_Feed_Exception
@return Zend_Feed_Abstract | [
"Imports",
"a",
"feed",
"represented",
"by",
"$string",
"."
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed.php#L191-L243 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Feed.php | Zend_Feed.importFile | public static function importFile($filename)
{
@ini_set('track_errors', 1);
$feed = @file_get_contents($filename);
@ini_restore('track_errors');
if ($feed === false) {
/**
* @see Zend_Feed_Exception
*/
require_once 'Zend/Feed/Exceptio... | php | public static function importFile($filename)
{
@ini_set('track_errors', 1);
$feed = @file_get_contents($filename);
@ini_restore('track_errors');
if ($feed === false) {
/**
* @see Zend_Feed_Exception
*/
require_once 'Zend/Feed/Exceptio... | [
"public",
"static",
"function",
"importFile",
"(",
"$",
"filename",
")",
"{",
"@",
"ini_set",
"(",
"'track_errors'",
",",
"1",
")",
";",
"$",
"feed",
"=",
"@",
"file_get_contents",
"(",
"$",
"filename",
")",
";",
"@",
"ini_restore",
"(",
"'track_errors'",
... | Imports a feed from a file located at $filename.
@param string $filename
@throws Zend_Feed_Exception
@return Zend_Feed_Abstract | [
"Imports",
"a",
"feed",
"from",
"a",
"file",
"located",
"at",
"$filename",
"."
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed.php#L253-L266 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Feed.php | Zend_Feed.findFeeds | public static function findFeeds($uri)
{
// Get the HTTP response from $uri and save the contents
$client = self::getHttpClient();
$client->setUri($uri);
$response = $client->request();
if ($response->getStatus() !== 200) {
/**
* @see Zend_Feed_Except... | php | public static function findFeeds($uri)
{
// Get the HTTP response from $uri and save the contents
$client = self::getHttpClient();
$client->setUri($uri);
$response = $client->request();
if ($response->getStatus() !== 200) {
/**
* @see Zend_Feed_Except... | [
"public",
"static",
"function",
"findFeeds",
"(",
"$",
"uri",
")",
"{",
"// Get the HTTP response from $uri and save the contents",
"$",
"client",
"=",
"self",
"::",
"getHttpClient",
"(",
")",
";",
"$",
"client",
"->",
"setUri",
"(",
"$",
"uri",
")",
";",
"$",... | Attempts to find feeds at $uri referenced by <link ... /> tags. Returns an
array of the feeds referenced at $uri.
@todo Allow findFeeds() to follow one, but only one, code 302.
@param string $uri
@throws Zend_Feed_Exception
@return array | [
"Attempts",
"to",
"find",
"feeds",
"at",
"$uri",
"referenced",
"by",
"<link",
"...",
"/",
">",
"tags",
".",
"Returns",
"an",
"array",
"of",
"the",
"feeds",
"referenced",
"at",
"$uri",
"."
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed.php#L279-L364 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Feed.php | Zend_Feed.importArray | public static function importArray(array $data, $format = 'atom')
{
$obj = 'Zend_Feed_' . ucfirst(strtolower($format));
/**
* @see Zend_Loader
*/
require_once 'Zend/Loader.php';
Zend_Loader::loadClass($obj);
/**
* @see Zend_Feed_Builder
*/
... | php | public static function importArray(array $data, $format = 'atom')
{
$obj = 'Zend_Feed_' . ucfirst(strtolower($format));
/**
* @see Zend_Loader
*/
require_once 'Zend/Loader.php';
Zend_Loader::loadClass($obj);
/**
* @see Zend_Feed_Builder
*/
... | [
"public",
"static",
"function",
"importArray",
"(",
"array",
"$",
"data",
",",
"$",
"format",
"=",
"'atom'",
")",
"{",
"$",
"obj",
"=",
"'Zend_Feed_'",
".",
"ucfirst",
"(",
"strtolower",
"(",
"$",
"format",
")",
")",
";",
"/**\n * @see Zend_Loader\n ... | Construct a new Zend_Feed_Abstract object from a custom array
@param array $data
@param string $format (rss|atom) the requested output format
@return Zend_Feed_Abstract | [
"Construct",
"a",
"new",
"Zend_Feed_Abstract",
"object",
"from",
"a",
"custom",
"array"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed.php#L373-L386 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Feed.php | Zend_Feed.importBuilder | public static function importBuilder(Zend_Feed_Builder_Interface $builder, $format = 'atom')
{
$obj = 'Zend_Feed_' . ucfirst(strtolower($format));
/**
* @see Zend_Loader
*/
require_once 'Zend/Loader.php';
Zend_Loader::loadClass($obj);
return new $obj(null, ... | php | public static function importBuilder(Zend_Feed_Builder_Interface $builder, $format = 'atom')
{
$obj = 'Zend_Feed_' . ucfirst(strtolower($format));
/**
* @see Zend_Loader
*/
require_once 'Zend/Loader.php';
Zend_Loader::loadClass($obj);
return new $obj(null, ... | [
"public",
"static",
"function",
"importBuilder",
"(",
"Zend_Feed_Builder_Interface",
"$",
"builder",
",",
"$",
"format",
"=",
"'atom'",
")",
"{",
"$",
"obj",
"=",
"'Zend_Feed_'",
".",
"ucfirst",
"(",
"strtolower",
"(",
"$",
"format",
")",
")",
";",
"/**\n ... | Construct a new Zend_Feed_Abstract object from a Zend_Feed_Builder_Interface data source
@param Zend_Feed_Builder_Interface $builder this object will be used to extract the data of the feed
@param string $format (rss|atom) the requested output format
@return Zend_Feed_Abstract | [
"Construct",
"a",
"new",
"Zend_Feed_Abstract",
"object",
"from",
"a",
"Zend_Feed_Builder_Interface",
"data",
"source"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed.php#L395-L405 |
inpsyde/inpsyde-filter | src/WordPress/NormalizeWhitespace.php | NormalizeWhitespace.filter | public function filter( $value ) {
if ( ! is_string( $value ) || empty( $value ) ) {
do_action( 'inpsyde.filter.error', 'The given value is not a string or empty.', [ 'method' => __METHOD__, 'value' => $value ] );
return $value;
}
return normalize_whitespace( $value );
} | php | public function filter( $value ) {
if ( ! is_string( $value ) || empty( $value ) ) {
do_action( 'inpsyde.filter.error', 'The given value is not a string or empty.', [ 'method' => __METHOD__, 'value' => $value ] );
return $value;
}
return normalize_whitespace( $value );
} | [
"public",
"function",
"filter",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"value",
")",
"||",
"empty",
"(",
"$",
"value",
")",
")",
"{",
"do_action",
"(",
"'inpsyde.filter.error'",
",",
"'The given value is not a string or empty.'",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/inpsyde/inpsyde-filter/blob/777a6208ea4dfbeed89e6d0712a35dc25eab498b/src/WordPress/NormalizeWhitespace.php#L18-L27 |
zodream/thirdparty | src/Pay/AliPay.php | AliPay.encrypt | protected function encrypt($str){
//AES, 128 模式加密数据 CBC
$screct_key = base64_decode($this->key);
$str = trim($str);
$str = $this->addPKCS7Padding($str);
$iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC), 1);
$encrypt_str = mcrypt_encrypt(MCR... | php | protected function encrypt($str){
//AES, 128 模式加密数据 CBC
$screct_key = base64_decode($this->key);
$str = trim($str);
$str = $this->addPKCS7Padding($str);
$iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC), 1);
$encrypt_str = mcrypt_encrypt(MCR... | [
"protected",
"function",
"encrypt",
"(",
"$",
"str",
")",
"{",
"//AES, 128 模式加密数据 CBC",
"$",
"screct_key",
"=",
"base64_decode",
"(",
"$",
"this",
"->",
"key",
")",
";",
"$",
"str",
"=",
"trim",
"(",
"$",
"str",
")",
";",
"$",
"str",
"=",
"$",
"this"... | 加密方法
@param string $str
@return string | [
"加密方法"
] | train | https://github.com/zodream/thirdparty/blob/b9d39087913850f1c5c7c9165105fec22a128f8f/src/Pay/AliPay.php#L298-L306 |
zodream/thirdparty | src/Pay/AliPay.php | AliPay.decrypt | function decrypt($str){
//AES, 128 模式加密数据 CBC
$str = base64_decode($str);
$screct_key = base64_decode($this->key);
$iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC), 1);
$encrypt_str = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $screct_key, $str, MCRYPT_MO... | php | function decrypt($str){
//AES, 128 模式加密数据 CBC
$str = base64_decode($str);
$screct_key = base64_decode($this->key);
$iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC), 1);
$encrypt_str = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $screct_key, $str, MCRYPT_MO... | [
"function",
"decrypt",
"(",
"$",
"str",
")",
"{",
"//AES, 128 模式加密数据 CBC",
"$",
"str",
"=",
"base64_decode",
"(",
"$",
"str",
")",
";",
"$",
"screct_key",
"=",
"base64_decode",
"(",
"$",
"this",
"->",
"key",
")",
";",
"$",
"iv",
"=",
"mcrypt_create_iv",
... | 解密方法
@param string $str
@return string | [
"解密方法"
] | train | https://github.com/zodream/thirdparty/blob/b9d39087913850f1c5c7c9165105fec22a128f8f/src/Pay/AliPay.php#L313-L324 |
zodream/thirdparty | src/Pay/AliPay.php | AliPay.addPKCS7Padding | protected function addPKCS7Padding($source){
$source = trim($source);
$block = mcrypt_get_block_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC);
$pad = $block - (strlen($source) % $block);
if ($pad <= $block) {
$char = chr($pad);
$source .= str_repeat($char, $pad);
... | php | protected function addPKCS7Padding($source){
$source = trim($source);
$block = mcrypt_get_block_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC);
$pad = $block - (strlen($source) % $block);
if ($pad <= $block) {
$char = chr($pad);
$source .= str_repeat($char, $pad);
... | [
"protected",
"function",
"addPKCS7Padding",
"(",
"$",
"source",
")",
"{",
"$",
"source",
"=",
"trim",
"(",
"$",
"source",
")",
";",
"$",
"block",
"=",
"mcrypt_get_block_size",
"(",
"MCRYPT_RIJNDAEL_128",
",",
"MCRYPT_MODE_CBC",
")",
";",
"$",
"pad",
"=",
"... | 填充算法
@param string $source
@return string | [
"填充算法"
] | train | https://github.com/zodream/thirdparty/blob/b9d39087913850f1c5c7c9165105fec22a128f8f/src/Pay/AliPay.php#L331-L341 |
zodream/thirdparty | src/Pay/AliPay.php | AliPay.stripPKSC7Padding | protected function stripPKSC7Padding($source){
$source = trim($source);
$char = substr($source, -1);
$num = ord($char);
if($num==62)return $source;
$source = substr($source,0,-$num);
return $source;
} | php | protected function stripPKSC7Padding($source){
$source = trim($source);
$char = substr($source, -1);
$num = ord($char);
if($num==62)return $source;
$source = substr($source,0,-$num);
return $source;
} | [
"protected",
"function",
"stripPKSC7Padding",
"(",
"$",
"source",
")",
"{",
"$",
"source",
"=",
"trim",
"(",
"$",
"source",
")",
";",
"$",
"char",
"=",
"substr",
"(",
"$",
"source",
",",
"-",
"1",
")",
";",
"$",
"num",
"=",
"ord",
"(",
"$",
"char... | 移去填充算法
@param string $source
@return string | [
"移去填充算法"
] | train | https://github.com/zodream/thirdparty/blob/b9d39087913850f1c5c7c9165105fec22a128f8f/src/Pay/AliPay.php#L347-L354 |
zodream/thirdparty | src/Pay/AliPay.php | AliPay.sign | public function sign($content) {
if (is_array($content)) {
$content = $this->getSignContent($content);
}
if ($this->signType == self::MD5
|| empty($this->privateKeyFile)) {
return md5($content.$this->key);
}
if ($this->signType != self::RSA
... | php | public function sign($content) {
if (is_array($content)) {
$content = $this->getSignContent($content);
}
if ($this->signType == self::MD5
|| empty($this->privateKeyFile)) {
return md5($content.$this->key);
}
if ($this->signType != self::RSA
... | [
"public",
"function",
"sign",
"(",
"$",
"content",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"content",
")",
")",
"{",
"$",
"content",
"=",
"$",
"this",
"->",
"getSignContent",
"(",
"$",
"content",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"s... | 生成请求参数的签名
@param string|array $content
@return string
@throws Exception | [
"生成请求参数的签名"
] | train | https://github.com/zodream/thirdparty/blob/b9d39087913850f1c5c7c9165105fec22a128f8f/src/Pay/AliPay.php#L402-L425 |
zodream/thirdparty | src/Pay/AliPay.php | AliPay.queryOrder | public function queryOrder(array $args = array()) {
$args = $this->getQuery()->parameters($this->merge($args))->json();
if (!array_key_exists('alipay_trade_query_response', $args)) {
throw new \Exception('未知错误!');
}
$args = $args['alipay_trade_query_response'];
if ($a... | php | public function queryOrder(array $args = array()) {
$args = $this->getQuery()->parameters($this->merge($args))->json();
if (!array_key_exists('alipay_trade_query_response', $args)) {
throw new \Exception('未知错误!');
}
$args = $args['alipay_trade_query_response'];
if ($a... | [
"public",
"function",
"queryOrder",
"(",
"array",
"$",
"args",
"=",
"array",
"(",
")",
")",
"{",
"$",
"args",
"=",
"$",
"this",
"->",
"getQuery",
"(",
")",
"->",
"parameters",
"(",
"$",
"this",
"->",
"merge",
"(",
"$",
"args",
")",
")",
"->",
"js... | 查询接口
EXMAPLE:
[
'timestamp' => date('Y-m-d H:i:s'),
'out_trade_no' => ''
]
@param array $args
@return array|bool|mixed
@throws \Exception | [
"查询接口",
"EXMAPLE",
":",
"[",
"timestamp",
"=",
">",
"date",
"(",
"Y",
"-",
"m",
"-",
"d",
"H",
":",
"i",
":",
"s",
")",
"out_trade_no",
"=",
">",
"]"
] | train | https://github.com/zodream/thirdparty/blob/b9d39087913850f1c5c7c9165105fec22a128f8f/src/Pay/AliPay.php#L517-L530 |
zodream/thirdparty | src/Pay/AliPay.php | AliPay.encodeContent | protected function encodeContent(array $args) {
$data = [];
foreach ($args as $key => $item) {
$data[] = sprintf('"%s"="%s"', $key, $item);
}
return '{'.implode(',', $data).'}';
} | php | protected function encodeContent(array $args) {
$data = [];
foreach ($args as $key => $item) {
$data[] = sprintf('"%s"="%s"', $key, $item);
}
return '{'.implode(',', $data).'}';
} | [
"protected",
"function",
"encodeContent",
"(",
"array",
"$",
"args",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"args",
"as",
"$",
"key",
"=>",
"$",
"item",
")",
"{",
"$",
"data",
"[",
"]",
"=",
"sprintf",
"(",
"'\"%s\"=\"%s\"'... | 合并biz_content
@param array $args
@return string | [
"合并biz_content"
] | train | https://github.com/zodream/thirdparty/blob/b9d39087913850f1c5c7c9165105fec22a128f8f/src/Pay/AliPay.php#L546-L552 |
yuncms/framework | src/web/Controller.php | Controller.asJsonP | public function asJsonP($data): YiiResponse
{
$response = Yii::$app->getResponse();
$response->data = $data;
$response->format = YiiResponse::FORMAT_JSONP;
return $response;
} | php | public function asJsonP($data): YiiResponse
{
$response = Yii::$app->getResponse();
$response->data = $data;
$response->format = YiiResponse::FORMAT_JSONP;
return $response;
} | [
"public",
"function",
"asJsonP",
"(",
"$",
"data",
")",
":",
"YiiResponse",
"{",
"$",
"response",
"=",
"Yii",
"::",
"$",
"app",
"->",
"getResponse",
"(",
")",
";",
"$",
"response",
"->",
"data",
"=",
"$",
"data",
";",
"$",
"response",
"->",
"format",... | Sets the response format of the given data as JSONP.
@param mixed $data The data that should be formatted.
@return Response A response that is configured to send `$data` formatted as JSON.
@see YiiResponse::$format
@see YiiResponse::FORMAT_JSONP
@see JsonResponseFormatter | [
"Sets",
"the",
"response",
"format",
"of",
"the",
"given",
"data",
"as",
"JSONP",
"."
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/web/Controller.php#L33-L39 |
yuncms/framework | src/web/Controller.php | Controller.asRaw | public function asRaw($data): YiiResponse
{
$response = Yii::$app->getResponse();
$response->data = $data;
$response->format = YiiResponse::FORMAT_RAW;
return $response;
} | php | public function asRaw($data): YiiResponse
{
$response = Yii::$app->getResponse();
$response->data = $data;
$response->format = YiiResponse::FORMAT_RAW;
return $response;
} | [
"public",
"function",
"asRaw",
"(",
"$",
"data",
")",
":",
"YiiResponse",
"{",
"$",
"response",
"=",
"Yii",
"::",
"$",
"app",
"->",
"getResponse",
"(",
")",
";",
"$",
"response",
"->",
"data",
"=",
"$",
"data",
";",
"$",
"response",
"->",
"format",
... | Sets the response format of the given data as RAW.
@param mixed $data The data that should *not* be formatted.
@return YiiResponse A response that is configured to send `$data` without formatting.
@see YiiResponse::$format
@see YiiResponse::FORMAT_RAW | [
"Sets",
"the",
"response",
"format",
"of",
"the",
"given",
"data",
"as",
"RAW",
"."
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/web/Controller.php#L49-L55 |
yuncms/framework | src/web/Controller.php | Controller.asQrCode | public function asQrCode($data): YiiResponse
{
$response = Yii::$app->getResponse();
$response->format = YiiResponse::FORMAT_RAW;
$headers = $response->getHeaders();
$qrCode = new QrCode($data);
$headers->setDefault('Content-Type', $qrCode->getContentType());
$respons... | php | public function asQrCode($data): YiiResponse
{
$response = Yii::$app->getResponse();
$response->format = YiiResponse::FORMAT_RAW;
$headers = $response->getHeaders();
$qrCode = new QrCode($data);
$headers->setDefault('Content-Type', $qrCode->getContentType());
$respons... | [
"public",
"function",
"asQrCode",
"(",
"$",
"data",
")",
":",
"YiiResponse",
"{",
"$",
"response",
"=",
"Yii",
"::",
"$",
"app",
"->",
"getResponse",
"(",
")",
";",
"$",
"response",
"->",
"format",
"=",
"YiiResponse",
"::",
"FORMAT_RAW",
";",
"$",
"hea... | 输出二维码
@param string $data
@return YiiResponse
@throws \Da\QrCode\Exception\UnknownWriterException | [
"输出二维码"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/web/Controller.php#L63-L72 |
AndreyKluev/yii2-shop-basket | BasketComponent.php | BasketComponent.init | public function init()
{
// Если гость ...
if (Yii::$app->getUser()->isGuest) {
// ... то корзину храним в сессии
$this->basket = new SessionBasket();
} else {
// ... иначе в БД
$this->basket = new DbBasket();
$this->basket->idUser ... | php | public function init()
{
// Если гость ...
if (Yii::$app->getUser()->isGuest) {
// ... то корзину храним в сессии
$this->basket = new SessionBasket();
} else {
// ... иначе в БД
$this->basket = new DbBasket();
$this->basket->idUser ... | [
"public",
"function",
"init",
"(",
")",
"{",
"// Если гость ...",
"if",
"(",
"Yii",
"::",
"$",
"app",
"->",
"getUser",
"(",
")",
"->",
"isGuest",
")",
"{",
"// ... то корзину храним в сессии",
"$",
"this",
"->",
"basket",
"=",
"new",
"SessionBasket",
"(",
... | Инициализируем корзину | [
"Инициализируем",
"корзину"
] | train | https://github.com/AndreyKluev/yii2-shop-basket/blob/3bc529fd576a18403096f911112d5337cb5b1069/BasketComponent.php#L52-L74 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.