allFiles(\Yii::$app->basepath, '*.php', [\Yii::$app->basepath . '/vendor']); foreach ($allFile as $file) { $this->addCopyright($file); } return ExitCode::OK; } /** * * @param mixed $file * @return bool * @author Syan mzsongyan@gmail.com * @date 2022-05-30 */ private function addCopyright($file) { $content = file_get_contents($file); if ($content === false) { return false; } $copyright = <<allFiles($item, $pattern)); } } return $result; } }