Various fixes

Thanks @PontusHorn for spotting!
This commit is contained in:
Daniel Rudolf 2015-09-13 20:46:09 +02:00
parent a83b01ef4f
commit 71e7da28cc
3 changed files with 13 additions and 12 deletions

View File

@ -209,17 +209,17 @@ abstract class AbstractPicoPlugin implements IPicoPlugin
} else { } else {
throw new RuntimeException( throw new RuntimeException(
"Unable to disable plugin '" . get_called_class() . "': " "Unable to disable plugin '" . get_called_class() . "': "
+ "Required by manually enabled plugin '" . $pluginName . "'" . "Required by manually enabled plugin '" . $pluginName . "'"
); );
} }
} }
} }
} else { } else {
$dependantsList = 'plugin' . ((count($dependants) > 1) ? 's' : '') . ' '; $dependantsList = 'plugin' . ((count($dependants) > 1) ? 's' : '') . ' ';
$dependantsList .= "'" + implode("', '", array_keys($dependants)) + "'"; $dependantsList .= "'" . implode("', '", array_keys($dependants)) . "'";
throw new RuntimeException( throw new RuntimeException(
"Unable to disable plugin '" . get_called_class() . "': " "Unable to disable plugin '" . get_called_class() . "': "
+ "Required by " . $dependantsList . "Required by " . $dependantsList
); );
} }
} }

View File

@ -228,7 +228,7 @@ class Pico
* Loads plugins from PLUGINS_DIR in alphabetical order * Loads plugins from PLUGINS_DIR in alphabetical order
* *
* Plugin files may be prefixed by a number (e.g. 00-PicoDeprecated.php) * Plugin files may be prefixed by a number (e.g. 00-PicoDeprecated.php)
* to indicate their processsing order. You MUST NOT use prefixes between * to indicate their processing order. You MUST NOT use prefixes between
* 00 and 19 (reserved for built-in plugins). * 00 and 19 (reserved for built-in plugins).
* *
* @return void * @return void
@ -497,9 +497,9 @@ class Pico
* ignored and won't be returned. * ignored and won't be returned.
* *
* @see <http://symfony.com/doc/current/components/yaml/introduction.html> * @see <http://symfony.com/doc/current/components/yaml/introduction.html>
* @param string $content the raw file contents * @param string $rawContent the raw file contents
* @param array $headers a array containing the known headers * @param array $headers a array containing the known headers
* @return array parsed meta data * @return array parsed meta data
*/ */
public function parseFileMeta($rawContent, array $headers) public function parseFileMeta($rawContent, array $headers)
{ {
@ -887,9 +887,10 @@ class Pico
* Recursively walks through a directory and returns all containing files * Recursively walks through a directory and returns all containing files
* matching the specified file extension in alphabetical order * matching the specified file extension in alphabetical order
* *
* @param string $directory start directory * @param string $directory start directory
* @param string $ext return files with this file extension only (optional) * @param string $fileExtension return files with the given file extension
* @return array list of found files * only (optional)
* @return array list of found files
*/ */
protected function getFiles($directory, $fileExtension = '') protected function getFiles($directory, $fileExtension = '')
{ {
@ -910,7 +911,7 @@ class Pico
if (is_dir($directory . '/' . $file)) { if (is_dir($directory . '/' . $file)) {
// get files recursively // get files recursively
$result = array_merge($result, $this->getFiles($directory . '/' . $file, $fileExtension)); $result = array_merge($result, $this->getFiles($directory . '/' . $file, $fileExtension));
} elseif (empty($fileExtension) || (substr($file, -strlen($fileExtension)) === $fileExtension)) { } elseif (empty($fileExtension) || (substr($file, -$fileExtensionLength) === $fileExtension)) {
$result[] = $directory . '/' . $file; $result[] = $directory . '/' . $file;
} }
} }

View File

@ -193,7 +193,7 @@ class DummyPlugin extends AbstractPicoPlugin
* Triggered after Pico parsed the contents of the file to serve * Triggered after Pico parsed the contents of the file to serve
* *
* @see Pico::getFileContent() * @see Pico::getFileContent()
* @param stirng &$content parsed contents * @param string &$content parsed contents
* @return void * @return void
*/ */
public function onContentParsed(&$content) public function onContentParsed(&$content)