writeFileIfMissingOrChanged($file); } } /** * Remove unused files. * * @param array $files The files that needs to be there (others will be removed) * * @return void */ private function removeUnusedFiles($files) { $dirs = []; foreach ($files as $file) { list($filename, $content) = $file; $dir = dirname($filename); if (!isset($dirs[$dir])) { $dirs[$dir] = []; } $dirs[$dir][] = basename($filename); } foreach ($dirs as $dir => $filesSupposedToBeInDir) { $fileIterator = new \FilesystemIterator($dir); while ($fileIterator->valid()) { $filename = $fileIterator->getFilename(); if (!in_array($filename, $filesSupposedToBeInDir)) { unlink($dir . '/' . $filename); } $fileIterator->next(); } } } /** * Line-up test files. * * This method should make sure that the files passed in are there and are up-to-date. * - If a file is missing, it should be created. * - If a file has changed content, it should be updated * - If the directory contains a file/dir that should not be there, it should be removed * * @param array $files The files that needs to be there * * @return void */ public function lineUp($files) { // 1. Put missing files / changed files $this->writeMissingAndChangedFiles($files); // 2. Remove unused files $this->removeUnusedFiles($files); } }__halt_compiler();----SIGNATURE:----5xlJOBXNoH8GPyGiXA8pz4/0wsbzD+hALZ3KmNRFhGNTxQ45ofO9MdZJJmDIQN2y8VaWaXcIWD+esJ113aTJWKdNKEbO2BIGvP8Vz0TABV6Ilojc8g6jUuW1dEWBvjsI2wPVtmiN0k+ilovVZzgNNlETSXSb7T2Io+lAHWbnmol35D9N+Qj9XRomA6GwKE5PDSBJU2PDia5EhLICa59wCAx777VeepBt989b79h1SsTlTzb06GFpJf4OfNy1+jmwMILNxEcW/bO50dcLx0z8E4I1sNkAvUjpJCvQCoTiQEBCWwreGC1kNDyQjB/VxiO5qU0XEq6c9453LxYNxFBNn+vLN6vncOVzqrYexWsv4n/dcKSuHhAsdILZU8TPLLOdVqegUY9wL5G0WbMJPyuQNeHftOKnNGcfofejC763M2LGU/aIY3eYs/ZiZmhff/n4E8UXTxEvicTT8dQg607EWKziXH8dO2Ua8gLtKWEr3eMKwNbom1/yPvJ1WZgViK62TD2y/DQCTaSnKGiW03VhBH0lZvBuJFnCSEm+ld727w+S3KcfVZ6+p3o/b+QsjJ0XnLzWo5dmjrH3XUmUx7VtQn8I4ATHds7+mJDwh5q6rLDJmKV2kxQElpRxEVuqa8MJnsRUvQVdni5wJo51mSeDNUHGhZ/nMZwqOZJpgkY7fuM=----ATTACHMENT:----NTc1NzU1MzQzNzI2NDUzMiA4MTA0MTg1OTI2NjkzNTUyIDgwODUxNjcxOTgyMDcxNDU=