id
int32
0
241k
repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
221,500
adhocore/php-cron-expr
src/SegmentChecker.php
SegmentChecker.checkDue
public function checkDue($segment, $pos, $times) { $isDue = true; $offsets = \explode(',', \trim($segment)); foreach ($offsets as $offset) { if (null === $isDue = $this->isOffsetDue($offset, $pos, $times)) { throw new \UnexpectedValueException( sprintf('Invalid offset value at segment #%d: %s', $pos, $offset) ); } if ($isDue) { return true; } } return false; }
php
public function checkDue($segment, $pos, $times) { $isDue = true; $offsets = \explode(',', \trim($segment)); foreach ($offsets as $offset) { if (null === $isDue = $this->isOffsetDue($offset, $pos, $times)) { throw new \UnexpectedValueException( sprintf('Invalid offset value at segment #%d: %s', $pos, $offset) ); } if ($isDue) { return true; } } return false; }
[ "public", "function", "checkDue", "(", "$", "segment", ",", "$", "pos", ",", "$", "times", ")", "{", "$", "isDue", "=", "true", ";", "$", "offsets", "=", "\\", "explode", "(", "','", ",", "\\", "trim", "(", "$", "segment", ")", ")", ";", "foreach", "(", "$", "offsets", "as", "$", "offset", ")", "{", "if", "(", "null", "===", "$", "isDue", "=", "$", "this", "->", "isOffsetDue", "(", "$", "offset", ",", "$", "pos", ",", "$", "times", ")", ")", "{", "throw", "new", "\\", "UnexpectedValueException", "(", "sprintf", "(", "'Invalid offset value at segment #%d: %s'", ",", "$", "pos", ",", "$", "offset", ")", ")", ";", "}", "if", "(", "$", "isDue", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Checks if a cron segment satisfies given time. @param string $segment @param int $pos @param array $times @return bool
[ "Checks", "if", "a", "cron", "segment", "satisfies", "given", "time", "." ]
d7bfd342d62795a50ad6377964cf567eb727961a
https://github.com/adhocore/php-cron-expr/blob/d7bfd342d62795a50ad6377964cf567eb727961a/src/SegmentChecker.php#L40-L58
221,501
adhocore/php-cron-expr
src/SegmentChecker.php
SegmentChecker.isOffsetDue
protected function isOffsetDue($offset, $pos, $times) { if (\strpos($offset, '/') !== false) { return $this->validator->inStep($times[$pos], $offset); } if (\strpos($offset, '-') !== false) { return $this->validator->inRange($times[$pos], $offset); } if (\is_numeric($offset)) { return $times[$pos] == $offset; } return $this->checkModifier($offset, $pos, $times); }
php
protected function isOffsetDue($offset, $pos, $times) { if (\strpos($offset, '/') !== false) { return $this->validator->inStep($times[$pos], $offset); } if (\strpos($offset, '-') !== false) { return $this->validator->inRange($times[$pos], $offset); } if (\is_numeric($offset)) { return $times[$pos] == $offset; } return $this->checkModifier($offset, $pos, $times); }
[ "protected", "function", "isOffsetDue", "(", "$", "offset", ",", "$", "pos", ",", "$", "times", ")", "{", "if", "(", "\\", "strpos", "(", "$", "offset", ",", "'/'", ")", "!==", "false", ")", "{", "return", "$", "this", "->", "validator", "->", "inStep", "(", "$", "times", "[", "$", "pos", "]", ",", "$", "offset", ")", ";", "}", "if", "(", "\\", "strpos", "(", "$", "offset", ",", "'-'", ")", "!==", "false", ")", "{", "return", "$", "this", "->", "validator", "->", "inRange", "(", "$", "times", "[", "$", "pos", "]", ",", "$", "offset", ")", ";", "}", "if", "(", "\\", "is_numeric", "(", "$", "offset", ")", ")", "{", "return", "$", "times", "[", "$", "pos", "]", "==", "$", "offset", ";", "}", "return", "$", "this", "->", "checkModifier", "(", "$", "offset", ",", "$", "pos", ",", "$", "times", ")", ";", "}" ]
Check if a given offset at a position is due with respect to given time. @param string $offset @param int $pos @param array $times @return bool|null
[ "Check", "if", "a", "given", "offset", "at", "a", "position", "is", "due", "with", "respect", "to", "given", "time", "." ]
d7bfd342d62795a50ad6377964cf567eb727961a
https://github.com/adhocore/php-cron-expr/blob/d7bfd342d62795a50ad6377964cf567eb727961a/src/SegmentChecker.php#L69-L84
221,502
twizoapi/lib-api-php
src/Entity/Factory.php
Factory.createBioVoiceRegistration
public function createBioVoiceRegistration($recipient, $language = null, $webHook = null) { $bioVoiceRegistration = $this->createEmptyBioVoiceRegistration(); $bioVoiceRegistration->setRecipient($recipient); if ($language !== null) { $bioVoiceRegistration->setLanguage($language); } if ($webHook !== null) { $bioVoiceRegistration->setWebHook($webHook); } return $bioVoiceRegistration; }
php
public function createBioVoiceRegistration($recipient, $language = null, $webHook = null) { $bioVoiceRegistration = $this->createEmptyBioVoiceRegistration(); $bioVoiceRegistration->setRecipient($recipient); if ($language !== null) { $bioVoiceRegistration->setLanguage($language); } if ($webHook !== null) { $bioVoiceRegistration->setWebHook($webHook); } return $bioVoiceRegistration; }
[ "public", "function", "createBioVoiceRegistration", "(", "$", "recipient", ",", "$", "language", "=", "null", ",", "$", "webHook", "=", "null", ")", "{", "$", "bioVoiceRegistration", "=", "$", "this", "->", "createEmptyBioVoiceRegistration", "(", ")", ";", "$", "bioVoiceRegistration", "->", "setRecipient", "(", "$", "recipient", ")", ";", "if", "(", "$", "language", "!==", "null", ")", "{", "$", "bioVoiceRegistration", "->", "setLanguage", "(", "$", "language", ")", ";", "}", "if", "(", "$", "webHook", "!==", "null", ")", "{", "$", "bioVoiceRegistration", "->", "setWebHook", "(", "$", "webHook", ")", ";", "}", "return", "$", "bioVoiceRegistration", ";", "}" ]
Create bio voice registration object @param string $recipient @param string|null $language @param string|null $webHook @return BioVoiceRegistration
[ "Create", "bio", "voice", "registration", "object" ]
2e545d859784184138332c9b5bfc063940e3c926
https://github.com/twizoapi/lib-api-php/blob/2e545d859784184138332c9b5bfc063940e3c926/src/Entity/Factory.php#L58-L72
221,503
twizoapi/lib-api-php
src/Entity/Factory.php
Factory.createSms
public function createSms($body, array $recipients, $sender) { $sms = $this->createEmptySms(); $sms->setBody($body); $sms->setRecipients($recipients); $sms->setSender($sender); return $sms; }
php
public function createSms($body, array $recipients, $sender) { $sms = $this->createEmptySms(); $sms->setBody($body); $sms->setRecipients($recipients); $sms->setSender($sender); return $sms; }
[ "public", "function", "createSms", "(", "$", "body", ",", "array", "$", "recipients", ",", "$", "sender", ")", "{", "$", "sms", "=", "$", "this", "->", "createEmptySms", "(", ")", ";", "$", "sms", "->", "setBody", "(", "$", "body", ")", ";", "$", "sms", "->", "setRecipients", "(", "$", "recipients", ")", ";", "$", "sms", "->", "setSender", "(", "$", "sender", ")", ";", "return", "$", "sms", ";", "}" ]
Create sms object @param string $body @param array $recipients @param string $sender @return Sms
[ "Create", "sms", "object" ]
2e545d859784184138332c9b5bfc063940e3c926
https://github.com/twizoapi/lib-api-php/blob/2e545d859784184138332c9b5bfc063940e3c926/src/Entity/Factory.php#L247-L255
221,504
twizoapi/lib-api-php
src/Entity/Factory.php
Factory.createTotp
public function createTotp($identifier, $issuer = null) { $totp = $this->createEmptyTotp(); $totp->setIdentifier($identifier); if (null !== $issuer) { $totp->setIssuer($issuer); } return $totp; }
php
public function createTotp($identifier, $issuer = null) { $totp = $this->createEmptyTotp(); $totp->setIdentifier($identifier); if (null !== $issuer) { $totp->setIssuer($issuer); } return $totp; }
[ "public", "function", "createTotp", "(", "$", "identifier", ",", "$", "issuer", "=", "null", ")", "{", "$", "totp", "=", "$", "this", "->", "createEmptyTotp", "(", ")", ";", "$", "totp", "->", "setIdentifier", "(", "$", "identifier", ")", ";", "if", "(", "null", "!==", "$", "issuer", ")", "{", "$", "totp", "->", "setIssuer", "(", "$", "issuer", ")", ";", "}", "return", "$", "totp", ";", "}" ]
Create new totp secret secret @param string $identifier @param string|null $issuer @return Totp
[ "Create", "new", "totp", "secret", "secret" ]
2e545d859784184138332c9b5bfc063940e3c926
https://github.com/twizoapi/lib-api-php/blob/2e545d859784184138332c9b5bfc063940e3c926/src/Entity/Factory.php#L275-L284
221,505
twizoapi/lib-api-php
src/Entity/Factory.php
Factory.createWidgetSession
public function createWidgetSession(array $allowedTypes = null, $recipient = null, $backupCodeIdentifier = null, $totpIdentifier = null, $issuer = null) { $widgetSession = $this->createEmptyWidgetSession(); if ($allowedTypes !== null) { $widgetSession->setAllowedTypes($allowedTypes); } if ($recipient !== null) { $widgetSession->setRecipient($recipient); } if ($backupCodeIdentifier !== null) { $widgetSession->setBackupCodeIdentifier($backupCodeIdentifier); } if ($totpIdentifier !== null) { $widgetSession->setTotpIdentifier($totpIdentifier); } if ($issuer !== null) { $widgetSession->setIssuer($issuer); } return $widgetSession; }
php
public function createWidgetSession(array $allowedTypes = null, $recipient = null, $backupCodeIdentifier = null, $totpIdentifier = null, $issuer = null) { $widgetSession = $this->createEmptyWidgetSession(); if ($allowedTypes !== null) { $widgetSession->setAllowedTypes($allowedTypes); } if ($recipient !== null) { $widgetSession->setRecipient($recipient); } if ($backupCodeIdentifier !== null) { $widgetSession->setBackupCodeIdentifier($backupCodeIdentifier); } if ($totpIdentifier !== null) { $widgetSession->setTotpIdentifier($totpIdentifier); } if ($issuer !== null) { $widgetSession->setIssuer($issuer); } return $widgetSession; }
[ "public", "function", "createWidgetSession", "(", "array", "$", "allowedTypes", "=", "null", ",", "$", "recipient", "=", "null", ",", "$", "backupCodeIdentifier", "=", "null", ",", "$", "totpIdentifier", "=", "null", ",", "$", "issuer", "=", "null", ")", "{", "$", "widgetSession", "=", "$", "this", "->", "createEmptyWidgetSession", "(", ")", ";", "if", "(", "$", "allowedTypes", "!==", "null", ")", "{", "$", "widgetSession", "->", "setAllowedTypes", "(", "$", "allowedTypes", ")", ";", "}", "if", "(", "$", "recipient", "!==", "null", ")", "{", "$", "widgetSession", "->", "setRecipient", "(", "$", "recipient", ")", ";", "}", "if", "(", "$", "backupCodeIdentifier", "!==", "null", ")", "{", "$", "widgetSession", "->", "setBackupCodeIdentifier", "(", "$", "backupCodeIdentifier", ")", ";", "}", "if", "(", "$", "totpIdentifier", "!==", "null", ")", "{", "$", "widgetSession", "->", "setTotpIdentifier", "(", "$", "totpIdentifier", ")", ";", "}", "if", "(", "$", "issuer", "!==", "null", ")", "{", "$", "widgetSession", "->", "setIssuer", "(", "$", "issuer", ")", ";", "}", "return", "$", "widgetSession", ";", "}" ]
Create widget session object @param array|null $allowedTypes @param string|null $recipient @param string|null $backupCodeIdentifier @param string|null $totpIdentifier @param string|null $issuer @return WidgetSession
[ "Create", "widget", "session", "object" ]
2e545d859784184138332c9b5bfc063940e3c926
https://github.com/twizoapi/lib-api-php/blob/2e545d859784184138332c9b5bfc063940e3c926/src/Entity/Factory.php#L312-L336
221,506
twizoapi/lib-api-php
src/Entity/Factory.php
Factory.createWidgetRegisterSession
public function createWidgetRegisterSession(array $allowedTypes = null, $recipient = null, $backupCodeIdentifier = null, $totpIdentifier = null, $issuer = null) { $widgetRegisterSession = $this->createEmptyWidgetRegisterSession(); if ($allowedTypes !== null) { $widgetRegisterSession->setAllowedTypes($allowedTypes); } if ($recipient !== null) { $widgetRegisterSession->setRecipient($recipient); } if ($backupCodeIdentifier !== null) { $widgetRegisterSession->setBackupCodeIdentifier($backupCodeIdentifier); } if ($totpIdentifier !== null) { $widgetRegisterSession->setTotpIdentifier($totpIdentifier); } if ($issuer !== null) { $widgetRegisterSession->setIssuer($issuer); } return $widgetRegisterSession; }
php
public function createWidgetRegisterSession(array $allowedTypes = null, $recipient = null, $backupCodeIdentifier = null, $totpIdentifier = null, $issuer = null) { $widgetRegisterSession = $this->createEmptyWidgetRegisterSession(); if ($allowedTypes !== null) { $widgetRegisterSession->setAllowedTypes($allowedTypes); } if ($recipient !== null) { $widgetRegisterSession->setRecipient($recipient); } if ($backupCodeIdentifier !== null) { $widgetRegisterSession->setBackupCodeIdentifier($backupCodeIdentifier); } if ($totpIdentifier !== null) { $widgetRegisterSession->setTotpIdentifier($totpIdentifier); } if ($issuer !== null) { $widgetRegisterSession->setIssuer($issuer); } return $widgetRegisterSession; }
[ "public", "function", "createWidgetRegisterSession", "(", "array", "$", "allowedTypes", "=", "null", ",", "$", "recipient", "=", "null", ",", "$", "backupCodeIdentifier", "=", "null", ",", "$", "totpIdentifier", "=", "null", ",", "$", "issuer", "=", "null", ")", "{", "$", "widgetRegisterSession", "=", "$", "this", "->", "createEmptyWidgetRegisterSession", "(", ")", ";", "if", "(", "$", "allowedTypes", "!==", "null", ")", "{", "$", "widgetRegisterSession", "->", "setAllowedTypes", "(", "$", "allowedTypes", ")", ";", "}", "if", "(", "$", "recipient", "!==", "null", ")", "{", "$", "widgetRegisterSession", "->", "setRecipient", "(", "$", "recipient", ")", ";", "}", "if", "(", "$", "backupCodeIdentifier", "!==", "null", ")", "{", "$", "widgetRegisterSession", "->", "setBackupCodeIdentifier", "(", "$", "backupCodeIdentifier", ")", ";", "}", "if", "(", "$", "totpIdentifier", "!==", "null", ")", "{", "$", "widgetRegisterSession", "->", "setTotpIdentifier", "(", "$", "totpIdentifier", ")", ";", "}", "if", "(", "$", "issuer", "!==", "null", ")", "{", "$", "widgetRegisterSession", "->", "setIssuer", "(", "$", "issuer", ")", ";", "}", "return", "$", "widgetRegisterSession", ";", "}" ]
Create widget register session object @param array|null $allowedTypes @param string|null $recipient @param string|null $backupCodeIdentifier @param string|null $totpIdentifier @param string|null $issuer @return WidgetRegisterSession
[ "Create", "widget", "register", "session", "object" ]
2e545d859784184138332c9b5bfc063940e3c926
https://github.com/twizoapi/lib-api-php/blob/2e545d859784184138332c9b5bfc063940e3c926/src/Entity/Factory.php#L349-L373
221,507
paquettg/leaguewrap
src/LeagueWrap/Dto/ShardList.php
ShardList.getShardByRegion
public function getShardByRegion($region) { foreach($this->info as $shard) { if($shard->slug == $region) return $shard; } return null; }
php
public function getShardByRegion($region) { foreach($this->info as $shard) { if($shard->slug == $region) return $shard; } return null; }
[ "public", "function", "getShardByRegion", "(", "$", "region", ")", "{", "foreach", "(", "$", "this", "->", "info", "as", "$", "shard", ")", "{", "if", "(", "$", "shard", "->", "slug", "==", "$", "region", ")", "return", "$", "shard", ";", "}", "return", "null", ";", "}" ]
Get a shard by its region. @param String $region @return Shard|null
[ "Get", "a", "shard", "by", "its", "region", "." ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Dto/ShardList.php#L29-L36
221,508
neos/fluid
Classes/TYPO3/Fluid/View/AbstractTemplateView.php
AbstractTemplateView.setRenderingContext
public function setRenderingContext(RenderingContextInterface $renderingContext) { $this->baseRenderingContext = $renderingContext; $this->baseRenderingContext->getViewHelperVariableContainer()->setView($this); $this->controllerContext = $renderingContext->getControllerContext(); }
php
public function setRenderingContext(RenderingContextInterface $renderingContext) { $this->baseRenderingContext = $renderingContext; $this->baseRenderingContext->getViewHelperVariableContainer()->setView($this); $this->controllerContext = $renderingContext->getControllerContext(); }
[ "public", "function", "setRenderingContext", "(", "RenderingContextInterface", "$", "renderingContext", ")", "{", "$", "this", "->", "baseRenderingContext", "=", "$", "renderingContext", ";", "$", "this", "->", "baseRenderingContext", "->", "getViewHelperVariableContainer", "(", ")", "->", "setView", "(", "$", "this", ")", ";", "$", "this", "->", "controllerContext", "=", "$", "renderingContext", "->", "getControllerContext", "(", ")", ";", "}" ]
Injects a fresh rendering context @param RenderingContextInterface $renderingContext @return void
[ "Injects", "a", "fresh", "rendering", "context" ]
ded6be84a9487f7e0e204703a30b12d2c58c0efd
https://github.com/neos/fluid/blob/ded6be84a9487f7e0e204703a30b12d2c58c0efd/Classes/TYPO3/Fluid/View/AbstractTemplateView.php#L126-L131
221,509
neos/fluid
Classes/TYPO3/Fluid/View/AbstractTemplateView.php
AbstractTemplateView.assign
public function assign($key, $value) { $templateVariableContainer = $this->baseRenderingContext->getTemplateVariableContainer(); if ($templateVariableContainer->exists($key)) { $templateVariableContainer->remove($key); } $templateVariableContainer->add($key, $value); return $this; }
php
public function assign($key, $value) { $templateVariableContainer = $this->baseRenderingContext->getTemplateVariableContainer(); if ($templateVariableContainer->exists($key)) { $templateVariableContainer->remove($key); } $templateVariableContainer->add($key, $value); return $this; }
[ "public", "function", "assign", "(", "$", "key", ",", "$", "value", ")", "{", "$", "templateVariableContainer", "=", "$", "this", "->", "baseRenderingContext", "->", "getTemplateVariableContainer", "(", ")", ";", "if", "(", "$", "templateVariableContainer", "->", "exists", "(", "$", "key", ")", ")", "{", "$", "templateVariableContainer", "->", "remove", "(", "$", "key", ")", ";", "}", "$", "templateVariableContainer", "->", "add", "(", "$", "key", ",", "$", "value", ")", ";", "return", "$", "this", ";", "}" ]
Assign a value to the variable container. @param string $key The key of a view variable to set @param mixed $value The value of the view variable @return \TYPO3\Fluid\View\AbstractTemplateView the instance of this view to allow chaining @api
[ "Assign", "a", "value", "to", "the", "variable", "container", "." ]
ded6be84a9487f7e0e204703a30b12d2c58c0efd
https://github.com/neos/fluid/blob/ded6be84a9487f7e0e204703a30b12d2c58c0efd/Classes/TYPO3/Fluid/View/AbstractTemplateView.php#L156-L164
221,510
neos/fluid
Classes/TYPO3/Fluid/View/AbstractTemplateView.php
AbstractTemplateView.assignMultiple
public function assignMultiple(array $values) { $templateVariableContainer = $this->baseRenderingContext->getTemplateVariableContainer(); foreach ($values as $key => $value) { if ($templateVariableContainer->exists($key)) { $templateVariableContainer->remove($key); } $templateVariableContainer->add($key, $value); } return $this; }
php
public function assignMultiple(array $values) { $templateVariableContainer = $this->baseRenderingContext->getTemplateVariableContainer(); foreach ($values as $key => $value) { if ($templateVariableContainer->exists($key)) { $templateVariableContainer->remove($key); } $templateVariableContainer->add($key, $value); } return $this; }
[ "public", "function", "assignMultiple", "(", "array", "$", "values", ")", "{", "$", "templateVariableContainer", "=", "$", "this", "->", "baseRenderingContext", "->", "getTemplateVariableContainer", "(", ")", ";", "foreach", "(", "$", "values", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "$", "templateVariableContainer", "->", "exists", "(", "$", "key", ")", ")", "{", "$", "templateVariableContainer", "->", "remove", "(", "$", "key", ")", ";", "}", "$", "templateVariableContainer", "->", "add", "(", "$", "key", ",", "$", "value", ")", ";", "}", "return", "$", "this", ";", "}" ]
Assigns multiple values to the JSON output. However, only the key "value" is accepted. @param array $values Keys and values - only a value with key "value" is considered @return \TYPO3\Fluid\View\AbstractTemplateView the instance of this view to allow chaining @api
[ "Assigns", "multiple", "values", "to", "the", "JSON", "output", ".", "However", "only", "the", "key", "value", "is", "accepted", "." ]
ded6be84a9487f7e0e204703a30b12d2c58c0efd
https://github.com/neos/fluid/blob/ded6be84a9487f7e0e204703a30b12d2c58c0efd/Classes/TYPO3/Fluid/View/AbstractTemplateView.php#L174-L184
221,511
neos/fluid
Classes/TYPO3/Fluid/View/AbstractTemplateView.php
AbstractTemplateView.render
public function render($actionName = null) { $this->baseRenderingContext->setControllerContext($this->controllerContext); $this->templateParser->setConfiguration($this->buildParserConfiguration()); $templateIdentifier = $this->getTemplateIdentifier($actionName); if ($this->templateCompiler->has($templateIdentifier)) { $parsedTemplate = $this->templateCompiler->get($templateIdentifier); } else { $parsedTemplate = $this->templateParser->parse($this->getTemplateSource($actionName)); if ($parsedTemplate->isCompilable()) { $this->templateCompiler->store($templateIdentifier, $parsedTemplate); } } if ($parsedTemplate->hasLayout()) { $layoutName = $parsedTemplate->getLayoutName($this->baseRenderingContext); $layoutIdentifier = $this->getLayoutIdentifier($layoutName); if ($this->templateCompiler->has($layoutIdentifier)) { $parsedLayout = $this->templateCompiler->get($layoutIdentifier); } else { $parsedLayout = $this->templateParser->parse($this->getLayoutSource($layoutName)); if ($parsedLayout->isCompilable()) { $this->templateCompiler->store($layoutIdentifier, $parsedLayout); } } $this->startRendering(self::RENDERING_LAYOUT, $parsedTemplate, $this->baseRenderingContext); $output = $parsedLayout->render($this->baseRenderingContext); $this->stopRendering(); } else { $this->startRendering(self::RENDERING_TEMPLATE, $parsedTemplate, $this->baseRenderingContext); $output = $parsedTemplate->render($this->baseRenderingContext); $this->stopRendering(); } return $output; }
php
public function render($actionName = null) { $this->baseRenderingContext->setControllerContext($this->controllerContext); $this->templateParser->setConfiguration($this->buildParserConfiguration()); $templateIdentifier = $this->getTemplateIdentifier($actionName); if ($this->templateCompiler->has($templateIdentifier)) { $parsedTemplate = $this->templateCompiler->get($templateIdentifier); } else { $parsedTemplate = $this->templateParser->parse($this->getTemplateSource($actionName)); if ($parsedTemplate->isCompilable()) { $this->templateCompiler->store($templateIdentifier, $parsedTemplate); } } if ($parsedTemplate->hasLayout()) { $layoutName = $parsedTemplate->getLayoutName($this->baseRenderingContext); $layoutIdentifier = $this->getLayoutIdentifier($layoutName); if ($this->templateCompiler->has($layoutIdentifier)) { $parsedLayout = $this->templateCompiler->get($layoutIdentifier); } else { $parsedLayout = $this->templateParser->parse($this->getLayoutSource($layoutName)); if ($parsedLayout->isCompilable()) { $this->templateCompiler->store($layoutIdentifier, $parsedLayout); } } $this->startRendering(self::RENDERING_LAYOUT, $parsedTemplate, $this->baseRenderingContext); $output = $parsedLayout->render($this->baseRenderingContext); $this->stopRendering(); } else { $this->startRendering(self::RENDERING_TEMPLATE, $parsedTemplate, $this->baseRenderingContext); $output = $parsedTemplate->render($this->baseRenderingContext); $this->stopRendering(); } return $output; }
[ "public", "function", "render", "(", "$", "actionName", "=", "null", ")", "{", "$", "this", "->", "baseRenderingContext", "->", "setControllerContext", "(", "$", "this", "->", "controllerContext", ")", ";", "$", "this", "->", "templateParser", "->", "setConfiguration", "(", "$", "this", "->", "buildParserConfiguration", "(", ")", ")", ";", "$", "templateIdentifier", "=", "$", "this", "->", "getTemplateIdentifier", "(", "$", "actionName", ")", ";", "if", "(", "$", "this", "->", "templateCompiler", "->", "has", "(", "$", "templateIdentifier", ")", ")", "{", "$", "parsedTemplate", "=", "$", "this", "->", "templateCompiler", "->", "get", "(", "$", "templateIdentifier", ")", ";", "}", "else", "{", "$", "parsedTemplate", "=", "$", "this", "->", "templateParser", "->", "parse", "(", "$", "this", "->", "getTemplateSource", "(", "$", "actionName", ")", ")", ";", "if", "(", "$", "parsedTemplate", "->", "isCompilable", "(", ")", ")", "{", "$", "this", "->", "templateCompiler", "->", "store", "(", "$", "templateIdentifier", ",", "$", "parsedTemplate", ")", ";", "}", "}", "if", "(", "$", "parsedTemplate", "->", "hasLayout", "(", ")", ")", "{", "$", "layoutName", "=", "$", "parsedTemplate", "->", "getLayoutName", "(", "$", "this", "->", "baseRenderingContext", ")", ";", "$", "layoutIdentifier", "=", "$", "this", "->", "getLayoutIdentifier", "(", "$", "layoutName", ")", ";", "if", "(", "$", "this", "->", "templateCompiler", "->", "has", "(", "$", "layoutIdentifier", ")", ")", "{", "$", "parsedLayout", "=", "$", "this", "->", "templateCompiler", "->", "get", "(", "$", "layoutIdentifier", ")", ";", "}", "else", "{", "$", "parsedLayout", "=", "$", "this", "->", "templateParser", "->", "parse", "(", "$", "this", "->", "getLayoutSource", "(", "$", "layoutName", ")", ")", ";", "if", "(", "$", "parsedLayout", "->", "isCompilable", "(", ")", ")", "{", "$", "this", "->", "templateCompiler", "->", "store", "(", "$", "layoutIdentifier", ",", "$", "parsedLayout", ")", ";", "}", "}", "$", "this", "->", "startRendering", "(", "self", "::", "RENDERING_LAYOUT", ",", "$", "parsedTemplate", ",", "$", "this", "->", "baseRenderingContext", ")", ";", "$", "output", "=", "$", "parsedLayout", "->", "render", "(", "$", "this", "->", "baseRenderingContext", ")", ";", "$", "this", "->", "stopRendering", "(", ")", ";", "}", "else", "{", "$", "this", "->", "startRendering", "(", "self", "::", "RENDERING_TEMPLATE", ",", "$", "parsedTemplate", ",", "$", "this", "->", "baseRenderingContext", ")", ";", "$", "output", "=", "$", "parsedTemplate", "->", "render", "(", "$", "this", "->", "baseRenderingContext", ")", ";", "$", "this", "->", "stopRendering", "(", ")", ";", "}", "return", "$", "output", ";", "}" ]
Loads the template source and render the template. If "layoutName" is set in a PostParseFacet callback, it will render the file with the given layout. @param string $actionName If set, the view of the specified action will be rendered instead. Default is the action specified in the Request object @return string Rendered Template @api
[ "Loads", "the", "template", "source", "and", "render", "the", "template", ".", "If", "layoutName", "is", "set", "in", "a", "PostParseFacet", "callback", "it", "will", "render", "the", "file", "with", "the", "given", "layout", "." ]
ded6be84a9487f7e0e204703a30b12d2c58c0efd
https://github.com/neos/fluid/blob/ded6be84a9487f7e0e204703a30b12d2c58c0efd/Classes/TYPO3/Fluid/View/AbstractTemplateView.php#L194-L230
221,512
neos/fluid
Classes/TYPO3/Fluid/View/AbstractTemplateView.php
AbstractTemplateView.renderStandaloneSection
protected function renderStandaloneSection($sectionName, array $variables = null, $ignoreUnknown = false) { $templateIdentifier = $this->getTemplateIdentifier(); if ($this->templateCompiler->has($templateIdentifier)) { $parsedTemplate = $this->templateCompiler->get($templateIdentifier); } else { $this->templateParser->setConfiguration($this->buildParserConfiguration()); $parsedTemplate = $this->templateParser->parse($this->getTemplateSource()); if ($parsedTemplate->isCompilable()) { $this->templateCompiler->store($templateIdentifier, $parsedTemplate); } } $this->baseRenderingContext->setControllerContext($this->controllerContext); $this->startRendering(self::RENDERING_LAYOUT, $parsedTemplate, $this->baseRenderingContext); $output = $this->renderSection($sectionName, $variables, $ignoreUnknown); $this->stopRendering(); return $output; }
php
protected function renderStandaloneSection($sectionName, array $variables = null, $ignoreUnknown = false) { $templateIdentifier = $this->getTemplateIdentifier(); if ($this->templateCompiler->has($templateIdentifier)) { $parsedTemplate = $this->templateCompiler->get($templateIdentifier); } else { $this->templateParser->setConfiguration($this->buildParserConfiguration()); $parsedTemplate = $this->templateParser->parse($this->getTemplateSource()); if ($parsedTemplate->isCompilable()) { $this->templateCompiler->store($templateIdentifier, $parsedTemplate); } } $this->baseRenderingContext->setControllerContext($this->controllerContext); $this->startRendering(self::RENDERING_LAYOUT, $parsedTemplate, $this->baseRenderingContext); $output = $this->renderSection($sectionName, $variables, $ignoreUnknown); $this->stopRendering(); return $output; }
[ "protected", "function", "renderStandaloneSection", "(", "$", "sectionName", ",", "array", "$", "variables", "=", "null", ",", "$", "ignoreUnknown", "=", "false", ")", "{", "$", "templateIdentifier", "=", "$", "this", "->", "getTemplateIdentifier", "(", ")", ";", "if", "(", "$", "this", "->", "templateCompiler", "->", "has", "(", "$", "templateIdentifier", ")", ")", "{", "$", "parsedTemplate", "=", "$", "this", "->", "templateCompiler", "->", "get", "(", "$", "templateIdentifier", ")", ";", "}", "else", "{", "$", "this", "->", "templateParser", "->", "setConfiguration", "(", "$", "this", "->", "buildParserConfiguration", "(", ")", ")", ";", "$", "parsedTemplate", "=", "$", "this", "->", "templateParser", "->", "parse", "(", "$", "this", "->", "getTemplateSource", "(", ")", ")", ";", "if", "(", "$", "parsedTemplate", "->", "isCompilable", "(", ")", ")", "{", "$", "this", "->", "templateCompiler", "->", "store", "(", "$", "templateIdentifier", ",", "$", "parsedTemplate", ")", ";", "}", "}", "$", "this", "->", "baseRenderingContext", "->", "setControllerContext", "(", "$", "this", "->", "controllerContext", ")", ";", "$", "this", "->", "startRendering", "(", "self", "::", "RENDERING_LAYOUT", ",", "$", "parsedTemplate", ",", "$", "this", "->", "baseRenderingContext", ")", ";", "$", "output", "=", "$", "this", "->", "renderSection", "(", "$", "sectionName", ",", "$", "variables", ",", "$", "ignoreUnknown", ")", ";", "$", "this", "->", "stopRendering", "(", ")", ";", "return", "$", "output", ";", "}" ]
Renders a section on its own, i.e. without the a surrounding template. In this case, we just emulate that a surrounding (empty) layout exists, and trigger the normal rendering flow then. @param string $sectionName Name of section to render @param array $variables The variables to use @param boolean $ignoreUnknown Ignore an unknown section and just return an empty string @return string rendered template for the section
[ "Renders", "a", "section", "on", "its", "own", "i", ".", "e", ".", "without", "the", "a", "surrounding", "template", "." ]
ded6be84a9487f7e0e204703a30b12d2c58c0efd
https://github.com/neos/fluid/blob/ded6be84a9487f7e0e204703a30b12d2c58c0efd/Classes/TYPO3/Fluid/View/AbstractTemplateView.php#L304-L322
221,513
twizoapi/lib-api-php
src/Entity/Totp/Exception.php
Exception.isTotpException
public static function isTotpException(EntityException $e) { if (in_array($e->getStatusCode(), array(RestStatusCodesInterface::REST_CLIENT_ERROR_UNPROCESSABLE_ENTITY, RestStatusCodesInterface::REST_CLIENT_ERROR_LOCKED)) && in_array($e->getJsonErrorCode(), self::getVerificationJsonStatusCodes()) ) { return true; } else { return false; } }
php
public static function isTotpException(EntityException $e) { if (in_array($e->getStatusCode(), array(RestStatusCodesInterface::REST_CLIENT_ERROR_UNPROCESSABLE_ENTITY, RestStatusCodesInterface::REST_CLIENT_ERROR_LOCKED)) && in_array($e->getJsonErrorCode(), self::getVerificationJsonStatusCodes()) ) { return true; } else { return false; } }
[ "public", "static", "function", "isTotpException", "(", "EntityException", "$", "e", ")", "{", "if", "(", "in_array", "(", "$", "e", "->", "getStatusCode", "(", ")", ",", "array", "(", "RestStatusCodesInterface", "::", "REST_CLIENT_ERROR_UNPROCESSABLE_ENTITY", ",", "RestStatusCodesInterface", "::", "REST_CLIENT_ERROR_LOCKED", ")", ")", "&&", "in_array", "(", "$", "e", "->", "getJsonErrorCode", "(", ")", ",", "self", "::", "getVerificationJsonStatusCodes", "(", ")", ")", ")", "{", "return", "true", ";", "}", "else", "{", "return", "false", ";", "}", "}" ]
Test if the entity exception is the result of a verification exception @param EntityException $e @return bool
[ "Test", "if", "the", "entity", "exception", "is", "the", "result", "of", "a", "verification", "exception" ]
2e545d859784184138332c9b5bfc063940e3c926
https://github.com/twizoapi/lib-api-php/blob/2e545d859784184138332c9b5bfc063940e3c926/src/Entity/Totp/Exception.php#L84-L93
221,514
ThibaudDauce/mattermost-php
src/Message.php
Message.attachment
public function attachment(Closure $callback) { $this->attachments[] = $attachment = new Attachment; $callback($attachment); return $this; }
php
public function attachment(Closure $callback) { $this->attachments[] = $attachment = new Attachment; $callback($attachment); return $this; }
[ "public", "function", "attachment", "(", "Closure", "$", "callback", ")", "{", "$", "this", "->", "attachments", "[", "]", "=", "$", "attachment", "=", "new", "Attachment", ";", "$", "callback", "(", "$", "attachment", ")", ";", "return", "$", "this", ";", "}" ]
Add an attachment for the message. @param \Closure $callback @return $this
[ "Add", "an", "attachment", "for", "the", "message", "." ]
7542208205ba160589f54cd8636cbba6fee29a37
https://github.com/ThibaudDauce/mattermost-php/blob/7542208205ba160589f54cd8636cbba6fee29a37/src/Message.php#L108-L115
221,515
twizoapi/lib-api-php
src/Entity/BackupCode/Exception.php
Exception.isBackupCodeException
public static function isBackupCodeException(EntityException $e) { if (in_array($e->getStatusCode(), array(RestStatusCodesInterface::REST_CLIENT_ERROR_CONFLICT, RestStatusCodesInterface::REST_CLIENT_ERROR_UNPROCESSABLE_ENTITY, RestStatusCodesInterface::REST_CLIENT_ERROR_LOCKED)) && in_array($e->getJsonErrorCode(), self::getBackupCodeJsonStatusCodes()) ) { return true; } else { return false; } }
php
public static function isBackupCodeException(EntityException $e) { if (in_array($e->getStatusCode(), array(RestStatusCodesInterface::REST_CLIENT_ERROR_CONFLICT, RestStatusCodesInterface::REST_CLIENT_ERROR_UNPROCESSABLE_ENTITY, RestStatusCodesInterface::REST_CLIENT_ERROR_LOCKED)) && in_array($e->getJsonErrorCode(), self::getBackupCodeJsonStatusCodes()) ) { return true; } else { return false; } }
[ "public", "static", "function", "isBackupCodeException", "(", "EntityException", "$", "e", ")", "{", "if", "(", "in_array", "(", "$", "e", "->", "getStatusCode", "(", ")", ",", "array", "(", "RestStatusCodesInterface", "::", "REST_CLIENT_ERROR_CONFLICT", ",", "RestStatusCodesInterface", "::", "REST_CLIENT_ERROR_UNPROCESSABLE_ENTITY", ",", "RestStatusCodesInterface", "::", "REST_CLIENT_ERROR_LOCKED", ")", ")", "&&", "in_array", "(", "$", "e", "->", "getJsonErrorCode", "(", ")", ",", "self", "::", "getBackupCodeJsonStatusCodes", "(", ")", ")", ")", "{", "return", "true", ";", "}", "else", "{", "return", "false", ";", "}", "}" ]
Test if the entity exception is the result of a backup code exception @param EntityException $e @return bool
[ "Test", "if", "the", "entity", "exception", "is", "the", "result", "of", "a", "backup", "code", "exception" ]
2e545d859784184138332c9b5bfc063940e3c926
https://github.com/twizoapi/lib-api-php/blob/2e545d859784184138332c9b5bfc063940e3c926/src/Entity/BackupCode/Exception.php#L76-L85
221,516
radphp/radphp
src/Network/Session.php
Session.get
public function get($key, $defaultValue = null) { if (isset($this->session[$key]) && !empty($this->session[$key])) { return $this->session[$key]; } return $defaultValue; }
php
public function get($key, $defaultValue = null) { if (isset($this->session[$key]) && !empty($this->session[$key])) { return $this->session[$key]; } return $defaultValue; }
[ "public", "function", "get", "(", "$", "key", ",", "$", "defaultValue", "=", "null", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "session", "[", "$", "key", "]", ")", "&&", "!", "empty", "(", "$", "this", "->", "session", "[", "$", "key", "]", ")", ")", "{", "return", "$", "this", "->", "session", "[", "$", "key", "]", ";", "}", "return", "$", "defaultValue", ";", "}" ]
Gets a session variable @param string $key @param mixed $defaultValue @return mixed
[ "Gets", "a", "session", "variable" ]
2cbde2c12dd7204b1aba3f8a6e351b287ae85f0a
https://github.com/radphp/radphp/blob/2cbde2c12dd7204b1aba3f8a6e351b287ae85f0a/src/Network/Session.php#L67-L74
221,517
radphp/radphp
src/Core/DotEnv.php
DotEnv.load
public static function load($path) { if (is_dir($path)) { foreach (preg_grep('/^\.env$/', scandir($path)) as $filename) { $filePath = rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $filename; if (is_readable($filePath)) { foreach (parse_ini_file($filePath) as $envKey => $envValue) { putenv($envKey . '=' . $envValue); } } } } else { throw new BaseException('Your path does not directory.'); } }
php
public static function load($path) { if (is_dir($path)) { foreach (preg_grep('/^\.env$/', scandir($path)) as $filename) { $filePath = rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $filename; if (is_readable($filePath)) { foreach (parse_ini_file($filePath) as $envKey => $envValue) { putenv($envKey . '=' . $envValue); } } } } else { throw new BaseException('Your path does not directory.'); } }
[ "public", "static", "function", "load", "(", "$", "path", ")", "{", "if", "(", "is_dir", "(", "$", "path", ")", ")", "{", "foreach", "(", "preg_grep", "(", "'/^\\.env$/'", ",", "scandir", "(", "$", "path", ")", ")", "as", "$", "filename", ")", "{", "$", "filePath", "=", "rtrim", "(", "$", "path", ",", "DIRECTORY_SEPARATOR", ")", ".", "DIRECTORY_SEPARATOR", ".", "$", "filename", ";", "if", "(", "is_readable", "(", "$", "filePath", ")", ")", "{", "foreach", "(", "parse_ini_file", "(", "$", "filePath", ")", "as", "$", "envKey", "=>", "$", "envValue", ")", "{", "putenv", "(", "$", "envKey", ".", "'='", ".", "$", "envValue", ")", ";", "}", "}", "}", "}", "else", "{", "throw", "new", "BaseException", "(", "'Your path does not directory.'", ")", ";", "}", "}" ]
Load .env file @param string $path Directory path @throws BaseException
[ "Load", ".", "env", "file" ]
2cbde2c12dd7204b1aba3f8a6e351b287ae85f0a
https://github.com/radphp/radphp/blob/2cbde2c12dd7204b1aba3f8a6e351b287ae85f0a/src/Core/DotEnv.php#L21-L35
221,518
neos/fluid
Classes/TYPO3/Fluid/ViewHelpers/Uri/ResourceViewHelper.php
ResourceViewHelper.render
public function render($path = null, $package = null, Resource $resource = null, $localize = true) { if ($resource !== null) { $uri = $this->resourceManager->getPublicPersistentResourceUri($resource); if ($uri === false) { $uri = '404-Resource-Not-Found'; } } else { if ($path === null) { throw new InvalidVariableException('The ResourceViewHelper did neither contain a valuable "resource" nor "path" argument.', 1353512742); } if ($package === null) { $package = $this->controllerContext->getRequest()->getControllerPackageKey(); } if (strpos($path, 'resource://') === 0) { try { list($package, $path) = $this->resourceManager->getPackageAndPathByPublicPath($path); } catch (Exception $exception) { throw new InvalidVariableException(sprintf('The specified path "%s" does not point to a public resource.', $path), 1386458851); } } if ($localize === true) { $resourcePath = 'resource://' . $package . '/Public/' . $path; $localizedResourcePathData = $this->i18nService->getLocalizedFilename($resourcePath); $matches = array(); if (preg_match('#resource://([^/]+)/Public/(.*)#', current($localizedResourcePathData), $matches) === 1) { $package = $matches[1]; $path = $matches[2]; } } $uri = $this->resourceManager->getPublicPackageResourceUri($package, $path); } return $uri; }
php
public function render($path = null, $package = null, Resource $resource = null, $localize = true) { if ($resource !== null) { $uri = $this->resourceManager->getPublicPersistentResourceUri($resource); if ($uri === false) { $uri = '404-Resource-Not-Found'; } } else { if ($path === null) { throw new InvalidVariableException('The ResourceViewHelper did neither contain a valuable "resource" nor "path" argument.', 1353512742); } if ($package === null) { $package = $this->controllerContext->getRequest()->getControllerPackageKey(); } if (strpos($path, 'resource://') === 0) { try { list($package, $path) = $this->resourceManager->getPackageAndPathByPublicPath($path); } catch (Exception $exception) { throw new InvalidVariableException(sprintf('The specified path "%s" does not point to a public resource.', $path), 1386458851); } } if ($localize === true) { $resourcePath = 'resource://' . $package . '/Public/' . $path; $localizedResourcePathData = $this->i18nService->getLocalizedFilename($resourcePath); $matches = array(); if (preg_match('#resource://([^/]+)/Public/(.*)#', current($localizedResourcePathData), $matches) === 1) { $package = $matches[1]; $path = $matches[2]; } } $uri = $this->resourceManager->getPublicPackageResourceUri($package, $path); } return $uri; }
[ "public", "function", "render", "(", "$", "path", "=", "null", ",", "$", "package", "=", "null", ",", "Resource", "$", "resource", "=", "null", ",", "$", "localize", "=", "true", ")", "{", "if", "(", "$", "resource", "!==", "null", ")", "{", "$", "uri", "=", "$", "this", "->", "resourceManager", "->", "getPublicPersistentResourceUri", "(", "$", "resource", ")", ";", "if", "(", "$", "uri", "===", "false", ")", "{", "$", "uri", "=", "'404-Resource-Not-Found'", ";", "}", "}", "else", "{", "if", "(", "$", "path", "===", "null", ")", "{", "throw", "new", "InvalidVariableException", "(", "'The ResourceViewHelper did neither contain a valuable \"resource\" nor \"path\" argument.'", ",", "1353512742", ")", ";", "}", "if", "(", "$", "package", "===", "null", ")", "{", "$", "package", "=", "$", "this", "->", "controllerContext", "->", "getRequest", "(", ")", "->", "getControllerPackageKey", "(", ")", ";", "}", "if", "(", "strpos", "(", "$", "path", ",", "'resource://'", ")", "===", "0", ")", "{", "try", "{", "list", "(", "$", "package", ",", "$", "path", ")", "=", "$", "this", "->", "resourceManager", "->", "getPackageAndPathByPublicPath", "(", "$", "path", ")", ";", "}", "catch", "(", "Exception", "$", "exception", ")", "{", "throw", "new", "InvalidVariableException", "(", "sprintf", "(", "'The specified path \"%s\" does not point to a public resource.'", ",", "$", "path", ")", ",", "1386458851", ")", ";", "}", "}", "if", "(", "$", "localize", "===", "true", ")", "{", "$", "resourcePath", "=", "'resource://'", ".", "$", "package", ".", "'/Public/'", ".", "$", "path", ";", "$", "localizedResourcePathData", "=", "$", "this", "->", "i18nService", "->", "getLocalizedFilename", "(", "$", "resourcePath", ")", ";", "$", "matches", "=", "array", "(", ")", ";", "if", "(", "preg_match", "(", "'#resource://([^/]+)/Public/(.*)#'", ",", "current", "(", "$", "localizedResourcePathData", ")", ",", "$", "matches", ")", "===", "1", ")", "{", "$", "package", "=", "$", "matches", "[", "1", "]", ";", "$", "path", "=", "$", "matches", "[", "2", "]", ";", "}", "}", "$", "uri", "=", "$", "this", "->", "resourceManager", "->", "getPublicPackageResourceUri", "(", "$", "package", ",", "$", "path", ")", ";", "}", "return", "$", "uri", ";", "}" ]
Render the URI to the resource. The filename is used from child content. @param string $path The location of the resource, can be either a path relative to the Public resource directory of the package or a resource://... URI @param string $package Target package key. If not set, the current package key will be used @param Resource $resource If specified, this resource object is used instead of the path and package information @param boolean $localize Whether resource localization should be attempted or not @return string The absolute URI to the resource @throws InvalidVariableException @api
[ "Render", "the", "URI", "to", "the", "resource", ".", "The", "filename", "is", "used", "from", "child", "content", "." ]
ded6be84a9487f7e0e204703a30b12d2c58c0efd
https://github.com/neos/fluid/blob/ded6be84a9487f7e0e204703a30b12d2c58c0efd/Classes/TYPO3/Fluid/ViewHelpers/Uri/ResourceViewHelper.php#L86-L119
221,519
paquettg/leaguewrap
src/LeagueWrap/Api/Staticdata.php
Staticdata.makeRequest
protected function makeRequest($path, $requestId, array $params) { if ($this->appendId($requestId)) { $path .= "/$requestId"; } return $this->request($path, $params, true); }
php
protected function makeRequest($path, $requestId, array $params) { if ($this->appendId($requestId)) { $path .= "/$requestId"; } return $this->request($path, $params, true); }
[ "protected", "function", "makeRequest", "(", "$", "path", ",", "$", "requestId", ",", "array", "$", "params", ")", "{", "if", "(", "$", "this", "->", "appendId", "(", "$", "requestId", ")", ")", "{", "$", "path", ".=", "\"/$requestId\"", ";", "}", "return", "$", "this", "->", "request", "(", "$", "path", ",", "$", "params", ",", "true", ")", ";", "}" ]
Make the request given the proper information. @param string $path @param mixed $requestId @param array $params @return array
[ "Make", "the", "request", "given", "the", "proper", "information", "." ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Api/Staticdata.php#L315-L323
221,520
paquettg/leaguewrap
src/LeagueWrap/Api/Staticdata.php
Staticdata.setUpParams
protected function setUpParams($name = '', $requestId = null, $data = null, $listData = '', $itemData = '') { $params = []; if ( ! is_null($this->locale)) { $params['locale'] = $this->locale; } if ( ! is_null($this->DDversion)) { $params['version'] = $this->DDversion; } if ( ! $this->appendId($requestId) && $this->dataById($name)) { $params['dataById'] = 'true'; } if ( ! is_null($data)) { if ($this->appendId($requestId)) { if (is_array($data) && ! empty($data)) { $data = implode(",", $data); } $params[$itemData] = $data; } else { if (is_array($data) && ! empty($data)) { $data = implode(",", $data); } $params[$listData] = $data; } } return $params; }
php
protected function setUpParams($name = '', $requestId = null, $data = null, $listData = '', $itemData = '') { $params = []; if ( ! is_null($this->locale)) { $params['locale'] = $this->locale; } if ( ! is_null($this->DDversion)) { $params['version'] = $this->DDversion; } if ( ! $this->appendId($requestId) && $this->dataById($name)) { $params['dataById'] = 'true'; } if ( ! is_null($data)) { if ($this->appendId($requestId)) { if (is_array($data) && ! empty($data)) { $data = implode(",", $data); } $params[$itemData] = $data; } else { if (is_array($data) && ! empty($data)) { $data = implode(",", $data); } $params[$listData] = $data; } } return $params; }
[ "protected", "function", "setUpParams", "(", "$", "name", "=", "''", ",", "$", "requestId", "=", "null", ",", "$", "data", "=", "null", ",", "$", "listData", "=", "''", ",", "$", "itemData", "=", "''", ")", "{", "$", "params", "=", "[", "]", ";", "if", "(", "!", "is_null", "(", "$", "this", "->", "locale", ")", ")", "{", "$", "params", "[", "'locale'", "]", "=", "$", "this", "->", "locale", ";", "}", "if", "(", "!", "is_null", "(", "$", "this", "->", "DDversion", ")", ")", "{", "$", "params", "[", "'version'", "]", "=", "$", "this", "->", "DDversion", ";", "}", "if", "(", "!", "$", "this", "->", "appendId", "(", "$", "requestId", ")", "&&", "$", "this", "->", "dataById", "(", "$", "name", ")", ")", "{", "$", "params", "[", "'dataById'", "]", "=", "'true'", ";", "}", "if", "(", "!", "is_null", "(", "$", "data", ")", ")", "{", "if", "(", "$", "this", "->", "appendId", "(", "$", "requestId", ")", ")", "{", "if", "(", "is_array", "(", "$", "data", ")", "&&", "!", "empty", "(", "$", "data", ")", ")", "{", "$", "data", "=", "implode", "(", "\",\"", ",", "$", "data", ")", ";", "}", "$", "params", "[", "$", "itemData", "]", "=", "$", "data", ";", "}", "else", "{", "if", "(", "is_array", "(", "$", "data", ")", "&&", "!", "empty", "(", "$", "data", ")", ")", "{", "$", "data", "=", "implode", "(", "\",\"", ",", "$", "data", ")", ";", "}", "$", "params", "[", "$", "listData", "]", "=", "$", "data", ";", "}", "}", "return", "$", "params", ";", "}" ]
Set up the boiler plate for the param array for any static data call. @param string $name of api call @param mixed $requestId @param mixed $data @param string $listData @param string $itemData @return array
[ "Set", "up", "the", "boiler", "plate", "for", "the", "param", "array", "for", "any", "static", "data", "call", "." ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Api/Staticdata.php#L336-L374
221,521
paquettg/leaguewrap
src/LeagueWrap/Api/Featuredgames.php
Featuredgames.featuredGames
public function featuredGames() { $response = $this->request('featured', [], false, false); return $this->attachStaticDataToDto(new FeaturedGamesDto($response)); }
php
public function featuredGames() { $response = $this->request('featured', [], false, false); return $this->attachStaticDataToDto(new FeaturedGamesDto($response)); }
[ "public", "function", "featuredGames", "(", ")", "{", "$", "response", "=", "$", "this", "->", "request", "(", "'featured'", ",", "[", "]", ",", "false", ",", "false", ")", ";", "return", "$", "this", "->", "attachStaticDataToDto", "(", "new", "FeaturedGamesDto", "(", "$", "response", ")", ")", ";", "}" ]
Requests all featured games. @return \LeagueWrap\Dto\AbstractDto @throws \Exception @throws \LeagueWrap\Exception\CacheNotFoundException @throws \LeagueWrap\Exception\RegionException @throws \LeagueWrap\Response\HttpClientError @throws \LeagueWrap\Response\HttpServerError
[ "Requests", "all", "featured", "games", "." ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Api/Featuredgames.php#L61-L66
221,522
neos/fluid
Classes/TYPO3/Fluid/ViewHelpers/Form/AbstractFormFieldViewHelper.php
AbstractFormFieldViewHelper.renderHiddenFieldForEmptyValue
protected function renderHiddenFieldForEmptyValue() { $emptyHiddenFieldNames = array(); if ($this->viewHelperVariableContainer->exists(\TYPO3\Fluid\ViewHelpers\FormViewHelper::class, 'emptyHiddenFieldNames')) { $emptyHiddenFieldNames = $this->viewHelperVariableContainer->get(\TYPO3\Fluid\ViewHelpers\FormViewHelper::class, 'emptyHiddenFieldNames'); } $fieldName = $this->getName(); if (substr($fieldName, -2) === '[]') { $fieldName = substr($fieldName, 0, -2); } if (!isset($emptyHiddenFieldNames[$fieldName])) { $disabled = false; if ($this->tag->hasAttribute('disabled')) { $disabled = $this->tag->getAttribute('disabled'); } $emptyHiddenFieldNames[$fieldName] = $disabled; $this->viewHelperVariableContainer->addOrUpdate(\TYPO3\Fluid\ViewHelpers\FormViewHelper::class, 'emptyHiddenFieldNames', $emptyHiddenFieldNames); } }
php
protected function renderHiddenFieldForEmptyValue() { $emptyHiddenFieldNames = array(); if ($this->viewHelperVariableContainer->exists(\TYPO3\Fluid\ViewHelpers\FormViewHelper::class, 'emptyHiddenFieldNames')) { $emptyHiddenFieldNames = $this->viewHelperVariableContainer->get(\TYPO3\Fluid\ViewHelpers\FormViewHelper::class, 'emptyHiddenFieldNames'); } $fieldName = $this->getName(); if (substr($fieldName, -2) === '[]') { $fieldName = substr($fieldName, 0, -2); } if (!isset($emptyHiddenFieldNames[$fieldName])) { $disabled = false; if ($this->tag->hasAttribute('disabled')) { $disabled = $this->tag->getAttribute('disabled'); } $emptyHiddenFieldNames[$fieldName] = $disabled; $this->viewHelperVariableContainer->addOrUpdate(\TYPO3\Fluid\ViewHelpers\FormViewHelper::class, 'emptyHiddenFieldNames', $emptyHiddenFieldNames); } }
[ "protected", "function", "renderHiddenFieldForEmptyValue", "(", ")", "{", "$", "emptyHiddenFieldNames", "=", "array", "(", ")", ";", "if", "(", "$", "this", "->", "viewHelperVariableContainer", "->", "exists", "(", "\\", "TYPO3", "\\", "Fluid", "\\", "ViewHelpers", "\\", "FormViewHelper", "::", "class", ",", "'emptyHiddenFieldNames'", ")", ")", "{", "$", "emptyHiddenFieldNames", "=", "$", "this", "->", "viewHelperVariableContainer", "->", "get", "(", "\\", "TYPO3", "\\", "Fluid", "\\", "ViewHelpers", "\\", "FormViewHelper", "::", "class", ",", "'emptyHiddenFieldNames'", ")", ";", "}", "$", "fieldName", "=", "$", "this", "->", "getName", "(", ")", ";", "if", "(", "substr", "(", "$", "fieldName", ",", "-", "2", ")", "===", "'[]'", ")", "{", "$", "fieldName", "=", "substr", "(", "$", "fieldName", ",", "0", ",", "-", "2", ")", ";", "}", "if", "(", "!", "isset", "(", "$", "emptyHiddenFieldNames", "[", "$", "fieldName", "]", ")", ")", "{", "$", "disabled", "=", "false", ";", "if", "(", "$", "this", "->", "tag", "->", "hasAttribute", "(", "'disabled'", ")", ")", "{", "$", "disabled", "=", "$", "this", "->", "tag", "->", "getAttribute", "(", "'disabled'", ")", ";", "}", "$", "emptyHiddenFieldNames", "[", "$", "fieldName", "]", "=", "$", "disabled", ";", "$", "this", "->", "viewHelperVariableContainer", "->", "addOrUpdate", "(", "\\", "TYPO3", "\\", "Fluid", "\\", "ViewHelpers", "\\", "FormViewHelper", "::", "class", ",", "'emptyHiddenFieldNames'", ",", "$", "emptyHiddenFieldNames", ")", ";", "}", "}" ]
Renders a hidden field with the same name as the element, to make sure the empty value is submitted in case nothing is selected. This is needed for checkbox and multiple select fields @return void
[ "Renders", "a", "hidden", "field", "with", "the", "same", "name", "as", "the", "element", "to", "make", "sure", "the", "empty", "value", "is", "submitted", "in", "case", "nothing", "is", "selected", ".", "This", "is", "needed", "for", "checkbox", "and", "multiple", "select", "fields" ]
ded6be84a9487f7e0e204703a30b12d2c58c0efd
https://github.com/neos/fluid/blob/ded6be84a9487f7e0e204703a30b12d2c58c0efd/Classes/TYPO3/Fluid/ViewHelpers/Form/AbstractFormFieldViewHelper.php#L325-L344
221,523
CapMousse/React-Restify
src/Container/Container.php
Container.has
public function has($id) { if (!is_string($id)) { throw new ContainerException('$id must be a string'); } if (array_key_exists($id, $this->definitions)) { return true; } return false; }
php
public function has($id) { if (!is_string($id)) { throw new ContainerException('$id must be a string'); } if (array_key_exists($id, $this->definitions)) { return true; } return false; }
[ "public", "function", "has", "(", "$", "id", ")", "{", "if", "(", "!", "is_string", "(", "$", "id", ")", ")", "{", "throw", "new", "ContainerException", "(", "'$id must be a string'", ")", ";", "}", "if", "(", "array_key_exists", "(", "$", "id", ",", "$", "this", "->", "definitions", ")", ")", "{", "return", "true", ";", "}", "return", "false", ";", "}" ]
Check if item is available in container @param string $id @return boolean
[ "Check", "if", "item", "is", "available", "in", "container" ]
51fe94d6e4c7fafec06fb304f9e44badde4bfe71
https://github.com/CapMousse/React-Restify/blob/51fe94d6e4c7fafec06fb304f9e44badde4bfe71/src/Container/Container.php#L60-L71
221,524
CapMousse/React-Restify
src/Container/Container.php
Container.get
public function get($id) { if (!is_string($id)) { throw new ContainerException('$id must be a string'); } if (!isset($this->definitions[$id])) { throw new NotFoundException("Unresolvable ".$id); } return $this->definitions[$id]; }
php
public function get($id) { if (!is_string($id)) { throw new ContainerException('$id must be a string'); } if (!isset($this->definitions[$id])) { throw new NotFoundException("Unresolvable ".$id); } return $this->definitions[$id]; }
[ "public", "function", "get", "(", "$", "id", ")", "{", "if", "(", "!", "is_string", "(", "$", "id", ")", ")", "{", "throw", "new", "ContainerException", "(", "'$id must be a string'", ")", ";", "}", "if", "(", "!", "isset", "(", "$", "this", "->", "definitions", "[", "$", "id", "]", ")", ")", "{", "throw", "new", "NotFoundException", "(", "\"Unresolvable \"", ".", "$", "id", ")", ";", "}", "return", "$", "this", "->", "definitions", "[", "$", "id", "]", ";", "}" ]
Get an item of the container @param string $id @return mixed @throw NotFoundException
[ "Get", "an", "item", "of", "the", "container" ]
51fe94d6e4c7fafec06fb304f9e44badde4bfe71
https://github.com/CapMousse/React-Restify/blob/51fe94d6e4c7fafec06fb304f9e44badde4bfe71/src/Container/Container.php#L79-L90
221,525
CapMousse/React-Restify
src/Container/Container.php
Container.call
public function call ($action, array $args = []) { $method = $action; $class = null; if (is_string($action)) { list($class, $method) = explode('@', $action); } elseif (is_array($action)) { list($class, $method) = $action; if (!is_object($class)) { throw new ContainerException('$class must be an object'); } if (!is_string($method)) { throw new ContainerException('$action must be a string'); } } $reflection = $this->getActionReflection($method, $class); $args = $this->getParametersDictionary($args); $parameters = $this->getParameters($reflection, $args); if (is_callable($method)) { return $method(...$parameters); } if(!is_object($class)) { $class = $this->build($class); } return $class->{$method}(...$parameters); }
php
public function call ($action, array $args = []) { $method = $action; $class = null; if (is_string($action)) { list($class, $method) = explode('@', $action); } elseif (is_array($action)) { list($class, $method) = $action; if (!is_object($class)) { throw new ContainerException('$class must be an object'); } if (!is_string($method)) { throw new ContainerException('$action must be a string'); } } $reflection = $this->getActionReflection($method, $class); $args = $this->getParametersDictionary($args); $parameters = $this->getParameters($reflection, $args); if (is_callable($method)) { return $method(...$parameters); } if(!is_object($class)) { $class = $this->build($class); } return $class->{$method}(...$parameters); }
[ "public", "function", "call", "(", "$", "action", ",", "array", "$", "args", "=", "[", "]", ")", "{", "$", "method", "=", "$", "action", ";", "$", "class", "=", "null", ";", "if", "(", "is_string", "(", "$", "action", ")", ")", "{", "list", "(", "$", "class", ",", "$", "method", ")", "=", "explode", "(", "'@'", ",", "$", "action", ")", ";", "}", "elseif", "(", "is_array", "(", "$", "action", ")", ")", "{", "list", "(", "$", "class", ",", "$", "method", ")", "=", "$", "action", ";", "if", "(", "!", "is_object", "(", "$", "class", ")", ")", "{", "throw", "new", "ContainerException", "(", "'$class must be an object'", ")", ";", "}", "if", "(", "!", "is_string", "(", "$", "method", ")", ")", "{", "throw", "new", "ContainerException", "(", "'$action must be a string'", ")", ";", "}", "}", "$", "reflection", "=", "$", "this", "->", "getActionReflection", "(", "$", "method", ",", "$", "class", ")", ";", "$", "args", "=", "$", "this", "->", "getParametersDictionary", "(", "$", "args", ")", ";", "$", "parameters", "=", "$", "this", "->", "getParameters", "(", "$", "reflection", ",", "$", "args", ")", ";", "if", "(", "is_callable", "(", "$", "method", ")", ")", "{", "return", "$", "method", "(", "...", "$", "parameters", ")", ";", "}", "if", "(", "!", "is_object", "(", "$", "class", ")", ")", "{", "$", "class", "=", "$", "this", "->", "build", "(", "$", "class", ")", ";", "}", "return", "$", "class", "->", "{", "$", "method", "}", "(", "...", "$", "parameters", ")", ";", "}" ]
Call method with given parameters @param string|array|callable $action @param array $args @return mixed
[ "Call", "method", "with", "given", "parameters" ]
51fe94d6e4c7fafec06fb304f9e44badde4bfe71
https://github.com/CapMousse/React-Restify/blob/51fe94d6e4c7fafec06fb304f9e44badde4bfe71/src/Container/Container.php#L98-L131
221,526
CapMousse/React-Restify
src/Container/Container.php
Container.getParametersDictionary
public function getParametersDictionary(array $args = []) { $dictionary = []; foreach ($args as $parameter) { if (!is_object($parameter)) continue; $dictionary[get_class($parameter)] = $parameter; } return array_merge($args, $dictionary); }
php
public function getParametersDictionary(array $args = []) { $dictionary = []; foreach ($args as $parameter) { if (!is_object($parameter)) continue; $dictionary[get_class($parameter)] = $parameter; } return array_merge($args, $dictionary); }
[ "public", "function", "getParametersDictionary", "(", "array", "$", "args", "=", "[", "]", ")", "{", "$", "dictionary", "=", "[", "]", ";", "foreach", "(", "$", "args", "as", "$", "parameter", ")", "{", "if", "(", "!", "is_object", "(", "$", "parameter", ")", ")", "continue", ";", "$", "dictionary", "[", "get_class", "(", "$", "parameter", ")", "]", "=", "$", "parameter", ";", "}", "return", "array_merge", "(", "$", "args", ",", "$", "dictionary", ")", ";", "}" ]
Find object and set classname alias on argument list @param array $args @return array
[ "Find", "object", "and", "set", "classname", "alias", "on", "argument", "list" ]
51fe94d6e4c7fafec06fb304f9e44badde4bfe71
https://github.com/CapMousse/React-Restify/blob/51fe94d6e4c7fafec06fb304f9e44badde4bfe71/src/Container/Container.php#L153-L163
221,527
CapMousse/React-Restify
src/Container/Container.php
Container.getParameters
public function getParameters(\ReflectionFunctionAbstract $reflection, array $args = []) { $dependencies = $reflection->getParameters(); $parameters = []; foreach ($dependencies as $parameter) { $parameters[] = $this->getParameter($parameter, $args); } return $parameters; }
php
public function getParameters(\ReflectionFunctionAbstract $reflection, array $args = []) { $dependencies = $reflection->getParameters(); $parameters = []; foreach ($dependencies as $parameter) { $parameters[] = $this->getParameter($parameter, $args); } return $parameters; }
[ "public", "function", "getParameters", "(", "\\", "ReflectionFunctionAbstract", "$", "reflection", ",", "array", "$", "args", "=", "[", "]", ")", "{", "$", "dependencies", "=", "$", "reflection", "->", "getParameters", "(", ")", ";", "$", "parameters", "=", "[", "]", ";", "foreach", "(", "$", "dependencies", "as", "$", "parameter", ")", "{", "$", "parameters", "[", "]", "=", "$", "this", "->", "getParameter", "(", "$", "parameter", ",", "$", "args", ")", ";", "}", "return", "$", "parameters", ";", "}" ]
Get reflection parameters @param \ReflectionFunctionAbstract $reflection @param array $args @return array
[ "Get", "reflection", "parameters" ]
51fe94d6e4c7fafec06fb304f9e44badde4bfe71
https://github.com/CapMousse/React-Restify/blob/51fe94d6e4c7fafec06fb304f9e44badde4bfe71/src/Container/Container.php#L171-L181
221,528
CapMousse/React-Restify
src/Container/Container.php
Container.getParameter
public function getParameter(\ReflectionParameter $parameter, array $args = []) { $class = $parameter->getClass(); if ($class && $this->has($class->name)) { return $this->get($class->name); } if ($class && array_key_exists($class->name, $args)) { return $args[$class->name]; } if (array_key_exists($parameter->name, $args)) { return $args[$parameter->name]; } throw new NotFoundException("Unresolvable " . ($class ? $class->name : $parameter->name)); }
php
public function getParameter(\ReflectionParameter $parameter, array $args = []) { $class = $parameter->getClass(); if ($class && $this->has($class->name)) { return $this->get($class->name); } if ($class && array_key_exists($class->name, $args)) { return $args[$class->name]; } if (array_key_exists($parameter->name, $args)) { return $args[$parameter->name]; } throw new NotFoundException("Unresolvable " . ($class ? $class->name : $parameter->name)); }
[ "public", "function", "getParameter", "(", "\\", "ReflectionParameter", "$", "parameter", ",", "array", "$", "args", "=", "[", "]", ")", "{", "$", "class", "=", "$", "parameter", "->", "getClass", "(", ")", ";", "if", "(", "$", "class", "&&", "$", "this", "->", "has", "(", "$", "class", "->", "name", ")", ")", "{", "return", "$", "this", "->", "get", "(", "$", "class", "->", "name", ")", ";", "}", "if", "(", "$", "class", "&&", "array_key_exists", "(", "$", "class", "->", "name", ",", "$", "args", ")", ")", "{", "return", "$", "args", "[", "$", "class", "->", "name", "]", ";", "}", "if", "(", "array_key_exists", "(", "$", "parameter", "->", "name", ",", "$", "args", ")", ")", "{", "return", "$", "args", "[", "$", "parameter", "->", "name", "]", ";", "}", "throw", "new", "NotFoundException", "(", "\"Unresolvable \"", ".", "(", "$", "class", "?", "$", "class", "->", "name", ":", "$", "parameter", "->", "name", ")", ")", ";", "}" ]
Get paremeter value @param \ReflectionParameter $parameter @param array $args @return mixed
[ "Get", "paremeter", "value" ]
51fe94d6e4c7fafec06fb304f9e44badde4bfe71
https://github.com/CapMousse/React-Restify/blob/51fe94d6e4c7fafec06fb304f9e44badde4bfe71/src/Container/Container.php#L189-L206
221,529
CapMousse/React-Restify
src/Container/Container.php
Container.build
public function build ($class) { $reflection = new \ReflectionClass($class); $parameters = []; if (!is_null($reflection->getConstructor())) { $parameters = $this->getParameters($reflection->getConstructor()); } return new $class(...$parameters); }
php
public function build ($class) { $reflection = new \ReflectionClass($class); $parameters = []; if (!is_null($reflection->getConstructor())) { $parameters = $this->getParameters($reflection->getConstructor()); } return new $class(...$parameters); }
[ "public", "function", "build", "(", "$", "class", ")", "{", "$", "reflection", "=", "new", "\\", "ReflectionClass", "(", "$", "class", ")", ";", "$", "parameters", "=", "[", "]", ";", "if", "(", "!", "is_null", "(", "$", "reflection", "->", "getConstructor", "(", ")", ")", ")", "{", "$", "parameters", "=", "$", "this", "->", "getParameters", "(", "$", "reflection", "->", "getConstructor", "(", ")", ")", ";", "}", "return", "new", "$", "class", "(", "...", "$", "parameters", ")", ";", "}" ]
Create a new container for asked class @param string $class @return Container
[ "Create", "a", "new", "container", "for", "asked", "class" ]
51fe94d6e4c7fafec06fb304f9e44badde4bfe71
https://github.com/CapMousse/React-Restify/blob/51fe94d6e4c7fafec06fb304f9e44badde4bfe71/src/Container/Container.php#L213-L223
221,530
paquettg/leaguewrap
src/LeagueWrap/Dto/AbstractDto.php
AbstractDto.get
public function get($key) { if (isset($this->info[$key])) { return $this->info[$key]; } return null; }
php
public function get($key) { if (isset($this->info[$key])) { return $this->info[$key]; } return null; }
[ "public", "function", "get", "(", "$", "key", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "info", "[", "$", "key", "]", ")", ")", "{", "return", "$", "this", "->", "info", "[", "$", "key", "]", ";", "}", "return", "null", ";", "}" ]
Gets the attribute of this Dto. @param string $key @return string|null
[ "Gets", "the", "attribute", "of", "this", "Dto", "." ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Dto/AbstractDto.php#L61-L69
221,531
paquettg/leaguewrap
src/LeagueWrap/Dto/AbstractDto.php
AbstractDto.loadStaticData
public function loadStaticData(Staticdata $staticData) { $fields = $this->getStaticFields(); $optimizer = new StaticOptimizer; $optimizer->optimizeFields($fields) ->setStaticInfo($staticData); $this->addStaticData($optimizer); return $this; }
php
public function loadStaticData(Staticdata $staticData) { $fields = $this->getStaticFields(); $optimizer = new StaticOptimizer; $optimizer->optimizeFields($fields) ->setStaticInfo($staticData); $this->addStaticData($optimizer); return $this; }
[ "public", "function", "loadStaticData", "(", "Staticdata", "$", "staticData", ")", "{", "$", "fields", "=", "$", "this", "->", "getStaticFields", "(", ")", ";", "$", "optimizer", "=", "new", "StaticOptimizer", ";", "$", "optimizer", "->", "optimizeFields", "(", "$", "fields", ")", "->", "setStaticInfo", "(", "$", "staticData", ")", ";", "$", "this", "->", "addStaticData", "(", "$", "optimizer", ")", ";", "return", "$", "this", ";", "}" ]
Attempts to load all static data within the children DTO objects. @param Staticdata $staticData @return $this
[ "Attempts", "to", "load", "all", "static", "data", "within", "the", "children", "DTO", "objects", "." ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Dto/AbstractDto.php#L92-L101
221,532
paquettg/leaguewrap
src/LeagueWrap/Dto/AbstractDto.php
AbstractDto.raw
public function raw() { // unpack $raw = []; foreach ($this->info as $key => $info) { if (is_array($info)) { $info = $this->unpack($info); } // check if it's just a single object if ($info instanceof AbstractDto) { $info = $info->raw(); } // set the raw value $raw[$key] = $info; } return $raw; }
php
public function raw() { // unpack $raw = []; foreach ($this->info as $key => $info) { if (is_array($info)) { $info = $this->unpack($info); } // check if it's just a single object if ($info instanceof AbstractDto) { $info = $info->raw(); } // set the raw value $raw[$key] = $info; } return $raw; }
[ "public", "function", "raw", "(", ")", "{", "// unpack", "$", "raw", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "info", "as", "$", "key", "=>", "$", "info", ")", "{", "if", "(", "is_array", "(", "$", "info", ")", ")", "{", "$", "info", "=", "$", "this", "->", "unpack", "(", "$", "info", ")", ";", "}", "// check if it's just a single object", "if", "(", "$", "info", "instanceof", "AbstractDto", ")", "{", "$", "info", "=", "$", "info", "->", "raw", "(", ")", ";", "}", "// set the raw value", "$", "raw", "[", "$", "key", "]", "=", "$", "info", ";", "}", "return", "$", "raw", ";", "}" ]
Returns the raw info array @return array @recursive
[ "Returns", "the", "raw", "info", "array" ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Dto/AbstractDto.php#L109-L129
221,533
paquettg/leaguewrap
src/LeagueWrap/Dto/AbstractDto.php
AbstractDto.getStaticFields
protected function getStaticFields() { $fields = []; foreach ($this->info as $info) { if (is_array($info)) { foreach ($info as $value) { if ($value instanceof AbstractDto) { $fields += $value->getStaticFields(); } } } if ($info instanceof AbstractDto) { $fields += $info->getStaticFields(); } } return $fields; }
php
protected function getStaticFields() { $fields = []; foreach ($this->info as $info) { if (is_array($info)) { foreach ($info as $value) { if ($value instanceof AbstractDto) { $fields += $value->getStaticFields(); } } } if ($info instanceof AbstractDto) { $fields += $info->getStaticFields(); } } return $fields; }
[ "protected", "function", "getStaticFields", "(", ")", "{", "$", "fields", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "info", "as", "$", "info", ")", "{", "if", "(", "is_array", "(", "$", "info", ")", ")", "{", "foreach", "(", "$", "info", "as", "$", "value", ")", "{", "if", "(", "$", "value", "instanceof", "AbstractDto", ")", "{", "$", "fields", "+=", "$", "value", "->", "getStaticFields", "(", ")", ";", "}", "}", "}", "if", "(", "$", "info", "instanceof", "AbstractDto", ")", "{", "$", "fields", "+=", "$", "info", "->", "getStaticFields", "(", ")", ";", "}", "}", "return", "$", "fields", ";", "}" ]
Gets all static fields that we expect to need to get all static data for any child dto object. @return array
[ "Gets", "all", "static", "fields", "that", "we", "expect", "to", "need", "to", "get", "all", "static", "data", "for", "any", "child", "dto", "object", "." ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Dto/AbstractDto.php#L137-L159
221,534
paquettg/leaguewrap
src/LeagueWrap/Dto/AbstractDto.php
AbstractDto.addStaticData
protected function addStaticData(StaticOptimizer $optimizer) { foreach ($this->info as $info) { if (is_array($info)) { foreach ($info as $value) { if ($value instanceof AbstractDto) { $value->addStaticData($optimizer); } } } if ($info instanceof AbstractDto) { $info->addStaticData($optimizer); } } }
php
protected function addStaticData(StaticOptimizer $optimizer) { foreach ($this->info as $info) { if (is_array($info)) { foreach ($info as $value) { if ($value instanceof AbstractDto) { $value->addStaticData($optimizer); } } } if ($info instanceof AbstractDto) { $info->addStaticData($optimizer); } } }
[ "protected", "function", "addStaticData", "(", "StaticOptimizer", "$", "optimizer", ")", "{", "foreach", "(", "$", "this", "->", "info", "as", "$", "info", ")", "{", "if", "(", "is_array", "(", "$", "info", ")", ")", "{", "foreach", "(", "$", "info", "as", "$", "value", ")", "{", "if", "(", "$", "value", "instanceof", "AbstractDto", ")", "{", "$", "value", "->", "addStaticData", "(", "$", "optimizer", ")", ";", "}", "}", "}", "if", "(", "$", "info", "instanceof", "AbstractDto", ")", "{", "$", "info", "->", "addStaticData", "(", "$", "optimizer", ")", ";", "}", "}", "}" ]
Attempts to add the static data that we got from getStaticData to any children DTO objects. @param StaticOptimizer $optimizer @return void
[ "Attempts", "to", "add", "the", "static", "data", "that", "we", "got", "from", "getStaticData", "to", "any", "children", "DTO", "objects", "." ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Dto/AbstractDto.php#L168-L187
221,535
paquettg/leaguewrap
src/LeagueWrap/Dto/AbstractDto.php
AbstractDto.unpack
protected function unpack(array $info) { $return = []; foreach ($info as $key => $value) { if ($value instanceof AbstractDto) { $value = $value->raw(); } $return[$key] = $value; } return $return; }
php
protected function unpack(array $info) { $return = []; foreach ($info as $key => $value) { if ($value instanceof AbstractDto) { $value = $value->raw(); } $return[$key] = $value; } return $return; }
[ "protected", "function", "unpack", "(", "array", "$", "info", ")", "{", "$", "return", "=", "[", "]", ";", "foreach", "(", "$", "info", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "$", "value", "instanceof", "AbstractDto", ")", "{", "$", "value", "=", "$", "value", "->", "raw", "(", ")", ";", "}", "$", "return", "[", "$", "key", "]", "=", "$", "value", ";", "}", "return", "$", "return", ";", "}" ]
Unpacks an array that contains Dto objects. @param array $info @return array
[ "Unpacks", "an", "array", "that", "contains", "Dto", "objects", "." ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Dto/AbstractDto.php#L195-L208
221,536
paquettg/leaguewrap
src/LeagueWrap/Dto/MatchTeam.php
MatchTeam.ban
public function ban($banId) { if ( ! isset($this->info['bans'])) { // no teams return null; } $bans = $this->info['bans']; if (isset($bans[$banId])) { return $bans[$banId]; } return null; }
php
public function ban($banId) { if ( ! isset($this->info['bans'])) { // no teams return null; } $bans = $this->info['bans']; if (isset($bans[$banId])) { return $bans[$banId]; } return null; }
[ "public", "function", "ban", "(", "$", "banId", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "info", "[", "'bans'", "]", ")", ")", "{", "// no teams", "return", "null", ";", "}", "$", "bans", "=", "$", "this", "->", "info", "[", "'bans'", "]", ";", "if", "(", "isset", "(", "$", "bans", "[", "$", "banId", "]", ")", ")", "{", "return", "$", "bans", "[", "$", "banId", "]", ";", "}", "return", "null", ";", "}" ]
Attempts to get a ban from this team. @param int $banId @return Ban|null
[ "Attempts", "to", "get", "a", "ban", "from", "this", "team", "." ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Dto/MatchTeam.php#L42-L56
221,537
neos/fluid
Classes/TYPO3/Fluid/Core/Parser/SyntaxTree/ObjectAccessorNode.php
ObjectAccessorNode.evaluate
public function evaluate(RenderingContextInterface $renderingContext) { return self::getPropertyPath($renderingContext->getTemplateVariableContainer(), $this->objectPath, $renderingContext); }
php
public function evaluate(RenderingContextInterface $renderingContext) { return self::getPropertyPath($renderingContext->getTemplateVariableContainer(), $this->objectPath, $renderingContext); }
[ "public", "function", "evaluate", "(", "RenderingContextInterface", "$", "renderingContext", ")", "{", "return", "self", "::", "getPropertyPath", "(", "$", "renderingContext", "->", "getTemplateVariableContainer", "(", ")", ",", "$", "this", "->", "objectPath", ",", "$", "renderingContext", ")", ";", "}" ]
Evaluate this node and return the correct object. Handles each part (denoted by .) in $this->objectPath in the following order: - call appropriate getter - call public property, if exists - fail The first part of the object path has to be a variable in the TemplateVariableContainer. @param RenderingContextInterface $renderingContext @return object The evaluated object, can be any object type.
[ "Evaluate", "this", "node", "and", "return", "the", "correct", "object", "." ]
ded6be84a9487f7e0e204703a30b12d2c58c0efd
https://github.com/neos/fluid/blob/ded6be84a9487f7e0e204703a30b12d2c58c0efd/Classes/TYPO3/Fluid/Core/Parser/SyntaxTree/ObjectAccessorNode.php#L69-L72
221,538
radphp/radphp
src/Routing/Router.php
Router.checkRestPrefixValidity
private function checkRestPrefixValidity(array $restPrefixes) { foreach ($restPrefixes as $prefix) { if (!is_string($prefix)) { throw new DomainException('All provided prefixes for REST must be string'); } // if it has "/" in it if (strpos('/', $prefix)) { throw new DomainException('Prefixes must not contain "/"'); } } }
php
private function checkRestPrefixValidity(array $restPrefixes) { foreach ($restPrefixes as $prefix) { if (!is_string($prefix)) { throw new DomainException('All provided prefixes for REST must be string'); } // if it has "/" in it if (strpos('/', $prefix)) { throw new DomainException('Prefixes must not contain "/"'); } } }
[ "private", "function", "checkRestPrefixValidity", "(", "array", "$", "restPrefixes", ")", "{", "foreach", "(", "$", "restPrefixes", "as", "$", "prefix", ")", "{", "if", "(", "!", "is_string", "(", "$", "prefix", ")", ")", "{", "throw", "new", "DomainException", "(", "'All provided prefixes for REST must be string'", ")", ";", "}", "// if it has \"/\" in it", "if", "(", "strpos", "(", "'/'", ",", "$", "prefix", ")", ")", "{", "throw", "new", "DomainException", "(", "'Prefixes must not contain \"/\"'", ")", ";", "}", "}", "}" ]
Check if REST prefixes are valid or not. It will throw exception on error @param array $restPrefixes REST prefixes @throws DomainException
[ "Check", "if", "REST", "prefixes", "are", "valid", "or", "not", ".", "It", "will", "throw", "exception", "on", "error" ]
2cbde2c12dd7204b1aba3f8a6e351b287ae85f0a
https://github.com/radphp/radphp/blob/2cbde2c12dd7204b1aba3f8a6e351b287ae85f0a/src/Routing/Router.php#L418-L430
221,539
radphp/radphp
src/Routing/Router.php
Router.prepareMethodName
protected function prepareMethodName() { if (PHP_SAPI === 'cli') { $method = 'cli'; } else { /** @var Request $request */ $request = $this->getContainer()->get('request'); $method = $request->getMethod(); } return ucfirst(strtolower($method)) . 'Method'; }
php
protected function prepareMethodName() { if (PHP_SAPI === 'cli') { $method = 'cli'; } else { /** @var Request $request */ $request = $this->getContainer()->get('request'); $method = $request->getMethod(); } return ucfirst(strtolower($method)) . 'Method'; }
[ "protected", "function", "prepareMethodName", "(", ")", "{", "if", "(", "PHP_SAPI", "===", "'cli'", ")", "{", "$", "method", "=", "'cli'", ";", "}", "else", "{", "/** @var Request $request */", "$", "request", "=", "$", "this", "->", "getContainer", "(", ")", "->", "get", "(", "'request'", ")", ";", "$", "method", "=", "$", "request", "->", "getMethod", "(", ")", ";", "}", "return", "ucfirst", "(", "strtolower", "(", "$", "method", ")", ")", ".", "'Method'", ";", "}" ]
Prepare method name, choose between CLI and all other HTTP methods @return string Method name + "Method"
[ "Prepare", "method", "name", "choose", "between", "CLI", "and", "all", "other", "HTTP", "methods" ]
2cbde2c12dd7204b1aba3f8a6e351b287ae85f0a
https://github.com/radphp/radphp/blob/2cbde2c12dd7204b1aba3f8a6e351b287ae85f0a/src/Routing/Router.php#L437-L448
221,540
radphp/radphp
src/Routing/Router.php
Router.extractLanguage
protected function extractLanguage(array &$parts) { if (!empty($parts) && in_array($parts[0], Config::get('languages.possible', ['en']))) { // We found the language, so set it as current language $this->language = array_shift($parts); } else { $this->language = Config::get('languages.default', 'en'); } }
php
protected function extractLanguage(array &$parts) { if (!empty($parts) && in_array($parts[0], Config::get('languages.possible', ['en']))) { // We found the language, so set it as current language $this->language = array_shift($parts); } else { $this->language = Config::get('languages.default', 'en'); } }
[ "protected", "function", "extractLanguage", "(", "array", "&", "$", "parts", ")", "{", "if", "(", "!", "empty", "(", "$", "parts", ")", "&&", "in_array", "(", "$", "parts", "[", "0", "]", ",", "Config", "::", "get", "(", "'languages.possible'", ",", "[", "'en'", "]", ")", ")", ")", "{", "// We found the language, so set it as current language", "$", "this", "->", "language", "=", "array_shift", "(", "$", "parts", ")", ";", "}", "else", "{", "$", "this", "->", "language", "=", "Config", "::", "get", "(", "'languages.default'", ",", "'en'", ")", ";", "}", "}" ]
If route is prefixed with language, extract it @param array $parts router parts
[ "If", "route", "is", "prefixed", "with", "language", "extract", "it" ]
2cbde2c12dd7204b1aba3f8a6e351b287ae85f0a
https://github.com/radphp/radphp/blob/2cbde2c12dd7204b1aba3f8a6e351b287ae85f0a/src/Routing/Router.php#L455-L463
221,541
radphp/radphp
src/Routing/Router.php
Router.prepareRestRequest
protected function prepareRestRequest(array &$parts) { if (!empty($parts) && in_array($parts[0], $this->restPrefixes)) { /* * if the request is something like /_/posts/1/comments/2 * it will convert it to something like /posts/comments/1/2 */ // first remove the REST prefix array_shift($parts); $restRoute = $restParams = []; $i = 1; foreach ($parts as $part) { if ($i % 2) { $restRoute[] = $part; } else { $restParams[] = $part; } $i++; } $parts = array_merge($restRoute, $restParams); } }
php
protected function prepareRestRequest(array &$parts) { if (!empty($parts) && in_array($parts[0], $this->restPrefixes)) { /* * if the request is something like /_/posts/1/comments/2 * it will convert it to something like /posts/comments/1/2 */ // first remove the REST prefix array_shift($parts); $restRoute = $restParams = []; $i = 1; foreach ($parts as $part) { if ($i % 2) { $restRoute[] = $part; } else { $restParams[] = $part; } $i++; } $parts = array_merge($restRoute, $restParams); } }
[ "protected", "function", "prepareRestRequest", "(", "array", "&", "$", "parts", ")", "{", "if", "(", "!", "empty", "(", "$", "parts", ")", "&&", "in_array", "(", "$", "parts", "[", "0", "]", ",", "$", "this", "->", "restPrefixes", ")", ")", "{", "/*\n * if the request is something like /_/posts/1/comments/2\n * it will convert it to something like /posts/comments/1/2\n */", "// first remove the REST prefix", "array_shift", "(", "$", "parts", ")", ";", "$", "restRoute", "=", "$", "restParams", "=", "[", "]", ";", "$", "i", "=", "1", ";", "foreach", "(", "$", "parts", "as", "$", "part", ")", "{", "if", "(", "$", "i", "%", "2", ")", "{", "$", "restRoute", "[", "]", "=", "$", "part", ";", "}", "else", "{", "$", "restParams", "[", "]", "=", "$", "part", ";", "}", "$", "i", "++", ";", "}", "$", "parts", "=", "array_merge", "(", "$", "restRoute", ",", "$", "restParams", ")", ";", "}", "}" ]
Prepare REST requests @param array $parts router parts
[ "Prepare", "REST", "requests" ]
2cbde2c12dd7204b1aba3f8a6e351b287ae85f0a
https://github.com/radphp/radphp/blob/2cbde2c12dd7204b1aba3f8a6e351b287ae85f0a/src/Routing/Router.php#L470-L496
221,542
radphp/radphp
src/Routing/Router.php
Router.finalizeRouterArguments
private function finalizeRouterArguments( array $parts, array $camelizedParts, $actionNamespace, $bundleName, $method ) { array_splice($camelizedParts, 1, 1, 'Responder'); $responderNamespace = implode('\\', $camelizedParts) . 'Responder'; $delta = ($this->routingPhase == self::ROUTING_PHASE_METHOD) ? 2 : 1; $this->action = ($this->routingPhase == self::ROUTING_PHASE_METHOD) ? $method : $parts[count($camelizedParts) - 2]; $this->bundle = strtolower($bundleName); $this->actionNamespace = $actionNamespace; $this->responderNamespace = $responderNamespace; $this->params = array_slice($parts, count($camelizedParts) - $delta, -1); $this->isMatched = true; }
php
private function finalizeRouterArguments( array $parts, array $camelizedParts, $actionNamespace, $bundleName, $method ) { array_splice($camelizedParts, 1, 1, 'Responder'); $responderNamespace = implode('\\', $camelizedParts) . 'Responder'; $delta = ($this->routingPhase == self::ROUTING_PHASE_METHOD) ? 2 : 1; $this->action = ($this->routingPhase == self::ROUTING_PHASE_METHOD) ? $method : $parts[count($camelizedParts) - 2]; $this->bundle = strtolower($bundleName); $this->actionNamespace = $actionNamespace; $this->responderNamespace = $responderNamespace; $this->params = array_slice($parts, count($camelizedParts) - $delta, -1); $this->isMatched = true; }
[ "private", "function", "finalizeRouterArguments", "(", "array", "$", "parts", ",", "array", "$", "camelizedParts", ",", "$", "actionNamespace", ",", "$", "bundleName", ",", "$", "method", ")", "{", "array_splice", "(", "$", "camelizedParts", ",", "1", ",", "1", ",", "'Responder'", ")", ";", "$", "responderNamespace", "=", "implode", "(", "'\\\\'", ",", "$", "camelizedParts", ")", ".", "'Responder'", ";", "$", "delta", "=", "(", "$", "this", "->", "routingPhase", "==", "self", "::", "ROUTING_PHASE_METHOD", ")", "?", "2", ":", "1", ";", "$", "this", "->", "action", "=", "(", "$", "this", "->", "routingPhase", "==", "self", "::", "ROUTING_PHASE_METHOD", ")", "?", "$", "method", ":", "$", "parts", "[", "count", "(", "$", "camelizedParts", ")", "-", "2", "]", ";", "$", "this", "->", "bundle", "=", "strtolower", "(", "$", "bundleName", ")", ";", "$", "this", "->", "actionNamespace", "=", "$", "actionNamespace", ";", "$", "this", "->", "responderNamespace", "=", "$", "responderNamespace", ";", "$", "this", "->", "params", "=", "array_slice", "(", "$", "parts", ",", "count", "(", "$", "camelizedParts", ")", "-", "$", "delta", ",", "-", "1", ")", ";", "$", "this", "->", "isMatched", "=", "true", ";", "}" ]
Finalize and set all route parameters @param array $parts Router parts @param array $camelizedParts Camelized router parts @param string $actionNamespace Namespace @param string $bundleName Bundle @param string $method Method
[ "Finalize", "and", "set", "all", "route", "parameters" ]
2cbde2c12dd7204b1aba3f8a6e351b287ae85f0a
https://github.com/radphp/radphp/blob/2cbde2c12dd7204b1aba3f8a6e351b287ae85f0a/src/Routing/Router.php#L507-L528
221,543
radphp/radphp
src/Network/Http/Message/Stream.php
Stream.connectionErrorHandler
protected function connectionErrorHandler($code, $message, $file, $line, $args) { $this->connectionErrors[] = [ 'code' => $code, 'message' => $message, 'file' => $file, 'line' => $line, 'args' => $args ]; }
php
protected function connectionErrorHandler($code, $message, $file, $line, $args) { $this->connectionErrors[] = [ 'code' => $code, 'message' => $message, 'file' => $file, 'line' => $line, 'args' => $args ]; }
[ "protected", "function", "connectionErrorHandler", "(", "$", "code", ",", "$", "message", ",", "$", "file", ",", "$", "line", ",", "$", "args", ")", "{", "$", "this", "->", "connectionErrors", "[", "]", "=", "[", "'code'", "=>", "$", "code", ",", "'message'", "=>", "$", "message", ",", "'file'", "=>", "$", "file", ",", "'line'", "=>", "$", "line", ",", "'args'", "=>", "$", "args", "]", ";", "}" ]
Connection error handler @param int $code Error code @param string $message Error message @param string $file Error file @param int $line Error line @param array $args Error arguments
[ "Connection", "error", "handler" ]
2cbde2c12dd7204b1aba3f8a6e351b287ae85f0a
https://github.com/radphp/radphp/blob/2cbde2c12dd7204b1aba3f8a6e351b287ae85f0a/src/Network/Http/Message/Stream.php#L104-L113
221,544
CapMousse/React-Restify
src/Traits/EventTrait.php
EventTrait.after
public function after($callback) { $container = Container::getInstance(); $this->on('after', function ($request, $response) use (&$container, &$callback) { try { $container->call($callback, func_get_args()); } catch (\Exception $e) { $this->emit('error', [$request, $response, $e->getMessage()]); } }); }
php
public function after($callback) { $container = Container::getInstance(); $this->on('after', function ($request, $response) use (&$container, &$callback) { try { $container->call($callback, func_get_args()); } catch (\Exception $e) { $this->emit('error', [$request, $response, $e->getMessage()]); } }); }
[ "public", "function", "after", "(", "$", "callback", ")", "{", "$", "container", "=", "Container", "::", "getInstance", "(", ")", ";", "$", "this", "->", "on", "(", "'after'", ",", "function", "(", "$", "request", ",", "$", "response", ")", "use", "(", "&", "$", "container", ",", "&", "$", "callback", ")", "{", "try", "{", "$", "container", "->", "call", "(", "$", "callback", ",", "func_get_args", "(", ")", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "$", "this", "->", "emit", "(", "'error'", ",", "[", "$", "request", ",", "$", "response", ",", "$", "e", "->", "getMessage", "(", ")", "]", ")", ";", "}", "}", ")", ";", "}" ]
Helper to listing to after event @param Callable $callback @return Void
[ "Helper", "to", "listing", "to", "after", "event" ]
51fe94d6e4c7fafec06fb304f9e44badde4bfe71
https://github.com/CapMousse/React-Restify/blob/51fe94d6e4c7fafec06fb304f9e44badde4bfe71/src/Traits/EventTrait.php#L31-L42
221,545
paquettg/leaguewrap
src/LeagueWrap/Dto/RecentGames.php
RecentGames.game
public function game($gameId) { if ( ! isset($this->info['games'][$gameId])) { return null; } return $this->info['games'][$gameId]; }
php
public function game($gameId) { if ( ! isset($this->info['games'][$gameId])) { return null; } return $this->info['games'][$gameId]; }
[ "public", "function", "game", "(", "$", "gameId", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "info", "[", "'games'", "]", "[", "$", "gameId", "]", ")", ")", "{", "return", "null", ";", "}", "return", "$", "this", "->", "info", "[", "'games'", "]", "[", "$", "gameId", "]", ";", "}" ]
Get a game by the id. @param int $gameId @return Game|null
[ "Get", "a", "game", "by", "the", "id", "." ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Dto/RecentGames.php#L33-L41
221,546
CapMousse/React-Restify
src/Routing/Routes.php
Routes.addRoute
public function addRoute($method, $route, $callback) { $route = $this->router->addRoute(strtoupper($method), $this->prefix . '/' . $route, $callback); $route->onAny(function($event, $arguments){ $this->emit($event, $arguments); }); $this->routes[] = $route; return $route; }
php
public function addRoute($method, $route, $callback) { $route = $this->router->addRoute(strtoupper($method), $this->prefix . '/' . $route, $callback); $route->onAny(function($event, $arguments){ $this->emit($event, $arguments); }); $this->routes[] = $route; return $route; }
[ "public", "function", "addRoute", "(", "$", "method", ",", "$", "route", ",", "$", "callback", ")", "{", "$", "route", "=", "$", "this", "->", "router", "->", "addRoute", "(", "strtoupper", "(", "$", "method", ")", ",", "$", "this", "->", "prefix", ".", "'/'", ".", "$", "route", ",", "$", "callback", ")", ";", "$", "route", "->", "onAny", "(", "function", "(", "$", "event", ",", "$", "arguments", ")", "{", "$", "this", "->", "emit", "(", "$", "event", ",", "$", "arguments", ")", ";", "}", ")", ";", "$", "this", "->", "routes", "[", "]", "=", "$", "route", ";", "return", "$", "route", ";", "}" ]
Create a new route for the group @param String $method @param String $route @param Callable $callback
[ "Create", "a", "new", "route", "for", "the", "group" ]
51fe94d6e4c7fafec06fb304f9e44badde4bfe71
https://github.com/CapMousse/React-Restify/blob/51fe94d6e4c7fafec06fb304f9e44badde4bfe71/src/Routing/Routes.php#L51-L62
221,547
CawaKharkov/laravel-balance
src/LaravelBalance/Services/BalanceService.php
BalanceService.canPay
public function canPay($amount, $userId) { $balance = config('laravel_balance.user')::find($userId)->balance(); return ($balance < $amount) ? false : true; }
php
public function canPay($amount, $userId) { $balance = config('laravel_balance.user')::find($userId)->balance(); return ($balance < $amount) ? false : true; }
[ "public", "function", "canPay", "(", "$", "amount", ",", "$", "userId", ")", "{", "$", "balance", "=", "config", "(", "'laravel_balance.user'", ")", "::", "find", "(", "$", "userId", ")", "->", "balance", "(", ")", ";", "return", "(", "$", "balance", "<", "$", "amount", ")", "?", "false", ":", "true", ";", "}" ]
Check if user can pay for transaction @param $amount @param $userId @return bool
[ "Check", "if", "user", "can", "pay", "for", "transaction" ]
9c297dc9675527b4be96699671ae26e76475a466
https://github.com/CawaKharkov/laravel-balance/blob/9c297dc9675527b4be96699671ae26e76475a466/src/LaravelBalance/Services/BalanceService.php#L53-L58
221,548
paquettg/leaguewrap
src/LeagueWrap/Limit/Collection.php
Collection.hitLimits
public function hitLimits($region, $count = 1) { foreach ($this->limits as $limit) { if ($limit->getRegion() == $region && ! $limit->hit($count) ) { return false; } } return true; }
php
public function hitLimits($region, $count = 1) { foreach ($this->limits as $limit) { if ($limit->getRegion() == $region && ! $limit->hit($count) ) { return false; } } return true; }
[ "public", "function", "hitLimits", "(", "$", "region", ",", "$", "count", "=", "1", ")", "{", "foreach", "(", "$", "this", "->", "limits", "as", "$", "limit", ")", "{", "if", "(", "$", "limit", "->", "getRegion", "(", ")", "==", "$", "region", "&&", "!", "$", "limit", "->", "hit", "(", "$", "count", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
Hit the limit set for the given region. @param string $region @param int $count @return bool
[ "Hit", "the", "limit", "set", "for", "the", "given", "region", "." ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Limit/Collection.php#L28-L41
221,549
paquettg/leaguewrap
src/LeagueWrap/Limit/Collection.php
Collection.remainingHits
public function remainingHits() { $remaining = null; foreach ($this->limits as $limit) { $hitsLeft = $limit->remaining(); if (is_null($remaining) || $hitsLeft < $remaining ) { $remaining = $hitsLeft; } } return $remaining; }
php
public function remainingHits() { $remaining = null; foreach ($this->limits as $limit) { $hitsLeft = $limit->remaining(); if (is_null($remaining) || $hitsLeft < $remaining ) { $remaining = $hitsLeft; } } return $remaining; }
[ "public", "function", "remainingHits", "(", ")", "{", "$", "remaining", "=", "null", ";", "foreach", "(", "$", "this", "->", "limits", "as", "$", "limit", ")", "{", "$", "hitsLeft", "=", "$", "limit", "->", "remaining", "(", ")", ";", "if", "(", "is_null", "(", "$", "remaining", ")", "||", "$", "hitsLeft", "<", "$", "remaining", ")", "{", "$", "remaining", "=", "$", "hitsLeft", ";", "}", "}", "return", "$", "remaining", ";", "}" ]
Returns the lowest
[ "Returns", "the", "lowest" ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Limit/Collection.php#L46-L61
221,550
radphp/radphp
src/Network/Http/Response/Cookies.php
Cookies.set
public function set($name, $value = '', $expire = 0, $path = '/', $domain = '', $secure = false, $httpOnly = false) { if (!is_string($name)) { throw new Cookie\Exception('The cookie name must be string'); } if (!isset($this->cookies[$name])) { $this->cookies[$name] = new Cookie($name, $value, $expire, $path, $domain, $secure, $httpOnly); $this->cookies[$name]->useEncryption($this->isUsingEncryption()); } else { $this->cookies[$name]->setValue($value) ->setExpiration($expire) ->setPath($path) ->setDomain($domain) ->setSecure($secure) ->setHttpOnly($httpOnly); } return $this; }
php
public function set($name, $value = '', $expire = 0, $path = '/', $domain = '', $secure = false, $httpOnly = false) { if (!is_string($name)) { throw new Cookie\Exception('The cookie name must be string'); } if (!isset($this->cookies[$name])) { $this->cookies[$name] = new Cookie($name, $value, $expire, $path, $domain, $secure, $httpOnly); $this->cookies[$name]->useEncryption($this->isUsingEncryption()); } else { $this->cookies[$name]->setValue($value) ->setExpiration($expire) ->setPath($path) ->setDomain($domain) ->setSecure($secure) ->setHttpOnly($httpOnly); } return $this; }
[ "public", "function", "set", "(", "$", "name", ",", "$", "value", "=", "''", ",", "$", "expire", "=", "0", ",", "$", "path", "=", "'/'", ",", "$", "domain", "=", "''", ",", "$", "secure", "=", "false", ",", "$", "httpOnly", "=", "false", ")", "{", "if", "(", "!", "is_string", "(", "$", "name", ")", ")", "{", "throw", "new", "Cookie", "\\", "Exception", "(", "'The cookie name must be string'", ")", ";", "}", "if", "(", "!", "isset", "(", "$", "this", "->", "cookies", "[", "$", "name", "]", ")", ")", "{", "$", "this", "->", "cookies", "[", "$", "name", "]", "=", "new", "Cookie", "(", "$", "name", ",", "$", "value", ",", "$", "expire", ",", "$", "path", ",", "$", "domain", ",", "$", "secure", ",", "$", "httpOnly", ")", ";", "$", "this", "->", "cookies", "[", "$", "name", "]", "->", "useEncryption", "(", "$", "this", "->", "isUsingEncryption", "(", ")", ")", ";", "}", "else", "{", "$", "this", "->", "cookies", "[", "$", "name", "]", "->", "setValue", "(", "$", "value", ")", "->", "setExpiration", "(", "$", "expire", ")", "->", "setPath", "(", "$", "path", ")", "->", "setDomain", "(", "$", "domain", ")", "->", "setSecure", "(", "$", "secure", ")", "->", "setHttpOnly", "(", "$", "httpOnly", ")", ";", "}", "return", "$", "this", ";", "}" ]
Sets a cookie to be sent at the end of the request This method overrides any cookie set before with the same name @param string $name The name of the cookie. @param string $value The value of the cookie. @param int $expire The time the cookie expires. @param string $path The path on the server in which the cookie will be available on. @param string $domain The domain that the cookie is available to. @param bool $secure Indicates that the cookie should only be transmitted over a secure HTTPS connection from the client. @param bool $httpOnly When TRUE the cookie will be made accessible only through the HTTP protocol. @return Cookies @throws Cookie\Exception
[ "Sets", "a", "cookie", "to", "be", "sent", "at", "the", "end", "of", "the", "request", "This", "method", "overrides", "any", "cookie", "set", "before", "with", "the", "same", "name" ]
2cbde2c12dd7204b1aba3f8a6e351b287ae85f0a
https://github.com/radphp/radphp/blob/2cbde2c12dd7204b1aba3f8a6e351b287ae85f0a/src/Network/Http/Response/Cookies.php#L64-L83
221,551
radphp/radphp
src/Network/Http/Response/Cookies.php
Cookies.get
public function get($name) { if (!is_string($name)) { throw new Cookie\Exception('The cookie name must be string'); } if (isset($this->cookies[$name])) { $this->cookies[$name]->useEncryption($this->isUsingEncryption()); return $this->cookies[$name]; } return null; }
php
public function get($name) { if (!is_string($name)) { throw new Cookie\Exception('The cookie name must be string'); } if (isset($this->cookies[$name])) { $this->cookies[$name]->useEncryption($this->isUsingEncryption()); return $this->cookies[$name]; } return null; }
[ "public", "function", "get", "(", "$", "name", ")", "{", "if", "(", "!", "is_string", "(", "$", "name", ")", ")", "{", "throw", "new", "Cookie", "\\", "Exception", "(", "'The cookie name must be string'", ")", ";", "}", "if", "(", "isset", "(", "$", "this", "->", "cookies", "[", "$", "name", "]", ")", ")", "{", "$", "this", "->", "cookies", "[", "$", "name", "]", "->", "useEncryption", "(", "$", "this", "->", "isUsingEncryption", "(", ")", ")", ";", "return", "$", "this", "->", "cookies", "[", "$", "name", "]", ";", "}", "return", "null", ";", "}" ]
Gets a cookie from the bag @param string $name @return null|Cookie @throws Cookie\Exception
[ "Gets", "a", "cookie", "from", "the", "bag" ]
2cbde2c12dd7204b1aba3f8a6e351b287ae85f0a
https://github.com/radphp/radphp/blob/2cbde2c12dd7204b1aba3f8a6e351b287ae85f0a/src/Network/Http/Response/Cookies.php#L93-L106
221,552
neos/fluid
Classes/TYPO3/Fluid/View/TemplateView.php
TemplateView.getPartialRootPaths
protected function getPartialRootPaths() { if ($this->options['partialRootPaths'] !== null) { return $this->options['partialRootPaths']; } /** @var $actionRequest \TYPO3\Flow\Mvc\ActionRequest */ $actionRequest = $this->controllerContext->getRequest(); return array(str_replace('@packageResourcesPath', 'resource://' . $actionRequest->getControllerPackageKey(), $this->options['partialRootPathPattern'])); }
php
protected function getPartialRootPaths() { if ($this->options['partialRootPaths'] !== null) { return $this->options['partialRootPaths']; } /** @var $actionRequest \TYPO3\Flow\Mvc\ActionRequest */ $actionRequest = $this->controllerContext->getRequest(); return array(str_replace('@packageResourcesPath', 'resource://' . $actionRequest->getControllerPackageKey(), $this->options['partialRootPathPattern'])); }
[ "protected", "function", "getPartialRootPaths", "(", ")", "{", "if", "(", "$", "this", "->", "options", "[", "'partialRootPaths'", "]", "!==", "null", ")", "{", "return", "$", "this", "->", "options", "[", "'partialRootPaths'", "]", ";", "}", "/** @var $actionRequest \\TYPO3\\Flow\\Mvc\\ActionRequest */", "$", "actionRequest", "=", "$", "this", "->", "controllerContext", "->", "getRequest", "(", ")", ";", "return", "array", "(", "str_replace", "(", "'@packageResourcesPath'", ",", "'resource://'", ".", "$", "actionRequest", "->", "getControllerPackageKey", "(", ")", ",", "$", "this", "->", "options", "[", "'partialRootPathPattern'", "]", ")", ")", ";", "}" ]
Resolves the partial root to be used inside other paths. @return array Path(s) to partial root directory
[ "Resolves", "the", "partial", "root", "to", "be", "used", "inside", "other", "paths", "." ]
ded6be84a9487f7e0e204703a30b12d2c58c0efd
https://github.com/neos/fluid/blob/ded6be84a9487f7e0e204703a30b12d2c58c0efd/Classes/TYPO3/Fluid/View/TemplateView.php#L143-L151
221,553
neos/fluid
Classes/TYPO3/Fluid/View/TemplateView.php
TemplateView.getLayoutIdentifier
protected function getLayoutIdentifier($layoutName = 'Default') { $layoutPathAndFilename = $this->getLayoutPathAndFilename($layoutName); $prefix = 'layout_' . $layoutName; return $this->createIdentifierForFile($layoutPathAndFilename, $prefix); }
php
protected function getLayoutIdentifier($layoutName = 'Default') { $layoutPathAndFilename = $this->getLayoutPathAndFilename($layoutName); $prefix = 'layout_' . $layoutName; return $this->createIdentifierForFile($layoutPathAndFilename, $prefix); }
[ "protected", "function", "getLayoutIdentifier", "(", "$", "layoutName", "=", "'Default'", ")", "{", "$", "layoutPathAndFilename", "=", "$", "this", "->", "getLayoutPathAndFilename", "(", "$", "layoutName", ")", ";", "$", "prefix", "=", "'layout_'", ".", "$", "layoutName", ";", "return", "$", "this", "->", "createIdentifierForFile", "(", "$", "layoutPathAndFilename", ",", "$", "prefix", ")", ";", "}" ]
Returns a unique identifier for the resolved layout file. This identifier is based on the template path and last modification date @param string $layoutName The name of the layout @return string layout identifier
[ "Returns", "a", "unique", "identifier", "for", "the", "resolved", "layout", "file", ".", "This", "identifier", "is", "based", "on", "the", "template", "path", "and", "last", "modification", "date" ]
ded6be84a9487f7e0e204703a30b12d2c58c0efd
https://github.com/neos/fluid/blob/ded6be84a9487f7e0e204703a30b12d2c58c0efd/Classes/TYPO3/Fluid/View/TemplateView.php#L270-L275
221,554
neos/fluid
Classes/TYPO3/Fluid/View/TemplateView.php
TemplateView.getPartialIdentifier
protected function getPartialIdentifier($partialName) { $partialPathAndFilename = $this->getPartialPathAndFilename($partialName); $prefix = 'partial_' . $partialName; return $this->createIdentifierForFile($partialPathAndFilename, $prefix); }
php
protected function getPartialIdentifier($partialName) { $partialPathAndFilename = $this->getPartialPathAndFilename($partialName); $prefix = 'partial_' . $partialName; return $this->createIdentifierForFile($partialPathAndFilename, $prefix); }
[ "protected", "function", "getPartialIdentifier", "(", "$", "partialName", ")", "{", "$", "partialPathAndFilename", "=", "$", "this", "->", "getPartialPathAndFilename", "(", "$", "partialName", ")", ";", "$", "prefix", "=", "'partial_'", ".", "$", "partialName", ";", "return", "$", "this", "->", "createIdentifierForFile", "(", "$", "partialPathAndFilename", ",", "$", "prefix", ")", ";", "}" ]
Returns a unique identifier for the resolved partial file. This identifier is based on the template path and last modification date @param string $partialName The name of the partial @return string partial identifier
[ "Returns", "a", "unique", "identifier", "for", "the", "resolved", "partial", "file", ".", "This", "identifier", "is", "based", "on", "the", "template", "path", "and", "last", "modification", "date" ]
ded6be84a9487f7e0e204703a30b12d2c58c0efd
https://github.com/neos/fluid/blob/ded6be84a9487f7e0e204703a30b12d2c58c0efd/Classes/TYPO3/Fluid/View/TemplateView.php#L334-L339
221,555
neos/fluid
Classes/TYPO3/Fluid/View/TemplateView.php
TemplateView.getPartialSource
protected function getPartialSource($partialName) { $partialPathAndFilename = $this->getPartialPathAndFilename($partialName); $partialSource = Files::getFileContents($partialPathAndFilename, FILE_TEXT); if ($partialSource === false) { throw new Exception\InvalidTemplateResourceException('"' . $partialPathAndFilename . '" is not a valid template resource URI.', 1257246929); } return $partialSource; }
php
protected function getPartialSource($partialName) { $partialPathAndFilename = $this->getPartialPathAndFilename($partialName); $partialSource = Files::getFileContents($partialPathAndFilename, FILE_TEXT); if ($partialSource === false) { throw new Exception\InvalidTemplateResourceException('"' . $partialPathAndFilename . '" is not a valid template resource URI.', 1257246929); } return $partialSource; }
[ "protected", "function", "getPartialSource", "(", "$", "partialName", ")", "{", "$", "partialPathAndFilename", "=", "$", "this", "->", "getPartialPathAndFilename", "(", "$", "partialName", ")", ";", "$", "partialSource", "=", "Files", "::", "getFileContents", "(", "$", "partialPathAndFilename", ",", "FILE_TEXT", ")", ";", "if", "(", "$", "partialSource", "===", "false", ")", "{", "throw", "new", "Exception", "\\", "InvalidTemplateResourceException", "(", "'\"'", ".", "$", "partialPathAndFilename", ".", "'\" is not a valid template resource URI.'", ",", "1257246929", ")", ";", "}", "return", "$", "partialSource", ";", "}" ]
Figures out which partial to use. @param string $partialName The name of the partial @return string contents of the partial template @throws Exception\InvalidTemplateResourceException
[ "Figures", "out", "which", "partial", "to", "use", "." ]
ded6be84a9487f7e0e204703a30b12d2c58c0efd
https://github.com/neos/fluid/blob/ded6be84a9487f7e0e204703a30b12d2c58c0efd/Classes/TYPO3/Fluid/View/TemplateView.php#L348-L356
221,556
neos/fluid
Classes/TYPO3/Fluid/View/TemplateView.php
TemplateView.canRender
public function canRender(ControllerContext $controllerContext) { $this->setControllerContext($controllerContext); try { $this->getTemplateSource(); return true; } catch (Exception\InvalidTemplateResourceException $e) { return false; } }
php
public function canRender(ControllerContext $controllerContext) { $this->setControllerContext($controllerContext); try { $this->getTemplateSource(); return true; } catch (Exception\InvalidTemplateResourceException $e) { return false; } }
[ "public", "function", "canRender", "(", "ControllerContext", "$", "controllerContext", ")", "{", "$", "this", "->", "setControllerContext", "(", "$", "controllerContext", ")", ";", "try", "{", "$", "this", "->", "getTemplateSource", "(", ")", ";", "return", "true", ";", "}", "catch", "(", "Exception", "\\", "InvalidTemplateResourceException", "$", "e", ")", "{", "return", "false", ";", "}", "}" ]
Checks whether a template can be resolved for the current request context. @param ControllerContext $controllerContext Controller context which is available inside the view @return boolean
[ "Checks", "whether", "a", "template", "can", "be", "resolved", "for", "the", "current", "request", "context", "." ]
ded6be84a9487f7e0e204703a30b12d2c58c0efd
https://github.com/neos/fluid/blob/ded6be84a9487f7e0e204703a30b12d2c58c0efd/Classes/TYPO3/Fluid/View/TemplateView.php#L383-L392
221,557
paquettg/leaguewrap
src/LeagueWrap/Dto/StaticData/Block.php
Block.item
public function item($key) { if ( ! isset($this->info['items'][$key])) { return null; } return $this->info['items'][$key]; }
php
public function item($key) { if ( ! isset($this->info['items'][$key])) { return null; } return $this->info['items'][$key]; }
[ "public", "function", "item", "(", "$", "key", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "info", "[", "'items'", "]", "[", "$", "key", "]", ")", ")", "{", "return", "null", ";", "}", "return", "$", "this", "->", "info", "[", "'items'", "]", "[", "$", "key", "]", ";", "}" ]
Gets the item by key. @param mixed $key @return null
[ "Gets", "the", "item", "by", "key", "." ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Dto/StaticData/Block.php#L33-L41
221,558
radphp/radphp
src/Core/Action.php
Action.forward
public function forward($uri, $method = Request::METHOD_GET) { if ('cli' === PHP_SAPI) { throw new BaseException('You can not call forward method in cli mode.'); } $request = $this->getRequest()->withMethod($method); $this->getContainer()->setShared('request', $request); $oldRouter = $this->getRouter(); $oldRequestUri = $_SERVER['REQUEST_URI']; $oldGetUrl = $_GET['_url']; $_GET['_url'] = $_SERVER['REQUEST_URI'] = $uri; $this->getContainer()->setShared('router', new Router()); $this->getRouter()->setPrefix($oldRouter->getPrefix()); $this->getRouter()->handle($uri); $dispatcher = new Dispatcher(); $response = $dispatcher->setAction($this->getRouter()->getAction()) ->setActionNamespace($this->getRouter()->getActionNamespace()) ->setBundle($this->getRouter()->getBundle()) ->setParams($this->getRouter()->getParams()) ->setResponderNamespace($this->getRouter()->getResponderNamespace()) ->setRouteMatched($this->getRouter()->isMatched()) ->dispatch($request); // restore latest state $this->getContainer()->setShared('router', $oldRouter); $_SERVER['REQUEST_URI'] = $oldRequestUri; $_GET['_url'] = $oldGetUrl; return $response; }
php
public function forward($uri, $method = Request::METHOD_GET) { if ('cli' === PHP_SAPI) { throw new BaseException('You can not call forward method in cli mode.'); } $request = $this->getRequest()->withMethod($method); $this->getContainer()->setShared('request', $request); $oldRouter = $this->getRouter(); $oldRequestUri = $_SERVER['REQUEST_URI']; $oldGetUrl = $_GET['_url']; $_GET['_url'] = $_SERVER['REQUEST_URI'] = $uri; $this->getContainer()->setShared('router', new Router()); $this->getRouter()->setPrefix($oldRouter->getPrefix()); $this->getRouter()->handle($uri); $dispatcher = new Dispatcher(); $response = $dispatcher->setAction($this->getRouter()->getAction()) ->setActionNamespace($this->getRouter()->getActionNamespace()) ->setBundle($this->getRouter()->getBundle()) ->setParams($this->getRouter()->getParams()) ->setResponderNamespace($this->getRouter()->getResponderNamespace()) ->setRouteMatched($this->getRouter()->isMatched()) ->dispatch($request); // restore latest state $this->getContainer()->setShared('router', $oldRouter); $_SERVER['REQUEST_URI'] = $oldRequestUri; $_GET['_url'] = $oldGetUrl; return $response; }
[ "public", "function", "forward", "(", "$", "uri", ",", "$", "method", "=", "Request", "::", "METHOD_GET", ")", "{", "if", "(", "'cli'", "===", "PHP_SAPI", ")", "{", "throw", "new", "BaseException", "(", "'You can not call forward method in cli mode.'", ")", ";", "}", "$", "request", "=", "$", "this", "->", "getRequest", "(", ")", "->", "withMethod", "(", "$", "method", ")", ";", "$", "this", "->", "getContainer", "(", ")", "->", "setShared", "(", "'request'", ",", "$", "request", ")", ";", "$", "oldRouter", "=", "$", "this", "->", "getRouter", "(", ")", ";", "$", "oldRequestUri", "=", "$", "_SERVER", "[", "'REQUEST_URI'", "]", ";", "$", "oldGetUrl", "=", "$", "_GET", "[", "'_url'", "]", ";", "$", "_GET", "[", "'_url'", "]", "=", "$", "_SERVER", "[", "'REQUEST_URI'", "]", "=", "$", "uri", ";", "$", "this", "->", "getContainer", "(", ")", "->", "setShared", "(", "'router'", ",", "new", "Router", "(", ")", ")", ";", "$", "this", "->", "getRouter", "(", ")", "->", "setPrefix", "(", "$", "oldRouter", "->", "getPrefix", "(", ")", ")", ";", "$", "this", "->", "getRouter", "(", ")", "->", "handle", "(", "$", "uri", ")", ";", "$", "dispatcher", "=", "new", "Dispatcher", "(", ")", ";", "$", "response", "=", "$", "dispatcher", "->", "setAction", "(", "$", "this", "->", "getRouter", "(", ")", "->", "getAction", "(", ")", ")", "->", "setActionNamespace", "(", "$", "this", "->", "getRouter", "(", ")", "->", "getActionNamespace", "(", ")", ")", "->", "setBundle", "(", "$", "this", "->", "getRouter", "(", ")", "->", "getBundle", "(", ")", ")", "->", "setParams", "(", "$", "this", "->", "getRouter", "(", ")", "->", "getParams", "(", ")", ")", "->", "setResponderNamespace", "(", "$", "this", "->", "getRouter", "(", ")", "->", "getResponderNamespace", "(", ")", ")", "->", "setRouteMatched", "(", "$", "this", "->", "getRouter", "(", ")", "->", "isMatched", "(", ")", ")", "->", "dispatch", "(", "$", "request", ")", ";", "// restore latest state", "$", "this", "->", "getContainer", "(", ")", "->", "setShared", "(", "'router'", ",", "$", "oldRouter", ")", ";", "$", "_SERVER", "[", "'REQUEST_URI'", "]", "=", "$", "oldRequestUri", ";", "$", "_GET", "[", "'_url'", "]", "=", "$", "oldGetUrl", ";", "return", "$", "response", ";", "}" ]
Forward to other action without redirect @param string $uri @param string $method @return Response @throws BaseException
[ "Forward", "to", "other", "action", "without", "redirect" ]
2cbde2c12dd7204b1aba3f8a6e351b287ae85f0a
https://github.com/radphp/radphp/blob/2cbde2c12dd7204b1aba3f8a6e351b287ae85f0a/src/Core/Action.php#L186-L220
221,559
radphp/radphp
src/Core/Action.php
Action.subscribe
public function subscribe(EventManager $eventManager) { $eventManager->attach(self::EVENT_BEFORE_WEB_METHOD, [$this, 'beforeWebMethod']) ->attach(self::EVENT_AFTER_WEB_METHOD, [$this, 'afterWebMethod']) ->attach(self::EVENT_BEFORE_CLI_METHOD, [$this, 'beforeCLiMethod']) ->attach(self::EVENT_AFTER_CLI_METHOD, [$this, 'afterCLiMethod']); }
php
public function subscribe(EventManager $eventManager) { $eventManager->attach(self::EVENT_BEFORE_WEB_METHOD, [$this, 'beforeWebMethod']) ->attach(self::EVENT_AFTER_WEB_METHOD, [$this, 'afterWebMethod']) ->attach(self::EVENT_BEFORE_CLI_METHOD, [$this, 'beforeCLiMethod']) ->attach(self::EVENT_AFTER_CLI_METHOD, [$this, 'afterCLiMethod']); }
[ "public", "function", "subscribe", "(", "EventManager", "$", "eventManager", ")", "{", "$", "eventManager", "->", "attach", "(", "self", "::", "EVENT_BEFORE_WEB_METHOD", ",", "[", "$", "this", ",", "'beforeWebMethod'", "]", ")", "->", "attach", "(", "self", "::", "EVENT_AFTER_WEB_METHOD", ",", "[", "$", "this", ",", "'afterWebMethod'", "]", ")", "->", "attach", "(", "self", "::", "EVENT_BEFORE_CLI_METHOD", ",", "[", "$", "this", ",", "'beforeCLiMethod'", "]", ")", "->", "attach", "(", "self", "::", "EVENT_AFTER_CLI_METHOD", ",", "[", "$", "this", ",", "'afterCLiMethod'", "]", ")", ";", "}" ]
Subscribe event listener @param EventManager $eventManager @return mixed
[ "Subscribe", "event", "listener" ]
2cbde2c12dd7204b1aba3f8a6e351b287ae85f0a
https://github.com/radphp/radphp/blob/2cbde2c12dd7204b1aba3f8a6e351b287ae85f0a/src/Core/Action.php#L229-L235
221,560
paquettg/leaguewrap
src/LeagueWrap/Dto/MatchList.php
MatchList.match
public function match($matchPosition) { if ( ! isset($this->info['matches'][$matchPosition])) { return null; } return $this->info['matches'][$matchPosition]; }
php
public function match($matchPosition) { if ( ! isset($this->info['matches'][$matchPosition])) { return null; } return $this->info['matches'][$matchPosition]; }
[ "public", "function", "match", "(", "$", "matchPosition", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "info", "[", "'matches'", "]", "[", "$", "matchPosition", "]", ")", ")", "{", "return", "null", ";", "}", "return", "$", "this", "->", "info", "[", "'matches'", "]", "[", "$", "matchPosition", "]", ";", "}" ]
Get a match by position. @param int $matchPosition @return Match|null
[ "Get", "a", "match", "by", "position", "." ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Dto/MatchList.php#L46-L54
221,561
neos/fluid
Classes/TYPO3/Fluid/ViewHelpers/Form/SelectViewHelper.php
SelectViewHelper.getTranslatedLabel
protected function getTranslatedLabel($value, $label) { $translationConfiguration = $this->arguments['translate']; $translateBy = isset($translationConfiguration['by']) ? $translationConfiguration['by'] : 'id'; $sourceName = isset($translationConfiguration['source']) ? $translationConfiguration['source'] : 'Main'; $request = $this->controllerContext->getRequest(); $packageKey = null; if (isset($translationConfiguration['package'])) { $packageKey = $translationConfiguration['package']; } elseif ($request instanceof ActionRequest) { $packageKey = $request->getControllerPackageKey(); } $prefix = isset($translationConfiguration['prefix']) ? $translationConfiguration['prefix'] : ''; if (isset($translationConfiguration['locale'])) { try { $localeObject = new Locale($translationConfiguration['locale']); } catch (InvalidLocaleIdentifierException $e) { throw new ViewHelper\Exception('"' . $translationConfiguration['locale'] . '" is not a valid locale identifier.', 1330013193); } } else { $localeObject = null; } switch ($translateBy) { case 'label': $label = isset($translationConfiguration['using']) && $translationConfiguration['using'] === 'value' ? $value : $label; return $this->translator->translateByOriginalLabel($label, array(), null, $localeObject, $sourceName, $packageKey); case 'id': $id = $prefix . (isset($translationConfiguration['using']) && $translationConfiguration['using'] === 'label' ? $label : $value); $translation = $this->translator->translateById($id, array(), null, $localeObject, $sourceName, $packageKey); return ($translation !== null) ? $translation : $label; default: throw new ViewHelper\Exception('You can only request to translate by "label" or by "id", but asked for "' . $translateBy . '" in your SelectViewHelper tag.', 1340050647); } }
php
protected function getTranslatedLabel($value, $label) { $translationConfiguration = $this->arguments['translate']; $translateBy = isset($translationConfiguration['by']) ? $translationConfiguration['by'] : 'id'; $sourceName = isset($translationConfiguration['source']) ? $translationConfiguration['source'] : 'Main'; $request = $this->controllerContext->getRequest(); $packageKey = null; if (isset($translationConfiguration['package'])) { $packageKey = $translationConfiguration['package']; } elseif ($request instanceof ActionRequest) { $packageKey = $request->getControllerPackageKey(); } $prefix = isset($translationConfiguration['prefix']) ? $translationConfiguration['prefix'] : ''; if (isset($translationConfiguration['locale'])) { try { $localeObject = new Locale($translationConfiguration['locale']); } catch (InvalidLocaleIdentifierException $e) { throw new ViewHelper\Exception('"' . $translationConfiguration['locale'] . '" is not a valid locale identifier.', 1330013193); } } else { $localeObject = null; } switch ($translateBy) { case 'label': $label = isset($translationConfiguration['using']) && $translationConfiguration['using'] === 'value' ? $value : $label; return $this->translator->translateByOriginalLabel($label, array(), null, $localeObject, $sourceName, $packageKey); case 'id': $id = $prefix . (isset($translationConfiguration['using']) && $translationConfiguration['using'] === 'label' ? $label : $value); $translation = $this->translator->translateById($id, array(), null, $localeObject, $sourceName, $packageKey); return ($translation !== null) ? $translation : $label; default: throw new ViewHelper\Exception('You can only request to translate by "label" or by "id", but asked for "' . $translateBy . '" in your SelectViewHelper tag.', 1340050647); } }
[ "protected", "function", "getTranslatedLabel", "(", "$", "value", ",", "$", "label", ")", "{", "$", "translationConfiguration", "=", "$", "this", "->", "arguments", "[", "'translate'", "]", ";", "$", "translateBy", "=", "isset", "(", "$", "translationConfiguration", "[", "'by'", "]", ")", "?", "$", "translationConfiguration", "[", "'by'", "]", ":", "'id'", ";", "$", "sourceName", "=", "isset", "(", "$", "translationConfiguration", "[", "'source'", "]", ")", "?", "$", "translationConfiguration", "[", "'source'", "]", ":", "'Main'", ";", "$", "request", "=", "$", "this", "->", "controllerContext", "->", "getRequest", "(", ")", ";", "$", "packageKey", "=", "null", ";", "if", "(", "isset", "(", "$", "translationConfiguration", "[", "'package'", "]", ")", ")", "{", "$", "packageKey", "=", "$", "translationConfiguration", "[", "'package'", "]", ";", "}", "elseif", "(", "$", "request", "instanceof", "ActionRequest", ")", "{", "$", "packageKey", "=", "$", "request", "->", "getControllerPackageKey", "(", ")", ";", "}", "$", "prefix", "=", "isset", "(", "$", "translationConfiguration", "[", "'prefix'", "]", ")", "?", "$", "translationConfiguration", "[", "'prefix'", "]", ":", "''", ";", "if", "(", "isset", "(", "$", "translationConfiguration", "[", "'locale'", "]", ")", ")", "{", "try", "{", "$", "localeObject", "=", "new", "Locale", "(", "$", "translationConfiguration", "[", "'locale'", "]", ")", ";", "}", "catch", "(", "InvalidLocaleIdentifierException", "$", "e", ")", "{", "throw", "new", "ViewHelper", "\\", "Exception", "(", "'\"'", ".", "$", "translationConfiguration", "[", "'locale'", "]", ".", "'\" is not a valid locale identifier.'", ",", "1330013193", ")", ";", "}", "}", "else", "{", "$", "localeObject", "=", "null", ";", "}", "switch", "(", "$", "translateBy", ")", "{", "case", "'label'", ":", "$", "label", "=", "isset", "(", "$", "translationConfiguration", "[", "'using'", "]", ")", "&&", "$", "translationConfiguration", "[", "'using'", "]", "===", "'value'", "?", "$", "value", ":", "$", "label", ";", "return", "$", "this", "->", "translator", "->", "translateByOriginalLabel", "(", "$", "label", ",", "array", "(", ")", ",", "null", ",", "$", "localeObject", ",", "$", "sourceName", ",", "$", "packageKey", ")", ";", "case", "'id'", ":", "$", "id", "=", "$", "prefix", ".", "(", "isset", "(", "$", "translationConfiguration", "[", "'using'", "]", ")", "&&", "$", "translationConfiguration", "[", "'using'", "]", "===", "'label'", "?", "$", "label", ":", "$", "value", ")", ";", "$", "translation", "=", "$", "this", "->", "translator", "->", "translateById", "(", "$", "id", ",", "array", "(", ")", ",", "null", ",", "$", "localeObject", ",", "$", "sourceName", ",", "$", "packageKey", ")", ";", "return", "(", "$", "translation", "!==", "null", ")", "?", "$", "translation", ":", "$", "label", ";", "default", ":", "throw", "new", "ViewHelper", "\\", "Exception", "(", "'You can only request to translate by \"label\" or by \"id\", but asked for \"'", ".", "$", "translateBy", ".", "'\" in your SelectViewHelper tag.'", ",", "1340050647", ")", ";", "}", "}" ]
Returns a translated version of the given label @param string $value option tag value @param string $label option tag label @return string @throws ViewHelper\Exception @throws Fluid\Exception
[ "Returns", "a", "translated", "version", "of", "the", "given", "label" ]
ded6be84a9487f7e0e204703a30b12d2c58c0efd
https://github.com/neos/fluid/blob/ded6be84a9487f7e0e204703a30b12d2c58c0efd/Classes/TYPO3/Fluid/ViewHelpers/Form/SelectViewHelper.php#L372-L408
221,562
radphp/radphp
src/OAuthentication/OAuthProviderFactory.php
OAuthProviderFactory.create
public static function create($oAuthProvider) { if (strpos($oAuthProvider, '\\') !== false) { if (class_exists($oAuthProvider)) { $providerInstance = new $oAuthProvider(); if (!($providerInstance instanceof AbstractOAuthProvider)) { throw new Exception( sprintf( 'OAuth provider "%s" must be extend "AbstractOAuthProvider".', $oAuthProvider ) ); } return $providerInstance; } else { throw new Exception(sprintf('OAuth provider "%s" does not exist.', $oAuthProvider)); } } $oAuthClass = 'Rad\\OAuthentication\\Provider\\' . Inflection::camelize($oAuthProvider) . 'Provider'; if (class_exists($oAuthClass)) { return new $oAuthClass(); } else { throw new Exception(sprintf('OAuth provider "%s" does not exist.', $oAuthClass)); } }
php
public static function create($oAuthProvider) { if (strpos($oAuthProvider, '\\') !== false) { if (class_exists($oAuthProvider)) { $providerInstance = new $oAuthProvider(); if (!($providerInstance instanceof AbstractOAuthProvider)) { throw new Exception( sprintf( 'OAuth provider "%s" must be extend "AbstractOAuthProvider".', $oAuthProvider ) ); } return $providerInstance; } else { throw new Exception(sprintf('OAuth provider "%s" does not exist.', $oAuthProvider)); } } $oAuthClass = 'Rad\\OAuthentication\\Provider\\' . Inflection::camelize($oAuthProvider) . 'Provider'; if (class_exists($oAuthClass)) { return new $oAuthClass(); } else { throw new Exception(sprintf('OAuth provider "%s" does not exist.', $oAuthClass)); } }
[ "public", "static", "function", "create", "(", "$", "oAuthProvider", ")", "{", "if", "(", "strpos", "(", "$", "oAuthProvider", ",", "'\\\\'", ")", "!==", "false", ")", "{", "if", "(", "class_exists", "(", "$", "oAuthProvider", ")", ")", "{", "$", "providerInstance", "=", "new", "$", "oAuthProvider", "(", ")", ";", "if", "(", "!", "(", "$", "providerInstance", "instanceof", "AbstractOAuthProvider", ")", ")", "{", "throw", "new", "Exception", "(", "sprintf", "(", "'OAuth provider \"%s\" must be extend \"AbstractOAuthProvider\".'", ",", "$", "oAuthProvider", ")", ")", ";", "}", "return", "$", "providerInstance", ";", "}", "else", "{", "throw", "new", "Exception", "(", "sprintf", "(", "'OAuth provider \"%s\" does not exist.'", ",", "$", "oAuthProvider", ")", ")", ";", "}", "}", "$", "oAuthClass", "=", "'Rad\\\\OAuthentication\\\\Provider\\\\'", ".", "Inflection", "::", "camelize", "(", "$", "oAuthProvider", ")", ".", "'Provider'", ";", "if", "(", "class_exists", "(", "$", "oAuthClass", ")", ")", "{", "return", "new", "$", "oAuthClass", "(", ")", ";", "}", "else", "{", "throw", "new", "Exception", "(", "sprintf", "(", "'OAuth provider \"%s\" does not exist.'", ",", "$", "oAuthClass", ")", ")", ";", "}", "}" ]
Create OAuth provider @param string $oAuthProvider @return AbstractOAuthProvider @throws Exception
[ "Create", "OAuth", "provider" ]
2cbde2c12dd7204b1aba3f8a6e351b287ae85f0a
https://github.com/radphp/radphp/blob/2cbde2c12dd7204b1aba3f8a6e351b287ae85f0a/src/OAuthentication/OAuthProviderFactory.php#L22-L50
221,563
twizoapi/lib-api-php
examples/util/Bootstrap.php
Bootstrap.init
public function init() { error_reporting(E_ALL); ini_set('display_errors', 1); // Load composer auto loader or when not available the Twizo auto loader if (file_exists($this->baseDir . '/vendor/autoload.php')) { require_once($this->baseDir . '/vendor/autoload.php'); } else { require_once($this->baseDir . '/autoload.php'); } require_once($this->baseDir . '/examples/util/EntityFormatter.php'); }
php
public function init() { error_reporting(E_ALL); ini_set('display_errors', 1); // Load composer auto loader or when not available the Twizo auto loader if (file_exists($this->baseDir . '/vendor/autoload.php')) { require_once($this->baseDir . '/vendor/autoload.php'); } else { require_once($this->baseDir . '/autoload.php'); } require_once($this->baseDir . '/examples/util/EntityFormatter.php'); }
[ "public", "function", "init", "(", ")", "{", "error_reporting", "(", "E_ALL", ")", ";", "ini_set", "(", "'display_errors'", ",", "1", ")", ";", "// Load composer auto loader or when not available the Twizo auto loader", "if", "(", "file_exists", "(", "$", "this", "->", "baseDir", ".", "'/vendor/autoload.php'", ")", ")", "{", "require_once", "(", "$", "this", "->", "baseDir", ".", "'/vendor/autoload.php'", ")", ";", "}", "else", "{", "require_once", "(", "$", "this", "->", "baseDir", ".", "'/autoload.php'", ")", ";", "}", "require_once", "(", "$", "this", "->", "baseDir", ".", "'/examples/util/EntityFormatter.php'", ")", ";", "}" ]
Configure php to display errors and load all required file
[ "Configure", "php", "to", "display", "errors", "and", "load", "all", "required", "file" ]
2e545d859784184138332c9b5bfc063940e3c926
https://github.com/twizoapi/lib-api-php/blob/2e545d859784184138332c9b5bfc063940e3c926/examples/util/Bootstrap.php#L38-L51
221,564
twizoapi/lib-api-php
examples/util/Bootstrap.php
Bootstrap.loadConfig
public function loadConfig() { // Load / create config file if (file_exists($this->baseDir . '/examples/config.php')) { include_once($this->baseDir . '/examples/config.php'); } else { define('SECRET', readline('Secret: ')); define('API_HOST', readline('Api host: ')); $configTemplate = "<?php" . PHP_EOL . "define('SECRET', %s);" . PHP_EOL . "define('API_HOST', %s);" . PHP_EOL; file_put_contents( $this->baseDir . '/examples/config.php', sprintf( $configTemplate, var_export(SECRET, true), var_export(API_HOST, true) ) ); } }
php
public function loadConfig() { // Load / create config file if (file_exists($this->baseDir . '/examples/config.php')) { include_once($this->baseDir . '/examples/config.php'); } else { define('SECRET', readline('Secret: ')); define('API_HOST', readline('Api host: ')); $configTemplate = "<?php" . PHP_EOL . "define('SECRET', %s);" . PHP_EOL . "define('API_HOST', %s);" . PHP_EOL; file_put_contents( $this->baseDir . '/examples/config.php', sprintf( $configTemplate, var_export(SECRET, true), var_export(API_HOST, true) ) ); } }
[ "public", "function", "loadConfig", "(", ")", "{", "// Load / create config file", "if", "(", "file_exists", "(", "$", "this", "->", "baseDir", ".", "'/examples/config.php'", ")", ")", "{", "include_once", "(", "$", "this", "->", "baseDir", ".", "'/examples/config.php'", ")", ";", "}", "else", "{", "define", "(", "'SECRET'", ",", "readline", "(", "'Secret: '", ")", ")", ";", "define", "(", "'API_HOST'", ",", "readline", "(", "'Api host: '", ")", ")", ";", "$", "configTemplate", "=", "\"<?php\"", ".", "PHP_EOL", ".", "\"define('SECRET', %s);\"", ".", "PHP_EOL", ".", "\"define('API_HOST', %s);\"", ".", "PHP_EOL", ";", "file_put_contents", "(", "$", "this", "->", "baseDir", ".", "'/examples/config.php'", ",", "sprintf", "(", "$", "configTemplate", ",", "var_export", "(", "SECRET", ",", "true", ")", ",", "var_export", "(", "API_HOST", ",", "true", ")", ")", ")", ";", "}", "}" ]
Load config file when it exists; otherwise create it by asking the user on command line for the required files
[ "Load", "config", "file", "when", "it", "exists", ";", "otherwise", "create", "it", "by", "asking", "the", "user", "on", "command", "line", "for", "the", "required", "files" ]
2e545d859784184138332c9b5bfc063940e3c926
https://github.com/twizoapi/lib-api-php/blob/2e545d859784184138332c9b5bfc063940e3c926/examples/util/Bootstrap.php#L56-L78
221,565
neos/fluid
Classes/TYPO3/Fluid/ViewHelpers/Format/BytesViewHelper.php
BytesViewHelper.render
public function render($value = null, $decimals = 0, $decimalSeparator = '.', $thousandsSeparator = ',') { return self::renderStatic(array('value' => $value, 'decimals' => $decimals, 'decimalSeparator' => $decimalSeparator, 'thousandsSeparator' => $thousandsSeparator), $this->buildRenderChildrenClosure(), $this->renderingContext); }
php
public function render($value = null, $decimals = 0, $decimalSeparator = '.', $thousandsSeparator = ',') { return self::renderStatic(array('value' => $value, 'decimals' => $decimals, 'decimalSeparator' => $decimalSeparator, 'thousandsSeparator' => $thousandsSeparator), $this->buildRenderChildrenClosure(), $this->renderingContext); }
[ "public", "function", "render", "(", "$", "value", "=", "null", ",", "$", "decimals", "=", "0", ",", "$", "decimalSeparator", "=", "'.'", ",", "$", "thousandsSeparator", "=", "','", ")", "{", "return", "self", "::", "renderStatic", "(", "array", "(", "'value'", "=>", "$", "value", ",", "'decimals'", "=>", "$", "decimals", ",", "'decimalSeparator'", "=>", "$", "decimalSeparator", ",", "'thousandsSeparator'", "=>", "$", "thousandsSeparator", ")", ",", "$", "this", "->", "buildRenderChildrenClosure", "(", ")", ",", "$", "this", "->", "renderingContext", ")", ";", "}" ]
Render the supplied byte count as a human readable string. @param integer $value The incoming data to convert, or NULL if VH children should be used @param integer $decimals The number of digits after the decimal point @param string $decimalSeparator The decimal point character @param string $thousandsSeparator The character for grouping the thousand digits @return string Formatted byte count @api
[ "Render", "the", "supplied", "byte", "count", "as", "a", "human", "readable", "string", "." ]
ded6be84a9487f7e0e204703a30b12d2c58c0efd
https://github.com/neos/fluid/blob/ded6be84a9487f7e0e204703a30b12d2c58c0efd/Classes/TYPO3/Fluid/ViewHelpers/Format/BytesViewHelper.php#L54-L57
221,566
neos/fluid
Classes/TYPO3/Fluid/ViewHelpers/LayoutViewHelper.php
LayoutViewHelper.postParseEvent
public static function postParseEvent(ViewHelperNode $syntaxTreeNode, array $viewHelperArguments, TemplateVariableContainer $variableContainer) { if (isset($viewHelperArguments['name'])) { $layoutNameNode = $viewHelperArguments['name']; } else { $layoutNameNode = new TextNode('Default'); } $variableContainer->add('layoutName', $layoutNameNode); }
php
public static function postParseEvent(ViewHelperNode $syntaxTreeNode, array $viewHelperArguments, TemplateVariableContainer $variableContainer) { if (isset($viewHelperArguments['name'])) { $layoutNameNode = $viewHelperArguments['name']; } else { $layoutNameNode = new TextNode('Default'); } $variableContainer->add('layoutName', $layoutNameNode); }
[ "public", "static", "function", "postParseEvent", "(", "ViewHelperNode", "$", "syntaxTreeNode", ",", "array", "$", "viewHelperArguments", ",", "TemplateVariableContainer", "$", "variableContainer", ")", "{", "if", "(", "isset", "(", "$", "viewHelperArguments", "[", "'name'", "]", ")", ")", "{", "$", "layoutNameNode", "=", "$", "viewHelperArguments", "[", "'name'", "]", ";", "}", "else", "{", "$", "layoutNameNode", "=", "new", "TextNode", "(", "'Default'", ")", ";", "}", "$", "variableContainer", "->", "add", "(", "'layoutName'", ",", "$", "layoutNameNode", ")", ";", "}" ]
On the post parse event, add the "layoutName" variable to the variable container so it can be used by the TemplateView. @param ViewHelperNode $syntaxTreeNode @param array $viewHelperArguments @param TemplateVariableContainer $variableContainer @return void
[ "On", "the", "post", "parse", "event", "add", "the", "layoutName", "variable", "to", "the", "variable", "container", "so", "it", "can", "be", "used", "by", "the", "TemplateView", "." ]
ded6be84a9487f7e0e204703a30b12d2c58c0efd
https://github.com/neos/fluid/blob/ded6be84a9487f7e0e204703a30b12d2c58c0efd/Classes/TYPO3/Fluid/ViewHelpers/LayoutViewHelper.php#L55-L64
221,567
neos/fluid
Classes/TYPO3/Fluid/ViewHelpers/FlashMessagesViewHelper.php
FlashMessagesViewHelper.renderAsList
protected function renderAsList(array $flashMessages) { $flashMessagesClass = $this->arguments['class'] !== null ? $this->arguments['class'] : 'flashmessages'; $tagContent = ''; /** @var $singleFlashMessage Message */ foreach ($flashMessages as $singleFlashMessage) { $severityClass = sprintf('%s-%s', $flashMessagesClass, strtolower($singleFlashMessage->getSeverity())); $messageContent = htmlspecialchars($singleFlashMessage->render()); if ($singleFlashMessage->getTitle() !== '') { $messageContent = sprintf('<h3>%s</h3>', htmlspecialchars($singleFlashMessage->getTitle())) . $messageContent; } $tagContent .= sprintf('<li class="%s">%s</li>', htmlspecialchars($severityClass), $messageContent); } $this->tag->setContent($tagContent); $content = $this->tag->render(); return $content; }
php
protected function renderAsList(array $flashMessages) { $flashMessagesClass = $this->arguments['class'] !== null ? $this->arguments['class'] : 'flashmessages'; $tagContent = ''; /** @var $singleFlashMessage Message */ foreach ($flashMessages as $singleFlashMessage) { $severityClass = sprintf('%s-%s', $flashMessagesClass, strtolower($singleFlashMessage->getSeverity())); $messageContent = htmlspecialchars($singleFlashMessage->render()); if ($singleFlashMessage->getTitle() !== '') { $messageContent = sprintf('<h3>%s</h3>', htmlspecialchars($singleFlashMessage->getTitle())) . $messageContent; } $tagContent .= sprintf('<li class="%s">%s</li>', htmlspecialchars($severityClass), $messageContent); } $this->tag->setContent($tagContent); $content = $this->tag->render(); return $content; }
[ "protected", "function", "renderAsList", "(", "array", "$", "flashMessages", ")", "{", "$", "flashMessagesClass", "=", "$", "this", "->", "arguments", "[", "'class'", "]", "!==", "null", "?", "$", "this", "->", "arguments", "[", "'class'", "]", ":", "'flashmessages'", ";", "$", "tagContent", "=", "''", ";", "/** @var $singleFlashMessage Message */", "foreach", "(", "$", "flashMessages", "as", "$", "singleFlashMessage", ")", "{", "$", "severityClass", "=", "sprintf", "(", "'%s-%s'", ",", "$", "flashMessagesClass", ",", "strtolower", "(", "$", "singleFlashMessage", "->", "getSeverity", "(", ")", ")", ")", ";", "$", "messageContent", "=", "htmlspecialchars", "(", "$", "singleFlashMessage", "->", "render", "(", ")", ")", ";", "if", "(", "$", "singleFlashMessage", "->", "getTitle", "(", ")", "!==", "''", ")", "{", "$", "messageContent", "=", "sprintf", "(", "'<h3>%s</h3>'", ",", "htmlspecialchars", "(", "$", "singleFlashMessage", "->", "getTitle", "(", ")", ")", ")", ".", "$", "messageContent", ";", "}", "$", "tagContent", ".=", "sprintf", "(", "'<li class=\"%s\">%s</li>'", ",", "htmlspecialchars", "(", "$", "severityClass", ")", ",", "$", "messageContent", ")", ";", "}", "$", "this", "->", "tag", "->", "setContent", "(", "$", "tagContent", ")", ";", "$", "content", "=", "$", "this", "->", "tag", "->", "render", "(", ")", ";", "return", "$", "content", ";", "}" ]
Render the flash messages as unsorted list. This is triggered if no "as" argument is given to the ViewHelper. @param array<Message> $flashMessages @return string
[ "Render", "the", "flash", "messages", "as", "unsorted", "list", ".", "This", "is", "triggered", "if", "no", "as", "argument", "is", "given", "to", "the", "ViewHelper", "." ]
ded6be84a9487f7e0e204703a30b12d2c58c0efd
https://github.com/neos/fluid/blob/ded6be84a9487f7e0e204703a30b12d2c58c0efd/Classes/TYPO3/Fluid/ViewHelpers/FlashMessagesViewHelper.php#L110-L127
221,568
neos/fluid
Classes/TYPO3/Fluid/ViewHelpers/FlashMessagesViewHelper.php
FlashMessagesViewHelper.renderFromTemplate
protected function renderFromTemplate(array $flashMessages, $as) { $templateVariableContainer = $this->renderingContext->getTemplateVariableContainer(); $templateVariableContainer->add($as, $flashMessages); $content = $this->renderChildren(); $templateVariableContainer->remove($as); return $content; }
php
protected function renderFromTemplate(array $flashMessages, $as) { $templateVariableContainer = $this->renderingContext->getTemplateVariableContainer(); $templateVariableContainer->add($as, $flashMessages); $content = $this->renderChildren(); $templateVariableContainer->remove($as); return $content; }
[ "protected", "function", "renderFromTemplate", "(", "array", "$", "flashMessages", ",", "$", "as", ")", "{", "$", "templateVariableContainer", "=", "$", "this", "->", "renderingContext", "->", "getTemplateVariableContainer", "(", ")", ";", "$", "templateVariableContainer", "->", "add", "(", "$", "as", ",", "$", "flashMessages", ")", ";", "$", "content", "=", "$", "this", "->", "renderChildren", "(", ")", ";", "$", "templateVariableContainer", "->", "remove", "(", "$", "as", ")", ";", "return", "$", "content", ";", "}" ]
Defer the rendering of Flash Messages to the template. In this case, the flash messages are stored in the template inside the variable specified in "as". @param array $flashMessages @param string $as @return string
[ "Defer", "the", "rendering", "of", "Flash", "Messages", "to", "the", "template", ".", "In", "this", "case", "the", "flash", "messages", "are", "stored", "in", "the", "template", "inside", "the", "variable", "specified", "in", "as", "." ]
ded6be84a9487f7e0e204703a30b12d2c58c0efd
https://github.com/neos/fluid/blob/ded6be84a9487f7e0e204703a30b12d2c58c0efd/Classes/TYPO3/Fluid/ViewHelpers/FlashMessagesViewHelper.php#L138-L146
221,569
paquettg/leaguewrap
src/LeagueWrap/Dto/CurrentGame.php
CurrentGame.ban
public function ban($pickTurn) { $bans = $this->info['bannedChampions']; if (isset($bans[$pickTurn])) { return $bans[$pickTurn]; } return null; }
php
public function ban($pickTurn) { $bans = $this->info['bannedChampions']; if (isset($bans[$pickTurn])) { return $bans[$pickTurn]; } return null; }
[ "public", "function", "ban", "(", "$", "pickTurn", ")", "{", "$", "bans", "=", "$", "this", "->", "info", "[", "'bannedChampions'", "]", ";", "if", "(", "isset", "(", "$", "bans", "[", "$", "pickTurn", "]", ")", ")", "{", "return", "$", "bans", "[", "$", "pickTurn", "]", ";", "}", "return", "null", ";", "}" ]
get a ban from the current game @param $pickTurn @return \LeagueWrap\Dto\Ban
[ "get", "a", "ban", "from", "the", "current", "game" ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Dto/CurrentGame.php#L57-L66
221,570
paquettg/leaguewrap
src/LeagueWrap/Dto/CurrentGame.php
CurrentGame.participant
public function participant($summonerId) { $participant = $this->info['participants']; if (isset($participant[$summonerId])) { return $participant[$summonerId]; } return null; }
php
public function participant($summonerId) { $participant = $this->info['participants']; if (isset($participant[$summonerId])) { return $participant[$summonerId]; } return null; }
[ "public", "function", "participant", "(", "$", "summonerId", ")", "{", "$", "participant", "=", "$", "this", "->", "info", "[", "'participants'", "]", ";", "if", "(", "isset", "(", "$", "participant", "[", "$", "summonerId", "]", ")", ")", "{", "return", "$", "participant", "[", "$", "summonerId", "]", ";", "}", "return", "null", ";", "}" ]
Gets the participant by the given summoner id. @param $summonerId @return \LeagueWrap\Dto\CurrentGameParticipant|null
[ "Gets", "the", "participant", "by", "the", "given", "summoner", "id", "." ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Dto/CurrentGame.php#L74-L83
221,571
paquettg/leaguewrap
src/LeagueWrap/Api/League.php
League.challenger
public function challenger($type = 'RANKED_SOLO_5x5') { $info = $this->request('league/challenger', ['type' => $type]); $info['id'] = null; return $this->attachStaticDataToDto(new Dto\League($info)); }
php
public function challenger($type = 'RANKED_SOLO_5x5') { $info = $this->request('league/challenger', ['type' => $type]); $info['id'] = null; return $this->attachStaticDataToDto(new Dto\League($info)); }
[ "public", "function", "challenger", "(", "$", "type", "=", "'RANKED_SOLO_5x5'", ")", "{", "$", "info", "=", "$", "this", "->", "request", "(", "'league/challenger'", ",", "[", "'type'", "=>", "$", "type", "]", ")", ";", "$", "info", "[", "'id'", "]", "=", "null", ";", "return", "$", "this", "->", "attachStaticDataToDto", "(", "new", "Dto", "\\", "League", "(", "$", "info", ")", ")", ";", "}" ]
Gets the league information for the challenger teams. @param string $type @return array
[ "Gets", "the", "league", "information", "for", "the", "challenger", "teams", "." ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Api/League.php#L118-L124
221,572
neos/fluid
Classes/TYPO3/Fluid/Core/Compiler/AbstractCompiledTemplate.php
AbstractCompiledTemplate.getViewHelper
public function getViewHelper($uniqueCounter, RenderingContextInterface $renderingContext, $viewHelperName) { if (Bootstrap::$staticObjectManager->getScope($viewHelperName) === Configuration::SCOPE_SINGLETON) { // if ViewHelper is Singleton, do NOT instantiate with NEW, but re-use it. $viewHelper = Bootstrap::$staticObjectManager->get($viewHelperName); $viewHelper->resetState(); return $viewHelper; } if (isset($this->viewHelpersByPositionAndContext[$uniqueCounter])) { /** @var $viewHelpers \SplObjectStorage */ $viewHelpers = $this->viewHelpersByPositionAndContext[$uniqueCounter]; if ($viewHelpers->contains($renderingContext)) { $viewHelper = $viewHelpers->offsetGet($renderingContext); $viewHelper->resetState(); return $viewHelper; } else { $viewHelperInstance = new $viewHelperName; $viewHelpers->attach($renderingContext, $viewHelperInstance); return $viewHelperInstance; } } else { $viewHelperInstance = new $viewHelperName; $viewHelpers = new \SplObjectStorage(); $viewHelpers->attach($renderingContext, $viewHelperInstance); $this->viewHelpersByPositionAndContext[$uniqueCounter] = $viewHelpers; return $viewHelperInstance; } }
php
public function getViewHelper($uniqueCounter, RenderingContextInterface $renderingContext, $viewHelperName) { if (Bootstrap::$staticObjectManager->getScope($viewHelperName) === Configuration::SCOPE_SINGLETON) { // if ViewHelper is Singleton, do NOT instantiate with NEW, but re-use it. $viewHelper = Bootstrap::$staticObjectManager->get($viewHelperName); $viewHelper->resetState(); return $viewHelper; } if (isset($this->viewHelpersByPositionAndContext[$uniqueCounter])) { /** @var $viewHelpers \SplObjectStorage */ $viewHelpers = $this->viewHelpersByPositionAndContext[$uniqueCounter]; if ($viewHelpers->contains($renderingContext)) { $viewHelper = $viewHelpers->offsetGet($renderingContext); $viewHelper->resetState(); return $viewHelper; } else { $viewHelperInstance = new $viewHelperName; $viewHelpers->attach($renderingContext, $viewHelperInstance); return $viewHelperInstance; } } else { $viewHelperInstance = new $viewHelperName; $viewHelpers = new \SplObjectStorage(); $viewHelpers->attach($renderingContext, $viewHelperInstance); $this->viewHelpersByPositionAndContext[$uniqueCounter] = $viewHelpers; return $viewHelperInstance; } }
[ "public", "function", "getViewHelper", "(", "$", "uniqueCounter", ",", "RenderingContextInterface", "$", "renderingContext", ",", "$", "viewHelperName", ")", "{", "if", "(", "Bootstrap", "::", "$", "staticObjectManager", "->", "getScope", "(", "$", "viewHelperName", ")", "===", "Configuration", "::", "SCOPE_SINGLETON", ")", "{", "// if ViewHelper is Singleton, do NOT instantiate with NEW, but re-use it.", "$", "viewHelper", "=", "Bootstrap", "::", "$", "staticObjectManager", "->", "get", "(", "$", "viewHelperName", ")", ";", "$", "viewHelper", "->", "resetState", "(", ")", ";", "return", "$", "viewHelper", ";", "}", "if", "(", "isset", "(", "$", "this", "->", "viewHelpersByPositionAndContext", "[", "$", "uniqueCounter", "]", ")", ")", "{", "/** @var $viewHelpers \\SplObjectStorage */", "$", "viewHelpers", "=", "$", "this", "->", "viewHelpersByPositionAndContext", "[", "$", "uniqueCounter", "]", ";", "if", "(", "$", "viewHelpers", "->", "contains", "(", "$", "renderingContext", ")", ")", "{", "$", "viewHelper", "=", "$", "viewHelpers", "->", "offsetGet", "(", "$", "renderingContext", ")", ";", "$", "viewHelper", "->", "resetState", "(", ")", ";", "return", "$", "viewHelper", ";", "}", "else", "{", "$", "viewHelperInstance", "=", "new", "$", "viewHelperName", ";", "$", "viewHelpers", "->", "attach", "(", "$", "renderingContext", ",", "$", "viewHelperInstance", ")", ";", "return", "$", "viewHelperInstance", ";", "}", "}", "else", "{", "$", "viewHelperInstance", "=", "new", "$", "viewHelperName", ";", "$", "viewHelpers", "=", "new", "\\", "SplObjectStorage", "(", ")", ";", "$", "viewHelpers", "->", "attach", "(", "$", "renderingContext", ",", "$", "viewHelperInstance", ")", ";", "$", "this", "->", "viewHelpersByPositionAndContext", "[", "$", "uniqueCounter", "]", "=", "$", "viewHelpers", ";", "return", "$", "viewHelperInstance", ";", "}", "}" ]
Public such that it is callable from within closures @param integer $uniqueCounter @param RenderingContextInterface $renderingContext @param string $viewHelperName @return AbstractViewHelper @Flow\Internal
[ "Public", "such", "that", "it", "is", "callable", "from", "within", "closures" ]
ded6be84a9487f7e0e204703a30b12d2c58c0efd
https://github.com/neos/fluid/blob/ded6be84a9487f7e0e204703a30b12d2c58c0efd/Classes/TYPO3/Fluid/Core/Compiler/AbstractCompiledTemplate.php#L42-L69
221,573
twizoapi/lib-api-php
src/Entity/Sms.php
Sms.isBinary
protected function isBinary() { $binary = false; if (($this->dcs & 200) === 0) { $binary = (($this->dcs & 4) > 0); } elseif (($this->dcs & 248) === 240) { $binary = (($this->dcs & 4) > 0); } return $binary; }
php
protected function isBinary() { $binary = false; if (($this->dcs & 200) === 0) { $binary = (($this->dcs & 4) > 0); } elseif (($this->dcs & 248) === 240) { $binary = (($this->dcs & 4) > 0); } return $binary; }
[ "protected", "function", "isBinary", "(", ")", "{", "$", "binary", "=", "false", ";", "if", "(", "(", "$", "this", "->", "dcs", "&", "200", ")", "===", "0", ")", "{", "$", "binary", "=", "(", "(", "$", "this", "->", "dcs", "&", "4", ")", ">", "0", ")", ";", "}", "elseif", "(", "(", "$", "this", "->", "dcs", "&", "248", ")", "===", "240", ")", "{", "$", "binary", "=", "(", "(", "$", "this", "->", "dcs", "&", "4", ")", ">", "0", ")", ";", "}", "return", "$", "binary", ";", "}" ]
Return true if the sms has been configured as binary message @return bool
[ "Return", "true", "if", "the", "sms", "has", "been", "configured", "as", "binary", "message" ]
2e545d859784184138332c9b5bfc063940e3c926
https://github.com/twizoapi/lib-api-php/blob/2e545d859784184138332c9b5bfc063940e3c926/src/Entity/Sms.php#L382-L393
221,574
twizoapi/lib-api-php
src/Entity/Sms.php
Sms.sendSimple
public function sendSimple() { $this->setType(self::TYPE_SIMPLE); $response = $this->sendApiCall(self::ACTION_CREATE, $this->getCreateUrl()); if (!isset($response->getBody()['_embedded']['items'])) { throw new Exception('Invalid response returned from server', Exception::INVALID_RESPONSE); } $result = array(); foreach ($response->getBody()['_embedded']['items'] as $item) { $result[] = $sms = new Sms($this->client, $this->factory); $sms->setFields($item); $sms->setType(self::TYPE_SIMPLE); } return $result; }
php
public function sendSimple() { $this->setType(self::TYPE_SIMPLE); $response = $this->sendApiCall(self::ACTION_CREATE, $this->getCreateUrl()); if (!isset($response->getBody()['_embedded']['items'])) { throw new Exception('Invalid response returned from server', Exception::INVALID_RESPONSE); } $result = array(); foreach ($response->getBody()['_embedded']['items'] as $item) { $result[] = $sms = new Sms($this->client, $this->factory); $sms->setFields($item); $sms->setType(self::TYPE_SIMPLE); } return $result; }
[ "public", "function", "sendSimple", "(", ")", "{", "$", "this", "->", "setType", "(", "self", "::", "TYPE_SIMPLE", ")", ";", "$", "response", "=", "$", "this", "->", "sendApiCall", "(", "self", "::", "ACTION_CREATE", ",", "$", "this", "->", "getCreateUrl", "(", ")", ")", ";", "if", "(", "!", "isset", "(", "$", "response", "->", "getBody", "(", ")", "[", "'_embedded'", "]", "[", "'items'", "]", ")", ")", "{", "throw", "new", "Exception", "(", "'Invalid response returned from server'", ",", "Exception", "::", "INVALID_RESPONSE", ")", ";", "}", "$", "result", "=", "array", "(", ")", ";", "foreach", "(", "$", "response", "->", "getBody", "(", ")", "[", "'_embedded'", "]", "[", "'items'", "]", "as", "$", "item", ")", "{", "$", "result", "[", "]", "=", "$", "sms", "=", "new", "Sms", "(", "$", "this", "->", "client", ",", "$", "this", "->", "factory", ")", ";", "$", "sms", "->", "setFields", "(", "$", "item", ")", ";", "$", "sms", "->", "setType", "(", "self", "::", "TYPE_SIMPLE", ")", ";", "}", "return", "$", "result", ";", "}" ]
Automatically split multi part sms messages and return result sms messages @return Sms[] @throws Exception
[ "Automatically", "split", "multi", "part", "sms", "messages", "and", "return", "result", "sms", "messages" ]
2e545d859784184138332c9b5bfc063940e3c926
https://github.com/twizoapi/lib-api-php/blob/2e545d859784184138332c9b5bfc063940e3c926/src/Entity/Sms.php#L431-L448
221,575
neos/fluid
Classes/TYPO3/Fluid/ViewHelpers/Widget/UriViewHelper.php
UriViewHelper.getAjaxUri
protected function getAjaxUri() { $action = $this->arguments['action']; $arguments = $this->arguments['arguments']; if ($action === null) { $action = $this->controllerContext->getRequest()->getControllerActionName(); } $arguments['@action'] = $action; if (strlen($this->arguments['format']) > 0) { $arguments['@format'] = $this->arguments['format']; } /** @var $widgetContext WidgetContext */ $widgetContext = $this->controllerContext->getRequest()->getInternalArgument('__widgetContext'); if ($widgetContext === null) { throw new WidgetContextNotFoundException('Widget context not found in <f:widget.uri>', 1307450639); } if ($this->arguments['includeWidgetContext'] === true) { $serializedWidgetContext = base64_encode(serialize($widgetContext)); $arguments['__widgetContext'] = $this->hashService->appendHmac($serializedWidgetContext); } else { $arguments['__widgetId'] = $widgetContext->getAjaxWidgetIdentifier(); } return '?' . http_build_query($arguments, null, '&'); }
php
protected function getAjaxUri() { $action = $this->arguments['action']; $arguments = $this->arguments['arguments']; if ($action === null) { $action = $this->controllerContext->getRequest()->getControllerActionName(); } $arguments['@action'] = $action; if (strlen($this->arguments['format']) > 0) { $arguments['@format'] = $this->arguments['format']; } /** @var $widgetContext WidgetContext */ $widgetContext = $this->controllerContext->getRequest()->getInternalArgument('__widgetContext'); if ($widgetContext === null) { throw new WidgetContextNotFoundException('Widget context not found in <f:widget.uri>', 1307450639); } if ($this->arguments['includeWidgetContext'] === true) { $serializedWidgetContext = base64_encode(serialize($widgetContext)); $arguments['__widgetContext'] = $this->hashService->appendHmac($serializedWidgetContext); } else { $arguments['__widgetId'] = $widgetContext->getAjaxWidgetIdentifier(); } return '?' . http_build_query($arguments, null, '&'); }
[ "protected", "function", "getAjaxUri", "(", ")", "{", "$", "action", "=", "$", "this", "->", "arguments", "[", "'action'", "]", ";", "$", "arguments", "=", "$", "this", "->", "arguments", "[", "'arguments'", "]", ";", "if", "(", "$", "action", "===", "null", ")", "{", "$", "action", "=", "$", "this", "->", "controllerContext", "->", "getRequest", "(", ")", "->", "getControllerActionName", "(", ")", ";", "}", "$", "arguments", "[", "'@action'", "]", "=", "$", "action", ";", "if", "(", "strlen", "(", "$", "this", "->", "arguments", "[", "'format'", "]", ")", ">", "0", ")", "{", "$", "arguments", "[", "'@format'", "]", "=", "$", "this", "->", "arguments", "[", "'format'", "]", ";", "}", "/** @var $widgetContext WidgetContext */", "$", "widgetContext", "=", "$", "this", "->", "controllerContext", "->", "getRequest", "(", ")", "->", "getInternalArgument", "(", "'__widgetContext'", ")", ";", "if", "(", "$", "widgetContext", "===", "null", ")", "{", "throw", "new", "WidgetContextNotFoundException", "(", "'Widget context not found in <f:widget.uri>'", ",", "1307450639", ")", ";", "}", "if", "(", "$", "this", "->", "arguments", "[", "'includeWidgetContext'", "]", "===", "true", ")", "{", "$", "serializedWidgetContext", "=", "base64_encode", "(", "serialize", "(", "$", "widgetContext", ")", ")", ";", "$", "arguments", "[", "'__widgetContext'", "]", "=", "$", "this", "->", "hashService", "->", "appendHmac", "(", "$", "serializedWidgetContext", ")", ";", "}", "else", "{", "$", "arguments", "[", "'__widgetId'", "]", "=", "$", "widgetContext", "->", "getAjaxWidgetIdentifier", "(", ")", ";", "}", "return", "'?'", ".", "http_build_query", "(", "$", "arguments", ",", "null", ",", "'&'", ")", ";", "}" ]
Get the URI for an AJAX Request. @return string the AJAX URI @throws WidgetContextNotFoundException
[ "Get", "the", "URI", "for", "an", "AJAX", "Request", "." ]
ded6be84a9487f7e0e204703a30b12d2c58c0efd
https://github.com/neos/fluid/blob/ded6be84a9487f7e0e204703a30b12d2c58c0efd/Classes/TYPO3/Fluid/ViewHelpers/Widget/UriViewHelper.php#L73-L97
221,576
radphp/radphp
src/Events/Event.php
Event.stopImmediatePropagation
public function stopImmediatePropagation() { if ($this->isCancelable() === false) { throw new Exception(sprintf('Event "%s" not cancelable.', $this->type)); } $this->immediateStopped = true; }
php
public function stopImmediatePropagation() { if ($this->isCancelable() === false) { throw new Exception(sprintf('Event "%s" not cancelable.', $this->type)); } $this->immediateStopped = true; }
[ "public", "function", "stopImmediatePropagation", "(", ")", "{", "if", "(", "$", "this", "->", "isCancelable", "(", ")", "===", "false", ")", "{", "throw", "new", "Exception", "(", "sprintf", "(", "'Event \"%s\" not cancelable.'", ",", "$", "this", "->", "type", ")", ")", ";", "}", "$", "this", "->", "immediateStopped", "=", "true", ";", "}" ]
Keeps the rest of the handlers from being executed and prevents the event @throws Exception
[ "Keeps", "the", "rest", "of", "the", "handlers", "from", "being", "executed", "and", "prevents", "the", "event" ]
2cbde2c12dd7204b1aba3f8a6e351b287ae85f0a
https://github.com/radphp/radphp/blob/2cbde2c12dd7204b1aba3f8a6e351b287ae85f0a/src/Events/Event.php#L50-L57
221,577
paquettg/leaguewrap
src/LeagueWrap/Api/Stats.php
Stats.summary
public function summary($identity) { $summonerId = $this->extractId($identity); $params = []; if ( ! is_null($this->season)) { $params['season'] = $this->season; } $info = $this->request('stats/by-summoner/'.$summonerId.'/summary', $params); $stats = new PlayerStatsSummaryList($info); $stats = $this->attachStaticDataToDto($stats); $this->attachResponse($identity, $stats, 'stats'); return $stats; }
php
public function summary($identity) { $summonerId = $this->extractId($identity); $params = []; if ( ! is_null($this->season)) { $params['season'] = $this->season; } $info = $this->request('stats/by-summoner/'.$summonerId.'/summary', $params); $stats = new PlayerStatsSummaryList($info); $stats = $this->attachStaticDataToDto($stats); $this->attachResponse($identity, $stats, 'stats'); return $stats; }
[ "public", "function", "summary", "(", "$", "identity", ")", "{", "$", "summonerId", "=", "$", "this", "->", "extractId", "(", "$", "identity", ")", ";", "$", "params", "=", "[", "]", ";", "if", "(", "!", "is_null", "(", "$", "this", "->", "season", ")", ")", "{", "$", "params", "[", "'season'", "]", "=", "$", "this", "->", "season", ";", "}", "$", "info", "=", "$", "this", "->", "request", "(", "'stats/by-summoner/'", ".", "$", "summonerId", ".", "'/summary'", ",", "$", "params", ")", ";", "$", "stats", "=", "new", "PlayerStatsSummaryList", "(", "$", "info", ")", ";", "$", "stats", "=", "$", "this", "->", "attachStaticDataToDto", "(", "$", "stats", ")", ";", "$", "this", "->", "attachResponse", "(", "$", "identity", ",", "$", "stats", ",", "'stats'", ")", ";", "return", "$", "stats", ";", "}" ]
Gets the stats summary by summoner id. @param mixed $identity @return array
[ "Gets", "the", "stats", "summary", "by", "summoner", "id", "." ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Api/Stats.php#L79-L95
221,578
paquettg/leaguewrap
src/LeagueWrap/Api/Stats.php
Stats.ranked
public function ranked($identity) { $summonerId = $this->extractId($identity); $params = []; if ( ! is_null($this->season)) { $params['season'] = $this->season; } $info = $this->request('stats/by-summoner/'.$summonerId.'/ranked', $params); $stats = $this->attachStaticDataToDto(new RankedStats($info)); $this->attachResponse($identity, $stats, 'rankedStats'); return $stats; }
php
public function ranked($identity) { $summonerId = $this->extractId($identity); $params = []; if ( ! is_null($this->season)) { $params['season'] = $this->season; } $info = $this->request('stats/by-summoner/'.$summonerId.'/ranked', $params); $stats = $this->attachStaticDataToDto(new RankedStats($info)); $this->attachResponse($identity, $stats, 'rankedStats'); return $stats; }
[ "public", "function", "ranked", "(", "$", "identity", ")", "{", "$", "summonerId", "=", "$", "this", "->", "extractId", "(", "$", "identity", ")", ";", "$", "params", "=", "[", "]", ";", "if", "(", "!", "is_null", "(", "$", "this", "->", "season", ")", ")", "{", "$", "params", "[", "'season'", "]", "=", "$", "this", "->", "season", ";", "}", "$", "info", "=", "$", "this", "->", "request", "(", "'stats/by-summoner/'", ".", "$", "summonerId", ".", "'/ranked'", ",", "$", "params", ")", ";", "$", "stats", "=", "$", "this", "->", "attachStaticDataToDto", "(", "new", "RankedStats", "(", "$", "info", ")", ")", ";", "$", "this", "->", "attachResponse", "(", "$", "identity", ",", "$", "stats", ",", "'rankedStats'", ")", ";", "return", "$", "stats", ";", "}" ]
Gets the stats for ranked queues only by summary id. @param mixed $identity @return array
[ "Gets", "the", "stats", "for", "ranked", "queues", "only", "by", "summary", "id", "." ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Api/Stats.php#L103-L118
221,579
paquettg/leaguewrap
src/LeagueWrap/StaticApi.php
StaticApi.mount
public static function mount() { foreach (self::$staticProxy as $staticProxy) { $staticProxyObject = '\\LeagueWrap\\StaticProxy\\Static'.$staticProxy; // mount it $staticProxyObject::mount(); // freshen it up $staticProxyObject::fresh(); } }
php
public static function mount() { foreach (self::$staticProxy as $staticProxy) { $staticProxyObject = '\\LeagueWrap\\StaticProxy\\Static'.$staticProxy; // mount it $staticProxyObject::mount(); // freshen it up $staticProxyObject::fresh(); } }
[ "public", "static", "function", "mount", "(", ")", "{", "foreach", "(", "self", "::", "$", "staticProxy", "as", "$", "staticProxy", ")", "{", "$", "staticProxyObject", "=", "'\\\\LeagueWrap\\\\StaticProxy\\\\Static'", ".", "$", "staticProxy", ";", "// mount it", "$", "staticProxyObject", "::", "mount", "(", ")", ";", "// freshen it up", "$", "staticProxyObject", "::", "fresh", "(", ")", ";", "}", "}" ]
Mount all the static static proxys found in the StaticProxy directory. @return void
[ "Mount", "all", "the", "static", "static", "proxys", "found", "in", "the", "StaticProxy", "directory", "." ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/StaticApi.php#L27-L37
221,580
radphp/radphp
src/OAuthentication/User.php
User.get
public function get($key) { if (array_key_exists($key, $this->container)) { return $this->container[$key]; } return null; }
php
public function get($key) { if (array_key_exists($key, $this->container)) { return $this->container[$key]; } return null; }
[ "public", "function", "get", "(", "$", "key", ")", "{", "if", "(", "array_key_exists", "(", "$", "key", ",", "$", "this", "->", "container", ")", ")", "{", "return", "$", "this", "->", "container", "[", "$", "key", "]", ";", "}", "return", "null", ";", "}" ]
Get user detail @param string $key @return null|mixed
[ "Get", "user", "detail" ]
2cbde2c12dd7204b1aba3f8a6e351b287ae85f0a
https://github.com/radphp/radphp/blob/2cbde2c12dd7204b1aba3f8a6e351b287ae85f0a/src/OAuthentication/User.php#L168-L175
221,581
paquettg/leaguewrap
src/LeagueWrap/Dto/Match.php
Match.participant
public function participant($participantId) { $participant = $this->info['participants']; if (isset($participant[$participantId])) { return $participant[$participantId]; } return null; }
php
public function participant($participantId) { $participant = $this->info['participants']; if (isset($participant[$participantId])) { return $participant[$participantId]; } return null; }
[ "public", "function", "participant", "(", "$", "participantId", ")", "{", "$", "participant", "=", "$", "this", "->", "info", "[", "'participants'", "]", ";", "if", "(", "isset", "(", "$", "participant", "[", "$", "participantId", "]", ")", ")", "{", "return", "$", "participant", "[", "$", "participantId", "]", ";", "}", "return", "null", ";", "}" ]
Attempts to get a participant from this match. @param int $participantId @return Participant|null
[ "Attempts", "to", "get", "a", "participant", "from", "this", "match", "." ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Dto/Match.php#L80-L89
221,582
paquettg/leaguewrap
src/LeagueWrap/Dto/Match.php
Match.identity
public function identity($participantId) { $participantIdentity = $this->info['participantIdentities']; if (isset($participantIdentity[$participantId])) { return $participantIdentity[$participantId]; } return null; }
php
public function identity($participantId) { $participantIdentity = $this->info['participantIdentities']; if (isset($participantIdentity[$participantId])) { return $participantIdentity[$participantId]; } return null; }
[ "public", "function", "identity", "(", "$", "participantId", ")", "{", "$", "participantIdentity", "=", "$", "this", "->", "info", "[", "'participantIdentities'", "]", ";", "if", "(", "isset", "(", "$", "participantIdentity", "[", "$", "participantId", "]", ")", ")", "{", "return", "$", "participantIdentity", "[", "$", "participantId", "]", ";", "}", "return", "null", ";", "}" ]
Attempts to get a participant identity from this match. @param int $participantId @return ParticipantIdentity|null
[ "Attempts", "to", "get", "a", "participant", "identity", "from", "this", "match", "." ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Dto/Match.php#L97-L106
221,583
paquettg/leaguewrap
src/LeagueWrap/Dto/Match.php
Match.team
public function team($teamId) { $team = $this->info['teams']; if (isset($team[$teamId])) { return $team[$teamId]; } return null; }
php
public function team($teamId) { $team = $this->info['teams']; if (isset($team[$teamId])) { return $team[$teamId]; } return null; }
[ "public", "function", "team", "(", "$", "teamId", ")", "{", "$", "team", "=", "$", "this", "->", "info", "[", "'teams'", "]", ";", "if", "(", "isset", "(", "$", "team", "[", "$", "teamId", "]", ")", ")", "{", "return", "$", "team", "[", "$", "teamId", "]", ";", "}", "return", "null", ";", "}" ]
Attempts to get a team from this match. @param int $teamId @return Team|null
[ "Attempts", "to", "get", "a", "team", "from", "this", "match", "." ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Dto/Match.php#L114-L123
221,584
CapMousse/React-Restify
src/Http/Request.php
Request.getHeaders
public function getHeaders() { $headers = array_change_key_case($this->httpRequest->getHeaders(), CASE_LOWER); foreach ($headers as $header) { $header = array_map(function ($value) { return strtolower($value); }, $header); } return $headers; }
php
public function getHeaders() { $headers = array_change_key_case($this->httpRequest->getHeaders(), CASE_LOWER); foreach ($headers as $header) { $header = array_map(function ($value) { return strtolower($value); }, $header); } return $headers; }
[ "public", "function", "getHeaders", "(", ")", "{", "$", "headers", "=", "array_change_key_case", "(", "$", "this", "->", "httpRequest", "->", "getHeaders", "(", ")", ",", "CASE_LOWER", ")", ";", "foreach", "(", "$", "headers", "as", "$", "header", ")", "{", "$", "header", "=", "array_map", "(", "function", "(", "$", "value", ")", "{", "return", "strtolower", "(", "$", "value", ")", ";", "}", ",", "$", "header", ")", ";", "}", "return", "$", "headers", ";", "}" ]
Get formated headers @return array
[ "Get", "formated", "headers" ]
51fe94d6e4c7fafec06fb304f9e44badde4bfe71
https://github.com/CapMousse/React-Restify/blob/51fe94d6e4c7fafec06fb304f9e44badde4bfe71/src/Http/Request.php#L49-L60
221,585
CapMousse/React-Restify
src/Http/Request.php
Request.onEnd
private function onEnd($dataResult) { if ($dataResult === null) return $this->emit('end'); if ($this->isJson()) $this->parseJson($dataResult); else $this->parseStr($dataResult); }
php
private function onEnd($dataResult) { if ($dataResult === null) return $this->emit('end'); if ($this->isJson()) $this->parseJson($dataResult); else $this->parseStr($dataResult); }
[ "private", "function", "onEnd", "(", "$", "dataResult", ")", "{", "if", "(", "$", "dataResult", "===", "null", ")", "return", "$", "this", "->", "emit", "(", "'end'", ")", ";", "if", "(", "$", "this", "->", "isJson", "(", ")", ")", "$", "this", "->", "parseJson", "(", "$", "dataResult", ")", ";", "else", "$", "this", "->", "parseStr", "(", "$", "dataResult", ")", ";", "}" ]
On request end @param string $dataResult @return void
[ "On", "request", "end" ]
51fe94d6e4c7fafec06fb304f9e44badde4bfe71
https://github.com/CapMousse/React-Restify/blob/51fe94d6e4c7fafec06fb304f9e44badde4bfe71/src/Http/Request.php#L96-L102
221,586
CapMousse/React-Restify
src/Http/Request.php
Request.parseJson
private function parseJson($jsonString) { $jsonData = json_decode($jsonString, true); if ($jsonData === null) { $this->emit('error', [json_last_error_msg()]); return; } $this->setContent($jsonString); $this->setData($jsonData); $this->emit('end'); }
php
private function parseJson($jsonString) { $jsonData = json_decode($jsonString, true); if ($jsonData === null) { $this->emit('error', [json_last_error_msg()]); return; } $this->setContent($jsonString); $this->setData($jsonData); $this->emit('end'); }
[ "private", "function", "parseJson", "(", "$", "jsonString", ")", "{", "$", "jsonData", "=", "json_decode", "(", "$", "jsonString", ",", "true", ")", ";", "if", "(", "$", "jsonData", "===", "null", ")", "{", "$", "this", "->", "emit", "(", "'error'", ",", "[", "json_last_error_msg", "(", ")", "]", ")", ";", "return", ";", "}", "$", "this", "->", "setContent", "(", "$", "jsonString", ")", ";", "$", "this", "->", "setData", "(", "$", "jsonData", ")", ";", "$", "this", "->", "emit", "(", "'end'", ")", ";", "}" ]
Parse json string @param string $jsonString @return void
[ "Parse", "json", "string" ]
51fe94d6e4c7fafec06fb304f9e44badde4bfe71
https://github.com/CapMousse/React-Restify/blob/51fe94d6e4c7fafec06fb304f9e44badde4bfe71/src/Http/Request.php#L125-L137
221,587
paquettg/leaguewrap
src/LeagueWrap/Api/Game.php
Game.recent
public function recent($identity) { $summonerId = $this->extractId($identity); $info = $this->request('game/by-summoner/'.$summonerId.'/recent'); $games = $this->attachStaticDataToDto(new RecentGames($info)); $this->attachResponse($identity, $games, 'recentGames'); return $games; }
php
public function recent($identity) { $summonerId = $this->extractId($identity); $info = $this->request('game/by-summoner/'.$summonerId.'/recent'); $games = $this->attachStaticDataToDto(new RecentGames($info)); $this->attachResponse($identity, $games, 'recentGames'); return $games; }
[ "public", "function", "recent", "(", "$", "identity", ")", "{", "$", "summonerId", "=", "$", "this", "->", "extractId", "(", "$", "identity", ")", ";", "$", "info", "=", "$", "this", "->", "request", "(", "'game/by-summoner/'", ".", "$", "summonerId", ".", "'/recent'", ")", ";", "$", "games", "=", "$", "this", "->", "attachStaticDataToDto", "(", "new", "RecentGames", "(", "$", "info", ")", ")", ";", "$", "this", "->", "attachResponse", "(", "$", "identity", ",", "$", "games", ",", "'recentGames'", ")", ";", "return", "$", "games", ";", "}" ]
Get the recent games by summoner id. @param Summoner|Int $identity @return array
[ "Get", "the", "recent", "games", "by", "summoner", "id", "." ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Api/Game.php#L57-L67
221,588
paquettg/leaguewrap
src/LeagueWrap/Dto/Summoner.php
Summoner.runePage
public function runePage($runePageId) { if ( ! isset($this->info['runePages'])) { // no rune pages return null; } $runePages = $this->info['runePages']; if (isset($runePages[$runePageId])) { return $runePages[$runePageId]; } return null; }
php
public function runePage($runePageId) { if ( ! isset($this->info['runePages'])) { // no rune pages return null; } $runePages = $this->info['runePages']; if (isset($runePages[$runePageId])) { return $runePages[$runePageId]; } return null; }
[ "public", "function", "runePage", "(", "$", "runePageId", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "info", "[", "'runePages'", "]", ")", ")", "{", "// no rune pages", "return", "null", ";", "}", "$", "runePages", "=", "$", "this", "->", "info", "[", "'runePages'", "]", ";", "if", "(", "isset", "(", "$", "runePages", "[", "$", "runePageId", "]", ")", ")", "{", "return", "$", "runePages", "[", "$", "runePageId", "]", ";", "}", "return", "null", ";", "}" ]
Attempts to get a rune page by the id. @param int $runePageId @return RunePage|null
[ "Attempts", "to", "get", "a", "rune", "page", "by", "the", "id", "." ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Dto/Summoner.php#L12-L26
221,589
paquettg/leaguewrap
src/LeagueWrap/Dto/Summoner.php
Summoner.masteryPage
public function masteryPage($masteryPageId) { if ( ! isset($this->info['masteryPages'])) { // no rune pages return null; } $masteryPages = $this->info['masteryPages']; if (isset($masteryPages[$masteryPageId])) { return $masteryPages[$masteryPageId]; } return null; }
php
public function masteryPage($masteryPageId) { if ( ! isset($this->info['masteryPages'])) { // no rune pages return null; } $masteryPages = $this->info['masteryPages']; if (isset($masteryPages[$masteryPageId])) { return $masteryPages[$masteryPageId]; } return null; }
[ "public", "function", "masteryPage", "(", "$", "masteryPageId", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "info", "[", "'masteryPages'", "]", ")", ")", "{", "// no rune pages", "return", "null", ";", "}", "$", "masteryPages", "=", "$", "this", "->", "info", "[", "'masteryPages'", "]", ";", "if", "(", "isset", "(", "$", "masteryPages", "[", "$", "masteryPageId", "]", ")", ")", "{", "return", "$", "masteryPages", "[", "$", "masteryPageId", "]", ";", "}", "return", "null", ";", "}" ]
Attempts to get the mastery page by the id. @param int $masteryPageId @return MasteryPage|null
[ "Attempts", "to", "get", "the", "mastery", "page", "by", "the", "id", "." ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Dto/Summoner.php#L34-L48
221,590
paquettg/leaguewrap
src/LeagueWrap/Dto/Summoner.php
Summoner.recentGame
public function recentGame($gameId) { if ( ! isset($this->info['recentGames'])) { // no rune pages return null; } $recentGames = $this->info['recentGames']; return $recentGames->game($gameId); }
php
public function recentGame($gameId) { if ( ! isset($this->info['recentGames'])) { // no rune pages return null; } $recentGames = $this->info['recentGames']; return $recentGames->game($gameId); }
[ "public", "function", "recentGame", "(", "$", "gameId", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "info", "[", "'recentGames'", "]", ")", ")", "{", "// no rune pages", "return", "null", ";", "}", "$", "recentGames", "=", "$", "this", "->", "info", "[", "'recentGames'", "]", ";", "return", "$", "recentGames", "->", "game", "(", "$", "gameId", ")", ";", "}" ]
Attempts to get the game by the id. @param int $gameId @return MasteryPage|null
[ "Attempts", "to", "get", "the", "game", "by", "the", "id", "." ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Dto/Summoner.php#L56-L66
221,591
paquettg/leaguewrap
src/LeagueWrap/Api/AbstractApi.php
AbstractApi.selectVersion
public function selectVersion($version) { if ( ! in_array($version, $this->versions)) { // not a value version return false; } $this->version = $version; return $this; }
php
public function selectVersion($version) { if ( ! in_array($version, $this->versions)) { // not a value version return false; } $this->version = $version; return $this; }
[ "public", "function", "selectVersion", "(", "$", "version", ")", "{", "if", "(", "!", "in_array", "(", "$", "version", ",", "$", "this", "->", "versions", ")", ")", "{", "// not a value version", "return", "false", ";", "}", "$", "this", "->", "version", "=", "$", "version", ";", "return", "$", "this", ";", "}" ]
Select the version of the api you wish to query. @param string $version @return bool|$this @return $this
[ "Select", "the", "version", "of", "the", "api", "you", "wish", "to", "query", "." ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Api/AbstractApi.php#L161-L172
221,592
paquettg/leaguewrap
src/LeagueWrap/Api/AbstractApi.php
AbstractApi.request
protected function request($path, $params = [], $static = false, $isVersionized = true) { // get and validate the region if ($this->region->isLocked($this->permittedRegions)) { throw new RegionException('The region "'.$this->region->getRegion().'" is not permited to query this API.'); } $this->client->baseUrl($this->getDomain()); if ($this->timeout > 0) { $this->client->setTimeout($this->timeout); } // add the key to the param list $params['api_key'] = $this->key; $uri = ($isVersionized) ? $this->getVersion().'/'.$path : $path; // check cache if ($this->cache instanceof CacheInterface) { $cacheKey = md5($this->getDomain().$uri.'?'.http_build_query($params)); if ($this->cache->has($cacheKey)) { $content = $this->cache->get($cacheKey); if ($content instanceof HttpClientError || $content instanceof HttpServerError ) { // this was a cached client error... throw it throw $content; } } elseif ($this->cacheOnly) { throw new CacheNotFoundException("A cache item for '$uri?".http_build_query($params)."' was not found!"); } else { try { $content = $this->clientRequest($static, $uri, $params); // we want to cache this response $this->cache->set($cacheKey, $content, $this->seconds); } catch (HttpClientError $clientError) { if ($this->cacheClientError) { // cache client errors $this->cache->set($cacheKey, $clientError, $this->seconds); } // rethrow the exception throw $clientError; } catch (HttpServerError $serverError) { if ($this->cacheServerError) { // cache server errors $this->cache->set($cacheKey, $serverError, $this->seconds); } // rethrow the exception throw $serverError; } } } elseif ($this->cacheOnly) { throw new CacheNotFoundException('The cache is not enabled but we were told to use only the cache!'); } else { $content = $this->clientRequest($static, $uri, $params); } // decode the content return json_decode($content, true); }
php
protected function request($path, $params = [], $static = false, $isVersionized = true) { // get and validate the region if ($this->region->isLocked($this->permittedRegions)) { throw new RegionException('The region "'.$this->region->getRegion().'" is not permited to query this API.'); } $this->client->baseUrl($this->getDomain()); if ($this->timeout > 0) { $this->client->setTimeout($this->timeout); } // add the key to the param list $params['api_key'] = $this->key; $uri = ($isVersionized) ? $this->getVersion().'/'.$path : $path; // check cache if ($this->cache instanceof CacheInterface) { $cacheKey = md5($this->getDomain().$uri.'?'.http_build_query($params)); if ($this->cache->has($cacheKey)) { $content = $this->cache->get($cacheKey); if ($content instanceof HttpClientError || $content instanceof HttpServerError ) { // this was a cached client error... throw it throw $content; } } elseif ($this->cacheOnly) { throw new CacheNotFoundException("A cache item for '$uri?".http_build_query($params)."' was not found!"); } else { try { $content = $this->clientRequest($static, $uri, $params); // we want to cache this response $this->cache->set($cacheKey, $content, $this->seconds); } catch (HttpClientError $clientError) { if ($this->cacheClientError) { // cache client errors $this->cache->set($cacheKey, $clientError, $this->seconds); } // rethrow the exception throw $clientError; } catch (HttpServerError $serverError) { if ($this->cacheServerError) { // cache server errors $this->cache->set($cacheKey, $serverError, $this->seconds); } // rethrow the exception throw $serverError; } } } elseif ($this->cacheOnly) { throw new CacheNotFoundException('The cache is not enabled but we were told to use only the cache!'); } else { $content = $this->clientRequest($static, $uri, $params); } // decode the content return json_decode($content, true); }
[ "protected", "function", "request", "(", "$", "path", ",", "$", "params", "=", "[", "]", ",", "$", "static", "=", "false", ",", "$", "isVersionized", "=", "true", ")", "{", "// get and validate the region", "if", "(", "$", "this", "->", "region", "->", "isLocked", "(", "$", "this", "->", "permittedRegions", ")", ")", "{", "throw", "new", "RegionException", "(", "'The region \"'", ".", "$", "this", "->", "region", "->", "getRegion", "(", ")", ".", "'\" is not permited to query this API.'", ")", ";", "}", "$", "this", "->", "client", "->", "baseUrl", "(", "$", "this", "->", "getDomain", "(", ")", ")", ";", "if", "(", "$", "this", "->", "timeout", ">", "0", ")", "{", "$", "this", "->", "client", "->", "setTimeout", "(", "$", "this", "->", "timeout", ")", ";", "}", "// add the key to the param list", "$", "params", "[", "'api_key'", "]", "=", "$", "this", "->", "key", ";", "$", "uri", "=", "(", "$", "isVersionized", ")", "?", "$", "this", "->", "getVersion", "(", ")", ".", "'/'", ".", "$", "path", ":", "$", "path", ";", "// check cache", "if", "(", "$", "this", "->", "cache", "instanceof", "CacheInterface", ")", "{", "$", "cacheKey", "=", "md5", "(", "$", "this", "->", "getDomain", "(", ")", ".", "$", "uri", ".", "'?'", ".", "http_build_query", "(", "$", "params", ")", ")", ";", "if", "(", "$", "this", "->", "cache", "->", "has", "(", "$", "cacheKey", ")", ")", "{", "$", "content", "=", "$", "this", "->", "cache", "->", "get", "(", "$", "cacheKey", ")", ";", "if", "(", "$", "content", "instanceof", "HttpClientError", "||", "$", "content", "instanceof", "HttpServerError", ")", "{", "// this was a cached client error... throw it", "throw", "$", "content", ";", "}", "}", "elseif", "(", "$", "this", "->", "cacheOnly", ")", "{", "throw", "new", "CacheNotFoundException", "(", "\"A cache item for '$uri?\"", ".", "http_build_query", "(", "$", "params", ")", ".", "\"' was not found!\"", ")", ";", "}", "else", "{", "try", "{", "$", "content", "=", "$", "this", "->", "clientRequest", "(", "$", "static", ",", "$", "uri", ",", "$", "params", ")", ";", "// we want to cache this response", "$", "this", "->", "cache", "->", "set", "(", "$", "cacheKey", ",", "$", "content", ",", "$", "this", "->", "seconds", ")", ";", "}", "catch", "(", "HttpClientError", "$", "clientError", ")", "{", "if", "(", "$", "this", "->", "cacheClientError", ")", "{", "// cache client errors", "$", "this", "->", "cache", "->", "set", "(", "$", "cacheKey", ",", "$", "clientError", ",", "$", "this", "->", "seconds", ")", ";", "}", "// rethrow the exception", "throw", "$", "clientError", ";", "}", "catch", "(", "HttpServerError", "$", "serverError", ")", "{", "if", "(", "$", "this", "->", "cacheServerError", ")", "{", "// cache server errors", "$", "this", "->", "cache", "->", "set", "(", "$", "cacheKey", ",", "$", "serverError", ",", "$", "this", "->", "seconds", ")", ";", "}", "// rethrow the exception", "throw", "$", "serverError", ";", "}", "}", "}", "elseif", "(", "$", "this", "->", "cacheOnly", ")", "{", "throw", "new", "CacheNotFoundException", "(", "'The cache is not enabled but we were told to use only the cache!'", ")", ";", "}", "else", "{", "$", "content", "=", "$", "this", "->", "clientRequest", "(", "$", "static", ",", "$", "uri", ",", "$", "params", ")", ";", "}", "// decode the content", "return", "json_decode", "(", "$", "content", ",", "true", ")", ";", "}" ]
Wraps the request of the api in this method. @param string $path @param array $params @param bool $static @param bool $isVersionized @return mixed @throws CacheNotFoundException @throws HttpClientError @throws HttpServerError @throws LimitReachedException @throws RegionException @throws string
[ "Wraps", "the", "request", "of", "the", "api", "in", "this", "method", "." ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Api/AbstractApi.php#L231-L312
221,593
paquettg/leaguewrap
src/LeagueWrap/Api/AbstractApi.php
AbstractApi.clientRequest
protected function clientRequest($static, $uri, $params) { // check if we have hit the limit if ( ! $static && ! $this->collection->hitLimits($this->region->getRegion()) ) { throw new LimitReachedException('You have hit the request limit in your collection.'); } $response = $this->client->request($uri, $params); ++$this->requests; // check if it's a valid response object if ($response instanceof Response) { $this->checkResponseErrors($response); } return $response; }
php
protected function clientRequest($static, $uri, $params) { // check if we have hit the limit if ( ! $static && ! $this->collection->hitLimits($this->region->getRegion()) ) { throw new LimitReachedException('You have hit the request limit in your collection.'); } $response = $this->client->request($uri, $params); ++$this->requests; // check if it's a valid response object if ($response instanceof Response) { $this->checkResponseErrors($response); } return $response; }
[ "protected", "function", "clientRequest", "(", "$", "static", ",", "$", "uri", ",", "$", "params", ")", "{", "// check if we have hit the limit", "if", "(", "!", "$", "static", "&&", "!", "$", "this", "->", "collection", "->", "hitLimits", "(", "$", "this", "->", "region", "->", "getRegion", "(", ")", ")", ")", "{", "throw", "new", "LimitReachedException", "(", "'You have hit the request limit in your collection.'", ")", ";", "}", "$", "response", "=", "$", "this", "->", "client", "->", "request", "(", "$", "uri", ",", "$", "params", ")", ";", "++", "$", "this", "->", "requests", ";", "// check if it's a valid response object", "if", "(", "$", "response", "instanceof", "Response", ")", "{", "$", "this", "->", "checkResponseErrors", "(", "$", "response", ")", ";", "}", "return", "$", "response", ";", "}" ]
Make the actual request. @param bool $static @param string $uri @param array $params @return \LeagueWrap\Response @throws LimitReachedException
[ "Make", "the", "actual", "request", "." ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Api/AbstractApi.php#L323-L342
221,594
paquettg/leaguewrap
src/LeagueWrap/Api/AbstractApi.php
AbstractApi.getVersion
protected function getVersion() { if (is_null($this->version)) { // get the first version in versions $this->version = reset($this->versions); } return $this->version; }
php
protected function getVersion() { if (is_null($this->version)) { // get the first version in versions $this->version = reset($this->versions); } return $this->version; }
[ "protected", "function", "getVersion", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "version", ")", ")", "{", "// get the first version in versions", "$", "this", "->", "version", "=", "reset", "(", "$", "this", "->", "versions", ")", ";", "}", "return", "$", "this", "->", "version", ";", "}" ]
Get the version string. @return string
[ "Get", "the", "version", "string", "." ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Api/AbstractApi.php#L349-L358
221,595
paquettg/leaguewrap
src/LeagueWrap/Api/AbstractApi.php
AbstractApi.extractIds
protected function extractIds($identities) { $ids = []; if (is_array($identities)) { foreach ($identities as $identity) { $ids[] = $this->extractId($identity); } } else { $ids[] = $this->extractId($identities); } return $ids; }
php
protected function extractIds($identities) { $ids = []; if (is_array($identities)) { foreach ($identities as $identity) { $ids[] = $this->extractId($identity); } } else { $ids[] = $this->extractId($identities); } return $ids; }
[ "protected", "function", "extractIds", "(", "$", "identities", ")", "{", "$", "ids", "=", "[", "]", ";", "if", "(", "is_array", "(", "$", "identities", ")", ")", "{", "foreach", "(", "$", "identities", "as", "$", "identity", ")", "{", "$", "ids", "[", "]", "=", "$", "this", "->", "extractId", "(", "$", "identity", ")", ";", "}", "}", "else", "{", "$", "ids", "[", "]", "=", "$", "this", "->", "extractId", "(", "$", "identities", ")", ";", "}", "return", "$", "ids", ";", "}" ]
Attempts to extract an ID from the array given. @param mixed $identities @return array @uses extractId()
[ "Attempts", "to", "extract", "an", "ID", "from", "the", "array", "given", "." ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Api/AbstractApi.php#L390-L406
221,596
paquettg/leaguewrap
src/LeagueWrap/Api/AbstractApi.php
AbstractApi.attachResponse
protected function attachResponse($identity, $response, $key) { if ($identity instanceof Summoner) { $identity->set($key, $response); return true; } return false; }
php
protected function attachResponse($identity, $response, $key) { if ($identity instanceof Summoner) { $identity->set($key, $response); return true; } return false; }
[ "protected", "function", "attachResponse", "(", "$", "identity", ",", "$", "response", ",", "$", "key", ")", "{", "if", "(", "$", "identity", "instanceof", "Summoner", ")", "{", "$", "identity", "->", "set", "(", "$", "key", ",", "$", "response", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}" ]
Attempts to attach the response to a summoner object. @param mixed $identity @param mixed $response @param string $key @return bool
[ "Attempts", "to", "attach", "the", "response", "to", "a", "summoner", "object", "." ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Api/AbstractApi.php#L416-L426
221,597
paquettg/leaguewrap
src/LeagueWrap/Api/AbstractApi.php
AbstractApi.attachResponses
protected function attachResponses($identities, $responses, $key) { if (is_array($identities)) { foreach ($identities as $identity) { if ($identity instanceof Summoner) { $id = $identity->id; if (isset($responses[$id])) { $response = $responses[$id]; $this->attachResponse($identity, $response, $key); } else { // we did not get a response for this id, attach null $this->attachResponse($identity, null, $key); } } } } else { $identity = $identities; if ($identity instanceof Summoner) { $id = $identity->id; if (isset($responses[$id])) { $response = $responses[$id]; $this->attachResponse($identity, $response, $key); } else { // we did not get a response for this id, attach null $this->attachResponse($identity, null, $key); } } } return true; }
php
protected function attachResponses($identities, $responses, $key) { if (is_array($identities)) { foreach ($identities as $identity) { if ($identity instanceof Summoner) { $id = $identity->id; if (isset($responses[$id])) { $response = $responses[$id]; $this->attachResponse($identity, $response, $key); } else { // we did not get a response for this id, attach null $this->attachResponse($identity, null, $key); } } } } else { $identity = $identities; if ($identity instanceof Summoner) { $id = $identity->id; if (isset($responses[$id])) { $response = $responses[$id]; $this->attachResponse($identity, $response, $key); } else { // we did not get a response for this id, attach null $this->attachResponse($identity, null, $key); } } } return true; }
[ "protected", "function", "attachResponses", "(", "$", "identities", ",", "$", "responses", ",", "$", "key", ")", "{", "if", "(", "is_array", "(", "$", "identities", ")", ")", "{", "foreach", "(", "$", "identities", "as", "$", "identity", ")", "{", "if", "(", "$", "identity", "instanceof", "Summoner", ")", "{", "$", "id", "=", "$", "identity", "->", "id", ";", "if", "(", "isset", "(", "$", "responses", "[", "$", "id", "]", ")", ")", "{", "$", "response", "=", "$", "responses", "[", "$", "id", "]", ";", "$", "this", "->", "attachResponse", "(", "$", "identity", ",", "$", "response", ",", "$", "key", ")", ";", "}", "else", "{", "// we did not get a response for this id, attach null", "$", "this", "->", "attachResponse", "(", "$", "identity", ",", "null", ",", "$", "key", ")", ";", "}", "}", "}", "}", "else", "{", "$", "identity", "=", "$", "identities", ";", "if", "(", "$", "identity", "instanceof", "Summoner", ")", "{", "$", "id", "=", "$", "identity", "->", "id", ";", "if", "(", "isset", "(", "$", "responses", "[", "$", "id", "]", ")", ")", "{", "$", "response", "=", "$", "responses", "[", "$", "id", "]", ";", "$", "this", "->", "attachResponse", "(", "$", "identity", ",", "$", "response", ",", "$", "key", ")", ";", "}", "else", "{", "// we did not get a response for this id, attach null", "$", "this", "->", "attachResponse", "(", "$", "identity", ",", "null", ",", "$", "key", ")", ";", "}", "}", "}", "return", "true", ";", "}" ]
Attempts to attach all the responses to the correct summoner. @param array|Summoner $identities @param mixed $responses @param string $key @return bool
[ "Attempts", "to", "attach", "all", "the", "responses", "to", "the", "correct", "summoner", "." ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Api/AbstractApi.php#L436-L478
221,598
paquettg/leaguewrap
src/LeagueWrap/Api/AbstractApi.php
AbstractApi.attachStaticDataToDto
protected function attachStaticDataToDto(AbstractDto $dto) { if ($this->attachStaticData) { $dto->loadStaticData($this->staticData); } return $dto; }
php
protected function attachStaticDataToDto(AbstractDto $dto) { if ($this->attachStaticData) { $dto->loadStaticData($this->staticData); } return $dto; }
[ "protected", "function", "attachStaticDataToDto", "(", "AbstractDto", "$", "dto", ")", "{", "if", "(", "$", "this", "->", "attachStaticData", ")", "{", "$", "dto", "->", "loadStaticData", "(", "$", "this", "->", "staticData", ")", ";", "}", "return", "$", "dto", ";", "}" ]
Will attempt to attach any static data to the given dto if the attach static data flag is set. @param AbstractDto $dto @return AbstractDto
[ "Will", "attempt", "to", "attach", "any", "static", "data", "to", "the", "given", "dto", "if", "the", "attach", "static", "data", "flag", "is", "set", "." ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Api/AbstractApi.php#L487-L495
221,599
paquettg/leaguewrap
src/LeagueWrap/Api/AbstractApi.php
AbstractApi.checkResponseErrors
protected function checkResponseErrors(Response $response) { $code = $response->getCode(); if ($code === 429 && !$response->hasHeader('Retry-After')) { throw Response\UnderlyingServiceRateLimitReached::withResponse( "Did not receive 'X-Rate-Limit-Type' and 'Retry-After' headers. ". "See https://developer.riotgames.com/docs/rate-limiting for more details", $response ); } if (intval($code / 100) != 2) { // we have an error! $message = "Http Error."; if (isset($this->responseErrors[$code])) { $message = trim($this->responseErrors[$code]); } $class = 'LeagueWrap\Response\Http'.$code; if (class_exists($class) && is_subclass_of($class, ResponseException::class)) { throw $class::withResponse($message, $response); } } }
php
protected function checkResponseErrors(Response $response) { $code = $response->getCode(); if ($code === 429 && !$response->hasHeader('Retry-After')) { throw Response\UnderlyingServiceRateLimitReached::withResponse( "Did not receive 'X-Rate-Limit-Type' and 'Retry-After' headers. ". "See https://developer.riotgames.com/docs/rate-limiting for more details", $response ); } if (intval($code / 100) != 2) { // we have an error! $message = "Http Error."; if (isset($this->responseErrors[$code])) { $message = trim($this->responseErrors[$code]); } $class = 'LeagueWrap\Response\Http'.$code; if (class_exists($class) && is_subclass_of($class, ResponseException::class)) { throw $class::withResponse($message, $response); } } }
[ "protected", "function", "checkResponseErrors", "(", "Response", "$", "response", ")", "{", "$", "code", "=", "$", "response", "->", "getCode", "(", ")", ";", "if", "(", "$", "code", "===", "429", "&&", "!", "$", "response", "->", "hasHeader", "(", "'Retry-After'", ")", ")", "{", "throw", "Response", "\\", "UnderlyingServiceRateLimitReached", "::", "withResponse", "(", "\"Did not receive 'X-Rate-Limit-Type' and 'Retry-After' headers. \"", ".", "\"See https://developer.riotgames.com/docs/rate-limiting for more details\"", ",", "$", "response", ")", ";", "}", "if", "(", "intval", "(", "$", "code", "/", "100", ")", "!=", "2", ")", "{", "// we have an error!", "$", "message", "=", "\"Http Error.\"", ";", "if", "(", "isset", "(", "$", "this", "->", "responseErrors", "[", "$", "code", "]", ")", ")", "{", "$", "message", "=", "trim", "(", "$", "this", "->", "responseErrors", "[", "$", "code", "]", ")", ";", "}", "$", "class", "=", "'LeagueWrap\\Response\\Http'", ".", "$", "code", ";", "if", "(", "class_exists", "(", "$", "class", ")", "&&", "is_subclass_of", "(", "$", "class", ",", "ResponseException", "::", "class", ")", ")", "{", "throw", "$", "class", "::", "withResponse", "(", "$", "message", ",", "$", "response", ")", ";", "}", "}", "}" ]
Checks the response for Http errors. @param Response $response @throws \LeagueWrap\Response\Http400 @throws \LeagueWrap\Response\Http401 @throws \LeagueWrap\Response\Http402 @throws \LeagueWrap\Response\Http403 @throws \LeagueWrap\Response\Http404 @throws \LeagueWrap\Response\Http405 @throws \LeagueWrap\Response\Http406 @throws \LeagueWrap\Response\Http407 @throws \LeagueWrap\Response\Http408 @throws \LeagueWrap\Response\Http429 @throws \LeagueWrap\Response\Http500 @throws \LeagueWrap\Response\Http501 @throws \LeagueWrap\Response\Http502 @throws \LeagueWrap\Response\Http503 @throws \LeagueWrap\Response\Http504 @throws \LeagueWrap\Response\Http505 @throws \LeagueWrap\Response\UnderlyingServiceRateLimitReached
[ "Checks", "the", "response", "for", "Http", "errors", "." ]
0f91813b5d8292054e5e13619d591b6b14dc63e6
https://github.com/paquettg/leaguewrap/blob/0f91813b5d8292054e5e13619d591b6b14dc63e6/src/LeagueWrap/Api/AbstractApi.php#L519-L544