ptejada/darkroom

View on GitHub

Showing 17 of 17 total issues

Function newAspectSize has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    protected function newAspectSize()
    {
        $image = $this->editor->image();

        $max_width  = $this->width;
Severity: Minor
Found in src/Tool/Resize.php - About 3 hrs 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 calcOffset has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    protected function calcOffset($position)
    {
        if (is_array($position) && count($position) > 1) {
            return [(int) $position[0], (int) $position[1]];
        }
Severity: Minor
Found in src/Utility/Position.php - About 2 hrs 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 basePath has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    protected function basePath()
    {
        if (empty($this->basePath)) {
            if (empty($_SERVER["DOCUMENT_ROOT"])) {
                if ($root = $this->findProjectRoot()) {
Severity: Minor
Found in src/Storage/Store.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 newPath has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function newPath(Image $image, $altName = null)
    {
        $triesLeft = 5;
        do {
            if (is_callable($this->pathGenerator)) {
Severity: Minor
Found in src/Storage/Store.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 execute has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    protected function execute()
    {
        if ($this->stamp && !empty($this->placements)) {
            $baseImage = $this->editor->image();
            $stamp     = $this->stamp;
Severity: Minor
Found in src/Tool/Stamp.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 execute has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function execute()
    {
        $image = $this->editor->image();

        if (!$this->height && !$this->width && $this->decimalPercent) {
Severity: Minor
Found in src/Tool/Resize.php - About 1 hr to fix

    Method newAspectSize has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function newAspectSize()
        {
            $image = $this->editor->image();
    
            $max_width  = $this->width;
    Severity: Minor
    Found in src/Tool/Resize.php - About 1 hr to fix

      Method newPath has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function newPath(Image $image, $altName = null)
          {
              $triesLeft = 5;
              do {
                  if (is_callable($this->pathGenerator)) {
      Severity: Minor
      Found in src/Storage/Store.php - About 1 hr to fix

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

            public function __construct(File $file)
            {
                $this->file = $file;
                if (! $file->exists()) {
                    throw new \InvalidArgumentException('Cannot open file: ' . $file->filePath());
        Severity: Minor
        Found in src/Image.php - About 1 hr to fix

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

              protected function calcOffset($position)
              {
                  if (is_array($position) && count($position) > 1) {
                      return [(int) $position[0], (int) $position[1]];
                  }
          Severity: Minor
          Found in src/Utility/Position.php - About 1 hr to fix

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

                public function offsetFor($position)
                {
                    list($positionX, $positionY) = $this->calcOffset($position);
                    list($anchorX, $anchorY) = $this->element_anchor;
            
            
            Severity: Minor
            Found in src/Utility/Position.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 execute has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function execute()
                {
                    $image = $this->editor->image();
            
                    if (!$this->height && !$this->width && $this->decimalPercent) {
            Severity: Minor
            Found in src/Tool/Resize.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 color has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public function color($image)
                {
                    if (is_resource($image)) {
                        $resource = $image;
                    } else {
            Severity: Minor
            Found in src/Utility/Color.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 toRgb has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function toRgb($hexColor, $transparency = 1.0)
                {
                    $hexColor = strtolower($hexColor);
            
                    if ($transparency > 1) {
            Severity: Minor
            Found in src/Utility/Color.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 execute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function execute()
                {
                    if ($this->angle) {
                        $image = $this->editor->image()->resource();
            
            
            Severity: Minor
            Found in src/Tool/Rotate.php - About 25 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 __construct has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                public function __construct($redOrHex, $green = null, $blue = null, $alpha = 0)
                {
                    if (is_null($green) && is_null($blue)) {
                        if (is_array($redOrHex)) {
                            $this->rgbColor = [
            Severity: Minor
            Found in src/Utility/Color.php - About 25 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 __construct has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                public function __construct(File $file)
                {
                    $this->file = $file;
                    if (! $file->exists()) {
                        throw new \InvalidArgumentException('Cannot open file: ' . $file->filePath());
            Severity: Minor
            Found in src/Image.php - About 25 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