diff --git a/index.php b/index.php
index 4d125f332..9379b7637 100644
--- a/index.php
+++ b/index.php
@@ -2,13 +2,13 @@
namespace Grav;
if (version_compare($ver = PHP_VERSION, $req = '5.4.0', '<')) {
- exit(sprintf('You are running PHP %s, but Grav needs at least PHP %s to run.', $ver, $req));
+ throw new \RuntimeException(sprintf('You are running PHP %s, but Grav needs at least PHP %s to run.', $ver, $req));
}
// Ensure vendor libraries exist
$autoload = __DIR__ . '/vendor/autoload.php';
if (!is_file($autoload)) {
- exit('Please run: bin/grav install');
+ throw new \RuntimeException("Please run: bin/grav install");
}
use Grav\Common\Grav;
diff --git a/system/src/Grav/Common/Assets.php b/system/src/Grav/Common/Assets.php
index 4e940d09e..4027b07d2 100644
--- a/system/src/Grav/Common/Assets.php
+++ b/system/src/Grav/Common/Assets.php
@@ -120,7 +120,7 @@ class Assets
}
// Set custom pipeline fetch command
- if (isset($config['fetch_command']) and ($config['fetch_command'] instanceof Closure)) {
+ if (isset($config['fetch_command']) && ($config['fetch_command'] instanceof Closure)) {
$this->fetch_command = $config['fetch_command'];
}
@@ -143,12 +143,12 @@ class Assets
}
// Set collections
- if (isset($config['collections']) and is_array($config['collections'])) {
+ if (isset($config['collections']) && is_array($config['collections'])) {
$this->collections = $config['collections'];
}
// Autoload assets
- if (isset($config['autoload']) and is_array($config['autoload'])) {
+ if (isset($config['autoload']) && is_array($config['autoload'])) {
foreach ($config['autoload'] as $asset) {
$this->add($asset);
}
@@ -651,9 +651,9 @@ class Assets
$info = pathinfo($asset);
if (isset($info['extension'])) {
$ext = strtolower($info['extension']);
- if ($ext === 'css' and !in_array($asset, $this->css)) {
+ if ($ext === 'css' && !in_array($asset, $this->css)) {
$this->css[] = $asset;
- } elseif ($ext === 'js' and !in_array($asset, $this->js)) {
+ } elseif ($ext === 'js' && !in_array($asset, $this->js)) {
$this->js[] = $asset;
}
}
@@ -673,8 +673,8 @@ class Assets
*/
protected function isRemoteLink($link)
{
- return ('http://' === substr($link, 0, 7) or 'https://' === substr($link, 0, 8)
- or '//' === substr($link, 0, 2));
+ return ('http://' === substr($link, 0, 7) || 'https://' === substr($link, 0, 8)
+ || '//' === substr($link, 0, 2));
}
/**
diff --git a/system/src/Grav/Common/Errors/Errors.php b/system/src/Grav/Common/Errors/Errors.php
index 57dfbd85a..bd03455b0 100644
--- a/system/src/Grav/Common/Errors/Errors.php
+++ b/system/src/Grav/Common/Errors/Errors.php
@@ -23,7 +23,7 @@ class Errors extends \Whoops\Run
}
if (!$handler instanceof HandlerInterface) {
- throw new InvalidArgumentException(
+ throw new \InvalidArgumentException(
"Argument to " . __METHOD__ . " must be a callable, or instance of"
. "Whoops\\Handler\\HandlerInterface"
);
diff --git a/system/src/Grav/Common/Errors/SimplePageHandler.php b/system/src/Grav/Common/Errors/SimplePageHandler.php
index f0c6749fb..8584900fa 100644
--- a/system/src/Grav/Common/Errors/SimplePageHandler.php
+++ b/system/src/Grav/Common/Errors/SimplePageHandler.php
@@ -46,6 +46,11 @@ class SimplePageHandler extends Handler
return Handler::QUIT;
}
+ /**
+ * @param $resource
+ *
+ * @return string
+ */
protected function getResource($resource)
{
// If the resource was found before, we can speed things up
@@ -67,7 +72,7 @@ class SimplePageHandler extends Handler
}
// If we got this far, nothing was found.
- throw new RuntimeException(
+ throw new \RuntimeException(
"Could not find resource '$resource' in any resource paths."
. "(searched: " . join(", ", $this->searchPaths). ")"
);
@@ -76,7 +81,7 @@ class SimplePageHandler extends Handler
public function addResourcePath($path)
{
if (!is_dir($path)) {
- throw new InvalidArgumentException(
+ throw new \InvalidArgumentException(
"'$path' is not a valid directory"
);
}
diff --git a/system/src/Grav/Common/Markdown/ParsedownGravTrait.php b/system/src/Grav/Common/Markdown/ParsedownGravTrait.php
index b85a98064..4cdbe0c6b 100644
--- a/system/src/Grav/Common/Markdown/ParsedownGravTrait.php
+++ b/system/src/Grav/Common/Markdown/ParsedownGravTrait.php
@@ -72,7 +72,7 @@ trait ParsedownGravTrait
protected function inlineSpecialCharacter($Excerpt)
{
- if ($Excerpt['text'][0] === '&' and ! preg_match('/^?\w+;/', $Excerpt['text'])) {
+ if ($Excerpt['text'][0] === '&' && ! preg_match('/^?\w+;/', $Excerpt['text'])) {
return array(
'markup' => '&',
'extent' => 1,