Selaa lähdekoodia

Various fixes

Thanks @PontusHorn for spotting!
Daniel Rudolf 9 vuotta sitten
vanhempi
commit
71e7da28cc
3 muutettua tiedostoa jossa 13 lisäystä ja 12 poistoa
  1. 3 3
      lib/AbstractPicoPlugin.php
  2. 9 8
      lib/Pico.php
  3. 1 1
      plugins/DummyPlugin.php

+ 3 - 3
lib/AbstractPicoPlugin.php

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

+ 9 - 8
lib/Pico.php

@@ -228,7 +228,7 @@ class Pico
      * Loads plugins from PLUGINS_DIR in alphabetical order
      *
      * 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).
      *
      * @return void
@@ -497,9 +497,9 @@ class Pico
      * ignored and won't be returned.
      *
      * @see    <http://symfony.com/doc/current/components/yaml/introduction.html>
-     * @param  string $content the raw file contents
-     * @param  array  $headers a array containing the known headers
-     * @return array           parsed meta data
+     * @param  string $rawContent the raw file contents
+     * @param  array  $headers    a array containing the known headers
+     * @return array              parsed meta data
      */
     public function parseFileMeta($rawContent, array $headers)
     {
@@ -887,9 +887,10 @@ class Pico
      * Recursively walks through a directory and returns all containing files
      * matching the specified file extension in alphabetical order
      *
-     * @param  string $directory start directory
-     * @param  string $ext       return files with this file extension only (optional)
-     * @return array             list of found files
+     * @param  string $directory     start directory
+     * @param  string $fileExtension return files with the given file extension
+     *     only (optional)
+     * @return array                 list of found files
      */
     protected function getFiles($directory, $fileExtension = '')
     {
@@ -910,7 +911,7 @@ class Pico
                 if (is_dir($directory . '/' . $file)) {
                     // get files recursively
                     $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;
                 }
             }

+ 1 - 1
plugins/DummyPlugin.php

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