OpenBuildings / postmark

Postmark transport for Swift Mailer
https://github.com/OpenBuildings/postmark
BSD 3-Clause "New" or "Revised" License
16 stars 8 forks source link

Comply with PSR-2 and Symfony conventions #16

Closed hkdobrev closed 9 years ago

hkdobrev commented 10 years ago

Coding style is changed to comply with:

Resolves #13.

Previous interface is left, but deprecated. Tests for deprecated methods are also left so the old interface is kept valid unless explicitly decided to be removed.


PHP Code Sniffer currently complains with the following warnings:

FILE: src/Openbuildings/Postmark/Api.php
--------------------------------------------------------------------------------
FOUND 3 ERROR(S) AFFECTING 3 LINE(S)
--------------------------------------------------------------------------------
 203 | ERROR | Method name "Api::is_secure" is not in camel caps format
 215 | ERROR | Method name "Api::set_secure" is not in camel caps format
 226 | ERROR | Method name "Api::get_send_uri" is not in camel caps format
--------------------------------------------------------------------------------

FILE: src/Openbuildings/Postmark/Swift/PostmarkTransport.php
--------------------------------------------------------------------------------
FOUND 1 ERROR(S) AFFECTING 1 LINE(S)
--------------------------------------------------------------------------------
 15 | ERROR | Class name "Swift_PostmarkTransport" is not in camel caps format
--------------------------------------------------------------------------------

FILE: src/Openbuildings/Postmark/Swift/Transport/PostmarkTransport.php
--------------------------------------------------------------------------------
FOUND 2 ERROR(S) AFFECTING 2 LINE(S)
--------------------------------------------------------------------------------
  13 | ERROR | Class name "Swift_Transport_PostmarkTransport" is not in camel
     |       | caps format
 217 | ERROR | Method name
     |       | "Swift_Transport_PostmarkTransport::convert_email_array" is not
     |       | in camel caps format
--------------------------------------------------------------------------------

FILE: tests/src/Swift/PostmarkTransportTest.php
--------------------------------------------------------------------------------
FOUND 1 ERROR(S) AFFECTING 1 LINE(S)
--------------------------------------------------------------------------------
 12 | ERROR | Class name "Swift_PostmarkTransportTest" is not in camel caps
    |       | format
--------------------------------------------------------------------------------

FILE: tests/src/Swift/Transport/PostmarkTransportTest.php
--------------------------------------------------------------------------------
FOUND 1 ERROR(S) AND 2 WARNING(S) AFFECTING 3 LINE(S)
--------------------------------------------------------------------------------
  18 | ERROR   | Class name "Swift_Transport_PostmarkTransportTest" is not in
     |         | camel caps format
 191 | WARNING | Line exceeds 120 characters; contains 1600 characters
 211 | WARNING | Line exceeds 120 characters; contains 1600 characters
--------------------------------------------------------------------------------

The legacy methods (which are in snake_case) are left intentionally to keep the old interface working.

The left long lines are base64 encoded images and do not do any harm to the readability.

The classes are left the same for backwards compatibility, but I'd take any suggestions on that.

hkdobrev commented 9 years ago

@ivank Could you take another look at that? I have:

yanev commented 9 years ago

@hkdobrev I think that the commit for reducing the blank lines (https://github.com/OpenBuildings/postmark/commit/ea26a039e2a4fa53777df9990904c5c2ae150e6e) needs an extensive review. @ivank what do you think?

ivank commented 9 years ago

Yeah I think it must be split into 2 commits, as it adds too much complexity! :)

hkdobrev commented 9 years ago

@yanev :laughing: I had these additions written some time ago and just committed them now. I had these lines fixed and I couldn't afford myself to put them in one of the other commits. I thought of removing the changes, but didn't seem right as well.

ivank commented 9 years ago

LGTM, if you want you could change to PSR-4 and not have all those deep nested folders.

hkdobrev commented 9 years ago

@ivank Sure, this would in #14 and still in the 0.3.x release.