Beispiel #1
0
 /**
  * @param array $libraryPaths
  *
  * @throws ServiceUnavailableException
  */
 protected static function initializeLibraryPaths($libraryPaths = null)
 {
     static::$libraryPaths = \Cache::get('scripting.library_paths', []);
     static::$libraries = \Cache::get('scripting.libraries', []);
     //  Add ones from constructor
     $libraryPaths = ArrayUtils::clean($libraryPaths);
     //  Application storage script path
     $libraryPaths[] = storage_path('scripting');
     //  Merge in config libraries...
     $libraryPaths = array_merge($libraryPaths, ArrayUtils::clean(\Config::get('df.scripting.paths', [])));
     //  Add them to collection if valid
     if (is_array($libraryPaths)) {
         foreach ($libraryPaths as $path) {
             if (!in_array($path, static::$libraryPaths)) {
                 if (!empty($path) || is_dir($path) || is_readable($path)) {
                     static::$libraryPaths[] = $path;
                 } else {
                     Log::debug("Invalid scripting library path given {$path}.");
                 }
             }
         }
     }
     \Cache::add('scripting.library_paths', static::$libraryPaths, static::DEFAULT_CACHE_TTL);
     if (empty(static::$libraryPaths)) {
         Log::debug('No scripting library paths found.');
     }
 }
Beispiel #2
0
 /**
  * Register PSR-0 libraries with the Autoloader.
  *
  * The library names given to this method should match directories within
  * the application libraries directory. This method provides an easy way
  * to indicate that some libraries should be loaded using the PSR-0
  * naming conventions instead of the Laravel conventions.
  *
  * <code>
  *		// Register the "Assetic" library with the Autoloader
  *		Autoloader::libraries('Assetic');
  *
  *		// Register several libraries with the Autoloader
  *		Autoloader::libraries(array('Assetic', 'Twig'));
  * </code>
  *
  * @param  array  $libraries
  * @return void
  */
 public static function libraries($libraries)
 {
     static::$libraries = array_merge(static::$libraries, (array) $libraries);
 }