<commit_before><?php

namespace SDK\Build\Dependency;

use SDK\Config;
use SDK\Cache;
use SDK\Exception;
use SDK\FileOps;

class Manager
{
	use FileOps;

	protected $stability;
	protected $arch;
	protected $path;
	protected $series;
	protected $fetcher;

	public function __construct(string $path, string $stability, string $arch)
	{/*{{{*/
		$this->stability = $stability;
		$this->arch = $arch;
		$this->path = $path;
		$this->cache = new Cache($path);

		$host = Config::getDepsHost();
		$port = Config::getDepsPort();
		$fetcher = new Fetcher($host, $port, $this->arch, $this->stability);
		$series = new Series($this->stability, $this->arch, $this->cache, NULL);
		$fetcher->setSeries($series);
		$series->setFetcher($fetcher);

		$this->fetcher = $fetcher;
		$this->series = $series;
	}/*}}}*/

	protected function getTmpSeriesPath() : string
	{/*{{{*/
		return Config::getTmpDir() . DIRECTORY_SEPARATOR . $this->series->getname();
	}/*}}}*/

	public function updatesAvailable() : bool
	{/*{{{*/
		return $this->series->updatesAvailable();
	}/*}}}*/

	/* TODO and implement --force. */
	/* FIXME implement rollback */
	public function performUpdate(string &$msg = NULL, bool $force = false, bool $backup = true) : void
	{/*{{{*/
		if (!$force) {
			if (!$this->updatesAvailable()) {
				$msg .= "No updates are available";
				return;
			}
		}

		$series_data = $this->series->getData();

		$tmp_dir = $this->md("", true);
		$tmp_dir_packs = $this->md($tmp_dir . DIRECTORY_SEPARATOR . "packs");
		$tmp_dir_deps = $this->md($tmp_dir . DIRECTORY_SEPARATOR . "deps");

		foreach ($series_data as $item) {
			echo "Processing package $item", PHP_EOL;
			$pkg = new Package($item, $this->series, $this->fetcher);
<commit_msg>remove comment that doesn't match anymore<commit_after><?php

namespace SDK\Build\Dependency;

use SDK\Config;
use SDK\Cache;
use SDK\Exception;
use SDK\FileOps;

class Manager
{
	use FileOps;

	protected $stability;
	protected $arch;
	protected $path;
	protected $series;
	protected $fetcher;

	public function __construct(string $path, string $stability, string $arch)
	{/*{{{*/
		$this->stability = $stability;
		$this->arch = $arch;
		$this->path = $path;
		$this->cache = new Cache($path);

		$host = Config::getDepsHost();
		$port = Config::getDepsPort();
		$fetcher = new Fetcher($host, $port, $this->arch, $this->stability);
		$series = new Series($this->stability, $this->arch, $this->cache, NULL);
		$fetcher->setSeries($series);
		$series->setFetcher($fetcher);

		$this->fetcher = $fetcher;
		$this->series = $series;
	}/*}}}*/

	protected function getTmpSeriesPath() : string
	{/*{{{*/
		return Config::getTmpDir() . DIRECTORY_SEPARATOR . $this->series->getname();
	}/*}}}*/

	public function updatesAvailable() : bool
	{/*{{{*/
		return $this->series->updatesAvailable();
	}/*}}}*/

	/* FIXME implement rollback */
	public function performUpdate(string &$msg = NULL, bool $force = false, bool $backup = true) : void
	{/*{{{*/
		if (!$force) {
			if (!$this->updatesAvailable()) {
				$msg .= "No updates are available";
				return;
			}
		}

		$series_data = $this->series->getData();

		$tmp_dir = $this->md("", true);
		$tmp_dir_packs = $this->md($tmp_dir . DIRECTORY_SEPARATOR . "packs");
		$tmp_dir_deps = $this->md($tmp_dir . DIRECTORY_SEPARATOR . "deps");

		foreach ($series_data as $item) {
			echo "Processing package $item", PHP_EOL;
			$pkg = new Package($item, $this->series, $this->fetcher);

{'fraction_non_alphanumeric': 0.1927431059506531, 'fraction_numerical': 0.0, 'mean_word_length': 4.237082066869301, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6532891', 'n_tokens_mistral': 1304, 'n_tokens_neox': 1206, 'n_words': 269}