Add to version control

@param  string            $path
@throws \RuntimeException
@return string
555259
public function add($path)
    {
        if (null === $this->wc) {
            throw new \RuntimeException('Working copy not initialized, have you tried checkout()?');
        }

        return $this->wc->add($path);
    }
1365572
public function read($path)
    {
        $path = $this->getPath($path);
        if (!is_readable($path) || !is_file($path)) {
            throw new RuntimeException($path . ' is not readable file');
        }

        return file_get_contents($path);
    }
593289
public function addPath($path) {
        if (substr($path, 0, 3) === '../') {
            $path = realpath(__DIR__ . '/' . $path);
        }

        if (substr($path, -1) !== '/') {
            $path .= '/';
        }

        $this->_paths[] = $path;

        return $this;
    }
146691
protected function writeFile($path)
    {
        $handle = fopen($path, Stream::MODE_READ_WRITE_RESET);

        if ($handle === false) {
            throw new \RuntimeException('Unable to write to path: ' . $path);
        }

        $this->stream->rewind();

        while (!$this->stream->eof()) {
            fwrite($handle, $this->stream->read(4096));
        }

        fclose($handle);
    }
945966
public function setRuntimePath($path)
    {
        if (($runtimePath = realpath($path)) === false || !is_dir($runtimePath) || !is_writable($runtimePath)) {
            throw new Exception(Mindy::t('base', 'Application runtime path "{path}" is not valid. Please make sure it is a directory writable by the Web server process.', ['{path}' => $path]));
        }
        $this->_runtimePath = $runtimePath;
    }
1286567
public function expand($path)
    {
        if (0 !== strpos($path, '@')) {
            return $path;
        }

        list($bundleName, $relPath) = explode('/', substr($path, 1), 2);

        $bundle = $this->kernel->getBundle($bundleName);

        return sprintf('%s/%s', $bundle->getPath(), $relPath);
    }
925251
public function setPath($path)
    {
        $this->path = $path;
        $fileFullPath = "{$this->rootPath}/{$this->path}";
        // readable ?
        if (file_exists($fileFullPath)) {
            $this->file = $fileFullPath;
            return $this;
        }
        // absolute path ?
        if (file_exists($path) && strpos($path, $this->rootPath) === 0) {
            $this->file = $path;
            $this->rootPath = '/';
        } else {
            error_log("[BEAR.Ace] 404: {$fileFullPath}");
            throw new Exception('Not found ' . $fileFullPath, 404);
        }

        return $this;
    }
558610
protected static function loadAddonConfig($path, $name)
    {
        if (file_exists($path.'/addon.php')) {
            $config = require $path.'/addon.php';
        } else {
            throw new RuntimeException("No such config file for addon '$name', need 'addon.php'.");
        }

        $version = array_get($config, 'version', 5);
        if ($version != 5) {
            throw new RuntimeException($version.': Illigal addon version.');
        }

        return $config;
    }
405397
protected function addFileExtension(string $path): string
    {
        $extension = pathinfo($path, PATHINFO_EXTENSION);
        if (empty($extension)) {
            $path .= $this->extension;
        }

        return $path;
    }
1090609
public function updateByPath($path)
    {
        $response = $this->httpRequest($path, Requests::PUT, $this);

        return $this->populate($response);
    }
594158
public function addPath($path)
	{
		$path = rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
		$this->finder->addPath($path);

		if ($this->environment)
		{
			$this->finder->addPath($path.$this->environment);
		}

		return $this;
	}
1115649
public function addConfigPath($path)
    {
        if (!file_exists($path) || !is_dir($path) || !is_readable($path)) {
            throw new Exception(
                'Invalid or unreadable path: '.$path,
                Exception::INVALID_PATH
            );
        }
        $this->configPaths[] = $path;

        return $this;
    }
109689
protected function makeAppAddon($path)
    {
        $config = [
            'namespace' => trim($this->getAppNamespace(), '\\'),
        ];

        return new Addon(null, 'app', $path, $config);
    }
347688
public function set($path, $create = false)
    {
        $zip = $this->zip;
        $flag = $create ? $zip::CREATE : null;

        if ($this->zip->open($path, $flag) !== true) {
            throw new RuntimeException("Failed to open ZIP file $path");
        }

        return $this;
    }
1570
public function addPath($path)
    {
        if (empty($path) || false === ($real_path = realpath($path))) {
            throw new FileNotFoundException(null, 0, null, $path);
        }
        $this->paths[] = $real_path;

        return $this;
    }
926792
public function createRuntimeClient($path)
    {
        $kernel = RuntimeKernel::getKernel();

        return new Protocol1RuntimeClient(
            $kernel->getProtocol1RuntimeGoalStateClient(),
            $kernel->getProtocol1RuntimeCurrentStateClient(),
            $path
        );
    }
1189963
public function loadEnv(string $path): Configurator
    {
        if (is_readable($path)) {
            $this->dotEnv->load($path);
        }

        return $this;
    }