Showing 325 of 325 total issues
Method writeSlideTransition
has 235 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function writeSlideTransition(XMLWriter $objWriter, ?Slide\Transition $transition): void
{
if (!$transition) {
return;
}
Method loadStyle
has 230 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function loadStyle(DOMElement $nodeStyle): bool
{
$keyStyle = $nodeStyle->getAttribute('style:name');
$nodeDrawingPageProps = $this->oXMLReader->getElement('style:drawing-page-properties', $nodeStyle);
Function writeStyleSlide
has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring. Open
protected function writeStyleSlide(XMLWriter $objWriter, Slide $slide, int $incPage): void
{
// style:style
$objWriter->startElement('style:style');
$objWriter->writeAttribute('style:family', 'drawing-page');
- 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 readRecordDocumentContainer
has 223 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function readRecordDocumentContainer(string $stream, int $pos): void
{
$documentAtom = $this->loadRecordHeader($stream, $pos);
$pos += 8;
if (0x1 != $documentAtom['recVer'] || 0x000 != $documentAtom['recInstance'] || self::RT_DOCUMENTATOM != $documentAtom['recType']) {
PowerPoint97
has 61 functions (exceeds 20 allowed). Consider refactoring. Open
class PowerPoint97 implements ReaderInterface
{
public const OFFICEARTBLIPEMF = 0xF01A;
public const OFFICEARTBLIPWMF = 0xF01B;
public const OFFICEARTBLIPPICT = 0xF01C;
Function writeShapeTable
has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring. Open
protected function writeShapeTable(XMLWriter $objWriter, Table $shape): void
{
// draw:frame
$objWriter->startElement('draw:frame');
$objWriter->writeAttribute('svg:x', Text::numberFormat(CommonDrawing::pixelsToCentimeters((int) $shape->getOffsetX()), 3) . 'cm');
- 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 readRecordOfficeArtSpContainer
has 199 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function readRecordOfficeArtSpContainer(string $stream, int $pos)
{
$arrayReturn = [
'length' => 0,
'shape' => null,
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ($subShape instanceof ShapeTable) {
// Rows
$countRows = count($subShape->getRows());
for ($row = 0; $row < $countRows; ++$row) {
// Cells in rows
- 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 244.
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ($shape instanceof ShapeTable) {
// Rows
$countRows = count($shape->getRows());
for ($row = 0; $row < $countRows; ++$row) {
// Cells in rows
- 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 244.
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
Function writeSlideTransition
has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring. Open
protected function writeSlideTransition(XMLWriter $objWriter, ?Slide\Transition $transition): void
{
if (!$transition) {
return;
}
- 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 writeAxis
has 187 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function writeAxis(XMLWriter $objWriter, Chart\Axis $oAxis, string $typeAxis, Chart\Type\AbstractType $typeChart): void
{
if (Chart\Axis::AXIS_X != $typeAxis && Chart\Axis::AXIS_Y != $typeAxis) {
return;
}
Method writeSlideRelationships
has 182 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function writeSlideRelationships(Slide $pSlide): string
{
//@todo Group all getShapeCollection()->getIterator
// Create XML writer
Method writeStyleSlide
has 179 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function writeStyleSlide(XMLWriter $objWriter, Slide $slide, int $incPage): void
{
// style:style
$objWriter->startElement('style:style');
$objWriter->writeAttribute('style:family', 'drawing-page');
Function displayShapeInfo
has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring. Open
protected function displayShapeInfo(AbstractShape $oShape): void
{
$this->append('<div class="infoBlk" id="div' . $oShape->getHashCode() . 'Info">');
$this->append('<dl>');
$this->append('<dt>HashCode</dt><dd>' . $oShape->getHashCode() . '</dd>');
- 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
File Sample_Header.php
has 449 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Header file.
*/
use PhpOffice\PhpPresentation\AbstractShape;
Function loadShapeDrawing
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
protected function loadShapeDrawing(XMLReader $document, DOMElement $node, AbstractSlide $oSlide): void
{
// Core
$document->registerNamespace('asvg', 'http://schemas.microsoft.com/office/drawing/2016/SVG/main');
if ($document->getElement('p:blipFill/a:blip/a:extLst/a:ext/asvg:svgBlip', $node)) {
- 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 readRecordOfficeArtFOPT
has 168 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function readRecordOfficeArtFOPT(string $stream, int $pos): array
{
$arrayReturn = [
'length' => 0,
];
File PptSlides.php
has 445 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.
*
RichText
has 48 functions (exceeds 20 allowed). Consider refactoring. Open
class RichText extends AbstractShape implements ComparableInterface
{
/** Wrapping */
public const WRAP_NONE = 'none';
public const WRAP_SQUARE = 'square';
Method loadParagraph
has 166 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function loadParagraph(XMLReader $document, DOMElement $oElement, $oShape): void
{
// Core
$oParagraph = $oShape->createParagraph();
$oParagraph->setRichTextElements([]);