public function checkText(EncodingAwareSource $source, array $languages): array
    {
        $process = $this->createProcess($this->createArguments($source, $languages));
        $process->setEnv($this->createEnvVars($source, $languages));

        $process->setInput($source->getAsString());

        try {
            $process->run();
        } catch (RuntimeException $e) {
            throw new ExternalProgramFailedException(
                $process->getCommandLine(),
                $e->getMessage(),
                0,
                $e
            );
        }

        try {
            $exitCode = $process->getExitCode();
        } catch (RuntimeException $e) {
            throw new EnvironmentException($e->getMessage(), $e->getCode(), $e);
        }

        if (0 !== $exitCode) {
            throw new ExternalProgramFailedException(
                $process->getCommandLine(),
                $process->getErrorOutput() ?: $process->getOutput(),
                $exitCode
            );
        }

        $output = $process->getOutput();

        if ($source instanceof EncodingAwareSource
            && strcasecmp($source->getEncoding(), 'UTF-8') !== 0
        ) {
            $output = iconv($source->getEncoding(), 'UTF-8', $output);
        }

        return $this->parseOutput($output);
    }
public function checkText(EncodingAwareSource $source, array $languages): array
    {
        $process = $this->createProcess($this->createArguments($source, $languages));
        $process->setEnv($this->createEnvVars($source, $languages));

        $process->setInput($source->getAsString());

        try {
            $process->run();
        } catch (RuntimeException $e) {
            throw new ExternalProgramFailedException(
                $process->getCommandLine(),
                $e->getMessage(),
                0,
                $e
            );
        }

        try {
            $exitCode = $process->getExitCode();
        } catch (RuntimeException $e) {
            throw new EnvironmentException($e->getMessage(), $e->getCode(), $e);
        }

        if (0 !== $exitCode) {
            throw new ExternalProgramFailedException(
                $process->getCommandLine(),
                $process->getErrorOutput() ?: $process->getOutput(),
                $exitCode
            );
        }

        $output = $process->getOutput();

        if ($source instanceof EncodingAwareSource
            && strcasecmp($source->getEncoding(), 'UTF-8') !== 0
        ) {
            $output = iconv($source->getEncoding(), 'UTF-8', $output);
        }

        return $this->parseOutput($output);
    }
public function checkText ( EncodingAwareSource $ source , array $ languages ) : array { $ process = $ this -> createProcess ( $ this -> createArguments ( $ source , $ languages ) ) ; $ process -> setEnv ( $ this -> createEnvVars ( $ source , $ languages ) ) ; $ process -> setInput ( $ source -> getAsString ( ) ) ; try { $ process -> run ( ) ; } catch ( RuntimeException $ e ) { throw new ExternalProgramFailedException ( $ process -> getCommandLine ( ) , $ e -> getMessage ( ) , 0 , $ e ) ; } try { $ exitCode = $ process -> getExitCode ( ) ; } catch ( RuntimeException $ e ) { throw new EnvironmentException ( $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e ) ; } if ( 0 !== $ exitCode ) { throw new ExternalProgramFailedException ( $ process -> getCommandLine ( ) , $ process -> getErrorOutput ( ) ? : $ process -> getOutput ( ) , $ exitCode ) ; } $ output = $ process -> getOutput ( ) ; if ( $ source instanceof EncodingAwareSource && strcasecmp ( $ source -> getEncoding ( ) , 'UTF-8' ) !== 0 ) { $ output = iconv ( $ source -> getEncoding ( ) , 'UTF-8' , $ output ) ; } return $ this -> parseOutput ( $ output ) ; }
Check text.

Check given text and return an array of spelling issues.

@param EncodingAwareSource $source    Text source to check.
@param array               $languages List of languages used in text (IETF language tag).

@return Issue[]

@see   http://tools.ietf.org/html/bcp47
@since 1.6
Check text .