Skip to content

Commit

Permalink
[2.3] Static Code Analysis for Components
Browse files Browse the repository at this point in the history
  • Loading branch information
kalessil authored and fabpot committed Dec 31, 2015
1 parent 08cb7fb commit 5edacf0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
14 changes: 4 additions & 10 deletions Dumper/IcuResFileDumper.php
Expand Up @@ -34,8 +34,8 @@ public function dump(MessageCatalogue $messages, $options = array())
$file = $messages->getLocale().'.'.$this->getExtension();
$path = $options['path'].'/'.$domain.'/';

if (!file_exists($path)) {
mkdir($path);
if (!is_dir($path) && !@mkdir($path) && !is_dir($path)) {
throw new \RuntimeException(sprintf('File Dumper was not able to create directory "%s"', $path));
}

// backup
Expand Down Expand Up @@ -102,11 +102,7 @@ public function format(MessageCatalogue $messages, $domain = 'messages')
1, 4, 0, 0 // Unicode version
);

$output = $header
.$root
.$data;

return $output;
return $header.$root.$data;
}

private function writePadding($data)
Expand All @@ -120,9 +116,7 @@ private function writePadding($data)

private function getPosition($data)
{
$position = (strlen($data) + 28) / 4;

return $position;
return (strlen($data) + 28) / 4;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions Writer/TranslationWriter.php
Expand Up @@ -67,8 +67,8 @@ public function writeTranslations(MessageCatalogue $catalogue, $format, $options
// get the right dumper
$dumper = $this->dumpers[$format];

if (isset($options['path']) && !is_dir($options['path'])) {
mkdir($options['path'], 0777, true);
if (isset($options['path']) && !is_dir($options['path']) && !@mkdir($options['path'], 0777, true) && !is_dir($options['path'])) {
throw new \RuntimeException(sprintf('Translation Writer was not able to create directory "%s"', $options['path']));
}

// save
Expand Down

0 comments on commit 5edacf0

Please sign in to comment.