_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q236100
ElasticsearchContextListener.refreshUser
train
private function refreshUser(TokenInterface $token) { $user = $token->getUser(); if (!$user instanceof UserInterface) { return $token; } if (null !== $this->logger) { $this->logger->debug(sprintf('Reloading user from user provider.')); } fore...
php
{ "resource": "" }
q236101
DiscussionsController.Table
train
public function Table($Page = '0') { if ($this->SyndicationMethod == SYNDICATION_NONE) $this->View = 'table'; $this->Index($Page); }
php
{ "resource": "" }
q236102
DiscussionsController.Bookmarked
train
public function Bookmarked($Page = '0') { $this->Permission('Garden.SignIn.Allow'); Gdn_Theme::Section('DiscussionList'); // Figure out which discussions layout to choose (Defined on "Homepage" settings page). $Layout = C('Vanilla.Discussions.Layout'); switch($Layout) { case 'tab...
php
{ "resource": "" }
q236103
DiscussionsController.Mine
train
public function Mine($Page = 'p1') { $this->Permission('Garden.SignIn.Allow'); Gdn_Theme::Section('DiscussionList'); // Set criteria & get discussions data list($Offset, $Limit) = OffsetLimit($Page, C('Vanilla.Discussions.PerPage', 30)); $Session = Gdn::Session(); $Wheres = ar...
php
{ "resource": "" }
q236104
DiscussionsController.GetCommentCounts
train
public function GetCommentCounts() { $this->AllowJSONP(TRUE); $vanilla_identifier = GetValue('vanilla_identifier', $_GET); if (!is_array($vanilla_identifier)) $vanilla_identifier = array($vanilla_identifier); $vanilla_identifier = array_unique($vanilla_identifier); $Fina...
php
{ "resource": "" }
q236105
DiscussionsController.Sort
train
public function Sort($Target = '') { if (!Gdn::Session()->IsValid()) throw PermissionException(); if (!$this->Request->IsAuthenticatedPostBack()) throw ForbiddenException('GET'); // Get param $SortField = Gdn::Request()->Post('DiscussionSort'); $SortField...
php
{ "resource": "" }
q236106
SkeFormInput.defineType
train
protected function defineType(string $strType) { switch ($strType) { case 'select': case 'textarea': $this->strElementType = $strType; break; case 'checkbox': case 'hidden': case 'radio': case 'text': ...
php
{ "resource": "" }
q236107
SkeFormInput.renderInput
train
public function renderInput(array $aAttribs = []) { $this->aAttribs += $aAttribs; $strElement = $this->isMulti() ? $this->renderMulti() : $this->renderSingle(); $strSuffix = $this->strSuffix ? ' ' . $this->strSuffix : ''; return $strElement . $strSuffix; }
php
{ "resource": "" }
q236108
SkeFormInput.renderSingle
train
protected function renderSingle() { $strHtml = ''; // Apply label? if (in_array($this->getType(), ['checkbox', 'radio'])) $strHtml .= '<label class="sked-input-multi">'; // Build opening tag $strHtml .= '<' . $this->strElementType . ' ' . $this->renderAttribs() ...
php
{ "resource": "" }
q236109
SkeFormInput.renderMulti
train
protected function renderMulti() { $strHtml = ''; // An indexed array means use the label as the value also. $bLabelIsValue = isset($this->aOptions[0]); foreach ($this->aOptions as $mValue => $strLabel) { if ($bLabelIsValue) $mValue = $strLabel; ...
php
{ "resource": "" }
q236110
Event.add
train
public function add() { if($moduleEvents = $this->module->events()) { $systemEvents = $this->load(); if(isset($moduleEvents['listen'])) // for listen event we must check if exists merge if not add it foreach ($moduleEvents['listen'] as $event => $liste...
php
{ "resource": "" }
q236111
Event.remove
train
public function remove() { if($moduleEvents = $this->module->events()) { $systemEvents = $this->load(); if (isset($moduleEvents['listen'])) // for listen event we must check if exists merge if not add it foreach ($moduleEvents['listen'] as $eve...
php
{ "resource": "" }
q236112
GenerateNewPassword.execute
train
public function execute(Framework $framework, WebRequest $request, Response $response) { // Set the title for the page $this->setTitle($this->translate('Generate a new password', '\\Zepi\\Web\\AccessControl')); // Generate a new password $result = $this->generateNewPassword(...
php
{ "resource": "" }
q236113
GenerateNewPassword.generateRandomPassword
train
protected function generateRandomPassword() { $alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890+*=-_/()!?[]{}'; $password = array(); $alphabetLength = strlen($alphabet) - 1; for ($i = 0; $i < 10; $i++) { $charIndex = mt_rand(0, $alphabet...
php
{ "resource": "" }
q236114
Block.setObject
train
public function setObject($object) { if ( ! is_object($object)) { throw new InvalidArgumentException( 'Expected an object, but got '.gettype($object) ); } $this->object = new ReflectionClass($object); }
php
{ "resource": "" }
q236115
Block.property
train
public function property($name) { if ( ! $this->object->hasProperty($name)) { throw new UnexpectedValueException( "Property {$name} does not exist" ); } return $this->extractComment($this->object->getProperty($name)); }
php
{ "resource": "" }
q236116
Block.properties
train
public function properties($filter = null) { if (is_null($filter)) { $properties = $this->object->getProperties(); } else { $properties = $this->object->getProperties($filter); } return array_map([$this, 'extractComment'], $properties)...
php
{ "resource": "" }
q236117
Block.method
train
public function method($name) { if ( ! $this->object->hasMethod($name)) { throw new UnexpectedValueException( "Method {$name} does not exist" ); } return $this->extractComment($this->object->getMethod($name)); }
php
{ "resource": "" }
q236118
Block.methods
train
public function methods($filter = null) { if (is_null($filter)) { $methods = $this->object->getMethods(); } else { $methods = $this->object->getMethods($filter); } return array_map([$this, 'extractComment'], $methods); }
php
{ "resource": "" }
q236119
AdminCategoryController.indexAction
train
public function indexAction() { $em = $this->getDoctrine()->getManager(); $rootName = $this->container->getParameter('flowcode_news.root_category'); $root = $em->getRepository('AmulenClassificationBundle:Category')->findOneBy(array("name" => $rootName)); $entities = $em->getRepository('A...
php
{ "resource": "" }
q236120
AdminCategoryController.childrensAction
train
public function childrensAction($id) { $em = $this->getDoctrine()->getManager(); $parent = $em->getRepository('AmulenClassificationBundle:Category')->findOneBy(array("id" => $id)); $childrens = $em->getRepository('AmulenClassificationBundle:Category')->getChildren($parent, true); retur...
php
{ "resource": "" }
q236121
AdminCategoryController.createDeleteForm
train
private function createDeleteForm($id) { return $this->createFormBuilder() ->setAction($this->generateUrl('admin_news_category_delete', array('id' => $id))) ->setMethod('DELETE') ->add('submit', 'submit', array('label' => 'Delete', ...
php
{ "resource": "" }
q236122
RouteDispatcher.parseFilters
train
protected function parseFilters($filters) { $beforeFilter = array(); $afterFilter = array(); if (isset($filters[Route::BEFORE])) { $beforeFilter = array_intersect_key($this->filters, array_flip((array)$filters[Route::BEFORE])); } if (isset($filters[Route::AFTER]...
php
{ "resource": "" }
q236123
RouteDispatcher.dispatchRoute
train
protected function dispatchRoute($httpMethod, $uri) { if (isset($this->staticRouteMap[$uri])) { return $this->dispatchStaticRoute($httpMethod, $uri); } return $this->dispatchVariableRoute($httpMethod, $uri); }
php
{ "resource": "" }
q236124
RouteDispatcher.dispatchStaticRoute
train
protected function dispatchStaticRoute($httpMethod, $uri) { $routes = $this->staticRouteMap[$uri]; if (!isset($routes[$httpMethod])) { $httpMethod = $this->checkFallbacks($routes, $httpMethod); } return $routes[$httpMethod]; }
php
{ "resource": "" }
q236125
RouteDispatcher.dispatchVariableRoute
train
protected function dispatchVariableRoute($httpMethod, $uri) { foreach ($this->variableRouteData as $data) { if (!preg_match($data['regex'], $uri, $matches)) { continue; } $count = count($matches); while (!isset($data['routeMap'][$count++])) {...
php
{ "resource": "" }
q236126
SkeModelPDO.find
train
public function find(int $iId) { $oSelect = $this->oConnector->prepare('SELECT * FROM sked_events WHERE id = :id'); if (!$oSelect->execute([':id' => $iId])) throw new \Exception(__METHOD__ . ' - ' . $oSelect->errorInfo()[2]); return $oSelect->fetch(\PDO::FETCH_ASSOC); }
php
{ "resource": "" }
q236127
SkeModelPDO.queryDay
train
protected function queryDay(string $strDateStart, string $strDateEnd) { $strQuery = $this->querySelectFrom($strDateStart) . $this->queryJoin() . $this->queryWhereNotExpired(); // Happening today $strQuery .= ' AND ('; // Original date matches ...
php
{ "resource": "" }
q236128
SkeModelPDO.queryPDO
train
private function queryPDO(string $strQuery, array $aParams = []) { $oStmt = $this->oConnector->prepare($strQuery); if (!$oStmt->execute($aParams)) throw new \Exception(__METHOD__ . ' - ' . $oStmt->errorInfo()[2]); list($strMethod) = explode(' ', trim($strQuery)); switch ...
php
{ "resource": "" }
q236129
SkeModelPDO.saveEventMembers
train
protected function saveEventMembers(int $iEventId, array $aMembers) { if (!empty($aMembers)) { $aExecParams[':sked_event_id'] = $iEventId; $strQuery = 'INSERT IGNORE INTO `sked_event_members` (`sked_event_id`, `member_id`, `owner`, `lead_time`, `created_at`) VALUES ';...
php
{ "resource": "" }
q236130
SkeModelPDO.saveEventTags
train
protected function saveEventTags(int $iEventId, array $aTags) { // Delete existing tags $this->queryPDO( 'DELETE FROM `sked_event_tags` WHERE `sked_event_id` = ?', [$iEventId] ); // Create new tags if (!empty($aTags)) { $aValueSets = []; ...
php
{ "resource": "" }
q236131
DataHelper.dataFormatoDestino
train
public function dataFormatoDestino($data, $formatoDestino) { $dataFormatada = false; if (!$dataFormatada && $this->validarDataPorFormato($data, $this->FORMATO_DATA_SQL)) { $dataFormatada = $this->dataFormatoOrigemDestino($data, $this->FORMATO_DATA_SQL, $formatoDestino); } ...
php
{ "resource": "" }
q236132
DataHelper.dataFormatoOrigemDestino
train
public function dataFormatoOrigemDestino($data, $formatoOrigem, $formatoDestino) { $data = $this->converterParaDateTime($data, $formatoOrigem); if (!$data) { return false; } return ($data->format($formatoDestino)); }
php
{ "resource": "" }
q236133
Chikka.send
train
public function send($mobileNumber, $message, $messageId = null) { return $this->app['chikka.sender']->send($mobileNumber, $message, $messageId); }
php
{ "resource": "" }
q236134
Chikka.sendAsync
train
public function sendAsync($mobileNumber, $message, $messageId = null) { return $this->app['chikka.sender']->sendAsync($mobileNumber, $message, $messageId); }
php
{ "resource": "" }
q236135
File.getUniqFilename
train
public static function getUniqFilename($filename = '', $dir = null, $force_file = true, $extension = 'txt') { if (empty($filename)) { return ''; } $extension = trim($extension, '.'); if (empty($filename)){ $filename = uniqid(); if ($force_file) $f...
php
{ "resource": "" }
q236136
File.formatFilename
train
public static function formatFilename($filename = '', $lowercase = false, $delimiter = '-') { if (empty($filename)) { return ''; } $_ext = self::getExtension($filename, true); if ($_ext) { $filename = str_replace($_ext, '', $filename); } $str...
php
{ "resource": "" }
q236137
File.getExtension
train
public static function getExtension($filename = '', $dot = false) { if (empty($filename)) { return ''; } $exploded_file_name = explode('.', $filename); return (strpos($filename, '.') ? ($dot ? '.' : '').end($exploded_file_name) : null); }
php
{ "resource": "" }
q236138
File.touch
train
public static function touch($file_path = null, array &$logs = array()) { if (is_null($file_path)) { return null; } if (!file_exists($file_path)) { $target_dir = dirname($file_path); $ok = !file_exists($target_dir) ? Directory::create($target_dir) : true; ...
php
{ "resource": "" }
q236139
File.remove
train
public static function remove($file_path = null, array &$logs = array()) { if (is_null($file_path)) { return null; } if (file_exists($file_path)) { if (unlink($file_path)) { clearstatcache(); return true; } else { ...
php
{ "resource": "" }
q236140
File.write
train
public static function write($file_path = null, $content, $type = 'a', $force = false, array &$logs = array()) { if (is_null($file_path)) { return null; } if (!file_exists($file_path)) { if (true===$force) { self::touch($file_path, $logs); ...
php
{ "resource": "" }
q236141
Mapper.find
train
public function find( $primaryKeys ) { if ( is_array( $primaryKeys ) ) { $primaryKeys = reset( $primaryKeys ); } $rootId = ( (int) $primaryKeys ) ?: null; return $this->createStructure( array( 'rootId' => $rootId, 'extra' => $this-...
php
{ "resource": "" }
q236142
Mapper.findByExtra
train
public function findByExtra( ExtraStructure $extra ) { $rootId = $extra->rootParagraphId; return $this->createStructure( array( 'rootId' => $rootId, 'extra' => $extra, 'rules' => $this->getRuleMapper() ->findAllByRoot( ...
php
{ "resource": "" }
q236143
PriorityQueue.toArray
train
public function toArray(): array { /* Enable extraction of data and priority */ $this->setExtractFlags(self::EXTR_BOTH); /* Prepare output */ $data = []; /* Iterate yourself */ foreach ($this as $item) { $data[] = $item; } return $data; ...
php
{ "resource": "" }
q236144
PriorityQueue.insert
train
public function insert($data, $priority = self::PIRORITY_DEFAULT): void { parent::insert($data, $priority); }
php
{ "resource": "" }
q236145
PriorityQueue.unserialize
train
public function unserialize($queue) { foreach (unserialize($queue) as $item) { $this->insert($item['data'], $item['priority']); } }
php
{ "resource": "" }
q236146
PriorityQueue.merge
train
public function merge(self $queue): void { $data = $queue->toArray(); foreach ($data as $item) { $this->insert($item['data'], $item['priority']); } }
php
{ "resource": "" }
q236147
ResultCollectionPresenter.display
train
public static function display(array $assocArgs, ResultCollection $resultCollection): void { // TODO: Use null coalescing assignment operator. $assocArgs['fields'] = $assocArgs['fields'] ?? self::DEFAULT_FIELDS; $formatter = new Formatter($assocArgs, $assocArgs['fields']); $formatte...
php
{ "resource": "" }
q236148
ResultCollectionPresenter.toTable
train
private static function toTable(ResultCollection $resultCollection): array { return array_map(function (ResultInterface $result): array { return self::toRow($result); }, $resultCollection->all()); }
php
{ "resource": "" }
q236149
ResultCollectionPresenter.toRow
train
private static function toRow(ResultInterface $result): array { $row = [ 'id' => $result->getChecker()->getId(), 'link' => $result->getChecker()->getLink(), 'description' => $result->getChecker()->getDescription(), 'status' => $result->getStatus(), ...
php
{ "resource": "" }
q236150
ResultCollectionPresenter.colorize
train
private static function colorize(ResultInterface $result, string $text): string { $colors = [ Success::class => '%G', Disabled::class => '%P', Failure::class => '%R', Error::class => '%1%w', 'reset' => '%n', ]; $color = $colors[get...
php
{ "resource": "" }
q236151
Response.header
train
public function header($header, $value, $replace = true) { $this->headers[] = array($header, $value, $replace); }
php
{ "resource": "" }
q236152
Processor.process
train
public function process(\SS_HTTPRequest $request) { if ($identifier = $request->param('ID')) { if ($this->currencyService->setActiveCurrency(new Identifier($identifier))) { return [ 'Success' => true ]; } } return [...
php
{ "resource": "" }
q236153
TransformPipeline.run
train
public function run(array $input) { return Std::foldl(function ($current, TransformInterface $input) { return $input->run($current); }, $input, $this->transforms); }
php
{ "resource": "" }
q236154
CMQPubSubAdapter.subscribe
train
public function subscribe($topicQueueName, callable $handler) { $isSubscriptionLoopActive = true; while ($isSubscriptionLoopActive) { $request = new SubscribeMessageRequest([ 'queueName' => $topicQueueName, 'pollingWaitSeconds' => 0, ]...
php
{ "resource": "" }
q236155
Relation.detectForeignKey
train
public function detectForeignKey($config, $class) { $foreignKey = $this->getConfig($config); if (!$foreignKey) { $foreignKey = $this->buildForeignKey($class); $this->setConfig($config, $foreignKey); } return $foreignKey; }
php
{ "resource": "" }
q236156
Relation.getPrimaryModel
train
public function getPrimaryModel() { if ($model = $this->_model) { return $model; } $class = $this->getPrimaryClass(); if (!$class) { return null; } $this->setPrimaryModel(new $class()); return $this->_model; }
php
{ "resource": "" }
q236157
Relation.getRelatedModel
train
public function getRelatedModel() { if ($model = $this->_relatedModel) { return $model; } $class = $this->getRelatedClass(); $this->setRelatedModel(new $class()); return $this->_relatedModel; }
php
{ "resource": "" }
q236158
Relation.setPrimaryModel
train
public function setPrimaryModel(Model $model) { $this->_model = $model; $this->setPrimaryClass(get_class($model)); return $this; }
php
{ "resource": "" }
q236159
Relation.setRelatedModel
train
public function setRelatedModel(Model $model) { $this->_relatedModel = $model; $this->setRelatedClass(get_class($model)); return $this; }
php
{ "resource": "" }
q236160
User.setHash
train
public function setHash($hash) { if(!is_string($hash) || strlen(trim($hash)) == 0) throw new InvalidArgumentException(__METHOD__ . '; Invalid hash, must be a non empty string'); $this->hash = $hash; }
php
{ "resource": "" }
q236161
Publisher.publish
train
public function publish() { if (!$this->console instanceof Command) { $message = "The 'console' property must instance of \\Illuminate\\Console\\Command."; throw new \RuntimeException($message); } if (!$this->getFilesystem()->isDirectory($sourcePath = $this->getSour...
php
{ "resource": "" }
q236162
EnvWriter.save
train
public function save(array $answers) { $path = $this->directory . DIRECTORY_SEPARATOR . $this->file; if (!file_exists($path)) { if (!is_writable($this->directory)) { throw new WritableException( sprintf( 'The env file is not pr...
php
{ "resource": "" }
q236163
Request.getCalls
train
public function getCalls() { if (null == $this->calls) { $this->calls = $this->extractCalls(); } return $this->calls; }
php
{ "resource": "" }
q236164
Request.extractCalls
train
public function extractCalls() { $calls = array(); if ('form' == $this->callType) { $calls[] = new Call($this->post, 'form'); } else { $decoded = json_decode($this->rawPost); $decoded = !is_array($decoded) ? array($decoded)...
php
{ "resource": "" }
q236165
Request.parseRawToArray
train
private function parseRawToArray(&$value, &$key) { // parse a json string to an array if (is_string($value)) { $pos = substr($value,0,1); if ($pos == '[' || $pos == '(' || $pos == '{') { $json = json_decode($value); } else { ...
php
{ "resource": "" }
q236166
Exec.run
train
public function run() { $process = $this->getProcessExecutor(); $process->setCommandLine($this->getCommand()); $logger = function ($error, $line) { call_user_func_array(array($this, 'logLine'), array($error, $line)); }; return $process->run($logger); }
php
{ "resource": "" }
q236167
Exec.logLine
train
protected function logLine($messageType, $messageText) { switch ($messageType) { case Process::ERR: $typeStr = "[Error]"; break; default: $typeStr = ""; break; } echo sprintf("\n%s %s\n", $typeStr, $mess...
php
{ "resource": "" }
q236168
DoctrineEventSubscriber.postPersist
train
public function postPersist(LifecycleEventArgs $args) { if ($args->getObject() instanceof CommitInterface) { $this->dispatcher->dispatch(NewCommitEvent::NAME, new NewCommitEvent($args->getObject())); } elseif ($args->getObject() instanceof BranchInterface) { $this->dispatcher...
php
{ "resource": "" }
q236169
FormUtils.serializeAttr
train
public static function serializeAttr(array $data, array $order=[]){ $attr = []; /* convert data to sorted array */ $sorted = static::sortedAttr($data, $order); foreach ( $sorted as list($key, $value) ){ if ( is_array($value) ){ /* ignore empty arrays */ if ( count($value) === 0 ){ continue; ...
php
{ "resource": "" }
q236170
Constraint.fromString
train
public static function fromString($constraintExpression) { if (!preg_match('/^(==?|\!=?|~|[<>]=?)?((?:\*|[0-9]+)(?:.(?:\*|[0-9]+))*)(?:\@(\w+))?$/', $constraintExpression, $m)) { throw new \InvalidArgumentException("Constraint expression '$constraintExpression' could not be parsed"); } ...
php
{ "resource": "" }
q236171
Constraint.match
train
public function match(Version $version) { $versionStabilityIndex = array_search($version->getStability(), Version::$stabilities); $constraintStabilityIndex = array_search($this->stability, Version::$stabilities); if ($this->compare($versionStabilityIndex, $constraintStabilityIndex) !== 0) {...
php
{ "resource": "" }
q236172
Element.setAttribute
train
public function setAttribute( $attr, $value ) { //data-* attribute or in valid attribute array if( strpos( $attr, 'data-' ) === 0 || in_array( $attr, $this->validAttributes ) ) { $this->attrs[$attr] = $value; } else { throw new Exception\InvalidAttributeException( $a...
php
{ "resource": "" }
q236173
Element.getAttribute
train
public function getAttribute( $name ) { if( key_exists( $name, $this->attrs ) ) { return $this->attrs[$name]; } else { return null; } }
php
{ "resource": "" }
q236174
Element.getHTML
train
public function getHTML() { $tag = "<" . $this->name; $q = $this->quoteType; //build attribute strings foreach( $this->attrs as $name=>$value ) { //if true, such as CHECKED, we just add the name if( $value === true ) { $tag .= " $name"; ...
php
{ "resource": "" }
q236175
Element.setQuote
train
public function setQuote( $type ) { $this->quoteType = $quoteType == self::SINGLE_QUOTE ? self::SINGLE_QUOTE : self::DOUBLE_QUOTE; }
php
{ "resource": "" }
q236176
Element.addValidAttributes
train
protected function addValidAttributes( $attrs ) { foreach( $attrs as $attr ) { //add if string if( is_string( $attr ) ) { $this->validAttributes[] = $attr; } } }
php
{ "resource": "" }
q236177
Select._formatOrder
train
private function _formatOrder() { $orders = array(); if (isset($this->_order[DbInterface::ORDER_RAND])) { $orders[] = 'RAND()'; } else { foreach ($this->_order as $field => $order) { $orders[] = "`$field` $order"; } } retu...
php
{ "resource": "" }
q236178
Select._doQuery
train
private function _doQuery($pLimitOne) { try { if (empty($this->_fields)) { $fields = '*'; } else { $fields = '`' . implode('`, `', $this->_fields) . '`'; } $query = " SELECT $fields ...
php
{ "resource": "" }
q236179
Select.fetchAll
train
public function fetchAll($pSingle = false) { if ($this->_stm === false) { return array(); } if ($pSingle) { return $this->_stm->fetch(PDO::FETCH_ASSOC); } return $this->_stm->fetchAll(PDO::FETCH_ASSOC); }
php
{ "resource": "" }
q236180
Select.fetchAllAsItems
train
public function fetchAllAsItems($pSingle = false) { $data = array(); if ($this->_stm === false) { return $data; } while ($row = $this->_stm->fetch(PDO::FETCH_ASSOC)) { if ($pSingle) { return Agl::getModel($this->_dbContainer, $row); ...
php
{ "resource": "" }
q236181
Configuration.add
train
public function add( $key, $value ) { if ( ! array_key_exists( $key, $this->attributes ) ) { $this->attributes[ $key ] = $value; } else { if ( ! \is_array( $this->attributes[ $key ] ) ) { $this->attributes[ $key ] = array( $this->attributes[ $key ], $value ); } else { $this->attributes[ $key ][] = ...
php
{ "resource": "" }
q236182
Maestrano_Saml_Response.getAttributes
train
public function getAttributes() { if ($this->cachedAttributes != null) { return $this->cachedAttributes; } $entries = $this->_queryAssertion('/saml:AttributeStatement/saml:Attribute'); $this->cachedAttributes = array(); /** $entry DOMNode */ foreach ($entr...
php
{ "resource": "" }
q236183
SimpleQuestionHelper.getFormattedQuestion
train
public function getFormattedQuestion($question, $default, array $options) { if ($this->isList($options)) { /** * Options list mode */ return $this->getFormattedListQuestion($question, $default, $options); } else { /** * Simpl...
php
{ "resource": "" }
q236184
SimpleQuestionHelper.getFormattedListQuestion
train
protected function getFormattedListQuestion($question, $default, array $options) { $list = ''; foreach ($options as $key => $title) { $list .= " $key - $title".($default == $key ? ' (Default)' : '').PHP_EOL; } return $question.":\n".$list; }
php
{ "resource": "" }
q236185
SimpleQuestionHelper.getFormattedSimpleQuestion
train
protected function getFormattedSimpleQuestion($question, $default, array $options) { $question .= '%s'; $question = sprintf( $question, ($options ? ' ('.implode('/', $options).')' : '') ); return $question; }
php
{ "resource": "" }
q236186
SimpleQuestionHelper.getValidator
train
protected function getValidator(array $options, $required, $optionValueIsAnswer) { // @codingStandardsIgnoreStart if ($options) { $useValue = $this->isList($options) && $optionValueIsAnswer; return function ($value) use ($options, $useValue) { if ($useValue &...
php
{ "resource": "" }
q236187
CustomRequest.copy
train
public static function copy(HttpRequest $request) { return new self( $request->getHost(), $request->getUri(), $request->getMethod(), $request->getHeaders(), $request->getBody() ); }
php
{ "resource": "" }
q236188
CustomRequest.jsonSerialize
train
public function jsonSerialize() { return [ 'host' => $this->host, 'uri' => $this->uri, 'method' => $this->method, 'headers' => $this->headers, 'body' => $this->body ]; }
php
{ "resource": "" }
q236189
Di.setEventsManager
train
protected function setEventsManager() { $ev = new EventsManager(); $ev->enablePriorities(true); $ev->collectResponses(true); $this->set('eventsManager', $ev, true); return $this; }
php
{ "resource": "" }
q236190
AbstractFileSource.setData
train
public function setData( array $data, bool $doReload = true ) { $this->logInfo( 'Manual set new data' . ( $doReload ? ' and reload.' : '.' ), __CLASS__ ); $this->_options[ 'data' ] = $data; if ( $doReload ) { $this->reload(); } return $this; }
php
{ "resource": "" }
q236191
AbstractFileSource.read
train
public function read( $identifier, $defaultTranslation = false ) { if ( ! isset( $this->_options[ 'data' ] ) ) { $this->reload(); } if ( ! \is_int( $identifier ) && ! \is_string( $identifier ) ) { // No identifier => RETURN ALL REGISTERED TRANSLATIONS return...
php
{ "resource": "" }
q236192
Configuration.addConfigurationLoader
train
public static function addConfigurationLoader($id, $loader) { if (array_key_exists($id, self::$configurationLoaders)) { throw new \Exception("there is already a configuration loader for id $id"); } $reflection = new \ReflectionClass($loader); if (!$reflection->implementsInterface(ConfigurationLoa...
php
{ "resource": "" }
q236193
LoadCustomFieldsGroup.createReport
train
private function createReport( ObjectManager $manager, array $name, array $options = array()) { echo $name['fr']." \n"; $cFGroup = (new CustomFieldsGroup()) ->setName($name) ->setEntity('Chill\ReportBundle\Entity\Report') -...
php
{ "resource": "" }
q236194
StructureController.actionRegenerateSlugs
train
public function actionRegenerateSlugs() { $this->elements = (new Query()) ->select(['id', 'parent_id']) ->from(BaseStructure::tableName()) ->orderBy(['parent_id' => SORT_ASC]) ->indexBy('id') ->all(); foreach ($this->elements as &$element)...
php
{ "resource": "" }
q236195
InvalidArgumentTypeException.constructException
train
private function constructException() { $this->details['argument_type_error'][$this->argument] = $this->details['argument_type_error']['ARG']; $this->details['argument_type_error'][$this->argument] = str_replace(['VAR_TYPE', 'ARG_TYPE'], [$this->argumentValueType, $this->argumentType], $this->detail...
php
{ "resource": "" }
q236196
SafeBrowsing.listed
train
public function listed(string $url, $returnType = false) { if (empty($this->apiKey)) { throw new Exception('A Google Safebrowsing API key has not been specified'); } // Retrieve the result from SafeBrowsing $result = $this->getSafebrowsingResult($url); // Check ...
php
{ "resource": "" }
q236197
SafeBrowsing.getSafebrowsingResult
train
protected function getSafebrowsingResult(string $url) { // Prepare the Safebrowsing API URL and // populate the API key for the request $safebrowsingUrl = sprintf('https://safebrowsing.googleapis.com/v4/threatMatches:find?key=%s', $this->apiKey); // Prepare the payload that will be ...
php
{ "resource": "" }
q236198
User.checkAuthorisation
train
public function checkAuthorisation($object, $functionName) { // Check whether the user has authenticated. if ($this->isAuthenticated()) { // The user is authenticated. Proceed. $class = $object; if (is_object($class)) { $class = get_class($class); ...
php
{ "resource": "" }
q236199
User.destroy
train
public function destroy() { parent::destroy(); Logger::get()->debug('Destroying user ' . $this->id); // If this user is the one stored in the session, destroy that too. if (!empty($_SESSION) && ($_SESSION['current_user'] == $this)) { unset($_SESSION['current_user']); ...
php
{ "resource": "" }