Comment::__construct PHP Method

__construct() public method

Construct a Comment and set defaults
public __construct ( )
    public function __construct()
    {
        $this->set('id', 0);
        $this->set('parent_id', 0);
        $this->set('text', '');
        $this->set('sort', 0);
        $this->set('status', self::statusPending);
        $this->set('flags', 0);
        $this->set('created', time());
        $this->set('email', '');
        $this->set('cite', '');
        $this->set('website', '');
        $this->set('ip', '');
        $this->set('user_agent', '');
        $this->set('created_users_id', $this->config->guestUserID);
        $this->set('code', '');
        // approval code
        $this->set('subcode', '');
        // subscriber code (for later user modifications to comment)
        $this->set('upvotes', 0);
        $this->set('downvotes', 0);
        $this->set('stars', 0);
    }

Usage Example

コード例 #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);
 }
All Usage Examples Of Comment::__construct