Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Merge pull request zendframework/zendframework#1725 from weierophinne…
Browse files Browse the repository at this point in the history
…y/feature/file-i18n

[zen-66] Update File\Transfer to new Translator
  • Loading branch information
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions src/Transfer/Adapter/AbstractAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
Zend\Filter,
Zend\Filter\Exception as FilterException,
Zend\Loader,
Zend\Translator,
Zend\Translator\Adapter as AdapterTranslator,
Zend\I18n\Translator\Translator,
Zend\Validator;

/**
Expand Down Expand Up @@ -82,7 +81,7 @@ abstract class AbstractAdapter
protected $messages = array();

/**
* @var AdapterTranslator\AbstractAdapter
* @var Translator
*/
protected $translator;

Expand Down Expand Up @@ -1093,28 +1092,19 @@ public function getDestination($files = null)
/**
* Set translator object for localization
*
* @param Translator\Translator|AdapterTranslator\AbstractAdapter|null $translator
* @param Translator|null $translator
* @return AbstractAdapter
*/
public function setTranslator($translator = null)
public function setTranslator(Translator $translator = null)
{
if (null === $translator) {
$this->translator = null;
} elseif ($translator instanceof AdapterTranslator\AbstractAdapter) {
$this->translator = $translator;
} elseif ($translator instanceof Translator\Translator) {
$this->translator = $translator->getAdapter();
} else {
throw new Exception\InvalidArgumentException('Invalid translator specified');
}

$this->translator = $translator;
return $this;
}

/**
* Retrieve localization translator object
*
* @return AdapterTranslator\AbstractAdapter|null
* @return Translator|null
*/
public function getTranslator()
{
Expand Down

0 comments on commit 9d50bff

Please sign in to comment.