Fragen\GitHub_Updater\GitLab_API::get_remote_readme PHP Метод

get_remote_readme() публичный Метод

Read and parse remote readme.txt.
public get_remote_readme ( ) : boolean
Результат boolean
    public function get_remote_readme()
    {
        if (!file_exists($this->type->local_path . 'readme.txt') && !file_exists($this->type->local_path_extended . 'readme.txt')) {
            return false;
        }
        $response = isset($this->response['readme']) ? $this->response['readme'] : false;
        /*
         * Set $response from local file if no update available.
         */
        if (!$response && !$this->can_update($this->type)) {
            $response = new \stdClass();
            $content = $this->get_local_info($this->type, 'readme.txt');
            if ($content) {
                $response->content = $content;
            } else {
                $response = false;
            }
        }
        if (!$response) {
            $id = $this->get_gitlab_id();
            self::$method = 'readme';
            $response = $this->api('/projects/' . $id . '/repository/files?file_path=readme.txt');
        }
        if ($response && isset($response->content)) {
            $file = base64_decode($response->content);
            $parser = new Readme_Parser($file);
            $response = $parser->parse_data();
            $this->set_transient('readme', $response);
        }
        if ($this->validate_response($response)) {
            return false;
        }
        $this->set_readme_info($response);
        return true;
    }