123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <?php namespace Laravel;
- class Fluent {
-
- public $attributes = array();
-
- public function __construct($attributes = array())
- {
- foreach ($attributes as $key => $value)
- {
- $this->$key = $value;
- }
- }
-
- public function get($attribute, $default = null)
- {
- return array_get($this->attributes, $attribute, $default);
- }
-
- public function __call($method, $parameters)
- {
- $this->$method = (count($parameters) > 0) ? $parameters[0] : true;
- return $this;
- }
-
- public function __get($key)
- {
- if (array_key_exists($key, $this->attributes))
- {
- return $this->attributes[$key];
- }
- }
-
- public function __set($key, $value)
- {
- $this->attributes[$key] = $value;
- }
-
- public function __isset($key)
- {
- return isset($this->attributes[$key]);
- }
-
- public function __unset($key)
- {
- unset($this->attributes[$key]);
- }
- }
|