Created
October 3, 2017 21:19
-
-
Save mikemilano/2145c6c8774175168ba79dfb6d50ad46 to your computer and use it in GitHub Desktop.
A simple PHP class which allows for chaining the setters.
This file contains 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 Motorcycle { | |
private $make; | |
private $model; | |
/** | |
* Returns the motorcycle make. | |
* | |
* @return string The motorcycle make | |
*/ | |
public function getMake(): string | |
{ | |
return $this->make; | |
} | |
/** | |
* Sets the make of the motorcycle. | |
* | |
* @param string $make The motorcycle make | |
* | |
* @return $this | |
*/ | |
public function setMake(string $make): Motorcycle | |
{ | |
$this->make = $make; | |
return $this; | |
} | |
/** | |
* Returns the motorcycle model. | |
* | |
* @return string The motorcycle model | |
*/ | |
public function getModel(): string | |
{ | |
return $this->model; | |
} | |
/** | |
* Sets the model of the motorcycle. | |
* | |
* @param string $model The motorcycle model | |
* | |
* @return $this | |
*/ | |
public function setModel(string $model): Motorcycle | |
{ | |
$this->model = $model; | |
return $this; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment