Platformsh\Cli\Api::loadTokenFromFile PHP Method

loadTokenFromFile() protected method

Load an API token from a file.
protected loadTokenFromFile ( string $filename ) : string
$filename string A filename, either relative to the user config directory, or absolute.
return string
    protected function loadTokenFromFile($filename)
    {
        if (strpos($filename, '/') !== 0 && strpos($filename, '\\') !== 0) {
            $filename = $this->config->getUserConfigDir() . '/' . $filename;
        }
        $content = file_get_contents($filename);
        if ($content === false) {
            throw new \RuntimeException('Failed to read file: ' . $filename);
        }
        return trim($content);
    }