Showing 325 of 325 total issues
File PptTheme.php
has 441 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* This file is part of PHPPresentation - A pure PHP library for reading and writing
* presentations documents.
*
Function writeShapeText
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
protected function writeShapeText(XMLWriter $objWriter, RichText $shape, int $shapeId): void
{
// p:sp
$objWriter->startElement('p:sp');
// p:sp\p:nvSpPr
- Read upRead up
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 writeTableStyle
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
protected function writeTableStyle(XMLWriter $objWriter, Table $shape): void
{
foreach ($shape->getRows() as $keyRow => $shapeRow) {
// style:style
$objWriter->startElement('style:style');
- Read upRead up
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
foreach ($richtexts as $richtext) {
++$richtextId;
if ($richtext instanceof TextElement) {
// text:span
$objWriter->startElement('text:span');
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 205.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
foreach ($richtexts as $richtext) {
++$richtextId;
if ($richtext instanceof TextElement) {
// text:span
$objWriter->startElement('text:span');
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 205.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method writeSlideAnimations
has 146 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function writeSlideAnimations(XMLWriter $objWriter, Slide $oSlide): void
{
$arrayAnimations = $oSlide->getAnimations();
if (empty($arrayAnimations)) {
return;
Function loadSlide
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
protected function loadSlide(string $sPart, string $baseFile): void
{
$xmlReader = new XMLReader();
// @phpstan-ignore-next-line
if ($xmlReader->getDomFromString($sPart)) {
- Read upRead up
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
Method render
has 138 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function render(): ZipInterface
{
// Create XML writer
$objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY);
Method writeShapeTable
has 137 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function writeShapeTable(XMLWriter $objWriter, ShapeTable $shape, int $shapeId): void
{
// p:graphicFrame
$objWriter->startElement('p:graphicFrame');
// p:graphicFrame/p:nvGraphicFramePr
Function writeShapeTable
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
protected function writeShapeTable(XMLWriter $objWriter, ShapeTable $shape, int $shapeId): void
{
// p:graphicFrame
$objWriter->startElement('p:graphicFrame');
// p:graphicFrame/p:nvGraphicFramePr
- Read upRead up
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 writeSeriesStyle
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
protected function writeSeriesStyle(Chart $chart, Chart\Series $series): void
{
$chartType = $chart->getPlotArea()->getType();
// style:style
- Read upRead up
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
Axis
has 40 functions (exceeds 20 allowed). Consider refactoring. Open
class Axis implements ComparableInterface
{
public const AXIS_X = 'x';
public const AXIS_Y = 'y';
Series
has 40 functions (exceeds 20 allowed). Consider refactoring. Open
class Series implements ComparableInterface
{
// Label positions
public const LABEL_BESTFIT = 'bestFit';
public const LABEL_BOTTOM = 'b';
Method writeNote
has 131 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function writeNote(Note $pNote): string
{
// Create XML writer
$objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY);
Method readStructureTextPFRun
has 130 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function readStructureTextPFRun(string $stream, int $pos, int $strLenRT): array
{
$arrayReturn = [
'length' => 0,
'strLenRT' => $strLenRT,
Function loadShapeRichText
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
protected function loadShapeRichText(XMLReader $document, DOMElement $node, $oSlide): void
{
// Core
$oShape = $oSlide->createRichTextShape();
$oShape->setParagraphs([]);
- Read upRead up
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
Method writeShapeText
has 126 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function writeShapeText(XMLWriter $objWriter, RichText $shape, int $shapeId): void
{
// p:sp
$objWriter->startElement('p:sp');
// p:sp\p:nvSpPr
Method loadShapeTable
has 124 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function loadShapeTable(XMLReader $document, DOMElement $node, AbstractSlide $oSlide): void
{
$this->fileRels = $oSlide->getRelsIndex();
$oShape = $oSlide->createTableShape();
Function loadShadow
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
protected function loadShadow(XMLReader $document, DOMElement $node): ?Shadow
{
if ($node instanceof DOMElement) {
$aNodes = $document->getElements('*', $node);
foreach ($aNodes as $nodeShadow) {
- Read upRead up
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
Font
has 37 functions (exceeds 20 allowed). Consider refactoring. Open
class Font implements ComparableInterface
{
// Capitalization type
public const CAPITALIZATION_NONE = 'none';
public const CAPITALIZATION_SMALL = 'small';