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:----p8mn+N4TVf5UkK2LMn+q2Zd+UXjb4ASQ4iu1eJEWaOTWERJFTUoTTPASIJdhwwAhxms8VQ7ZAPikLGv9ludEnlzVCqjLd/sYX0v53fC720VZl7oBT9WANpAZqPxgxmz0DqNi5A39a2NiDlt7wamxSaWC+weQw3qjdxqdjjw/PvscHGkiOnhTpC7wTqSf/6fQi1j8HtRcwuRfo8+2SEiypycWyjAFLdjibFFezH8rTkFLAaiacBExCRMq3fsvbV1T0dz3unuADIZy4Vtt57aE0SXPIpagex9m97lzz2uf0ZiOSg/8gdjUkOURwTtsNkLisdt7IZbuYZETPOuMTx3JIhdyaQTGykDExUQnfsyoGnJyLYaUKc2lNlYfWxlFqhh1zxcUI5Ky4xKE4mi3wtM1CrcJ5oYOZMV8ZCO5w2vNbn8lyIk4/+XgNwZziTlY6wWs0wfRRvWPiXY5HrESoGgfACz7d8WGyWfzT/JSXtTgXjE50CVl6ec44Q3F8Jqa8ds4+6o8NneOSi3LSyETMkUQQZTdVFPz8VOsnF12OVUioTxoJ4K32Do7qVXH6LqwO7end3Mr5OmdYCeM4NCKYzhAnrBD26s9hbUp09MAXTq5nRMApk9mmmaqFJoiyTVenrZtHRGhMeo90ws3WCgtZVwUfmH7xd1AxRZ1mxUmlK43uY4=----ATTACHMENT:----ODc3MDAzODAwMTQxMzc2NyA0MTQyMzQxMDQ3NzAyMzEyIDQwNzM0OTA2NjY2Nzc5MzU=