Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring in ScheduledReports to remove useless indentation #6396

Merged
merged 1 commit into from Oct 8, 2014

Conversation

mnapoli
Copy link
Contributor

@mnapoli mnapoli commented Oct 7, 2014

I have refactored the code a bit to make it (hopefully) more readable.

The diff is going crazy, but basically I have just replaced this:

if (self::manageEvent($reportType)) {
    // big block of code
}

By this:

if (! self::manageEvent($reportType)) {
    return;
}

// big block of code

It's not much but it removes one level of indentation in almost the whole class (almost all the methods were like that), which is kind of nice.

(by the way this is one of the "object calisthenics" rules)

I have refactored the code a bit to make it (hopefully) more readable. I have replaced this:

```php
if (self::manageEvent($reportType)) {
    // do something
}
```

By this:

```php
if (! self::manageEvent($reportType)) {
    return;
}

// do something
```

It's not much but it removes one level of indentation in almost the whole class, which is kind of nice.

FYI, this is one of the "object calisthenics" rules.
mattab pushed a commit that referenced this pull request Oct 8, 2014
Refactoring in ScheduledReports to remove useless indentation
@mattab mattab merged commit 7afc482 into master Oct 8, 2014
@mattab
Copy link
Member

mattab commented Oct 8, 2014

Nice change improving readability!

@mnapoli mnapoli deleted the code-refactorings branch October 8, 2014 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants