__construct() публичный Метод

Construct a Comment and set defaults
public __construct ( )
Пример #1
0
 /**
  * @param string $class
  * @param string $phpDoc
  */
 public function __construct(string $class, string $phpDoc)
 {
     $phpDoc = trim(preg_replace('`[ \\t]*(?:\\/\\*\\*|\\*\\/|\\*)?[ \\t]*(.*)?`', '$1', $phpDoc));
     $explode = explode(' ', str_replace(["\n", "\r"], ["\n ", ''], $phpDoc));
     $type = array_pop($explode);
     $subType = null;
     if (stripos($type, 'map[') === 0) {
         $subType = substr($type, 4, -1);
         $type = array_pop($explode);
     }
     if ($type == '$this') {
         $type = $class;
     } elseif ($type == '$this') {
         $type = $class . '[]';
     }
     $this->type = explode('|', $type);
     $this->subType = $subType;
     // remove @var
     array_pop($explode);
     if (array_search("@nullable\n", $explode) !== false) {
         $this->nullable = true;
         unset($explode[array_search("@nullable\n", $explode)]);
     }
     $comment = trim(implode(' ', $explode));
     parent::__construct($comment);
 }
Пример #2
0
 public function __construct($content = false)
 {
     parent::__construct($content);
     $this->before = '/**';
     $this->into = ' * ';
     $this->after = ' */';
     $this->allowOneLine = false;
 }
Пример #3
0
 /**
  * @param array $explode
  */
 public function __construct(array $explode)
 {
     $this->type = array_shift($explode);
     $statusCode = array_shift($explode);
     if (is_numeric($statusCode) && $statusCode >= 100 && $statusCode < 700) {
         $this->statusCode = (int) $statusCode;
     } else {
         $this->statusCode = 500;
         array_unshift($explode, $statusCode);
     }
     parent::__construct(implode(' ', $explode));
 }
Пример #4
0
 /**
  * @param array $explode
  */
 public function __construct(array $explode = null)
 {
     if (!is_null($explode)) {
         $statusCode = array_shift($explode);
         if (is_numeric($statusCode) && $statusCode >= 100 && $statusCode < 700) {
             $this->statusCode = (int) $statusCode;
         } else {
             $this->statusCode = 200;
             array_unshift($explode, $statusCode);
         }
         if ($this->statusCode !== 204) {
             $this->type = explode('|', trim(array_shift($explode)));
         }
         parent::__construct(implode(' ', $explode));
     }
 }
Пример #5
0
 /**
  * @param array $explode
  */
 public function __construct(array $explode)
 {
     $statusCode = array_shift($explode);
     if (is_numeric($statusCode) && $statusCode >= 100 && $statusCode < 700) {
         $this->statusCode = (int) $statusCode;
     } else {
         $this->statusCode = 200;
         array_unshift($explode, $statusCode);
     }
     $comments = [];
     while (substr($explode[0], 0, 1) !== '{') {
         $comments[] = array_shift($explode);
     }
     $this->example = json_decode(implode(' ', $explode), true);
     parent::__construct(implode(' ', $comments));
 }
Пример #6
0
 /**
  * @param array $explode
  */
 public function __construct(array $explode)
 {
     $this->type = explode('|', trim(array_shift($explode)));
     parent::__construct(implode(' ', $explode));
 }
Пример #7
0
	public function __construct()
	{
		parent::__construct();
	}