original_string: public static function get($plugin = null)
      {
          $cacheKey = "get({$plugin})";
          $cache = static::cache($cacheKey);
  
          if ($cache !== null) {
              return $cache;
          }
  
          if ($plugin === null) {
              $collection = [];
              foreach ((array)quickapps('plugins') as $plugin) {
                  $plugin = PackageFactory::create($plugin['name']);
                  if ($plugin instanceof PluginPackage) {
                      $collection[] = $plugin;
                  }
              }
  
              return static::cache($cacheKey, collection($collection));
          }
  
          $package = PackageFactory::create($plugin);
          if ($package instanceof PluginPackage) {
              return static::cache($cacheKey, $package);
          }
  
          throw new FatalErrorException(__d('cms', 'Plugin "{0}" was not found', $plugin));
      }
code: public static function get($plugin = null)
      {
          $cacheKey = "get({$plugin})";
          $cache = static::cache($cacheKey);
  
          if ($cache !== null) {
              return $cache;
          }
  
          if ($plugin === null) {
              $collection = [];
              foreach ((array)quickapps('plugins') as $plugin) {
                  $plugin = PackageFactory::create($plugin['name']);
                  if ($plugin instanceof PluginPackage) {
                      $collection[] = $plugin;
                  }
              }
  
              return static::cache($cacheKey, collection($collection));
          }
  
          $package = PackageFactory::create($plugin);
          if ($package instanceof PluginPackage) {
              return static::cache($cacheKey, $package);
          }
  
          throw new FatalErrorException(__d('cms', 'Plugin "{0}" was not found', $plugin));
      }
code_tokens: public static function get ( $ plugin = null ) { $ cacheKey = "get({$plugin})" ; $ cache = static :: cache ( $ cacheKey ) ; if ( $ cache !== null ) { return $ cache ; } if ( $ plugin === null ) { $ collection = [ ] ; foreach ( ( array ) quickapps ( 'plugins' ) as $ plugin ) { $ plugin = PackageFactory :: create ( $ plugin [ 'name' ] ) ; if ( $ plugin instanceof PluginPackage ) { $ collection [ ] = $ plugin ; } } return static :: cache ( $ cacheKey , collection ( $ collection ) ) ; } $ package = PackageFactory :: create ( $ plugin ) ; if ( $ package instanceof PluginPackage ) { return static :: cache ( $ cacheKey , $ package ) ; } throw new FatalErrorException ( __d ( 'cms' , 'Plugin "{0}" was not found' , $ plugin ) ) ; }
docstring: Get the given plugin as an object, or a collection of objects if not
  specified.
  
  @param string $plugin Plugin name to get, or null to get a collection of
  all plugin objects
  @return \CMS\Core\Package\PluginPackage|\Cake\Collection\Collection
  @throws \Cake\Error\FatalErrorException When requested plugin was not found
docstring_tokens: Get the given plugin as an object or a collection of objects if not specified .