YetiForceCompany/YetiForcePDF

View on GitHub
lib/Objects/ImageStream.php

Summary

Maintainability
A
2 hrs
Test Coverage

Method loadImage has 29 lines of code (exceeds 25 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

    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

    Remove error control operator '@' on line 78.
    Open

        protected function convertToJpg(string $imageData)
        {
            if ('data:image' === substr($imageData, 0, 10)) {
                $matches = [];
                preg_match('/data:image\/[a-z]+;base64,(.*)/', $imageData, $matches);
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpmd

    ErrorControlOperator

    Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

    Example

    function foo($filePath) {
        $file = @fopen($filPath); // hides exceptions
        $key = @$array[$notExistingKey]; // assigns null to $key
    }

    Source http://phpmd.org/rules/cleancode.html#errorcontroloperator

    Missing class import via use statement (line '105', column '19').
    Open

                    $client = new \GuzzleHttp\Client();
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Avoid using static access to class '\YetiForcePDF\Math' in method 'loadImage'.
    Open

                Math::setAccurate(false);
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    The method loadImage uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                if (file_exists($fileName)) {
                    $this->imageData = $this->convertToJpg(file_get_contents($fileName));
                }
            }
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpmd

    ElseExpression

    Since: 1.4.0

    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

    Example

    class Foo
    {
        public function bar($flag)
        {
            if ($flag) {
                // one branch
            } else {
                // another branch
            }
        }
    }

    Source https://phpmd.org/rules/cleancode.html#elseexpression

    Avoid using static access to class '\YetiForcePDF\Math' in method 'loadImage'.
    Open

                Math::setAccurate(true);
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class '\Composer\CaBundle\CaBundle' in method 'loadImage'.
    Open

                    $res = $client->request('GET', $fileName, ['verify' => \Composer\CaBundle\CaBundle::getSystemCaRootBundlePath()]);
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class '\YetiForcePDF\Math' in method 'loadImage'.
    Open

                $this->ratio = Math::div($this->getWidth(), $this->getHeight());
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using empty try-catch blocks in loadImage.
    Open

                } catch (\Exception $e) {
                }
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpmd

    EmptyCatchBlock

    Since: 2.7.0

    Usually empty try-catch is a bad idea because you are silently swallowing an error condition and then continuing execution. Occasionally this may be the right thing to do, but often it's a sign that a developer saw an exception, didn't know what to do about it, and so used an empty catch to silence the problem.

    Example

    class Foo {
    
      public function bar()
      {
          try {
              // ...
          } catch (Exception $e) {} // empty catch block
      }
    }

    Source https://phpmd.org/rules/design.html#emptycatchblock

    Either remove or fill this block of code.
    Open

                } catch (\Exception $e) {
                }
    Severity: Major
    Found in lib/Objects/ImageStream.php by sonar-php

    Most of the time a block of code is empty when a piece of code is really missing. So such empty block must be either filled or removed.

    Noncompliant Code Example

    for ($i = 0; $i < 42; $i++){}  // Empty on purpose or missing piece of code ?
    

    Exceptions

    When a block contains a comment, this block is not considered to be empty.

    Avoid variables with short names like $bg. Configured minimum length is 3.
    Open

            $bg = imagecreatetruecolor(imagesx($image), imagesy($image));
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpmd

    ShortVariable

    Since: 0.2

    Detects when a field, local, or parameter has a very short name.

    Example

    class Something {
        private $q = 15; // VIOLATION - Field
        public static function main( array $as ) { // VIOLATION - Formal
            $r = 20 + $this->q; // VIOLATION - Local
            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                $r += $this->q;
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#shortvariable

    Avoid variables with short names like $x. Configured minimum length is 3.
    Open

        protected $x = 0;
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpmd

    ShortVariable

    Since: 0.2

    Detects when a field, local, or parameter has a very short name.

    Example

    class Something {
        private $q = 15; // VIOLATION - Field
        public static function main( array $as ) { // VIOLATION - Formal
            $r = 20 + $this->q; // VIOLATION - Local
            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                $r += $this->q;
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#shortvariable

    Avoid variables with short names like $y. Configured minimum length is 3.
    Open

        protected $y = 0;
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpmd

    ShortVariable

    Since: 0.2

    Detects when a field, local, or parameter has a very short name.

    Example

    class Something {
        private $q = 15; // VIOLATION - Field
        public static function main( array $as ) { // VIOLATION - Formal
            $r = 20 + $this->q; // VIOLATION - Local
            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                $r += $this->q;
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#shortvariable

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @var string
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        protected $y = 0;
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @var string image original height
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            ob_start();
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $imageString = ob_get_contents();
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                Math::setAccurate(false);
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        protected $imageData = '';
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @return string
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                preg_match('/data:image\/[a-z]+;base64,(.*)/', $imageData, $matches);
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            imagealphablending($bg, true);
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    $res = $client->request('GET', $fileName, ['verify' => \Composer\CaBundle\CaBundle::getSystemCaRootBundlePath()]);
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $this->displayHeight = $this->height;
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if ('data:image' === substr($imageData, 0, 10)) {
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            imagefill($bg, 0, 0, imagecolorallocate($bg, 255, 255, 255));
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                try {
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        protected function convertToJpg(string $imageData)
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $image = @imagecreatefromstring($imageData);
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            imagejpeg($bg, null, 90);
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Line exceeds 120 characters; contains 130 characters
    Open

                    $res = $client->request('GET', $fileName, ['verify' => \Composer\CaBundle\CaBundle::getSystemCaRootBundlePath()]);
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                        $res->getHeader('content-type');
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        protected $bitsPerComponent = 8;
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $this->imageData = $this->convertToJpg($fileName);
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    }
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $this->height = (string) $info[1];
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $this->displayWidth = $this->width;
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            return $this;
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        protected $ratio = '0';
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Convert images to jpeg.
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $matches = [];
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            } elseif (filter_var($fileName, FILTER_VALIDATE_URL)) {
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    $client = new \GuzzleHttp\Client();
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                        $this->imageData = $this->convertToJpg((string) $res->getBody());
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                } catch (\Exception $e) {
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    $this->imageData = $this->convertToJpg(file_get_contents($fileName));
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $this->bitsPerComponent = (string) $info['bits'];
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $this->ratio = Math::div($this->getWidth(), $this->getHeight());
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Width / Height ratio.
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @var int bits per component
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param string $fileName
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                }
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            } else {
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $this->width = (string) $info[0];
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @var int
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        protected $height = '0';
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $imageData = base64_decode($matches[1]);
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            return $imageString;
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Object name.
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    if (200 === $res->getStatusCode()) {
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        protected $width = '0';
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param string $imageData
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            ob_end_clean();
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Load image data.
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                if (file_exists($fileName)) {
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @var string Image data
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @var string image original width
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            imagecopy($bg, $image, 0, 0, 0, 0, imagesx($image), imagesy($image));
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            imagedestroy($bg);
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Text x position at current page.
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Text y position at current page.
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @var string
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @return $this
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $bg = imagecreatetruecolor(imagesx($image), imagesy($image));
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function loadImage(string $fileName)
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if ('data:image' === substr($fileName, 0, 10)) {
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @return string
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $stream = $this->imageData;
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                '  /Height ' . $this->height,
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $this->ratio = $ratio;
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $this->displayHeight = $displayHeight;
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                '  /ColorSpace  /DeviceRGB',
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            return $this;
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function getDisplayHeight()
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            imagedestroy($image);
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                }
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if ($this->imageData) {
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                Math::setAccurate(true);
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @return self
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @return string
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        protected $x = 0;
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @var int
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $info = getimagesizefromstring($this->imageData);
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            return $this->width;
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * {@inheritdoc}
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                '  /Type /XObject',
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @return string
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function getRatio()
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Set width / Height ratio.
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Set display height.
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            return $this;
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function getHeight()
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $this->getRawId() . ' obj',
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                '  /Subtype  /Image',
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                'endobj',
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        protected $name = 'ImageStream';
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            return 'Im' . $this->id;
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Get width / Height ratio.
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Get image name.
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                '  /BitsPerComponent ' . $this->bitsPerComponent,
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function setRatio(string $ratio)
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Get display width.
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @return self
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @return string
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function setDisplayHeight(string $displayHeight)
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function getImageName()
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function getWidth()
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                '  /Width ' . $this->width,
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                '  /Length  ' . \strlen($stream),
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param string $displayWidth Display width
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Get image height.
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function render(): string
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                '  /Filter /DCTDecode',
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                '>>',
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                'stream',
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $stream,
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function getDisplayWidth()
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @return string
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            return $this->ratio;
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            return $this->displayWidth;
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $this->displayWidth = $displayWidth;
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param string $displayHeight Display height
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @return self
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            return $this->height;
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                'endstream',
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function setDisplayWidth(string $displayWidth)
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Get display height.
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            return $this->displayHeight;
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @return string
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            return implode("\n", [
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param string $ratio Width / Height ratio.
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Set display width.
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Get image width.
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                '<<',
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            ]);
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            return $this;
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in lib/Objects/ImageStream.php by phpcodesniffer

    There are no issues that match your filters.

    Category
    Status