YetiForceCompany/YetiForcePDF

View on GitHub

Showing 287 of 15,735 total issues

Function getStyleWidth has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function getStyleWidth()
    {
        if (!$this->getBox()->isForMeasurement() && !$this->getBox()) {
            return '0';
        }
Severity: Minor
Found in lib/Layout/Dimensions/BoxDimensions.php - About 1 hr 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 getColumns has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function getColumns()
    {
        $columns = [];
        foreach ($this->getChildren() as $rowGroup) {
            foreach ($rowGroup->getChildren() as $row) {
Severity: Minor
Found in lib/Layout/TableBox.php - About 1 hr 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 loadImage has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function loadImage(string $fileName)
    {
        if ('data:image' === substr($fileName, 0, 10)) {
            $this->imageData = $this->convertToJpg($fileName);
        } elseif (filter_var($fileName, FILTER_VALIDATE_URL)) {
Severity: Minor
Found in lib/Objects/ImageStream.php - About 1 hr 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 addChild has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function addChild(self $child, self $after = null): self
    {
        $afterIndex = \count($this->children);
        if ($after) {
            foreach ($this->children as $afterIndex => $childObject) {
Severity: Minor
Found in lib/Objects/PdfObject.php - About 1 hr 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 renderResources has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function renderResources(): string
    {
        $rendered = [
            '  /Resources <<',
        ];
Severity: Minor
Found in lib/Page.php - About 1 hr 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 mergeLineGroups has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function mergeLineGroups(array $lineGroups)
    {
        $lines = [];
        foreach ($lineGroups as $lines) {
            if (!empty($lines)) {
Severity: Minor
Found in lib/Layout/BlockBox.php - About 1 hr 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 divideLines has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function divideLines()
    {
        $this->mergeLineGroups($this->groupLines());
        foreach ($this->getChildren() as $child) {
            if ($child instanceof LineBox) {
Severity: Minor
Found in lib/Layout/BlockBox.php - About 1 hr 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

Method parseFont has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function parseFont(array $rulesParsed)
    {
        $finalRules = [];
        foreach ($rulesParsed as $ruleName => $ruleValue) {
            if ('font' === substr($ruleName, 0, 4)) {
Severity: Minor
Found in lib/Style/Style.php - About 1 hr to fix

    Method clearMiddleInline has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function clearMiddleInline()
        {
            $box = $this->getBox();
            $leftSpace = $this->getFullLeftSpace();
            $dimensions = $box->getDimensions();
    Severity: Minor
    Found in lib/Style/Style.php - About 1 hr to fix

      Method getOuterHeight has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getOuterHeight()
          {
              $box = $this->getBox();
              if (!$box->isForMeasurement() && !$this->getBox()->getStyle()->haveSpacing()) {
                  return '0';
      Severity: Minor
      Found in lib/Layout/Dimensions/BoxDimensions.php - About 1 hr to fix

        Function loadFontData has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function loadFontData()
            {
                $fileName = $this->getFontFileName();
                $fileContent = file_get_contents($fileName);
                $font = \FontLib\Font::load($fileName);
        Severity: Minor
        Found in lib/Objects/Font.php - About 55 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 replacePageNumbers has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public function replacePageNumbers()
            {
                $allChildren = [];
                $this->getAllChildren($allChildren);
                foreach ($allChildren as $child) {
        Severity: Minor
        Found in lib/Layout/BlockBox.php - About 55 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 parseImage has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function parseImage(array $rulesParsed)
            {
                if ($element = $this->getElement()) {
                    if (($domElement = $element->getDOMElement()) && isset($domElement->tagName)) {
                        if ('img' === $domElement->tagName && $domElement->getAttribute('src')) {
        Severity: Minor
        Found in lib/Style/Style.php - About 55 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 parseFont has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function parseFont(array $rulesParsed)
            {
                $finalRules = [];
                foreach ($rulesParsed as $ruleName => $ruleValue) {
                    if ('font' === substr($ruleName, 0, 4)) {
        Severity: Minor
        Found in lib/Style/Style.php - About 55 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 getStyleHeight has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getStyleHeight()
            {
                if (!$this->getBox()->isForMeasurement()) {
                    return '0';
                }
        Severity: Minor
        Found in lib/Layout/Dimensions/BoxDimensions.php - About 55 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 getBoxesByType has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getBoxesByType(string $shortClassName, string $until = '')
            {
                $boxes = [];
                $untilWas = 0;
                $allChildren = [];
        Severity: Minor
        Found in lib/Layout/Box.php - About 55 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 parseInline has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public function parseInline()
            {
                $parsed = array_merge($this->getMandatoryRules(), $this->getDefaultRules());
                if ($this->content) {
                    $rules = explode(';', $this->content);
        Severity: Minor
        Found in lib/Style/Style.php - About 55 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 setRenderable has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function setRenderable(bool $renderable = true, bool $forceUpdate = false)
            {
                $changed = $this->renderable !== $renderable;
                if (!$this->renderable && $renderable) {
                    $this->restoreRenderableState();
        Severity: Minor
        Found in lib/Layout/Box.php - About 45 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 hideEmptyLines has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function hideEmptyLines()
            {
                foreach ($this->getChildren() as $child) {
                    if ($child instanceof LineBox) {
                        if ($child->isEmpty() && !$child->getStyle()->haveSpacing()) {
        Severity: Minor
        Found in lib/Layout/BlockBox.php - About 45 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 getFontFileName has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getFontFileName()
            {
                if (isset(static::$fontFiles[$this->family])) {
                    $match = $this->matchFont();
                    if (file_exists($this->fontDir . $match)) {
        Severity: Minor
        Found in lib/Objects/Font.php - About 45 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