rostenkowski/imagestore

View on GitHub

Showing 6 of 6 total issues

ImageStorage has 27 functions (exceeds 20 allowed). Consider refactoring.
Open

class ImageStorage implements Storage
{

    /**
     * The directory to store the images in
Severity: Minor
Found in src/ImageStorage.php - About 3 hrs to fix

    File ImageStorage.php has 269 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace Rostenkowski\Resize;
    
    
    
    Severity: Minor
    Found in src/ImageStorage.php - About 2 hrs to fix

      Method crop has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function crop(Image $image, Request $request)
          {
              if ($request->getDimensions() === Request::ORIGINAL) {
      
                  return $image;
      Severity: Minor
      Found in src/ImageStorage.php - About 1 hr to fix

        Function crop has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            private function crop(Image $image, Request $request)
            {
                if ($request->getDimensions() === Request::ORIGINAL) {
        
                    return $image;
        Severity: Minor
        Found in src/ImageStorage.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 checkImage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            private function checkImage(Request $request)
            {
                $filename = $this->createCacheFilename($request);
        
                if (!file_exists($filename)) {
        Severity: Minor
        Found in src/ImageStorage.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 check has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            private function check($name, $tryCreateDirectories = true)
            {
                $exists = true;
                $isWritable = true;
        
        
        Severity: Minor
        Found in src/Directory/Directory.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