@@ -45,7 +45,6 @@ discard block |
||
| 45 | 45 | protected $logger; |
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | - * @param LoggerInterface $cache |
|
| 49 | 48 | * @param string[] $options |
| 50 | 49 | */ |
| 51 | 50 | public function __construct(LoggerInterface $logger = null, array $options = []) |
@@ -142,6 +141,9 @@ discard block |
||
| 142 | 141 | return $this->results; |
| 143 | 142 | } |
| 144 | 143 | |
| 144 | + /** |
|
| 145 | + * @param string $text |
|
| 146 | + */ |
|
| 145 | 147 | private function calcCacheKey($text) |
| 146 | 148 | { |
| 147 | 149 | return sha1($text); |
@@ -118,7 +118,7 @@ |
||
| 118 | 118 | mkdir($fileName, 0755, true); |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - $fileName .= '/' . $result->getCacheKey() . '.mp3'; |
|
| 121 | + $fileName .= '/' . $result->getCacheKey() . '.mp3'; |
|
| 122 | 122 | } else { |
| 123 | 123 | $fileName = tempnam(sys_get_temp_dir(), 'tts-') . '.mp3'; |
| 124 | 124 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | if (isset($options['debug'])) { |
| 65 | - $this->debug = (bool)$options['debug']; |
|
| 65 | + $this->debug = (bool) $options['debug']; |
|
| 66 | 66 | $this->isCached = true; |
| 67 | 67 | } |
| 68 | 68 | } |
@@ -118,9 +118,9 @@ discard block |
||
| 118 | 118 | mkdir($fileName, 0755, true); |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - $fileName .= '/' . $result->getCacheKey() . '.mp3'; |
|
| 121 | + $fileName .= '/'.$result->getCacheKey().'.mp3'; |
|
| 122 | 122 | } else { |
| 123 | - $fileName = tempnam(sys_get_temp_dir(), 'tts-') . '.mp3'; |
|
| 123 | + $fileName = tempnam(sys_get_temp_dir(), 'tts-').'.mp3'; |
|
| 124 | 124 | } |
| 125 | 125 | $result->setFile($fileName); |
| 126 | 126 | $result->export(); |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | |
| 17 | 17 | public function make($text, $fileName) |
| 18 | 18 | { |
| 19 | - system('echo \''. $text .'\' | /usr/bin/text2wave -o ' . $fileName); |
|
| 19 | + system('echo \''.$text.'\' | /usr/bin/text2wave -o '.$fileName); |
|
| 20 | 20 | return $fileName; |
| 21 | 21 | } |
| 22 | 22 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | public function setCached($cached = true) |
| 85 | 85 | { |
| 86 | - $this->cached = (bool)$cached; |
|
| 86 | + $this->cached = (bool) $cached; |
|
| 87 | 87 | return $this; |
| 88 | 88 | } |
| 89 | 89 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | public function import() |
| 96 | 96 | { |
| 97 | - $file = $this->file . '.json'; |
|
| 97 | + $file = $this->file.'.json'; |
|
| 98 | 98 | |
| 99 | 99 | if (file_exists($file)) { |
| 100 | 100 | $data = json_decode( |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | public function export() |
| 116 | 116 | { |
| 117 | - $file = $this->file . '.json'; |
|
| 117 | + $file = $this->file.'.json'; |
|
| 118 | 118 | |
| 119 | 119 | file_put_contents($file, json_encode([ |
| 120 | 120 | 'createdAt' => $this->createdAt->format(\DateTime::RFC3339), |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | if (isset($options['driver'])) { |
| 29 | - $adapterClass = __NAMESPACE__. '\\Driver\\' . $options['driver']; |
|
| 29 | + $adapterClass = __NAMESPACE__.'\\Driver\\'.$options['driver']; |
|
| 30 | 30 | } else { |
| 31 | 31 | $adapterClass = Google::class; |
| 32 | 32 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | $cacheDir = $this->getCacheDir(); |
| 68 | 68 | if (!is_dir($cacheDir) || !is_writable($cacheDir)) { |
| 69 | - throw new Exception('Can not write to ' . $cacheDir); |
|
| 69 | + throw new Exception('Can not write to '.$cacheDir); |
|
| 70 | 70 | } |
| 71 | 71 | $cacheDir = dirname($this->prepareFileName($text)); |
| 72 | 72 | if (!is_dir($cacheDir)) { |
@@ -98,18 +98,18 @@ discard block |
||
| 98 | 98 | private function getCacheDir() |
| 99 | 99 | { |
| 100 | 100 | return $this->cacheDir |
| 101 | - . '/' . strtolower($this->driver->getName()) |
|
| 102 | - . '/' .$this->driver->getVoice() . '/'; |
|
| 101 | + . '/'.strtolower($this->driver->getName()) |
|
| 102 | + . '/'.$this->driver->getVoice().'/'; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | private function prepareFileName($text) |
| 106 | 106 | { |
| 107 | 107 | $fileName = $this->prepareUiq($text); |
| 108 | - return $this->getCacheDir() . '/' . substr($fileName, 0, 2) . '/' . substr( |
|
| 108 | + return $this->getCacheDir().'/'.substr($fileName, 0, 2).'/'.substr( |
|
| 109 | 109 | $fileName, |
| 110 | 110 | 2, |
| 111 | 111 | 2 |
| 112 | - ) . '/' . $fileName . '.mp3'; |
|
| 112 | + ).'/'.$fileName.'.mp3'; |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | private function prepareUiq($text) |