system/src/Grav/Common/GPM/GPM.php
/**
     * Searches for a Package in the repository
     * @param  string $search Can be either the slug or the name
     * @return Remote\Package Package if found, FALSE if not
     */
Searches for a Package in the repository
@param  string $search Can be either the slug or the name
@return Remote\Package Package if found, FALSE if not
Searches for a Package in the repository @param string $search Can be either the slug or the name @return Remote \ Package Package if found FALSE if not
public function findPackage($search)
    {
        $search = strtolower($search);
        $found = $this->getRepositoryTheme($search);
        if ($found) {
            return $found;
        }
        $found = $this->getRepositoryPlugin($search);
        if ($found) {
            return $found;
        }
        $themes = $this->getRepositoryThemes();
        $plugins = $this->getRepositoryPlugins();
        if (!$themes && !$plugins) {
            if (!is_writable(ROOT_DIR . '/cache/gpm')) {
                throw new \RuntimeException("The cache/gpm folder is not writable. Please check the folder permissions.");
            }
            throw new \RuntimeException("GPM not reachable. Please check your internet connection or check the Grav site is reachable");
        }
        if ($themes) {
            foreach ($themes as $slug => $theme) {
                if ($search == $slug || $search == $theme->name) {
                    return $theme;
                }
            }
        }
        if ($plugins) {
            foreach ($plugins as $slug => $plugin) {
                if ($search == $slug || $search == $plugin->name) {
                    return $plugin;
                }
            }
        }
        return false;
    }
public function findPackage ( $ search ) { $ search = strtolower ( $ search ) ; $ found = $ this -> getRepositoryTheme ( $ search ) ; if ( $ found ) { return $ found ; } $ found = $ this -> getRepositoryPlugin ( $ search ) ; if ( $ found ) { return $ found ; } $ themes = $ this -> getRepositoryThemes ( ) ; $ plugins = $ this -> getRepositoryPlugins ( ) ; if ( ! $ themes && ! $ plugins ) { if ( ! is_writable ( ROOT_DIR . '/cache/gpm' ) ) { throw new \ RuntimeException ( " The cache/gpm folder is not writable. Please check the folder permissions. " ) ; } throw new \ RuntimeException ( " GPM not reachable. Please check your internet connection or check the Grav site is reachable " ) ; } if ( $ themes ) { foreach ( $ themes as $ slug => $ theme ) { if ( $ search == $ slug || $ search == $ theme -> name ) { return $ theme ; } } } if ( $ plugins ) { foreach ( $ plugins as $ slug => $ plugin ) { if ( $ search == $ slug || $ search == $ plugin -> name ) { return $ plugin ; } } } return false ; }
Searches for a Package in the repository
 @param  string $search Can be either the slug or the name
 @return Remote\Package Package if found, FALSE if not
Searches for a Package in the repository @param string $search Can be either the slug or the name @return Remote \ Package Package if found FALSE if not