_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 33 8k | 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 | 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];
}
| php | {
"resource": ""
} |
q8702 | Location.addPath | train | public function addPath($value)
{
if ($this->path === null) {
| php | {
"resource": ""
} |
q8703 | Location.addSpan | train | public function addSpan($value)
{
if ($this->span === null) {
| php | {
"resource": ""
} |
q8704 | Location.addLeadingDetachedComments | train | public function addLeadingDetachedComments($value)
{
if ($this->leading_detached_comments === null) { | php | {
"resource": ""
} |
q8705 | Revisionable.getOldAttributes | train | public function getOldAttributes()
{
$attributes = $this->prepareAttributes($this->original);
$attributes | php | {
"resource": ""
} |
q8706 | Revisionable.getNewAttributes | train | public function getNewAttributes()
{
$attributes = $this->prepareAttributes($this->attributes);
$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::getConnectionNamePrefix() . $manager;
// Bind manager
$this->app->singleton($managerName, function () use ($settings) {
$manager = EntityManager::create(
ConnectionManager::resolve(array_get($settings, 'connection')),
MetaDataManager::resolve(array_get($settings, 'meta'))
);
$configuration = $manager->getConfiguration();
// Listeners
if (isset($settings['events']['listeners'])) {
foreach ($settings['events']['listeners'] as $event => $listener) {
$manager->getEventManager()->addEventListener($event, $listener);
}
}
// Subscribers
if (isset($settings['events']['subscribers'])) {
foreach ($settings['events']['subscribers'] as $subscriber) {
$manager->getEventManager()->addEventSubscriber($subscriber);
}
}
// Filters
if (isset($settings['filters'])) {
foreach ($settings['filters'] as $name => $filter) {
$configuration->getMetadataDriverImpl()->addFilter($name, $filter);
$manager->getFilters()->enable($name);
}
}
// Paths
$configuration->getMetadataDriverImpl()->addPaths(
| php | {
"resource": ""
} |
q8709 | DoctrineServiceProvider.registerEntityManager | train | protected function registerEntityManager()
{
// Bind the default Entity Manager
$this->app->singleton('em', function ($app) {
| 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'] === true) {
$debugStack = new DebugStack();
$configuration->setSQLLogger($debugStack);
$this->app['debugbar']->addCollector(
new DoctrineCollector($debugStack)
);
}
$configuration->getMetadataDriverImpl()->addPaths([
__DIR__ . '/Migrations',
__DIR__ . '/Auth/Passwords'
]);
// Automatically make | 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; | 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
$rules = (is_array($filter)) ? $filter : explode('|', $filter);
// At least a rule is set and the input
// field exists.
if (count($rules) and isset($inputs[$name])) {
foreach ($rules as $rule) {
$splitAt = strpos($rule, ':');
$argument = null;
if | 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>', | php | {
"resource": ""
} |
q8714 | Filters.filterNumberFormat | train | private function filterNumberFormat($value, $argument = null)
{
if ($argument and | php | {
"resource": ""
} |
q8715 | ValidatorManager.validate | train | public function validate($endpoint, $value, $configKey = 'upload_validators')
{
$validationConfiguration = $this->configuration->getValue($endpoint, $configKey);
| 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');
}
// open browser if connection uses custom SID (not defaultly autogenerated)
if (!$this->con->isCustomSidProvided()) {
if (null === $browserName) {
throw new \InvalidArgumentException('Specify browser to run in');
}
$this->con->start($browserName);
$limit = 600;
while (!$this->con->isReady()) {
usleep(100000);
if (--$limit <= 0) {
throw new Exception\ConnectionException(
'Connection time limit reached'
);
| php | {
"resource": ""
} |
q8717 | Client.stop | train | public function stop()
{
if (!$this->started) {
throw new Exception\ConnectionException('Client is not started');
}
| 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';
}
| 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 {
| php | {
"resource": ""
} |
q8720 | Client.findDiv | train | public function findDiv($id = null, array $relations = array())
| php | {
"resource": ""
} |
q8721 | Client.findImage | train | public function findImage($id = null, array $relations = array())
| php | {
"resource": ""
} |
q8722 | Client.findLabel | train | public function findLabel($id = null, array $relations = array())
| php | {
"resource": ""
} |
q8723 | Client.findLink | train | public function findLink($id = null, array $relations = array())
| php | {
"resource": ""
} |
q8724 | Client.findListItem | train | public function findListItem($id = null, array $relations = array())
| php | {
"resource": ""
} |
q8725 | Client.findSpan | train | public function findSpan($id = null, array $relations = array())
| php | {
"resource": ""
} |
q8726 | Client.findButton | train | public function findButton($id = null, array $relations = array())
| php | {
"resource": ""
} |
q8727 | Client.findCheckbox | train | public function findCheckbox($id = null, array $relations = array())
| php | {
"resource": ""
} |
q8728 | Client.findFile | train | public function findFile($id = null, array $relations = array())
| php | {
"resource": ""
} |
q8729 | Client.findHidden | train | public function findHidden($id = null, array $relations = array())
| php | {
"resource": ""
} |
q8730 | Client.findImageSubmitButton | train | public function findImageSubmitButton($id = null, array $relations = array())
| php | {
"resource": ""
} |
q8731 | Client.findOption | train | public function findOption($id = null, array $relations = array())
| php | {
"resource": ""
} |
q8732 | Client.findPassword | train | public function findPassword($id = null, array $relations = array())
| php | {
"resource": ""
} |
q8733 | Client.findRadio | train | public function findRadio($id = null, array $relations = array())
| php | {
"resource": ""
} |
q8734 | Client.findReset | train | public function findReset($id = null, array $relations = array())
| php | {
"resource": ""
} |
q8735 | Client.findSelect | train | public function findSelect($id = null, array $relations = array())
| php | {
"resource": ""
} |
q8736 | Client.findSubmit | train | public function findSubmit($id = null, array $relations = array())
| php | {
"resource": ""
} |
q8737 | Client.findTextarea | train | public function findTextarea($id = null, array $relations = array())
| php | {
"resource": ""
} |
q8738 | Client.findTextbox | train | public function findTextbox($id = null, array $relations = array())
| php | {
"resource": ""
} |
q8739 | Client.findCell | train | public function findCell($id = null, array $relations = array())
| php | {
"resource": ""
} |
q8740 | Client.findRow | train | public function findRow($id = null, array $relations = array())
| php | {
"resource": ""
} |
q8741 | Client.findTableHeader | train | public function findTableHeader($id = null, array $relations = array())
| php | {
"resource": ""
} |
q8742 | Client.findTable | train | public function findTable($id = null, array $relations = array())
| php | {
"resource": ""
} |
q8743 | InstallerController.store | train | public function store(Request $request, Installer $processor)
{
| php | {
"resource": ""
} |
q8744 | KeyGenerator.fromEndpoint | train | public static function fromEndpoint(Endpoint $endpoint)
{
return | 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\MelisSearchService $searchIndex */
$searchIndex = $this->getServiceLocator()->get('MelisSearch');
if ($moduleName && $pageId) {
$tmpexPageIds = explode(';', $excludes);
$exPageIds = [];
foreach ($tmpexPageIds as $id) {
if ($id) {
$exPageIds[] = $id;
}
}
/** Checks if the site's folder is that of MelisSite or Vendor */
$moduleDirectory = null;
if (is_dir($_SERVER['DOCUMENT_ROOT'] . self::MELIS_SITES . $moduleName)) {
/** Module is located inside MelisSites folder */
| php | {
"resource": ""
} |
q8746 | QueryFilter.getValue | train | public function getValue($name)
{
return (isset($this->options['params'][$name])) | 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'][$param]($query, $value);
}
);
| 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:
$serverPid = $this->getServerPid();
if ($serverPid !== 0) {
return $serverPid;
}
// startup server:
$phpPath = $this->config['php_path'];
$startupCommand = escapeshellcmd($phpPath . ' ' | php | {
"resource": ""
} |
q8749 | AngelaControl.stop | train | public function stop() : bool
{
$serverPid = $this->getServerPid();
if ($serverPid === 0) {
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) {
| 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)) {
| php | {
"resource": ""
} |
q8752 | AngelaControl.flushQueue | train | public function flushQueue() : bool
{
$serverPid = $this->getServerPid();
if (empty($serverPid)) {
throw new ControlException('Angela not currently | 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 => $poolConfig) {
$pids = $this->getPidsByPath($poolConfig['worker_file']);
if (empty($pids)) {
continue;
}
| 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 (strpos($line, 'grep') !== false) {
| 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 (strpos($line, 'grep') !== false) {
| 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);
| php | {
"resource": ""
} |
q8757 | OperationArguments.checkType | train | protected function checkType($value, $type, $nullable = false)
{
if (gettype($value) === $type) {
return true; | 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.',
| 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 to be %s, | php | {
"resource": ""
} |
q8760 | OperationArguments.& | train | public function & get($argname)
{
if ($this->has($argname)) {
return $this->values[$argname];
}
| php | {
"resource": ""
} |
q8761 | OperationArguments.setValue | train | public function setValue(& $value)
{
if ('append' == $this->operation) {
| php | {
"resource": ""
} |
q8762 | DoctrineTokenRepository.createNewToken | train | protected function createNewToken(CanResetPassword $user)
{
$email = $user->getEmailForPasswordReset();
| php | {
"resource": ""
} |
q8763 | DoctrineTokenRepository.deleteExpired | train | public function deleteExpired()
{
$expired = Carbon::now()->subSeconds($this->expires);
$this->makeDelete()
| 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'];
| php | {
"resource": ""
} |
q8765 | View.element | train | public function element($name, array $data = [])
{
$view = new View();
$view->type(self::VIEW_TYPE_ELEMENT); | 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()
&&
file_exists($path . trim($this->context(), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $view)
) {
$viewPath = $path . trim($this->context(), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $view;
break;
}
| 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];
| 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];
| 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',
];
| php | {
"resource": ""
} |
q8770 | FileOptions.setOptimizeFor | train | public function setOptimizeFor(\google\protobuf\FileOptions\OptimizeMode $value = null)
{
| 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' => 'nl2br',
'purify' => 'purify',
];
// Make an array of the comma separated string $filters
if (is_array($filters)) {
$filter = $filters;
} else {
$filters = strtolower($filters);
$filter = preg_replace('/\s/', '', explode(',', $filters)); | php | {
"resource": ""
} |
q8772 | TextFilter.setFilterConfig | train | public function setFilterConfig($filter, $config)
{
if (!$this->hasFilter($filter)) {
throw new Exception("No such filter | php | {
"resource": ""
} |
q8773 | TextFilter.getFilterConfig | train | public function getFilterConfig($filter)
{
if (!$this->hasFilter($filter)) {
throw new Exception("No such filter '$filter' exists.");
}
| 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 = [];
}
| 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);
| php | {
"resource": ""
} |
q8776 | TextFilter.addExcerpt | train | public function addExcerpt($current)
{
list($excerpt, $hasMore) = $this->getUntilMore($current->text); | 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;
}
}
$frontmatter = null;
if ($start !== false) {
$stop = strpos($text, $stopToken, $tokenLength - 1);
if ($stop !== false && $text[$stop - 1] === "\n") {
| 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 | 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");
| 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;
}
if (method_exists("Symfony\Component\Yaml\Yaml", "parse")) {
// symfony/yaml
$parsed = \Symfony\Component\Yaml\Yaml::parse($text);
return $parsed;
| php | {
"resource": ""
} |
q8781 | TextFilter.getTitleFromFirstH1 | train | public function getTitleFromFirstH1($text)
{
$matches = [];
$title = null;
if (preg_match("#<h1.*?>(.*)</h1>#", $text, $matches)) {
| php | {
"resource": ""
} |
q8782 | TextFilter.getTitleFromFirstHeader | train | public function getTitleFromFirstHeader($text)
{
$matches = [];
$title = null;
| php | {
"resource": ""
} |
q8783 | TextFilter.purify | train | public function purify($text)
{
$config = \HTMLPurifier_Config::createDefault();
$config->set("Cache.DefinitionImpl", null); | php | {
"resource": ""
} |
q8784 | TextFilter.markdown | train | public function markdown($text)
{
$text = \Michelf\MarkdownExtra::defaultTransform($text);
$text | php | {
"resource": ""
} |
q8785 | MorphOneOrMany.getRelationQuery | train | public function getRelationQuery(Builder $query, Builder $parent, $columns = ['*'])
{
$query = parent::getRelationQuery($query, $parent, $columns); | 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(
| php | {
"resource": ""
} |
q8787 | AbstractAccessor.setFile | train | public function setFile($path)
{
$this->con->executeStep(
| php | {
"resource": ""
} |
q8788 | AbstractAccessor.dragDrop | train | public function dragDrop(AbstractAccessor $to)
{
$this->con->executeStep(sprintf('_sahi._dragDrop(%s, | 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(
| php | {
"resource": ""
} |
q8790 | AbstractAccessor.keyPress | train | public function keyPress($charInfo, $combo = null)
{
$this->con->executeStep(
| php | {
"resource": ""
} |
q8791 | AbstractAccessor.setValue | train | public function setValue($val)
{
$this->con->executeStep(
| 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) {
| php | {
"resource": ""
} |
q8793 | AbstractAccessor.getKeyArgumentsString | train | private function getKeyArgumentsString($charInfo, $combo)
{
$arguments = json_encode($charInfo);
if (null !== $combo) {
| php | {
"resource": ""
} |
q8794 | AbstractOTP.setSecret | train | public function setSecret($secret)
{
if (!$secret instanceof Seed) {
$secret = new Seed($secret);
| 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) << | php | {
"resource": ""
} |
q8796 | AbstractOTP.counterToString | train | protected static function counterToString($counter)
{
$temp = '';
while ($counter != 0) {
$temp .= chr($counter & 0xff);
$counter >>= 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 => | 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;
}
$optionsResolver = new OptionsResolver();
$plugins->getPlugin($backup['plugin'])->configureOptionsResolver($optionsResolver);
try {
$parameter = $optionsResolver->resolve($backup['parameter']);
} catch (InvalidArgumentException $e) {
$io->warning(sprintf('Parameter not valid' . PHP_EOL . PHP_EOL . 'Message: "%s"', $e->getMessage()));
return false;
}
| 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 */
| php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.