Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
calebporzio committed Mar 6, 2019
1 parent 1ccd037 commit 3238c7c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/GitDown.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,28 +38,28 @@ public function parse($content)
throw new \Exception('GitHub API Error: ' . $response->body());
}

return $response;
return (string) $response;
}

public function parseAndCache($content, $minutes = null)
{
if (is_callable($minutes)) {
return $minutes(static::generateParseCallback($content));
return $minutes($this->generateParseCallback($content));
} elseif (is_null($minutes)) {
return cache()->rememberForever(sha1($content), function () use ($content) {
return static::parse($content);
return $this->parse($content);
});
}

return cache()->remember(sha1($content), $minutes, function () use ($content) {
return static::parse($content);
return $this->parse($content);
});
}

protected function generateParseCallback($content)
{
return function () use ($content) {
return static::parse($content);
return $this->parse($content);
};
}

Expand Down

0 comments on commit 3238c7c

Please sign in to comment.