/**
  * {@inheritDoc}
  *
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (!($this->project && $this->getApi())) {
         $this->writelnAlways($output, '<error>No project set or no API received, exiting.</error>');
         return;
     }
     $project = new Project($this->getApi());
     $project->setSlug($this->project);
     $resources = $project->getResources();
     $files = $this->getAllTxFiles($this->baselanguage);
     foreach ($files as $file => $basename) {
         $noext = basename($basename, '.xlf');
         if (array_key_exists($this->prefix . $noext, $resources)) {
             // already present, update.
             $this->writeln($output, sprintf('Updating ressource <info>%s</info>', $this->prefix . $noext));
             /** @var \CyberSpectrum\Transifex\TranslationResource $resource */
             $resource = $resources[$this->prefix . $noext];
             $resource->setContent(file_get_contents($file));
             $resource->updateContent();
         } else {
             $this->writeln($output, sprintf('Creating new ressource <info>%s</info>', $this->prefix . $noext));
             // upload new.
             $resource = new TranslationResource($this->getApi());
             $resource->setProject($this->project);
             $resource->setSlug($this->prefix . $noext);
             $resource->setName($resource->getSlug());
             $resource->setSourceLanguageCode($this->baselanguage);
             $resource->setContent(file_get_contents($file));
             $resource->create();
         }
     }
 }
 /**
  * {@inheritDoc}
  *
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $translationMode = $input->getOption('mode');
     // HOTFIX: translated actually appears to be "translator".
     if ($translationMode == 'translated') {
         $translationMode = 'translator';
     }
     $allLanguages = $input->getArgument('languages') == 'all';
     $project = new Project($this->getApi());
     $project->setSlug($this->project);
     $resources = $project->getResources();
     foreach ($resources as $resource) {
         $this->handleResource($resource, $translationMode, $allLanguages, $output);
     }
 }