LegacyServiceProvider.php
5 years ago
Onboarding.php
5 years ago
PaymentGateways.php
5 years ago
RestAPI.php
5 years ago
Routes.php
5 years ago
ServiceProvider.php
5 years ago
RestAPI.php
71 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Give\ServiceProviders; |
| 4 | |
| 5 | use Give\API\Endpoints\Reports\AverageDonation; |
| 6 | use Give\API\Endpoints\Reports\FormPerformance; |
| 7 | use Give\API\Endpoints\Reports\Income; |
| 8 | use Give\API\Endpoints\Reports\IncomeBreakdown; |
| 9 | use Give\API\Endpoints\Reports\PaymentMethods; |
| 10 | use Give\API\Endpoints\Reports\PaymentStatuses; |
| 11 | use Give\API\Endpoints\Reports\RecentDonations; |
| 12 | use Give\API\Endpoints\Reports\TopDonors; |
| 13 | use Give\API\Endpoints\Reports\TotalDonors; |
| 14 | use Give\API\Endpoints\Reports\TotalIncome; |
| 15 | use Give\API\Endpoints\Reports\TotalRefunds; |
| 16 | use Give\API\Endpoints\Logs\GetLogs; |
| 17 | use Give\API\Endpoints\Logs\FlushLogs; |
| 18 | use Give\API\Endpoints\Migrations\GetMigrations; |
| 19 | use Give\API\Endpoints\Migrations\RunMigration; |
| 20 | use Give\API\RestRoute; |
| 21 | |
| 22 | class RestAPI implements ServiceProvider { |
| 23 | /** |
| 24 | * @var string[] array of RestRoute classes |
| 25 | */ |
| 26 | private $reportRoutes = [ |
| 27 | PaymentStatuses::class, |
| 28 | PaymentMethods::class, |
| 29 | FormPerformance::class, |
| 30 | TopDonors::class, |
| 31 | RecentDonations::class, |
| 32 | Income::class, |
| 33 | IncomeBreakdown::class, |
| 34 | AverageDonation::class, |
| 35 | TotalDonors::class, |
| 36 | TotalIncome::class, |
| 37 | TotalRefunds::class, |
| 38 | GetLogs::class, |
| 39 | FlushLogs::class, |
| 40 | GetMigrations::class, |
| 41 | RunMigration::class, |
| 42 | ]; |
| 43 | |
| 44 | /** |
| 45 | * @inheritDoc |
| 46 | */ |
| 47 | public function register() { |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * @inheritDoc |
| 52 | */ |
| 53 | public function boot() { |
| 54 | add_action( 'rest_api_init', [ $this, 'registerRoutes' ] ); |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Calls the route registrations within the WordPress REST API hook |
| 59 | * |
| 60 | * @since 2.8.0 |
| 61 | */ |
| 62 | public function registerRoutes() { |
| 63 | foreach ( $this->reportRoutes as $route ) { |
| 64 | /** @var RestRoute $route */ |
| 65 | $route = give()->make( $route ); |
| 66 | |
| 67 | $route->registerRoute(); |
| 68 | } |
| 69 | } |
| 70 | } |
| 71 |