_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q246500
ElasticsearchModel.all
validation
public static function all($query = []) { if ($query instanceof QueryBuilder) { $query = $query->build(); } $collection = collect(); static::map($query, function (ElasticsearchModel $document) use ($collection) { $collection->put($document->getId(), $document)...
php
{ "resource": "" }
q246501
Filter.setOptions
validation
public function setOptions($mode = null, $logicalOperator = null, array $linkedFilters = []) { $this->mode = is_null($mode) ? Filter::MODE_INCLUDE : $mode; $this->logicalOperator = is_null($logicalOperator) ? Filter::MERGE_OR : $logicalOperator; $this->linkedFilters = $linkedFilters; ...
php
{ "resource": "" }
q246502
Filter.mergeQuery
validation
public function mergeQuery(array $query) { $types = [ Filter::MERGE_AND => 'must', Filter::MERGE_OR => 'should' ]; $type = $this->getMergeType(); $query['body']['filter']['bool'][$types[$type]][] = $this->makeQuery(); return $query; }
php
{ "resource": "" }
q246503
Filter.mergeBoolQuery
validation
protected function mergeBoolQuery(array $query1, array $query2, $type) { if (empty($query2['bool'][$type])) { return $query1; } else { if (empty($query1['bool'][$type])) { $query1['bool'][$type] = []; } } $query1['bool'][$type] = a...
php
{ "resource": "" }
q246504
QueryBuilder.fields
validation
public function fields($fields = false) { if ($fields === false) { $this->query['body']['_source'] = false; } elseif ((array)$fields == ['*']) { unset($this->query['body']['_source']); } else { $this->query['body']['_source'] = $fields; } r...
php
{ "resource": "" }
q246505
RuntimeCache.put
validation
public function put($key, Model $instance, array $attributes = ['*']) { if ($attributes != ['*'] && $this->has($key)) { $instance = Model::merge($this->cache[$key]['instance'], $instance, $attributes); $attributes = array_merge($this->cache[$key]['attributes'], $attributes); ...
php
{ "resource": "" }
q246506
RuntimeCache.getNotCachedAttributes
validation
public function getNotCachedAttributes($key, array $attributes = ['*']) { if (!$this->has($key)) { return $attributes; } $cachedAttributes = $this->cache[$key]['attributes']; return $cachedAttributes == ['*'] ? [] : array_diff($attributes, $cachedAttributes); }
php
{ "resource": "" }
q246507
Mergeable.merge
validation
public static function merge(Model $model1, Model $model2, array $attributes) { foreach ($attributes as $attribute) { $model1->$attribute = $model2->$attribute; } return $model1; }
php
{ "resource": "" }
q246508
Escape.esc_value
validation
public function esc_value( $value ) { global $wpdb; if ( is_int( $value ) ) { return $wpdb->prepare( '%d', $value ); } if ( is_float( $value ) ) { return $wpdb->prepare( '%f', $value ); } if ( is_string( $value ) ) { return 'null' === $value ? $value : $wpdb->prepare( '%s', $value ); } retu...
php
{ "resource": "" }
q246509
Escape.esc_like
validation
public function esc_like( $value, $start = '%', $end = '%' ) { global $wpdb; return $start . $wpdb->esc_like( $value ) . $end; }
php
{ "resource": "" }
q246510
Translate.translateSelect
validation
private function translateSelect() { // @codingStandardsIgnoreLine $build = array( 'select' ); if ( $this->found_rows ) { $build[] = 'SQL_CALC_FOUND_ROWS'; } if ( $this->distinct ) { $build[] = 'distinct'; } // Build the selected fields. $build[] = ! empty( $this->statements['select'] ) && is_arra...
php
{ "resource": "" }
q246511
Translate.translateUpdate
validation
private function translateUpdate() { // @codingStandardsIgnoreLine $build = array( "update {$this->table} set" ); // Add the values. $values = array(); foreach ( $this->statements['values'] as $key => $value ) { $values[] = $key . ' = ' . $this->esc_value( $value ); } if ( ! empty( $values ) ) { $bu...
php
{ "resource": "" }
q246512
Translate.translateDelete
validation
private function translateDelete() { // @codingStandardsIgnoreLine $build = array( "delete from {$this->table}" ); // Build the where statements. if ( ! empty( $this->statements['wheres'] ) ) { $build[] = join( ' ', $this->statements['wheres'] ); } // Build offset and limit. if ( ! empty( $this->limit ...
php
{ "resource": "" }
q246513
Translate.translateOrderBy
validation
protected function translateOrderBy() { // @codingStandardsIgnoreLine $build = array(); foreach ( $this->statements['orders'] as $column => $direction ) { // in case a raw value is given we had to // put the column / raw value an direction inside another // array because we cannot make objects to array k...
php
{ "resource": "" }
q246514
Database.table
validation
public static function table( $table_name ) { global $wpdb; if ( empty( self::$instances ) || empty( self::$instances[ $table_name ] ) ) { self::$instances[ $table_name ] = new Query_Builder( $wpdb->prefix . $table_name ); } return self::$instances[ $table_name ]; }
php
{ "resource": "" }
q246515
GroupBy.groupBy
validation
public function groupBy( $columns ) { // @codingStandardsIgnoreLine if ( is_string( $columns ) ) { $columns = $this->argument_to_array( $columns ); } $this->statements['groups'] = $this->statements['groups'] + $columns; return $this; }
php
{ "resource": "" }
q246516
GroupBy.having
validation
public function having( $column, $param1 = null, $param2 = null ) { $this->statements['having'] = $this->generateWhere( $column, $param1, $param2, 'having' ); return $this; }
php
{ "resource": "" }
q246517
OrderBy.orderBy
validation
public function orderBy( $columns, $direction = 'asc' ) { // @codingStandardsIgnoreLine if ( is_string( $columns ) ) { $columns = $this->argument_to_array( $columns ); } foreach ( $columns as $key => $column ) { if ( is_numeric( $key ) ) { $this->statements['orders'][ $column ] = $direction; } else ...
php
{ "resource": "" }
q246518
Where.where
validation
public function where( $column, $param1 = null, $param2 = null, $type = 'and' ) { // Check if the where type is valid. if ( ! in_array( $type, array( 'and', 'or', 'where' ) ) ) { throw new \Exception( 'Invalid where type "' . $type . '"' ); } $sub_type = is_null( $param1 ) ? $type : $param1; if ( empty( ...
php
{ "resource": "" }
q246519
Where.orWhere
validation
public function orWhere( $column, $param1 = null, $param2 = null ) { // @codingStandardsIgnoreLine return $this->where( $column, $param1, $param2, 'or' ); }
php
{ "resource": "" }
q246520
Where.generateWhere
validation
protected function generateWhere( $column, $param1 = null, $param2 = null, $type = 'and' ) { // @codingStandardsIgnoreLine // when param2 is null we replace param2 with param one as the // value holder and make param1 to the = operator. if ( is_null( $param2 ) ) { $param2 = $param1; $param1 = '='; } /...
php
{ "resource": "" }
q246521
Select.select
validation
public function select( $fields = '' ) { if ( empty( $fields ) ) { return $this; } if ( is_string( $fields ) ) { $this->statements['select'][] = $fields; return $this; } foreach ( $fields as $key => $field ) { if ( is_string( $key ) ) { $this->statements['select'][] = "$key as $field"; } ...
php
{ "resource": "" }
q246522
Select.selectFunc
validation
public function selectFunc( $func, $field, $alias = null ) { // @codingStandardsIgnoreLine $field = "$func({$field})"; if ( ! is_null( $alias ) ) { $field .= " as {$alias}"; } $this->statements['select'][] = $field; return $this; }
php
{ "resource": "" }
q246523
Query_Builder.getVar
validation
public function getVar() { // @codingStandardsIgnoreLine $row = $this->one( \ARRAY_A ); return is_null( $row ) ? false : current( $row ); }
php
{ "resource": "" }
q246524
Query_Builder.insert
validation
public function insert( $data, $format = null ) { global $wpdb; $wpdb->insert( $this->table, $data, $format ); return $wpdb->insert_id; }
php
{ "resource": "" }
q246525
Query_Builder.limit
validation
public function limit( $limit, $offset = 0 ) { global $wpdb; $limit = \absint( $limit ); $offset = \absint( $offset ); $this->limit = $wpdb->prepare( 'limit %d, %d', $offset, $limit ); return $this; }
php
{ "resource": "" }
q246526
Query_Builder.page
validation
public function page( $page, $size = 25 ) { $size = \absint( $size ); $offset = $size * \absint( $page ); $this->limit( $size, $offset ); return $this; }
php
{ "resource": "" }
q246527
Query_Builder.reset
validation
private function reset() { $this->distinct = false; $this->found_rows = false; $this->limit = null; $this->statements = [ 'select' => [], 'wheres' => [], 'orders' => [], 'values' => [], 'groups' => [], 'having' => '', ]; return $this; }
php
{ "resource": "" }
q246528
Client.request
validation
public static function request($method, $params = null) { $url = self::getUrl($method); $request_method = self::getRequestMethodName(); $response_body = self::$request_method($url, $params); $response = json_decode($response_body); if (!is_object($response)) thr...
php
{ "resource": "" }
q246529
Client.getRequestMethodName
validation
protected static function getRequestMethodName() { $request_engine = self::$requestEngine; if ($request_engine == 'curl' && !function_exists('curl_init')) { trigger_error("DetectLanguage::Client - CURL not found, switching to stream"); $request_engine = self::$requestEngine ...
php
{ "resource": "" }
q246530
Client.requestStream
validation
protected static function requestStream($url, $params) { $opts = array('http' => array( 'method' => 'POST', 'header' => implode("\n", self::getHeaders()), 'content' => json_encode($params), 'timeout' => self::$requestTimeout, ...
php
{ "resource": "" }
q246531
Client.requestCurl
validation
protected static function requestCurl($url, $params) { $ch = curl_init(); $options = array( CURLOPT_URL => $url, CURLOPT_HTTPHEADER => self::getHeaders(), CURLOPT_POSTFIELDS => json_encode($params), CURLOPT_CONNECTTIMEOUT => self::$connectTimeout, ...
php
{ "resource": "" }
q246532
DetectLanguage.simpleDetect
validation
public static function simpleDetect($text) { $detections = self::detect($text); if (count($detections) > 0) return $detections[0]->language; else return null; }
php
{ "resource": "" }
q246533
Gravatar.buildGravatarURL
validation
public function buildGravatarURL($email, $hash_email = true) { // Start building the URL, and deciding if we're doing this via HTTPS or HTTP. if($this->usingSecureImages()) { $url = static::HTTPS_URL; } else { $url = static::HTTP_URL; } // Tack the email hash onto the end. if($hash_email == tr...
php
{ "resource": "" }
q246534
CreateFontCommand.execute
validation
protected function execute(InputInterface $input, OutputInterface $output){ $directory = $input->getArgument('directory'); $outputFile = $input->getArgument('output-file'); $generator = new IconFontGenerator; $output->writeln('reading files from "'.$directory.'" ...'); $generator->generateFromDir($director...
php
{ "resource": "" }
q246535
CreateCssCommand.execute
validation
protected function execute(InputInterface $input, OutputInterface $output){ $fontFile = realpath($input->getArgument('font-file')); if($fontFile === false || !file_exists($fontFile)){ throw new \InvalidArgumentException('"'.$input->getArgument('font-file').'" does not exist'); } $outputFile = $input->getAr...
php
{ "resource": "" }
q246536
CreateFilesCommand.execute
validation
protected function execute(InputInterface $input, OutputInterface $output){ $fontFile = realpath($input->getArgument('font-file')); if($fontFile === false || !file_exists($fontFile)){ throw new \InvalidArgumentException('"'.$input->getArgument('font-file').'" does not exist'); } $outputDirectory = realpath...
php
{ "resource": "" }
q246537
Font.setOptions
validation
public function setOptions($options = array()){ $this->options = array_merge($this->options, $options); $this->xmlDocument->defs[0]->font[0]['id'] = $this->options['id']; $this->xmlDocument->defs[0]->font[0]['horiz-adv-x'] = $this->options['horiz-adv-x']; $this->xmlDocument->defs[0]->font[0]->{'font-face'}[0]...
php
{ "resource": "" }
q246538
Font.getOptionsFromXML
validation
protected function getOptionsFromXML(){ $options = array(); foreach(array('id', 'horiz-adv-x') as $key){ if(isset($this->xmlDocument->defs[0]->font[0][$key])){ $options[$key] = (string)$this->xmlDocument->defs[0]->font[0][$key]; } } foreach(array('units-per-em', 'ascent', 'descent', 'x-height', 'cap...
php
{ "resource": "" }
q246539
Font.addGlyph
validation
public function addGlyph($char, $path, $name = null, $width = null){ $glyph = $this->xmlDocument->defs[0]->font[0]->addChild('glyph'); $glyph->addAttribute('unicode', $char); if($name !== null){ $glyph->addAttribute('glyph-name', $name); } if($width !== null){ $glyph->addAttribute('horiz-adv-x', $width...
php
{ "resource": "" }
q246540
Font.getGlyphs
validation
public function getGlyphs(){ if( !isset($this->xmlDocument->defs[0]->font[0]->glyph) || !count($this->xmlDocument->defs[0]->font[0]->glyph) ){ return array(); } $glyphs = array(); foreach($this->xmlDocument->defs[0]->font[0]->glyph as $xmlGlyph){ if(isset($xmlGlyph['unicode']) && isset($xmlGlyph[...
php
{ "resource": "" }
q246541
IconFontGenerator.getGlyphNames
validation
public function getGlyphNames(){ $glyphNames = array(); foreach($this->font->getGlyphs() as $glyph){ $glyphNames[static::unicodeToHex($glyph['char'])] = empty($glyph['name']) ? null : $glyph['name']; } return $glyphNames; }
php
{ "resource": "" }
q246542
IconFontGenerator.getCss
validation
public function getCss(){ $css = ''; foreach($this->getGlyphNames() as $unicode => $name){ $css .= ".icon-".$name.":before {"."\n"; $css .= "\tcontent: \"\\".$unicode."\";\n"; $css .= "}\n"; } return $css; }
php
{ "resource": "" }
q246543
IconFontGenerator.unicodeToHex
validation
public static function unicodeToHex($char){ if(!is_string($char) || mb_strlen($char, 'utf-8') !== 1){ throw new \InvalidArgumentException('$char must be one single character'); } $unicode = unpack('N', mb_convert_encoding($char, 'UCS-4BE', 'UTF-8')); return dechex($unicode[1]); }
php
{ "resource": "" }
q246544
IconFontGenerator.hexToUnicode
validation
protected static function hexToUnicode($char){ if(!is_string($char) || !preg_match('(^[0-9a-f]{2,6}$)i', $char)){ throw new \InvalidArgumentException('$char must be one single unicode character as hex string'); } return mb_convert_encoding('&#x'.strtolower($char).';', 'UTF-8', 'HTML-ENTITIES'); }
php
{ "resource": "" }
q246545
Document.getPath
validation
public function getPath($scale = 1, $roundPrecision = null, $flip = 'none', $onlyFilled = true, $xOffset = 0, $yOffset = 0){ $path = $this->getPathPart($this->xmlDocument, $onlyFilled); if($scale !== 1 || $roundPrecision !== null || $flip !== 'none' || $xOffset !== 0 || $yOffset !== 0){ $path = $this->transfor...
php
{ "resource": "" }
q246546
Document.getPathPart
validation
protected function getPathPart(SimpleXMLElement $xmlElement, $onlyFilled){ $path = ''; if($xmlElement === null){ $xmlElement = $this->xmlDocument; } foreach($xmlElement->children() as $child){ $childName = $child->getName(); if(!empty($child['transform'])){ throw new \Exception('Transforms are c...
php
{ "resource": "" }
q246547
Document.transformPath
validation
protected function transformPath($path, $scale, $roundPrecision, $flip, $xOffset, $yOffset){ if($flip === 'horizontal' || $flip === 'vertical'){ $viewBox = $this->getViewBox(); } return preg_replace_callback('([m,l,h,v,c,s,q,t,a,z](?:[\\s,]*-?(?=\\.?\\d)\\d*(?:\\.\\d+)?)*)i', function($maches) use ($scale, $...
php
{ "resource": "" }
q246548
Document.getPathFromPolygon
validation
protected function getPathFromPolygon(SimpleXMLElement $polygon){ $points = $this->getValuesFromList($polygon['points']); $path = 'M'.array_shift($points).' '.array_shift($points); while(count($points)){ $path .= 'L'.array_shift($points).' '.array_shift($points); } return $path.'Z'; }
php
{ "resource": "" }
q246549
Document.getPathFromRect
validation
protected function getPathFromRect(SimpleXMLElement $rect){ if(empty($rect['width']) || $rect['width'] < 0 || empty($rect['height']) || $rect['height'] < 0){ return ''; } if(empty($rect['x'])){ $rect['x'] = 0; } if(empty($rect['y'])){ $rect['y'] = 0; } return 'M'.$rect['x'].' '.$rect['y'].'l'.$r...
php
{ "resource": "" }
q246550
Document.getPathFromCircle
validation
protected function getPathFromCircle(SimpleXMLElement $circle){ $mult = 0.55228475; return 'M'.($circle['cx']-$circle['r']).' '.$circle['cy']. 'C'.($circle['cx']-$circle['r']).' '.($circle['cy']-$circle['r']*$mult).' '.($circle['cx']-$circle['r']*$mult).' '.($circle['cy']-$circle['r']).' '.$circle['cx'].' '....
php
{ "resource": "" }
q246551
Document.getPathFromEllipse
validation
protected function getPathFromEllipse(SimpleXMLElement $ellipse){ $mult = 0.55228475; return 'M'.($ellipse['cx']-$ellipse['rx']).' '.$ellipse['cy']. 'C'.($ellipse['cx']-$ellipse['rx']).' '.($ellipse['cy']-$ellipse['ry']*$mult).' '.($ellipse['cx']-$ellipse['rx']*$mult).' '.($ellipse['cy']-$ellipse['ry']).' '....
php
{ "resource": "" }
q246552
CreateInfoCommand.execute
validation
protected function execute(InputInterface $input, OutputInterface $output){ $fontFile = realpath($input->getArgument('font-file')); if($fontFile === false || !file_exists($fontFile)){ throw new \InvalidArgumentException('"'.$input->getArgument('font-file').'" does not exist'); } $outputFile = $input->getAr...
php
{ "resource": "" }
q246553
CreateInfoCommand.getHTMLFromGenerator
validation
protected function getHTMLFromGenerator(IconFontGenerator $generator, $fontFile){ $fontOptions = $generator->getFont()->getOptions(); $html = '<!doctype html> <html> <head> <title>'.htmlspecialchars($fontOptions['id']).'</title> <style> @font-face { font-family: "'.$fontOptions['id'].'"; ...
php
{ "resource": "" }
q246554
CreateInfoCommand.getHTMLListFromGenerator
validation
protected function getHTMLListFromGenerator(IconFontGenerator $generator, $fontFile){ $fontOptions = $generator->getFont()->getOptions(); $html = '<ul>'; $glyphNames = $generator->getGlyphNames(); asort($glyphNames); foreach($glyphNames as $unicode => $glyph){ $html .= "\n\t" . '<li data-icon="&#x'...
php
{ "resource": "" }
q246555
Recovery.generate
validation
protected function generate() { $this->reset(); foreach (range(1, $this->getCount()) as $counter) { $this->codes[] = $this->generateBlocks(); } return $this->codes; }
php
{ "resource": "" }
q246556
Recovery.generateBlocks
validation
protected function generateBlocks() { $blocks = []; foreach (range(1, $this->getBlocks()) as $counter) { $blocks[] = $this->generateChars(); } return implode($this->blockSeparator, $blocks); }
php
{ "resource": "" }
q246557
Recovery.toCollection
validation
public function toCollection() { if (function_exists($this->collectionFunction)) { return call_user_func($this->collectionFunction, $this->toArray()); } throw new \Exception( "Function {$this->collectionFunction}() was not found. " . "You probably need to...
php
{ "resource": "" }
q246558
Process.run
validation
public function run() { $signalHandler = $this->getSignalHandler(); $signalHandler->registerHandler(SIGTERM, function () { $this->shouldShutdown = true; }); $this->sharedMemory[self::STARTED_MARKER] = true; /** @var callable $callable */ $callable = $thi...
php
{ "resource": "" }
q246559
Process.wait
validation
public function wait() { $this->internalWait(); $event = $this->isSuccessExit() ? 'success' : 'error'; $this->internalEmit('exit', $this->pid); $this->internalEmit($event); return $this; }
php
{ "resource": "" }
q246560
Process.isSuccessExit
validation
public function isSuccessExit() { $this->exitCode = pcntl_wexitstatus($this->status); return (pcntl_wifexited($this->status) && ($this->exitCode === 0)); }
php
{ "resource": "" }
q246561
Process.waitReady
validation
public function waitReady() { $x = 0; while ($x++ < 100) { usleep(self::WAIT_IDLE); if ($this[self::STARTED_MARKER] === true) { return $this; } } throw new \RuntimeException('Wait process running timeout for child pid ' . $this->ge...
php
{ "resource": "" }
q246562
Semaphore.remove
validation
public function remove() { if (is_resource($this->mutex)) { sem_remove($this->mutex); } if (file_exists($this->file)) { unlink($this->file); } }
php
{ "resource": "" }
q246563
Semaphore.lockExecute
validation
public function lockExecute(callable $callable) { $this->isAcquired = $this->acquire(); $result = $callable(); $this->isAcquired = $this->release(); return $result; }
php
{ "resource": "" }
q246564
SignalHandler.registerHandler
validation
public function registerHandler($signal, $handler) { if (!is_callable($handler)) { throw new \InvalidArgumentException('The handler is not callable'); } if (!isset($this->handlers[$signal])) { $this->handlers[$signal] = []; if (!pcntl_signal($signal, [$t...
php
{ "resource": "" }
q246565
SignalHandler.dispatch
validation
public function dispatch() { pcntl_signal_dispatch(); foreach ($this->signalQueue as $signal) { foreach ($this->handlers[$signal] as &$callable) { call_user_func($callable, $signal); } } return $this; }
php
{ "resource": "" }
q246566
SharedMemory.lockExecute
validation
protected function lockExecute(callable $task) { if($this->mutex->isAcquired()) { return $task(); } return $this->mutex->lockExecute($task); }
php
{ "resource": "" }
q246567
Profile.begin
validation
public function begin(string $profile) { Craft::beginProfile( $profile, Craft::t('twig-profiler', self::CATEGORY_PREFIX) .TwigProfiler::$renderingTemplate ); }
php
{ "resource": "" }
q246568
Profile.end
validation
public function end(string $profile) { Craft::endProfile( $profile, Craft::t('twig-profiler', self::CATEGORY_PREFIX) .TwigProfiler::$renderingTemplate ); }
php
{ "resource": "" }
q246569
LinuxProvider.getCpuinfoByLsCpu
validation
public function getCpuinfoByLsCpu() { if (!$this->cpuInfoByLsCpu) { $lscpu = shell_exec('lscpu'); $lscpu = explode("\n", $lscpu); $values = []; foreach ($lscpu as $v) { $v = array_map('trim', explode(':', $v)); if (isset($v[0], ...
php
{ "resource": "" }
q246570
Parser.push
validation
final public function push(string $data) { if ($this->generator === null) { throw new \Error("The parser is no longer writable"); } $this->buffer .= $data; $end = false; try { while ($this->buffer !== "") { if (\is_int($this->delimiter)) ...
php
{ "resource": "" }
q246571
Detector.getEmojiPattern
validation
public function getEmojiPattern() { if (null === self::$emojiPattern) { $codeString = ''; foreach ($this->getEmojiCodeList() as $code) { if (is_array($code)) { $first = dechex(array_shift($code)); $last = dechex(array_pop($co...
php
{ "resource": "" }
q246572
Detector.getEmojiCodeList
validation
public function getEmojiCodeList() { return [ // Various 'older' charactes, dingbats etc. which over time have // received an additional emoji representation. 0x203c, 0x2049, 0x2122, 0x2139, range(0x2194, 0x2199), ...
php
{ "resource": "" }
q246573
Haikunator.haikunate
validation
public static function haikunate(array $params = []) { $defaults = [ "delimiter" => "-", "tokenLength" => 4, "tokenHex" => false, "tokenChars" => "0123456789", ]; $params = array_merge($defaults, $params); if ($params["tokenHex"...
php
{ "resource": "" }
q246574
SoapClient.setSignature
validation
public function setSignature($parameters, $privateKey, $service, $endpoint, $timestamp, $nonce) { $this->__setCookie('signature', rawurlencode($this->sign($privateKey, array_merge($parameters, [ '__service' => $service, '__hostname' => $endpoint, '__timestamp' => $time...
php
{ "resource": "" }
q246575
SoapClient.sign
validation
protected function sign($privateKey, $parameters) { if (preg_match('/-----BEGIN (RSA )?PRIVATE KEY-----(.*)-----END (RSA )?PRIVATE KEY-----/si', $privateKey, $matches)) { $key = $matches[2]; $key = preg_replace('/\s*/s', '', $key); $key = chunk_split($key, 64, "\n"); ...
php
{ "resource": "" }
q246576
SoapClient.sha512Asn1
validation
protected function sha512Asn1($data) { $digest = hash('sha512', $data, true); // this ASN1 header is sha512 specific $asn1 = chr(0x30).chr(0x51); $asn1 .= chr(0x30).chr(0x0d); $asn1 .= chr(0x06).chr(0x09); $asn1 .= chr(0x60).chr(0x86).chr(0x48).chr(0x01).chr(0x65); ...
php
{ "resource": "" }
q246577
SoapClient.encodeParameters
validation
protected function encodeParameters($parameters, $keyPrefix = null) { if (!is_array($parameters) && !is_object($parameters)) { return rawurlencode($parameters); } $encodedData = []; foreach ($parameters as $key => $value) { $encodedKey = is_null($keyPrefix) ...
php
{ "resource": "" }
q246578
Client.api
validation
public function api($name) { switch ($name) { case 'domain': case 'domain_service': case 'domainService': return new Api\Domain($this); case 'colocation': case 'colocation_service': case 'colocationService': ...
php
{ "resource": "" }
q246579
Client.buildSoapClient
validation
public function buildSoapClient($service) { $director = new Soap\SoapClientDirector($this->username, $this->mode, $this->endpoint); switch ($service) { case 'DomainService': return $director->build(new Soap\Builder\DomainSoapClientBuilder); case 'ColocationSe...
php
{ "resource": "" }
q246580
Client.setMode
validation
public function setMode($mode) { if (!in_array($mode, $this->acceptedModes)) { throw new \InvalidArgumentException(sprintf('Invalid mode: [%s]', $mode)); } $this->mode = $mode; }
php
{ "resource": "" }
q246581
Haip.setBalancingMode
validation
public function setBalancingMode($haipName, $balancingMode, $cookieName = '') { return $this->call(self::SERVICE, 'setBalancingMode', [$haipName, $balancingMode, $cookieName]); }
php
{ "resource": "" }
q246582
AbstractApi.call
validation
protected function call($service, $method, array $parameters = []) { return $this->getSoapClient($service, $method, $parameters)->__call($method, $parameters); }
php
{ "resource": "" }
q246583
AbstractApi.getSoapClient
validation
private function getSoapClient($service, $method, array $parameters) { $timestamp = time(); $nonce = uniqid(null, true); $soapClient = $this->client->buildSoapClient($service); $soapClient->setTimestamp($timestamp); $soapClient->setNonce($nonce); $soapClient->setSign...
php
{ "resource": "" }
q246584
SoapClientDirector.build
validation
public function build(SoapClientBuilderInterface $builder) { $builder->createWsdl($this->endpoint); $builder->createSoapClient(); $builder->setLogin($this->login); $builder->setMode($this->mode); $builder->setClientVersion(self::CLIENT_VERSION); return $builder->getS...
php
{ "resource": "" }
q246585
SoapClientFactory.make
validation
public function make($wsdl, array $classMap = []) { return new SoapClient($wsdl, [ 'trace' => true, 'exceptions' => true, 'encoding' => 'utf-8', 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, 'classmap' => $classMap, 'cache_wsdl' ...
php
{ "resource": "" }
q246586
Colocation.requestAccess
validation
public function requestAccess($when, $duration, array $visitors, $phoneNumber) { return $this->call(self::SERVICE, 'requestAccess', [$when, $duration, $visitors, $phoneNumber]); }
php
{ "resource": "" }
q246587
Colocation.requestRemoteHands
validation
public function requestRemoteHands($colocationName, $contactName, $phoneNumber, $expectedDuration, $instructions) { return $this->call(self::SERVICE, 'requestRemoteHands', [$colocationName, $contactName, $phoneNumber, $expectedDuration, $instructions]); }
php
{ "resource": "" }
q246588
Vps.revertSnapshotToOtherVps
validation
public function revertSnapshotToOtherVps($sourceVpsName, $snapshotName, $destinationVpsName) { return $this->call(self::SERVICE, 'revertSnapshotToOtherVps', [$sourceVpsName, $snapshotName, $destinationVpsName]); }
php
{ "resource": "" }
q246589
Vps.installOperatingSystem
validation
public function installOperatingSystem($vpsName, $operatingSystemName, $hostname) { return $this->call(self::SERVICE, 'installOperatingSystem', [$vpsName, $operatingSystemName, $hostname]); }
php
{ "resource": "" }
q246590
Vps.installOperatingSystemUnattended
validation
public function installOperatingSystemUnattended($vpsName, $operatingSystemName, $base64InstallText) { return $this->call(self::SERVICE, 'installOperatingSystemUnattended', [$vpsName, $operatingSystemName, $base64InstallText]); }
php
{ "resource": "" }
q246591
WebHosting.setMailBoxPassword
validation
public function setMailBoxPassword($domainName, $mailBox, $password) { return $this->call(self::SERVICE, 'setMailBoxPassword', [$domainName, $mailBox, $password]); }
php
{ "resource": "" }
q246592
WebHosting.setDatabasePassword
validation
public function setDatabasePassword($domainName, $database, $password) { return $this->call(self::SERVICE, 'setDatabasePassword', [$domainName, $database, $password]); }
php
{ "resource": "" }
q246593
Site.getSupportedNamespaces
validation
public function getSupportedNamespaces() { if ( empty( $this->data->namespaces ) || ! is_array( $this->data->namespaces ) ) { return array(); } return $this->data->namespaces; }
php
{ "resource": "" }
q246594
Site.getSupportedAuthentication
validation
public function getSupportedAuthentication() { if ( empty( $this->data->authentication ) || empty( $this->data->authentication ) ) { return array(); } return (array) $this->data->authentication; }
php
{ "resource": "" }
q246595
Site.getAuthenticationData
validation
public function getAuthenticationData( $method ) { if ( ! $this->supportsAuthentication( $method ) ) { return null; } $authentication = $this->getSupportedAuthentication(); return $authentication[ $method ]; }
php
{ "resource": "" }
q246596
OpenApiGuesser.getClassFromOperation
validation
protected function getClassFromOperation($name, Operation $operation = null, $reference, $registry) { if ($operation === null) { return; } if ($operation->getParameters()) { foreach ($operation->getParameters() as $key => $parameter) { if ($parameter ...
php
{ "resource": "" }
q246597
SchemaParser.parseSchema
validation
public function parseSchema($openApiSpec) { $openApiSpecContents = file_get_contents($openApiSpec); $schemaClass = self::OPEN_API_MODEL; $schema = null; $jsonException = null; $yamlException = null; try { return $this->ser...
php
{ "resource": "" }
q246598
InputGeneratorTrait.createQueryParamStatements
validation
protected function createQueryParamStatements(Operation $operation) { $queryParamDocumentation = []; $queryParamVariable = new Expr\Variable('queryParam'); $queryParamStatements = [ new Expr\Assign($queryParamVariable, new Expr\New_(new Name('QueryParam'))) ]; if...
php
{ "resource": "" }
q246599
InputGeneratorTrait.createParameters
validation
protected function createParameters(Operation $operation, $queryParamDocumentation, Context $context) { $documentationParams = []; $methodParameters = []; if ($operation->getOperation()->getParameters()) { foreach ($operation->getOperation()->getParameters() as $key => $paramete...
php
{ "resource": "" }