Showing 85 of 140 total issues
Method __construct
has 13 arguments (exceeds 4 allowed). Consider refactoring. Open
string $id,
string $type,
string $url,
?string $name = null,
?string $latestReleasedVersion = null,
Method profile
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function profile(Request $request): Response
{
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED');
$oauthTokens = $this->userQuery->findAllOAuthTokens($this->getUser()->id());
Method buildForm
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('formUrl', HiddenType::class, [
'attr' => ['class' => 'addPackageFormUrl'],
Method packages
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function packages(string $organizationId, \DateTimeImmutable $till, int $limit = 100, int $offset = 0): array
{
return array_map(function (array $data): Package {
return new Package(
$data['type'],
Method __construct
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct(string $id, string $email, string $password, string $status, bool $emailConfirmed, string $emailConfirmToken, $roles, $organizations, bool $emailScanResult, string $timezone)
Method scan
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function scan(Package $package): void
{
$packageName = $package->name();
$result = [];
$status = ScanResult::STATUS_OK;
Method register
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function register(Request $request): Response
{
$this->ensureRegistrationIsEnabled();
$form = $this->createForm(RegisterType::class);
Method findDistribution
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function findDistribution(Package $package): string
{
$packageName = $package->name();
$latestReleasedVersion = $package->latestReleasedVersion();
Method __construct
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
string $type,
?\DateTimeImmutable $lastRelease,
?\DateTimeImmutable $lastSync,
?\DateTimeImmutable $lastScan,
bool $hasError,
Method getAdvisories
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getAdvisories(): array
{
$advisories = [];
foreach ($this->getDatabase() as $file) {
if (!$file->isFile() || $file->getExtension() !== 'yaml') {
Method getDetailsById
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getDetailsById(string $id): Option
{
$data = $this->connection->fetchAssociative(
'SELECT
id,
Method findAll
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function findAll(string $organizationId, int $limit = 20, int $offset = 0): array
{
return array_map(function (array $data): Package {
return $this->hydratePackage($data);
}, $this->connection->fetchAllAssociative(
Function syncSuccess
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function syncSuccess(string $name, string $description, string $latestReleasedVersion, array $encounteredVersions, array $encounteredLinks, \DateTimeImmutable $latestReleaseDate): void
{
$this->setName($name);
$this->description = $description;
$this->latestReleasedVersion = $latestReleasedVersion;
- 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
Function getAdvisories
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function getAdvisories(): array
{
$advisories = [];
foreach ($this->getDatabase() as $file) {
if (!$file->isFile() || $file->getExtension() !== 'yaml') {
- 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
Method organizations
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function organizations(int $limit = 100, int $offset = 0): array
{
return array_map(function (array $data): Organization {
return new Organization(
$data['id'],
Method getById
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getById(string $id): Option
{
$data = $this->connection->fetchAssociative(
'SELECT
id,
Method settings
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function settings(Organization $organization, Request $request): Response
{
$renameForm = $this->createForm(ChangeNameType::class, ['name' => $organization->name()]);
$renameForm->handleRequest($request);
if ($renameForm->isSubmitted() && $renameForm->isValid()) {
Method getById
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getById(string $organizationId, string $id): Option
{
$data = $this->connection->fetchAssociative(
'SELECT
id,
Function distribution
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function distribution(string $package, string $version, string $ref, string $format): Option
{
$path = $this->distPath($package, $ref, $format);
if (!$this->filesystem->has($path)) {
foreach ($this->decodeMetadata($package) as $packageData) {
- 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
Function download
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function download(string $package, string $version): void
{
$lastDist = null;
foreach ($this->decodeMetadata($package) as $packageData) {
- 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"