YetiForceCompany/YetiForcePDF

View on GitHub

Showing 155 of 15,735 total issues

Function getMinWidth has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

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

    public function groupLines()
    {
        $lineGroups = [];
        $currentGroup = 0;
        foreach ($this->getChildren() as $child) {
Severity: Minor
Found in lib/Layout/BlockBox.php - About 35 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 measureOffset has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function measureOffset(bool $afterPageDividing = false)
    {
        $rules = $this->getStyle()->getRules();
        $parent = $this->getParent();
        $top = $parent->getStyle()->getOffsetTop();
Severity: Minor
Found in lib/Layout/InlineBox.php - About 35 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 attachClasses has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function attachClasses()
    {
        if ($this->domElement instanceof \DOMElement && $this->domElement->hasAttribute('class')) {
            $classNames = [];
            foreach (explode(' ', $this->domElement->getAttribute('class')) as $className) {
Severity: Minor
Found in lib/Html/Element.php - About 35 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 measureWidth has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function measureWidth(bool $afterPageDividing = false)
    {
        if ($this->parentWidth === $this->getParent()->getParent()->getDimensions()->getWidth()) {
            return $this;
        }
Severity: Minor
Found in lib/Layout/TableBox.php - About 35 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 measureWidth has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function measureWidth(bool $afterPageDividing = false)
    {
        $style = $this->getStyle();
        if ($this->parentWidth === $this->getParent()->getDimensions()->getWidth() && null !== $this->getDimensions()->getWidth()) {
            if (!$this->isForMeasurement()) {
Severity: Minor
Found in lib/Layout/InlineBox.php - About 35 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 iterateChildren has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function iterateChildren(callable $fn, bool $reverse = false, bool $deep = true)
    {
        $allChildren = [];
        if ($deep) {
            $this->getAllChildren($allChildren);
Severity: Minor
Found in lib/Layout/Box.php - About 35 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 loadFromArray has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function loadFromArray(array $decoded)
    {
        if (!\is_array($decoded)) {
            throw new \ErrorException('Invalid fonts json structure.');
        }
Severity: Minor
Found in lib/Objects/Font.php - About 35 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 getChildrenWidth has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getChildrenWidth()
    {
        $width = '0';
        foreach ($this->getChildren() as $childBox) {
            if ($childBox->isForMeasurement()) {
Severity: Minor
Found in lib/Layout/LineBox.php - About 35 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 div has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function div(string ...$numbers)
    {
        if (!isset($numbers[2])) {
            if ((float) $numbers[0] !== (float) 0 && (float) $numbers[1] !== (float) 0) {
                return bcdiv($numbers[0], $numbers[1], static::$scale);
Severity: Minor
Found in lib/Math.php - About 35 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

Avoid too many return statements within this method.
Open

        return $this->getBox()->getChildrenWidth();
Severity: Major
Found in lib/Layout/Dimensions/BoxDimensions.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                    return Math::mul($this->getFont()->getSize()->getConverted(), $size);
    Severity: Major
    Found in lib/Style/Style.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return Math::add($this->getHeight(), $style->getHorizontalMarginsWidth());
      Severity: Major
      Found in lib/Layout/Dimensions/BoxDimensions.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                        return $size . '%'; // percent values are calculated later
        Severity: Major
        Found in lib/Style/Style.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                              return Math::mul($font->getSize()->getConverted(), $size);
          Severity: Major
          Found in lib/Style/Style.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return null;
            Severity: Major
            Found in lib/Layout/Dimensions/BoxDimensions.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return null;
              Severity: Major
              Found in lib/Layout/Dimensions/BoxDimensions.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                        return $this->finish();
                Severity: Major
                Found in lib/Layout/TableBox.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return static::$customFontFiles[$this->family][$weight][$style];
                  Severity: Major
                  Found in lib/Objects/Font.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                            return $this->fontDir . static::$fontFiles[static::$defaultFontFamily][$this->weight][$this->style];
                    Severity: Major
                    Found in lib/Objects/Font.php - About 30 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language