Static Methods

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
    A really important thing just happened.
  • 0:10
    For the first time ever we referred to something on our class by using its class name.
  • 0:16
    To use the constant we said BattleManager::TYPE_NO_JEDI.
  • 0:23
    That makes sense, but notice it’s completely different than how we’ve referred to
  • 0:28
    class properties and methods so far.
  • 0:31
    Normally, we create a new object by saying, new BattleManager.
  • 0:36
    For us, this lives inside the container.
  • 0:39
    But here’s the important part: to reference a method or property we use the object
  • 0:46
    by saying $battleManager-> followed by the method name.
  • 0:50
    For constants, it’s totally different.
Loading ...