Skip to content

Commit 218096f

Browse files
committed
Don't do an unnecessary file_exists check if data is passed into evaluate
1 parent 363318e commit 218096f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/Pipe/Context.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,20 @@ function dependOn($path)
4343

4444
function evaluate($path, $options = array())
4545
{
46-
if (!is_file($path)) {
47-
throw new UnexpectedValueException("Asset $path not found");
48-
}
49-
5046
if (isset($options['data'])) {
5147
$data = $options['data'];
5248
} else {
49+
if (!is_file($path)) {
50+
throw new UnexpectedValueException("Asset $path not found");
51+
}
52+
5353
$data = @file_get_contents($path);
5454
}
5555

5656
$subContext = $this->createSubContext();
5757

5858
if (array_key_exists("processors", $options)) {
59-
$processors = $options["processors"];
59+
$processors = (array) $options["processors"];
6060
} else {
6161
$processors = array();
6262
}

0 commit comments

Comments
 (0)