Permalink
Browse files

[Yaml][Parser] throw an exception if not readable

  • Loading branch information...
1 parent dec12c2 commit 7555587bc9bf4241b33b03190edbd690cd1ec17f @makasim makasim committed Jan 13, 2012
Showing with 8 additions and 1 deletion.
  1. +8 −1 Yaml.php
View
9 Yaml.php
@@ -47,7 +47,14 @@ static public function parse($input)
$file = '';
// if input is a file, process it
- if (strpos($input, "\n") === false && is_file($input) && is_readable($input)) {
+ if (strpos($input, "\n") === false && is_file($input)) {
+ if (false === is_readable($input)) {
+ throw new \InvalidArgumentException(sprintf(
+ 'The service file "%s" is not readable.',
+ $input
+ ));
+ }
+
$file = $input;
ob_start();

0 comments on commit 7555587

Please sign in to comment.