Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/vendor/sebastianfeldmann/git/src/Command/Apply/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/sebastianfeldmann/git/src/Command/Apply/ApplyPatch.php
<?php

/**
 * This file is part of SebastianFeldmann\Git.
 *
 * (c) Sebastian Feldmann <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace SebastianFeldmann\Git\Command\Apply;

use SebastianFeldmann\Git\Command\Base;

/**
 * Class ApplyPatch
 *
 * @package SebastianFeldmann\Git
 * @author  Sebastian Feldmann <[email protected]>
 * @link    https://github.com/sebastianfeldmann/git
 * @since   Class available since Release 3.7.0
 */
class ApplyPatch extends Base
{
    /**
     * Patch files to apply.
     *
     * @var string[]
     */
    private $patchFiles = [];

    /**
     * Action to take when encountering whitespace.
     *
     * @var string
     */
    private $whitespace = ' --whitespace=\'warn\'';

    /**
     * Number of leading path components to remove from the diff paths.
     *
     * @var string
     */
    private $pathComponents = ' -p1';

    /**
     * Ignore changes in whitespace in context lines.
     *
     * @var string
     */
    private $ignoreSpaceChange = '';

    /**
     * Patch files to apply.
     *
     * @param string[] $patchFiles
     * @return \SebastianFeldmann\Git\Command\Apply\ApplyPatch
     */
    public function patches(array $patchFiles): ApplyPatch
    {
        $this->patchFiles = $patchFiles;
        return $this;
    }

    /**
     * Set the action to take when encountering whitespace.
     *
     * @param  string $action
     * @return \SebastianFeldmann\Git\Command\Apply\ApplyPatch
     */
    public function whitespace(string $action = 'warn'): ApplyPatch
    {
        $this->whitespace = ' --whitespace=' . escapeshellarg($action);
        return $this;
    }

    /**
     * Set the number of leading path components to remove from the diff paths.
     *
     * @param  int $pathComponents
     * @return \SebastianFeldmann\Git\Command\Apply\ApplyPatch
     */
    public function pathComponents(int $pathComponents = 1): ApplyPatch
    {
        $this->pathComponents = ' -p' . $pathComponents;
        return $this;
    }

    /**
     * Ignore changes in whitespace in context lines if necessary.
     *
     * @param bool $bool
     * @return \SebastianFeldmann\Git\Command\Apply\ApplyPatch
     */
    public function ignoreSpaceChange(bool $bool = true): ApplyPatch
    {
        $this->ignoreSpaceChange = $this->useOption('--ignore-space-change', $bool);
        return $this;
    }

    /**
     * Return the command to execute.
     *
     * @return string
     */
    protected function getGitCommand(): string
    {
        return 'apply'
            . $this->pathComponents
            . $this->whitespace
            . $this->ignoreSpaceChange
            . ' '
            . implode(' ', array_map('escapeshellarg', $this->patchFiles));
    }
}

Spamworldpro Mini