More Fun with use Statements

Video loading...

Join Drupalize.Me to watch this video

Join today and gain instant access to our entire video library.

Log in Sign up
  • 0:07
    I hate needing all these require statements.
  • 0:11
    But thanks to our autoloader, the only thing we need to do is
  • 0:15
    give every class the namespace that matches its directory.
  • 0:20
    This will be a little bit of work because we didn't do it up front.
  • 0:24
    Life is much easier when you use namespaces like this from the very beginning.
  • 0:30
    But we'll learn some stuff along the way.
  • 0:33
    The AbstractShip class lives in the model directory.
  • 0:36
    So give it the namespace Model.
  • 0:39
    Copy that and do the same thing in BattleResult,
  • 0:44
    BrokenShip,
Loading ...