-
Notifications
You must be signed in to change notification settings - Fork 0
/
Comment.php
46 lines (37 loc) · 1.45 KB
/
Comment.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
namespace Sf2gen\Component\PhpCoder;
class Comment extends Code {
protected $single = '//';
protected $before = '/*';
protected $after = '*/';
protected $into = ' ';
protected $content = false;
protected $afterContent = false;
protected $allowOneLine = true;
public function __construct($content = false) {
$this->setContent($content);
}
public function setContent($content) {
$this->content = $content;
}
public function output() {
if($this->allowOneLine
&& $this->afterContent === false
&& strpos($this->content, self::$newline) === FALSE
)
return $this->single . $this->content . self::$newline;
return $this->before
. self::$newline
// call indentation function with $this->into (because into is not specially the normal indentation
. self::indent($this->into,
self::$newline,
$this->content . ($this->afterContent ?
( $this->content ? self::$newline : '' ) // return only if content exists
. $this->afterContent
: '')
)
. self::$newline
. $this->after
. self::$newline;
}
}