Skip to content

Commit 12e7501

Browse files
committed
Pass target file to the export method instead of the whole class
1 parent f315b1d commit 12e7501

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

PHPCtags.class.php

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

88
private $mParser;
99

10-
public function __construct($file)
10+
public function __construct()
1111
{
12-
//@todo Check for existence
13-
$this->mFile = $file;
1412
$this->mKinds= array(
1513
'c' => 'class',
1614
'm' => 'method',
@@ -212,8 +210,10 @@ private function render($structs, $options)
212210
return $str;
213211
}
214212

215-
public function export($options)
213+
public function export($file, $options)
216214
{
215+
//@todo Check for existence
216+
$this->mFile = $file;
217217
$structs = $this->struct($this->mParser->parse(file_get_contents($this->mFile)));
218218
echo $this->render($structs,$options);
219219
}

phpctags

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@ if(isset($options['fields'])) {
3737
$options['fields'] = array('k','s');
3838
}
3939

40-
$ctags = new PHPCtags($file);
41-
$ctags->export($options);
40+
$ctags = new PHPCtags();
41+
$ctags->export($file, $options);

tests/PHPCtagsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class PHPCtagsTest extends PHPUnit_Framework_TestCase
1515
*/
1616
protected function setUp()
1717
{
18-
$this->object = new PHPCtags(__DIR__ . '/PHPCtagsTest.example.php');
18+
$this->object = new PHPCtags();
1919
}
2020

2121
/**
@@ -37,7 +37,7 @@ public function testExport()
3737
'format' => 2,
3838
);
3939

40-
$this->object->export($options);
40+
$this->object->export(__DIR__ . '/PHPCtagsTest.example.php', $options);
4141
}
4242

4343
}

0 commit comments

Comments
 (0)