rogervila/provably-fair

View on GitHub

Showing 34 of 34 total issues

The parameter $available_algorithms is not named in camelCase.
Open

    public function __construct(
        public readonly string $value,
        ?array $available_algorithms = null,
    ) {
        if (!in_array($this->value, $available_algorithms ?? hash_hmac_algos())) {
Severity: Minor
Found in src/Algorithm.php by phpmd

CamelCaseParameterName

Since: 0.2

It is considered best practice to use the camelCase notation to name parameters.

Example

class ClassName {
    public function doSomething($user_name) {
    }
}

Source

The parameter $include_original is not named in camelCase.
Open

    public function generate(int $amount, bool $include_original = false): array;

CamelCaseParameterName

Since: 0.2

It is considered best practice to use the camelCase notation to name parameters.

Example

class ClassName {
    public function doSomething($user_name) {
    }
}

Source

The parameter $include_original is not named in camelCase.
Open

    public function generate(int $amount, bool $include_original = false): array
    {
        $serverSeed = $this->serverSeed;
        $results = $include_original
            ? [new Result(
Severity: Minor
Found in src/ProvablyFair.php by phpmd

CamelCaseParameterName

Since: 0.2

It is considered best practice to use the camelCase notation to name parameters.

Example

class ClassName {
    public function doSomething($user_name) {
    }
}

Source

The method generate has a boolean flag argument $include_original, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function generate(int $amount, bool $include_original = false): array;

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

The method generate has a boolean flag argument $include_original, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function generate(int $amount, bool $include_original = false): array
Severity: Minor
Found in src/ProvablyFair.php by phpmd

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

Line exceeds 120 characters; contains 197 characters
Open

                            <option <?php echo $available_algorithm === $algorithm->value ? 'selected' : '' ?> value="<?php echo $available_algorithm ?>"><?php echo $available_algorithm ?></option>
Severity: Minor
Found in index.php by phpcodesniffer

Line exceeds 120 characters; contains 214 characters
Open

    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/css/bootstrap.min.css" integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi" crossorigin="anonymous">
Severity: Minor
Found in index.php by phpcodesniffer

Line exceeds 120 characters; contains 155 characters
Open

                    <input class="form-control" id="server" autocomplete="off" type="text" name="server" value="<?php echo $serverSeed->value ?>" required>
Severity: Minor
Found in index.php by phpcodesniffer

Line exceeds 120 characters; contains 144 characters
Open

                  <input class="form-check-input" type="checkbox" id="prepend" name="prepend" <?php echo $prepend === true ? 'checked' : '' ?> >
Severity: Minor
Found in index.php by phpcodesniffer

Line exceeds 120 characters; contains 154 characters
Open

                    <input class="form-control" id="amount" autocomplete="off" type="number" min="0" name="amount" value="<?php echo $amount ?>" required>
Severity: Minor
Found in index.php by phpcodesniffer

Line exceeds 120 characters; contains 155 characters
Open

                    <input class="form-control" id="client" autocomplete="off" type="text" name="client" value="<?php echo $clientSeed->value ?>" required>
Severity: Minor
Found in index.php by phpcodesniffer

Line indented incorrectly; expected 4 spaces, found 8
Open

        public readonly SeedInterface $clientSeed,
Severity: Minor
Found in src/ProvablyFair.php by phpcodesniffer

Expected 1 space after closing parenthesis; found 0
Open

            <?php foreach ($results as $result): ?>
Severity: Minor
Found in index.php by phpcodesniffer

Expected 1 space after closing parenthesis; found 0
Open

                        <?php foreach (hash_hmac_algos() as $available_algorithm): ?>
Severity: Minor
Found in index.php by phpcodesniffer

Line indented incorrectly; expected 4 spaces, found 8
Open

        public readonly string $value,
Severity: Minor
Found in src/Algorithm.php by phpcodesniffer

Line indented incorrectly; expected 4 spaces, found 8
Open

        public readonly SeedInterface $serverSeed,
Severity: Minor
Found in src/ProvablyFair.php by phpcodesniffer

Line indented incorrectly; expected 4 spaces, found 8
Open

        public readonly AlgorithmInterface $algorithm
Severity: Minor
Found in src/System.php by phpcodesniffer

Line indented incorrectly; expected 4 spaces, found 8
Open

        public readonly AlgorithmInterface $algorithm,
Severity: Minor
Found in src/ProvablyFair.php by phpcodesniffer

Line indented incorrectly; expected 4 spaces, found 8
Open

        public readonly string $hash,
Severity: Minor
Found in src/Result.php by phpcodesniffer

Line indented incorrectly; expected 4 spaces, found 8
Open

        public readonly string $value,
Severity: Minor
Found in src/Result.php by phpcodesniffer
Severity
Category
Status
Source
Language