Skip to content

Commit

Permalink
Add content check after key file reading
Browse files Browse the repository at this point in the history
  • Loading branch information
misantron authored and lcobucci committed Jul 29, 2018
1 parent ac083fa commit 92a07a1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Signer/Key.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,22 @@ private function setContent($content)
*
* @return string
*
* @throws \InvalidArgumentException
* @throws InvalidArgumentException
*/
private function readFile($content)
{
$file = substr($content, 7);

if (!is_readable($file)) {
throw new \InvalidArgumentException('You must inform a valid key file');
throw new InvalidArgumentException('You must inform a valid key file');
}

$content = file_get_contents($file);
if ($content === false) {
throw new InvalidArgumentException('You must inform a valid key file');
}

return file_get_contents($file);
return $content;
}

/**
Expand Down

0 comments on commit 92a07a1

Please sign in to comment.