From 63dfca016a1d6bea4d6a4867bdf1cd89c38010e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Duli=C3=A7i?= Date: Sat, 21 Nov 2020 20:37:36 +0300 Subject: [PATCH] added laravel stats package --- .gitignore | 1 + app/Classifiers/BulkAction.php | 29 ++++++ app/Classifiers/Event.php | 29 ++++++ app/Classifiers/Export.php | 29 ++++++ app/Classifiers/Import.php | 29 ++++++ app/Classifiers/Job.php | 29 ++++++ app/Classifiers/Observer.php | 29 ++++++ app/Classifiers/Report.php | 29 ++++++ app/Classifiers/Scope.php | 29 ++++++ app/Classifiers/Transformer.php | 29 ++++++ app/Classifiers/Widget.php | 29 ++++++ composer.json | 3 +- composer.lock | 156 ++++++++++++++++++++++++++++++-- config/stats.php | 97 ++++++++++++++++++++ 14 files changed, 539 insertions(+), 8 deletions(-) create mode 100644 app/Classifiers/BulkAction.php create mode 100644 app/Classifiers/Event.php create mode 100644 app/Classifiers/Export.php create mode 100644 app/Classifiers/Import.php create mode 100644 app/Classifiers/Job.php create mode 100644 app/Classifiers/Observer.php create mode 100644 app/Classifiers/Report.php create mode 100644 app/Classifiers/Scope.php create mode 100644 app/Classifiers/Transformer.php create mode 100644 app/Classifiers/Widget.php create mode 100644 config/stats.php diff --git a/.gitignore b/.gitignore index 5d4800791..0bff5e933 100644 --- a/.gitignore +++ b/.gitignore @@ -95,3 +95,4 @@ _ide_helper_models.php modules/* !modules/OfflinePayments !modules/PaypalStandard +.laravelstatsrc diff --git a/app/Classifiers/BulkAction.php b/app/Classifiers/BulkAction.php new file mode 100644 index 000000000..2c9455398 --- /dev/null +++ b/app/Classifiers/BulkAction.php @@ -0,0 +1,29 @@ +isSubclassOf(\App\Abstracts\BulkAction::class); + } + + public function countsTowardsApplicationCode(): bool + { + return true; + } + + public function countsTowardsTests(): bool + { + return false; + } +} diff --git a/app/Classifiers/Event.php b/app/Classifiers/Event.php new file mode 100644 index 000000000..bfbd5b0e3 --- /dev/null +++ b/app/Classifiers/Event.php @@ -0,0 +1,29 @@ +isSubclassOf(\App\Abstracts\Event::class); + } + + public function countsTowardsApplicationCode(): bool + { + return true; + } + + public function countsTowardsTests(): bool + { + return false; + } +} diff --git a/app/Classifiers/Export.php b/app/Classifiers/Export.php new file mode 100644 index 000000000..cba1248e3 --- /dev/null +++ b/app/Classifiers/Export.php @@ -0,0 +1,29 @@ +isSubclassOf(\App\Abstracts\Export::class); + } + + public function countsTowardsApplicationCode(): bool + { + return true; + } + + public function countsTowardsTests(): bool + { + return false; + } +} diff --git a/app/Classifiers/Import.php b/app/Classifiers/Import.php new file mode 100644 index 000000000..cabf85418 --- /dev/null +++ b/app/Classifiers/Import.php @@ -0,0 +1,29 @@ +isSubclassOf(\App\Abstracts\Import::class); + } + + public function countsTowardsApplicationCode(): bool + { + return true; + } + + public function countsTowardsTests(): bool + { + return false; + } +} diff --git a/app/Classifiers/Job.php b/app/Classifiers/Job.php new file mode 100644 index 000000000..b83f4b07f --- /dev/null +++ b/app/Classifiers/Job.php @@ -0,0 +1,29 @@ +isSubclassOf(\App\Abstracts\Job::class); + } + + public function countsTowardsApplicationCode(): bool + { + return true; + } + + public function countsTowardsTests(): bool + { + return false; + } +} diff --git a/app/Classifiers/Observer.php b/app/Classifiers/Observer.php new file mode 100644 index 000000000..835e264ce --- /dev/null +++ b/app/Classifiers/Observer.php @@ -0,0 +1,29 @@ +isSubclassOf(\App\Abstracts\Observer::class); + } + + public function countsTowardsApplicationCode(): bool + { + return true; + } + + public function countsTowardsTests(): bool + { + return false; + } +} diff --git a/app/Classifiers/Report.php b/app/Classifiers/Report.php new file mode 100644 index 000000000..b8ff53b77 --- /dev/null +++ b/app/Classifiers/Report.php @@ -0,0 +1,29 @@ +isSubclassOf(\App\Abstracts\Report::class); + } + + public function countsTowardsApplicationCode(): bool + { + return true; + } + + public function countsTowardsTests(): bool + { + return false; + } +} diff --git a/app/Classifiers/Scope.php b/app/Classifiers/Scope.php new file mode 100644 index 000000000..697013abc --- /dev/null +++ b/app/Classifiers/Scope.php @@ -0,0 +1,29 @@ +isSubclassOf(\Illuminate\Database\Eloquent\Scope::class); + } + + public function countsTowardsApplicationCode(): bool + { + return true; + } + + public function countsTowardsTests(): bool + { + return false; + } +} diff --git a/app/Classifiers/Transformer.php b/app/Classifiers/Transformer.php new file mode 100644 index 000000000..0e6f115f2 --- /dev/null +++ b/app/Classifiers/Transformer.php @@ -0,0 +1,29 @@ +isSubclassOf(\League\Fractal\TransformerAbstract::class); + } + + public function countsTowardsApplicationCode(): bool + { + return true; + } + + public function countsTowardsTests(): bool + { + return false; + } +} diff --git a/app/Classifiers/Widget.php b/app/Classifiers/Widget.php new file mode 100644 index 000000000..d29d04f26 --- /dev/null +++ b/app/Classifiers/Widget.php @@ -0,0 +1,29 @@ +isSubclassOf(\App\Abstracts\Widget::class); + } + + public function countsTowardsApplicationCode(): bool + { + return true; + } + + public function countsTowardsTests(): bool + { + return false; + } +} diff --git a/composer.json b/composer.json index cd6c56126..622ab907f 100644 --- a/composer.json +++ b/composer.json @@ -59,7 +59,8 @@ "fzaninotto/faker": "^1.9.1", "mockery/mockery": "^1.3.1", "nunomaduro/collision": "^5.0", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^9.3", + "wnx/laravel-stats": "^2.5" }, "extra": { "laravel": { diff --git a/composer.lock b/composer.lock index 175e96685..07ce7862e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "fa78a7bebcf71ddd5e1d34c47ca11735", + "content-hash": "b9470a40700d335a124d21e67ffce71a", "packages": [ { "name": "akaunting/firewall", @@ -2633,16 +2633,16 @@ }, { "name": "genealabs/laravel-model-caching", - "version": "0.11.0", + "version": "0.11.1", "source": { "type": "git", "url": "https://github.com/GeneaLabs/laravel-model-caching.git", - "reference": "f790e9c8ef7097b39bcf893c1e7335763cb812f3" + "reference": "464a115348c8f44ce13c77d68b38b875e8202157" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/GeneaLabs/laravel-model-caching/zipball/f790e9c8ef7097b39bcf893c1e7335763cb812f3", - "reference": "f790e9c8ef7097b39bcf893c1e7335763cb812f3", + "url": "https://api.github.com/repos/GeneaLabs/laravel-model-caching/zipball/464a115348c8f44ce13c77d68b38b875e8202157", + "reference": "464a115348c8f44ce13c77d68b38b875e8202157", "shasum": "" }, "require": { @@ -2696,9 +2696,9 @@ "description": "Automatic caching for Eloquent models.", "support": { "issues": "https://github.com/GeneaLabs/laravel-model-caching/issues", - "source": "https://github.com/GeneaLabs/laravel-model-caching/tree/0.11.0" + "source": "https://github.com/GeneaLabs/laravel-model-caching/tree/0.11.1" }, - "time": "2020-09-08T15:51:40+00:00" + "time": "2020-11-21T15:34:18+00:00" }, { "name": "genealabs/laravel-pivot-events", @@ -13345,6 +13345,67 @@ ], "time": "2020-09-28T06:39:44+00:00" }, + { + "name": "stefanzweifel/laravel-stats-phploc", + "version": "7.1.0", + "source": { + "type": "git", + "url": "https://github.com/stefanzweifel/phploc.git", + "reference": "9c96c5528c294c4ac7620b6ec9d6cee6de1477b1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/stefanzweifel/phploc/zipball/9c96c5528c294c4ac7620b6ec9d6cee6de1477b1", + "reference": "9c96c5528c294c4ac7620b6ec9d6cee6de1477b1", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "php": ">=7.3", + "phpunit/php-file-iterator": "^3.0", + "sebastian/cli-parser": "^1.0", + "sebastian/version": "^2.0 || ^3.0" + }, + "bin": [ + "phploc" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "A tool for quickly measuring the size of a PHP project. (Don't use this fork in your production apps)", + "homepage": "https://github.com/stefanzweifel/phploc", + "support": { + "issues": "https://github.com/stefanzweifel/phploc/issues", + "source": "https://github.com/stefanzweifel/phploc/tree/7.1.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T17:57:06+00:00" + }, { "name": "theseer/tokenizer", "version": "1.2.0", @@ -13394,6 +13455,87 @@ } ], "time": "2020-07-12T23:59:07+00:00" + }, + { + "name": "wnx/laravel-stats", + "version": "v2.5.0", + "source": { + "type": "git", + "url": "https://github.com/stefanzweifel/laravel-stats.git", + "reference": "d6237ba1e44def2abd89a1a96faa10f15e47358a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/stefanzweifel/laravel-stats/zipball/d6237ba1e44def2abd89a1a96faa10f15e47358a", + "reference": "d6237ba1e44def2abd89a1a96faa10f15e47358a", + "shasum": "" + }, + "require": { + "ext-json": "*", + "illuminate/console": "^6.0 || ^7.0 || ^8.0", + "illuminate/support": "^6.0 || ^7.0 || ^8.0", + "php": "^7.3 || ^8.0", + "stefanzweifel/laravel-stats-phploc": "^6.1 || ^7.1", + "symfony/finder": "^4.3 || ^5.0", + "symfony/process": "^4.3 || ^5.0" + }, + "require-dev": { + "laravel/browser-kit-testing": "~5.0 || ~6.0 || ~7.0", + "laravel/dusk": "~5.0 || ~6.0", + "mockery/mockery": "^1.1", + "orchestra/testbench": "^4.0 || ^5.0 || ^6.0", + "phpunit/phpunit": "8.* || 9.*", + "psalm/plugin-laravel": "^1.4", + "vimeo/psalm": "^4.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Wnx\\LaravelStats\\StatsServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Wnx\\LaravelStats\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Stefan Zweifel", + "email": "hello@stefanzweifel.io", + "homepage": "https://stefanzweifel.io", + "role": "Developer" + } + ], + "description": "Get insights about your Laravel Project", + "homepage": "https://github.com/stefanzweifel/laravel-stats", + "keywords": [ + "laravel", + "statistics", + "stats", + "wnx" + ], + "support": { + "issues": "https://github.com/stefanzweifel/laravel-stats/issues", + "source": "https://github.com/stefanzweifel/laravel-stats/tree/v2.5.0" + }, + "funding": [ + { + "url": "https://buymeacoff.ee/3oQ64YW", + "type": "custom" + }, + { + "url": "https://github.com/stefanzweifel", + "type": "github" + } + ], + "time": "2020-11-20T19:49:06+00:00" } ], "aliases": [], diff --git a/config/stats.php b/config/stats.php new file mode 100644 index 000000000..91b875d4f --- /dev/null +++ b/config/stats.php @@ -0,0 +1,97 @@ + [ + base_path('app'), + base_path('database'), + base_path('modules'), + base_path('tests'), + ], + + /* + * List of files/folders to be excluded from analysis. + */ + 'exclude' => [ + // base_path('app/helpers.php'), + // base_path('app/Services'), + ], + + /* + * List of your custom Classifiers + */ + 'custom_component_classifier' => [ + 'App\Classifiers\BulkAction', + 'App\Classifiers\Event', + 'App\Classifiers\Export', + 'App\Classifiers\Import', + 'App\Classifiers\Job', + 'App\Classifiers\Observer', + 'App\Classifiers\Report', + 'App\Classifiers\Scope', + 'App\Classifiers\Transformer', + 'App\Classifiers\Widget', + ], + + /* + * The Strategy used to reject Classes from the project statistics. + * + * By default all Classes located in + * the vendor directory are being rejected and don't + * count to the statistics. + * + * The package ships with 2 strategies: + * - \Wnx\LaravelStats\RejectionStrategies\RejectVendorClasses::class + * - \Wnx\LaravelStats\RejectionStrategies\RejectInternalClasses::class + * + * If none of the default strategies fit for your usecase, you can + * write your own class which implements the RejectionStrategy Contract. + */ + 'rejection_strategy' => 'Wnx\LaravelStats\RejectionStrategies\RejectVendorClasses', + + /* + * Namespaces which should be ignored. + * Laravel Stats uses the `Str::startsWith()` helper to + * check if a Namespace should be ignored. + * + * You can use `Illuminate` to ignore the entire `Illuminate`-namespace + * or `Illuminate\Support` to ignore a subset of the namespace. + */ + 'ignored_namespaces' => [ + 'Akaunting', + 'Barryvdh', + 'Collective', + 'Composer', + 'ConsoleTVs', + 'Dingo', + 'Doctrine', + 'Dompdf', + 'Facade', + 'Fruitcake', + 'GeneaLabs', + 'GrahamCampbell', + 'Hoa', + 'Http', + 'Illuminate', + 'Intervention', + 'Jenssegers', + 'Kyslik', + 'Laracasts', + 'Laratrust', + 'Lorisleiva', + 'Maatwebsite', + 'Monooso', + 'NunoMaduro', + 'Omnipay', + 'Plank', + 'Psr', + 'Riverskies', + 'SebastianBergmann', + 'Symfony', + 'Wnx\LaravelStats', + ], + +];