Skip to content

Commit

Permalink
Changed the project variable to be compound
Browse files Browse the repository at this point in the history
  • Loading branch information
jguittard committed Jan 30, 2016
1 parent ced0fee commit 50bc775
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/Task/PoeditorTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,22 @@ class PoeditorTask extends Task
protected $token;

/**
* ID of the project
* Identifier of the project
*
* @var string
*/
protected $project;

/**
* @var string
*/
protected $id;

/**
* @var string
*/
protected $module;

/**
* Language code
*
Expand Down Expand Up @@ -154,6 +164,11 @@ public function getProject()
*/
public function setProject($project)
{
$parts = explode('-', $project);
if (count($parts) > 1) {
$this->module = ucfirst($parts[0]);
$this->id = $parts[1];
}
$this->project = $project;
return $this;
}
Expand Down Expand Up @@ -275,7 +290,7 @@ public function main()

protected function retrieveFileName()
{
return $this->getExportPath() . DIRECTORY_SEPARATOR . $this->languages[$this->getLanguage()] . '.' . $this->getType();
return $this->getExportPath() . DIRECTORY_SEPARATOR . ucfirst($this->project) . DIRECTORY_SEPARATOR . 'language' . DIRECTORY_SEPARATOR . $this->languages[$this->getLanguage()] . '.' . $this->getType();
}

/**
Expand All @@ -286,7 +301,7 @@ protected function getPostParams()
return [
'api_token' => $this->getToken(),
'action' => 'export',
'id' => $this->getProject(),
'id' => $this->id,
'type' => $this->getType() ?: self::DEFAULT_TYPE,
'language' => $this->getLanguage(),
];
Expand Down

0 comments on commit 50bc775

Please sign in to comment.