Пример #1
0
 /**
  * Constructor
  *
  * @param ObjectConfig $config An optional ObjectConfig object with configuration options.
  */
 public function __construct(ObjectConfig $config)
 {
     parent::__construct($config);
     //Add the behaviors in FIFO order
     $behaviors = (array) ObjectConfig::unbox($config->behaviors);
     foreach ($behaviors as $key => $value) {
         if (is_numeric($key)) {
             $this->addBehavior($value);
         } else {
             $this->addBehavior($key, $value);
         }
     }
 }
Пример #2
0
 /**
  * Constructor
  *
  * @param ObjectConfig $object An optional ObjectConfig object with configuration options.
  */
 public function __construct(ObjectConfig $config)
 {
     parent::__construct($config);
     //Set the auto mixin state
     $this->_auto_mixin = $config->auto_mixin;
     //Add the behaviors in FIFO order (allow behavior remixing).
     $behaviors = (array) ObjectConfig::unbox($config->behaviors);
     foreach (array_reverse($behaviors) as $key => $value) {
         if (is_numeric($key)) {
             $this->attachBehavior($value);
         } else {
             $this->attachBehavior($key, $value);
         }
     }
 }