<?php

namespace App\Classes\Modules\Documents;

use App\Classes\Service\Documents\FilterDocuments;

use App\Traits\DocumentTrait;

class UpdateDocuments extends AbstractDocument
{

    use DocumentTrait;

    public function execute(?array $documents) {

        if($documents !== null){

            $filterDocuments = new FilterDocuments($documents);

            $this->deleteDocuments($filterDocuments->execute('old'));

            $this->addDocuments($filterDocuments->execute('new'));

        }

    }

}