| @@ -80,13 +80,13 @@ discard block | ||
| 80 | 80 | public function info($file, $format = 'json', $decode = true) | 
| 81 | 81 |      { | 
| 82 | 82 |          $this->isPossible('input'); | 
| 83 | -        if(!File::exists($file)) { | |
| 83 | +        if (!File::exists($file)) { | |
| 84 | 84 |              throw new FileNotFoundException('The input file "'.$file.'" not exists!'); | 
| 85 | 85 | } | 
| 86 | 86 | |
| 87 | 87 | $format = in_array($format, ['json', 'xml', 'csv']) ? $format : 'json'; | 
| 88 | 88 |          $data = $this->runCmd('get_file_info', [$this->config['ffprobe'], $format, $file]); | 
| 89 | -        if($format == 'json' && $decode === true) { | |
| 89 | +        if ($format == 'json' && $decode === true) { | |
| 90 | 90 | return json_decode($data, true); | 
| 91 | 91 | } | 
| 92 | 92 | |
| @@ -110,17 +110,17 @@ discard block | ||
| 110 | 110 | public function thumbnail($file, $outputPath, $count = 1, $interval = null) | 
| 111 | 111 |      { | 
| 112 | 112 |          $this->isPossible('input'); | 
| 113 | -        if(!File::exists($file)) { | |
| 113 | +        if (!File::exists($file)) { | |
| 114 | 114 |              throw new FileNotFoundException('The input file "'.$file.'" not exists!'); | 
| 115 | 115 | } | 
| 116 | -        if(!File::isWritable(dirname($outputPath))) { | |
| 116 | +        if (!File::isWritable(dirname($outputPath))) { | |
| 117 | 117 |              throw new NotWritableException('The output path "'.$outputPath.'" is not writable!'); | 
| 118 | 118 | } | 
| 119 | 119 | |
| 120 | -        if($interval == null) { | |
| 120 | +        if ($interval == null) { | |
| 121 | 121 | $interval = 10; | 
| 122 | 122 | $info = $this->info($file); | 
| 123 | -            if(is_array($info)) { | |
| 123 | +            if (is_array($info)) { | |
| 124 | 124 |                  $duration = $this->timestamp(explode('.', $info['format']['duration'])[0]); | 
| 125 | 125 | |
| 126 | 126 | $interval = round($duration / $count); | 
| @@ -143,7 +143,7 @@ discard block | ||
| 143 | 143 | public function from($file) | 
| 144 | 144 |      { | 
| 145 | 145 |          $this->isPossible('input'); | 
| 146 | -        if(!File::exists($file)) { | |
| 146 | +        if (!File::exists($file)) { | |
| 147 | 147 |              throw new FileNotFoundException('The input file "'.$file.'" not exists!'); | 
| 148 | 148 | } | 
| 149 | 149 | |
| @@ -165,7 +165,7 @@ discard block | ||
| 165 | 165 | public function to($outputPath) | 
| 166 | 166 |      { | 
| 167 | 167 |          $this->isPossible('output'); | 
| 168 | -        if(!File::isWritable(dirname($outputPath))) { | |
| 168 | +        if (!File::isWritable(dirname($outputPath))) { | |
| 169 | 169 |              throw new NotWritableException('The output path "'.$outputPath.'" is not writable!'); | 
| 170 | 170 | } | 
| 171 | 171 | |
| @@ -312,7 +312,7 @@ discard block | ||
| 312 | 312 | public function run() | 
| 313 | 313 |      { | 
| 314 | 314 |          $this->parameters[] = sprintf('"%s"', $this->outputPath); | 
| 315 | -        if($this->logPath !== null) { | |
| 315 | +        if ($this->logPath !== null) { | |
| 316 | 316 |              $this->parameters[] = sprintf('>"%s" 2>&1', $this->logPath); | 
| 317 | 317 | } | 
| 318 | 318 | |
| @@ -333,7 +333,7 @@ discard block | ||
| 333 | 333 | */ | 
| 334 | 334 | private function isPossible($context) | 
| 335 | 335 |      { | 
| 336 | -        if($this->nextContext != $context) { | |
| 336 | +        if ($this->nextContext != $context) { | |
| 337 | 337 |              throw new \BadMethodCallException('This method is not possible on this context'); | 
| 338 | 338 | } | 
| 339 | 339 | |
| @@ -65,11 +65,11 @@ | ||
| 65 | 65 | $process = new Process(vsprintf($cmd, array_values($args))); | 
| 66 | 66 | $process->run(); | 
| 67 | 67 | |
| 68 | -        if($process->isSuccessful()) { | |
| 68 | +        if ($process->isSuccessful()) { | |
| 69 | 69 | $output = $process->getOutput(); | 
| 70 | 70 | |
| 71 | -            if(isset($prop['regex'])) { | |
| 72 | -                if(preg_match_all($prop['regex'], $output, $matches)) { | |
| 71 | +            if (isset($prop['regex'])) { | |
| 72 | +                if (preg_match_all($prop['regex'], $output, $matches)) { | |
| 73 | 73 | return array_only($matches, $prop['returns']); | 
| 74 | 74 | } | 
| 75 | 75 | } | 
| @@ -59,9 +59,9 @@ discard block | ||
| 59 | 59 | */ | 
| 60 | 60 | public function formats() | 
| 61 | 61 |      { | 
| 62 | -        if($this->_info['formats'] === null) { | |
| 62 | +        if ($this->_info['formats'] === null) { | |
| 63 | 63 |              $data = $this->runCmd('get_formats', [$this->config['ffmpeg']]); | 
| 64 | -            if(is_array($data)) { | |
| 64 | +            if (is_array($data)) { | |
| 65 | 65 | $this->_info['formats'] = array_combine($data['format'], $data['mux']); | 
| 66 | 66 | } | 
| 67 | 67 | } | 
| @@ -81,10 +81,10 @@ discard block | ||
| 81 | 81 | */ | 
| 82 | 82 | public function encoders() | 
| 83 | 83 |      { | 
| 84 | -        if($this->_info['encoders']['audio'] === []) { | |
| 84 | +        if ($this->_info['encoders']['audio'] === []) { | |
| 85 | 85 |              $data = $this->runCmd('get_encoders', [$this->config['ffmpeg']]); | 
| 86 | -            if(is_array($data)) { | |
| 87 | -                foreach($data['type'] as $key => $type) { | |
| 86 | +            if (is_array($data)) { | |
| 87 | +                foreach ($data['type'] as $key => $type) { | |
| 88 | 88 | $this->_info['encoders'][($type == 'A' ? 'audio' : 'video')][] = $data['format'][$key]; | 
| 89 | 89 | } | 
| 90 | 90 | } | 
| @@ -105,10 +105,10 @@ discard block | ||
| 105 | 105 | */ | 
| 106 | 106 | public function decoders() | 
| 107 | 107 |      { | 
| 108 | -        if($this->_info['decoders']['audio'] === []) { | |
| 108 | +        if ($this->_info['decoders']['audio'] === []) { | |
| 109 | 109 |              $data = $this->runCmd('get_decoders', [$this->config['ffmpeg']]); | 
| 110 | -            if(is_array($data)) { | |
| 111 | -                foreach($data['type'] as $key => $type) { | |
| 110 | +            if (is_array($data)) { | |
| 111 | +                foreach ($data['type'] as $key => $type) { | |
| 112 | 112 | $this->_info['decoders'][($type == 'A' ? 'audio' : 'video')][] = $data['format'][$key]; | 
| 113 | 113 | } | 
| 114 | 114 | } | 
| @@ -144,7 +144,7 @@ discard block | ||
| 144 | 144 | */ | 
| 145 | 145 | protected function timestamp($time, $isDate = true) | 
| 146 | 146 |      { | 
| 147 | -        if($isDate) { | |
| 147 | +        if ($isDate) { | |
| 148 | 148 |              $time = explode(':', $time); | 
| 149 | 149 | |
| 150 | 150 | return ($time[0] * 3600) + ($time[1] * 60) + (ceil($time[2])); | 
| @@ -19,7 +19,7 @@ | ||
| 19 | 19 | */ | 
| 20 | 20 | public function boot() | 
| 21 | 21 |      { | 
| 22 | - $configPath = __DIR__ . '/../../../../config/flavy.php'; | |
| 22 | + $configPath = __DIR__.'/../../../../config/flavy.php'; | |
| 23 | 23 |          $publishPath = config_path('flavy.php'); | 
| 24 | 24 | |
| 25 | 25 | $this->publishes([$configPath => $publishPath], 'config'); |