Skip to content

Commit e5f04a1

Browse files
committed
Format code.
1 parent 2c73360 commit e5f04a1

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

PHPCtags.class.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ class PHPCtags
55

66
private $mParser;
77

8-
public function __construct($file) {
8+
public function __construct($file)
9+
{
910
//@todo Check for existence
1011
$this->mFile = $file;
1112
$this->mParser = new PHPParser_Parser(new PHPParser_Lexer);
@@ -111,7 +112,7 @@ private function struct($node, $class_name = NULL, $function_name = NULL)
111112
// we don't care the rest of them.
112113
}
113114

114-
if(!empty($kind) && !empty($name) && !empty($line)) {
115+
if (!empty($kind) && !empty($name) && !empty($line)) {
115116
$structs[] = array(
116117
'kind' => $kind,
117118
'name' => $name,
@@ -124,7 +125,7 @@ private function struct($node, $class_name = NULL, $function_name = NULL)
124125
return $structs;
125126
}
126127

127-
private function render($structs)
128+
private function render($structs)
128129
{
129130
$str = '';
130131
$lines = file($this->mFile);
@@ -150,7 +151,7 @@ private function render($structs)
150151

151152
public function export()
152153
{
153-
$code =file_get_contents($this->mFile);
154+
$code = file_get_contents($this->mFile);
154155
$stmts = $this->mParser->parse($code);
155156
$structs = $this->struct($stmts);
156157
echo $this->render($structs);

tests/PHPCtagsTest.example.php

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
define('GLOBAL_CONST_1','this is a global const.');
3+
define('GLOBAL_CONST_1', 'this is a global const.');
44

55
// Only available php 5.3+
66
const GLOBAL_CONST_2 = 'this is a global const too.';
@@ -10,17 +10,20 @@
1010
$var2 = 2;
1111

1212
// With a variable define in scope
13-
function function_1() {
13+
function function_1()
14+
{
1415
$var = 1;
1516
return $var;
1617
}
1718

1819
// Without a variable define in scope
19-
function function_2() {
20+
function function_2()
21+
{
2022
return function_1();
2123
}
2224

23-
trait Trait_1 {
25+
trait Trait_1
26+
{
2427

2528
}
2629

@@ -47,26 +50,31 @@ abstract class Class_1 implements Interface_1
4750

4851
protected $var3;
4952

50-
function __construct() {
53+
function __construct()
54+
{
5155
$this->var1 = 1;
5256
$this->var2 = 2;
5357
$this->var3 = 3;
5458
}
5559

56-
function method_0() {
60+
function method_0()
61+
{
5762
$var = 'this is a method with a variable defined in this scope';
5863
return $var;
5964
}
6065

61-
public function method_1() {
66+
public function method_1()
67+
{
6268
return 'this is a public method.';
6369
}
6470

65-
private function method_2() {
71+
private function method_2()
72+
{
6673
return 'this is a private method.';
6774
}
6875

69-
protected function method_3() {
76+
protected function method_3()
77+
{
7078
return 'this is a protected method.';
7179
}
7280
}

0 commit comments

Comments
 (0)