bnomei/kirby3-cloudconvert

View on GitHub

Showing 7 of 7 total issues

Function convert has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public static function convert(array $options, string $outputPath = null, $async = null)
    {
        $convert = option('bnomei.cloudconvert.convert');

        $ao = option('bnomei.cloudconvert.async');
Severity: Minor
Found in classes/CloudConvert.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

Method convert has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function convert(array $options, string $outputPath = null, $async = null)
    {
        $convert = option('bnomei.cloudconvert.convert');

        $ao = option('bnomei.cloudconvert.async');
Severity: Major
Found in classes/CloudConvert.php - About 2 hrs to fix

    Function callback has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function callback(string $id, string $url)
        {
            if ($options = static::cache()->get($id)) {
                $status = json_decode(Remote::get('http:' . $url)->content(), true);
                if ($output = A::get($status, 'output')) {
    Severity: Minor
    Found in classes/CloudConvert.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 createFile has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        private static function createFile(array $options, string $outputPath)
        {
            if ($uid = A::get($options, 'kirby.page')) {
                if ($page = page($uid)) {
                    $tmp = A::get($options, 'kirby.tmp', $outputPath);
    Severity: Minor
    Found in classes/CloudConvert.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

    Avoid too many return statements within this method.
    Open

            return null;
    Severity: Major
    Found in classes/CloudConvert.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  return $process;
      Severity: Major
      Found in classes/CloudConvert.php - About 30 mins to fix

        Function api has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            private static function api()
            {
                $apikey = option('bnomei.cloudconvert.apikey');
                if ($apikey) {
                    if (is_callable($apikey)) {
        Severity: Minor
        Found in classes/CloudConvert.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