Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialGareth Redfern
36,217 PointsName Spacing For Swiftmailer
When you create the transport object on line 43 the following is used:
$transport = Swift_SendmailTransport::newInstance();
My question is how does the app know how to find that static method in particular as its not namespaced. Should it not be prefixed with a \
?
1 Answer
Hampton Paulk
5,093 PointsTake a look at this file SmtpTransport.php
On Line 53 there is the method that the class you mentioned inherits from.
This method calls the 'new' keyword for you. This is not the ideal way IMHO, but it works.
Oziel Perez
61,321 PointsDo you have any idea what approach were they going with to instantiate a class object in this way? It seems a bit overengineered but then again, not sure if I'm there's something I'm not aware of that makes them write the code like that.
Antonio Jaramillo
15,604 PointsAntonio Jaramillo
15,604 PointsGreat question. Wouldn't have even thought to have asked it.