// --------------------------------------------------------------------
// Class Core
// --------------------------------------------------------------------
/**
* Loads the helper and verifies the source and destination directories.
*/
public function __construct(?string
$source = null, ?string
$destination = null
) { helper(['filesystem'
]);
$this->source = self::
resolveDirectory($source ??
$this->source
);
$this->destination = self::
resolveDirectory($destination ??
$this->destination
);
$this->replacer =
new ContentReplacer();
// Restrictions are intentionally not injected to prevent overriding
$this->restrictions =
config(PublisherConfig::
class)->restrictions;
// Make sure the destination is allowed
foreach (array_keys($this->restrictions
) as $directory) { if (strpos($this->destination,
$directory) === 0
) { return;
}