/**
  * Constructor.
  * @param mixed $data if string, it represents a config file (a PHP script returning the configuration as an array);
  * If array, it is config data.
  */
 public function __construct($data = null)
 {
     if (is_string($data)) {
         parent::__construct(require $data);
     } else {
         parent::__construct($data);
     }
 }
 /**
  * Constructor.
  * @param CForm the form object that owns this collection
  * @param boolean whether this collection is used to store buttons.
  */
 public function __construct($form, $forButtons = false)
 {
     parent::__construct();
     $this->_form = $form;
     $this->_forButtons = $forButtons;
 }
Beispiel #3
0
 public function __construct()
 {
     parent::__construct();
     $this->init();
 }
Beispiel #4
0
 public function __construct(array $options)
 {
     parent::__construct($options);
 }
Beispiel #5
0
 /**
  * @param Reflector $class
  * @return CMap
  */
 public function __construct($class)
 {
     $data = array('title' => NULL, 'description' => NULL);
     if ($class instanceof Reflector && method_exists($class, 'getDocComment')) {
         // Get the comment.
         if (preg_match('#^/\\*\\*(.*)\\*/#s', $class->getDocComment(), $lines) !== false) {
             $lines = trim($lines[1]);
             // Get all the lines and strip the * from the first character.
             if (preg_match_all('#^\\s*\\*(.*)#m', $lines, $lines) !== false) {
                 $description = array();
                 foreach ($lines[1] as $line) {
                     // Parse the line.
                     $line = trim($line);
                     if (!empty($line) && strpos($line, '@') === 0) {
                         // Get the parameter name and value.
                         $param = explode(' ', substr($line, 1), 2);
                         $data[$param[0]] = isset($param[1]) ? $param[1] : true;
                     } else {
                         if (count($data) <= 2) {
                             $description[] = $line;
                             // Store the first line in the title.
                             if (!empty($line) && empty($data['title'])) {
                                 $data['title'] = $line;
                             }
                         }
                     }
                     // Store the line before params in the description.
                     $data['description'] = trim(implode(PHP_EOL, $description));
                 }
             }
         }
     }
     parent::__construct($data, true);
 }