Skip to content

Commit

Permalink
アノテーション漏れを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuring committed Oct 9, 2023
1 parent 0fd210f commit 74778d4
Show file tree
Hide file tree
Showing 14 changed files with 204 additions and 83 deletions.
4 changes: 3 additions & 1 deletion plugins/baser-core/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
"baserproject/bc-uploader": "^5.1",
"baserproject/bc-widget-area": "^5.1",
"imo-tikuwa/cakephp-soft-delete": "^2.0",
"ext-mbstring": "*"
"ext-mbstring": "*",
"ext-zip": "*",
"ext-gd": "*"
},
"require-dev": {
"cakephp/bake": "^2.6",
Expand Down
20 changes: 17 additions & 3 deletions plugins/baser-core/src/BcPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,11 @@ public function initialize(): void
/**
* bootstrap
*
* @param PluginApplicationInterface $application
* @param PluginApplicationInterface $app
* @checked
* @noTodo
*/
public function bootstrap(PluginApplicationInterface $application): void
public function bootstrap(PluginApplicationInterface $app): void
{
$pluginPath = BcUtil::getPluginPath($this->name);
if (file_exists($pluginPath . 'config' . DS . 'setting.php')) {
Expand All @@ -86,7 +88,7 @@ public function bootstrap(PluginApplicationInterface $application): void
}
// 親の bootstrap は、setting の読み込みの後でなければならない
// bootstrap 内で、setting の値を参照する場合があるため
parent::bootstrap($application);
parent::bootstrap($app);
}

/**
Expand Down Expand Up @@ -149,6 +151,8 @@ public function install($options = []): bool
* マイグレーションを実行する
*
* @param array $options
* @checked
* @noTodo
*/
public function migrate($options = [])
{
Expand All @@ -163,6 +167,8 @@ public function migrate($options = [])

/**
* アップデートプログラムを実行する
* @checked
* @noTodo
*/
public function execUpdater()
{
Expand Down Expand Up @@ -437,6 +443,8 @@ public function routes(RouteBuilder $routes): void
* @param RouteBuilder $routes
* @param string $plugin
* @return RouteBuilder
* @checked
* @noTodo
*/
public function contentsRoutingForReverse(RouteBuilder $routes, string $plugin)
{
Expand All @@ -463,6 +471,8 @@ function(RouteBuilder $routes) {
* @param RouteBuilder $routes
* @param string $plugin
* @return RouteBuilder
* @checked
* @noTodo
*/
public function frontPageRouting(RouteBuilder $routes, string $plugin)
{
Expand All @@ -488,6 +498,8 @@ function(RouteBuilder $routes) {
* @param RouteBuilder $routes
* @param string $plugin
* @return RouteBuilder
* @checked
* @noTodo
*/
public function prefixRouting(RouteBuilder $routes, string $plugin)
{
Expand Down Expand Up @@ -535,6 +547,8 @@ function(RouteBuilder $routes) use($isApi) {
* @param RouteBuilder $routes
* @param string $plugin
* @return RouteBuilder
* @checked
* @noTodo
*/
public function siteRouting(RouteBuilder $routes, string $plugin)
{
Expand Down
27 changes: 17 additions & 10 deletions plugins/baser-core/src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
use Cake\Core\Exception\MissingPluginException;
use Cake\Core\PluginApplicationInterface;
use Cake\Event\EventManager;
use Cake\Http\Exception\ForbiddenException;
use Cake\Http\Middleware\CsrfProtectionMiddleware;
use Cake\Http\MiddlewareQueue;
use Cake\Http\ServerRequestFactory;
Expand Down Expand Up @@ -67,13 +66,13 @@ class Plugin extends BcPlugin implements AuthenticationServiceProviderInterface
/**
* bootstrap
*
* @param PluginApplicationInterface $application
* @param PluginApplicationInterface $app
*
* @checked
* @unitTest
* @noTodo
*/
public function bootstrap(PluginApplicationInterface $application): void
public function bootstrap(PluginApplicationInterface $app): void
{
/**
* composer インストール対応
Expand Down Expand Up @@ -116,14 +115,14 @@ public function bootstrap(PluginApplicationInterface $application): void
if (BcUtil::isInstalled()) {
BcUtil::checkTmpFolders();
} else {
$application->addPlugin('BcInstaller');
$app->addPlugin('BcInstaller');
Configure::load('BcInstaller.setting');
}

/**
* プラグインごとの設定ファイル読み込み
*/
parent::bootstrap($application);
parent::bootstrap($app);

/**
* 文字コードの検出順を指定
Expand All @@ -150,11 +149,11 @@ public function bootstrap(PluginApplicationInterface $application): void
/**
* プラグインロード
*/
if (BcUtil::isTest()) $application->addPlugin('CakephpFixtureFactories');
$application->addPlugin('Authentication');
$application->addPlugin('Migrations');
if (BcUtil::isTest()) $app->addPlugin('CakephpFixtureFactories');
$app->addPlugin('Authentication');
$app->addPlugin('Migrations');

$this->addTheme($application);
$this->addTheme($app);

if (!filter_var(env('USE_DEBUG_KIT', true), FILTER_VALIDATE_BOOLEAN)) {
// 明示的に指定がない場合、DebugKitは重すぎるのでデバッグモードでも利用しない
Expand All @@ -164,7 +163,7 @@ public function bootstrap(PluginApplicationInterface $application): void
if ($plugins) {
foreach($plugins as $plugin) {
if (BcUtil::includePluginClass($plugin->name)) {
$this->loadPlugin($application, $plugin->name, $plugin->priority);
$this->loadPlugin($app, $plugin->name, $plugin->priority);
}
}
}
Expand Down Expand Up @@ -386,6 +385,8 @@ public function getAuthenticationService(ServerRequestInterface $request): Authe
*
* @param array $authSetting
* @return bool
* @checked
* @noTodo
*/
public function isRequiredAuthentication(array $authSetting)
{
Expand All @@ -401,6 +402,8 @@ public function isRequiredAuthentication(array $authSetting)
* @param AuthenticationService $service
* @param array $authSetting
* @return AuthenticationService
* @checked
* @noTodo
*/
public function setupSessionAuth(AuthenticationService $service, array $authSetting)
{
Expand Down Expand Up @@ -438,6 +441,8 @@ public function setupSessionAuth(AuthenticationService $service, array $authSett
* @param AuthenticationService $service
* @param array $authSetting
* @return AuthenticationService
* @checked
* @noTodo
*/
public function setupJwtAuth(AuthenticationService $service, array $authSetting, string $prefix)
{
Expand Down Expand Up @@ -608,6 +613,8 @@ public function services(ContainerInterface $container): void
*
* @param CommandCollection $commands
* @return CommandCollection
* @checked
* @checked
*/
public function console(CommandCollection $commands): CommandCollection
{
Expand Down
64 changes: 54 additions & 10 deletions plugins/baser-core/src/Utility/BcUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,8 @@ public static function getEnablePlugins($force = false)
* 現在のDB接続の設定を取得する
*
* @return array
* @checked
* @noTodo
*/
public static function getCurrentDbConfig()
{
Expand All @@ -447,6 +449,8 @@ public static function getCurrentDbConfig()
* 現在のDB接続を取得する
*
* @return \Cake\Database\Connection
* @checked
* @noTodo
*/
public static function getCurrentDb()
{
Expand Down Expand Up @@ -687,6 +691,9 @@ public static function serialize($value)
*
* @param mixed $value 対象文字列
* @return mixed
* @checked
* @noTodo
* @unitTest
*/
public static function unserialize($value)
{
Expand Down Expand Up @@ -742,6 +749,8 @@ public static function isConsole()
* ユニットテストかどうか
*
* @return bool
* @checked
* @noTodo
*/
public static function isTest()
{
Expand Down Expand Up @@ -1226,6 +1235,8 @@ public static function getRootTheme()
* 現在の管理画面のテーマ名を取得する
* キャメルケースが前提
* @return mixed|string
* @checked
* @noTodo
*/
public static function getCurrentAdminTheme()
{
Expand All @@ -1242,6 +1253,8 @@ public static function getCurrentAdminTheme()
* @param string $str
* @param string $suffix
* @return string
* @checked
* @noTodo
*/
public static function mbBasename($str, $suffix = null)
{
Expand Down Expand Up @@ -1308,7 +1321,10 @@ public static function getExtension($fileName)
*
* index.phpは含まない
*
* @return string
* @return string
* @checked
* @noTodo
* @unitTest
*/
public static function siteUrl()
{
Expand All @@ -1330,6 +1346,9 @@ public static function siteUrl()
* ※ プログラムフォルダ内の画像やCSSの読み込み時もbootstrap.php で呼び出されるのでサーバーキャッシュは利用しない
*
* @return string ベースURL
* @checked
* @noTodo
* @unitTest
*/
public static function baseUrl()
{
Expand Down Expand Up @@ -1363,7 +1382,10 @@ public static function baseUrl()
* サブドメインの場合など、$_SERVER['DOCUMENT_ROOT'] が正常に取得できない場合に利用する
* UserDir に対応
*
* @return string ドキュメントルートの絶対パス
* @return string ドキュメントルートの絶対パス
* @checked
* @noTodo
* @unitTest
*/
public static function docRoot()
{
Expand Down Expand Up @@ -1392,6 +1414,9 @@ public static function docRoot()
* 実行環境のOSがWindowsであるかどうかを返す
*
* @return bool
* @checked
* @noTodo
* @unitTest
*/
public static function isWindows()
{
Expand Down Expand Up @@ -1498,11 +1523,11 @@ public static function emptyFolder($path)
/**
* ファイルポインタから行を取得し、CSVフィールドを処理する
*
* @param stream handle
* @param int length
* @param string delimiter
* @param string enclosure
* @return mixed ファイルの終端に達した場合を含み、エラー時にFALSEを返します。
* @param resource $handle
* @param int $length
* @param string $d delimiter
* @param string $e enclosure
* @return mixed ファイルの終端に達した場合を含み、エラー時にFALSEを返します。
* @checked
* @noTodo
* @unitTest
Expand Down Expand Up @@ -1655,6 +1680,9 @@ public static function createRequest($url = '/', $data = [], $method = 'GET', $c
/**
* 必要な一時フォルダが存在するかチェックし、
* なければ生成する
* @checked
* @noTodo
* @unitTest
*/
public static function checkTmpFolders()
{
Expand Down Expand Up @@ -1693,7 +1721,10 @@ public static function changePluginNameSpace($newPlugin)
* httpからのフルURLを取得する
*
* @param mixed $url
* @return string
* @return string
* @checked
* @noTodo
* @unitTest
*/
public static function fullUrl($url)
{
Expand Down Expand Up @@ -1780,6 +1811,8 @@ public static function getExistsTemplateDir(string $theme, string $plugin, strin
* @param string $path
* @param string $type
* @return false|string
* @checked
* @noTodo
*/
public static function getExistsWebrootDir(string $theme, string $plugin, string $path, string $type = '')
{
Expand Down Expand Up @@ -1835,6 +1868,8 @@ public static function getExistsWebrootDir(string $theme, string $plugin, string
* `array('a'=>'b')`
*
* @return array Associative array
* @checked
* @noTodo
*/
public static function pairToAssoc()
{
Expand Down Expand Up @@ -1863,6 +1898,8 @@ public static function pairToAssoc()
* @param int $interval 試行の間隔(ミリ秒)
* @return mixed
* @throws Exception
* @checked
* @noTodo
*/
public static function retry($times, callable $callback, $interval = 0)
{
Expand Down Expand Up @@ -1944,6 +1981,8 @@ public static function getRequestPrefix(ServerRequestInterface $request)
* デバッグモードかどうか
*
* @return bool
* @checked
* @noTodo
*/
public static function isDebug(): bool
{
Expand All @@ -1957,8 +1996,9 @@ public static function isDebug(): bool
* @param $min
* @param $sec
* @return bool
* @checked
* @noTodo
*/

public static function checkTime($hour, $min, $sec = null): bool
{
$hour = (int)$hour;
Expand All @@ -1983,6 +2023,8 @@ public static function checkTime($hour, $min, $sec = null): bool
*
* @param string $val 対象文字列
* @return string
* @checked
* @noTodo
*/
public static function base64UrlSafeDecode($val): string
{
Expand All @@ -2001,8 +2043,10 @@ public static function base64UrlSafeDecode($val): string
*
* @param string $val 対象文字列
* @return string
* @checked
* @noTodo
*/
public static function base64UrlsafeEncode($val): string
public static function base64UrlSafeEncode($val): string
{
$val = base64_encode($val);
return str_replace(['+', '/', '='], ['_', '-', '.'], $val);
Expand Down
Loading

0 comments on commit 74778d4

Please sign in to comment.