nodes-php/assets

View on GitHub

Showing 6 of 10 total issues

Method addFromUrl has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function addFromUrl($url, $folder, Settings $settings)
    {
        // Stream file from URL
        $streamContextOptions = [
            'ssl' => [
Severity: Minor
Found in src/Upload/AbstractUploadProvider.php - About 1 hr to fix

    Function assets_resize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        function assets_resize($url, $width = false, $height = false)
        {
            // Validate the url
            if (! filter_var($url, FILTER_VALIDATE_URL)) {
                return $url;
    Severity: Minor
    Found in src/Support/Helpers/URL.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 cache has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public function cache($path, $width, $height, $mode)
        {
            if (empty($width) && empty($height)) {
                $path = $this->getFullPath($path);
    
    
    Severity: Minor
    Found in src/Support/PublicFolderCache.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 __construct has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function __construct(array $nodesConfig)
        {
            $this->nodesConfig = $nodesConfig;
    
            // Check cloudfrontUrl
    Severity: Minor
    Found in src/Url/Providers/NodesCdn.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 add has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function add($file, $folder = null, UploadSettings $settings = null)
        {
            // Make sure we actually have data to work with
            if (empty($file)) {
                return;
    Severity: Minor
    Found in src/Manager.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(array $config)
        {
            $this->config = $config;
    
            // Check cloudfrontUrl
    Severity: Minor
    Found in src/Url/Providers/VaporCloud.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