Created
July 9, 2014 20:05
-
-
Save RayBenefield/2f8b8aff0d6c54713072 to your computer and use it in GitHub Desktop.
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
<?php | |
class car { | |
// class-level variables storing classes; Type-hinted | |
protected $Frame; | |
protected $Paint; | |
protected $Tires; | |
// class-level variables; not Type-hinted | |
protected $paintColor = 'red'; // class-level variable storing a scalar | |
protected $level; | |
protected $bubble; | |
// Type-hinted arguments are studly cased and not type-hinted are camel cased | |
public function __construct(Frame $Frame, Paint $Paint, Tires $Tires, $level = Logger::DEBUG, $bubble = true) { | |
$this->Frame = $Frame; | |
$this->Paint = $Paint; | |
$this->Tires = $Tires; | |
// Not type-hinted | |
$this->level = $level; | |
$this->bubble = $bubble; | |
} | |
// Assembler is type-hinted and message is not | |
public function assembleCar(Assembler $Assembler, $message) { | |
$Assembler->add($this->Frame); | |
$Assembler->add($this->Paint, $this->paintColor); | |
$Assembler->add($this->Tires); | |
// Not type-hinted | |
echo $message; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment