Selaa lähdekoodia

Also use symfony/process for chardet

pull/10/head
datagutten 6 vuotta sitten
vanhempi
commit
79f2498d1f
1 muutettua tiedostoa jossa 4 lisäystä ja 1 poistoa
  1. +4
    -1
      src/Chardet.php

+ 4
- 1
src/Chardet.php Näytä tiedosto

@@ -3,6 +3,7 @@
namespace OrpheusNET\Logchecker; namespace OrpheusNET\Logchecker;


use OrpheusNET\Logchecker\Exception\{FileNotFoundException}; use OrpheusNET\Logchecker\Exception\{FileNotFoundException};
use Symfony\Component\Process\Process;


class Chardet { class Chardet {
private $executable = null; private $executable = null;
@@ -29,8 +30,10 @@ class Chardet {
if (!file_exists($filename)) { if (!file_exists($filename)) {
throw new FileNotFoundException($filename); throw new FileNotFoundException($filename);
} }
$process = new Process([$this->executable, $filename]);
$process->run();
$output = $process->getOutput();


$output = shell_exec($this->executable . " " . escapeshellarg($filename));
// Following regex: // Following regex:
// matches[1] - file path // matches[1] - file path
// matches[2] - charset // matches[2] - charset


Ladataan…
Peruuta
Tallenna