Skip to content

Commit b0ec5c3

Browse files
committed
Add flushDependencies method
1 parent f6ca59f commit b0ec5c3

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/JsPhpize/JsPhpize.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,18 @@ public function compileDependencies()
9898
return $compiler->compileDependencies($this->dependencies);
9999
}
100100

101+
/**
102+
* Flush all saved dependencies.
103+
*
104+
* @return $this
105+
*/
106+
public function flushDependencies()
107+
{
108+
$this->dependencies = array();
109+
110+
return $this;
111+
}
112+
101113
/**
102114
* Compile and return the code execution result.
103115
*

tests/mainMethods.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public function testCompileFile()
3434
$this->assertSame($expected, $actual);
3535

3636
$actual = $jsPhpizeCatchDeps->compileDependencies();
37+
$jsPhpizeCatchDeps->flushDependencies();
3738
$expected = '$GLOBALS[\'__jpv_dot\'] = ' . file_get_contents(__DIR__ . '/../src/JsPhpize/Compiler/Helpers/Dot.h') . ';';
3839
$expected .= '$GLOBALS[\'__jpv_plus\'] = ' . file_get_contents(__DIR__ . '/../src/JsPhpize/Compiler/Helpers/Plus.h') . ';';
3940

0 commit comments

Comments
 (0)