Ejemplo n.º 1
0
bool FormatOptions::GetPhpFixerCommand(const wxFileName& fileName, wxString& command)
{
    command.Clear();
    m_optionsPhp.Load();
    wxString phar, php, parameters, filePath;
    php = m_optionsPhp.GetPhpExe();
    if(php.IsEmpty()) {
        clDEBUG() << "CodeForamtter: GetPhpFixerCommand(): empty php command" << clEndl;
        return false;
    }
    ::WrapWithQuotes(php);
    phar = GetPHPCSFixerPhar();
    if(phar.IsEmpty()) {
        clDEBUG() << "CodeForamtter: GetPhpFixerCommand(): empty php-cs-fixer phar path" << clEndl;
        return false;
    }
    ::WrapWithQuotes(phar);

    parameters = GetPHPCSFixerPharOptions();
    if(parameters.IsEmpty()) {
        if(m_PHPCSFixerPharSettings & kPcfAllowRisky) {
            parameters << " --allow-risky=yes";
        }

        parameters << GetPhpFixerRules(fileName);
    }
    parameters.Trim().Trim(false);
    clDEBUG() << parameters << clEndl;

    filePath = fileName.GetFullPath();
    ::WrapWithQuotes(filePath);

    command << php << " " << phar << " fix " << parameters << " " << filePath;
    return true;
}
Ejemplo n.º 2
0
wxString FormatOptions::GetPhpFixerCommand() const
{
    wxString command, phar, php, options;
    php << GetPhpExecutable();
    ::WrapWithQuotes(php);
    
    phar << GetPHPCSFixerPhar();
    ::WrapWithQuotes(phar);
    
    options << GetPHPCSFixerPharOptions();
    options.Trim().Trim(false);
    command << php << " " << phar << " fix " << options;
    return command;
}