Showing 52 of 52 total issues
Method notifyAction
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function notifyAction(
Request $request,
EntityManagerInterface $entityManager,
EventDispatcherInterface $eventDispatcher,
StripeManager $stripeManager,
Function toStripe
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function toStripe(string $action): array
{
if (self::ACTION_CREATE !== $action && 'update' !== $action) {
throw new \InvalidArgumentException('StripeLocalCustomer::__toArray() accepts only "create" or "update" as 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 callStripeApi
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function callStripeApi(string $endpoint, string $action, array $arguments)
{
$return = null;
try {
Method toStripe
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function toStripe(string $action): array
{
$return = [];
// Prepare the array for creation
Method checkApiVersion
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function checkApiVersion(SymfonyStyle $ioWriter): void
{
if (false === \class_exists(Crawler::class)) {
$ioWriter->error('The Symfony DomCrawler component is not installed and it is required to run this command.
Run "composer req symfony/domcrawler" to install it.');
Method getConfigTreeBuilder
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder('shq_stripe');
$rootNode = $treeBuilder->getRootNode();
Method notifyAction
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
Request $request,
EntityManagerInterface $entityManager,
EventDispatcherInterface $eventDispatcher,
StripeManager $stripeManager,
EventGuesser $eventGuesser,
Function callStripeApi
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function callStripeApi(string $endpoint, string $action, array $arguments)
{
$return = null;
try {
- 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 handleException
has a Cognitive Complexity of 10 (exceeds 5 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
- 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 compareLocalPropertiesWithSdkOnes
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function compareLocalPropertiesWithSdkOnes(string $localModelClass, string $sdkModelClass, array $propertiesToCompare): array
{
$failures = [];
foreach ($propertiesToCompare as $propertyToCompare) {
$localPropertyDocBlock = ReflectionHelper::getLocalModelPropertyDocComment($localModelClass, $propertyToCompare);
Function getModelClasses
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function getModelClasses(): array
{
static $modelClasses = null;
if (\is_array($modelClasses)) {
- 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 compareLocalPropertiesWithSdkOnes
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function compareLocalPropertiesWithSdkOnes(string $localModelClass, string $sdkModelClass, 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 __construct
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct(string $secretKey, string $debug, string $statementDescriptor, ChargeSyncer $chargeSyncer, CustomerSyncer $customerSyncer, WebhookEventSyncer $webhookEventSyncer, LoggerInterface $logger = null)
Function getSdkModelPropertiesDocComments
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function getSdkModelPropertiesDocComments(string $sdkModelClass): array
{
if (false === isset(self::$sdkModelsCache[$sdkModelClass])) {
$reflectedSdkModel = new \ReflectionClass($sdkModelClass);
$docComment = self::getDockBlockFactory()->create($reflectedSdkModel->getDocComment());
- 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 syncLocalSources
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function syncLocalSources(StripeLocalResourceInterface $localResource, ApiResource $stripeResource): void
{
/** @var StripeLocalCustomer $localResource */
if ( ! $localResource instanceof StripeLocalCustomer) {
throw new \InvalidArgumentException('CustomerSyncer::syncLocalFromStripe() accepts only StripeLocalCustomer 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 callStripeObject
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function callStripeObject(ApiResource $object, string $method, array $arguments = [])
{
try {
switch (\count($arguments)) {
// Method has no signature (it doesn't accept any argument)
- 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 syncStripeFromLocal
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function syncStripeFromLocal(ApiResource $stripeResource, StripeLocalResourceInterface $localResource): void
{
/** @var Customer $stripeResource */
if ( ! $stripeResource instanceof Customer) {
throw new \InvalidArgumentException('CustomerSyncer::syncStripeFromLocal() accepts only Stripe\Customer 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
Avoid too many return
statements within this method. Open
return [
self::TYPE => \constant(StripeWebhookReviewEvent::class . '::' . $pieces[self::TYPE]),
self::OBJECT => $dispatchingEvent,
];
Avoid too many return
statements within this method. Open
return [
self::TYPE => \constant(StripeWebhookTransferEventEvent::class . '::' . $pieces[self::TYPE]),
self::OBJECT => $dispatchingEvent,
];
Avoid too many return
statements within this method. Open
return [
self::TYPE => \constant(StripeWebhookSkuEventEvent::class . '::' . $pieces[self::TYPE]),
self::OBJECT => $dispatchingEvent,
];