protected function makeMainClient()
	{
		$this->mainClientData['uses'] = [
			'GuzzleHttp\Client as GuzzleClient'
		];
		$this->mainClientData['managers'] = [];
		$this->mainClientData['className'] = 'ApiClient';
		$this->mainClientData['classPhpDocTitle'] = $this->openApiFileContent['info']['title'] . ' client class';
		$this->mainClientData['classPhpDocTitle'] .= $this->openApiFileContent['info']['version'] ? (' (version ' . $this->openApiFileContent['info']['version'] . ')') : '';
		$this->mainClientData['namespace'] = $this->namespace;

		$this->mainClientData['info'] = $this->openApiFileContent['info'];

		$firstKey = array_keys($this->openApiFileContent['servers'])[0];
		$this->mainClientData['apiBaseUrl'] = $this->openApiFileContent['servers'][$firstKey]['url'];

		// Security
		// @todo Not only OAuth support
		// @todo Scopes support ?
		$this->mainClientData['useBearerToken'] = false;
		if (isset($this->openApiFileContent['security'])) {
			foreach ($this->openApiFileContent['security'] as $s) {
				foreach ($s as $securityRequirement => $scope) {
					// Ignoring scopes...
					if (!isset($this->mainClientData['security'])) {
						$this->mainClientData['security'] = [];
					}
					$this->mainClientData['security'][$securityRequirement] = $this->openApiFileContent['components']['securitySchemes'][$securityRequirement];

					if ($this->openApiFileContent['components']['securitySchemes'][$securityRequirement]['type'] == 'http') {
						if ($this->openApiFileContent['components']['securitySchemes'][$securityRequirement]['scheme'] == 'bearer') {
							$this->mainClientData['useBearerToken'] = true;
						}
					}

					if ($this->openApiFileContent['components']['securitySchemes'][$securityRequirement]['type'] == 'oauth2') {
						$this->mainClientData['useBearerToken'] = true;
					}
				}
			}
		}

		// Add extra Guzzle classes in uses
		if ($this->mainClientData['useBearerToken']) {
			$this->mainClientData['uses'][] = 'Psr\Http\Message\RequestInterface';
			$this->mainClientData['uses'][] = 'GuzzleHttp\HandlerStack';
			$this->mainClientData['uses'][] = 'GuzzleHttp\Handler\CurlHandler';
			$this->mainClientData['uses'][] = 'GuzzleHttp\Middleware';
		}

		foreach ($this->managersData as $managerName => $managerData) {
			$this->mainClientData['uses'][] = $this->namespace . '\\Managers\\' . $managerName . 'Manager';
			$this->mainClientData['managers'][$managerName] = [
				'name' => $managerName,
				'className' => $managerName . 'Manager',
				'lowerCamelCaseClassName' => lcfirst($managerName . 'Manager')
			];
		}
	}
protected function makeMainClient()
	{
		$this->mainClientData['uses'] = [
			'GuzzleHttp\Client as GuzzleClient'
		];
		$this->mainClientData['managers'] = [];
		$this->mainClientData['className'] = 'ApiClient';
		$this->mainClientData['classPhpDocTitle'] = $this->openApiFileContent['info']['title'] . ' client class';
		$this->mainClientData['classPhpDocTitle'] .= $this->openApiFileContent['info']['version'] ? (' (version ' . $this->openApiFileContent['info']['version'] . ')') : '';
		$this->mainClientData['namespace'] = $this->namespace;

		$this->mainClientData['info'] = $this->openApiFileContent['info'];

		$firstKey = array_keys($this->openApiFileContent['servers'])[0];
		$this->mainClientData['apiBaseUrl'] = $this->openApiFileContent['servers'][$firstKey]['url'];

		// Security
		// @todo Not only OAuth support
		// @todo Scopes support ?
		$this->mainClientData['useBearerToken'] = false;
		if (isset($this->openApiFileContent['security'])) {
			foreach ($this->openApiFileContent['security'] as $s) {
				foreach ($s as $securityRequirement => $scope) {
					// Ignoring scopes...
					if (!isset($this->mainClientData['security'])) {
						$this->mainClientData['security'] = [];
					}
					$this->mainClientData['security'][$securityRequirement] = $this->openApiFileContent['components']['securitySchemes'][$securityRequirement];

					if ($this->openApiFileContent['components']['securitySchemes'][$securityRequirement]['type'] == 'http') {
						if ($this->openApiFileContent['components']['securitySchemes'][$securityRequirement]['scheme'] == 'bearer') {
							$this->mainClientData['useBearerToken'] = true;
						}
					}

					if ($this->openApiFileContent['components']['securitySchemes'][$securityRequirement]['type'] == 'oauth2') {
						$this->mainClientData['useBearerToken'] = true;
					}
				}
			}
		}

		// Add extra Guzzle classes in uses
		if ($this->mainClientData['useBearerToken']) {
			$this->mainClientData['uses'][] = 'Psr\Http\Message\RequestInterface';
			$this->mainClientData['uses'][] = 'GuzzleHttp\HandlerStack';
			$this->mainClientData['uses'][] = 'GuzzleHttp\Handler\CurlHandler';
			$this->mainClientData['uses'][] = 'GuzzleHttp\Middleware';
		}

		foreach ($this->managersData as $managerName => $managerData) {
			$this->mainClientData['uses'][] = $this->namespace . '\\Managers\\' . $managerName . 'Manager';
			$this->mainClientData['managers'][$managerName] = [
				'name' => $managerName,
				'className' => $managerName . 'Manager',
				'lowerCamelCaseClassName' => lcfirst($managerName . 'Manager')
			];
		}
	}
