__construct() public method

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
ファイル: PhpDoc.php プロジェクト: RapotOR/PhpCoder
 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();
	}