This repository has been archived by the owner on Oct 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Craig Paul
committed
Oct 19, 2016
1 parent
2ae5925
commit 4469fbe
Showing
2 changed files
with
25 additions
and
34 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace CraigPaul\Moneris; | ||
|
||
trait Gettable | ||
{ | ||
/** | ||
* Retrieve a property off of the class. | ||
* | ||
* @param string $property | ||
* | ||
* @throws \InvalidArgumentException | ||
* @return mixed | ||
*/ | ||
public function __get(string $property) | ||
{ | ||
if (property_exists($this, $property)) { | ||
return $this->$property; | ||
} | ||
|
||
throw new \InvalidArgumentException('['.get_class($this).'] does not contain a property named ['.$property.']'); | ||
} | ||
} |
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