YetiForceCompany/YetiForcePDF

View on GitHub

Showing 155 of 15,735 total issues

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

    Function normalize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function normalize($ruleValue, string $ruleName = ''): array
        {
            if (null !== $this->normalized) {
                return $this->normalized;
            }
    Severity: Minor
    Found in lib/Style/Normalizer/Border.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

    Method addBorderInstructions has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        protected function addBorderInstructions(array $element, string $pdfX, string $pdfY, string $width, string $height)
    Severity: Minor
    Found in lib/Layout/Box.php - About 35 mins to fix

      Method addBackgroundImageInstructions has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public function addBackgroundImageInstructions(array $element, $pdfX, $pdfY, $width, $height)
      Severity: Minor
      Found in lib/Layout/BlockBox.php - About 35 mins to fix

        Method addBackgroundColorInstructions has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function addBackgroundColorInstructions(array $element, $pdfX, $pdfY, $width, $height)
        Severity: Minor
        Found in lib/Layout/InlineBox.php - About 35 mins to fix

          Method addBackgroundColorInstructions has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function addBackgroundColorInstructions(array $element, $pdfX, $pdfY, $width, $height)
          Severity: Minor
          Found in lib/Layout/BlockBox.php - About 35 mins to fix

            Method appendTableRowGroupBox has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public function appendTableRowGroupBox($childDomElement, $element, $style, $parentBlock, string $display)
            Severity: Minor
            Found in lib/Layout/TableBox.php - About 35 mins to fix

              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 render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function render(): string
                  {
                      if ($this->title) {
                          $this->addValue('Title', $this->document->filterText($this->title, 'UTF-16', true, true));
                      }
              Severity: Minor
              Found in lib/Objects/Meta.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

              Severity
              Category
              Status
              Source
              Language