fail('Copyright is missing or has wrong format ' . $filename); } }, $this->copyrightDataProvider() ); } public function copyrightDataProvider() { $blackList = $this->getFilesData('blacklist*.php'); $changedFiles = []; foreach (glob(__DIR__ . '/../_files/changed_files*') as $listFile) { $changedFiles = array_merge($changedFiles, file($listFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES)); } array_walk( $changedFiles, function (&$file) { $file = [BP . '/' . $file]; } ); $changedFiles = array_filter( $changedFiles, function ($path) use ($blackList) { if (!file_exists($path[0]) || !is_readable($path[0])) { return false; } $path[0] = realpath($path[0]); foreach ($blackList as $item) { if (preg_match($item, $path[0])) { return false; } } return true; } ); return $changedFiles; } /** * @param string $filePattern * @return array */ protected function getFilesData($filePattern) { $result = []; foreach (glob(__DIR__ . '/_files/copyright/' . $filePattern) as $file) { $fileData = include $file; $result = array_merge($result, $fileData); } return $result; } }