From b6468ca215d56e3abff879306645fb54b438519a Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Sun, 8 Oct 2017 00:36:29 +0200 Subject: [PATCH] Various small improvements --- index.php | 2 +- lib/Pico.php | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/index.php b/index.php index e582694..4fb0d55 100644 --- a/index.php +++ b/index.php @@ -8,7 +8,7 @@ if (is_file(__DIR__ . '/vendor/autoload.php')) { // composer dependency package require_once(__DIR__ . '/../../../vendor/autoload.php'); } else { - die("Cannot find `vendor/autoload.php`. Run `composer install`."); + die("Cannot find 'vendor/autoload.php'. Run `composer install`."); } // instance Pico diff --git a/lib/Pico.php b/lib/Pico.php index 24a82c8..829d749 100644 --- a/lib/Pico.php +++ b/lib/Pico.php @@ -131,7 +131,7 @@ class Pico /** * List of loaded plugins using the current API version * - * @var object[] + * @var PicoPluginInterface[] */ protected $nativePlugins = array(); @@ -661,6 +661,7 @@ class Pico } $className = get_class($plugin); + if (!($plugin instanceof PicoPluginInterface)) { throw new RuntimeException( "Unable to load plugin '" . $className . "': " @@ -676,7 +677,7 @@ class Pico // trigger onPluginManuallyLoaded event // the event is also called on the newly loaded plugin, allowing you to distinguish manual and auto loading - $this->triggerEvent('onPluginManuallyLoaded', array($this->plugins[$className])); + $this->triggerEvent('onPluginManuallyLoaded', array($plugin)); return $plugin; } @@ -2192,7 +2193,7 @@ class Pico public function getAbsolutePath($path) { if (DIRECTORY_SEPARATOR === '\\') { - if (preg_match('/^([a-zA-Z]:\\\\|\\\\\\\\)/', $path) !== 1) { + if (preg_match('/^(?>[a-zA-Z]:\\\\|\\\\\\\\)/', $path) !== 1) { $path = $this->getRootDir() . $path; } } else {