src/Service/Toot.php
Function __construct
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
public function __construct($toot_string, array $options)
{
v::stringType()->assert($toot_string);
$this->toot_string = $toot_string;
- Read upRead up
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
Cannot modify read-only magic property \Baguette\Mastodon\Service\toot->toot_string
defined at src/Service/Toot.php:13
Open
Open
$this->toot_string = $toot_string;
- Exclude checks
Call to method in
from undeclared class \Respect\Validation\Validator
Open
Open
v::in(Toot::$VISIBILITIES)->assert($options['visibility']);
- Exclude checks
Class uses undeclared trait \Teto\Object\PrivateGetter
Open
Open
class Toot
- Exclude checks
Call to method intType
from undeclared class \Respect\Validation\Validator
Open
Open
v::intType()->assert($id);
- Exclude checks
Cannot modify read-only magic property \Baguette\Mastodon\Service\toot->in_reply_to_id
defined at src/Service/Toot.php:15
Open
Open
$this->in_reply_to_id = $options['in_reply_to_id'];
- Exclude checks
Cannot modify read-only magic property \Baguette\Mastodon\Service\toot->visibility
defined at src/Service/Toot.php:16
Open
Open
$this->visibility = $options['visibility'];
- Exclude checks
Reference to undeclared property \Baguette\Mastodon\Service\toot->senstitive
(Did you mean expr->sensitive) Open
Open
$this->senstitive = $options['senstitive'];
- Exclude checks
Call to method stringType
from undeclared class \Respect\Validation\Validator
Open
Open
v::stringType()->assert($toot_string);
- Exclude checks
Saw an @param annotation for scopes,
but it was not found in the param list of function __construct($toot_string, array $options)
Open
Open
* @param string[] $scopes
- Exclude checks
Call to method bool
from undeclared class \Respect\Validation\Validator
Open
Open
v::bool()->assert($options['senstitive']);
- Exclude checks
Cannot modify read-only magic property \Baguette\Mastodon\Service\toot->media_ids
defined at src/Service/Toot.php:14
Open
Open
$this->media_ids = $ids;
- Exclude checks
Class uses undeclared trait \Teto\Object\ReadOnly
Open
Open
class Toot
- Exclude checks
Call to method intType
from undeclared class \Respect\Validation\Validator
Open
Open
v::intType()->assert($options['in_reply_to_id']);
- Exclude checks