_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q8700
ObjectMatcher.throwsException
train
public function throwsException($exceptionClassOrObject): ObjectExceptionMatcher { $class = is_string($exceptionClassOrObject) ? $exceptionClassOrObject : get_class($exceptionClassOrObject); $matcher = $this->createInternalMatcherWithDescription(ObjectExceptionMatcher::class, 'I see that exception "' . ...
php
{ "resource": "" }
q8701
EndpointConfiguration.getValue
train
public function getValue($endpoint, $key) { if (isset($this->endpoints['endpoints'][$endpoint]) && isset($this->endpoints['endpoints'][$endpoint][$key]) ) { return $this->endpoints['endpoints'][$endpoint][$key]; } if (isset($this->endpoints[$key])) { ...
php
{ "resource": "" }
q8702
Location.addPath
train
public function addPath($value) { if ($this->path === null) { $this->path = new \Protobuf\ScalarCollection(); } $this->path->add($value); }
php
{ "resource": "" }
q8703
Location.addSpan
train
public function addSpan($value) { if ($this->span === null) { $this->span = new \Protobuf\ScalarCollection(); } $this->span->add($value); }
php
{ "resource": "" }
q8704
Location.addLeadingDetachedComments
train
public function addLeadingDetachedComments($value) { if ($this->leading_detached_comments === null) { $this->leading_detached_comments = new \Protobuf\ScalarCollection(); } $this->leading_detached_comments->add($value); }
php
{ "resource": "" }
q8705
Revisionable.getOldAttributes
train
public function getOldAttributes() { $attributes = $this->prepareAttributes($this->original); $attributes = $this->getRevisionableItems($attributes); return $attributes; }
php
{ "resource": "" }
q8706
Revisionable.getNewAttributes
train
public function getNewAttributes() { $attributes = $this->prepareAttributes($this->attributes); $attributes = $this->getRevisionableItems($attributes); return $attributes; }
php
{ "resource": "" }
q8707
Invoice.generateSecurityCode
train
public function generateSecurityCode() { $result = $this->getCertificatePrivateKey(); $result .= $this->getOib(); $result .= $this->getDateTime(); $result .= $this->getInvoiceNumber()->getInvoiceNumber(); $result .= $this->getInvoiceNumber()->getBusinessLocationCode(); ...
php
{ "resource": "" }
q8708
DoctrineServiceProvider.setUpEntityManagers
train
protected function setUpEntityManagers() { $managers = []; $connections = []; foreach ($this->config['managers'] as $manager => $settings) { $managerName = IlluminateRegistry::getManagerNamePrefix() . $manager; $connectionName = IlluminateRegistry::getConnectio...
php
{ "resource": "" }
q8709
DoctrineServiceProvider.registerEntityManager
train
protected function registerEntityManager() { // Bind the default Entity Manager $this->app->singleton('em', function ($app) { return $app->make(ManagerRegistry::class)->getManager(); }); $this->app->alias('em', EntityManager::class); $this->app->alias('em', Entit...
php
{ "resource": "" }
q8710
DoctrineServiceProvider.setupMetaData
train
protected function setupMetaData() { MetaDataManager::registerDrivers( $this->config['meta']['drivers'], $this->config['dev'] ); MetaDataManager::resolved(function (Configuration $configuration) { // Debugbar if ($this->config['debugbar'] ===...
php
{ "resource": "" }
q8711
CacheManager.setup
train
public static function setup($caches, Logger $logger = null, $logLevel = null) { if (!is_array($caches)) { $caches = array(self::_DEFAULT => array('backend' => $caches)); } self::$logger = $logger; self::$logLevel = $logLevel; foreach ($caches as $name => $optio...
php
{ "resource": "" }
q8712
Filters.apply
train
public function apply() { $filters = $this->filters; $inputs = $this->inputs; $assistant = $this->assistant; if (count($filters)) { foreach ($filters as $name => $filter) { // Allow filter to defined as array or pipe delimited string...
php
{ "resource": "" }
q8713
Filters.filterStripTags
train
private function filterStripTags($value, $argument = null) { $allowedTags = array('<p>', '<a>', '<b>', '<i>', '<em>', '<strong>', '<img>', '<br>', '<ul>', '<ol>', '<li>', '<span>', '<blockquote>', '<code>', '<sub>', '<sup>', '<h1>', '<h2>', '<h3>', '<h4>', '<h5>', '<h6>', '<dd>', '<dl>', '<label>'); ...
php
{ "resource": "" }
q8714
Filters.filterNumberFormat
train
private function filterNumberFormat($value, $argument = null) { if ($argument and is_int($argument)) { $value = number_format($value, $argument); } return $value; }
php
{ "resource": "" }
q8715
ValidatorManager.validate
train
public function validate($endpoint, $value, $configKey = 'upload_validators') { $validationConfiguration = $this->configuration->getValue($endpoint, $configKey); foreach ((array) $validationConfiguration as $validationType => $config) { $validator = $this->validators->getValidator($vali...
php
{ "resource": "" }
q8716
Client.start
train
public function start($browserName = null) { if ($this->started) { throw new Exception\ConnectionException('Client is already started'); } if (!$this->con->isProxyStarted()) { throw new Exception\ConnectionException('Sahi proxy seems not running'); } ...
php
{ "resource": "" }
q8717
Client.stop
train
public function stop() { if (!$this->started) { throw new Exception\ConnectionException('Client is not started'); } if ($this->browserAutoruned) { $this->con->stop(); } $this->started = false; }
php
{ "resource": "" }
q8718
Client.navigateTo
train
public function navigateTo($url, $reload = null) { $arguments = array(json_encode($url)); if (null !== $reload) { $arguments[] = (bool) $reload ? 'true' : 'false'; } $this->con->executeStep(sprintf('_sahi._navigateTo(%s)', implode(', ', $arguments))); }
php
{ "resource": "" }
q8719
Client.wait
train
public function wait($timeout, $condition) { $conditionResult = false; while ($timeout > 0 && true !== $conditionResult) { usleep(100); $timeout -= 100; // don't throw exceptions try { $conditionResult = $this->con->evaluateJavascript(...
php
{ "resource": "" }
q8720
Client.findDiv
train
public function findDiv($id = null, array $relations = array()) { return new Accessor\DivAccessor($id, $relations, $this->con); }
php
{ "resource": "" }
q8721
Client.findImage
train
public function findImage($id = null, array $relations = array()) { return new Accessor\ImageAccessor($id, $relations, $this->con); }
php
{ "resource": "" }
q8722
Client.findLabel
train
public function findLabel($id = null, array $relations = array()) { return new Accessor\LabelAccessor($id, $relations, $this->con); }
php
{ "resource": "" }
q8723
Client.findLink
train
public function findLink($id = null, array $relations = array()) { return new Accessor\LinkAccessor($id, $relations, $this->con); }
php
{ "resource": "" }
q8724
Client.findListItem
train
public function findListItem($id = null, array $relations = array()) { return new Accessor\ListItemAccessor($id, $relations, $this->con); }
php
{ "resource": "" }
q8725
Client.findSpan
train
public function findSpan($id = null, array $relations = array()) { return new Accessor\SpanAccessor($id, $relations, $this->con); }
php
{ "resource": "" }
q8726
Client.findButton
train
public function findButton($id = null, array $relations = array()) { return new Accessor\Form\ButtonAccessor($id, $relations, $this->con); }
php
{ "resource": "" }
q8727
Client.findCheckbox
train
public function findCheckbox($id = null, array $relations = array()) { return new Accessor\Form\CheckboxAccessor($id, $relations, $this->con); }
php
{ "resource": "" }
q8728
Client.findFile
train
public function findFile($id = null, array $relations = array()) { return new Accessor\Form\FileAccessor($id, $relations, $this->con); }
php
{ "resource": "" }
q8729
Client.findHidden
train
public function findHidden($id = null, array $relations = array()) { return new Accessor\Form\HiddenAccessor($id, $relations, $this->con); }
php
{ "resource": "" }
q8730
Client.findImageSubmitButton
train
public function findImageSubmitButton($id = null, array $relations = array()) { return new Accessor\Form\ImageSubmitButtonAccessor($id, $relations, $this->con); }
php
{ "resource": "" }
q8731
Client.findOption
train
public function findOption($id = null, array $relations = array()) { return new Accessor\Form\OptionAccessor($id, $relations, $this->con); }
php
{ "resource": "" }
q8732
Client.findPassword
train
public function findPassword($id = null, array $relations = array()) { return new Accessor\Form\PasswordAccessor($id, $relations, $this->con); }
php
{ "resource": "" }
q8733
Client.findRadio
train
public function findRadio($id = null, array $relations = array()) { return new Accessor\Form\RadioAccessor($id, $relations, $this->con); }
php
{ "resource": "" }
q8734
Client.findReset
train
public function findReset($id = null, array $relations = array()) { return new Accessor\Form\ResetAccessor($id, $relations, $this->con); }
php
{ "resource": "" }
q8735
Client.findSelect
train
public function findSelect($id = null, array $relations = array()) { return new Accessor\Form\SelectAccessor($id, $relations, $this->con); }
php
{ "resource": "" }
q8736
Client.findSubmit
train
public function findSubmit($id = null, array $relations = array()) { return new Accessor\Form\SubmitAccessor($id, $relations, $this->con); }
php
{ "resource": "" }
q8737
Client.findTextarea
train
public function findTextarea($id = null, array $relations = array()) { return new Accessor\Form\TextareaAccessor($id, $relations, $this->con); }
php
{ "resource": "" }
q8738
Client.findTextbox
train
public function findTextbox($id = null, array $relations = array()) { return new Accessor\Form\TextboxAccessor($id, $relations, $this->con); }
php
{ "resource": "" }
q8739
Client.findCell
train
public function findCell($id = null, array $relations = array()) { return new Accessor\Table\CellAccessor($id, $relations, $this->con); }
php
{ "resource": "" }
q8740
Client.findRow
train
public function findRow($id = null, array $relations = array()) { return new Accessor\Table\RowAccessor($id, $relations, $this->con); }
php
{ "resource": "" }
q8741
Client.findTableHeader
train
public function findTableHeader($id = null, array $relations = array()) { return new Accessor\Table\TableHeaderAccessor($id, $relations, $this->con); }
php
{ "resource": "" }
q8742
Client.findTable
train
public function findTable($id = null, array $relations = array()) { return new Accessor\Table\TableAccessor($id, $relations, $this->con); }
php
{ "resource": "" }
q8743
InstallerController.store
train
public function store(Request $request, Installer $processor) { return $processor->store($this, $request->all()); }
php
{ "resource": "" }
q8744
KeyGenerator.fromEndpoint
train
public static function fromEndpoint(Endpoint $endpoint) { return static::generateKey(strtolower($endpoint->getRegion()->getDomain()).$endpoint->getUrl()); }
php
{ "resource": "" }
q8745
MelisFrontSearchController.addLuceneIndexAction
train
public function addLuceneIndexAction() { $moduleName = $this->params()->fromRoute('moduleName', null); $pageId = $this->params()->fromRoute('pageid', null); $excludes = $this->params()->fromRoute('expageid', null); $status = ''; /** @var \MelisEngine\Service\MelisSearchServi...
php
{ "resource": "" }
q8746
QueryFilter.getValue
train
public function getValue($name) { return (isset($this->options['params'][$name])) ? $this->options['params'][$name] : null; }
php
{ "resource": "" }
q8747
QueryFilter.run
train
public function run($query) { $options = $this->options; if ($this->hasActiveFilters()) { foreach ($options['params'] as $param => $value) { $query->where( function ($query) use ($options, $param, $value) { $options['filters'][$...
php
{ "resource": "" }
q8748
AngelaControl.start
train
public function start() : int { $pathToServerScript = $this->config['server_path']; if (!file_exists($pathToServerScript)) { throw new ControlException('Server script not found. Check server_path in your config file.'); } // check if process is already running: $...
php
{ "resource": "" }
q8749
AngelaControl.stop
train
public function stop() : bool { $serverPid = $this->getServerPid(); if ($serverPid === 0) { return true; } $response = $this->sendCommand('stop'); if ($response !== 'ok') { throw new ControlException('Shutdown failed.'); } return true; ...
php
{ "resource": "" }
q8750
AngelaControl.restart
train
public function restart() : int { $pid = $this->getServerPid(); if (empty($pid)) { return $this->start(); } $stopped = $this->stop(); if ($stopped !== true) { throw new ControlException('Error while stopping current Angela process.'); } ...
php
{ "resource": "" }
q8751
AngelaControl.status
train
public function status() : array { $serverPid = $this->getServerPid(); if (empty($serverPid)) { throw new ControlException('Angela not currently running.'); } $response = $this->sendCommand('status'); if (empty($response)) { throw new ControlException(...
php
{ "resource": "" }
q8752
AngelaControl.flushQueue
train
public function flushQueue() : bool { $serverPid = $this->getServerPid(); if (empty($serverPid)) { throw new ControlException('Angela not currently running.'); } $response = $this->sendCommand('flush_queue'); if ($response !== 'ok') { throw new Control...
php
{ "resource": "" }
q8753
AngelaControl.kill
train
public function kill() : bool { // kill server process: $serverPid = $this->getServerPid(); if (!empty($serverPid)) { $this->killProcessById($serverPid); } // kill worker processes: $workerPids = []; foreach ($this->config['pool'] as $poolName => ...
php
{ "resource": "" }
q8754
AngelaControl.getPidByPath
train
protected function getPidByPath(string $path) : int { $procInfo = []; $cliOutput = []; exec('ps x | grep ' . $path, $cliOutput); foreach ($cliOutput as $line) { $line = trim($line); if (empty($line)) { continue; } if (st...
php
{ "resource": "" }
q8755
AngelaControl.getPidsByPath
train
protected function getPidsByPath(string $path) : array { $pids = []; $cliOutput = []; exec('ps x | grep ' . $path, $cliOutput); foreach ($cliOutput as $line) { $line = trim($line); if (empty($line)) { continue; } if (str...
php
{ "resource": "" }
q8756
AngelaControl.sendCommand
train
protected function sendCommand(string $command) : string { try { $client = new Client; $client->addServer($this->config['sockets']['client']); $response = $client->sendCommand($command); $client->close(); return $response; } catch (ClientEx...
php
{ "resource": "" }
q8757
OperationArguments.checkType
train
protected function checkType($value, $type, $nullable = false) { if (gettype($value) === $type) { return true; } return $nullable && null === $value; }
php
{ "resource": "" }
q8758
OperationArguments.validateArgument
train
public function validateArgument($argname, $value, $type, $nullable = false) { if (!$this->checkType($value, $type, $nullable)) { throw new OperationArgumentException(sprintf( 'Method %s() expects $%s to be %s, %s given.', $this->operation, $argnam...
php
{ "resource": "" }
q8759
OperationArguments.validateArrayArgument
train
public function validateArrayArgument($argname, array $value, $type, $nullable = false) { foreach ($value as $element) { if (!$this->checkType($element, $type, $nullable)) { throw new OperationArgumentException(sprintf( 'Method %s() expects all of $%s elements...
php
{ "resource": "" }
q8760
OperationArguments.&
train
public function & get($argname) { if ($this->has($argname)) { return $this->values[$argname]; } throw new OutOfRangeException(sprintf('Argument %s does not exist.', $argname)); }
php
{ "resource": "" }
q8761
OperationArguments.setValue
train
public function setValue(& $value) { if ('append' == $this->operation) { $this->validateArgument('value', $value, 'string'); } return $this->set('value', $value); }
php
{ "resource": "" }
q8762
DoctrineTokenRepository.createNewToken
train
protected function createNewToken(CanResetPassword $user) { $email = $user->getEmailForPasswordReset(); $value = str_shuffle(sha1($email . spl_object_hash($this) . microtime(true))); return hash_hmac('sha1', $value, $this->hashKey); }
php
{ "resource": "" }
q8763
DoctrineTokenRepository.deleteExpired
train
public function deleteExpired() { $expired = Carbon::now()->subSeconds($this->expires); $this->makeDelete() ->where('o.createdAt < :expired') ->setParameter('expired', $expired) ->getQuery() ->execute(); }
php
{ "resource": "" }
q8764
View.cell
train
public function cell($cell, array $data = [], array $options = []) { $parts = explode('::', $cell); if (count($parts) === 2) { list($cell, $action) = [$parts[0], $parts[1]]; } else { list($cell, $action) = [$parts[0], 'display']; } $className = Applica...
php
{ "resource": "" }
q8765
View.element
train
public function element($name, array $data = []) { $view = new View(); $view->type(self::VIEW_TYPE_ELEMENT); $view->set(array_merge($this->viewVars, $data)); return $view->render($name); }
php
{ "resource": "" }
q8766
View.viewContent
train
protected function viewContent($type, $view) { $ext = pathinfo($view, PATHINFO_EXTENSION); $view = ($ext === '') ? $view.'.php' : $view; foreach ($this->paths as $path) { $path .= $type . DIRECTORY_SEPARATOR; if ($this->context() && fil...
php
{ "resource": "" }
q8767
MediaGalleryUpdateObserver.initializeProductMediaGallery
train
protected function initializeProductMediaGallery(array $attr) { // load the value and the attribute ID $value = $attr[MemberNames::VALUE]; $attributeId = $attr[MemberNames::ATTRIBUTE_ID]; // query whether the product media gallery entity already exists or not if ($entity = ...
php
{ "resource": "" }
q8768
MediaGalleryUpdateObserver.initializeProductMediaGalleryValueToEntity
train
protected function initializeProductMediaGalleryValueToEntity(array $attr) { // load the value/entity ID $valueId = $attr[MemberNames::VALUE_ID]; $entityId = $attr[MemberNames::ENTITY_ID]; // query whether the product media gallery value to entity entity already exists or not ...
php
{ "resource": "" }
q8769
Authentication.parseAuthenticationConfiguration
train
protected function parseAuthenticationConfiguration(array $auth): array { $driver = $auth['defaults']['guard'] ?? null; $guard = $auth['guards'][$driver] ?? [ 'driver' => 'session', 'provider' => 'users', ]; $provider = $auth['providers'][$guard['provider']]...
php
{ "resource": "" }
q8770
FileOptions.setOptimizeFor
train
public function setOptimizeFor(\google\protobuf\FileOptions\OptimizeMode $value = null) { $this->optimize_for = $value; }
php
{ "resource": "" }
q8771
TextFilter.doFilter
train
public function doFilter($text, $filters) { // Define all valid filters with their callback function. $callbacks = [ 'bbcode' => 'bbcode2html', 'clickable' => 'makeClickable', 'shortcode' => 'shortCode', 'markdown' => 'markdown', 'nl2br...
php
{ "resource": "" }
q8772
TextFilter.setFilterConfig
train
public function setFilterConfig($filter, $config) { if (!$this->hasFilter($filter)) { throw new Exception("No such filter '$filter' exists."); } $this->config[$filter] = $config; }
php
{ "resource": "" }
q8773
TextFilter.getFilterConfig
train
public function getFilterConfig($filter) { if (!$this->hasFilter($filter)) { throw new Exception("No such filter '$filter' exists."); } return isset($this->config[$filter]) ? $this->config[$filter] : []; }
php
{ "resource": "" }
q8774
TextFilter.addToFrontmatter
train
private function addToFrontmatter($matter) { if (empty($matter) || !is_array($matter)) { return $this; } if (is_null($this->current->frontmatter)) { $this->current->frontmatter = []; } $this->current->frontmatter = array_merge($this->current->frontma...
php
{ "resource": "" }
q8775
TextFilter.parse
train
public function parse($text, $filter) { $this->current = new \stdClass(); $this->current->frontmatter = []; $this->current->text = $text; foreach ($filter as $key) { $this->parseFactory($key); } $this->current->text = $this->getUntilStop($this->current->...
php
{ "resource": "" }
q8776
TextFilter.addExcerpt
train
public function addExcerpt($current) { list($excerpt, $hasMore) = $this->getUntilMore($current->text); $current->excerpt = $excerpt; $current->hasMore = $hasMore; }
php
{ "resource": "" }
q8777
TextFilter.extractFrontMatter
train
private function extractFrontMatter($text, $startToken, $stopToken) { $tokenLength = strlen($startToken); $start = strpos($text, $startToken); // Is a valid start? if ($start !== false && $start !== 0) { if ($text[$start - 1] !== "\n") { $start = false; ...
php
{ "resource": "" }
q8778
TextFilter.jsonFrontMatter
train
public function jsonFrontMatter($text) { list($text, $frontmatter) = $this->extractFrontMatter($text, "{{{\n", "}}}\n"); if (!empty($frontmatter)) { $frontmatter = json_decode($frontmatter, true); if (is_null($frontmatter)) { throw new Exception("Failed pars...
php
{ "resource": "" }
q8779
TextFilter.yamlFrontMatter
train
public function yamlFrontMatter($text) { list($text, $frontmatter) = $this->extractFrontMatter($text, "---\n", "...\n"); if (!empty($frontmatter)) { $frontmatter = $this->yamlParse("---\n$frontmatter...\n"); } return [ "text" => $text, "frontmatt...
php
{ "resource": "" }
q8780
TextFilter.yamlParse
train
public function yamlParse($text) { if (function_exists("yaml_parse")) { // Prefer php5-yaml extension $parsed = yaml_parse($text); if ($parsed === false) { throw new Exception("Failed parsing YAML frontmatter."); } return $parsed;...
php
{ "resource": "" }
q8781
TextFilter.getTitleFromFirstH1
train
public function getTitleFromFirstH1($text) { $matches = []; $title = null; if (preg_match("#<h1.*?>(.*)</h1>#", $text, $matches)) { $title = strip_tags($matches[1]); } return $title; }
php
{ "resource": "" }
q8782
TextFilter.getTitleFromFirstHeader
train
public function getTitleFromFirstHeader($text) { $matches = []; $title = null; if (preg_match("#<h[1-6].*?>(.*)</h[1-6]>#", $text, $matches)) { $title = strip_tags($matches[1]); } return $title; }
php
{ "resource": "" }
q8783
TextFilter.purify
train
public function purify($text) { $config = \HTMLPurifier_Config::createDefault(); $config->set("Cache.DefinitionImpl", null); //$config->set('Cache.SerializerPath', '/home/user/absolute/path'); $purifier = new \HTMLPurifier($config); return $purifier->purify($text); ...
php
{ "resource": "" }
q8784
TextFilter.markdown
train
public function markdown($text) { $text = \Michelf\MarkdownExtra::defaultTransform($text); $text = \Michelf\SmartyPantsTypographer::defaultTransform( $text, "2" ); return $text; }
php
{ "resource": "" }
q8785
MorphOneOrMany.getRelationQuery
train
public function getRelationQuery(Builder $query, Builder $parent, $columns = ['*']) { $query = parent::getRelationQuery($query, $parent, $columns); return $query->where($this->morphType, $this->morphClass); }
php
{ "resource": "" }
q8786
AbstractAccessor.choose
train
public function choose($val, $isMultiple = null) { $arguments = array(json_encode($val)); if (null !== $isMultiple) { $arguments[] = (bool) $isMultiple ? 'true' : 'false'; } $this->con->executeStep( sprintf('_sahi._setSelected(%s, %s)', $this->getAccessor(), ...
php
{ "resource": "" }
q8787
AbstractAccessor.setFile
train
public function setFile($path) { $this->con->executeStep( sprintf('_sahi._setFile(%s, %s)', $this->getAccessor(), json_encode($path)) ); }
php
{ "resource": "" }
q8788
AbstractAccessor.dragDrop
train
public function dragDrop(AbstractAccessor $to) { $this->con->executeStep(sprintf('_sahi._dragDrop(%s, %s)', $this->getAccessor(), $to->getAccessor())); }
php
{ "resource": "" }
q8789
AbstractAccessor.dragDropXY
train
public function dragDropXY($x, $y, $relative = null) { $arguments = array($x, $y); if (null !== $relative) { $arguments[] = (bool) $relative ? 'true' : 'false'; } $this->con->executeStep( sprintf('_sahi._dragDropXY(%s, %s)', $this->getAccessor(), implode(', ...
php
{ "resource": "" }
q8790
AbstractAccessor.keyPress
train
public function keyPress($charInfo, $combo = null) { $this->con->executeStep( sprintf('_sahi._keyPress(%s, %s)', $this->getAccessor(), $this->getKeyArgumentsString($charInfo, $combo)) ); }
php
{ "resource": "" }
q8791
AbstractAccessor.setValue
train
public function setValue($val) { $this->con->executeStep( sprintf('_sahi._setValue(%s, %s)', $this->getAccessor(), json_encode($val)) ); }
php
{ "resource": "" }
q8792
AbstractAccessor.getAttr
train
public function getAttr($attr) { $attributeValue = $this->con->evaluateJavascript(sprintf('%s.getAttribute(%s)', $this->getAccessor(), json_encode($attr))); if ($attributeValue === false) { // see https://github.com/kriswallsmith/Buzz/pull/138 bug return ''; } ...
php
{ "resource": "" }
q8793
AbstractAccessor.getKeyArgumentsString
train
private function getKeyArgumentsString($charInfo, $combo) { $arguments = json_encode($charInfo); if (null !== $combo) { $arguments .= ', ' . json_encode($combo); } return $arguments; }
php
{ "resource": "" }
q8794
AbstractOTP.setSecret
train
public function setSecret($secret) { if (!$secret instanceof Seed) { $secret = new Seed($secret); } $this->secret = $secret; return $this; }
php
{ "resource": "" }
q8795
AbstractOTP.truncateHash
train
protected static function truncateHash($hash) { $offset = ord($hash[19]) & 0xf; $value = (ord($hash[$offset + 0]) & 0x7f) << 24; $value |= (ord($hash[$offset + 1]) & 0xff) << 16; $value |= (ord($hash[$offset + 2]) & 0xff) << 8; $value |= (ord($hash[$offset + 3]) & 0xff); ...
php
{ "resource": "" }
q8796
AbstractOTP.counterToString
train
protected static function counterToString($counter) { $temp = ''; while ($counter != 0) { $temp .= chr($counter & 0xff); $counter >>= 8; } return substr(str_pad(strrev($temp), 8, "\0", STR_PAD_LEFT), 0, 8); }
php
{ "resource": "" }
q8797
CheckCommand.checkBackups
train
private function checkBackups(SymfonyStyle $io, array $backups) { /** @var PluginRegistry $plugins */ $plugins = $this->getContainer()->get('plugins'); foreach ($backups as $name => $backup) { $this->checkBackup($plugins, $io, $name, $backup); } }
php
{ "resource": "" }
q8798
CheckCommand.checkBackup
train
private function checkBackup(PluginRegistry $plugins, SymfonyStyle $io, $name, array $backup) { $io->section('Backup: ' . $name); if (!$plugins->has($backup['plugin'])) { $io->warning(sprintf('Plugin "%s" not found', $backup['plugin'])); return false; } $opt...
php
{ "resource": "" }
q8799
CheckCommand.getBackups
train
private function getBackups() { $backups = $this->getContainer()->getParameter('nanbando.backup'); $preset = []; if ($name = $this->getParameter('nanbando.application.name')) { /** @var PresetStore $presetStore */ $presetStore = $this->getContainer()->get('presets');...
php
{ "resource": "" }