for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Crowdin API implementation in PHP.
*
* @copyright Copyright (C) 2016 Nikolai Plath (elkuku)
* @license WTFPL - See license.txt
*/
namespace ElKuKu\Crowdin;
use GuzzleHttp\Client as HttpClient;
* Class Package
* @since 1.0
abstract class Package
{
* The Crowdin project id.
* @var string
private $projectId;
* The Crowdin API key.
private $apiKey;
* The HTTP client object.
* @var HttpClient
private $httpClient;
* Constructor.
* @param string $projectId The project ID.
* @param string $apiKey The API key
* @param HttpClient $httpClient The HTTP client object.
public function __construct($projectId, $apiKey, HttpClient $httpClient)
$this->projectId = $projectId;
$this->apiKey = $apiKey;
$this->httpClient = $httpClient;
}
* Get the project ID.
* @return string
protected function getProjectId()
return $this->projectId;
* Get the API key.
protected function getApiKey()
return $this->apiKey;
* Get the HTTP client object.
* @return HttpClient
protected function getHttpClient()
return $this->httpClient;
* Get the base path for the command including an action.
* @param string $action The action to perform.
protected function getBasePath($action)
return sprintf(
'project/%s/%s?key=%s',
$this->getProjectId(),
$action,
$this->getApiKey()
);