Skip to content
This repository has been archived by the owner on Feb 1, 2020. It is now read-only.

Commit

Permalink
Fixing formatting and invalid use of RuntimeException (no create() me…
Browse files Browse the repository at this point in the history
…thod).
  • Loading branch information
kherge committed Aug 7, 2013
1 parent b42f1b9 commit 5d409b8
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions bin/go
Original file line number Diff line number Diff line change
Expand Up @@ -47,26 +47,30 @@ function load_composer_classloader($dir = null, $skip = 0)
} while ($dir !== ($up = dirname($dir)));

if (empty($path)) {
throw new RuntimeException (
throw new RuntimeException(
'The composer.json file could not be found.'
);
}

if (false === ($json = file_get_contents($path))) {
throw new RuntimeException(sprintf(
'The file "%s" could not be read.',
$path
));
throw new RuntimeException(
sprintf(
'The file "%s" could not be read.',
$path
)
);
}

$json = json_decode($json);

if (JSON_ERROR_NONE !== ($code = json_last_error())) {
throw new RuntimeException(sprintf(
'The file "%s" could not be parsed [%d].',
$path,
$code
));
throw new RuntimeException(
sprintf(
'The file "%s" could not be parsed [%d].',
$path,
$code
)
);
}

$path = dirname($path);
Expand All @@ -80,11 +84,13 @@ function load_composer_classloader($dir = null, $skip = 0)
$path .= DIRECTORY_SEPARATOR . 'autoload.php';

if (false === file_exists($path)) {
throw RuntimeException::create(
'The Composer class loader "%s" could not be found.',
$path
throw new RuntimeException(
sprintf(
'The Composer class loader "%s" could not be found.',
$path
)
);
}

return include $path;
}
}

0 comments on commit 5d409b8

Please sign in to comment.