_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q249200 | Xdsl.getPairsNumber | validation | public function getPairsNumber($forceReload = false)
{
if (!$this->properties || $forceReload)
$this->getProperties();
return $this->properties->pairsNumber;
} | php | {
"resource": ""
} |
q249201 | Xdsl.canChangeDslamProfile | validation | public function canChangeDslamProfile($forceReload = false)
{
if (!$this->properties || $forceReload)
$this->getProperties();
return $this->properties->capabilities->canChangeDslamProfile;
} | php | {
"resource": ""
} |
q249202 | Xdsl.canResetDslamPort | validation | public function canResetDslamPort($forceReload = false)
{
if (!$this->properties || $forceReload)
$this->getProperties();
return $this->properties->capabilities->canResetDslamPort;
} | php | {
"resource": ""
} |
q249203 | Xdsl.canChangeLns | validation | public function canChangeLns($forceReload = false)
{
if (!$this->properties || $forceReload)
$this->getProperties();
return $this->properties->capabilities->canChangeLns;
} | php | {
"resource": ""
} |
q249204 | Xdsl.ipSetMonitoringNotifications | validation | public function ipSetMonitoringNotifications($ip, $frequency = 'once', $email = '', $sms = array())
{
return json_decode(self::getClient()->ipSetMonitoringNotifications($this->id, $ip, $frequency, $email, $sms));
} | php | {
"resource": ""
} |
q249205 | Xdsl.ipGetMonitoringNotification | validation | public function ipGetMonitoringNotification($ip, $notificationId)
{
return json_decode(self::getClient()->ipGetMonitoringNotification($this->id, $ip, $notificationId));
} | php | {
"resource": ""
} |
q249206 | TelephonyAccountServiceClient.getVoiceConsumptions | validation | public function getVoiceConsumptions($service, $billingAccount, $params = null)
{
$paramsString = "";
if (!$service)
throw new BadMethodCallException('Parameter $service is missing.');
if (!$billingAccount)
throw new BadMethodCallException('Parameter $billingAccount is miss... | php | {
"resource": ""
} |
q249207 | TelephonyClient.getProperties | validation | public function getProperties($billingAccount)
{
if (!$billingAccount)
throw new BadMethodCallException('Parameter $billingAccount is missing.');
try {
$r = $this->get('telephony/' . $billingAccount)->send();
} catch (\Exception $e) {
throw new TelephonyEx... | php | {
"resource": ""
} |
q249208 | TelephonyClient.setProperties | validation | public function setProperties($billingAccount, $properties)
{
if (!$billingAccount)
throw new BadMethodCallException('Parameter $billingAccount is missing.');
if (!$properties)
throw new BadMethodCallException('Parameter $properties is missing.');
if (!is_array($prope... | php | {
"resource": ""
} |
q249209 | TelephonyAccountService.getFaxConsumptions | validation | public function getFaxConsumptions($params = null)
{
$consumptionList = json_decode(self::getClient()->getFaxConsumptions($this->service, $this->billingAccount, $params));
$consumptions = array();
foreach ($consumptionList as $consumption)
{
$consumptions[] = new FaxConsumption($consumpt... | php | {
"resource": ""
} |
q249210 | TelephonyAccountService.getVoiceConsumptions | validation | public function getVoiceConsumptions($params = null)
{
$consumptionList = json_decode(self::getClient()->getVoiceConsumptions($this->service, $this->billingAccount, $params));
$consumptions = array();
foreach ($consumptionList as $consumption)
{
$consumptions[] = new VoiceConsumption($co... | php | {
"resource": ""
} |
q249211 | smsClient.deleteBlacklist | validation | public function deleteBlacklist($domain, $number)
{
if (!$domain)
throw new BadMethodCallException('Parameter $domain is missing.');
if (!$number)
throw new BadMethodCallException('Parameter $number is missing.');
try {
$r = $this->delete('sms/' . $domain ... | php | {
"resource": ""
} |
q249212 | smsClient.getIncoming | validation | public function getIncoming($domain, $id)
{
if (!$domain)
throw new BadMethodCallException('Parameter $domain is missing.');
if ($id !== 0 && !$id)
throw new BadMethodCallException('Parameter $id is missing.');
$id = intval($id);
try {
$r = $this->... | php | {
"resource": ""
} |
q249213 | smsClient.deleteIncoming | validation | public function deleteIncoming($domain, $id)
{
if (!$domain)
throw new BadMethodCallException('Parameter $domain is missing.');
if (!$id)
throw new BadMethodCallException('Parameter $id is missing.');
try {
$this->delete('sms/' . $domain . '/incoming/' . $... | php | {
"resource": ""
} |
q249214 | smsClient.purchase | validation | public function purchase($domain, $quantity)
{
if (!$domain)
throw new BadMethodCallException('Parameter $domain is missing.');
if (!$quantity)
throw new BadMethodCallException('Parameter $quantity is missing.');
$quantity = intval($quantity);
$allowedQ = arra... | php | {
"resource": ""
} |
q249215 | smsClient.getSender | validation | public function getSender($domain, $sender)
{
if (!$domain)
throw new BadMethodCallException('Parameter $domain is missing.');
if (!$sender)
throw new BadMethodCallException('Parameter $sender is missing.');
$sender = urlencode($sender);
try {
$r =... | php | {
"resource": ""
} |
q249216 | smsClient.createSender | validation | public function createSender($domain, $sender)
{
if (!$domain)
throw new BadMethodCallException('Parameter $domain is missing.');
if (!$sender)
throw new BadMethodCallException('Parameter $sender is missing.');
if (!is_array($sender))
throw new BadMethodCa... | php | {
"resource": ""
} |
q249217 | Server.addSecondaryDnsDomains | validation | public function addSecondaryDnsDomains($domain2add, $ip){
self::getClient()->addSecondaryDnsDomains($this->getDomain(),$domain2add,$ip);
return true;
} | php | {
"resource": ""
} |
q249218 | Server.deleteSecondaryDnsDomains | validation | public function deleteSecondaryDnsDomains($domain2delete){
json_decode(self::getClient()->deleteSecondaryDnsDomains($this->getDomain(), $domain2delete));
return true;
} | php | {
"resource": ""
} |
q249219 | Pca.setSshKey | validation | public function setSshKey($key)
{
self::getClient()->setSshKey($this->pp, $this->sn, $key);
} | php | {
"resource": ""
} |
q249220 | Pca.getSessionProperties | validation | public function getSessionProperties($sessId)
{
return json_decode(self::getClient()->getPcaSessionProperties($this->pp, $this->sn, $sessId));
} | php | {
"resource": ""
} |
q249221 | Pca.getSessionFiles | validation | public function getSessionFiles($sessId)
{
return json_decode(self::getClient()->getPcaSessionFiles($this->pp, $this->sn, $sessId));
} | php | {
"resource": ""
} |
q249222 | Pca.getSessionFilesProperties | validation | public function getSessionFilesProperties($sessId, $fileId)
{
return json_decode(self::getClient()->getPcaSessionFilesProperties($this->pp, $this->sn, $sessId, $fileId));
} | php | {
"resource": ""
} |
q249223 | Pca.addDeleteTask | validation | public function addDeleteTask($sessionId)
{
return json_decode(self::getClient()->createPcaDeleteTask($this->pp, $this->sn, $sessionId));
} | php | {
"resource": ""
} |
q249224 | Pca.addRestoreTask | validation | public function addRestoreTask($sessionId)
{
return json_decode(self::getClient()->createPcaRestoreTask($this->pp, $this->sn, $sessionId));
} | php | {
"resource": ""
} |
q249225 | VpsClient.getCurrentMonitoring | validation | public function getCurrentMonitoring($domain, $type)
{
$type = strtolower($type);
if (!$domain)
throw new BadMethodCallException('Parameter $domain is missing.');
if (!in_array($type, array('cpu:max', 'cpu:used', 'mem:max', 'mem:used', 'net:rx', 'net:tx')))
throw new ... | php | {
"resource": ""
} |
q249226 | VpsClient.getAvailableOptions | validation | public function getAvailableOptions($domain)
{
$domain = (string)$domain;
if (!$domain)
throw new BadMethodCallException('Parameter $domain is missing.');
try {
$r = $this->get('vps/' . $domain . '/availableOptions')->send();
} catch (ClientErrorResponseExcept... | php | {
"resource": ""
} |
q249227 | VpsClient.getModels | validation | public function getModels($domain)
{
$domain = (string)$domain;
if (!$domain)
throw new BadMethodCallException('Parameter $domain is missing.');
try {
$r = $this->get('vps/' . $domain . '/models')->send();
} catch (\Exception $e) {
throw new VpsExc... | php | {
"resource": ""
} |
q249228 | VpsClient.setSnapshotProperties | validation | public function setSnapshotProperties($domain, array $properties)
{
$domain = (string)$domain;
if (!$domain)
throw new BadMethodCallException('Parameter $domain is missing.');
if (!$properties || !is_array($properties) || count($properties) == 0)
throw new BadMethodCa... | php | {
"resource": ""
} |
q249229 | VpsClient.deleteSnapshot | validation | public function deleteSnapshot($domain)
{
$domain = (string)$domain;
if (!$domain)
throw new BadMethodCallException('Parameter $domain is missing.');
try {
$r = $this->delete('vps/' . $domain . '/snapshot')->send();
} catch (\Exception $e) {
throw ... | php | {
"resource": ""
} |
q249230 | VpsClient.getTemplateProperties | validation | public function getTemplateProperties($domain, $templateId)
{
$domain = (string)$domain;
if (!$domain)
throw new BadMethodCallException('Parameter $domain is missing.');
$templateId = (string)$templateId;
if (!$templateId)
throw new BadMethodCallException("Par... | php | {
"resource": ""
} |
q249231 | CloudClient.getPcaServices | validation | public function getPcaServices($pp)
{
if (!$pp)
throw new BadMethodCallException('Missing parameter $pp (passport).');
try {
$r = $this->get('cloud/' . $pp . '/pca')->send();
} catch (\Exception $e) {
throw new CloudException($e->getMessage(), $e->getCode(... | php | {
"resource": ""
} |
q249232 | CloudClient.setSshKey | validation | public function setSshKey($pp, $pca, $key)
{
if (!$pp)
throw new BadMethodCallException('Missing parameter $pp (OVH cloud passport).');
if (!$pca)
throw new BadMethodCallException('Missing parameter $pca (PCA ServiceName).');
if (!$key)
throw new BadMethod... | php | {
"resource": ""
} |
q249233 | CloudClient.setPassword | validation | public function setPassword($pp, $pca, $passwd)
{
if (!$pp)
throw new BadMethodCallException('Missing parameter $pp (OVH cloud passport).');
if (!$pca)
throw new BadMethodCallException('Missing parameter $pca (PCA ServiceName).');
if (!$passwd)
throw new B... | php | {
"resource": ""
} |
q249234 | Vps.getDiskUsage | validation | public function getDiskUsage($diskId, $type)
{
return json_decode(self::getClient()->getDiskUsage($this->getDomain(), $diskId, $type));
} | php | {
"resource": ""
} |
q249235 | OvhClient.getDedicatedServerList | validation | public function getDedicatedServerList(){
$request = $this->get('dedicated/server');
$response=$request->send();
return $response->getBody(true);
} | php | {
"resource": ""
} |
q249236 | OvhClient.getVpsList | validation | public function getVpsList(){
$request = $this->get('vps');
$response=$request->send();
return $response->getBody(true);
} | php | {
"resource": ""
} |
q249237 | AbstractHasher.validateHashContext | validation | protected function validateHashContext($context)
{
if (!($context instanceof HashContext) && (false === $context
|| !is_resource($context)
|| (is_resource($context) && static::HASH_CONTEXT_RESOURCE_TYPE !== get_resource_type($context)))) {
throw new InvalidArgumentExcepti... | php | {
"resource": ""
} |
q249238 | NegotiateFlag.getSpecificationString | validation | public static function getSpecificationString($reversed = false)
{
$reflection = new ReflectionClass(get_class());
$constants = $reflection->getConstants();
if ($reversed) {
$constants = array_reverse($constants);
}
$string = '';
foreach ($constants as ... | php | {
"resource": ""
} |
q249239 | OpenSslDesEncrypter.getOpenSslEncryptionOptions | validation | private function getOpenSslEncryptionOptions()
{
$options = self::DEFAULT_OPENSSL_OPTIONS;
if ($this->zero_pad) {
$options = $options | OPENSSL_ZERO_PADDING;
}
return $options;
} | php | {
"resource": ""
} |
q249240 | AbstractAuthenticateMessageEncoder.identifyTargetName | validation | public function identifyTargetName($username, $nt_domain, ServerChallenge $server_challenge)
{
// If a domain name wasn't supplied, fall back to the server challenge's supplied value
$target_name = $nt_domain ?: $server_challenge->getTargetName();
/**
* If the username is in the "U... | php | {
"resource": ""
} |
q249241 | NtlmV1AuthenticateMessageEncoder.calculateNtResponse | validation | public function calculateNtResponse(
HashCredentialInterface $hash_credential,
$client_challenge = null,
$server_challenge_nonce = null
) {
// By default, our encryption data is our server challenge nonce
$encryption_data = $server_challenge_nonce;
// If we have a cl... | php | {
"resource": ""
} |
q249242 | NtlmV1AuthenticateMessageEncoder.calculateChallengeResponseData | validation | public function calculateChallengeResponseData(HashCredentialInterface $hash_credential, $data)
{
// Nul pad the credential hash to the full key size
$padded_hash = str_pad($hash_credential->getValue(), static::DESL_FULL_KEY_LENGTH, static::NULL_PAD_CHARACTER);
$key_blocks = str_split($padd... | php | {
"resource": ""
} |
q249243 | MbstringEncodingConverter.resolveInputEncoding | validation | private function resolveInputEncoding($string)
{
$encoding = null;
if ($this->detect) {
$encoding = mb_detect_encoding($string, null, true);
}
// Fall back to the internal encoding
if (false === $encoding || null === $encoding) {
$encoding = mb_inter... | php | {
"resource": ""
} |
q249244 | EncodingDetectionException.forCurrentSystem | validation | public static function forCurrentSystem($code = self::CODE_FOR_SYSTEM, Exception $previous = null)
{
$message = self::DEFAULT_MESSAGE . self::MESSAGE_EXTENSION_FOR_SYSTEM;
return new static($message, $code, $previous);
} | php | {
"resource": ""
} |
q249245 | EncodingDetectionException.forString | validation | public static function forString($string, $code = self::CODE_FOR_STRING, Exception $previous = null)
{
$message = self::DEFAULT_MESSAGE . sprintf(self::MESSAGE_EXTENSION_FOR_STRING_FORMAT, $string);
return new static($message, $code, $previous);
} | php | {
"resource": ""
} |
q249246 | NegotiateMessageEncoder.calculatePayloadOffset | validation | public static function calculatePayloadOffset($negotiate_flags)
{
$offset = 0;
$offset += strlen(static::SIGNATURE); // 8-byte signature
$offset += 4; // Message-type indicator
$offset += 4; // 32-bit Negotation flags
$offset += 8; // 64-bit domain name field designator
... | php | {
"resource": ""
} |
q249247 | CryptographicFailureException.forReasonCode | validation | public static function forReasonCode($code = 0, Exception $previous = null)
{
switch ($code) {
case self::CODE_FOR_ENCRYPTION_FAILURE:
$message = self::MESSAGE_FOR_ENCRYPTION_FAILURE;
break;
case self::CODE_FOR_RANDOM_DATA_GENERATION_FAILURE:
... | php | {
"resource": ""
} |
q249248 | AbstractHasherFactory.validateSupportedAlgorithm | validation | protected function validateSupportedAlgorithm($algorithm)
{
if (!in_array($algorithm, $this->supported_algorithms, true)) {
throw new InvalidArgumentException(
sprintf(
'Algorithm "%s" not supported',
$algorithm
)
... | php | {
"resource": ""
} |
q249249 | EncodingConversionFailureException.forStringAndEncodings | validation | public static function forStringAndEncodings(
$string,
$from_encoding,
$to_encoding,
$code = self::CODE_FOR_STRING_AND_ENCODING_INFO,
Exception $previous = null
) {
$message = self::DEFAULT_MESSAGE
. sprintf(self::MESSAGE_EXTENSION_FOR_STRING_FORMAT, $stri... | php | {
"resource": ""
} |
q249250 | AbstractDesEncrypter.processKey | validation | protected function processKey($raw_key)
{
$key = $raw_key;
if ($this->expand_and_normalize_keys) {
$key = self::expand56BitKeyTo64BitKey($key, true);
}
return $key;
} | php | {
"resource": ""
} |
q249251 | AbstractDesEncrypter.expand56BitKeyTo64BitKey | validation | private static function expand56BitKeyTo64BitKey($string_key, $set_parity = true)
{
$byte_array_56 = new SplFixedArray(7);
$byte_array_64 = new SplFixedArray(8);
$key_64bit = '';
// Get the byte value of each ASCII character in the string
for ($i = 0; $i < $byte_array_56->ge... | php | {
"resource": ""
} |
q249252 | AbstractDesEncrypter.setParityBit | validation | private static function setParityBit($byte)
{
$parity = 1;
for ($i = 1; $i < 8; $i++) {
$parity = ($parity + (($byte >> $i) & 1)) %2;
}
$byte = $byte | ($parity & 1);
return $byte;
} | php | {
"resource": ""
} |
q249253 | InvalidChallengeMessageException.forChallengeMessage | validation | public static function forChallengeMessage(
$challenge_message,
$code = 0,
Exception $previous = null
) {
$message = self::DEFAULT_MESSAGE;
$reason_messages = [];
if ((self::CODE_FOR_INVALID_SIGNATURE & $code) === self::CODE_FOR_INVALID_SIGNATURE) {
$rea... | php | {
"resource": ""
} |
q249254 | Command.getBasicOptions | validation | protected function getBasicOptions()
{
$options = array();
$options[] = '-encoding UTF-8'; // funktioniert erwiesenerma�en, ABER NUR MIT DATEI, nicht mit Konsole! Also niemals konsole verwenden!
if ($this->_asHtml) {
$options[] = '-html';
}
if ($this->_toConsole) ... | php | {
"resource": ""
} |
q249255 | PdfBox.prepareCommand | validation | protected function prepareCommand($filename, $saveToFile, $pdfIsTemp = false)
{
$resultIsTemp = false;
$command = new Command();
$command->setPdfFile($filename, $pdfIsTemp);
if ($saveToFile === null) {
$saveToFile = tempnam(sys_get_temp_dir(), 'pdfbox');
$resu... | php | {
"resource": ""
} |
q249256 | PdfBox.execute | validation | protected function execute(Command $command)
{
$command->setJar($this->getPathToPdfBox());
$command->setOptions($this->_options);
exec((string) $command . ' 2>&1', $stdErr, $exitCode);
if ($command->getPdfFileIsTemp()) {
unlink($command->getPdfFile());
}
i... | php | {
"resource": ""
} |
q249257 | StatementClient.close | validation | public function close()
{
$uri = $this->current()->getNextUri();
if (!is_null($uri)) {
$this->client->deleteAsync($uri)->wait();
}
$this->closed = true;
} | php | {
"resource": ""
} |
q249258 | AmazonS3ResourceManager.fileExists | validation | public function fileExists($name)
{
$http = new \Guzzle\Http\Client();
try {
$response = $http->get($this->getUrl($name))->send();
} catch(ClientErrorResponseException $e) {
return false;
}
return $response->isSuccessful();
} | php | {
"resource": ""
} |
q249259 | AmazonS3ResourceManager.getUrl | validation | public function getUrl($name, $expires = NULL)
{
return $this->getClient()->getObjectUrl($this->bucket, $name, $expires);
} | php | {
"resource": ""
} |
q249260 | AmazonS3ResourceManager.getClient | validation | public function getClient()
{
if ($this->_client === null) {
$settings=[
'key' => $this->key,
'secret' => $this->secret
];
if($this->enableV4)
$settings['signature']='v4';
$this->_client = S3Client::factory($settings);
}
return $this->_client;
} | php | {
"resource": ""
} |
q249261 | QueryResult.set | validation | public function set(string $content)
{
$parsed = $this->parseContent($content);
$this->id = $parsed->id;
$this->infoUri = $parsed->infoUri;
$this->partialCancelUri = $parsed->partialCancelUri ?? null;
$this->nextUri = $parsed->nextUri ?? null;
$this->columns = [];
... | php | {
"resource": ""
} |
q249262 | Client.payload | validation | public function payload(array $payload)
{
$client = new GuzzleClient([
'base_uri' => $this->server
]);
$client->request('POST', $this->getUri(), [
'form_params' => [
'payload' => json_encode($payload)
]
]);
} | php | {
"resource": ""
} |
q249263 | Attachment.addField | validation | public function addField($title, $value, $short = false)
{
$this->fields[] = [
'title' => $title,
'value' => $value,
'short' => $short
];
} | php | {
"resource": ""
} |
q249264 | Semaphore.synchronize | validation | public function synchronize(\Closure $closure) {
$this->acquire();
call_user_func($closure);
$this->release();
return $this;
} | php | {
"resource": ""
} |
q249265 | Semaphore.destroy | validation | public function destroy() {
if (!is_resource($this->semaphore)) {
throw new SemaphoreException('Semaphore hasn\'t yet been created.');
}
if (!sem_remove($this->semaphore)) {
throw new SemaphoreException('Cannot remove the semaphore.');
}
$this->semaphore = NULL;
$this->semKey = NULL;
return $this;
... | php | {
"resource": ""
} |
q249266 | ProcessDetailsCollection.addFree | validation | public function addFree(ProcessDetails $processDetails) {
$pid = $processDetails->getPid();
$this->processDetails[$pid] = $processDetails;
$this->sockets[$pid] = $processDetails->getSocket();
$this->registerFreeProcess($processDetails);
return $this;
} | php | {
"resource": ""
} |
q249267 | ProcessDetailsCollection.remove | validation | public function remove(ProcessDetails $processDetails) {
$pid = $processDetails->getPid();
if ($this->hasProcess($pid) === FALSE) {
throw new \InvalidArgumentException(sprintf('Could not remove process. Process (%d) not in list.', $processDetails->getPid()), 1400761297);
}
if (isset($this->freeProcessIds[$... | php | {
"resource": ""
} |
q249268 | ProcessDetailsCollection.killAllProcesses | validation | public function killAllProcesses() {
foreach ($this->processDetails as $pid => $processDetails) {
$this->remove($processDetails);
posix_kill($pid, SIGKILL);
}
} | php | {
"resource": ""
} |
q249269 | ProcessDetailsCollection.registerFreeProcess | validation | public function registerFreeProcess(ProcessDetails $processDetails) {
$pid = $processDetails->getPid();
if ($this->hasProcess($pid) === FALSE) {
throw new \InvalidArgumentException(sprintf('Could not register free process. Process (%d) not in list.', $processDetails->getPid()), 1400761296);
}
$this->freeProc... | php | {
"resource": ""
} |
q249270 | ProcessDetailsCollection.registerFreeProcessId | validation | public function registerFreeProcessId($pid) {
$processDetails = $this->getProcessDetails($pid);
if ($processDetails !== NULL) {
$this->registerFreeProcess($processDetails);
}
return $this;
} | php | {
"resource": ""
} |
q249271 | ProcessDetailsCollection.takeFreeProcess | validation | public function takeFreeProcess() {
if ($this->getFreeProcessesCount() === 0) {
return NULL;
}
$freePid = array_shift($this->freeProcessIds);
if ($freePid === NULL) {
return NULL;
}
return $this->getProcessDetails($freePid);
} | php | {
"resource": ""
} |
q249272 | ProcessDetailsCollection.getProcessDetails | validation | public function getProcessDetails($pid) {
if ($this->hasProcess($pid) === FALSE) {
return NULL;
}
return $this->processDetails[$pid];
} | php | {
"resource": ""
} |
q249273 | CalendarEventsValidator.validateDatesArray | validation | public function validateDatesArray($attribute, $value, array $parameters, Validator $validator)
{
foreach ($value as $date) {
if (false === strtotime($date) || empty($date)) {
return false;
}
}
return true;
} | php | {
"resource": ""
} |
q249274 | PDF.loadView | validation | public function loadView($viewName, $data = array(), $mergeData = array())
{
$this->htmlContent = View::make($viewName, $data, $mergeData);
return $this;
} | php | {
"resource": ""
} |
q249275 | LdapUser.buildAttributesFromLdap | validation | private function buildAttributesFromLdap($entry)
{
$this->attributes['dn'] = $entry['dn'];
// Set the attributes accordingly to the search fields given
foreach($entry as $index => $key){
if(array_key_exists($index, config('ldap.search_fields'))){
$this->attribu... | php | {
"resource": ""
} |
q249276 | LdapUser.isMemberOf | validation | public function isMemberOf($group)
{
foreach ($this->attributes['member_of'] as $groups) {
if (preg_match('/^CN=' . $group . '/', $groups)) {
return true;
}
}
return false;
} | php | {
"resource": ""
} |
q249277 | Reversible.convert | validation | public static function convert($input, $outputFormat = Code::FORMAT_ALNUM, $minLength = null)
{
if(is_int($minLength)) {
$input += self::getMinForlength($outputFormat, $minLength);
}
static::throwUnlessAcceptable($outputFormat, $input);
return self::convertBase($input, ... | php | {
"resource": ""
} |
q249278 | Reversible.revert | validation | public static function revert($input, $inputFormat = Code::FORMAT_ALNUM, $minLength = null)
{
$number = self::convertBase($input, $inputFormat, Code::FORMAT_NUMBER);
if (is_int($minLength)) {
$number -= self::getMinForlength($inputFormat, $minLength);
}
return $number;
... | php | {
"resource": ""
} |
q249279 | Ldap.find | validation | public function find($identifier, array $fields = [ ])
{
// Get all result entries
$results = $this->ldap->search(
$this->base_dn,
$this->search_filter . '=' . $identifier,
( $fields ?: $this->search_fields )
);
if (count($results) > 0) {
... | php | {
"resource": ""
} |
q249280 | CalendarEventsEngine.buildEventData | validation | public function buildEventData(array $data)
{
$start = strtotime($data['start']['date'] . ' ' . $data['start']['time']);
$start = date('Y-m-d H:i:s', $start);
$end = null;
if (array_key_exists('end', $data)) {
$end = strtotime($data['end']['date'] . ' ' . $data['end']['t... | php | {
"resource": ""
} |
q249281 | CalendarEventsEngine.buildEventDates | validation | public function buildEventDates(array $data)
{
$dates = [];
$eventLength = $this->calculateEventLength($data);
$allDay = array_key_exists('all_day', $data);
foreach ($data['repeat_dates'] as $date) {
if (strlen($date) > 0) {
$date = strtotime($date . ' ' ... | php | {
"resource": ""
} |
q249282 | CalendarEventsEngine.formatEventsToJson | validation | public function formatEventsToJson(array $calendarEvents)
{
$array = [];
foreach ($calendarEvents as $event) {
$start = $this->carbon
->copy()
->setTimestamp(strtotime($event->start))
->toIso8601String();
$end = $this->carbon
... | php | {
"resource": ""
} |
q249283 | CalendarEventsEngine.calculateEventLength | validation | protected function calculateEventLength(array $data)
{
$start = $this->carbon->copy()->setTimestamp(strtotime($data['start']['date'] . ' ' . $data['start']['time']));
if (array_key_exists('all_day', $data)) {
$end = $this->carbon->copy()->setTimestamp(strtotime($data['start']['date'] . ... | php | {
"resource": ""
} |
q249284 | SuperClosureWorker.onProcessCreate | validation | public function onProcessCreate(Semaphore $semaphore) {
$this->semaphore = $semaphore;
$this->create->__invoke($this->semaphore, $this->storage);
} | php | {
"resource": ""
} |
q249285 | ProcessDetails.setProcessTitle | validation | public static function setProcessTitle($title, array $replacements = array()) {
// skip when empty title names or running on MacOS
if (trim($title) == '' || PHP_OS == 'Darwin') {
return;
}
// 1. replace the values
$title = preg_replace_callback(
'/\%([a-z0-9]+)\%/i',
function ($match) use ($replaceme... | php | {
"resource": ""
} |
q249286 | SimpleSocket.select | validation | public static function select(array $readSockets = array(), array $writeSockets = array(), array $exceptSockets = array(), $sec = 0, $usec = 0) {
$out = array();
$out['read'] = array();
$out['write'] = array();
$out['except'] = array();
if(count($readSockets) === 0){
return $out;
}
$readSocketsResour... | php | {
"resource": ""
} |
q249287 | SimpleSocket.hasData | validation | public function hasData($sec = 0, $usec = 0) {
$sec = (int)$sec;
$usec = (int)$usec;
if ($sec < 0) {
$sec = 0;
}
if ($usec < 0) {
$usec = 0;
}
$read = array($this->socket);
$write = array();
$except = array();
$sockets = socket_select($read, $write, $except, $sec, $usec);
if ($sockets === ... | php | {
"resource": ""
} |
q249288 | SimpleSocket.send | validation | public function send($data) {
$serialized = serialize($data);
$hdr = pack('N', strlen($serialized)); // 4 byte length
$buffer = $hdr . $serialized;
unset($serialized);
unset($hdr);
$total = strlen($buffer);
while ($total > 0) {
$sent = socket_write($this->socket, $buffer);
if ($sent === FALSE) {
... | php | {
"resource": ""
} |
q249289 | SimpleSocket.receive | validation | public function receive() {
// read 4 byte length first
$hdr = '';
do {
$read = socket_read($this->socket, 4 - strlen($hdr));
if ($read === FALSE) {
throw new SimpleSocketException('Reception failed with: ' . socket_strerror(socket_last_error($this->socket)));
}
elseif ($read === '' || $read === N... | php | {
"resource": ""
} |
q249290 | CalendarEventsService.createCalendarEvent | validation | public function createCalendarEvent(array $data)
{
$eventData = $this->calendarEventsEngine->buildEventData($data);
$eventDates = $this->calendarEventsEngine->buildEventDates($data);
$cache = $this->cache;
$calendarEvent = $this->calendarEvent->create($eventData);
$this->hand... | php | {
"resource": ""
} |
q249291 | CalendarEventsService.getCalendarEvent | validation | public function getCalendarEvent($id)
{
/** @var Models\CalendarEvent $calendarEvent */
$calendarEvent = null;
$cache = $this->cache;
if ($cache::has(self::CACHE_KEY.$id)) {
return $cache::get(self::CACHE_KEY.$id);
}
$calendarEvent = $this->calendarEven... | php | {
"resource": ""
} |
q249292 | CalendarEventsService.getAllEvents | validation | public function getAllEvents(): array
{
$calendarEvents = null;
$cache = $this->cache;
if ($cache::has(self::ALL_EVENTS_KEY)) {
return $cache::get(self::ALL_EVENTS_KEY);
}
$allEvents = $this->calendarEvent
->with(['calendarEventRepeatDates'])
... | php | {
"resource": ""
} |
q249293 | CalendarEventsService.getAllEventsAsJson | validation | public function getAllEventsAsJson()
{
$cache = $this->cache;
if ($cache::has(self::ALL_EVENTS_TO_JSON_KEY)) {
return $cache::get(self::ALL_EVENTS_TO_JSON_KEY);
}
$allEvents = $this->calendarEventsEngine
->formatEventsToJson($this->getAllEvents());
$... | php | {
"resource": ""
} |
q249294 | CalendarEventsService.deleteCalendarEvent | validation | public function deleteCalendarEvent($id)
{
$cache = $this->cache;
$this->calendarEvent->destroy($id);
$allEvents = $this->getAllEvents();
unset($allEvents[$id]);
$cache::put(self::ALL_EVENTS_KEY, $allEvents, $this->cacheTimeToLive);
return true;
} | php | {
"resource": ""
} |
q249295 | CalendarEventsService.updateCalendarEvent | validation | public function updateCalendarEvent($id, array $data)
{
$eventData = $this->calendarEventsEngine->buildEventData($data);
$eventDates = $this->calendarEventsEngine->buildEventDates($data);
$cache = $this->cache;
$calendarEventRepeatDate = clone $this->calendarEventRepeatDate;
... | php | {
"resource": ""
} |
q249296 | Random.get | validation | public static function get($length = 8, $outputFormat = Code::FORMAT_ALNUM)
{
static::throwUnlessAcceptable($outputFormat, $length);
$number = rand(100, 900) . str_replace('.', '', microtime(true));
$output = self::convertBase($number, self::FORMAT_NUMBER, $outputFormat);
if(strlen... | php | {
"resource": ""
} |
q249297 | WorkerPool.setChildProcessTitleFormat | validation | public function setChildProcessTitleFormat($string) {
if ($this->created) {
throw new WorkerPoolException('Cannot set the Parent\'s Process Title Format for a created pool.');
}
$this->childProcessTitleFormat = ProcessDetails::sanitizeProcessTitleFormat($string);
return $this;
} | php | {
"resource": ""
} |
q249298 | WorkerPool.setParentProcessTitleFormat | validation | public function setParentProcessTitleFormat($string) {
if ($this->created) {
throw new WorkerPoolException('Cannot set the Children\'s Process Title Format for a created pool.');
}
$this->parentProcessTitleFormat = ProcessDetails::sanitizeProcessTitleFormat($string);
return $this;
} | php | {
"resource": ""
} |
q249299 | WorkerPool.setWorkerPoolSize | validation | public function setWorkerPoolSize($size) {
if ($this->created) {
throw new WorkerPoolException('Cannot set the Worker Pool Size for a created pool.');
}
$size = (int)$size;
if ($size <= 0) {
throw new \InvalidArgumentException('"' . $size . '" is not an integer greater than 0.');
}
$this->workerPoolSi... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.