_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 missing.'); if ($params != null && is_array($params) && count($params) > 0) { $paramsString = "?"; if (array_key_exists('creationDatetime.from', $params)) { $string = $params['creationDatetime.from']; if ($params['creationDatetime.from'] instanceof \Datetime) $string = $params['creationDatetime.from']->format("Y-m-d\TH:i:sP"); $paramsString .= "creationDatetime.from=".urlencode($string); } if (array_key_exists('creationDatetime.to', $params)) { $paramsString .= "&"; $string = $params['creationDatetime.to']; if ($params['creationDatetime.to'] instanceof \Datetime) $string = $params['creationDatetime.to']->format("Y-m-d\TH:i:sP"); $paramsString .= "creationDatetime.to=".urlencode($string); } if (array_key_exists('destinationType', $params) && in_array($params['destinationType'], array('landline', 'mobile', 'special'))) { $paramsString .= "&"; $paramsString .= "destinationType=".$params['destinationType']; } if (array_key_exists('planType', $params) && in_array($params['planType'], array('outplan', 'priceplan'))) { $paramsString .= "&"; $paramsString .= "planType=".$params['planType']; } if (array_key_exists('wayType', $params) && in_array($params['wayType'], array('incoming', 'outgoing', 'transfer'))) { $paramsString .= "&"; $paramsString .= "wayType=".$params['wayType']; } } try { $r = $this->get('telephony/' . $billingAccount->getBillingAccount() . '/service/' . $service . '/voiceConsumption' . $paramsString)->send(); } catch (\Exception $e) { throw new TelephonyAccountServiceException($e->getMessage(), $e->getCode(), $e); } return $r->getBody(true); }
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 TelephonyException($e->getMessage(), $e->getCode(), $e); } return $r->getBody(true); }
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($properties)) throw new BadMethodCallException('Parameter $properties must be a array.'); $t = array(); if (array_key_exists('description', $properties)) $t['description'] = $properties['description']; $properties = $t; unset($t); if (count($properties) == 0) throw new BadMethodCallException('Parameter $properties does not contain valid key. valid key is "description"'); try { $r = $this->put('telephony/' . $billingAccount, array('Content-Type' => 'application/json;charset=UTF-8'), json_encode($properties))->send(); } catch (\Exception $e) { throw new TelephonyException($e->getMessage(), $e->getCode(), $e); } return true; }
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($consumption, $this); } return $consumptions; }
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($consumption, $this); } return $consumptions; }
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 . '/blacklists/' . $number)->send(); } catch (\Exception $e) { throw new SmsException($e->getMessage(), $e->getCode(), $e); } return $r; }
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->get('sms/' . $domain . '/incoming/' . $id)->send(); } catch (\Exception $e) { throw new SmsException($e->getMessage(), $e->getCode(), $e); } return $r->getBody(true); }
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/' . $id)->send(); } catch (\Exception $e) { throw new SmsException($e->getMessage(), $e->getCode(), $e); } return true; }
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 = array(100, 200, 250, 500, 1000, 5000, 2500, 10000, 50000, 100000); if (!in_array($quantity, $allowedQ)) throw new BadMethodCallException('Parameter $quantity must be in array (' . implode(', ', $allowedQ) . '), "' . $quantity . '" given.'); try { $r = $this->post('sms/' . $domain . '/purchase', array('Content-Type' => 'application/json;charset=UTF-8'), json_encode($quantity))->send(); } catch (\Exception $e) { throw new SmsException($e->getMessage(), $e->getCode(), $e); } return $r->getBody(true); }
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 = $this->get('sms/' . $domain . '/senders/' . $sender)->send(); } catch (\Exception $e) { throw new SmsException($e->getMessage(), $e->getCode(), $e); } return $r->getBody(true); }
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 BadMethodCallException('Parameter $sender must be a array. ' . gettype($sender) . ' given.'); // required fields (sender) if (!array_key_exists('sender', $sender)) throw new BadMethodCallException('Parameter $sender have key sender (string).'); // sanitize $t = array(); $t['sender'] = $sender['sender']; // relaunch ($sender['relaunch']) ? $t['relaunch'] = $sender['relaunch'] : $t['relaunch'] = ''; // reason ($sender['reason']) ? $t['reason'] = $sender['reason'] : $t['reason'] = ''; unset($sender); try { $r = $this->post('sms/' . $domain . '/senders', array('Content-Type' => 'application/json;charset=UTF-8'), json_encode($t))->send(); } catch (\Exception $e) { throw new SmsException($e->getMessage(), $e->getCode(), $e); } }
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 BadMethodCallException('Parameter $type must be "cpu:max" or "cpu:used" or "mem:max" or "mem:used" or "net:rx" or "net:tx". "' . $type . '" given.'); try { $r = $this->get('vps/' . $domain . '/use?type=' . $type)->send(); } catch (\Exception $e) { throw new VpsException($e->getMessage(), $e->getCode(),$e); } return $r->getBody(true); }
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 (ClientErrorResponseException $e) { if ($e->getResponse()->getStatusCode() == '404' && json_decode($e->getResponse()->getBody())->message == "No options found") return "[]"; else throw new VpsException($e->getMessage(), $e->getCode(), $e); } catch (\Exception $e) { throw new VpsException($e->getMessage(), $e->getCode(), $e); } return $r->getBody(true); }
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 VpsException($e->getMessage(), $e->getCode(), $e); } return $r->getBody(true); }
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 BadMethodCallException('Parameter $properties must be a non empty array.'); $qr = ''; foreach ($properties as $k => $v) { $qr .= $k . '=' . $v . '&'; } $qr = substr($qr, 0, strlen($qr) - 1); try { $r = $this->put('vps/' . $domain . '/snapshot/?' . $qr)->send(); } catch (\Exception $e) { throw new VpsException($e->getMessage(), $e->getCode(),$e); } return $r; }
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 new VpsException($e->getMessage(), $e->getCode(),$e); } return $r; }
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("Parameter $templateId is missing"); try { $r = $this->get('vps/' . $domain . '/templates/' . $templateId)->send(); } catch (\Exception $e) { throw new VpsException($e->getMessage(), $e->getCode(), $e); } return $r->getBody(); }
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(), $e); } return $r->getBody(true); }
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 BadMethodCallException('Missing parameter $key (Public key for this pca).'); $payload = array('sshkey' => $key); try { $this->put('cloud/' . $pp . '/pca/' . $pca, array('Content-Type' => 'application/json;charset=UTF-8'), json_encode($payload))->send(); } catch (\Exception $e) { throw new CloudException($e->getMessage(), $e->getCode(), $e); } }
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 BadMethodCallException('Missing parameter $passwd (Password for this pca).'); $payload = array('password' => $passwd); try { $this->put('cloud/' . $pp . '/pca/' . $pca, array('Content-Type' => 'application/json;charset=UTF-8'), json_encode($payload))->send(); } catch (\Exception $e) { throw new CloudException($e->getMessage(), $e->getCode(), $e); } }
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 InvalidArgumentException( 'Unable to initialize hashing context. Your system might not support the supplied algorithm.' ); } return $context; }
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 $name => $int_val) { $binary_val_string = base_convert((string) $int_val, '10', '2'); $string .= sprintf( '0b%s : %s', str_pad($binary_val_string, 32, '0', STR_PAD_LEFT), $name ); $string .= PHP_EOL; } return $string; }
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 "UPN" (Kerberos) format, the target name should be empty * * @link https://msdn.microsoft.com/en-us/library/windows/desktop/aa380525(v=vs.85).aspx * @link http://davenport.sourceforge.net/ntlm.html#nameVariations */ if (false !== strpos($username, static::USER_PRINCIPAL_NAME_SEPARATOR)) { $target_name = ''; } return $target_name; }
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 client challenge, extended session security must be negotiated if (null !== $client_challenge) { // Grab a hasher $extended_security_hasher = $this->crypt_hasher_factory->build( static::EXTENDED_SESSION_SECURITY_HASHER_ALGORITHM ); // Concat the two challenge strings $nt_extended_security_challenge_source = $server_challenge_nonce . $client_challenge; $nt_extended_security_hash = $extended_security_hasher ->update($nt_extended_security_challenge_source) ->digest(); // Our challenge is a substring of the resulting hash $nt_extended_security_challenge = substr( $nt_extended_security_hash, 0, static::EXTENDED_SESSION_SECURITY_CHALLENGE_LENGTH ); $encryption_data = $nt_extended_security_challenge; } return $this->calculateChallengeResponseData($hash_credential, $encryption_data); }
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($padded_hash, static::DESL_KEY_BLOCK_SEGMENT_LENGTH); $binary_data = array_reduce( $key_blocks, function ($result, $key_block) use ($data) { return $result . $this->des_encrypter->encrypt( $key_block, $data, CipherMode::ECB, '' // DES-ECB expects a 0-byte-length initialization vector ); }, '' ); return $binary_data; }
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_internal_encoding(); } if (false === $encoding || null === $encoding) { throw EncodingDetectionException::forString($string); } return $encoding; }
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 $offset += 8; // 64-bit client hostname field designator return $offset; }
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: $message = self::MESSAGE_FOR_RANDOM_DATA_GENERATION_FAILURE; break; default: $message = self::DEFAULT_MESSAGE; } return new static($message, $code, $previous); }
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 ) ); } return $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, $string) . sprintf(self::MESSAGE_EXTENSION_FOR_ENCODING_INFO_FORMAT, $from_encoding, $to_encoding); return new static($message, $code, $previous); }
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->getSize(); $i++) { $byte_array_56[$i] = isset($string_key[$i]) ? ord($string_key[$i]) : 0; } $byte_array_64[0] = $byte_array_56[0] & 254; $byte_array_64[1] = ($byte_array_56[0] << 7) | ($byte_array_56[1] >> 1); $byte_array_64[2] = ($byte_array_56[1] << 6) | ($byte_array_56[2] >> 2); $byte_array_64[3] = ($byte_array_56[2] << 5) | ($byte_array_56[3] >> 3); $byte_array_64[4] = ($byte_array_56[3] << 4) | ($byte_array_56[4] >> 4); $byte_array_64[5] = ($byte_array_56[4] << 3) | ($byte_array_56[5] >> 5); $byte_array_64[6] = ($byte_array_56[5] << 2) | ($byte_array_56[6] >> 6); $byte_array_64[7] = $byte_array_56[6] << 1; foreach ($byte_array_64 as $byte_val) { // Optionally set parity for each byte $byte_val = $set_parity ? self::setParityBit($byte_val) : $byte_val; $key_64bit .= chr($byte_val); } return $key_64bit; }
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) { $reason_messages[] = self::MESSAGE_FOR_INVALID_SIGNATURE; } if ((self::CODE_FOR_INVALID_MESSAGE_TYPE & $code) === self::CODE_FOR_INVALID_MESSAGE_TYPE) { $reason_messages[] = self::MESSAGE_FOR_INVALID_MESSAGE_TYPE; } $message .= sprintf( self::MESSAGE_EXTENSION_FOR_REASONS_FORMAT, implode(self::MESSAGE_REASON_GLUE, $reason_messages) ); $instance = new static($message, $code, $previous); $instance->challenge_message = $challenge_message; return $instance; }
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) { $options[] = '-console'; } return join(' ', $options); }
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'); $resultIsTemp = true; } $command->setTextFile($saveToFile, $resultIsTemp); return $command; }
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()); } if ($exitCode > 0) { throw new \RuntimeException(join("\n", $stdErr), $exitCode); } $resultFile = $command->getTextFile(); $result = file_get_contents($resultFile); if ($command->getTextFileIsTemp()) { unlink($resultFile); } return $result; }
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 = []; if (isset($parsed->columns)) { $this->columnTransfer($parsed->columns); } $this->data = $parsed->data ?? []; $this->stats = isset($parsed->stats) ? $this->statsTransfer($parsed->stats) : null; $this->error = isset($parsed->error) ? $this->errorTransfer($parsed->error) : null; }
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[$pid])) { unset($this->freeProcessIds[$pid]); } if (isset($this->sockets[$pid])) { unset($this->sockets[$pid]); } unset($this->processDetails[$pid]); return $this; }
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->freeProcessIds[$pid] = $pid; return $this; }
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->attributes[$key] = isset($entry[$key][1]) ? $entry[$key] : $entry[$key][0]; } }; }
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, self::FORMAT_NUMBER, $outputFormat); }
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) { $entry = $this->ldap->entry($results); // Returning a single LDAP entry if (isset( $entry[0] ) && ! empty( $entry[0] )) { return $entry[0]; } } throw new EmptySearchResultException; }
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']['time']); $end = date('Y-m-d H:i:s', $end); if (strtotime($end) < strtotime($start)) { throw new DateDifferenceException('Start date bigger then end date!'); } } $event = [ 'title' => $data['title'], 'description' => $data['description'], 'start' => $start, 'end' => $end, 'all_day' => array_key_exists('all_day', $data), 'border_color' => $data['border_color'], 'background_color' => $data['background_color'], 'text_color' => $data['text_color'], ]; return $event; }
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 . ' ' . $data['start']['time']); if (false === $date) { throw new InvalidDateStringException('Invalid date string!'); } $eventStart = $this->carbon->copy()->setTimestamp($date); $eventEnds = $allDay ? null : $eventStart->copy()->addSeconds($eventLength); $dates[] = [ 'start' => $eventStart->toDateTimeString(), 'end' => (null !== $eventEnds) ? $eventEnds->toDateTimeString() : null, ]; } } return $dates; }
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 ->copy() ->setTimestamp(strtotime($event->end)) ->toIso8601String(); $allDay = $event->all_day == 1; $data = [ 'title' => $event->title, 'description' => $event->description, 'start' => $start, 'end' => $end, 'allDay' => $allDay, 'borderColor' => $event->border_color, 'textColor' => $event->text_color, 'backgroundColor' => $event->background_color, ]; $array[] = $data; if ($event->calendarEventRepeatDates()->count() > 0) { foreach ($event->calendarEventRepeatDates()->get() as $repeatDate) { $start = $this->carbon ->copy() ->setTimestamp(strtotime($repeatDate->start)) ->toIso8601String(); $end = $this->carbon ->copy() ->setTimestamp(strtotime($repeatDate->end)) ->toIso8601String(); $data['start'] = $start; $data['end'] = $end; $array[] = $data; } } } return $array; }
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'] . ' 23:59:59')); } else { $end = $this->carbon->copy()->setTimestamp(strtotime($data['start']['date'] . ' ' . $data['end']['time'])); } return $start->diffInSeconds($end); }
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 ($replacements) { if (isset($replacements[$match[1]])) { return $replacements[$match[1]]; } return $match[0]; }, $title ); // 2. remove forbidden chars $title = preg_replace( '/[^a-z0-9-_.: \\\\\\]\\[]/i', '', $title ); // 3. set the title if (function_exists('cli_set_process_title')) { cli_set_process_title($title); // PHP 5.5+ has a builtin function } elseif (function_exists('setproctitle')) { setproctitle($title); // pecl proctitle extension } }
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; } $readSocketsResources = array(); $writeSocketsResources = array(); $exceptSocketsResources = array(); $readSockets = self::createSocketsIndex($readSockets, $readSocketsResources); $writeSockets = self::createSocketsIndex($writeSockets, $writeSocketsResources); $exceptSockets = self::createSocketsIndex($exceptSockets, $exceptSocketsResources); $socketsSelected = @socket_select($readSocketsResources, $writeSocketsResources, $exceptSocketsResources, $sec, $usec); if ($socketsSelected === FALSE) { $socketError = socket_last_error(); // 1 more retry https://stackoverflow.com/questions/2933343/php-can-pcntl-alarm-and-socket-select-peacefully-exist-in-the-same-thread/2938156#2938156 if ($socketError === SOCKET_EINTR) { socket_clear_error(); $socketsSelected = socket_select($readSocketsResources, $writeSocketsResources, $exceptSocketsResources, $sec, $usec); if ($socketsSelected === FALSE) { return $out; } } else { trigger_error( sprintf('socket_select(): unable to select [%d]: %s', $socketError, socket_strerror($socketError)), E_USER_WARNING ); return $out; } } foreach ($readSocketsResources as $socketResource) { $out['read'][] = $readSockets[intval($socketResource)]; } foreach ($writeSocketsResources as $socketResource) { $out['write'][] = $writeSockets[intval($socketResource)]; } foreach ($exceptSocketsResources as $socketResource) { $out['except'][] = $exceptSockets[intval($socketResource)]; } return $out; }
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 === FALSE) { return FALSE; } return $sockets > 0; }
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) { throw new SimpleSocketException('Sending failed with: ' . socket_strerror(socket_last_error($this->socket))); } $total -= $sent; $buffer = substr($buffer, $sent); } }
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 === NULL) { return NULL; } $hdr .= $read; } while (strlen($hdr) < 4); list($len) = array_values(unpack("N", $hdr)); // read the full buffer $buffer = ''; do { $read = socket_read($this->socket, $len - strlen($buffer)); if ($read === FALSE || $read == '') { throw new SimpleSocketException('Reception failed with: ' . socket_strerror(socket_last_error($this->socket))); } elseif ($read == '') { return NULL; } $buffer .= $read; } while (strlen($buffer) < $len); $data = unserialize($buffer); return $data; }
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->handleEventLocation($data, $calendarEvent); foreach ($eventDates as $date) { $calendarEventRepeatDate = clone $this->calendarEventRepeatDate; $calendarEventRepeatDate->start = $date['start']; $calendarEventRepeatDate->end = $date['end']; $calendarEventRepeatDate->calendarEvent() ->associate($calendarEvent) ; $calendarEventRepeatDate->save(); unset($calendarEventRepeatDate); } $cache::put(self::CACHE_KEY.$calendarEvent->id, $calendarEvent, $this->cacheTimeToLive); $allEvents = $this->getAllEvents(); $allEvents[$calendarEvent->id] = $calendarEvent; $cache::put(self::ALL_EVENTS_KEY, $allEvents, $this->cacheTimeToLive); return true; }
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->calendarEvent ->with(['calendarEventRepeatDates']) ->where('id', $id) ->firstOrFail() ; $cache::put(self::CACHE_KEY.$id, $calendarEvent, $this->cacheTimeToLive); return $calendarEvent; }
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']) ->get() ; $calendarEvents = $allEvents->keyBy('id') ->toArray() ; $cache::put(self::ALL_EVENTS_KEY, $calendarEvents, $this->cacheTimeToLive); return $calendarEvents; }
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()); $allEventsToJson = json_encode($allEvents); $cache::put(self::ALL_EVENTS_TO_JSON_KEY, $allEventsToJson, $this->cacheTimeToLive); return $allEventsToJson; }
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; $calendarEventRepeatDate ->where('calendar_event_id', $id) ->delete() ; $this->calendarEvent ->where('id', $id) ->update($eventData) ; // This is necessary due to in some Laravel 5.1 versions there is no model hydration after update $calendarEvent = $this->calendarEvent ->where('id', $id) ->firstOrFail() ; $this->handleEventLocation($data, $calendarEvent); foreach ($eventDates as $date) { $calendarEventRepeatDate = clone $this->calendarEventRepeatDate; $calendarEventRepeatDate->start = $date['start']; $calendarEventRepeatDate->end = $date['end']; $calendarEventRepeatDate->calendarEvent() ->associate($calendarEvent) ; $calendarEventRepeatDate->save(); unset($calendarEventRepeatDate); } $cache::put(self::CACHE_KEY.$calendarEvent->id, $calendarEvent, $this->cacheTimeToLive); $allEvents = $this->getAllEvents(); $allEvents->put($calendarEvent->id, $calendarEvent); $cache::put(self::ALL_EVENTS_KEY, $allEvents, $this->cacheTimeToLive); return true; }
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($output) < $length) { $output .= substr(str_shuffle($outputFormat.$outputFormat), 0, ($length - strlen($output))); } if(strlen($output) > $length) { $output = substr($output, 0, $length); } return $output; }
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->workerPoolSize = $size; return $this; }
php
{ "resource": "" }