mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
46 lines
1.1 KiB
PHP
46 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Pest\Plugins;
|
|
|
|
use Pest\Contracts\Plugins\HandlesArguments;
|
|
use Pest\Plugins\Concerns\HandleArguments;
|
|
|
|
/**
|
|
* @internal
|
|
*/
|
|
final class Cache implements HandlesArguments
|
|
{
|
|
use HandleArguments;
|
|
|
|
/**
|
|
* The temporary folder.
|
|
*/
|
|
private const TEMPORARY_FOLDER = __DIR__
|
|
.DIRECTORY_SEPARATOR
|
|
.'..'
|
|
.DIRECTORY_SEPARATOR
|
|
.'..'
|
|
.DIRECTORY_SEPARATOR
|
|
.'.temp';
|
|
|
|
/**
|
|
* Handles the arguments, adding the cache directory and the cache result arguments.
|
|
*/
|
|
public function handleArguments(array $arguments): array
|
|
{
|
|
if (! $this->hasArgument('--cache-directory', $arguments)) {
|
|
$arguments = $this->pushArgument('--cache-directory', $arguments);
|
|
|
|
$arguments = $this->pushArgument((string) realpath(self::TEMPORARY_FOLDER), $arguments);
|
|
}
|
|
|
|
if (! $this->hasArgument('--parallel', $arguments)) {
|
|
return $this->pushArgument('--cache-result', $arguments);
|
|
}
|
|
|
|
return $arguments;
|
|
}
|
|
}
|