Showing 52 of 52 total issues
StripeLocalCharge
has 54 functions (exceeds 20 allowed). Consider refactoring. Open
class StripeLocalCharge implements StripeLocalResourceInterface
{
/** @var array<array-key, string> Properties of the Model that may not be present in the SDK model: these must be ignored when populating the local model */
public const IGNORE = [
// This is an optional parameter required when creating a charge and not returned by the SDK
StripeLocalCard
has 42 functions (exceeds 20 allowed). Consider refactoring. Open
class StripeLocalCard implements StripeLocalResourceInterface
{
/** @var array<array-key, string> Properties of the Model that may not be present in the SDK model: these must be ignored when populating the local model */
public const IGNORE = [
// This is used internally to save the error returned by the API when calling it
Method guess
has 116 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function guess(Event $stripeEvent, StripeLocalWebhookEvent $localEventEntity): array
{
$pieces = $this->guessEventPieces($stripeEvent->type);
switch ($pieces['kind']) {
Function syncLocalFromStripe
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
public function syncLocalFromStripe(StripeLocalResourceInterface $localResource, ApiResource $stripeResource): void
{
/** @var StripeLocalCharge $localResource */
if ( ! $localResource instanceof StripeLocalCharge) {
throw new \InvalidArgumentException('ChargeSyncer::syncLocalFromStripe() accepts only StripeLocalCharge objects as first parameter.');
- 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
StripeLocalCustomer
has 33 functions (exceeds 20 allowed). Consider refactoring. Open
class StripeLocalCustomer implements StripeLocalResourceInterface
{
/** @var array<array-key, string> Properties of the Model that may not be present in the SDK model: these must be ignored when populating the local model */
public const IGNORE = [
// This is required by Doctrine to create the relation between Card and Charges
Function syncLocalFromStripe
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
public function syncLocalFromStripe(StripeLocalResourceInterface $localResource, ApiResource $stripeResource): void
{
/** @var StripeLocalCard $localResource */
if ( ! $localResource instanceof StripeLocalCard) {
throw new \InvalidArgumentException('CardSyncer::hydrateLocal() accepts only StripeLocalCard objects as first parameter');
- 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 syncLocalFromStripe
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function syncLocalFromStripe(StripeLocalResourceInterface $localResource, ApiResource $stripeResource): void
{
/** @var StripeLocalCharge $localResource */
if ( ! $localResource instanceof StripeLocalCharge) {
throw new \InvalidArgumentException('ChargeSyncer::syncLocalFromStripe() accepts only StripeLocalCharge objects as first parameter.');
File StripeLocalCharge.php
has 316 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
/*
Method syncLocalFromStripe
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function syncLocalFromStripe(StripeLocalResourceInterface $localResource, ApiResource $stripeResource): void
{
/** @var StripeLocalCard $localResource */
if ( ! $localResource instanceof StripeLocalCard) {
throw new \InvalidArgumentException('CardSyncer::hydrateLocal() accepts only StripeLocalCard objects as first parameter');
File CheckCommand.php
has 290 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
/*
Function syncLocalFromStripe
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function syncLocalFromStripe(StripeLocalResourceInterface $localResource, ApiResource $stripeResource): void
{
/** @var StripeLocalCustomer $localResource */
if ( ! $localResource instanceof StripeLocalWebhookEvent) {
throw new \InvalidArgumentException('WebhookEventSyncer::syncLocalFromStripe() accepts only StripeLocalWebhookEvent objects as first parameter.');
- 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 compareLocalPropertiesWithMappedOnes
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
private function compareLocalPropertiesWithMappedOnes(string $localModelClass, array $propertiesToCompare): array
{
$failures = [];
foreach ($propertiesToCompare as $propertyToCompare) {
$localPropertyDocBlock = ReflectionHelper::getLocalModelPropertyDocComment($localModelClass, $propertyToCompare);
- 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 syncLocalFromStripe
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function syncLocalFromStripe(StripeLocalResourceInterface $localResource, ApiResource $stripeResource): void
{
/** @var StripeLocalCustomer $localResource */
if ( ! $localResource instanceof StripeLocalWebhookEvent) {
throw new \InvalidArgumentException('WebhookEventSyncer::syncLocalFromStripe() accepts only StripeLocalWebhookEvent objects as first parameter.');
Method syncLocalFromStripe
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function syncLocalFromStripe(StripeLocalResourceInterface $localResource, ApiResource $stripeResource): void
{
/** @var StripeLocalCustomer $localResource */
if ( ! $localResource instanceof StripeLocalCustomer) {
throw new \InvalidArgumentException('CustomerSyncer::syncLocalFromStripe() accepts only StripeLocalCustoer objects as first parameter.');
Function syncLocalFromStripe
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function syncLocalFromStripe(StripeLocalResourceInterface $localResource, ApiResource $stripeResource): void
{
/** @var StripeLocalCustomer $localResource */
if ( ! $localResource instanceof StripeLocalCustomer) {
throw new \InvalidArgumentException('CustomerSyncer::syncLocalFromStripe() accepts only StripeLocalCustoer objects as first parameter.');
- 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
File StripeManager.php
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
/*
Function notifyAction
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function notifyAction(
Request $request,
EntityManagerInterface $entityManager,
EventDispatcherInterface $eventDispatcher,
StripeManager $stripeManager,
- 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 compareLocalPropertiesWithMappedOnes
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function compareLocalPropertiesWithMappedOnes(string $localModelClass, array $propertiesToCompare): array
{
$failures = [];
foreach ($propertiesToCompare as $propertyToCompare) {
$localPropertyDocBlock = ReflectionHelper::getLocalModelPropertyDocComment($localModelClass, $propertyToCompare);
Method handleException
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function handleException(ExceptionInterface $e): bool
{
switch (\get_class($e)) {
case RateLimitException::class:
// We have to retry with an exponential backoff if is not reached the maximum number of retries
Function toStripe
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function toStripe(string $action): array
{
$return = [];
// Prepare the array for creation
- 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"