BaguettePHP/mastodon-api

View on GitHub
src/Service/Toot.php

Summary

Maintainability
A
25 mins
Test Coverage

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

    public function __construct($toot_string, array $options)
    {
        v::stringType()->assert($toot_string);
        $this->toot_string = $toot_string;

Severity: Minor
Found in src/Service/Toot.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

Saw an @param annotation for scopes, but it was not found in the param list of function __construct($toot_string, array $options)
Open

     * @param string[] $scopes
Severity: Info
Found in src/Service/Toot.php by phan

Call to method intType from undeclared class \Respect\Validation\Validator
Open

            v::intType()->assert($options['in_reply_to_id']);
Severity: Critical
Found in src/Service/Toot.php by phan

Class uses undeclared trait \Teto\Object\PrivateGetter
Open

class Toot
Severity: Critical
Found in src/Service/Toot.php by phan

Cannot modify read-only magic property \Baguette\Mastodon\Service\toot->toot_string defined at src/Service/Toot.php:13
Open

        $this->toot_string = $toot_string;
Severity: Minor
Found in src/Service/Toot.php by phan

Call to method stringType from undeclared class \Respect\Validation\Validator
Open

        v::stringType()->assert($toot_string);
Severity: Critical
Found in src/Service/Toot.php by phan

Cannot modify read-only magic property \Baguette\Mastodon\Service\toot->visibility defined at src/Service/Toot.php:16
Open

            $this->visibility = $options['visibility'];
Severity: Minor
Found in src/Service/Toot.php by phan

Class uses undeclared trait \Teto\Object\ReadOnly
Open

class Toot
Severity: Critical
Found in src/Service/Toot.php by phan

Call to method bool from undeclared class \Respect\Validation\Validator
Open

            v::bool()->assert($options['senstitive']);
Severity: Critical
Found in src/Service/Toot.php by phan

Call to method in from undeclared class \Respect\Validation\Validator
Open

            v::in(Toot::$VISIBILITIES)->assert($options['visibility']);
Severity: Critical
Found in src/Service/Toot.php by phan

Reference to undeclared property \Baguette\Mastodon\Service\toot->senstitive (Did you mean expr->sensitive)
Open

            $this->senstitive = $options['senstitive'];
Severity: Minor
Found in src/Service/Toot.php by phan

Cannot modify read-only magic property \Baguette\Mastodon\Service\toot->media_ids defined at src/Service/Toot.php:14
Open

            $this->media_ids = $ids;
Severity: Minor
Found in src/Service/Toot.php by phan

Cannot modify read-only magic property \Baguette\Mastodon\Service\toot->in_reply_to_id defined at src/Service/Toot.php:15
Open

            $this->in_reply_to_id = $options['in_reply_to_id'];
Severity: Minor
Found in src/Service/Toot.php by phan

Call to method intType from undeclared class \Respect\Validation\Validator
Open

                v::intType()->assert($id);
Severity: Critical
Found in src/Service/Toot.php by phan

There are no issues that match your filters.

Category
Status