:octocat: added container trait

This commit is contained in:
smiley
2017-10-25 04:12:23 +02:00
parent 9c826d2e8d
commit 964f9be90c
3 changed files with 70 additions and 0 deletions
+66
View File
@@ -0,0 +1,66 @@
<?php
/**
* Trait Container
*
* @filesource Container.php
* @created 09.07.2017
* @package chillerlan\QRCode
* @author Smiley <smiley@chillerlan.net>
* @copyright 2017 Smiley
* @license MIT
*/
namespace chillerlan\QRCode;
/**
* a generic container with getter and setter
* @codeCoverageIgnore
*/
trait Container{
/**
* Boa constructor.
*
* @param array $properties
*/
public function __construct(array $properties = []){
foreach($properties as $key => $value){
$this->__set($key, $value);
}
}
/**
* David Getter
*
* @param string $property
*
* @return mixed
*/
public function __get(string $property){
if(property_exists($this, $property)){
return $this->{$property};
}
return false;
}
/**
* Jet-setter
*
* @param string $property
* @param mixed $value
*
* @return void
*/
public function __set(string $property, $value){
if(property_exists($this, $property)){
$this->{$property} = $value;
}
}
}
+3
View File
@@ -12,10 +12,13 @@
namespace chillerlan\QRCode\Output;
use chillerlan\QRCode\Container;
/**
*
*/
abstract class QROutputOptionsAbstract{
use Container;
public $type;
+1
View File
@@ -16,6 +16,7 @@ namespace chillerlan\QRCode;
*
*/
class QROptions{
use Container;
/**
* @var int