takeawaytown/laravel-uuid

View on GitHub

Showing 109 of 109 total issues

Possibly zero references to use statement for classlike/namespace Config (\Illuminate\Support\Facades\Config)
Open

use Illuminate\Support\Facades\Config;
Severity: Minor
Found in src/Classes/Uuid.php by phan

Call to undeclared function \config()
Confirmed

        $ver = $ver !== null ? $ver : config('uuid.default_version');
Severity: Critical
Found in src/Classes/Uuid.php by phan

Call to undeclared function \config()
Confirmed

        $node = $node !== null ? $node : config('uuid.default_node');
Severity: Critical
Found in src/Classes/Uuid.php by phan

Suspicious array access to ?string
Open

        $uuid[8] = chr(ord($uuid[8]) & static::CLEAR_VAR | static::VAR_RFC);
Severity: Minor
Found in src/Classes/Uuid.php by phan

Call to undeclared method \TakeawayTown\LaravelUuid\Providers\UuidServiceProvider::publishes
Open

      $this->publishes([
Severity: Critical
Found in src/Providers/UuidServiceProvider.php by phan

Call to undeclared function \config()
Open

      if (!$model->{config('uuid.uuid_column')}) {
Severity: Critical
Found in src/Traits/Uuid.php by phan

Reduce the number of returns of this function 4, down to the maximum allowed 3.
Open

    public static function generate($ver = null, $node = null, $namespace = null)
Severity: Major
Found in src/Classes/Uuid.php by sonar-php

Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.

Noncompliant Code Example

With the default threshold of 3:

function myFunction(){ // Noncompliant as there are 4 return statements
  if (condition1) {
    return true;
  } else {
    if (condition2) {
      return false;
    } else {
      return true;
    }
  }
  return false;
}

Reference to undeclared property \TakeawayTown\LaravelUuid\Classes\Uuid->bytes
Open

        $this->bytes = $uuid;
Severity: Minor
Found in src/Classes/Uuid.php by phan

Call to method __construct from undeclared class \TakeawayTown\LaravelUuid\Classes\UnexpectedValueException (Did you mean class \UnexpectedValueException)
Open

                throw new UnexpectedValueException('Version ' . $ver . ' is unsupported.');
Severity: Critical
Found in src/Classes/Uuid.php by phan

Class extends undeclared class \Illuminate\Support\ServiceProvider
Open

class UuidServiceProvider extends ServiceProvider
Severity: Critical
Found in src/Providers/UuidServiceProvider.php by phan

Reference to parent from trait \TakeawayTown\LaravelUuid\Classes\Uuid,1
Open

    parent::boot();
Severity: Info
Found in src/Traits/Uuid.php by phan

Possibly zero references to use statement for classlike/namespace UuidServiceProvider (\TakeawayTown\LaravelUuid\Providers\UuidServiceProvider)
Open

use TakeawayTown\LaravelUuid\Providers\UuidServiceProvider;
Severity: Minor
Found in src/Classes/Uuid.php by phan

Call to method __construct from undeclared class \TakeawayTown\LaravelUuid\Classes\InvalidArgumentException (Did you mean class \InvalidArgumentException)
Open

            throw new InvalidArgumentException('A binary namespace is required for Version 3 or 5 UUIDs.');
Severity: Critical
Found in src/Classes/Uuid.php by phan

Call to method where on non-class type string
Open

    $results = $query->where(config('uuid.uuid_column'), $uuid);
Severity: Critical
Found in src/Traits/Uuid.php by phan

Trait \TakeawayTown\LaravelUuid\Classes\Uuid defined at /code/src/Traits/Uuid.php:8 was previously defined as Class \TakeawayTown\LaravelUuid\Classes\Uuid at /code/src/Classes/Uuid.php:13
Open

trait Uuid
Severity: Minor
Found in src/Traits/Uuid.php by phan

Call to undeclared function \config()
Open

        $model->{config('uuid.uuid_column')} = strtoupper(Uuid::generate()->string);
Severity: Critical
Found in src/Traits/Uuid.php by phan

Call to undeclared function \config()
Open

      if ($uuid !== $model->{config('uuid.uuid_column')}) {
Severity: Critical
Found in src/Traits/Uuid.php by phan

Reduce the number of returns of this function 14, down to the maximum allowed 3.
Open

    public function __get($var)
Severity: Major
Found in src/Classes/Uuid.php by sonar-php

Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.

Noncompliant Code Example

With the default threshold of 3:

function myFunction(){ // Noncompliant as there are 4 return statements
  if (condition1) {
    return true;
  } else {
    if (condition2) {
      return false;
    } else {
      return true;
    }
  }
  return false;
}

Call to method __construct from undeclared class \TakeawayTown\LaravelUuid\Classes\InvalidArgumentException (Did you mean class \InvalidArgumentException)
Open

            throw new InvalidArgumentException('A name-string is required for Version 3 or 5 UUIDs.');
Severity: Critical
Found in src/Classes/Uuid.php by phan

Argument 2 (raw_output) is 1 but \sha1() takes bool
Open

                $uuid = substr(sha1($namespace . $node, 1), 0, 16);
Severity: Minor
Found in src/Classes/Uuid.php by phan
Severity
Category
Status
Source
Language