Created
December 16, 2017 16:05
-
-
Save conleec/6893ec41690757fe228bcf6d03b05e9a to your computer and use it in GitHub Desktop.
PHP - Object Oriented Notes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Misc notes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Encapsulation
Getters and Setters explained along with property and method visibility.
https://goo.gl/cQ71rF
Inheritance
DRY = Don't Reuse Your code...
This example takes any method that contains "createdOn" and returns a DateTime() object. All other methods get passed thru.
Autoloading
A way of automatically loading PHP classes when they're called, so we don't need a gazillion "includes"
https://getcomposer.org/
Package for doing autoloads. Codecourse has tutorial on using it.
Traits
A way to share methods with classes
Exceptions
You can create a new exception class, which extends standard PHP exception. This allows custom functionality and messages when a specific exception is thrown.