Showing 23 of 27 total issues
Partner
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class Partner implements UserInterface, JWTUserInterface
{
/**
* Define an APi admin role (associated to a partner special account).
*/
HTTPCache
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class HTTPCache
{
/**
* Define which kind of HTTP cache is used for a particular response.
*/
Phone
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class Phone
{
/**
* Define a set of phones categories.
*/
Function loadSwaggerUI
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function loadSwaggerUI(userOptions = {}) {
const data = JSON.parse(document.getElementById('swagger-data').innerText);
const defaultOptions = {
spec: data.spec,
dom_id: '#swagger-ui',
Method apply
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function apply(Request $request, ParamConverter $configuration): bool
{
// Interrupt process if no uuid request attribute is found, or no special case matches!
if (null === $request->get('uuid') && !$this->setEntityUuidWithSpecialCase($request, $configuration)) {
return false;
Method loadValidatorMetadata
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function loadValidatorMetadata(ClassMetadata $metadata): void
{
$metadata->addConstraint(
new UniqueEntity([
'fields' => ['brand', 'model']
Method listClients
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function listClients(
FilterRequestHandler $requestHandler,
RepresentationBuilder $representationBuilder,
Request $request,
HTTPCache $httpCache
Method listPartners
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function listPartners(
FilterRequestHandler $requestHandler,
RepresentationBuilder $representationBuilder,
Request $request,
HTTPCache $httpCache
Method listOffersPerPhone
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function listOffersPerPhone(
FilterRequestHandler $requestHandler,
Phone $phone,
RepresentationBuilder $representationBuilder,
Request $request,
Method loadData
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function loadData(ObjectManager $manager): void
{
// Get existing companies sets
$data = DataProvider::PARTNER_COMPANY_SETS['references'];
// Use a row index per partner type (will be used for Proxy objects references)
Method listPhones
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function listPhones(
FilterRequestHandler $requestHandler,
RepresentationBuilder $representationBuilder,
Request $request,
HTTPCache $httpCache
Method loadData
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function loadData(ObjectManager $manager): void
{
// Get all existing phones models
$data = DataProvider::PHONE_MODELS['references'];
// Use a row index per phone brand (will be used for Proxy objects references)
Method listOffers
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function listOffers(
FilterRequestHandler $requestHandler,
RepresentationBuilder $representationBuilder,
Request $request,
HTTPCache $httpCache
Function invalidateHTTPCache
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
private function invalidateHTTPCache(UuidInterface $entityUuid, string $className, bool $isRemoval = false): void
{
/** @var HTTPCacheRepository $httpCacheRepository */
$httpCacheRepository = $this->entityManager->getRepository(HTTPCache::class);
$results = $httpCacheRepository->findBy(['classShortName' => self::ALLOWED_ENTITIES[$className]]);
- 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 onKernelRequest
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
public function onKernelRequest(RequestEvent $event): void
{
if (!$event->isMasterRequest()) {
return;
}
- 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 listPhonesPerPartner
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
FilterRequestHandler $requestHandler,
Partner $partner,
RepresentationBuilder $representationBuilder,
Request $request,
HTTPCache $httpCache
Method construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
DeserializationVisitorInterface $visitor,
ClassMetadata $metadata,
$data,
array $type,
DeserializationContext $context
Method createJson
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
?string $data,
int $statusCode = 200,
array $headers = [],
bool $isAlreadyJson = true,
int $httpCacheConfig = HTTPCache::NONE
Method listOffersPerPartner
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
FilterRequestHandler $requestHandler,
Partner $partner,
RepresentationBuilder $representationBuilder,
Request $request,
HTTPCache $httpCache
Method listOffersPerPhone
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
FilterRequestHandler $requestHandler,
Phone $phone,
RepresentationBuilder $representationBuilder,
Request $request,
HTTPCache $httpCache