Skip to content

Commit

Permalink
added addComment(), setComment() and getComment()
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Jun 17, 2016
1 parent 6245050 commit bbc8189
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 3 deletions.
30 changes: 30 additions & 0 deletions src/PhpGenerator/ClassType.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,36 @@ public function addTrait($trait)
}


/**
* @param string|NULL
* @return self
*/
public function setComment($val)
{
$this->documents = $val ? array((string) $val) : array();
return $this;
}


/**
* @return string|NULL
*/
public function getComment()
{
return implode($this->documents) ?: NULL;
}


/**
* @param string
* @return self
*/
public function addComment($val)
{
return $this->addDocument($val);
}


/**
* @param string[]
* @return self
Expand Down
30 changes: 30 additions & 0 deletions src/PhpGenerator/Method.php
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,36 @@ public function isVariadic()
}


/**
* @param string|NULL
* @return self
*/
public function setComment($val)
{
$this->documents = $val ? array((string) $val) : array();
return $this;
}


/**
* @return string|NULL
*/
public function getComment()
{
return implode($this->documents) ?: NULL;
}


/**
* @param string
* @return self
*/
public function addComment($val)
{
return $this->addDocument($val);
}


/**
* @param string[]
* @return self
Expand Down
36 changes: 33 additions & 3 deletions src/PhpGenerator/PhpFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,32 @@ class PhpFile extends Object


/**
* @return string[]
* @param string|NULL
* @return self
*/
public function getDocuments()
public function setComment($val)
{
return $this->documents;
$this->documents = $val ? array((string) $val) : array();
return $this;
}


/**
* @return string|NULL
*/
public function getComment()
{
return implode($this->documents) ?: NULL;
}


/**
* @param string
* @return self
*/
public function addComment($val)
{
return $this->addDocument($val);
}


Expand All @@ -48,6 +69,15 @@ public function setDocuments(array $documents)
}


/**
* @return string[]
*/
public function getDocuments()
{
return $this->documents;
}


/**
* @param string
* @return self
Expand Down
30 changes: 30 additions & 0 deletions src/PhpGenerator/Property.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,36 @@ public function getVisibility()
}


/**
* @param string|NULL
* @return self
*/
public function setComment($val)
{
$this->documents = $val ? array((string) $val) : array();
return $this;
}


/**
* @return string|NULL
*/
public function getComment()
{
return implode($this->documents) ?: NULL;
}


/**
* @param string
* @return self
*/
public function addComment($val)
{
return $this->addDocument($val);
}


/**
* @param string[]
* @return self
Expand Down

0 comments on commit bbc8189

Please sign in to comment.