_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q251000 | Assertion.contain | validation | function contain($value = null): self {
if ($this->hasFlag('file')) return $this->expect(@file_get_contents($this->target), stringContains($value));
return $this->expect($this->target, is_string($this->target) ? stringContains($value) : contains($value));
} | php | {
"resource": ""
} |
q251001 | Assertion.containOnly | validation | function containOnly(string $type): self {
return $this->expect($this->target, containsOnly($type));
} | php | {
"resource": ""
} |
q251002 | Assertion.containOnlyInstancesOf | validation | function containOnlyInstancesOf(string $className): self {
return $this->expect($this->target, containsOnlyInstancesOf($className));
} | php | {
"resource": ""
} |
q251003 | Assertion.empty | validation | function empty(): self {
if (is_object($this->target) && !($this->target instanceof \Countable)) {
$constraint = countOf(0);
$target = get_object_vars($this->target);
}
else if (is_string($this->target)) {
$constraint = equalTo(0);
$target = $this->hasFlag('file') ? @filesize($this->... | php | {
"resource": ""
} |
q251004 | Assertion.endWith | validation | function endWith(string $value): self {
return $this->expect($this->target, stringEndsWith($value));
} | php | {
"resource": ""
} |
q251005 | Assertion.equal | validation | function equal($value): self {
if ($this->hasFlag('file')) {
if ($this->hasFlag('negate')) assertFileNotEquals($value, $this->target, $this->message);
else assertFileEquals($value, $this->target, $this->message);
return $this;
}
$target = $this->hasFlag('length') ? $this->getLength($this-... | php | {
"resource": ""
} |
q251006 | Assertion.exist | validation | function exist(): self {
if ($this->hasFlag('directory')) $constraint = directoryExists();
else if ($this->hasFlag('file')) $constraint = fileExists();
else throw new \BadMethodCallException('This assertion is not a file or directory one.');
return $this->expect($this->target, $constraint);
} | php | {
"resource": ""
} |
q251007 | Assertion.instanceOf | validation | function instanceOf(string $className): self {
return $this->expect($this->target, isInstanceOf($className));
} | php | {
"resource": ""
} |
q251008 | Assertion.least | validation | function least($value): self {
$target = $this->hasFlag('length') ? $this->getLength($this->target) : $this->target;
return $this->expect($target, greaterThanOrEqual($value));
} | php | {
"resource": ""
} |
q251009 | Assertion.lengthOf | validation | function lengthOf(int $value = null): self {
if ($value === null) return $this->setFlag('length');
if (is_string($this->target)) {
$constraint = equalTo($value);
$target = mb_strlen($this->target);
}
else {
$constraint = countOf($value);
$target = $this->target;
}
retur... | php | {
"resource": ""
} |
q251010 | Assertion.match | validation | function match(string $pattern): self {
return $this->expect($this->target, matchesRegularExpression($pattern));
} | php | {
"resource": ""
} |
q251011 | Assertion.matchFormat | validation | function matchFormat(string $format): self {
return $this->expect($this->target, matches($format));
} | php | {
"resource": ""
} |
q251012 | Assertion.most | validation | function most($value): self {
$target = $this->hasFlag('length') ? $this->getLength($this->target) : $this->target;
return $this->expect($target, lessThanOrEqual($value));
} | php | {
"resource": ""
} |
q251013 | Assertion.property | validation | function property(string $name, $value = null): self {
$isArray = is_array($this->target) || $this->target instanceof \ArrayAccess;
if (!$isArray && !is_object($this->target)) throw new \BadMethodCallException('The target is not an array nor an object.');
$hasProperty = $isArray ? array_key_exists($name, $... | php | {
"resource": ""
} |
q251014 | Assertion.readable | validation | function readable(): self {
if (!$this->hasFlag('directory') && !$this->hasFlag('file'))
throw new \BadMethodCallException('This assertion is not a file or directory one.');
return $this->expect($this->target, isReadable());
} | php | {
"resource": ""
} |
q251015 | Assertion.satisfy | validation | function satisfy(callable $predicate): self {
return $this->expect(call_user_func($predicate, $this->target), isTrue());
} | php | {
"resource": ""
} |
q251016 | Assertion.startWith | validation | function startWith(string $value): self {
return $this->expect($this->target, stringStartsWith($value));
} | php | {
"resource": ""
} |
q251017 | Assertion.throw | validation | function throw(string $className = ''): self {
if (!is_callable($this->target)) throw new \BadMethodCallException('The function target is not callable.');
$exception = null;
try { call_user_func($this->target); }
catch (\Throwable $e) { $exception = $e; }
$constraint = logicalNot(isNull());
re... | php | {
"resource": ""
} |
q251018 | Assertion.within | validation | function within($start, $finish): self {
$target = $this->hasFlag('length') ? $this->getLength($this->target) : $this->target;
return $this->expect($target, logicalAnd(greaterThanOrEqual($start), lessThanOrEqual($finish)));
} | php | {
"resource": ""
} |
q251019 | Assertion.writable | validation | function writable(): self {
if (!$this->hasFlag('directory') && !$this->hasFlag('file'))
throw new \BadMethodCallException('This assertion is not a file or directory one.');
return $this->expect($this->target, isWritable());
} | php | {
"resource": ""
} |
q251020 | Assertion.expect | validation | private function expect($target, Constraint $constraint): self {
assertThat($target, $this->hasFlag('negate') ? logicalNot($constraint) : $constraint, $this->message);
return $this;
} | php | {
"resource": ""
} |
q251021 | Assertion.getLength | validation | private function getLength($value): int {
if (is_array($value) || $value instanceof \Countable) return count($value);
if ($value instanceof \Traversable) return iterator_count($value);
if (is_string($value)) return mb_strlen($value);
throw new \InvalidArgumentException("The specified value is not iterab... | php | {
"resource": ""
} |
q251022 | Assertion.setFlag | validation | private function setFlag(string $name, bool $value = true): self {
$this->flags[$name] = $value;
return $this;
} | php | {
"resource": ""
} |
q251023 | Parser.parseIf | validation | private function parseIf() {
// consume required tokens
$if_open = $this->pop('IF_OPEN');
$output = 'if(' . $if_open[1] . ') {' . "\n";
$this->currLine++;
$seeking = true;
while($seeking) {
list($type, $value) = $this->peek();
switch($type) {
... | php | {
"resource": ""
} |
q251024 | Parser.parseExpression | validation | public function parseExpression() {
$token = $this->peek();
// check first token
$type = $token[0];
switch($type) {
case 'IF_OPEN':
return $this->parseIf();
case 'FOR_OPEN':
return $this->parseFor();
case 'FILTERED_VALUE':
retu... | php | {
"resource": ""
} |
q251025 | Parser.parseHTML | validation | public function parseHTML() {
$token = $this->pop('HTML');
$value = $this->stripQuotes($token[1]);
$this->currLine += substr_count($value, "\n");
return '$output .= \'' . $value . "';\n";
} | php | {
"resource": ""
} |
q251026 | Parser.parseFor | validation | public function parseFor() {
// consume required tokens
$for_open_token = $this->pop('FOR_OPEN');
$this->currLine++;
// create output so far
$output = '$for_index = 0; foreach(' .
$for_open_token[1][1] . ' as ' .
$for_open_token[1][0] . ') {' . "\n";
... | php | {
"resource": ""
} |
q251027 | Parser.parseEscape | validation | public function parseEscape() {
$token = $this->pop('ESCAPE');
$value = $this->stripQuotes($token[1]);
$this->currLine += substr_count($value, "\n");
return '$output .= \'' . $value . "';\n";
} | php | {
"resource": ""
} |
q251028 | Parser.parseFilteredValue | validation | public function parseFilteredValue() {
list($type, $filters) = $this->pop('FILTERED_VALUE');
$value = array_shift($filters);
$opening = '';
$closing = '';
foreach($filters as $filter) {
if(function_exists($filter)) {
$opening .= $filter . '(';
... | php | {
"resource": ""
} |
q251029 | Conditional.setConditions | validation | public function setConditions($pValue)
{
if (!is_array($pValue)) {
$pValue = [$pValue];
}
$this->condition = $pValue;
return $this;
} | php | {
"resource": ""
} |
q251030 | Chart.setBottomRightPosition | validation | public function setBottomRightPosition($cell, $xOffset = null, $yOffset = null)
{
$this->bottomRightCellRef = $cell;
if ($xOffset !== null) {
$this->setBottomRightXOffset($xOffset);
}
if ($yOffset !== null) {
$this->setBottomRightYOffset($yOffset);
}
... | php | {
"resource": ""
} |
q251031 | Cell.getFormattedValue | validation | public function getFormattedValue()
{
return (string) NumberFormat::toFormattedString(
$this->getCalculatedValue(),
$this->getStyle()
->getNumberFormat()->getFormatCode()
);
} | php | {
"resource": ""
} |
q251032 | Cell.getCalculatedValue | validation | public function getCalculatedValue($resetLog = true)
{
if ($this->dataType == DataType::TYPE_FORMULA) {
try {
$result = Calculation::getInstance(
$this->getWorksheet()->getParent()
)->calculateCellValue($this, $resetLog);
// ... | php | {
"resource": ""
} |
q251033 | Cell.setDataType | validation | public function setDataType($pDataType)
{
if ($pDataType == DataType::TYPE_STRING2) {
$pDataType = DataType::TYPE_STRING;
}
$this->dataType = $pDataType;
return $this->updateInCollection();
} | php | {
"resource": ""
} |
q251034 | Cell.hasDataValidation | validation | public function hasDataValidation()
{
if (!isset($this->parent)) {
throw new Exception('Cannot check for data validation when cell is not bound to a worksheet');
}
return $this->getWorksheet()->dataValidationExists($this->getCoordinate());
} | php | {
"resource": ""
} |
q251035 | Cell.getDataValidation | validation | public function getDataValidation()
{
if (!isset($this->parent)) {
throw new Exception('Cannot get data validation for cell that is not bound to a worksheet');
}
return $this->getWorksheet()->getDataValidation($this->getCoordinate());
} | php | {
"resource": ""
} |
q251036 | Cell.setDataValidation | validation | public function setDataValidation(DataValidation $pDataValidation = null)
{
if (!isset($this->parent)) {
throw new Exception('Cannot set data validation for cell that is not bound to a worksheet');
}
$this->getWorksheet()->setDataValidation($this->getCoordinate(), $pDataValidati... | php | {
"resource": ""
} |
q251037 | Cell.hasHyperlink | validation | public function hasHyperlink()
{
if (!isset($this->parent)) {
throw new Exception('Cannot check for hyperlink when cell is not bound to a worksheet');
}
return $this->getWorksheet()->hyperlinkExists($this->getCoordinate());
} | php | {
"resource": ""
} |
q251038 | Cell.getHyperlink | validation | public function getHyperlink()
{
if (!isset($this->parent)) {
throw new Exception('Cannot get hyperlink for cell that is not bound to a worksheet');
}
return $this->getWorksheet()->getHyperlink($this->getCoordinate());
} | php | {
"resource": ""
} |
q251039 | Cell.setHyperlink | validation | public function setHyperlink(Hyperlink $pHyperlink = null)
{
if (!isset($this->parent)) {
throw new Exception('Cannot set hyperlink for cell that is not bound to a worksheet');
}
$this->getWorksheet()->setHyperlink($this->getCoordinate(), $pHyperlink);
return $this->upd... | php | {
"resource": ""
} |
q251040 | Cell.compareCells | validation | public static function compareCells(self $a, self $b)
{
if ($a->getRow() < $b->getRow()) {
return -1;
} elseif ($a->getRow() > $b->getRow()) {
return 1;
} elseif (Coordinate::columnIndexFromString($a->getColumn()) < Coordinate::columnIndexFromString($b->getColumn())) ... | php | {
"resource": ""
} |
q251041 | Settings.setChartRenderer | validation | public static function setChartRenderer($rendererClass)
{
if (!is_a($rendererClass, IRenderer::class, true)) {
throw new Exception('Chart renderer must implement ' . IRenderer::class);
}
self::$chartRenderer = $rendererClass;
} | php | {
"resource": ""
} |
q251042 | Settings.setLibXmlLoaderOptions | validation | public static function setLibXmlLoaderOptions($options)
{
if ($options === null && defined('LIBXML_DTDLOAD')) {
$options = LIBXML_DTDLOAD | LIBXML_DTDATTR;
}
self::$libXmlLoaderOptions = $options;
} | php | {
"resource": ""
} |
q251043 | Settings.getLibXmlLoaderOptions | validation | public static function getLibXmlLoaderOptions()
{
if (self::$libXmlLoaderOptions === null && defined('LIBXML_DTDLOAD')) {
self::setLibXmlLoaderOptions(LIBXML_DTDLOAD | LIBXML_DTDATTR);
} elseif (self::$libXmlLoaderOptions === null) {
self::$libXmlLoaderOptions = true;
... | php | {
"resource": ""
} |
q251044 | Properties.setCreated | validation | public function setCreated($time)
{
if ($time === null) {
$time = time();
} elseif (is_string($time)) {
if (is_numeric($time)) {
$time = (int) $time;
} else {
$time = strtotime($time);
}
}
$this->created... | php | {
"resource": ""
} |
q251045 | Properties.setModified | validation | public function setModified($time)
{
if ($time === null) {
$time = time();
} elseif (is_string($time)) {
if (is_numeric($time)) {
$time = (int) $time;
} else {
$time = strtotime($time);
}
}
$this->modifi... | php | {
"resource": ""
} |
q251046 | Escher.readDefault | validation | private function readDefault()
{
// offset 0; size: 2; recVer and recInstance
$verInstance = Xls::getUInt2d($this->data, $this->pos);
// offset: 2; size: 2: Record Type
$fbt = Xls::getUInt2d($this->data, $this->pos + 2);
// bit: 0-3; mask: 0x000F; recVer
$recVer = (... | php | {
"resource": ""
} |
q251047 | Escher.readBSE | validation | private function readBSE()
{
// offset: 0; size: 2; recVer and recInstance
// bit: 4-15; mask: 0xFFF0; recInstance
$recInstance = (0xFFF0 & Xls::getUInt2d($this->data, $this->pos)) >> 4;
$length = Xls::getInt4d($this->data, $this->pos + 4);
$recordData = substr($this->data,... | php | {
"resource": ""
} |
q251048 | Escher.readBlipJPEG | validation | private function readBlipJPEG()
{
// offset: 0; size: 2; recVer and recInstance
// bit: 4-15; mask: 0xFFF0; recInstance
$recInstance = (0xFFF0 & Xls::getUInt2d($this->data, $this->pos)) >> 4;
$length = Xls::getInt4d($this->data, $this->pos + 4);
$recordData = substr($this->... | php | {
"resource": ""
} |
q251049 | Escher.readOPT | validation | private function readOPT()
{
// offset: 0; size: 2; recVer and recInstance
// bit: 4-15; mask: 0xFFF0; recInstance
$recInstance = (0xFFF0 & Xls::getUInt2d($this->data, $this->pos)) >> 4;
$length = Xls::getInt4d($this->data, $this->pos + 4);
$recordData = substr($this->data,... | php | {
"resource": ""
} |
q251050 | Escher.readClientTextbox | validation | private function readClientTextbox()
{
// offset: 0; size: 2; recVer and recInstance
// bit: 4-15; mask: 0xFFF0; recInstance
$recInstance = (0xFFF0 & Xls::getUInt2d($this->data, $this->pos)) >> 4;
$length = Xls::getInt4d($this->data, $this->pos + 4);
$recordData = substr($t... | php | {
"resource": ""
} |
q251051 | Escher.readClientAnchor | validation | private function readClientAnchor()
{
$length = Xls::getInt4d($this->data, $this->pos + 4);
$recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record
$this->pos += 8 + $length;
// offset: 2; size: 2; upper-left corner column index (0-... | php | {
"resource": ""
} |
q251052 | AbstractApi.pureGet | validation | protected function pureGet(string $path, array $params = [], array $headers = [])
{
if ($params) {
$path .= '?'.http_build_query($params);
}
return $this->client->get($path, $headers);
} | php | {
"resource": ""
} |
q251053 | AbstractApi.putRaw | validation | protected function putRaw(string $path, $body = null, array $headers = [])
{
$response = $this->client->put($path, $headers, $body);
return ResponseMediator::getContent($response);
} | php | {
"resource": ""
} |
q251054 | AbstractApi.deleteRaw | validation | protected function deleteRaw(string $path, $body = null, array $headers = [])
{
$response = $this->client->delete($path, $headers, $body);
return ResponseMediator::getContent($response);
} | php | {
"resource": ""
} |
q251055 | BlacklistsService.addEntriesToBlacklist | validation | public function addEntriesToBlacklist($id, $entries, $importName = null)
{
if ($importName == null) {
$importName = "phpclient_import_" . uniqid();
}
$action = new AddEntriesAction();
$action->importName = $importName;
$action->entries = $entries;
return $... | php | {
"resource": ""
} |
q251056 | NamedRange.setWorksheet | validation | public function setWorksheet(Worksheet $value = null)
{
if ($value !== null) {
$this->worksheet = $value;
}
return $this;
} | php | {
"resource": ""
} |
q251057 | XMLWriter.writeRawData | validation | public function writeRawData($text)
{
if (is_array($text)) {
$text = implode("\n", $text);
}
return $this->writeRaw(htmlspecialchars($text));
} | php | {
"resource": ""
} |
q251058 | SheetView.setView | validation | public function setView($pValue)
{
// MS Excel 2007 allows setting the view to 'normal', 'pageLayout' or 'pageBreakPreview' via the user interface
if ($pValue === null) {
$pValue = self::SHEETVIEW_NORMAL;
}
if (in_array($pValue, self::$sheetViewTypes)) {
$this... | php | {
"resource": ""
} |
q251059 | PolynomialBestFit.polynomialRegression | validation | private function polynomialRegression($order, $yValues, $xValues)
{
// calculate sums
$x_sum = array_sum($xValues);
$y_sum = array_sum($yValues);
$xx_sum = $xy_sum = 0;
for ($i = 0; $i < $this->valueCount; ++$i) {
$xy_sum += $xValues[$i] * $yValues[$i];
... | php | {
"resource": ""
} |
q251060 | Bloc.setSegmentSize | validation | public function setSegmentSize($size) {
if (null !== $this->memory) {
throw new Exception\RuntimeException(
'You can not change the segment size because memory is already allocated.'
. ' Use realloc() function to create new memory segment.'
);
}
$t... | php | {
"resource": ""
} |
q251061 | AutoFilter.getColumn | validation | public function getColumn($pColumn)
{
$this->testColumnInRange($pColumn);
if (!isset($this->columns[$pColumn])) {
$this->columns[$pColumn] = new AutoFilter\Column($pColumn, $this);
}
return $this->columns[$pColumn];
} | php | {
"resource": ""
} |
q251062 | AutoFilter.shiftColumn | validation | public function shiftColumn($fromColumn, $toColumn)
{
$fromColumn = strtoupper($fromColumn);
$toColumn = strtoupper($toColumn);
if (($fromColumn !== null) && (isset($this->columns[$fromColumn])) && ($toColumn !== null)) {
$this->columns[$fromColumn]->setParent();
$th... | php | {
"resource": ""
} |
q251063 | Rels.writeRelationships | validation | public function writeRelationships(Spreadsheet $spreadsheet)
{
// Create XML writer
$objWriter = null;
if ($this->getParentWriter()->getUseDiskCaching()) {
$objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
} else {
... | php | {
"resource": ""
} |
q251064 | Rels.writeWorkbookRelationships | validation | public function writeWorkbookRelationships(Spreadsheet $spreadsheet)
{
// Create XML writer
$objWriter = null;
if ($this->getParentWriter()->getUseDiskCaching()) {
$objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
} ... | php | {
"resource": ""
} |
q251065 | Rels.writeWorksheetRelationships | validation | public function writeWorksheetRelationships(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pWorksheet, $pWorksheetId = 1, $includeCharts = false)
{
// Create XML writer
$objWriter = null;
if ($this->getParentWriter()->getUseDiskCaching()) {
$objWriter = new XMLWriter(XMLWriter::S... | php | {
"resource": ""
} |
q251066 | Rels.writeDrawingRelationships | validation | public function writeDrawingRelationships(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pWorksheet, &$chartRef, $includeCharts = false)
{
// Create XML writer
$objWriter = null;
if ($this->getParentWriter()->getUseDiskCaching()) {
$objWriter = new XMLWriter(XMLWriter::STORAGE_DI... | php | {
"resource": ""
} |
q251067 | Rels.writeRelationship | validation | private function writeRelationship(XMLWriter $objWriter, $pId, $pType, $pTarget, $pTargetMode = '')
{
if ($pType != '' && $pTarget != '') {
// Write relationship
$objWriter->startElement('Relationship');
$objWriter->writeAttribute('Id', 'rId' . $pId);
$objWrit... | php | {
"resource": ""
} |
q251068 | Protection.setPassword | validation | public function setPassword($pValue, $pAlreadyHashed = false)
{
if (!$pAlreadyHashed) {
$pValue = PasswordHasher::hashPassword($pValue);
}
$this->password = $pValue;
return $this;
} | php | {
"resource": ""
} |
q251069 | AujaRouter.getCreateAssociationName | validation | public function getCreateAssociationName($modelName, $otherModelName) {
return sprintf('auja.%s.%s.create', $this->toUrlName($modelName), $this->toUrlName($otherModelName));
} | php | {
"resource": ""
} |
q251070 | AujaRouter.getAssociationName | validation | public function getAssociationName($modelName, $otherModelName) {
return sprintf('auja.%s.%s', $this->toUrlName($modelName), $this->toUrlName($otherModelName));
} | php | {
"resource": ""
} |
q251071 | AujaRouter.getAssociationMenuName | validation | public function getAssociationMenuName($modelName, $otherModelName) {
return sprintf('auja.%s.%s.menu', $this->toUrlName($modelName), $this->toUrlName($otherModelName));
} | php | {
"resource": ""
} |
q251072 | AujaRouter.resource | validation | public function resource($modelName, $controller) {
if (php_sapi_name() == 'cli') {
/* Don't run when we're running artisan commands. */
return;
}
if (!class_exists($controller)) {
throw new ExpectedAujaControllerException($controller . ' does not exist.');
... | php | {
"resource": ""
} |
q251073 | Security.setRevisionsPassword | validation | public function setRevisionsPassword($pValue, $pAlreadyHashed = false)
{
if (!$pAlreadyHashed) {
$pValue = PasswordHasher::hashPassword($pValue);
}
$this->revisionsPassword = $pValue;
return $this;
} | php | {
"resource": ""
} |
q251074 | Security.setWorkbookPassword | validation | public function setWorkbookPassword($pValue, $pAlreadyHashed = false)
{
if (!$pAlreadyHashed) {
$pValue = PasswordHasher::hashPassword($pValue);
}
$this->workbookPassword = $pValue;
return $this;
} | php | {
"resource": ""
} |
q251075 | Drawing.pixelsToCellDimension | validation | public static function pixelsToCellDimension($pValue, \PhpOffice\PhpSpreadsheet\Style\Font $pDefaultFont)
{
// Font name and size
$name = $pDefaultFont->getName();
$size = $pDefaultFont->getSize();
if (isset(Font::$defaultColumnWidths[$name][$size])) {
// Exact width can... | php | {
"resource": ""
} |
q251076 | Drawing.imagecreatefrombmp | validation | public static function imagecreatefrombmp($p_sFile)
{
// Load the image into a string
$file = fopen($p_sFile, 'rb');
$read = fread($file, 10);
while (!feof($file) && ($read != '')) {
$read .= fread($file, 1024);
}
$temp = unpack('H*', $read);
$... | php | {
"resource": ""
} |
q251077 | BaseReader.openFile | validation | protected function openFile($pFilename)
{
File::assertFile($pFilename);
// Open file
$this->fileHandle = fopen($pFilename, 'r');
if ($this->fileHandle === false) {
throw new Exception('Could not open file ' . $pFilename . ' for reading.');
}
} | php | {
"resource": ""
} |
q251078 | Slim.createSymmetricAuthenticatedJsonRequest | validation | public function createSymmetricAuthenticatedJsonRequest(
string $method,
string $uri,
array $arrayToJsonify,
SharedAuthenticationKey $key,
array $headers = []
): RequestInterface {
if (empty($headers['Content-Type'])) {
$headers['Content-Type'] = 'applicat... | php | {
"resource": ""
} |
q251079 | Slim.createSymmetricAuthenticatedJsonResponse | validation | public function createSymmetricAuthenticatedJsonResponse(
int $status,
array $arrayToJsonify,
SharedAuthenticationKey $key,
array $headers = [],
string $version = '1.1'
): ResponseInterface {
if (empty($headers['Content-Type'])) {
$headers['Content-Type'] ... | php | {
"resource": ""
} |
q251080 | Slim.createSymmetricEncryptedJsonRequest | validation | public function createSymmetricEncryptedJsonRequest(
string $method,
string $uri,
array $arrayToJsonify,
SharedEncryptionKey $key,
array $headers = []
): RequestInterface {
if (empty($headers['Content-Type'])) {
$headers['Content-Type'] = 'application/json... | php | {
"resource": ""
} |
q251081 | Slim.createSymmetricEncryptedJsonResponse | validation | public function createSymmetricEncryptedJsonResponse(
int $status,
array $arrayToJsonify,
SharedEncryptionKey $key,
array $headers = [],
string $version = '1.1'
): ResponseInterface {
if (empty($headers['Content-Type'])) {
$headers['Content-Type'] = 'appli... | php | {
"resource": ""
} |
q251082 | Slim.createSealedJsonRequest | validation | public function createSealedJsonRequest(
string $method,
string $uri,
array $arrayToJsonify,
SealingPublicKey $key,
array $headers = []
): RequestInterface {
if (empty($headers['Content-Type'])) {
$headers['Content-Type'] = 'application/json';
}
... | php | {
"resource": ""
} |
q251083 | Slim.createSealedJsonResponse | validation | public function createSealedJsonResponse(
int $status,
array $arrayToJsonify,
SealingPublicKey $key,
array $headers = [],
string $version = '1.1'
): ResponseInterface {
if (empty($headers['Content-Type'])) {
$headers['Content-Type'] = 'application/json';
... | php | {
"resource": ""
} |
q251084 | Slim.createSignedJsonRequest | validation | public function createSignedJsonRequest(
string $method,
string $uri,
array $arrayToJsonify,
SigningSecretKey $key,
array $headers = []
): RequestInterface {
if (empty($headers['Content-Type'])) {
$headers['Content-Type'] = 'application/json';
}
... | php | {
"resource": ""
} |
q251085 | Slim.createSignedJsonResponse | validation | public function createSignedJsonResponse(
int $status,
array $arrayToJsonify,
SigningSecretKey $key,
array $headers = [],
string $version = '1.1'
): ResponseInterface {
if (empty($headers['Content-Type'])) {
$headers['Content-Type'] = 'application/json';
... | php | {
"resource": ""
} |
q251086 | Slim.createSymmetricEncryptedRequest | validation | public function createSymmetricEncryptedRequest(
string $method,
string $uri,
string $body,
SharedEncryptionKey $key,
array $headers = []
): RequestInterface {
return new Request(
$method,
Uri::createFromString($uri),
new Headers($h... | php | {
"resource": ""
} |
q251087 | Slim.createSealedRequest | validation | public function createSealedRequest(
string $method,
string $uri,
string $body,
SealingPublicKey $key,
array $headers = []
): RequestInterface {
return new Request(
$method,
Uri::createFromString($uri),
new Headers($headers),
... | php | {
"resource": ""
} |
q251088 | Slim.createSealedResponse | validation | public function createSealedResponse(
int $status,
string $body,
SealingPublicKey $key,
array $headers = [],
string $version = '1.1'
): ResponseInterface {
return new Response(
$status,
new Headers($headers),
$this->stringToStream(
... | php | {
"resource": ""
} |
q251089 | Slim.createSignedRequest | validation | public function createSignedRequest(
string $method,
string $uri,
string $body,
SigningSecretKey $key,
array $headers = []
): RequestInterface {
$signature = \ParagonIE_Sodium_Compat::crypto_sign_detached(
$body,
$key->getString(true)
)... | php | {
"resource": ""
} |
q251090 | Slim.createSignedResponse | validation | public function createSignedResponse(
int $status,
string $body,
SigningSecretKey $key,
array $headers = [],
string $version = '1.1'
): ResponseInterface {
$signature = \ParagonIE_Sodium_Compat::crypto_sign_detached(
$body,
$key->getString(true... | php | {
"resource": ""
} |
q251091 | Slim.stringToStream | validation | public function stringToStream(string $input): StreamInterface
{
/** @var resource $stream */
$stream = \fopen('php://temp', 'w+');
if (!\is_resource($stream)) {
throw new \Error('Could not create stream');
}
\fwrite($stream, $input);
\rewind($stream);
... | php | {
"resource": ""
} |
q251092 | PasswordHasher.hashPassword | validation | public static function hashPassword($pPassword)
{
$password = 0x0000;
$charPos = 1; // char position
// split the plain text password in its component characters
$chars = preg_split('//', $pPassword, -1, PREG_SPLIT_NO_EMPTY);
foreach ($chars as $char) {
$value = ... | php | {
"resource": ""
} |
q251093 | Drawing.setPath | validation | public function setPath($pValue, $pVerifyFile = true)
{
if ($pVerifyFile) {
if (file_exists($pValue)) {
$this->path = $pValue;
if ($this->width == 0 && $this->height == 0) {
// Get width/height
list($this->width, $this->hei... | php | {
"resource": ""
} |
q251094 | CacheItem.expiresAt | validation | public function expiresAt($expires)
{
if ($expires instanceof DateTimeInterface) {
$this->expires = $expires;
} else {
$this->expires = null;
}
return $this;
} | php | {
"resource": ""
} |
q251095 | BIFFwriter.append | validation | protected function append($data)
{
if (strlen($data) - 4 > $this->limit) {
$data = $this->addContinue($data);
}
$this->_data .= $data;
$this->_datasize += strlen($data);
} | php | {
"resource": ""
} |
q251096 | BIFFwriter.storeBof | validation | protected function storeBof($type)
{
$record = 0x0809; // Record identifier (BIFF5-BIFF8)
$length = 0x0010;
// by inspection of real files, MS Office Excel 2007 writes the following
$unknown = pack('VV', 0x000100D1, 0x00000406);
$build = 0x0DBB; // Excel 97
$y... | php | {
"resource": ""
} |
q251097 | BIFFwriter.addContinue | validation | private function addContinue($data)
{
$limit = $this->limit;
$record = 0x003C; // Record identifier
// The first 2080/8224 bytes remain intact. However, we have to change
// the length field of the record.
$tmp = substr($data, 0, 2) . pack('v', $limit) . substr($data, 4, $li... | php | {
"resource": ""
} |
q251098 | DataValidator.isValid | validation | public function isValid(Cell $cell)
{
if (!$cell->hasDataValidation()) {
return true;
}
$cellValue = $cell->getValue();
$dataValidation = $cell->getDataValidation();
if (!$dataValidation->getAllowBlank() && ($cellValue === null || $cellValue === '')) {
... | php | {
"resource": ""
} |
q251099 | DataValidator.isValueInList | validation | private function isValueInList(Cell $cell)
{
$cellValue = $cell->getValue();
$dataValidation = $cell->getDataValidation();
$formula1 = $dataValidation->getFormula1();
if (!empty($formula1)) {
// inline values list
if ($formula1[0] === '"') {
r... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.