_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q257300 | AbstractInstallCommand.executeCommand | test | protected function executeCommand($command, OutputInterface $output = null, array $options = [])
{
if (is_null($output)) {
$output = new NullOutput();
}
$options = array_merge($options, [
'command' => $command,
]);
$this
->getApplication(... | php | {
"resource": ""
} |
q257301 | Str.between | test | public function between($start, $end)
{
if ($start == '' && $end == '') {
return $this;
}
if ($start != '' && strpos($this->string, $start) === false) {
return new static();
}
if ($end != '' && strpos($this->string, $end) === false) {
ret... | php | {
"resource": ""
} |
q257302 | Str.sanitizeForTease | test | private function sanitizeForTease($string)
{
$string = trim($string);
//remove html
$string = strip_tags($string);
//replace multiple spaces
$string = preg_replace("/\s+/", ' ', $string);
return $string;
} | php | {
"resource": ""
} |
q257303 | Str.replaceFirst | test | public function replaceFirst($search, $replace)
{
if ($search == '') {
return $this;
}
$position = strpos($this->string, $search);
if ($position === false) {
return $this;
}
$resultString = substr_replace($this->string, $replace, $position, ... | php | {
"resource": ""
} |
q257304 | Str.replaceLast | test | public function replaceLast($search, $replace)
{
if ($search == '') {
return $this;
}
$position = strrpos($this->string, $search);
if ($position === false) {
return $this;
}
$resultString = substr_replace($this->string, $replace, $position, ... | php | {
"resource": ""
} |
q257305 | Str.possessive | test | public function possessive()
{
if ($this->string == '') {
return new static();
}
$noApostropheEdgeCases = ['it'];
if (in_array($this->string, $noApostropheEdgeCases)) {
return new static($this->string.'s');
}
return new static($this->string.... | php | {
"resource": ""
} |
q257306 | Str.segment | test | public function segment($delimiter, $index)
{
$segments = explode($delimiter, $this->string);
if ($index < 0) {
$segments = array_reverse($segments);
$index = abs($index) - 1;
}
$segment = isset($segments[$index]) ? $segments[$index] : '';
return ne... | php | {
"resource": ""
} |
q257307 | Str.contains | test | public function contains($needle, $caseSensitive = false, $absolute = false)
{
return $this->find($needle, $caseSensitive, $absolute);
} | php | {
"resource": ""
} |
q257308 | PayUMoneyGateway.encrypt | test | protected function encrypt()
{
$this->hash = '';
$hashSequence = "key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5|udf6|udf7|udf8|udf9|udf10";
$hashVarsSeq = explode('|', $hashSequence);
$hash_string = '';
foreach($hashVarsSeq as $hash_var) {
... | php | {
"resource": ""
} |
q257309 | PayUMoneyGateway.decrypt | test | protected function decrypt($response)
{
$hashSequence = "status||||||udf5|udf4|udf3|udf2|udf1|email|firstname|productinfo|amount|txnid|key";
$hashVarsSeq = explode('|', $hashSequence);
$hash_string = $this->salt."|";
foreach($hashVarsSeq as $hash_var) {
$hash_string .= ... | php | {
"resource": ""
} |
q257310 | CCAvenueGateway.encrypt | test | protected function encrypt($plainText,$key)
{
$secretKey = $this->hextobin(md5($key));
$initVector = pack("C*", 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f);
$openMode = @mcrypt_module_open(MCRYPT_RIJNDAEL_128, '','cbc', '');
$blockS... | php | {
"resource": ""
} |
q257311 | CCAvenueGateway.decrypt | test | protected function decrypt($encryptedText,$key)
{
$secretKey = $this->hextobin(md5($key));
$initVector = pack("C*", 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f);
$encryptedText=$this->hextobin($encryptedText);
$openMode = @mcrypt_mod... | php | {
"resource": ""
} |
q257312 | CitrusGateway.encrypt | test | protected function encrypt()
{
$hash_string = $this->vanityUrl.$this->parameters['orderAmount'].$this->parameters['merchantTxnId'].$this->parameters['currency'];
$this->hash = hash_hmac('sha1', $hash_string, $this->secretKey);
} | php | {
"resource": ""
} |
q257313 | CitrusGateway.decrypt | test | protected function decrypt($response)
{
$hash_string = '';
$hash_string .= $response['TxId'];
$hash_string .= $response['TxStatus'];
$hash_string .= $response['amount'];
$hash_string .= $response['pgTxnNo'];
$hash_string .= $response['issuerRefNo'];
$hash_stri... | php | {
"resource": ""
} |
q257314 | EBSGateway.encrypt | test | protected function encrypt()
{
$this->hash = '';
$hash_string = $this->secretKey."|".urlencode($this->parameters['account_id'])."|".urlencode($this->parameters['amount'])."|".urlencode($this->parameters['reference_no'])."|".$this->parameters['return_url']."|".urlencode($this->parameters['mode']);
... | php | {
"resource": ""
} |
q257315 | VerbalExpressions.range | test | public function range()
{
$args = func_get_args();
$arg_num = count($args);
if ($arg_num%2 != 0) {
throw new \InvalidArgumentException('Number of args must be even', 1);
}
$value = '[';
for ($i = 0; $i < $arg_num;) {
$value .= self::sanitize... | php | {
"resource": ""
} |
q257316 | VerbalExpressions.addModifier | test | public function addModifier($modifier)
{
if (strpos($this->modifiers, $modifier) === false) {
$this->modifiers .= $modifier;
}
return $this;
} | php | {
"resource": ""
} |
q257317 | Pages.addRange | test | public function addRange(int $start, int $end): void
{
$this->pages = array_merge($this->pages, range($start, $end));
} | php | {
"resource": ""
} |
q257318 | Merger.addRaw | test | public function addRaw(string $content, PagesInterface $pages = null): void
{
$this->sources[] = new RawSource($content, $pages);
} | php | {
"resource": ""
} |
q257319 | Merger.addFile | test | public function addFile(string $filename, PagesInterface $pages = null): void
{
$this->sources[] = new FileSource($filename, $pages);
} | php | {
"resource": ""
} |
q257320 | Merger.addIterator | test | public function addIterator(iterable $iterator, PagesInterface $pages = null): void
{
foreach ($iterator as $filename) {
$this->addFile($filename, $pages);
}
} | php | {
"resource": ""
} |
q257321 | Linked.jsonUnserializeFromProperties | test | protected static function jsonUnserializeFromProperties($properties)
{
if ( ! is_array($properties) && ! is_object($properties)) {
throw UnserializationException::invalidProperty('Linked CRS', 'properties', $properties, 'array or object');
}
$properties = new \ArrayObject($prope... | php | {
"resource": ""
} |
q257322 | GeoJson.setOptionalConstructorArgs | test | protected function setOptionalConstructorArgs(array $args)
{
foreach ($args as $arg) {
if ($arg instanceof CoordinateReferenceSystem) {
$this->crs = $arg;
}
if ($arg instanceof BoundingBox) {
$this->boundingBox = $arg;
}
... | php | {
"resource": ""
} |
q257323 | UnserializationException.invalidValue | test | public static function invalidValue($context, $value, $expectedType)
{
return new self(sprintf(
'%s expected value of type %s, %s given',
$context,
$expectedType,
is_object($value) ? get_class($value) : gettype($value)
));
} | php | {
"resource": ""
} |
q257324 | UnserializationException.invalidProperty | test | public static function invalidProperty($context, $property, $value, $expectedType)
{
return new self(sprintf(
'%s expected "%s" property of type %s, %s given',
$context,
$property,
$expectedType,
is_object($value) ? get_class($value) : gettype($val... | php | {
"resource": ""
} |
q257325 | Named.jsonUnserializeFromProperties | test | protected static function jsonUnserializeFromProperties($properties)
{
if ( ! is_array($properties) && ! is_object($properties)) {
throw UnserializationException::invalidProperty('Named CRS', 'properties', $properties, 'array or object');
}
$properties = new \ArrayObject($proper... | php | {
"resource": ""
} |
q257326 | Application.configPath | test | public function configPath($path = '')
{
return $this->basePath.DIRECTORY_SEPARATOR.'vendor'.DIRECTORY_SEPARATOR.'matthewbdaly'.DIRECTORY_SEPARATOR.'artisan-standalone'.DIRECTORY_SEPARATOR.'config'.($path ? DIRECTORY_SEPARATOR.$path : $path);
} | php | {
"resource": ""
} |
q257327 | Application.getNamespace | test | public function getNamespace()
{
if (! is_null($this->namespace)) {
return $this->namespace;
}
$path = $this->basePath;
$composer = json_decode(file_get_contents($path.DIRECTORY_SEPARATOR.'composer.json'), true);
foreach ((array) data_get($composer, 'autoload.psr... | php | {
"resource": ""
} |
q257328 | CacheAdapterExtension.load | test | public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load(... | php | {
"resource": ""
} |
q257329 | HdNode.newMasterNode | test | public static function newMasterNode($entropy)
{
$hmac = hash_hmac('sha512', $entropy, 'ed25519 seed', true);
return new HdNode(
substr($hmac, 0, 32),
substr($hmac, 32, 32)
);
} | php | {
"resource": ""
} |
q257330 | Account.getNativeBalance | test | public function getNativeBalance()
{
MathSafety::require64Bit();
foreach ($this->getBalances() as $balance) {
if ($balance->isNativeAsset()) return $balance->getBalance();
}
return 0;
} | php | {
"resource": ""
} |
q257331 | Account.getNativeBalanceStroops | test | public function getNativeBalanceStroops()
{
MathSafety::require64Bit();
foreach ($this->getBalances() as $balance) {
if ($balance->isNativeAsset()) return $balance->getUnscaledBalance();
}
return "0";
} | php | {
"resource": ""
} |
q257332 | Account.getCustomAssetBalanceValue | test | public function getCustomAssetBalanceValue(Asset $asset)
{
foreach ($this->getBalances() as $balance) {
if ($balance->getAssetCode() !== $asset->getAssetCode()) continue;
if ($balance->getAssetIssuerAccountId() != $asset->getIssuer()->getAccountIdString()) continue;
retu... | php | {
"resource": ""
} |
q257333 | Account.getCustomAssetBalance | test | public function getCustomAssetBalance(Asset $asset)
{
foreach ($this->getBalances() as $balance) {
if ($balance->getAssetCode() !== $asset->getAssetCode()) continue;
if ($balance->getAssetIssuerAccountId() != $asset->getIssuer()->getAccountIdString()) continue;
return $b... | php | {
"resource": ""
} |
q257334 | Account.getCustomAssetBalanceStroops | test | public function getCustomAssetBalanceStroops(Asset $asset)
{
MathSafety::require64Bit();
foreach ($this->getBalances() as $balance) {
if ($balance->getAssetCode() !== $asset->getAssetCode()) continue;
if ($balance->getAssetIssuerAccountId() != $asset->getIssuer()->getAccount... | php | {
"resource": ""
} |
q257335 | Bip39.getEntropyChecksumHex | test | public static function getEntropyChecksumHex($entropyBytes)
{
$checksumLengthBits = (strlen($entropyBytes)*8) / 32;
$hashBytes = hash('sha256', $entropyBytes, true);
// base_convert can only handle up to 64 bits, so we have to reduce the
// length of data that gets sent to it
... | php | {
"resource": ""
} |
q257336 | Bip39.bitstringToHex | test | public static function bitstringToHex($bitstring)
{
$chunkSizeBits = 8;
// If the string is shorter than the chunk size it can be 0-padded
if (strlen($bitstring) < $chunkSizeBits) {
$bitstring = str_pad($bitstring, $chunkSizeBits, '0', STR_PAD_LEFT);
}
if (strle... | php | {
"resource": ""
} |
q257337 | Bip39.mnemonicToEntropy | test | public function mnemonicToEntropy($mnenomic)
{
$bitstring = $this->parseMnemonic($mnenomic);
// Calculate expected lengths
$numChecksumBits = strlen($bitstring) / 33;
$numEntropyBits = strlen($bitstring) - $numChecksumBits;
// Get checksum bits from the end of the string
... | php | {
"resource": ""
} |
q257338 | TransactionBuilder.authorizeTrustline | test | public function authorizeTrustline(Asset $asset, $trustorId, $sourceAccountId = null)
{
if ($trustorId instanceof Keypair) {
$trustorId = $trustorId->getPublicKey();
}
$op = new AllowTrustOp($asset, new AccountId($trustorId), $sourceAccountId);
$op->setIsAuthorized(true)... | php | {
"resource": ""
} |
q257339 | TransactionBuilder.revokeTrustline | test | public function revokeTrustline(Asset $asset, $trustorId, $sourceAccountId = null)
{
if ($trustorId instanceof Keypair) {
$trustorId = $trustorId->getPublicKey();
}
$op = new AllowTrustOp($asset, new AccountId($trustorId), $sourceAccountId);
$op->setIsAuthorized(false);
... | php | {
"resource": ""
} |
q257340 | Operation.toXdr | test | public function toXdr()
{
$bytes = '';
// Source Account
$bytes .= XdrEncoder::optional($this->sourceAccount);
// Type
$bytes .= XdrEncoder::unsignedInteger($this->type);
return $bytes;
} | php | {
"resource": ""
} |
q257341 | XdrEncoder.opaqueVariable | test | public static function opaqueVariable($value)
{
$maxLength = pow(2, 32) - 1;
if (strlen($value) > $maxLength) throw new \InvalidArgumentException(sprintf('Value of length %s is greater than the maximum allowed length of %s', strlen($value), $maxLength));
$bytes = '';
$bytes... | php | {
"resource": ""
} |
q257342 | XdrEncoder.optional | test | public static function optional(XdrEncodableInterface $value = null)
{
$bytes = '';
if ($value !== null) {
$bytes .= self::boolean(true);
$bytes .= $value->toXdr();
}
else {
$bytes .= self::boolean(false);
}
return $bytes;
} | php | {
"resource": ""
} |
q257343 | BucketLevel.getUniqueBucketHashes | test | public function getUniqueBucketHashes()
{
$hashes = [];
if ($this->curr != self::HASH_EMPTY) $hashes[] = $this->curr;
if ($this->snap != self::HASH_EMPTY) $hashes[] = $this->snap;
return array_values(array_unique($hashes));
} | php | {
"resource": ""
} |
q257344 | Server.accountExists | test | public function accountExists($accountId)
{
// Handle basic errors such as malformed account IDs
try {
$account = $this->getAccount($accountId);
} catch (\InvalidArgumentException $e) {
return false;
}
// Account ID may be valid but hasn't been funded... | php | {
"resource": ""
} |
q257345 | SetOptionsOp.setAuthRequired | test | public function setAuthRequired($isRequired)
{
if ($isRequired) {
$this->setFlags = $this->setFlags | static::FLAG_AUTH_REQUIRED;
$this->clearFlags = $this->clearFlags & ~(static::FLAG_AUTH_REQUIRED);
}
else {
$this->setFlags = $this->setFlags & ~(stat... | php | {
"resource": ""
} |
q257346 | SetOptionsOp.setAuthRevocable | test | public function setAuthRevocable($isRevocable)
{
if ($isRevocable) {
$this->setFlags = $this->setFlags | static::FLAG_AUTH_REVOCABLE;
$this->clearFlags = $this->clearFlags & ~(static::FLAG_AUTH_REVOCABLE);
}
else {
$this->setFlags = $this->setFlags & ~... | php | {
"resource": ""
} |
q257347 | Keypair.getPublicKeyChecksum | test | public function getPublicKeyChecksum()
{
$checksumBytes = substr($this->getPublicKeyBytes(), -2);
$unpacked = unpack('v', $checksumBytes);
return array_shift($unpacked);
} | php | {
"resource": ""
} |
q257348 | XdrDecoder.opaqueFixedString | test | public static function opaqueFixedString($xdr, $length)
{
$bytes = static::opaqueFixed($xdr, $length);
// remove trailing nulls
return strval(rtrim($bytes, "\0x00"));
} | php | {
"resource": ""
} |
q257349 | PostTransactionResponse.parseRawData | test | protected function parseRawData($rawData)
{
if (!$rawData) return;
if (!empty($rawData['result_xdr'])) {
$xdr = new XdrBuffer(base64_decode($rawData['result_xdr']));
$this->result = TransactionResult::fromXdr($xdr);
}
} | php | {
"resource": ""
} |
q257350 | TransactionEnvelope.sign | test | public function sign($keypairsOrsecretKeyStrings, Server $server = null)
{
if (!is_array($keypairsOrsecretKeyStrings)) $keypairsOrsecretKeyStrings = [$keypairsOrsecretKeyStrings];
$transactionHash = null;
if ($server) {
$transactionHash = $server->getApiClient()->hash($this->tra... | php | {
"resource": ""
} |
q257351 | ApiClient.submitTransaction | test | public function submitTransaction(TransactionBuilder $transactionBuilder, $signingAccountSeedString)
{
$transactionEnvelope = $transactionBuilder->sign($signingAccountSeedString);
return $this->submitB64Transaction(base64_encode($transactionEnvelope->toXdr()));
} | php | {
"resource": ""
} |
q257352 | Patch.fromText | test | public function fromText($patchText){
$patches = array();
if (!$patchText) {
return $patches;
}
$lines = explode("\n", $patchText);
while (count($lines)) {
$line = $lines[0];
if (!preg_match("/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/", $line, $m)... | php | {
"resource": ""
} |
q257353 | Patch.toText | test | public function toText($patches)
{
$text = '';
foreach ($patches as $patch) {
$text .= (string)$patch;
}
return $text;
} | php | {
"resource": ""
} |
q257354 | Patch.addContext | test | public function addContext(PatchObject $patch, $text)
{
if (!mb_strlen($text)) {
return;
}
$padding = 0;
$pattern = mb_substr($text, $patch->getStart1(), $patch->getLength1());
// Look for the first and last matches of pattern in text.
// If two different... | php | {
"resource": ""
} |
q257355 | Patch.deepCopy | test | protected function deepCopy($patches)
{
$patchesCopy = array();
foreach ($patches as $patch) {
$patchCopy = clone $patch;
$patchesCopy[] = $patchCopy;
}
return $patchesCopy;
} | php | {
"resource": ""
} |
q257356 | Match.bitapScore | test | protected function bitapScore($errors, $matchLoc, $patternLen, $searchLoc)
{
$accuracy = $errors / $patternLen;
$proximity = abs($searchLoc - $matchLoc);
if (!$this->getDistance()) {
// Dodge divide by zero error.
return $proximity ? 1.0 : $accuracy;
}
... | php | {
"resource": ""
} |
q257357 | Match.alphabet | test | public function alphabet($pattern)
{
$s = array();
foreach (preg_split("//u", $pattern, -1, PREG_SPLIT_NO_EMPTY) as $char) {
$s[$char] = 0;
}
for ($i = 0; $i < mb_strlen($pattern); $i++) {
$s[mb_substr($pattern, $i, 1)] |= 1 << (mb_strlen($pattern) - $i - 1);
... | php | {
"resource": ""
} |
q257358 | Diff.prettyHtml | test | public function prettyHtml()
{
$diffs = $this->getChanges();
$html = '';
foreach ($diffs as $change) {
$op = $change[0];
$data = $change[1];
$text = str_replace(array(
'&', '<', '>', "\n",
), array(
'&', '&l... | php | {
"resource": ""
} |
q257359 | Diff.toDelta | test | public function toDelta() {
$diffs = $this->getChanges();
$text = array();
foreach ($diffs as $change) {
$op = $change[0];
$data = $change[1];
if ($op == self::INSERT) {
$text[] = '+'. Utils::escapeString($data);
} elseif ($op == ... | php | {
"resource": ""
} |
q257360 | Diff.fromDelta | test | public function fromDelta($text1, $delta)
{
$diffs = array();
// Cursor in text1
$pointer = 0;
$tokens = explode("\t", $delta);
foreach ($tokens as $token) {
if ($token == '') {
// Blank tokens are ok (from a trailing \t).
continue;... | php | {
"resource": ""
} |
q257361 | Diff.levenshtein | test | public function levenshtein()
{
$diffs = $this->getChanges();
$levenshtein = 0;
$insertions = 0;
$deletions = 0;
foreach ($diffs as $change) {
$op = $change[0];
$text = $change[1];
switch ($op) {
case self::INSERT:
... | php | {
"resource": ""
} |
q257362 | Diff.compute | test | protected function compute($text1, $text2, $checklines, $deadline)
{
if ($text1 == '') {
// Just add some text (speedup).
return array(
array(self::INSERT, $text2),
);
}
if ($text2 == '') {
// Just delete some text (speedup).
... | php | {
"resource": ""
} |
q257363 | Diff.lineMode | test | protected function lineMode($text1, $text2, $deadline)
{
// Scan the text on a line-by-line basis first.
list($text1, $text2, $lineArray) = $this->getToolkit()->linesToChars($text1, $text2);
$diff = new Diff();
$diff->main($text1, $text2, false, $deadline);
$diffs = $diff->g... | php | {
"resource": ""
} |
q257364 | Diff.bisectSplit | test | protected function bisectSplit($text1, $text2, $x, $y, $deadline)
{
$text1A = mb_substr($text1, 0, $x);
$text2A = mb_substr($text2, 0, $y);
$text1B = mb_substr($text1, $x);
$text2B = mb_substr($text2, $y);
// Compute both diffs serially.
$diffA = new Diff();
... | php | {
"resource": ""
} |
q257365 | DiffToolkit.commonPrefix | test | public function commonPrefix($text1, $text2)
{
// Quick check for common null cases.
if ($text1 == '' || $text2 == '' || mb_substr($text1, 0, 1) != mb_substr($text2, 0, 1)) {
return 0;
}
// Binary search.
// Performance analysis: http://neil.fraser.name/news/2007/... | php | {
"resource": ""
} |
q257366 | DiffToolkit.commonSuffix | test | public function commonSuffix($text1, $text2)
{
// Quick check for common null cases.
if ($text1 == '' || $text2 == '' || mb_substr($text1, -1, 1) != mb_substr($text2, -1, 1)) {
return 0;
}
// Binary search.
// Performance analysis: http://neil.fraser.name/news/200... | php | {
"resource": ""
} |
q257367 | DiffToolkit.commontOverlap | test | public function commontOverlap($text1, $text2)
{
// Cache the text lengths to prevent multiple calls.
$text1_length = mb_strlen($text1);
$text2_length = mb_strlen($text2);
// Eliminate the null case.
if (!$text1_length || !$text2_length) {
return 0;
}
... | php | {
"resource": ""
} |
q257368 | DiffToolkit.halfMatch | test | public function halfMatch($text1, $text2)
{
if (mb_strlen($text1) > mb_strlen($text2)) {
$longtext = $text1;
$shorttext = $text2;
} else {
$shorttext = $text1;
$longtext = $text2;
}
if (mb_strlen($longtext) < 4 || mb_strlen($shorttext)... | php | {
"resource": ""
} |
q257369 | DiffToolkit.halfMatchI | test | protected function halfMatchI($longtext, $shorttext, $i)
{
$seed = mb_substr($longtext, $i, (int)(mb_strlen($longtext) / 4));
$best_common = $best_longtext_a = $best_longtext_b = $best_shorttext_a = $best_shorttext_b = '';
$j = mb_strpos($shorttext, $seed);
while ($j !== false) {
... | php | {
"resource": ""
} |
q257370 | DiffToolkit.linesToChars | test | public function linesToChars($text1, $text2)
{
// e.g. $lineArray[4] == "Hello\n"
$lineArray = array();
// e.g. $lineHash["Hello\n"] == 4
$lineHash = array();
// "\x00" is a valid character, but various debuggers don't like it.
// So we'll insert a junk entry to avoi... | php | {
"resource": ""
} |
q257371 | SmscRuChannel.getRecipients | test | protected function getRecipients($notifiable, Notification $notification)
{
$to = $notifiable->routeNotificationFor('smscru', $notification);
if ($to === null || $to === false || $to === '') {
return [];
}
return \is_array($to) ? $to : [$to];
} | php | {
"resource": ""
} |
q257372 | ServiceProvider.version | test | public function version()
{
$app = $this->app;
$tab = explode('Laravel Components ', $app->version());
return intval(empty($tab[1]) ? $app::VERSION : $tab[1]);
} | php | {
"resource": ""
} |
q257373 | ServiceProvider.registerPugCompiler | test | public function registerPugCompiler($subExtension = '')
{
// Add resolver
$this->getEngineResolver()->register('pug' . $subExtension, function () use ($subExtension) {
return new CompilerEngine($this->app['Bkwld\LaravelPug\Pug' . ucfirst(ltrim($subExtension, '.')) . 'Compiler']);
... | php | {
"resource": ""
} |
q257374 | ServiceProvider.getConfig | test | public function getConfig()
{
$key = $this->version() >= 5 ? 'laravel-pug' : 'laravel-pug::config';
return array_merge(array(
'allow_composite_extensions' => true,
), $this->app->make('config')->get($key));
} | php | {
"resource": ""
} |
q257375 | PugHandlerTrait.construct | test | public function construct(array $pugTarget, Filesystem $files, array $config, $defaultCachePath = null)
{
$this->pugTarget = $pugTarget;
$cachePath = null;
foreach (array('cache_dir', 'cache', 'defaultCache') as $name) {
if (isset($config[$name])) {
$cachePath = ... | php | {
"resource": ""
} |
q257376 | PugHandlerTrait.getPug | test | public function getPug()
{
if (!$this->pug) {
$this->pug = $this->pugTarget[0][$this->pugTarget[1]];
}
return $this->pug;
} | php | {
"resource": ""
} |
q257377 | PugHandlerTrait.getCachePath | test | public function getCachePath()
{
if ($this->cachePath) {
return $this->cachePath;
}
$cachePath = $this->getOption('cache');
return is_string($cachePath) ? $cachePath : $this->getOption('defaultCache');
} | php | {
"resource": ""
} |
q257378 | PugHandlerTrait.getOption | test | public function getOption($name, $default = null)
{
$pug = $this->getPug();
try {
if (method_exists($pug, 'hasOption') && !$pug->hasOption($name)) {
throw new \InvalidArgumentException('invalid option');
}
return $pug->getOption($name);
}... | php | {
"resource": ""
} |
q257379 | PugHandlerTrait.isExpired | test | public function isExpired($path)
{
if (!$this->cachePath || parent::isExpired($path)) {
return true;
}
return is_subclass_of('\Pug\Pug', '\Phug\Renderer') && $this->hasExpiredImport($path);
} | php | {
"resource": ""
} |
q257380 | PugHandlerTrait.extractPath | test | public function extractPath($path)
{
if ($path && method_exists($this, 'setPath')) {
$this->setPath($path);
}
if (!$path && method_exists($this, 'getPath')) {
$path = $this->getPath();
}
if (!$path) {
throw new InvalidArgumentException('M... | php | {
"resource": ""
} |
q257381 | AmoCrmManager.getClient | test | public function getClient()
{
if (!$this->client instanceof Client) {
$this->client = new Client(
$this->config->get('amocrm.domain'),
$this->config->get('amocrm.login'),
$this->config->get('amocrm.hash')
);
}
return $t... | php | {
"resource": ""
} |
q257382 | AmoCrmManager.getB2BFamily | test | public function getB2BFamily()
{
$client = $this->getClient();
return new B2BFamily($client,
$this->config->get('amocrm.b2bfamily.appkey'),
$this->config->get('amocrm.b2bfamily.secret'),
$this->config->get('amocrm.b2bfamily.email'),
$this->config->get... | php | {
"resource": ""
} |
q257383 | Optimizer.hashPrint | test | private function hashPrint($input)
{
// Get the stronger hashing algorithm available to minimize collision risks
$algorithms = hash_algos();
$algorithm = $algorithms[0];
$number = 0;
foreach ($algorithms as $hashAlgorithm) {
$lettersLength = substr($hashAlgorithm,... | php | {
"resource": ""
} |
q257384 | Optimizer.resolve | test | public function resolve($file)
{
return $this->locator->locate(
$file,
$this->paths,
isset($this->options['extensions'])
? $this->options['extensions']
: ['', '.pug', '.jade']
);
} | php | {
"resource": ""
} |
q257385 | Optimizer.displayFile | test | public function displayFile($__pug_file, array $__pug_parameters = [])
{
if ($this->isExpired($__pug_file, $__pug_cache_file)) {
if (isset($this->options['render'])) {
call_user_func($this->options['render'], $__pug_file, $__pug_parameters, $this->options);
retur... | php | {
"resource": ""
} |
q257386 | ExtensionsTrait.getExtensionsOptions | test | public static function getExtensionsOptions(array $extensions, array $options = [])
{
$methods = static::getExtensionsGetters();
foreach ($extensions as $extensionClassName) {
if (is_a($extensionClassName, ModuleInterface::class, true)) {
if (!isset($options['modules'])) ... | php | {
"resource": ""
} |
q257387 | Phug.removeOptions | test | public static function removeOptions($path, $options)
{
if (self::$renderer && (empty($path) || self::$renderer->hasOption($path))) {
if (is_array($options)) {
foreach ($options as $key => $value) {
if (is_int($key)) {
$callbacks = self... | php | {
"resource": ""
} |
q257388 | Phug.reset | test | public static function reset()
{
static::resetFacadeOptions();
self::$renderer = null;
self::$extensions = [];
self::$filters = [];
self::$keywords = [];
} | php | {
"resource": ""
} |
q257389 | Phug.getRenderer | test | public static function getRenderer(array $options = [])
{
$options = static::getOptions($options);
if (!self::$renderer) {
$rendererClassName = self::getRendererClassName();
self::$renderer = new $rendererClassName($options);
} elseif (!empty($options)) {
... | php | {
"resource": ""
} |
q257390 | Phug.addFilter | test | public static function addFilter($name, $filter)
{
$key = self::normalizeFilterName($name);
if (isset(self::$filters[$key])) {
throw new PhugException(
'Filter '.$name.' is already set.'
);
}
self::setFilter($name, $filter);
} | php | {
"resource": ""
} |
q257391 | Phug.addKeyword | test | public static function addKeyword($name, $keyword)
{
$key = self::normalizeKeywordName($name);
if (isset(self::$keywords[$key])) {
throw new PhugException(
'Keyword '.$name.' is already set.'
);
}
self::setKeyword($name, $keyword);
} | php | {
"resource": ""
} |
q257392 | Phug.textualCacheDirectory | test | public static function textualCacheDirectory($source, $destination = null, $options = null)
{
list($success, $errors, $errorDetails) = static::cacheDirectory($source, $destination, $options);
return
"$success templates cached.\n".
"$errors templates failed to be cached.\n".
... | php | {
"resource": ""
} |
q257393 | Cli.run | test | public function run($arguments)
{
$outputFile = $this->getNamedArgument($arguments, ['--output-file', '-o']);
$bootstrapFile = $this->getNamedArgument($arguments, ['--bootstrap', '-b']);
if ($bootstrapFile) {
include $bootstrapFile;
} elseif (file_exists('phugBootstrap.ph... | php | {
"resource": ""
} |
q257394 | Cli.getAvailableMethods | test | public function getAvailableMethods($customMethods = null)
{
foreach ([$this->methods, $customMethods ?: $this->getCustomMethods()] as $methods) {
foreach ($methods as $method => $action) {
$method = is_int($method) ? $action : $method;
if (substr($method, 0, 2) !... | php | {
"resource": ""
} |
q257395 | Cli.listAvailableMethods | test | public function listAvailableMethods($customMethods = null)
{
echo "Available methods are:\n";
foreach ($this->getAvailableMethods($customMethods ?: $this->getCustomMethods()) as $method) {
$action = $this->convertToKebabCase($method);
$target = isset($this->methods[$method])... | php | {
"resource": ""
} |
q257396 | SEOEditorMetaDescriptionColumn.getErrors | test | public function getErrors(DataObject $record)
{
$errors = [];
if (strlen($record->MetaDescription) < 10) {
$errors[] = 'seo-editor-error-too-short';
}
if (strlen($record->MetaDescription) > 160) {
$errors[] = 'seo-editor-error-too-long';
}
if ... | php | {
"resource": ""
} |
q257397 | SEOEditorAdmin.getList | test | public function getList()
{
$list = parent::getList();
$params = $this->request->requestVar('q');
if (isset($params['RemoveEmptyMetaTitles']) && $params['RemoveEmptyMetaTitles']) {
$list = $this->removeEmptyAttributes($list, 'MetaTitle');
}
if (isset($params['Re... | php | {
"resource": ""
} |
q257398 | SEOEditorAdmin.markDuplicates | test | private function markDuplicates($list)
{
$duplicates = $this->findDuplicates($list, 'MetaTitle')->map('ID', 'ID')->toArray();
$duplicateList = new ArrayList();
foreach ($list as $item) {
if (in_array($item->ID, $duplicates)) {
$item->IsDuplicate = true;
... | php | {
"resource": ""
} |
q257399 | SEOEditorAdmin.findDuplicates | test | private function findDuplicates(SS_List $list, $type)
{
$pageAttributes = $list->map('ID', $type)->toArray();
$potentialDuplicateAttributes = array_unique(
array_diff_assoc(
$pageAttributes,
array_unique($pageAttributes)
)
);
$... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.