PHPOffice/PHPPresentation

View on GitHub

Showing 284 of 325 total issues

Function setCustomProperty has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function setCustomProperty(string $propertyName, $propertyValue = '', ?string $propertyType = null): self
    {
        if (!in_array($propertyType, [
            self::PROPERTY_TYPE_INTEGER,
            self::PROPERTY_TYPE_FLOAT,
Severity: Minor
Found in src/PhpPresentation/DocumentProperties.php - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function readRecordUserEditAtom has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function readRecordUserEditAtom(string $stream, int $pos): void
    {
        $rHeader = $this->loadRecordHeader($stream, $pos);
        $pos += 8;
        if (0x0 != $rHeader['recVer'] || 0x000 != $rHeader['recInstance'] || self::RT_USEREDITATOM != $rHeader['recType'] || (0x0000001C != $rHeader['recLen'] && 0x00000020 != $rHeader['recLen'])) {
Severity: Minor
Found in src/PhpPresentation/Reader/PowerPoint97.php - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function loadPowerpointDocumentStream has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function loadPowerpointDocumentStream(): void
    {
        $this->readRecordUserEditAtom($this->streamPowerpointDocument, $this->offsetToCurrentEdit);

        $this->readRecordPersistDirectoryAtom($this->streamPowerpointDocument, $this->offsetPersistDirectory);
Severity: Minor
Found in src/PhpPresentation/Reader/PowerPoint97.php - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function readStructureTextSIRun has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function readStructureTextSIRun(string $stream, int $pos, int $strLenRT): array
    {
        $arrayReturn = [
            'length' => 0,
            'strLenRT' => $strLenRT,
Severity: Minor
Found in src/PhpPresentation/Reader/PowerPoint97.php - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Severity
Category
Status
Source
Language