repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
Setasign/FPDI | src/PdfParser/Type/PdfHexString.php | PdfHexString.parse | public static function parse(StreamReader $streamReader)
{
$bufferOffset = $streamReader->getOffset();
/**
* @var string $buffer
* @var int $pos
*/
while (true) {
$buffer = $streamReader->getBuffer(false);
$pos = \strpos($buffer, '>', $buff... | php | public static function parse(StreamReader $streamReader)
{
$bufferOffset = $streamReader->getOffset();
/**
* @var string $buffer
* @var int $pos
*/
while (true) {
$buffer = $streamReader->getBuffer(false);
$pos = \strpos($buffer, '>', $buff... | [
"public",
"static",
"function",
"parse",
"(",
"StreamReader",
"$",
"streamReader",
")",
"{",
"$",
"bufferOffset",
"=",
"$",
"streamReader",
"->",
"getOffset",
"(",
")",
";",
"/**\n * @var string $buffer\n * @var int $pos\n */",
"while",
"(",
"tru... | Parses a hexadecimal string object from the stream reader.
@param StreamReader $streamReader
@return bool|self | [
"Parses",
"a",
"hexadecimal",
"string",
"object",
"from",
"the",
"stream",
"reader",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/Type/PdfHexString.php#L27-L55 |
Setasign/FPDI | src/PdfParser/Filter/Ascii85.php | Ascii85.decode | public function decode($data)
{
$out = '';
$state = 0;
$chn = null;
$l = \strlen($data);
/** @noinspection ForeachInvariantsInspection */
for ($k = 0; $k < $l; ++$k) {
$ch = \ord($data[$k]) & 0xff;
//Start <~
if ($k === 0 && $ch ... | php | public function decode($data)
{
$out = '';
$state = 0;
$chn = null;
$l = \strlen($data);
/** @noinspection ForeachInvariantsInspection */
for ($k = 0; $k < $l; ++$k) {
$ch = \ord($data[$k]) & 0xff;
//Start <~
if ($k === 0 && $ch ... | [
"public",
"function",
"decode",
"(",
"$",
"data",
")",
"{",
"$",
"out",
"=",
"''",
";",
"$",
"state",
"=",
"0",
";",
"$",
"chn",
"=",
"null",
";",
"$",
"l",
"=",
"\\",
"strlen",
"(",
"$",
"data",
")",
";",
"/** @noinspection ForeachInvariantsInspecti... | Decode ASCII85 encoded string.
@param string $data The input string
@return string
@throws Ascii85Exception | [
"Decode",
"ASCII85",
"encoded",
"string",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/Filter/Ascii85.php#L26-L103 |
Setasign/FPDI | src/PdfParser/Filter/AsciiHex.php | AsciiHex.decode | public function decode($data)
{
$data = \preg_replace('/[^0-9A-Fa-f]/', '', \rtrim($data, '>'));
if ((\strlen($data) % 2) === 1) {
$data .= '0';
}
return \pack('H*', $data);
} | php | public function decode($data)
{
$data = \preg_replace('/[^0-9A-Fa-f]/', '', \rtrim($data, '>'));
if ((\strlen($data) % 2) === 1) {
$data .= '0';
}
return \pack('H*', $data);
} | [
"public",
"function",
"decode",
"(",
"$",
"data",
")",
"{",
"$",
"data",
"=",
"\\",
"preg_replace",
"(",
"'/[^0-9A-Fa-f]/'",
",",
"''",
",",
"\\",
"rtrim",
"(",
"$",
"data",
",",
"'>'",
")",
")",
";",
"if",
"(",
"(",
"\\",
"strlen",
"(",
"$",
"da... | Converts an ASCII hexadecimal encoded string into its binary representation.
@param string $data The input string
@return string | [
"Converts",
"an",
"ASCII",
"hexadecimal",
"encoded",
"string",
"into",
"its",
"binary",
"representation",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/Filter/AsciiHex.php#L25-L33 |
Setasign/FPDI | src/PdfParser/Filter/AsciiHex.php | AsciiHex.encode | public function encode($data, $leaveEOD = false)
{
$t = \unpack('H*', $data);
return \current($t)
. ($leaveEOD ? '' : '>');
} | php | public function encode($data, $leaveEOD = false)
{
$t = \unpack('H*', $data);
return \current($t)
. ($leaveEOD ? '' : '>');
} | [
"public",
"function",
"encode",
"(",
"$",
"data",
",",
"$",
"leaveEOD",
"=",
"false",
")",
"{",
"$",
"t",
"=",
"\\",
"unpack",
"(",
"'H*'",
",",
"$",
"data",
")",
";",
"return",
"\\",
"current",
"(",
"$",
"t",
")",
".",
"(",
"$",
"leaveEOD",
"?... | Converts a string into ASCII hexadecimal representation.
@param string $data The input string
@param boolean $leaveEOD
@return string | [
"Converts",
"a",
"string",
"into",
"ASCII",
"hexadecimal",
"representation",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/Filter/AsciiHex.php#L42-L47 |
Setasign/FPDI | src/PdfParser/Type/PdfString.php | PdfString.parse | public static function parse(StreamReader $streamReader)
{
$pos = $startPos = $streamReader->getOffset();
$openBrackets = 1;
do {
$buffer = $streamReader->getBuffer(false);
for ($length = \strlen($buffer); $openBrackets !== 0 && $pos < $length; $pos++) {
... | php | public static function parse(StreamReader $streamReader)
{
$pos = $startPos = $streamReader->getOffset();
$openBrackets = 1;
do {
$buffer = $streamReader->getBuffer(false);
for ($length = \strlen($buffer); $openBrackets !== 0 && $pos < $length; $pos++) {
... | [
"public",
"static",
"function",
"parse",
"(",
"StreamReader",
"$",
"streamReader",
")",
"{",
"$",
"pos",
"=",
"$",
"startPos",
"=",
"$",
"streamReader",
"->",
"getOffset",
"(",
")",
";",
"$",
"openBrackets",
"=",
"1",
";",
"do",
"{",
"$",
"buffer",
"="... | Parses a string object from the stream reader.
@param StreamReader $streamReader
@return self | [
"Parses",
"a",
"string",
"object",
"from",
"the",
"stream",
"reader",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/Type/PdfString.php#L27-L54 |
Setasign/FPDI | src/PdfParser/Type/PdfString.php | PdfString.unescape | public static function unescape($s)
{
$out = '';
/** @noinspection ForeachInvariantsInspection */
for ($count = 0, $n = \strlen($s); $count < $n; $count++) {
if ($s[$count] !== '\\') {
$out .= $s[$count];
} else {
// A backslash at the ... | php | public static function unescape($s)
{
$out = '';
/** @noinspection ForeachInvariantsInspection */
for ($count = 0, $n = \strlen($s); $count < $n; $count++) {
if ($s[$count] !== '\\') {
$out .= $s[$count];
} else {
// A backslash at the ... | [
"public",
"static",
"function",
"unescape",
"(",
"$",
"s",
")",
"{",
"$",
"out",
"=",
"''",
";",
"/** @noinspection ForeachInvariantsInspection */",
"for",
"(",
"$",
"count",
"=",
"0",
",",
"$",
"n",
"=",
"\\",
"strlen",
"(",
"$",
"s",
")",
";",
"$",
... | Unescapes escaped sequences in a PDF string according to the PDF specification.
@param string $s
@return string | [
"Unescapes",
"escaped",
"sequences",
"in",
"a",
"PDF",
"string",
"according",
"to",
"the",
"PDF",
"specification",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/Type/PdfString.php#L88-L171 |
Setasign/FPDI | src/PdfParser/PdfParser.php | PdfParser.resolveFileHeader | protected function resolveFileHeader()
{
if ($this->fileHeader) {
return $this->fileHeaderOffset;
}
$this->streamReader->reset(0);
$offset = false;
$maxIterations = 1000;
while (true) {
$buffer = $this->streamReader->getBuffer(false);
... | php | protected function resolveFileHeader()
{
if ($this->fileHeader) {
return $this->fileHeaderOffset;
}
$this->streamReader->reset(0);
$offset = false;
$maxIterations = 1000;
while (true) {
$buffer = $this->streamReader->getBuffer(false);
... | [
"protected",
"function",
"resolveFileHeader",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"fileHeader",
")",
"{",
"return",
"$",
"this",
"->",
"fileHeaderOffset",
";",
"}",
"$",
"this",
"->",
"streamReader",
"->",
"reset",
"(",
"0",
")",
";",
"$",
"of... | Resolves the file header.
@throws PdfParserException
@return int | [
"Resolves",
"the",
"file",
"header",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/PdfParser.php#L117-L146 |
Setasign/FPDI | src/PdfParser/PdfParser.php | PdfParser.getCrossReference | public function getCrossReference()
{
if ($this->xref === null) {
$this->xref = new CrossReference($this, $this->resolveFileHeader());
}
return $this->xref;
} | php | public function getCrossReference()
{
if ($this->xref === null) {
$this->xref = new CrossReference($this, $this->resolveFileHeader());
}
return $this->xref;
} | [
"public",
"function",
"getCrossReference",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"xref",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"xref",
"=",
"new",
"CrossReference",
"(",
"$",
"this",
",",
"$",
"this",
"->",
"resolveFileHeader",
"(",
")",
... | Get the cross reference instance.
@return CrossReference
@throws CrossReferenceException
@throws PdfParserException | [
"Get",
"the",
"cross",
"reference",
"instance",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/PdfParser.php#L155-L162 |
Setasign/FPDI | src/PdfParser/PdfParser.php | PdfParser.getPdfVersion | public function getPdfVersion()
{
$this->resolveFileHeader();
if (\preg_match('/%PDF-(\d)\.(\d)/', $this->fileHeader, $result) === 0) {
throw new PdfParserException(
'Unable to extract PDF version from file header.',
PdfParserException::PDF_VERSION_NOT_FO... | php | public function getPdfVersion()
{
$this->resolveFileHeader();
if (\preg_match('/%PDF-(\d)\.(\d)/', $this->fileHeader, $result) === 0) {
throw new PdfParserException(
'Unable to extract PDF version from file header.',
PdfParserException::PDF_VERSION_NOT_FO... | [
"public",
"function",
"getPdfVersion",
"(",
")",
"{",
"$",
"this",
"->",
"resolveFileHeader",
"(",
")",
";",
"if",
"(",
"\\",
"preg_match",
"(",
"'/%PDF-(\\d)\\.(\\d)/'",
",",
"$",
"this",
"->",
"fileHeader",
",",
"$",
"result",
")",
"===",
"0",
")",
"{"... | Get the PDF version.
@return int[] An array of major and minor version.
@throws PdfParserException | [
"Get",
"the",
"PDF",
"version",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/PdfParser.php#L170-L191 |
Setasign/FPDI | src/PdfParser/PdfParser.php | PdfParser.getCatalog | public function getCatalog()
{
$xref = $this->getCrossReference();
$trailer = $xref->getTrailer();
$catalog = PdfType::resolve(PdfDictionary::get($trailer, 'Root'), $this);
return PdfDictionary::ensure($catalog);
} | php | public function getCatalog()
{
$xref = $this->getCrossReference();
$trailer = $xref->getTrailer();
$catalog = PdfType::resolve(PdfDictionary::get($trailer, 'Root'), $this);
return PdfDictionary::ensure($catalog);
} | [
"public",
"function",
"getCatalog",
"(",
")",
"{",
"$",
"xref",
"=",
"$",
"this",
"->",
"getCrossReference",
"(",
")",
";",
"$",
"trailer",
"=",
"$",
"xref",
"->",
"getTrailer",
"(",
")",
";",
"$",
"catalog",
"=",
"PdfType",
"::",
"resolve",
"(",
"Pd... | Get the catalog dictionary.
@return PdfDictionary
@throws Type\PdfTypeException
@throws CrossReferenceException
@throws PdfParserException | [
"Get",
"the",
"catalog",
"dictionary",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/PdfParser.php#L201-L209 |
Setasign/FPDI | src/PdfParser/PdfParser.php | PdfParser.getIndirectObject | public function getIndirectObject($objectNumber, $cache = false)
{
$objectNumber = (int) $objectNumber;
if (isset($this->objects[$objectNumber])) {
return $this->objects[$objectNumber];
}
$xref = $this->getCrossReference();
$object = $xref->getIndirectObject($obj... | php | public function getIndirectObject($objectNumber, $cache = false)
{
$objectNumber = (int) $objectNumber;
if (isset($this->objects[$objectNumber])) {
return $this->objects[$objectNumber];
}
$xref = $this->getCrossReference();
$object = $xref->getIndirectObject($obj... | [
"public",
"function",
"getIndirectObject",
"(",
"$",
"objectNumber",
",",
"$",
"cache",
"=",
"false",
")",
"{",
"$",
"objectNumber",
"=",
"(",
"int",
")",
"$",
"objectNumber",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"objects",
"[",
"$",
"objec... | Get an indirect object by its object number.
@param int $objectNumber
@param bool $cache
@return PdfIndirectObject
@throws CrossReferenceException
@throws PdfParserException | [
"Get",
"an",
"indirect",
"object",
"by",
"its",
"object",
"number",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/PdfParser.php#L220-L235 |
Setasign/FPDI | src/PdfParser/PdfParser.php | PdfParser.readValue | public function readValue($token = null, $expectedType = null)
{
if ($token === null) {
$token = $this->tokenizer->getNextToken();
}
if ($token === false) {
if ($expectedType !== null) {
throw new Type\PdfTypeException('Got unexpected token type.', Ty... | php | public function readValue($token = null, $expectedType = null)
{
if ($token === null) {
$token = $this->tokenizer->getNextToken();
}
if ($token === false) {
if ($expectedType !== null) {
throw new Type\PdfTypeException('Got unexpected token type.', Ty... | [
"public",
"function",
"readValue",
"(",
"$",
"token",
"=",
"null",
",",
"$",
"expectedType",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"token",
"===",
"null",
")",
"{",
"$",
"token",
"=",
"$",
"this",
"->",
"tokenizer",
"->",
"getNextToken",
"(",
")",
... | Read a PDF value.
@param null|bool|string $token
@param null|string $expectedType
@return bool|PdfArray|PdfBoolean|PdfHexString|PdfName|PdfNull|PdfNumeric|PdfString|PdfToken|PdfIndirectObjectReference
@throws Type\PdfTypeException | [
"Read",
"a",
"PDF",
"value",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/PdfParser.php#L245-L349 |
Setasign/FPDI | src/PdfParser/PdfParser.php | PdfParser.ensureExpectedType | private function ensureExpectedType($token, $expectedType)
{
static $mapping = [
'(' => PdfString::class,
'<' => PdfHexString::class,
'<<' => PdfDictionary::class,
'/' => PdfName::class,
'[' => PdfArray::class,
'true' => PdfBoolean::cla... | php | private function ensureExpectedType($token, $expectedType)
{
static $mapping = [
'(' => PdfString::class,
'<' => PdfHexString::class,
'<<' => PdfDictionary::class,
'/' => PdfName::class,
'[' => PdfArray::class,
'true' => PdfBoolean::cla... | [
"private",
"function",
"ensureExpectedType",
"(",
"$",
"token",
",",
"$",
"expectedType",
")",
"{",
"static",
"$",
"mapping",
"=",
"[",
"'('",
"=>",
"PdfString",
"::",
"class",
",",
"'<'",
"=>",
"PdfHexString",
"::",
"class",
",",
"'<<'",
"=>",
"PdfDiction... | Ensures that the token will evaluate to an expected object type (or not).
@param string $token
@param string|null $expectedType
@return bool
@throws Type\PdfTypeException | [
"Ensures",
"that",
"the",
"token",
"will",
"evaluate",
"to",
"an",
"expected",
"object",
"type",
"(",
"or",
"not",
")",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/PdfParser.php#L359-L377 |
Setasign/FPDI | src/PdfParser/StreamReader.php | StreamReader.createByString | public static function createByString($content, $maxMemory = 2097152)
{
$h = \fopen('php://temp/maxmemory:' . ((int) $maxMemory), 'r+b');
\fwrite($h, $content);
\rewind($h);
return new self($h, true);
} | php | public static function createByString($content, $maxMemory = 2097152)
{
$h = \fopen('php://temp/maxmemory:' . ((int) $maxMemory), 'r+b');
\fwrite($h, $content);
\rewind($h);
return new self($h, true);
} | [
"public",
"static",
"function",
"createByString",
"(",
"$",
"content",
",",
"$",
"maxMemory",
"=",
"2097152",
")",
"{",
"$",
"h",
"=",
"\\",
"fopen",
"(",
"'php://temp/maxmemory:'",
".",
"(",
"(",
"int",
")",
"$",
"maxMemory",
")",
",",
"'r+b'",
")",
"... | Creates a stream reader instance by a string value.
@param string $content
@param int $maxMemory
@return StreamReader | [
"Creates",
"a",
"stream",
"reader",
"instance",
"by",
"a",
"string",
"value",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/StreamReader.php#L26-L33 |
Setasign/FPDI | src/PdfParser/StreamReader.php | StreamReader.getBufferLength | public function getBufferLength($atOffset = false)
{
if ($atOffset === false) {
return $this->bufferLength;
}
return $this->bufferLength - $this->offset;
} | php | public function getBufferLength($atOffset = false)
{
if ($atOffset === false) {
return $this->bufferLength;
}
return $this->bufferLength - $this->offset;
} | [
"public",
"function",
"getBufferLength",
"(",
"$",
"atOffset",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"atOffset",
"===",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"bufferLength",
";",
"}",
"return",
"$",
"this",
"->",
"bufferLength",
"-",
"$",
"... | Returns the byte length of the buffer.
@param bool $atOffset
@return int | [
"Returns",
"the",
"byte",
"length",
"of",
"the",
"buffer",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/StreamReader.php#L146-L153 |
Setasign/FPDI | src/PdfParser/StreamReader.php | StreamReader.getBuffer | public function getBuffer($atOffset = true)
{
if ($atOffset === false) {
return $this->buffer;
}
$string = \substr($this->buffer, $this->offset);
return (string) $string;
} | php | public function getBuffer($atOffset = true)
{
if ($atOffset === false) {
return $this->buffer;
}
$string = \substr($this->buffer, $this->offset);
return (string) $string;
} | [
"public",
"function",
"getBuffer",
"(",
"$",
"atOffset",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"atOffset",
"===",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"buffer",
";",
"}",
"$",
"string",
"=",
"\\",
"substr",
"(",
"$",
"this",
"->",
"buff... | Returns the current buffer.
@param bool $atOffset
@return string | [
"Returns",
"the",
"current",
"buffer",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/StreamReader.php#L171-L180 |
Setasign/FPDI | src/PdfParser/StreamReader.php | StreamReader.getByte | public function getByte($position = null)
{
$position = (int) ($position !== null ? $position : $this->offset);
if ($position >= $this->bufferLength &&
(!$this->increaseLength() || $position >= $this->bufferLength)
) {
return false;
}
return $this->bu... | php | public function getByte($position = null)
{
$position = (int) ($position !== null ? $position : $this->offset);
if ($position >= $this->bufferLength &&
(!$this->increaseLength() || $position >= $this->bufferLength)
) {
return false;
}
return $this->bu... | [
"public",
"function",
"getByte",
"(",
"$",
"position",
"=",
"null",
")",
"{",
"$",
"position",
"=",
"(",
"int",
")",
"(",
"$",
"position",
"!==",
"null",
"?",
"$",
"position",
":",
"$",
"this",
"->",
"offset",
")",
";",
"if",
"(",
"$",
"position",
... | Gets a byte at a specific position in the buffer.
If the position is invalid the method will return false.
If the $position parameter is set to null the value of $this->offset will be used.
@param int|null $position
@return string|bool | [
"Gets",
"a",
"byte",
"at",
"a",
"specific",
"position",
"in",
"the",
"buffer",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/StreamReader.php#L192-L202 |
Setasign/FPDI | src/PdfParser/StreamReader.php | StreamReader.readByte | public function readByte($position = null)
{
if ($position !== null) {
$position = (int) $position;
// check if needed bytes are available in the current buffer
if (!($position >= $this->position && $position < $this->position + $this->bufferLength)) {
$th... | php | public function readByte($position = null)
{
if ($position !== null) {
$position = (int) $position;
// check if needed bytes are available in the current buffer
if (!($position >= $this->position && $position < $this->position + $this->bufferLength)) {
$th... | [
"public",
"function",
"readByte",
"(",
"$",
"position",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"position",
"!==",
"null",
")",
"{",
"$",
"position",
"=",
"(",
"int",
")",
"$",
"position",
";",
"// check if needed bytes are available in the current buffer",
"if... | Returns a byte at a specific position, and set the offset to the next byte position.
If the position is invalid the method will return false.
If the $position parameter is set to null the value of $this->offset will be used.
@param int|null $position
@return string|bool | [
"Returns",
"a",
"byte",
"at",
"a",
"specific",
"position",
"and",
"set",
"the",
"offset",
"to",
"the",
"next",
"byte",
"position",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/StreamReader.php#L214-L237 |
Setasign/FPDI | src/PdfParser/StreamReader.php | StreamReader.readBytes | public function readBytes($length, $position = null)
{
$length = (int) $length;
if ($position !== null) {
// check if needed bytes are available in the current buffer
if (!($position >= $this->position && $position < $this->position + $this->bufferLength)) {
$... | php | public function readBytes($length, $position = null)
{
$length = (int) $length;
if ($position !== null) {
// check if needed bytes are available in the current buffer
if (!($position >= $this->position && $position < $this->position + $this->bufferLength)) {
$... | [
"public",
"function",
"readBytes",
"(",
"$",
"length",
",",
"$",
"position",
"=",
"null",
")",
"{",
"$",
"length",
"=",
"(",
"int",
")",
"$",
"length",
";",
"if",
"(",
"$",
"position",
"!==",
"null",
")",
"{",
"// check if needed bytes are available in the... | Read bytes from the current or a specific offset position and set the internal pointer to the next byte.
If the position is invalid the method will return false.
If the $position parameter is set to null the value of $this->offset will be used.
@param int $length
@param int|null $position
@return string | [
"Read",
"bytes",
"from",
"the",
"current",
"or",
"a",
"specific",
"offset",
"position",
"and",
"set",
"the",
"internal",
"pointer",
"to",
"the",
"next",
"byte",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/StreamReader.php#L250-L275 |
Setasign/FPDI | src/PdfParser/StreamReader.php | StreamReader.readLine | public function readLine($length = 1024)
{
if ($this->ensureContent() === false) {
return false;
}
$line = '';
while ($this->ensureContent()) {
$char = $this->readByte();
if ($char === "\n") {
break;
}
if ... | php | public function readLine($length = 1024)
{
if ($this->ensureContent() === false) {
return false;
}
$line = '';
while ($this->ensureContent()) {
$char = $this->readByte();
if ($char === "\n") {
break;
}
if ... | [
"public",
"function",
"readLine",
"(",
"$",
"length",
"=",
"1024",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"ensureContent",
"(",
")",
"===",
"false",
")",
"{",
"return",
"false",
";",
"}",
"$",
"line",
"=",
"''",
";",
"while",
"(",
"$",
"this",
"... | Read a line from the current position.
@param int $length
@return string|bool | [
"Read",
"a",
"line",
"from",
"the",
"current",
"position",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/StreamReader.php#L283-L312 |
Setasign/FPDI | src/PdfParser/StreamReader.php | StreamReader.setOffset | public function setOffset($offset)
{
if ($offset > $this->bufferLength || $offset < 0) {
throw new \OutOfRangeException(
\sprintf('Offset (%s) out of range (length: %s)', $offset, $this->bufferLength)
);
}
$this->offset = (int) $offset;
} | php | public function setOffset($offset)
{
if ($offset > $this->bufferLength || $offset < 0) {
throw new \OutOfRangeException(
\sprintf('Offset (%s) out of range (length: %s)', $offset, $this->bufferLength)
);
}
$this->offset = (int) $offset;
} | [
"public",
"function",
"setOffset",
"(",
"$",
"offset",
")",
"{",
"if",
"(",
"$",
"offset",
">",
"$",
"this",
"->",
"bufferLength",
"||",
"$",
"offset",
"<",
"0",
")",
"{",
"throw",
"new",
"\\",
"OutOfRangeException",
"(",
"\\",
"sprintf",
"(",
"'Offset... | Set the offset position in the current buffer.
@param int $offset | [
"Set",
"the",
"offset",
"position",
"in",
"the",
"current",
"buffer",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/StreamReader.php#L319-L328 |
Setasign/FPDI | src/PdfParser/StreamReader.php | StreamReader.getTotalLength | public function getTotalLength()
{
if ($this->totalLength === null) {
$stat = \fstat($this->stream);
$this->totalLength = $stat['size'];
}
return $this->totalLength;
} | php | public function getTotalLength()
{
if ($this->totalLength === null) {
$stat = \fstat($this->stream);
$this->totalLength = $stat['size'];
}
return $this->totalLength;
} | [
"public",
"function",
"getTotalLength",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"totalLength",
"===",
"null",
")",
"{",
"$",
"stat",
"=",
"\\",
"fstat",
"(",
"$",
"this",
"->",
"stream",
")",
";",
"$",
"this",
"->",
"totalLength",
"=",
"$",
"s... | Gets the total available length.
@return int | [
"Gets",
"the",
"total",
"available",
"length",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/StreamReader.php#L380-L388 |
Setasign/FPDI | src/PdfParser/StreamReader.php | StreamReader.reset | public function reset($pos = 0, $length = 200)
{
if ($pos === null) {
$pos = $this->position + $this->offset;
} elseif ($pos < 0) {
$pos = \max(0, $this->getTotalLength() + $pos);
}
\fseek($this->stream, $pos);
$this->position = $pos;
$this->... | php | public function reset($pos = 0, $length = 200)
{
if ($pos === null) {
$pos = $this->position + $this->offset;
} elseif ($pos < 0) {
$pos = \max(0, $this->getTotalLength() + $pos);
}
\fseek($this->stream, $pos);
$this->position = $pos;
$this->... | [
"public",
"function",
"reset",
"(",
"$",
"pos",
"=",
"0",
",",
"$",
"length",
"=",
"200",
")",
"{",
"if",
"(",
"$",
"pos",
"===",
"null",
")",
"{",
"$",
"pos",
"=",
"$",
"this",
"->",
"position",
"+",
"$",
"this",
"->",
"offset",
";",
"}",
"e... | Resets the buffer to a position and re-read the buffer with the given length.
If the $pos parameter is negative the start buffer position will be the $pos'th position from
the end of the file.
If the $pos parameter is negative and the absolute value is bigger then the totalLength of
the file $pos will set to zero.
@... | [
"Resets",
"the",
"buffer",
"to",
"a",
"position",
"and",
"re",
"-",
"read",
"the",
"buffer",
"with",
"the",
"given",
"length",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/StreamReader.php#L402-L425 |
Setasign/FPDI | src/PdfParser/StreamReader.php | StreamReader.ensure | public function ensure($pos, $length)
{
if ($pos >= $this->position
&& $pos < ($this->position + $this->bufferLength)
&& ($this->position + $this->bufferLength) >= ($pos + $length)
) {
$this->offset = $pos - $this->position;
} else {
$this->res... | php | public function ensure($pos, $length)
{
if ($pos >= $this->position
&& $pos < ($this->position + $this->bufferLength)
&& ($this->position + $this->bufferLength) >= ($pos + $length)
) {
$this->offset = $pos - $this->position;
} else {
$this->res... | [
"public",
"function",
"ensure",
"(",
"$",
"pos",
",",
"$",
"length",
")",
"{",
"if",
"(",
"$",
"pos",
">=",
"$",
"this",
"->",
"position",
"&&",
"$",
"pos",
"<",
"(",
"$",
"this",
"->",
"position",
"+",
"$",
"this",
"->",
"bufferLength",
")",
"&&... | Ensures bytes in the buffer with a specific length and location in the file.
@param int $pos
@param int $length
@see reset() | [
"Ensures",
"bytes",
"in",
"the",
"buffer",
"with",
"a",
"specific",
"length",
"and",
"location",
"in",
"the",
"file",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/StreamReader.php#L434-L444 |
Setasign/FPDI | src/PdfParser/StreamReader.php | StreamReader.increaseLength | public function increaseLength($minLength = 100)
{
$length = \max($minLength, 100);
if (\feof($this->stream) || $this->getTotalLength() === $this->position + $this->bufferLength) {
return false;
}
$newLength = $this->bufferLength + $length;
do {
$thi... | php | public function increaseLength($minLength = 100)
{
$length = \max($minLength, 100);
if (\feof($this->stream) || $this->getTotalLength() === $this->position + $this->bufferLength) {
return false;
}
$newLength = $this->bufferLength + $length;
do {
$thi... | [
"public",
"function",
"increaseLength",
"(",
"$",
"minLength",
"=",
"100",
")",
"{",
"$",
"length",
"=",
"\\",
"max",
"(",
"$",
"minLength",
",",
"100",
")",
";",
"if",
"(",
"\\",
"feof",
"(",
"$",
"this",
"->",
"stream",
")",
"||",
"$",
"this",
... | Forcefully read more data into the buffer.
@param int $minLength
@return bool Returns false if the stream reaches the end | [
"Forcefully",
"read",
"more",
"data",
"into",
"the",
"buffer",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/StreamReader.php#L452-L467 |
Setasign/FPDI | src/PdfParser/Type/PdfIndirectObject.php | PdfIndirectObject.parse | public static function parse(
$objectNumberToken,
$objectGenerationNumberToken,
PdfParser $parser,
Tokenizer $tokenizer,
StreamReader $reader
) {
$value = $parser->readValue();
if ($value === false) {
return false;
}
$nextToken = $... | php | public static function parse(
$objectNumberToken,
$objectGenerationNumberToken,
PdfParser $parser,
Tokenizer $tokenizer,
StreamReader $reader
) {
$value = $parser->readValue();
if ($value === false) {
return false;
}
$nextToken = $... | [
"public",
"static",
"function",
"parse",
"(",
"$",
"objectNumberToken",
",",
"$",
"objectGenerationNumberToken",
",",
"PdfParser",
"$",
"parser",
",",
"Tokenizer",
"$",
"tokenizer",
",",
"StreamReader",
"$",
"reader",
")",
"{",
"$",
"value",
"=",
"$",
"parser"... | Parses an indirect object from a tokenizer, parser and stream-reader.
@param int $objectNumberToken
@param int $objectGenerationNumberToken
@param PdfParser $parser
@param Tokenizer $tokenizer
@param StreamReader $reader
@return bool|self
@throws PdfTypeException | [
"Parses",
"an",
"indirect",
"object",
"from",
"a",
"tokenizer",
"parser",
"and",
"stream",
"-",
"reader",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/Type/PdfIndirectObject.php#L34-L59 |
Setasign/FPDI | src/PdfParser/Type/PdfIndirectObject.php | PdfIndirectObject.create | public static function create($objectNumber, $generationNumber, PdfType $value)
{
$v = new self;
$v->objectNumber = (int) $objectNumber;
$v->generationNumber = (int) $generationNumber;
$v->value = $value;
return $v;
} | php | public static function create($objectNumber, $generationNumber, PdfType $value)
{
$v = new self;
$v->objectNumber = (int) $objectNumber;
$v->generationNumber = (int) $generationNumber;
$v->value = $value;
return $v;
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"objectNumber",
",",
"$",
"generationNumber",
",",
"PdfType",
"$",
"value",
")",
"{",
"$",
"v",
"=",
"new",
"self",
";",
"$",
"v",
"->",
"objectNumber",
"=",
"(",
"int",
")",
"$",
"objectNumber",
";",... | Helper method to create an instance.
@param int $objectNumber
@param int $generationNumber
@param PdfType $value
@return self | [
"Helper",
"method",
"to",
"create",
"an",
"instance",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/Type/PdfIndirectObject.php#L69-L77 |
Setasign/FPDI | src/PdfParser/Tokenizer.php | Tokenizer.getNextToken | public function getNextToken()
{
$token = \array_pop($this->stack);
if ($token !== null) {
return $token;
}
if (($byte = $this->streamReader->readByte()) === false) {
return false;
}
if ($byte === "\x20" ||
$byte === "\x0A" ||
... | php | public function getNextToken()
{
$token = \array_pop($this->stack);
if ($token !== null) {
return $token;
}
if (($byte = $this->streamReader->readByte()) === false) {
return false;
}
if ($byte === "\x20" ||
$byte === "\x0A" ||
... | [
"public",
"function",
"getNextToken",
"(",
")",
"{",
"$",
"token",
"=",
"\\",
"array_pop",
"(",
"$",
"this",
"->",
"stack",
")",
";",
"if",
"(",
"$",
"token",
"!==",
"null",
")",
"{",
"return",
"$",
"token",
";",
"}",
"if",
"(",
"(",
"$",
"byte",... | Get next token.
@return bool|string | [
"Get",
"next",
"token",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/Tokenizer.php#L74-L138 |
Setasign/FPDI | src/PdfParser/Tokenizer.php | Tokenizer.leapWhiteSpaces | public function leapWhiteSpaces()
{
do {
if (!$this->streamReader->ensureContent()) {
return false;
}
$buffer = $this->streamReader->getBuffer(false);
$matches = \strspn($buffer, "\x20\x0A\x0C\x0D\x09\x00", $this->streamReader->getOffset());
... | php | public function leapWhiteSpaces()
{
do {
if (!$this->streamReader->ensureContent()) {
return false;
}
$buffer = $this->streamReader->getBuffer(false);
$matches = \strspn($buffer, "\x20\x0A\x0C\x0D\x09\x00", $this->streamReader->getOffset());
... | [
"public",
"function",
"leapWhiteSpaces",
"(",
")",
"{",
"do",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"streamReader",
"->",
"ensureContent",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"buffer",
"=",
"$",
"this",
"->",
"streamReader",
"->",
... | Leap white spaces.
@return boolean | [
"Leap",
"white",
"spaces",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/Tokenizer.php#L145-L160 |
Setasign/FPDI | src/PdfParser/Filter/Lzw.php | Lzw.decode | public function decode($data)
{
if ($data[0] === "\x00" && $data[1] === "\x01") {
throw new LzwException(
'LZW flavour not supported.',
LzwException::LZW_FLAVOUR_NOT_SUPPORTED
);
}
$this->initsTable();
$this->data = $data;
... | php | public function decode($data)
{
if ($data[0] === "\x00" && $data[1] === "\x01") {
throw new LzwException(
'LZW flavour not supported.',
LzwException::LZW_FLAVOUR_NOT_SUPPORTED
);
}
$this->initsTable();
$this->data = $data;
... | [
"public",
"function",
"decode",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"data",
"[",
"0",
"]",
"===",
"\"\\x00\"",
"&&",
"$",
"data",
"[",
"1",
"]",
"===",
"\"\\x01\"",
")",
"{",
"throw",
"new",
"LzwException",
"(",
"'LZW flavour not supported.'",
... | Method to decode LZW compressed data.
@param string $data The compressed data
@return string The uncompressed data
@throws LzwException | [
"Method",
"to",
"decode",
"LZW",
"compressed",
"data",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/Filter/Lzw.php#L71-L126 |
Setasign/FPDI | src/PdfParser/Filter/Lzw.php | Lzw.initsTable | protected function initsTable()
{
$this->sTable = [];
for ($i = 0; $i < 256; $i++) {
$this->sTable[$i] = \chr($i);
}
$this->tIdx = 258;
$this->bitsToGet = 9;
} | php | protected function initsTable()
{
$this->sTable = [];
for ($i = 0; $i < 256; $i++) {
$this->sTable[$i] = \chr($i);
}
$this->tIdx = 258;
$this->bitsToGet = 9;
} | [
"protected",
"function",
"initsTable",
"(",
")",
"{",
"$",
"this",
"->",
"sTable",
"=",
"[",
"]",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"256",
";",
"$",
"i",
"++",
")",
"{",
"$",
"this",
"->",
"sTable",
"[",
"$",
"i",
"]"... | Initialize the string table. | [
"Initialize",
"the",
"string",
"table",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/Filter/Lzw.php#L131-L141 |
Setasign/FPDI | src/PdfParser/Filter/Lzw.php | Lzw.addStringToTable | protected function addStringToTable($oldString, $newString = '')
{
$string = $oldString . $newString;
// Add this new String to the table
$this->sTable[$this->tIdx++] = $string;
if ($this->tIdx === 511) {
$this->bitsToGet = 10;
} elseif ($this->tIdx === 1023) {
... | php | protected function addStringToTable($oldString, $newString = '')
{
$string = $oldString . $newString;
// Add this new String to the table
$this->sTable[$this->tIdx++] = $string;
if ($this->tIdx === 511) {
$this->bitsToGet = 10;
} elseif ($this->tIdx === 1023) {
... | [
"protected",
"function",
"addStringToTable",
"(",
"$",
"oldString",
",",
"$",
"newString",
"=",
"''",
")",
"{",
"$",
"string",
"=",
"$",
"oldString",
".",
"$",
"newString",
";",
"// Add this new String to the table",
"$",
"this",
"->",
"sTable",
"[",
"$",
"t... | Add a new string to the string table.
@param string $oldString
@param string $newString | [
"Add",
"a",
"new",
"string",
"to",
"the",
"string",
"table",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/Filter/Lzw.php#L149-L163 |
Setasign/FPDI | src/PdfParser/Filter/Lzw.php | Lzw.getNextCode | protected function getNextCode()
{
if ($this->bytePointer === $this->dataLength) {
return 257;
}
$this->nextData = ($this->nextData << 8) | (\ord($this->data[$this->bytePointer++]) & 0xff);
$this->nextBits += 8;
if ($this->nextBits < $this->bitsToGet) {
... | php | protected function getNextCode()
{
if ($this->bytePointer === $this->dataLength) {
return 257;
}
$this->nextData = ($this->nextData << 8) | (\ord($this->data[$this->bytePointer++]) & 0xff);
$this->nextBits += 8;
if ($this->nextBits < $this->bitsToGet) {
... | [
"protected",
"function",
"getNextCode",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"bytePointer",
"===",
"$",
"this",
"->",
"dataLength",
")",
"{",
"return",
"257",
";",
"}",
"$",
"this",
"->",
"nextData",
"=",
"(",
"$",
"this",
"->",
"nextData",
"... | Returns the next 9, 10, 11 or 12 bits.
@return integer | [
"Returns",
"the",
"next",
"9",
"10",
"11",
"or",
"12",
"bits",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/Filter/Lzw.php#L170-L188 |
Setasign/FPDI | src/PdfReader/Page.php | Page.getPageDictionary | public function getPageDictionary()
{
if (null === $this->pageDictionary) {
$this->pageDictionary = PdfDictionary::ensure(PdfType::resolve($this->getPageObject(), $this->parser));
}
return $this->pageDictionary;
} | php | public function getPageDictionary()
{
if (null === $this->pageDictionary) {
$this->pageDictionary = PdfDictionary::ensure(PdfType::resolve($this->getPageObject(), $this->parser));
}
return $this->pageDictionary;
} | [
"public",
"function",
"getPageDictionary",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"pageDictionary",
")",
"{",
"$",
"this",
"->",
"pageDictionary",
"=",
"PdfDictionary",
"::",
"ensure",
"(",
"PdfType",
"::",
"resolve",
"(",
"$",
"this",... | Get the dictionary of this page.
@return PdfDictionary
@throws PdfParserException
@throws PdfTypeException
@throws CrossReferenceException | [
"Get",
"the",
"dictionary",
"of",
"this",
"page",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfReader/Page.php#L85-L92 |
Setasign/FPDI | src/PdfReader/Page.php | Page.getAttribute | public function getAttribute($name, $inherited = true)
{
$dict = $this->getPageDictionary();
if (isset($dict->value[$name])) {
return $dict->value[$name];
}
$inheritedKeys = ['Resources', 'MediaBox', 'CropBox', 'Rotate'];
if ($inherited && \in_array($name, $inhe... | php | public function getAttribute($name, $inherited = true)
{
$dict = $this->getPageDictionary();
if (isset($dict->value[$name])) {
return $dict->value[$name];
}
$inheritedKeys = ['Resources', 'MediaBox', 'CropBox', 'Rotate'];
if ($inherited && \in_array($name, $inhe... | [
"public",
"function",
"getAttribute",
"(",
"$",
"name",
",",
"$",
"inherited",
"=",
"true",
")",
"{",
"$",
"dict",
"=",
"$",
"this",
"->",
"getPageDictionary",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"dict",
"->",
"value",
"[",
"$",
"name",
"]... | Get a page attribute.
@param string $name
@param bool $inherited
@return PdfType|null
@throws PdfParserException
@throws PdfTypeException
@throws CrossReferenceException | [
"Get",
"a",
"page",
"attribute",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfReader/Page.php#L104-L146 |
Setasign/FPDI | src/PdfReader/Page.php | Page.getRotation | public function getRotation()
{
$rotation = $this->getAttribute('Rotate');
if (null === $rotation) {
return 0;
}
$rotation = PdfNumeric::ensure(PdfType::resolve($rotation, $this->parser))->value % 360;
if ($rotation < 0) {
$rotation += 360;
}... | php | public function getRotation()
{
$rotation = $this->getAttribute('Rotate');
if (null === $rotation) {
return 0;
}
$rotation = PdfNumeric::ensure(PdfType::resolve($rotation, $this->parser))->value % 360;
if ($rotation < 0) {
$rotation += 360;
}... | [
"public",
"function",
"getRotation",
"(",
")",
"{",
"$",
"rotation",
"=",
"$",
"this",
"->",
"getAttribute",
"(",
"'Rotate'",
")",
";",
"if",
"(",
"null",
"===",
"$",
"rotation",
")",
"{",
"return",
"0",
";",
"}",
"$",
"rotation",
"=",
"PdfNumeric",
... | Get the rotation value.
@return int
@throws PdfParserException
@throws PdfTypeException
@throws CrossReferenceException | [
"Get",
"the",
"rotation",
"value",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfReader/Page.php#L156-L170 |
Setasign/FPDI | src/PdfReader/Page.php | Page.getBoundary | public function getBoundary($box = PageBoundaries::CROP_BOX, $fallback = true)
{
$value = $this->getAttribute($box);
if ($value !== null) {
return Rectangle::byPdfArray($value, $this->parser);
}
if ($fallback === false) {
return false;
}
swi... | php | public function getBoundary($box = PageBoundaries::CROP_BOX, $fallback = true)
{
$value = $this->getAttribute($box);
if ($value !== null) {
return Rectangle::byPdfArray($value, $this->parser);
}
if ($fallback === false) {
return false;
}
swi... | [
"public",
"function",
"getBoundary",
"(",
"$",
"box",
"=",
"PageBoundaries",
"::",
"CROP_BOX",
",",
"$",
"fallback",
"=",
"true",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"getAttribute",
"(",
"$",
"box",
")",
";",
"if",
"(",
"$",
"value",
"!==... | Get a boundary of this page.
@param string $box
@param bool $fallback
@return bool|Rectangle
@throws PdfParserException
@throws PdfTypeException
@throws CrossReferenceException
@see PageBoundaries | [
"Get",
"a",
"boundary",
"of",
"this",
"page",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfReader/Page.php#L183-L205 |
Setasign/FPDI | src/PdfReader/Page.php | Page.getWidthAndHeight | public function getWidthAndHeight($box = PageBoundaries::CROP_BOX, $fallback = true)
{
$boundary = $this->getBoundary($box, $fallback);
if ($boundary === false) {
return false;
}
$rotation = $this->getRotation();
$interchange = ($rotation / 90) % 2;
retu... | php | public function getWidthAndHeight($box = PageBoundaries::CROP_BOX, $fallback = true)
{
$boundary = $this->getBoundary($box, $fallback);
if ($boundary === false) {
return false;
}
$rotation = $this->getRotation();
$interchange = ($rotation / 90) % 2;
retu... | [
"public",
"function",
"getWidthAndHeight",
"(",
"$",
"box",
"=",
"PageBoundaries",
"::",
"CROP_BOX",
",",
"$",
"fallback",
"=",
"true",
")",
"{",
"$",
"boundary",
"=",
"$",
"this",
"->",
"getBoundary",
"(",
"$",
"box",
",",
"$",
"fallback",
")",
";",
"... | Get the width and height of this page.
@param string $box
@param bool $fallback
@return array|bool
@throws PdfParserException
@throws PdfTypeException
@throws CrossReferenceException | [
"Get",
"the",
"width",
"and",
"height",
"of",
"this",
"page",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfReader/Page.php#L217-L231 |
Setasign/FPDI | src/PdfReader/Page.php | Page.getContentStream | public function getContentStream()
{
$dict = $this->getPageDictionary();
$contents = PdfType::resolve(PdfDictionary::get($dict, 'Contents'), $this->parser);
if ($contents instanceof PdfNull) {
return '';
}
if ($contents instanceof PdfArray) {
$result ... | php | public function getContentStream()
{
$dict = $this->getPageDictionary();
$contents = PdfType::resolve(PdfDictionary::get($dict, 'Contents'), $this->parser);
if ($contents instanceof PdfNull) {
return '';
}
if ($contents instanceof PdfArray) {
$result ... | [
"public",
"function",
"getContentStream",
"(",
")",
"{",
"$",
"dict",
"=",
"$",
"this",
"->",
"getPageDictionary",
"(",
")",
";",
"$",
"contents",
"=",
"PdfType",
"::",
"resolve",
"(",
"PdfDictionary",
"::",
"get",
"(",
"$",
"dict",
",",
"'Contents'",
")... | Get the raw content stream.
@return string
@throws PdfReaderException
@throws PdfTypeException
@throws FilterException
@throws PdfParserException | [
"Get",
"the",
"raw",
"content",
"stream",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfReader/Page.php#L242-L271 |
Setasign/FPDI | src/PdfParser/Type/PdfType.php | PdfType.resolve | public static function resolve(PdfType $value, PdfParser $parser, $stopAtIndirectObject = false)
{
if ($value instanceof PdfIndirectObject) {
if ($stopAtIndirectObject === true) {
return $value;
}
return self::resolve($value->value, $parser, $stopAtIndire... | php | public static function resolve(PdfType $value, PdfParser $parser, $stopAtIndirectObject = false)
{
if ($value instanceof PdfIndirectObject) {
if ($stopAtIndirectObject === true) {
return $value;
}
return self::resolve($value->value, $parser, $stopAtIndire... | [
"public",
"static",
"function",
"resolve",
"(",
"PdfType",
"$",
"value",
",",
"PdfParser",
"$",
"parser",
",",
"$",
"stopAtIndirectObject",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"value",
"instanceof",
"PdfIndirectObject",
")",
"{",
"if",
"(",
"$",
"stopA... | Resolves a PdfType value to its value.
This method is used to evaluate indirect and direct object references until a final value is reached.
@param PdfType $value
@param PdfParser $parser
@param bool $stopAtIndirectObject
@return PdfType
@throws CrossReferenceException
@throws PdfParserException | [
"Resolves",
"a",
"PdfType",
"value",
"to",
"its",
"value",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/Type/PdfType.php#L35-L50 |
Setasign/FPDI | src/PdfParser/Type/PdfType.php | PdfType.ensureType | protected static function ensureType($type, $value, $errorMessage)
{
if (!($value instanceof $type)) {
throw new PdfTypeException(
$errorMessage,
PdfTypeException::INVALID_DATA_TYPE
);
}
return $value;
} | php | protected static function ensureType($type, $value, $errorMessage)
{
if (!($value instanceof $type)) {
throw new PdfTypeException(
$errorMessage,
PdfTypeException::INVALID_DATA_TYPE
);
}
return $value;
} | [
"protected",
"static",
"function",
"ensureType",
"(",
"$",
"type",
",",
"$",
"value",
",",
"$",
"errorMessage",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"value",
"instanceof",
"$",
"type",
")",
")",
"{",
"throw",
"new",
"PdfTypeException",
"(",
"$",
"errorM... | Ensure that a value is an instance of a specific PDF type.
@param string $type
@param PdfType $value
@param string $errorMessage
@return mixed
@throws PdfTypeException | [
"Ensure",
"that",
"a",
"value",
"is",
"an",
"instance",
"of",
"a",
"specific",
"PDF",
"type",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/Type/PdfType.php#L61-L71 |
Setasign/FPDI | src/FpdfTplTrait.php | FpdfTplTrait.setPageFormat | public function setPageFormat($size, $orientation)
{
if ($this->currentTemplateId !== null) {
throw new \BadMethodCallException('The page format cannot be changed when writing to a template.');
}
if (!\in_array($orientation, ['P', 'L'], true)) {
throw new \InvalidArg... | php | public function setPageFormat($size, $orientation)
{
if ($this->currentTemplateId !== null) {
throw new \BadMethodCallException('The page format cannot be changed when writing to a template.');
}
if (!\in_array($orientation, ['P', 'L'], true)) {
throw new \InvalidArg... | [
"public",
"function",
"setPageFormat",
"(",
"$",
"size",
",",
"$",
"orientation",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"currentTemplateId",
"!==",
"null",
")",
"{",
"throw",
"new",
"\\",
"BadMethodCallException",
"(",
"'The page format cannot be changed when wr... | Set the page format of the current page.
@param array $size An array with two values defining the size.
@param string $orientation "L" for landscape, "P" for portrait.
@throws \BadMethodCallException | [
"Set",
"the",
"page",
"format",
"of",
"the",
"current",
"page",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/FpdfTplTrait.php#L49-L84 |
Setasign/FPDI | src/FpdfTplTrait.php | FpdfTplTrait.useTemplate | public function useTemplate($tpl, $x = 0, $y = 0, $width = null, $height = null, $adjustPageSize = false)
{
if (!isset($this->templates[$tpl])) {
throw new \InvalidArgumentException('Template does not exist!');
}
if (\is_array($x)) {
unset($x['tpl']);
\ex... | php | public function useTemplate($tpl, $x = 0, $y = 0, $width = null, $height = null, $adjustPageSize = false)
{
if (!isset($this->templates[$tpl])) {
throw new \InvalidArgumentException('Template does not exist!');
}
if (\is_array($x)) {
unset($x['tpl']);
\ex... | [
"public",
"function",
"useTemplate",
"(",
"$",
"tpl",
",",
"$",
"x",
"=",
"0",
",",
"$",
"y",
"=",
"0",
",",
"$",
"width",
"=",
"null",
",",
"$",
"height",
"=",
"null",
",",
"$",
"adjustPageSize",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"isset"... | Draws a template onto the page or another template.
Give only one of the size parameters (width, height) to calculate the other one automatically in view to the
aspect ratio.
@param mixed $tpl The template id
@param array|float|int $x The abscissa of upper-left corner. Alternatively you could use an assoc array
with ... | [
"Draws",
"a",
"template",
"onto",
"the",
"page",
"or",
"another",
"template",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/FpdfTplTrait.php#L102-L139 |
Setasign/FPDI | src/FpdfTplTrait.php | FpdfTplTrait.getTemplateSize | public function getTemplateSize($tpl, $width = null, $height = null)
{
if (!isset($this->templates[$tpl])) {
return false;
}
if ($width === null && $height === null) {
$width = $this->templates[$tpl]['width'];
$height = $this->templates[$tpl]['height'];
... | php | public function getTemplateSize($tpl, $width = null, $height = null)
{
if (!isset($this->templates[$tpl])) {
return false;
}
if ($width === null && $height === null) {
$width = $this->templates[$tpl]['width'];
$height = $this->templates[$tpl]['height'];
... | [
"public",
"function",
"getTemplateSize",
"(",
"$",
"tpl",
",",
"$",
"width",
"=",
"null",
",",
"$",
"height",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"templates",
"[",
"$",
"tpl",
"]",
")",
")",
"{",
"return",
"fal... | Get the size of a template.
Give only one of the size parameters (width, height) to calculate the other one automatically in view to the
aspect ratio.
@param mixed $tpl The template id
@param float|int|null $width The width.
@param float|int|null $height The height.
@return array|bool An array with following keys: wi... | [
"Get",
"the",
"size",
"of",
"a",
"template",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/FpdfTplTrait.php#L152-L180 |
Setasign/FPDI | src/FpdfTplTrait.php | FpdfTplTrait.beginTemplate | public function beginTemplate($width = null, $height = null, $groupXObject = false)
{
if ($width === null) {
$width = $this->w;
}
if ($height === null) {
$height = $this->h;
}
$templateId = $this->getNextTemplateId();
// initiate buffer with... | php | public function beginTemplate($width = null, $height = null, $groupXObject = false)
{
if ($width === null) {
$width = $this->w;
}
if ($height === null) {
$height = $this->h;
}
$templateId = $this->getNextTemplateId();
// initiate buffer with... | [
"public",
"function",
"beginTemplate",
"(",
"$",
"width",
"=",
"null",
",",
"$",
"height",
"=",
"null",
",",
"$",
"groupXObject",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"width",
"===",
"null",
")",
"{",
"$",
"width",
"=",
"$",
"this",
"->",
"w",
... | Begins a new template.
@param float|int|null $width The width of the template. If null, the current page width is used.
@param float|int|null $height The height of the template. If null, the current page height is used.
@param bool $groupXObject Define the form XObject as a group XObject to support transparency (if us... | [
"Begins",
"a",
"new",
"template",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/FpdfTplTrait.php#L190-L260 |
Setasign/FPDI | src/FpdfTplTrait.php | FpdfTplTrait.endTemplate | public function endTemplate()
{
if (null === $this->currentTemplateId) {
return false;
}
$templateId = $this->currentTemplateId;
$template = $this->templates[$templateId];
$state = $template['state'];
$this->SetXY($state['x'], $state['y']);
$this... | php | public function endTemplate()
{
if (null === $this->currentTemplateId) {
return false;
}
$templateId = $this->currentTemplateId;
$template = $this->templates[$templateId];
$state = $template['state'];
$this->SetXY($state['x'], $state['y']);
$this... | [
"public",
"function",
"endTemplate",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"currentTemplateId",
")",
"{",
"return",
"false",
";",
"}",
"$",
"templateId",
"=",
"$",
"this",
"->",
"currentTemplateId",
";",
"$",
"template",
"=",
"$",
... | Ends a template.
@return bool|int|null A template identifier. | [
"Ends",
"a",
"template",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/FpdfTplTrait.php#L267-L307 |
Setasign/FPDI | src/PdfReader/PdfReader.php | PdfReader.getPageCount | public function getPageCount()
{
if ($this->pageCount === null) {
$catalog = $this->parser->getCatalog();
$pages = PdfType::resolve(PdfDictionary::get($catalog, 'Pages'), $this->parser);
$count = PdfType::resolve(PdfDictionary::get($pages, 'Count'), $this->parser);
... | php | public function getPageCount()
{
if ($this->pageCount === null) {
$catalog = $this->parser->getCatalog();
$pages = PdfType::resolve(PdfDictionary::get($catalog, 'Pages'), $this->parser);
$count = PdfType::resolve(PdfDictionary::get($pages, 'Count'), $this->parser);
... | [
"public",
"function",
"getPageCount",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"pageCount",
"===",
"null",
")",
"{",
"$",
"catalog",
"=",
"$",
"this",
"->",
"parser",
"->",
"getCatalog",
"(",
")",
";",
"$",
"pages",
"=",
"PdfType",
"::",
"resolve... | Get the page count.
@return int
@throws PdfTypeException
@throws CrossReferenceException
@throws PdfParserException | [
"Get",
"the",
"page",
"count",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfReader/PdfReader.php#L96-L108 |
Setasign/FPDI | src/PdfReader/PdfReader.php | PdfReader.getPage | public function getPage($pageNumber)
{
if (!\is_numeric($pageNumber)) {
throw new \InvalidArgumentException(
'Page number needs to be a number.'
);
}
if ($pageNumber < 1 || $pageNumber > $this->getPageCount()) {
throw new \InvalidArgumentE... | php | public function getPage($pageNumber)
{
if (!\is_numeric($pageNumber)) {
throw new \InvalidArgumentException(
'Page number needs to be a number.'
);
}
if ($pageNumber < 1 || $pageNumber > $this->getPageCount()) {
throw new \InvalidArgumentE... | [
"public",
"function",
"getPage",
"(",
"$",
"pageNumber",
")",
"{",
"if",
"(",
"!",
"\\",
"is_numeric",
"(",
"$",
"pageNumber",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Page number needs to be a number.'",
")",
";",
"}",
"if",
"... | Get a page instance.
@param int $pageNumber
@return Page
@throws PdfTypeException
@throws CrossReferenceException
@throws PdfParserException
@throws \InvalidArgumentException | [
"Get",
"a",
"page",
"instance",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfReader/PdfReader.php#L120-L177 |
Setasign/FPDI | src/PdfReader/PdfReader.php | PdfReader.readPages | protected function readPages()
{
if (\count($this->pages) > 0) {
return;
}
$readPages = function ($kids, $count) use (&$readPages) {
$kids = PdfArray::ensure($kids);
$isLeaf = $count->value === \count($kids->value);
foreach ($kids->value as $... | php | protected function readPages()
{
if (\count($this->pages) > 0) {
return;
}
$readPages = function ($kids, $count) use (&$readPages) {
$kids = PdfArray::ensure($kids);
$isLeaf = $count->value === \count($kids->value);
foreach ($kids->value as $... | [
"protected",
"function",
"readPages",
"(",
")",
"{",
"if",
"(",
"\\",
"count",
"(",
"$",
"this",
"->",
"pages",
")",
">",
"0",
")",
"{",
"return",
";",
"}",
"$",
"readPages",
"=",
"function",
"(",
"$",
"kids",
",",
"$",
"count",
")",
"use",
"(",
... | Walk the page tree and resolve all indirect objects of all pages.
@throws PdfTypeException
@throws CrossReferenceException
@throws PdfParserException | [
"Walk",
"the",
"page",
"tree",
"and",
"resolve",
"all",
"indirect",
"objects",
"of",
"all",
"pages",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfReader/PdfReader.php#L186-L220 |
Setasign/FPDI | src/Tcpdf/Fpdi.php | Fpdi.useImportedPage | public function useImportedPage($pageId, $x = 0, $y = 0, $width = null, $height = null, $adjustPageSize = false)
{
$size = $this->fpdiUseImportedPage($pageId, $x, $y, $width, $height, $adjustPageSize);
if ($this->inxobj) {
$importedPage = $this->importedPages[$pageId];
$this-... | php | public function useImportedPage($pageId, $x = 0, $y = 0, $width = null, $height = null, $adjustPageSize = false)
{
$size = $this->fpdiUseImportedPage($pageId, $x, $y, $width, $height, $adjustPageSize);
if ($this->inxobj) {
$importedPage = $this->importedPages[$pageId];
$this-... | [
"public",
"function",
"useImportedPage",
"(",
"$",
"pageId",
",",
"$",
"x",
"=",
"0",
",",
"$",
"y",
"=",
"0",
",",
"$",
"width",
"=",
"null",
",",
"$",
"height",
"=",
"null",
",",
"$",
"adjustPageSize",
"=",
"false",
")",
"{",
"$",
"size",
"=",
... | Draws an imported page onto the page.
Give only one of the size parameters (width, height) to calculate the other one automatically in view to the
aspect ratio.
@param mixed $pageId The page id
@param float|int|array $x The abscissa of upper-left corner. Alternatively you could use an assoc array
with the keys "x", "... | [
"Draws",
"an",
"imported",
"page",
"onto",
"the",
"page",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/Tcpdf/Fpdi.php#L106-L115 |
Setasign/FPDI | src/Tcpdf/Fpdi.php | Fpdi._put | protected function _put($s, $newLine = true)
{
if ($newLine) {
$this->setBuffer($s . "\n");
} else {
$this->setBuffer($s);
}
} | php | protected function _put($s, $newLine = true)
{
if ($newLine) {
$this->setBuffer($s . "\n");
} else {
$this->setBuffer($s);
}
} | [
"protected",
"function",
"_put",
"(",
"$",
"s",
",",
"$",
"newLine",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"newLine",
")",
"{",
"$",
"this",
"->",
"setBuffer",
"(",
"$",
"s",
".",
"\"\\n\"",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"setB... | Append content to the buffer of TCPDF.
@param string $s
@param bool $newLine | [
"Append",
"content",
"to",
"the",
"buffer",
"of",
"TCPDF",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/Tcpdf/Fpdi.php#L205-L212 |
Setasign/FPDI | src/Tcpdf/Fpdi.php | Fpdi.writePdfType | protected function writePdfType(PdfType $value)
{
if (!$this->encrypted) {
$this->fpdiWritePdfType($value);
return;
}
if ($value instanceof PdfString) {
$string = PdfString::unescape($value->value);
$string = $this->_encrypt_data($this->curren... | php | protected function writePdfType(PdfType $value)
{
if (!$this->encrypted) {
$this->fpdiWritePdfType($value);
return;
}
if ($value instanceof PdfString) {
$string = PdfString::unescape($value->value);
$string = $this->_encrypt_data($this->curren... | [
"protected",
"function",
"writePdfType",
"(",
"PdfType",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"encrypted",
")",
"{",
"$",
"this",
"->",
"fpdiWritePdfType",
"(",
"$",
"value",
")",
";",
"return",
";",
"}",
"if",
"(",
"$",
"value"... | Writes a PdfType object to the resulting buffer.
@param PdfType $value
@throws PdfTypeException | [
"Writes",
"a",
"PdfType",
"object",
"to",
"the",
"resulting",
"buffer",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/Tcpdf/Fpdi.php#L232-L265 |
Setasign/FPDI | src/PdfParser/Type/PdfStream.php | PdfStream.parse | public static function parse(PdfDictionary $dictionary, StreamReader $reader, PdfParser $parser = null)
{
$v = new self;
$v->value = $dictionary;
$v->reader = $reader;
$v->parser = $parser;
$offset = $reader->getOffset();
// Find the first "newline"
while ((... | php | public static function parse(PdfDictionary $dictionary, StreamReader $reader, PdfParser $parser = null)
{
$v = new self;
$v->value = $dictionary;
$v->reader = $reader;
$v->parser = $parser;
$offset = $reader->getOffset();
// Find the first "newline"
while ((... | [
"public",
"static",
"function",
"parse",
"(",
"PdfDictionary",
"$",
"dictionary",
",",
"StreamReader",
"$",
"reader",
",",
"PdfParser",
"$",
"parser",
"=",
"null",
")",
"{",
"$",
"v",
"=",
"new",
"self",
";",
"$",
"v",
"->",
"value",
"=",
"$",
"diction... | Parses a stream from a stream reader.
@param PdfDictionary $dictionary
@param StreamReader $reader
@param PdfParser $parser Optional to keep backwards compatibility
@return self
@throws PdfTypeException | [
"Parses",
"a",
"stream",
"from",
"a",
"stream",
"reader",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/Type/PdfStream.php#L39-L78 |
Setasign/FPDI | src/PdfParser/Type/PdfStream.php | PdfStream.create | public static function create(PdfDictionary $dictionary, $stream)
{
$v = new self;
$v->value = $dictionary;
$v->stream = (string) $stream;
return $v;
} | php | public static function create(PdfDictionary $dictionary, $stream)
{
$v = new self;
$v->value = $dictionary;
$v->stream = (string) $stream;
return $v;
} | [
"public",
"static",
"function",
"create",
"(",
"PdfDictionary",
"$",
"dictionary",
",",
"$",
"stream",
")",
"{",
"$",
"v",
"=",
"new",
"self",
";",
"$",
"v",
"->",
"value",
"=",
"$",
"dictionary",
";",
"$",
"v",
"->",
"stream",
"=",
"(",
"string",
... | Helper method to create an instance.
@param PdfDictionary $dictionary
@param string $stream
@return self | [
"Helper",
"method",
"to",
"create",
"an",
"instance",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/Type/PdfStream.php#L87-L94 |
Setasign/FPDI | src/PdfParser/Type/PdfStream.php | PdfStream.getStream | public function getStream($cache = false)
{
if (\is_int($this->stream)) {
$length = PdfDictionary::get($this->value, 'Length');
if ($this->parser !== null) {
$length = PdfType::resolve($length, $this->parser);
}
if (!($length instanceof PdfNum... | php | public function getStream($cache = false)
{
if (\is_int($this->stream)) {
$length = PdfDictionary::get($this->value, 'Length');
if ($this->parser !== null) {
$length = PdfType::resolve($length, $this->parser);
}
if (!($length instanceof PdfNum... | [
"public",
"function",
"getStream",
"(",
"$",
"cache",
"=",
"false",
")",
"{",
"if",
"(",
"\\",
"is_int",
"(",
"$",
"this",
"->",
"stream",
")",
")",
"{",
"$",
"length",
"=",
"PdfDictionary",
"::",
"get",
"(",
"$",
"this",
"->",
"value",
",",
"'Leng... | Get the stream data.
@param bool $cache Whether cache the stream data or not.
@return bool|string
@throws PdfTypeException
@throws CrossReferenceException
@throws PdfParserException | [
"Get",
"the",
"stream",
"data",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/Type/PdfStream.php#L138-L173 |
Setasign/FPDI | src/PdfParser/Type/PdfStream.php | PdfStream.extractStream | protected function extractStream()
{
while (true) {
$buffer = $this->reader->getBuffer(false);
$length = \strpos($buffer, 'endstream');
if ($length === false) {
if (!$this->reader->increaseLength(100000)) {
throw new PdfTypeException('C... | php | protected function extractStream()
{
while (true) {
$buffer = $this->reader->getBuffer(false);
$length = \strpos($buffer, 'endstream');
if ($length === false) {
if (!$this->reader->increaseLength(100000)) {
throw new PdfTypeException('C... | [
"protected",
"function",
"extractStream",
"(",
")",
"{",
"while",
"(",
"true",
")",
"{",
"$",
"buffer",
"=",
"$",
"this",
"->",
"reader",
"->",
"getBuffer",
"(",
"false",
")",
";",
"$",
"length",
"=",
"\\",
"strpos",
"(",
"$",
"buffer",
",",
"'endstr... | Extract the stream "manually".
@return string
@throws PdfTypeException | [
"Extract",
"the",
"stream",
"manually",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/Type/PdfStream.php#L181-L212 |
Setasign/FPDI | src/PdfParser/Type/PdfStream.php | PdfStream.getUnfilteredStream | public function getUnfilteredStream()
{
$stream = $this->getStream();
$filters = PdfDictionary::get($this->value, 'Filter');
if ($filters instanceof PdfNull) {
return $stream;
}
if ($filters instanceof PdfArray) {
$filters = $filters->value;
}... | php | public function getUnfilteredStream()
{
$stream = $this->getStream();
$filters = PdfDictionary::get($this->value, 'Filter');
if ($filters instanceof PdfNull) {
return $stream;
}
if ($filters instanceof PdfArray) {
$filters = $filters->value;
}... | [
"public",
"function",
"getUnfilteredStream",
"(",
")",
"{",
"$",
"stream",
"=",
"$",
"this",
"->",
"getStream",
"(",
")",
";",
"$",
"filters",
"=",
"PdfDictionary",
"::",
"get",
"(",
"$",
"this",
"->",
"value",
",",
"'Filter'",
")",
";",
"if",
"(",
"... | Get the unfiltered stream data.
@return string
@throws FilterException
@throws PdfParserException | [
"Get",
"the",
"unfiltered",
"stream",
"data",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/Type/PdfStream.php#L221-L319 |
Setasign/FPDI | src/PdfParser/CrossReference/LineReader.php | LineReader.extract | protected function extract(StreamReader $reader)
{
$cycles = -1;
$bytesPerCycle = 100;
$reader->reset(null, $bytesPerCycle);
while (
($trailerPos = \strpos($reader->getBuffer(false), 'trailer', \max($bytesPerCycle * $cycles++, 0))) === false
) {
if (... | php | protected function extract(StreamReader $reader)
{
$cycles = -1;
$bytesPerCycle = 100;
$reader->reset(null, $bytesPerCycle);
while (
($trailerPos = \strpos($reader->getBuffer(false), 'trailer', \max($bytesPerCycle * $cycles++, 0))) === false
) {
if (... | [
"protected",
"function",
"extract",
"(",
"StreamReader",
"$",
"reader",
")",
"{",
"$",
"cycles",
"=",
"-",
"1",
";",
"$",
"bytesPerCycle",
"=",
"100",
";",
"$",
"reader",
"->",
"reset",
"(",
"null",
",",
"$",
"bytesPerCycle",
")",
";",
"while",
"(",
... | Extracts the cross reference data from the stream reader.
@param StreamReader $reader
@return string
@throws CrossReferenceException | [
"Extracts",
"the",
"cross",
"reference",
"data",
"from",
"the",
"stream",
"reader",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/CrossReference/LineReader.php#L73-L99 |
Setasign/FPDI | src/PdfParser/CrossReference/LineReader.php | LineReader.read | protected function read($xrefContent)
{
// get eol markers in the first 100 bytes
\preg_match_all("/(\r\n|\n|\r)/", \substr($xrefContent, 0, 100), $m);
if (\count($m[0]) === 0) {
throw new CrossReferenceException(
'No data found in cross-reference.',
... | php | protected function read($xrefContent)
{
// get eol markers in the first 100 bytes
\preg_match_all("/(\r\n|\n|\r)/", \substr($xrefContent, 0, 100), $m);
if (\count($m[0]) === 0) {
throw new CrossReferenceException(
'No data found in cross-reference.',
... | [
"protected",
"function",
"read",
"(",
"$",
"xrefContent",
")",
"{",
"// get eol markers in the first 100 bytes",
"\\",
"preg_match_all",
"(",
"\"/(\\r\\n|\\n|\\r)/\"",
",",
"\\",
"substr",
"(",
"$",
"xrefContent",
",",
"0",
",",
"100",
")",
",",
"$",
"m",
")",
... | Read the cross-reference entries.
@param string $xrefContent
@throws CrossReferenceException | [
"Read",
"the",
"cross",
"-",
"reference",
"entries",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/CrossReference/LineReader.php#L107-L172 |
Setasign/FPDI | src/PdfParser/Type/PdfArray.php | PdfArray.parse | public static function parse(Tokenizer $tokenizer, PdfParser $parser)
{
$result = [];
// Recurse into this function until we reach the end of the array.
while (($token = $tokenizer->getNextToken()) !== ']') {
if ($token === false || ($value = $parser->readValue($token)) === fals... | php | public static function parse(Tokenizer $tokenizer, PdfParser $parser)
{
$result = [];
// Recurse into this function until we reach the end of the array.
while (($token = $tokenizer->getNextToken()) !== ']') {
if ($token === false || ($value = $parser->readValue($token)) === fals... | [
"public",
"static",
"function",
"parse",
"(",
"Tokenizer",
"$",
"tokenizer",
",",
"PdfParser",
"$",
"parser",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"// Recurse into this function until we reach the end of the array.",
"while",
"(",
"(",
"$",
"token",
"=",
... | Parses an array of the passed tokenizer and parser.
@param Tokenizer $tokenizer
@param PdfParser $parser
@return bool|self
@throws PdfTypeException | [
"Parses",
"an",
"array",
"of",
"the",
"passed",
"tokenizer",
"and",
"parser",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/Type/PdfArray.php#L31-L48 |
Setasign/FPDI | src/PdfParser/Type/PdfArray.php | PdfArray.ensure | public static function ensure($array, $size = null)
{
$result = PdfType::ensureType(self::class, $array, 'Array value expected.');
if ($size !== null && \count($array->value) !== $size) {
throw new PdfTypeException(
\sprintf('Array with %s entries expected.', $size),
... | php | public static function ensure($array, $size = null)
{
$result = PdfType::ensureType(self::class, $array, 'Array value expected.');
if ($size !== null && \count($array->value) !== $size) {
throw new PdfTypeException(
\sprintf('Array with %s entries expected.', $size),
... | [
"public",
"static",
"function",
"ensure",
"(",
"$",
"array",
",",
"$",
"size",
"=",
"null",
")",
"{",
"$",
"result",
"=",
"PdfType",
"::",
"ensureType",
"(",
"self",
"::",
"class",
",",
"$",
"array",
",",
"'Array value expected.'",
")",
";",
"if",
"(",... | Ensures that the passed array is a PdfArray instance with a (optional) specific size.
@param mixed $array
@param null|int $size
@return self
@throws PdfTypeException | [
"Ensures",
"that",
"the",
"passed",
"array",
"is",
"a",
"PdfArray",
"instance",
"with",
"a",
"(",
"optional",
")",
"specific",
"size",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/Type/PdfArray.php#L72-L84 |
Setasign/FPDI | src/PdfParser/Type/PdfDictionary.php | PdfDictionary.parse | public static function parse(Tokenizer $tokenizer, StreamReader $streamReader, PdfParser $parser)
{
$entries = [];
while (true) {
$token = $tokenizer->getNextToken();
if ($token === '>' && $streamReader->getByte() === '>') {
$streamReader->addOffset(1);
... | php | public static function parse(Tokenizer $tokenizer, StreamReader $streamReader, PdfParser $parser)
{
$entries = [];
while (true) {
$token = $tokenizer->getNextToken();
if ($token === '>' && $streamReader->getByte() === '>') {
$streamReader->addOffset(1);
... | [
"public",
"static",
"function",
"parse",
"(",
"Tokenizer",
"$",
"tokenizer",
",",
"StreamReader",
"$",
"streamReader",
",",
"PdfParser",
"$",
"parser",
")",
"{",
"$",
"entries",
"=",
"[",
"]",
";",
"while",
"(",
"true",
")",
"{",
"$",
"token",
"=",
"$"... | Parses a dictionary of the passed tokenizer, stream-reader and parser.
@param Tokenizer $tokenizer
@param StreamReader $streamReader
@param PdfParser $parser
@return bool|self
@throws PdfTypeException | [
"Parses",
"a",
"dictionary",
"of",
"the",
"passed",
"tokenizer",
"stream",
"-",
"reader",
"and",
"parser",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/Type/PdfDictionary.php#L32-L86 |
Setasign/FPDI | src/PdfParser/Type/PdfDictionary.php | PdfDictionary.get | public static function get($dictionary, $key, PdfType $default = null)
{
$dictionary = self::ensure($dictionary);
if (isset($dictionary->value[$key])) {
return $dictionary->value[$key];
}
return $default === null
? new PdfNull()
: $default;
} | php | public static function get($dictionary, $key, PdfType $default = null)
{
$dictionary = self::ensure($dictionary);
if (isset($dictionary->value[$key])) {
return $dictionary->value[$key];
}
return $default === null
? new PdfNull()
: $default;
} | [
"public",
"static",
"function",
"get",
"(",
"$",
"dictionary",
",",
"$",
"key",
",",
"PdfType",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"dictionary",
"=",
"self",
"::",
"ensure",
"(",
"$",
"dictionary",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"... | Get a value by its key from a dictionary or a default value.
@param mixed $dictionary
@param string $key
@param PdfType|mixed|null $default
@return PdfNull|PdfType
@throws PdfTypeException | [
"Get",
"a",
"value",
"by",
"its",
"key",
"from",
"a",
"dictionary",
"or",
"a",
"default",
"value",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/Type/PdfDictionary.php#L111-L122 |
Setasign/FPDI | src/PdfParser/Type/PdfName.php | PdfName.parse | public static function parse(Tokenizer $tokenizer, StreamReader $streamReader)
{
$v = new self;
if (\strspn($streamReader->getByte(), "\x00\x09\x0A\x0C\x0D\x20()<>[]{}/%") === 0) {
$v->value = (string) $tokenizer->getNextToken();
return $v;
}
$v->value = '';
... | php | public static function parse(Tokenizer $tokenizer, StreamReader $streamReader)
{
$v = new self;
if (\strspn($streamReader->getByte(), "\x00\x09\x0A\x0C\x0D\x20()<>[]{}/%") === 0) {
$v->value = (string) $tokenizer->getNextToken();
return $v;
}
$v->value = '';
... | [
"public",
"static",
"function",
"parse",
"(",
"Tokenizer",
"$",
"tokenizer",
",",
"StreamReader",
"$",
"streamReader",
")",
"{",
"$",
"v",
"=",
"new",
"self",
";",
"if",
"(",
"\\",
"strspn",
"(",
"$",
"streamReader",
"->",
"getByte",
"(",
")",
",",
"\"... | Parses a name object from the passed tokenizer and stream-reader.
@param Tokenizer $tokenizer
@param StreamReader $streamReader
@return self | [
"Parses",
"a",
"name",
"object",
"from",
"the",
"passed",
"tokenizer",
"and",
"stream",
"-",
"reader",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/Type/PdfName.php#L29-L39 |
Setasign/FPDI | src/PdfParser/Type/PdfName.php | PdfName.unescape | static public function unescape($value)
{
if (strpos($value, '#') === false)
return $value;
return preg_replace_callback('/#[a-fA-F\d]{2}/', function($matches) {
return chr(hexdec($matches[0]));
}, $value);
} | php | static public function unescape($value)
{
if (strpos($value, '#') === false)
return $value;
return preg_replace_callback('/#[a-fA-F\d]{2}/', function($matches) {
return chr(hexdec($matches[0]));
}, $value);
} | [
"static",
"public",
"function",
"unescape",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"value",
",",
"'#'",
")",
"===",
"false",
")",
"return",
"$",
"value",
";",
"return",
"preg_replace_callback",
"(",
"'/#[a-fA-F\\d]{2}/'",
",",
"functio... | Unescapes a name string.
@param string $value
@return string | [
"Unescapes",
"a",
"name",
"string",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/Type/PdfName.php#L47-L55 |
Setasign/FPDI | src/PdfParser/CrossReference/FixedReader.php | FixedReader.read | protected function read()
{
$subSections = [];
$startObject = $entryCount = $lastLineStart = null;
$validityChecked = false;
while (($line = $this->reader->readLine(20)) !== false) {
if (\strpos($line, 'trailer') !== false) {
$this->reader->reset($lastLin... | php | protected function read()
{
$subSections = [];
$startObject = $entryCount = $lastLineStart = null;
$validityChecked = false;
while (($line = $this->reader->readLine(20)) !== false) {
if (\strpos($line, 'trailer') !== false) {
$this->reader->reset($lastLin... | [
"protected",
"function",
"read",
"(",
")",
"{",
"$",
"subSections",
"=",
"[",
"]",
";",
"$",
"startObject",
"=",
"$",
"entryCount",
"=",
"$",
"lastLineStart",
"=",
"null",
";",
"$",
"validityChecked",
"=",
"false",
";",
"while",
"(",
"(",
"$",
"line",
... | Read the cross-reference.
This reader will only read the subsections in this method. The offsets were resolved individually by this
information.
@throws CrossReferenceException | [
"Read",
"the",
"cross",
"-",
"reference",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/CrossReference/FixedReader.php#L89-L152 |
Setasign/FPDI | src/PdfParser/CrossReference/FixedReader.php | FixedReader.fixFaultySubSectionShift | public function fixFaultySubSectionShift()
{
$subSections = $this->getSubSections();
if (\count($subSections) > 1) {
return false;
}
$subSection = \current($subSections);
if ($subSection[0] != 1) {
return false;
}
if ($this->getOffset... | php | public function fixFaultySubSectionShift()
{
$subSections = $this->getSubSections();
if (\count($subSections) > 1) {
return false;
}
$subSection = \current($subSections);
if ($subSection[0] != 1) {
return false;
}
if ($this->getOffset... | [
"public",
"function",
"fixFaultySubSectionShift",
"(",
")",
"{",
"$",
"subSections",
"=",
"$",
"this",
"->",
"getSubSections",
"(",
")",
";",
"if",
"(",
"\\",
"count",
"(",
"$",
"subSections",
")",
">",
"1",
")",
"{",
"return",
"false",
";",
"}",
"$",
... | Fixes an invalid object number shift.
This method can be used to repair documents with an invalid subsection header:
<code>
xref
1 7
0000000000 65535 f
0000000009 00000 n
0000412075 00000 n
0000412172 00000 n
0000412359 00000 n
0000412417 00000 n
0000412468 00000 n
</code>
It shall only be called on the first table.... | [
"Fixes",
"an",
"invalid",
"object",
"number",
"shift",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/CrossReference/FixedReader.php#L175-L195 |
Setasign/FPDI | src/PdfReader/DataStructure/Rectangle.php | Rectangle.byPdfArray | public static function byPdfArray($array, PdfParser $parser)
{
$array = PdfArray::ensure(PdfType::resolve($array, $parser), 4)->value;
$ax = PdfNumeric::ensure(PdfType::resolve($array[0], $parser))->value;
$ay = PdfNumeric::ensure(PdfType::resolve($array[1], $parser))->value;
$bx = P... | php | public static function byPdfArray($array, PdfParser $parser)
{
$array = PdfArray::ensure(PdfType::resolve($array, $parser), 4)->value;
$ax = PdfNumeric::ensure(PdfType::resolve($array[0], $parser))->value;
$ay = PdfNumeric::ensure(PdfType::resolve($array[1], $parser))->value;
$bx = P... | [
"public",
"static",
"function",
"byPdfArray",
"(",
"$",
"array",
",",
"PdfParser",
"$",
"parser",
")",
"{",
"$",
"array",
"=",
"PdfArray",
"::",
"ensure",
"(",
"PdfType",
"::",
"resolve",
"(",
"$",
"array",
",",
"$",
"parser",
")",
",",
"4",
")",
"->... | Create a rectangle instance by a PdfArray.
@param PdfArray|mixed $array
@param PdfParser $parser
@return Rectangle
@throws PdfTypeException
@throws CrossReferenceException
@throws PdfParserException | [
"Create",
"a",
"rectangle",
"instance",
"by",
"a",
"PdfArray",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfReader/DataStructure/Rectangle.php#L57-L66 |
Setasign/FPDI | src/PdfReader/DataStructure/Rectangle.php | Rectangle.toPdfArray | public function toPdfArray()
{
$array = new PdfArray();
$array->value[] = PdfNumeric::create($this->llx);
$array->value[] = PdfNumeric::create($this->lly);
$array->value[] = PdfNumeric::create($this->urx);
$array->value[] = PdfNumeric::create($this->ury);
return $arr... | php | public function toPdfArray()
{
$array = new PdfArray();
$array->value[] = PdfNumeric::create($this->llx);
$array->value[] = PdfNumeric::create($this->lly);
$array->value[] = PdfNumeric::create($this->urx);
$array->value[] = PdfNumeric::create($this->ury);
return $arr... | [
"public",
"function",
"toPdfArray",
"(",
")",
"{",
"$",
"array",
"=",
"new",
"PdfArray",
"(",
")",
";",
"$",
"array",
"->",
"value",
"[",
"]",
"=",
"PdfNumeric",
"::",
"create",
"(",
"$",
"this",
"->",
"llx",
")",
";",
"$",
"array",
"->",
"value",
... | Get the rectangle as a PdfArray.
@return PdfArray | [
"Get",
"the",
"rectangle",
"as",
"a",
"PdfArray",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfReader/DataStructure/Rectangle.php#L164-L173 |
Setasign/FPDI | src/PdfParser/CrossReference/AbstractReader.php | AbstractReader.readTrailer | protected function readTrailer()
{
try {
$trailerKeyword = $this->parser->readValue(null, PdfToken::class);
if ($trailerKeyword->value !== 'trailer') {
throw new CrossReferenceException(
\sprintf(
'Unexpected end of cross re... | php | protected function readTrailer()
{
try {
$trailerKeyword = $this->parser->readValue(null, PdfToken::class);
if ($trailerKeyword->value !== 'trailer') {
throw new CrossReferenceException(
\sprintf(
'Unexpected end of cross re... | [
"protected",
"function",
"readTrailer",
"(",
")",
"{",
"try",
"{",
"$",
"trailerKeyword",
"=",
"$",
"this",
"->",
"parser",
"->",
"readValue",
"(",
"null",
",",
"PdfToken",
"::",
"class",
")",
";",
"if",
"(",
"$",
"trailerKeyword",
"->",
"value",
"!==",
... | Read the trailer dictionary.
@throws CrossReferenceException
@throws PdfTypeException | [
"Read",
"the",
"trailer",
"dictionary",
"."
] | train | https://github.com/Setasign/FPDI/blob/3c266002f8044f61b17329f7cd702d44d73f0f7f/src/PdfParser/CrossReference/AbstractReader.php#L63-L95 |
simplesamlphp/saml2 | src/SAML2/XML/md/EntityDescriptor.php | EntityDescriptor.toXML | public function toXML(DOMElement $parent = null) : DOMElement
{
if (empty($this->entityID)) {
throw new \Exception('Cannot convert EntityDescriptor to XML without an EntityID set.');
}
if ($parent === null) {
$doc = DOMDocumentFactory::create();
$e = $doc... | php | public function toXML(DOMElement $parent = null) : DOMElement
{
if (empty($this->entityID)) {
throw new \Exception('Cannot convert EntityDescriptor to XML without an EntityID set.');
}
if ($parent === null) {
$doc = DOMDocumentFactory::create();
$e = $doc... | [
"public",
"function",
"toXML",
"(",
"DOMElement",
"$",
"parent",
"=",
"null",
")",
":",
"DOMElement",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"entityID",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'Cannot convert EntityDescriptor to XML... | Create this EntityDescriptor.
@param \DOMElement|null $parent The EntitiesDescriptor we should append this EntityDescriptor to.
@return \DOMElement | [
"Create",
"this",
"EntityDescriptor",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/XML/md/EntityDescriptor.php#L474-L530 |
simplesamlphp/saml2 | src/SAML2/XML/md/AttributeConsumingService.php | AttributeConsumingService.toXML | public function toXML(DOMElement $parent) : DOMElement
{
$doc = $parent->ownerDocument;
$e = $doc->createElementNS(Constants::NS_MD, 'md:AttributeConsumingService');
$parent->appendChild($e);
$e->setAttribute('index', strval($this->getIndex()));
if ($this->getIsDefault() =... | php | public function toXML(DOMElement $parent) : DOMElement
{
$doc = $parent->ownerDocument;
$e = $doc->createElementNS(Constants::NS_MD, 'md:AttributeConsumingService');
$parent->appendChild($e);
$e->setAttribute('index', strval($this->getIndex()));
if ($this->getIsDefault() =... | [
"public",
"function",
"toXML",
"(",
"DOMElement",
"$",
"parent",
")",
":",
"DOMElement",
"{",
"$",
"doc",
"=",
"$",
"parent",
"->",
"ownerDocument",
";",
"$",
"e",
"=",
"$",
"doc",
"->",
"createElementNS",
"(",
"Constants",
"::",
"NS_MD",
",",
"'md:Attri... | Convert to \DOMElement.
@param \DOMElement $parent The element we should append this AttributeConsumingService to.
@return \DOMElement | [
"Convert",
"to",
"\\",
"DOMElement",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/XML/md/AttributeConsumingService.php#L227-L250 |
simplesamlphp/saml2 | src/SAML2/Certificate/KeyLoader.php | KeyLoader.extractPublicKeys | public static function extractPublicKeys(
CertificateProvider $config,
string $usage = null,
bool $required = false
) : KeyCollection {
$keyLoader = new self();
return $keyLoader->loadKeysFromConfiguration($config, $usage, $required);
} | php | public static function extractPublicKeys(
CertificateProvider $config,
string $usage = null,
bool $required = false
) : KeyCollection {
$keyLoader = new self();
return $keyLoader->loadKeysFromConfiguration($config, $usage, $required);
} | [
"public",
"static",
"function",
"extractPublicKeys",
"(",
"CertificateProvider",
"$",
"config",
",",
"string",
"$",
"usage",
"=",
"null",
",",
"bool",
"$",
"required",
"=",
"false",
")",
":",
"KeyCollection",
"{",
"$",
"keyLoader",
"=",
"new",
"self",
"(",
... | Extracts the public keys given by the configuration. Mainly exists for BC purposes.
Prioritisation order is keys > certData > certificate
@param \SAML2\Configuration\CertificateProvider $config
@param string|null $usage
@param bool $required
@return \SAM... | [
"Extracts",
"the",
"public",
"keys",
"given",
"by",
"the",
"configuration",
".",
"Mainly",
"exists",
"for",
"BC",
"purposes",
".",
"Prioritisation",
"order",
"is",
"keys",
">",
"certData",
">",
"certificate"
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Certificate/KeyLoader.php#L44-L52 |
simplesamlphp/saml2 | src/SAML2/Certificate/KeyLoader.php | KeyLoader.loadKeys | public function loadKeys($configuredKeys, string $usage = null) : void
{
foreach ($configuredKeys as $keyData) {
if (isset($keyData['X509Certificate'])) {
$key = new X509($keyData);
} else {
$key = new Key($keyData);
}
if ($usa... | php | public function loadKeys($configuredKeys, string $usage = null) : void
{
foreach ($configuredKeys as $keyData) {
if (isset($keyData['X509Certificate'])) {
$key = new X509($keyData);
} else {
$key = new Key($keyData);
}
if ($usa... | [
"public",
"function",
"loadKeys",
"(",
"$",
"configuredKeys",
",",
"string",
"$",
"usage",
"=",
"null",
")",
":",
"void",
"{",
"foreach",
"(",
"$",
"configuredKeys",
"as",
"$",
"keyData",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"keyData",
"[",
"'X509Ce... | Loads the keys given, optionally excluding keys when a usage is given and they
are not configured to be used with the usage given
@param array|\Traversable $configuredKeys
@param string|null $usage
@return void | [
"Loads",
"the",
"keys",
"given",
"optionally",
"excluding",
"keys",
"when",
"a",
"usage",
"is",
"given",
"and",
"they",
"are",
"not",
"configured",
"to",
"be",
"used",
"with",
"the",
"usage",
"given"
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Certificate/KeyLoader.php#L97-L112 |
simplesamlphp/saml2 | src/SAML2/Certificate/KeyLoader.php | KeyLoader.loadCertificateData | public function loadCertificateData(string $certificateData) : void
{
$this->loadedKeys->add(X509::createFromCertificateData($certificateData));
} | php | public function loadCertificateData(string $certificateData) : void
{
$this->loadedKeys->add(X509::createFromCertificateData($certificateData));
} | [
"public",
"function",
"loadCertificateData",
"(",
"string",
"$",
"certificateData",
")",
":",
"void",
"{",
"$",
"this",
"->",
"loadedKeys",
"->",
"add",
"(",
"X509",
"::",
"createFromCertificateData",
"(",
"$",
"certificateData",
")",
")",
";",
"}"
] | Attempts to load a key based on the given certificateData
@param string $certificateData
@return void | [
"Attempts",
"to",
"load",
"a",
"key",
"based",
"on",
"the",
"given",
"certificateData"
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Certificate/KeyLoader.php#L121-L124 |
simplesamlphp/saml2 | src/SAML2/Certificate/KeyLoader.php | KeyLoader.loadCertificateFile | public function loadCertificateFile(string $certificateFile) : void
{
$certificate = File::getFileContents($certificateFile);
if (!Certificate::hasValidStructure($certificate)) {
throw new InvalidCertificateStructureException(sprintf(
'Could not find PEM encoded certific... | php | public function loadCertificateFile(string $certificateFile) : void
{
$certificate = File::getFileContents($certificateFile);
if (!Certificate::hasValidStructure($certificate)) {
throw new InvalidCertificateStructureException(sprintf(
'Could not find PEM encoded certific... | [
"public",
"function",
"loadCertificateFile",
"(",
"string",
"$",
"certificateFile",
")",
":",
"void",
"{",
"$",
"certificate",
"=",
"File",
"::",
"getFileContents",
"(",
"$",
"certificateFile",
")",
";",
"if",
"(",
"!",
"Certificate",
"::",
"hasValidStructure",
... | Loads the certificate in the file given
@param string $certificateFile the full path to the cert file.
@return void | [
"Loads",
"the",
"certificate",
"in",
"the",
"file",
"given"
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Certificate/KeyLoader.php#L133-L147 |
simplesamlphp/saml2 | src/SAML2/Exception/InvalidArgumentException.php | InvalidArgumentException.invalidType | public static function invalidType(string $expected, $parameter) : InvalidArgumentException
{
$message = sprintf(
'Invalid Argument type: "%s" expected, "%s" given',
$expected,
is_object($parameter) ? get_class($parameter) : gettype($parameter)
);
return ... | php | public static function invalidType(string $expected, $parameter) : InvalidArgumentException
{
$message = sprintf(
'Invalid Argument type: "%s" expected, "%s" given',
$expected,
is_object($parameter) ? get_class($parameter) : gettype($parameter)
);
return ... | [
"public",
"static",
"function",
"invalidType",
"(",
"string",
"$",
"expected",
",",
"$",
"parameter",
")",
":",
"InvalidArgumentException",
"{",
"$",
"message",
"=",
"sprintf",
"(",
"'Invalid Argument type: \"%s\" expected, \"%s\" given'",
",",
"$",
"expected",
",",
... | @param string $expected description of expected type
@param mixed $parameter the parameter that is not of the expected type.
@return \SAML2\Exception\InvalidArgumentException | [
"@param",
"string",
"$expected",
"description",
"of",
"expected",
"type",
"@param",
"mixed",
"$parameter",
"the",
"parameter",
"that",
"is",
"not",
"of",
"the",
"expected",
"type",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Exception/InvalidArgumentException.php#L15-L24 |
simplesamlphp/saml2 | src/SAML2/XML/saml/NameIDType.php | NameIDType.toXML | public function toXML(DOMElement $parent = null) : DOMElement
{
$element = parent::toXML($parent);
if ($this->Format !== null) {
$element->setAttribute('Format', $this->Format);
}
if ($this->SPProvidedID !== null) {
$element->setAttribute('SPProvidedID', $th... | php | public function toXML(DOMElement $parent = null) : DOMElement
{
$element = parent::toXML($parent);
if ($this->Format !== null) {
$element->setAttribute('Format', $this->Format);
}
if ($this->SPProvidedID !== null) {
$element->setAttribute('SPProvidedID', $th... | [
"public",
"function",
"toXML",
"(",
"DOMElement",
"$",
"parent",
"=",
"null",
")",
":",
"DOMElement",
"{",
"$",
"element",
"=",
"parent",
"::",
"toXML",
"(",
"$",
"parent",
")",
";",
"if",
"(",
"$",
"this",
"->",
"Format",
"!==",
"null",
")",
"{",
... | Convert this NameIDType to XML.
@param \DOMElement $parent The element we are converting to XML.
@return \DOMElement The XML element after adding the data corresponding to this NameIDType. | [
"Convert",
"this",
"NameIDType",
"to",
"XML",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/XML/saml/NameIDType.php#L155-L171 |
simplesamlphp/saml2 | src/SAML2/XML/md/EntitiesDescriptor.php | EntitiesDescriptor.addChildren | public function addChildren($child) : void
{
Assert::isInstanceOfAny($child, [EntityDescriptor::class, EntitiesDescriptor::class]);
$this->children[] = $child;
} | php | public function addChildren($child) : void
{
Assert::isInstanceOfAny($child, [EntityDescriptor::class, EntitiesDescriptor::class]);
$this->children[] = $child;
} | [
"public",
"function",
"addChildren",
"(",
"$",
"child",
")",
":",
"void",
"{",
"Assert",
"::",
"isInstanceOfAny",
"(",
"$",
"child",
",",
"[",
"EntityDescriptor",
"::",
"class",
",",
"EntitiesDescriptor",
"::",
"class",
"]",
")",
";",
"$",
"this",
"->",
... | Add the value to the children property.
@param \SAML2\XML\md\EntityDescriptor|\SAML2\XML\md\EntitiesDescriptor $child
@return void | [
"Add",
"the",
"value",
"to",
"the",
"children",
"property",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/XML/md/EntitiesDescriptor.php#L245-L249 |
simplesamlphp/saml2 | src/SAML2/XML/md/EntitiesDescriptor.php | EntitiesDescriptor.toXML | public function toXML(DOMElement $parent = null) : DOMElement
{
if ($parent === null) {
$doc = DOMDocumentFactory::create();
$e = $doc->createElementNS(Constants::NS_MD, 'md:EntitiesDescriptor');
$doc->appendChild($e);
} else {
$e = $parent->ownerDocum... | php | public function toXML(DOMElement $parent = null) : DOMElement
{
if ($parent === null) {
$doc = DOMDocumentFactory::create();
$e = $doc->createElementNS(Constants::NS_MD, 'md:EntitiesDescriptor');
$doc->appendChild($e);
} else {
$e = $parent->ownerDocum... | [
"public",
"function",
"toXML",
"(",
"DOMElement",
"$",
"parent",
"=",
"null",
")",
":",
"DOMElement",
"{",
"if",
"(",
"$",
"parent",
"===",
"null",
")",
"{",
"$",
"doc",
"=",
"DOMDocumentFactory",
"::",
"create",
"(",
")",
";",
"$",
"e",
"=",
"$",
... | Convert this EntitiesDescriptor to XML.
@param \DOMElement|null $parent The EntitiesDescriptor we should append this EntitiesDescriptor to.
@return \DOMElement | [
"Convert",
"this",
"EntitiesDescriptor",
"to",
"XML",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/XML/md/EntitiesDescriptor.php#L258-L295 |
simplesamlphp/saml2 | src/SAML2/XML/samlp/Extensions.php | Extensions.getList | public static function getList(DOMElement $parent) : array
{
$ret = [];
/** @var \DOMElement $node */
foreach (Utils::xpQuery($parent, './saml_protocol:Extensions/*') as $node) {
$ret[] = new Chunk($node);
}
return $ret;
} | php | public static function getList(DOMElement $parent) : array
{
$ret = [];
/** @var \DOMElement $node */
foreach (Utils::xpQuery($parent, './saml_protocol:Extensions/*') as $node) {
$ret[] = new Chunk($node);
}
return $ret;
} | [
"public",
"static",
"function",
"getList",
"(",
"DOMElement",
"$",
"parent",
")",
":",
"array",
"{",
"$",
"ret",
"=",
"[",
"]",
";",
"/** @var \\DOMElement $node */",
"foreach",
"(",
"Utils",
"::",
"xpQuery",
"(",
"$",
"parent",
",",
"'./saml_protocol:Extensio... | Get a list of Extensions in the given element.
@param \DOMElement $parent The element that may contain the samlp:Extensions element.
@return array Array of extensions. | [
"Get",
"a",
"list",
"of",
"Extensions",
"in",
"the",
"given",
"element",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/XML/samlp/Extensions.php#L26-L35 |
simplesamlphp/saml2 | src/SAML2/XML/samlp/Extensions.php | Extensions.addList | public static function addList(DOMElement $parent, array $extensions) : void
{
if (empty($extensions)) {
return;
}
$extElement = $parent->ownerDocument->createElementNS(Constants::NS_SAMLP, 'samlp:Extensions');
$parent->appendChild($extElement);
foreach ($extens... | php | public static function addList(DOMElement $parent, array $extensions) : void
{
if (empty($extensions)) {
return;
}
$extElement = $parent->ownerDocument->createElementNS(Constants::NS_SAMLP, 'samlp:Extensions');
$parent->appendChild($extElement);
foreach ($extens... | [
"public",
"static",
"function",
"addList",
"(",
"DOMElement",
"$",
"parent",
",",
"array",
"$",
"extensions",
")",
":",
"void",
"{",
"if",
"(",
"empty",
"(",
"$",
"extensions",
")",
")",
"{",
"return",
";",
"}",
"$",
"extElement",
"=",
"$",
"parent",
... | Add a list of Extensions to the given element.
@param \DOMElement $parent The element we should add the extensions to.
@param \SAML2\XML\Chunk[] $extensions List of extension objects.
@return void | [
"Add",
"a",
"list",
"of",
"Extensions",
"to",
"the",
"given",
"element",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/XML/samlp/Extensions.php#L45-L57 |
simplesamlphp/saml2 | src/SAML2/Assertion/Decrypter.php | Decrypter.decrypt | public function decrypt(EncryptedAssertion $assertion) : Assertion
{
$decryptionKeys = $this->privateKeyLoader->loadDecryptionKeys($this->identityProvider, $this->serviceProvider);
$blacklistedKeys = $this->identityProvider->getBlacklistedAlgorithms();
if (is_null($blacklistedKeys)) {
... | php | public function decrypt(EncryptedAssertion $assertion) : Assertion
{
$decryptionKeys = $this->privateKeyLoader->loadDecryptionKeys($this->identityProvider, $this->serviceProvider);
$blacklistedKeys = $this->identityProvider->getBlacklistedAlgorithms();
if (is_null($blacklistedKeys)) {
... | [
"public",
"function",
"decrypt",
"(",
"EncryptedAssertion",
"$",
"assertion",
")",
":",
"Assertion",
"{",
"$",
"decryptionKeys",
"=",
"$",
"this",
"->",
"privateKeyLoader",
"->",
"loadDecryptionKeys",
"(",
"$",
"this",
"->",
"identityProvider",
",",
"$",
"this",... | @param \SAML2\EncryptedAssertion $assertion
@return \SAML2\Assertion | [
"@param",
"\\",
"SAML2",
"\\",
"EncryptedAssertion",
"$assertion"
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Assertion/Decrypter.php#L77-L107 |
simplesamlphp/saml2 | src/SAML2/XML/saml/AttributeValue.php | AttributeValue.toXML | public function toXML(DOMElement $parent) : DOMElement
{
Assert::same($this->getElement()->namespaceURI, Constants::NS_SAML);
Assert::same($this->getElement()->localName, "AttributeValue");
return Utils::copyElement($this->element, $parent);
} | php | public function toXML(DOMElement $parent) : DOMElement
{
Assert::same($this->getElement()->namespaceURI, Constants::NS_SAML);
Assert::same($this->getElement()->localName, "AttributeValue");
return Utils::copyElement($this->element, $parent);
} | [
"public",
"function",
"toXML",
"(",
"DOMElement",
"$",
"parent",
")",
":",
"DOMElement",
"{",
"Assert",
"::",
"same",
"(",
"$",
"this",
"->",
"getElement",
"(",
")",
"->",
"namespaceURI",
",",
"Constants",
"::",
"NS_SAML",
")",
";",
"Assert",
"::",
"same... | Append this attribute value to an element.
@param \DOMElement $parent The element we should append this attribute value to.
@return \DOMElement The generated AttributeValue element. | [
"Append",
"this",
"attribute",
"value",
"to",
"an",
"element",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/XML/saml/AttributeValue.php#L93-L99 |
simplesamlphp/saml2 | src/SAML2/XML/saml/AttributeValue.php | AttributeValue.unserialize | public function unserialize($serialized) : void
{
$doc = DOMDocumentFactory::fromString(unserialize($serialized));
$this->element = $doc->documentElement;
} | php | public function unserialize($serialized) : void
{
$doc = DOMDocumentFactory::fromString(unserialize($serialized));
$this->element = $doc->documentElement;
} | [
"public",
"function",
"unserialize",
"(",
"$",
"serialized",
")",
":",
"void",
"{",
"$",
"doc",
"=",
"DOMDocumentFactory",
"::",
"fromString",
"(",
"unserialize",
"(",
"$",
"serialized",
")",
")",
";",
"$",
"this",
"->",
"element",
"=",
"$",
"doc",
"->",... | Un-serialize this AttributeValue.
@param string $serialized The serialized AttributeValue.
@return void
Type hint not possible due to upstream method signature | [
"Un",
"-",
"serialize",
"this",
"AttributeValue",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/XML/saml/AttributeValue.php#L152-L156 |
simplesamlphp/saml2 | src/SAML2/Assertion.php | Assertion.parseSubject | private function parseSubject(DOMElement $xml) : void
{
/** @var \DOMElement[] $subject */
$subject = Utils::xpQuery($xml, './saml_assertion:Subject');
if (empty($subject)) {
/* No Subject node. */
return;
} elseif (count($subject) > 1) {
throw ne... | php | private function parseSubject(DOMElement $xml) : void
{
/** @var \DOMElement[] $subject */
$subject = Utils::xpQuery($xml, './saml_assertion:Subject');
if (empty($subject)) {
/* No Subject node. */
return;
} elseif (count($subject) > 1) {
throw ne... | [
"private",
"function",
"parseSubject",
"(",
"DOMElement",
"$",
"xml",
")",
":",
"void",
"{",
"/** @var \\DOMElement[] $subject */",
"$",
"subject",
"=",
"Utils",
"::",
"xpQuery",
"(",
"$",
"xml",
",",
"'./saml_assertion:Subject'",
")",
";",
"if",
"(",
"empty",
... | Parse subject in assertion.
@param \DOMElement $xml The assertion XML element.
@throws \Exception
@return void | [
"Parse",
"subject",
"in",
"assertion",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Assertion.php#L301-L340 |
simplesamlphp/saml2 | src/SAML2/Assertion.php | Assertion.parseConditions | private function parseConditions(DOMElement $xml) : void
{
/** @var \DOMElement[] $conditions */
$conditions = Utils::xpQuery($xml, './saml_assertion:Conditions');
if (empty($conditions)) {
/* No <saml:Conditions> node. */
return;
} elseif (count($conditions)... | php | private function parseConditions(DOMElement $xml) : void
{
/** @var \DOMElement[] $conditions */
$conditions = Utils::xpQuery($xml, './saml_assertion:Conditions');
if (empty($conditions)) {
/* No <saml:Conditions> node. */
return;
} elseif (count($conditions)... | [
"private",
"function",
"parseConditions",
"(",
"DOMElement",
"$",
"xml",
")",
":",
"void",
"{",
"/** @var \\DOMElement[] $conditions */",
"$",
"conditions",
"=",
"Utils",
"::",
"xpQuery",
"(",
"$",
"xml",
",",
"'./saml_assertion:Conditions'",
")",
";",
"if",
"(",
... | Parse conditions in assertion.
@param \DOMElement $xml The assertion XML element.
@throws \Exception
@return void | [
"Parse",
"conditions",
"in",
"assertion",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Assertion.php#L350-L407 |
simplesamlphp/saml2 | src/SAML2/Assertion.php | Assertion.parseAuthnStatement | private function parseAuthnStatement(DOMElement $xml) : void
{
/** @var \DOMElement[] $authnStatements */
$authnStatements = Utils::xpQuery($xml, './saml_assertion:AuthnStatement');
if (empty($authnStatements)) {
$this->authnInstant = null;
return;
} elseif (... | php | private function parseAuthnStatement(DOMElement $xml) : void
{
/** @var \DOMElement[] $authnStatements */
$authnStatements = Utils::xpQuery($xml, './saml_assertion:AuthnStatement');
if (empty($authnStatements)) {
$this->authnInstant = null;
return;
} elseif (... | [
"private",
"function",
"parseAuthnStatement",
"(",
"DOMElement",
"$",
"xml",
")",
":",
"void",
"{",
"/** @var \\DOMElement[] $authnStatements */",
"$",
"authnStatements",
"=",
"Utils",
"::",
"xpQuery",
"(",
"$",
"xml",
",",
"'./saml_assertion:AuthnStatement'",
")",
";... | Parse AuthnStatement in assertion.
@param \DOMElement $xml The assertion XML element.
@throws \Exception
@return void | [
"Parse",
"AuthnStatement",
"in",
"assertion",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Assertion.php#L417-L446 |
simplesamlphp/saml2 | src/SAML2/Assertion.php | Assertion.parseAuthnContext | private function parseAuthnContext(DOMElement $authnStatementEl) : void
{
// Get the AuthnContext element
/** @var \DOMElement[] $authnContexts */
$authnContexts = Utils::xpQuery($authnStatementEl, './saml_assertion:AuthnContext');
if (count($authnContexts) > 1) {
throw n... | php | private function parseAuthnContext(DOMElement $authnStatementEl) : void
{
// Get the AuthnContext element
/** @var \DOMElement[] $authnContexts */
$authnContexts = Utils::xpQuery($authnStatementEl, './saml_assertion:AuthnContext');
if (count($authnContexts) > 1) {
throw n... | [
"private",
"function",
"parseAuthnContext",
"(",
"DOMElement",
"$",
"authnStatementEl",
")",
":",
"void",
"{",
"// Get the AuthnContext element",
"/** @var \\DOMElement[] $authnContexts */",
"$",
"authnContexts",
"=",
"Utils",
"::",
"xpQuery",
"(",
"$",
"authnStatementEl",
... | Parse AuthnContext in AuthnStatement.
@param \DOMElement $authnStatementEl
@throws \Exception
@return void | [
"Parse",
"AuthnContext",
"in",
"AuthnStatement",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Assertion.php#L456-L511 |
simplesamlphp/saml2 | src/SAML2/Assertion.php | Assertion.parseAttributes | private function parseAttributes(DOMElement $xml) : void
{
$firstAttribute = true;
/** @var \DOMElement[] $attributes */
$attributes = Utils::xpQuery($xml, './saml_assertion:AttributeStatement/saml_assertion:Attribute');
foreach ($attributes as $attribute) {
if (!$attribu... | php | private function parseAttributes(DOMElement $xml) : void
{
$firstAttribute = true;
/** @var \DOMElement[] $attributes */
$attributes = Utils::xpQuery($xml, './saml_assertion:AttributeStatement/saml_assertion:Attribute');
foreach ($attributes as $attribute) {
if (!$attribu... | [
"private",
"function",
"parseAttributes",
"(",
"DOMElement",
"$",
"xml",
")",
":",
"void",
"{",
"$",
"firstAttribute",
"=",
"true",
";",
"/** @var \\DOMElement[] $attributes */",
"$",
"attributes",
"=",
"Utils",
"::",
"xpQuery",
"(",
"$",
"xml",
",",
"'./saml_as... | Parse attribute statements in assertion.
@param \DOMElement $xml The XML element with the assertion.
@throws \Exception
@return void | [
"Parse",
"attribute",
"statements",
"in",
"assertion",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Assertion.php#L521-L554 |
simplesamlphp/saml2 | src/SAML2/Assertion.php | Assertion.parseSignature | private function parseSignature(DOMElement $xml) : void
{
/** @var \DOMAttr[] $signatureMethod */
$signatureMethod = Utils::xpQuery($xml, './ds:Signature/ds:SignedInfo/ds:SignatureMethod/@Algorithm');
/* Validate the signature element of the message. */
$sig = Utils::validateElement... | php | private function parseSignature(DOMElement $xml) : void
{
/** @var \DOMAttr[] $signatureMethod */
$signatureMethod = Utils::xpQuery($xml, './ds:Signature/ds:SignedInfo/ds:SignatureMethod/@Algorithm');
/* Validate the signature element of the message. */
$sig = Utils::validateElement... | [
"private",
"function",
"parseSignature",
"(",
"DOMElement",
"$",
"xml",
")",
":",
"void",
"{",
"/** @var \\DOMAttr[] $signatureMethod */",
"$",
"signatureMethod",
"=",
"Utils",
"::",
"xpQuery",
"(",
"$",
"xml",
",",
"'./ds:Signature/ds:SignedInfo/ds:SignatureMethod/@Algor... | Parse signature on assertion.
@param \DOMElement $xml The assertion XML element.
@return void | [
"Parse",
"signature",
"on",
"assertion",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Assertion.php#L640-L653 |
simplesamlphp/saml2 | src/SAML2/Assertion.php | Assertion.validate | public function validate(XMLSecurityKey $key) : bool
{
Assert::same($key->type, XMLSecurityKey::RSA_SHA256);
if ($this->signatureData === null) {
return false;
}
Utils::validateSignature($this->signatureData, $key);
return true;
} | php | public function validate(XMLSecurityKey $key) : bool
{
Assert::same($key->type, XMLSecurityKey::RSA_SHA256);
if ($this->signatureData === null) {
return false;
}
Utils::validateSignature($this->signatureData, $key);
return true;
} | [
"public",
"function",
"validate",
"(",
"XMLSecurityKey",
"$",
"key",
")",
":",
"bool",
"{",
"Assert",
"::",
"same",
"(",
"$",
"key",
"->",
"type",
",",
"XMLSecurityKey",
"::",
"RSA_SHA256",
")",
";",
"if",
"(",
"$",
"this",
"->",
"signatureData",
"===",
... | Validate this assertion against a public key.
If no signature was present on the assertion, we will return false.
Otherwise, true will be returned. An exception is thrown if the
signature validation fails.
@param XMLSecurityKey $key The key we should check against.
@return boolean true if successful, false if... | [
"Validate",
"this",
"assertion",
"against",
"a",
"public",
"key",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Assertion.php#L666-L677 |
simplesamlphp/saml2 | src/SAML2/Assertion.php | Assertion.encryptNameId | public function encryptNameId(XMLSecurityKey $key) : void
{
if ($this->nameId === null) {
throw new \Exception('Cannot encrypt NameID, no NameID set.');
}
/* First create an XML representation of the NameID. */
$doc = DOMDocumentFactory::create();
$root = $doc->cr... | php | public function encryptNameId(XMLSecurityKey $key) : void
{
if ($this->nameId === null) {
throw new \Exception('Cannot encrypt NameID, no NameID set.');
}
/* First create an XML representation of the NameID. */
$doc = DOMDocumentFactory::create();
$root = $doc->cr... | [
"public",
"function",
"encryptNameId",
"(",
"XMLSecurityKey",
"$",
"key",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"nameId",
"===",
"null",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'Cannot encrypt NameID, no NameID set.'",
")",
";",
"}"... | Encrypt the NameID in the Assertion.
@param XMLSecurityKey $key The encryption key.
@return void | [
"Encrypt",
"the",
"NameID",
"in",
"the",
"Assertion",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Assertion.php#L797-L829 |
simplesamlphp/saml2 | src/SAML2/Assertion.php | Assertion.decryptNameId | public function decryptNameId(XMLSecurityKey $key, array $blacklist = []) : void
{
if ($this->encryptedNameId === null) {
/* No NameID to decrypt. */
return;
}
$nameId = Utils::decryptElement($this->encryptedNameId, $key, $blacklist);
Utils::getContainer()->... | php | public function decryptNameId(XMLSecurityKey $key, array $blacklist = []) : void
{
if ($this->encryptedNameId === null) {
/* No NameID to decrypt. */
return;
}
$nameId = Utils::decryptElement($this->encryptedNameId, $key, $blacklist);
Utils::getContainer()->... | [
"public",
"function",
"decryptNameId",
"(",
"XMLSecurityKey",
"$",
"key",
",",
"array",
"$",
"blacklist",
"=",
"[",
"]",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"encryptedNameId",
"===",
"null",
")",
"{",
"/* No NameID to decrypt. */",
"return",... | Decrypt the NameId of the subject in the assertion.
@param XMLSecurityKey $key The decryption key.
@param array $blacklist Blacklisted decryption algorithms.
@return void | [
"Decrypt",
"the",
"NameId",
"of",
"the",
"subject",
"in",
"the",
"assertion",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Assertion.php#L839-L852 |
simplesamlphp/saml2 | src/SAML2/Assertion.php | Assertion.decryptAttributes | public function decryptAttributes(XMLSecurityKey $key, array $blacklist = []) : void
{
if (!$this->hasEncryptedAttributes()) {
return;
}
$firstAttribute = true;
$attributes = $this->getEncryptedAttributes();
foreach ($attributes as $attributeEnc) {
/* ... | php | public function decryptAttributes(XMLSecurityKey $key, array $blacklist = []) : void
{
if (!$this->hasEncryptedAttributes()) {
return;
}
$firstAttribute = true;
$attributes = $this->getEncryptedAttributes();
foreach ($attributes as $attributeEnc) {
/* ... | [
"public",
"function",
"decryptAttributes",
"(",
"XMLSecurityKey",
"$",
"key",
",",
"array",
"$",
"blacklist",
"=",
"[",
"]",
")",
":",
"void",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasEncryptedAttributes",
"(",
")",
")",
"{",
"return",
";",
"}",
"$"... | Decrypt the assertion attributes.
@param XMLSecurityKey $key
@param array $blacklist
@throws \Exception
@return void | [
"Decrypt",
"the",
"assertion",
"attributes",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Assertion.php#L874-L915 |
simplesamlphp/saml2 | src/SAML2/Assertion.php | Assertion.setAuthnContextDecl | public function setAuthnContextDecl(Chunk $authnContextDecl) : void
{
if (!empty($this->authnContextDeclRef)) {
throw new \Exception(
'AuthnContextDeclRef is already registered! May only have either a Decl or a DeclRef, not both!'
);
}
$this->authnCon... | php | public function setAuthnContextDecl(Chunk $authnContextDecl) : void
{
if (!empty($this->authnContextDeclRef)) {
throw new \Exception(
'AuthnContextDeclRef is already registered! May only have either a Decl or a DeclRef, not both!'
);
}
$this->authnCon... | [
"public",
"function",
"setAuthnContextDecl",
"(",
"Chunk",
"$",
"authnContextDecl",
")",
":",
"void",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"authnContextDeclRef",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'AuthnContextDeclRef is a... | Set the authentication context declaration.
@param \SAML2\XML\Chunk $authnContextDecl
@throws \Exception
@return void | [
"Set",
"the",
"authentication",
"context",
"declaration",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Assertion.php#L1160-L1169 |
simplesamlphp/saml2 | src/SAML2/Assertion.php | Assertion.setAuthnContextDeclRef | public function setAuthnContextDeclRef(string $authnContextDeclRef = null) : void
{
if (!empty($this->authnContextDecl)) {
throw new \Exception(
'AuthnContextDecl is already registered! May only have either a Decl or a DeclRef, not both!'
);
}
$this->... | php | public function setAuthnContextDeclRef(string $authnContextDeclRef = null) : void
{
if (!empty($this->authnContextDecl)) {
throw new \Exception(
'AuthnContextDecl is already registered! May only have either a Decl or a DeclRef, not both!'
);
}
$this->... | [
"public",
"function",
"setAuthnContextDeclRef",
"(",
"string",
"$",
"authnContextDeclRef",
"=",
"null",
")",
":",
"void",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"authnContextDecl",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'Aut... | Set the authentication context declaration reference.
@param string|null $authnContextDeclRef
@throws \Exception
@return void | [
"Set",
"the",
"authentication",
"context",
"declaration",
"reference",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Assertion.php#L1193-L1202 |
simplesamlphp/saml2 | src/SAML2/Assertion.php | Assertion.toXML | public function toXML(\DOMNode $parentElement = null) : DOMElement
{
if ($parentElement === null) {
$document = DOMDocumentFactory::create();
$parentElement = $document;
} else {
$document = $parentElement->ownerDocument;
}
$root = $document->crea... | php | public function toXML(\DOMNode $parentElement = null) : DOMElement
{
if ($parentElement === null) {
$document = DOMDocumentFactory::create();
$parentElement = $document;
} else {
$document = $parentElement->ownerDocument;
}
$root = $document->crea... | [
"public",
"function",
"toXML",
"(",
"\\",
"DOMNode",
"$",
"parentElement",
"=",
"null",
")",
":",
"DOMElement",
"{",
"if",
"(",
"$",
"parentElement",
"===",
"null",
")",
"{",
"$",
"document",
"=",
"DOMDocumentFactory",
"::",
"create",
"(",
")",
";",
"$",... | Convert this assertion to an XML element.
@param \DOMNode|null $parentElement The DOM node the assertion should be created in.
@return \DOMElement This assertion. | [
"Convert",
"this",
"assertion",
"to",
"an",
"XML",
"element",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Assertion.php#L1467-L1507 |
simplesamlphp/saml2 | src/SAML2/Assertion.php | Assertion.addConditions | private function addConditions(DOMElement $root) : void
{
$document = $root->ownerDocument;
$conditions = $document->createElementNS(Constants::NS_SAML, 'saml:Conditions');
$root->appendChild($conditions);
if ($this->notBefore !== null) {
$conditions->setAttribute('NotB... | php | private function addConditions(DOMElement $root) : void
{
$document = $root->ownerDocument;
$conditions = $document->createElementNS(Constants::NS_SAML, 'saml:Conditions');
$root->appendChild($conditions);
if ($this->notBefore !== null) {
$conditions->setAttribute('NotB... | [
"private",
"function",
"addConditions",
"(",
"DOMElement",
"$",
"root",
")",
":",
"void",
"{",
"$",
"document",
"=",
"$",
"root",
"->",
"ownerDocument",
";",
"$",
"conditions",
"=",
"$",
"document",
"->",
"createElementNS",
"(",
"Constants",
"::",
"NS_SAML",... | Add a Conditions-node to the assertion.
@param \DOMElement $root The assertion element we should add the conditions to.
@return void | [
"Add",
"a",
"Conditions",
"-",
"node",
"to",
"the",
"assertion",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Assertion.php#L1547-L1567 |
simplesamlphp/saml2 | src/SAML2/Assertion.php | Assertion.addAuthnStatement | private function addAuthnStatement(DOMElement $root) : void
{
if ($this->authnInstant === null ||
(
$this->authnContextClassRef === null &&
$this->authnContextDecl === null &&
$this->authnContextDeclRef === null
)
) {
... | php | private function addAuthnStatement(DOMElement $root) : void
{
if ($this->authnInstant === null ||
(
$this->authnContextClassRef === null &&
$this->authnContextDecl === null &&
$this->authnContextDeclRef === null
)
) {
... | [
"private",
"function",
"addAuthnStatement",
"(",
"DOMElement",
"$",
"root",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"authnInstant",
"===",
"null",
"||",
"(",
"$",
"this",
"->",
"authnContextClassRef",
"===",
"null",
"&&",
"$",
"this",
"->",
... | Add a AuthnStatement-node to the assertion.
@param \DOMElement $root The assertion element we should add the authentication statement to.
@return void | [
"Add",
"a",
"AuthnStatement",
"-",
"node",
"to",
"the",
"assertion",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Assertion.php#L1576-L1637 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.