protected function makeMainClient ( ) { $ this -> mainClientData [ 'uses' ] = [ 'GuzzleHttp\Client as GuzzleClient' ] ; $ this -> mainClientData [ 'managers' ] = [ ] ; $ this -> mainClientData [ 'className' ] = 'ApiClient' ; $ this -> mainClientData [ 'classPhpDocTitle' ] = $ this -> openApiFileContent [ 'info' ] [ 'title' ] . ' client class' ; $ this -> mainClientData [ 'classPhpDocTitle' ] .= $ this -> openApiFileContent [ 'info' ] [ 'version' ] ? ( ' (version ' . $ this -> openApiFileContent [ 'info' ] [ 'version' ] . ')' ) : '' ; $ this -> mainClientData [ 'namespace' ] = $ this -> namespace ; $ this -> mainClientData [ 'info' ] = $ this -> openApiFileContent [ 'info' ] ; $ firstKey = array_keys ( $ this -> openApiFileContent [ 'servers' ] ) [ 0 ] ; $ this -> mainClientData [ 'apiBaseUrl' ] = $ this -> openApiFileContent [ 'servers' ] [ $ firstKey ] [ 'url' ] ; // Security
 // @todo Not only OAuth support
 // @todo Scopes support ?
 $ this -> mainClientData [ 'useBearerToken' ] = false ; if ( isset ( $ this -> openApiFileContent [ 'security' ] ) ) { foreach ( $ this -> openApiFileContent [ 'security' ] as $ s ) { foreach ( $ s as $ securityRequirement => $ scope ) { // Ignoring scopes...
 if ( ! isset ( $ this -> mainClientData [ 'security' ] ) ) { $ this -> mainClientData [ 'security' ] = [ ] ; } $ this -> mainClientData [ 'security' ] [ $ securityRequirement ] = $ this -> openApiFileContent [ 'components' ] [ 'securitySchemes' ] [ $ securityRequirement ] ; if ( $ this -> openApiFileContent [ 'components' ] [ 'securitySchemes' ] [ $ securityRequirement ] [ 'type' ] == 'http' ) { if ( $ this -> openApiFileContent [ 'components' ] [ 'securitySchemes' ] [ $ securityRequirement ] [ 'scheme' ] == 'bearer' ) { $ this -> mainClientData [ 'useBearerToken' ] = true ; } } if ( $ this -> openApiFileContent [ 'components' ] [ 'securitySchemes' ] [ $ securityRequirement ] [ 'type' ] == 'oauth2' ) { $ this -> mainClientData [ 'useBearerToken' ] = true ; } } } } // Add extra Guzzle classes in uses
 if ( $ this -> mainClientData [ 'useBearerToken' ] ) { $ this -> mainClientData [ 'uses' ] [ ] = 'Psr\Http\Message\RequestInterface' ; $ this -> mainClientData [ 'uses' ] [ ] = 'GuzzleHttp\HandlerStack' ; $ this -> mainClientData [ 'uses' ] [ ] = 'GuzzleHttp\Handler\CurlHandler' ; $ this -> mainClientData [ 'uses' ] [ ] = 'GuzzleHttp\Middleware' ; } foreach ( $ this -> managersData as $ managerName => $ managerData ) { $ this -> mainClientData [ 'uses' ] [ ] = $ this -> namespace . '\\Managers\\' . $ managerName . 'Manager' ; $ this -> mainClientData [ 'managers' ] [ $ managerName ] = [ 'name' => $ managerName , 'className' => $ managerName . 'Manager' , 'lowerCamelCaseClassName' => lcfirst ( $ managerName . 'Manager' ) ] ; } }
Make the main client data
Make the main client data