Skip to content

Commit

Permalink
Merge branch '8.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohammad-Alavi committed Dec 15, 2023
2 parents 981c3eb + ed7b717 commit 4f23361
Show file tree
Hide file tree
Showing 201 changed files with 5,664 additions and 3,189 deletions.
3 changes: 3 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Code of Conduct

The Apiato Code of Conduct can be found in the [Apiato documentation](https://apiato.io/docs/prologue/contribution-guide#code-of-conduct).
3 changes: 3 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Apiato Contribution Guide

The Apiato contributing guide can be found in the [Apiato documentation](https://apiato.io/docs/prologue/contribution-guide).
6 changes: 6 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# DO NOT CHANGE THIS FILE PLEASE.

github: Mahmoudz
open_collective: apiato
custom: ['https://paypal.me/mzmmzz']
patreon: zalt
40 changes: 40 additions & 0 deletions .github/ISSUE_TEMPLATE/Bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Bug Report
description: "Report something that's broken."
body:
- type: markdown
attributes:
value: "Please read [our full contribution guide](https://apiato.io/docs/prologue/contribution-guide#bug-reports) before submitting bug reports. If you notice improper DocBlock, Psalm, or IDE warnings while using Apiato, do not create a GitHub issue. Instead, please submit a pull request to fix the problem."
- type: input
attributes:
label: Apiato Core Version
description: Provide the Apiato Core version that you are using. [Please ensure it is still supported.](https://apiato.io/docs/prologue/release-notes#support-policy)
placeholder: 8.x
validations:
required: true
- type: input
attributes:
label: PHP Version
description: Provide the PHP version that you are using.
placeholder: 8.1.x
validations:
required: true
- type: input
attributes:
label: Database Driver & Version
description: If applicable, provide the database driver and version you are using.
placeholder: "MySQL 8.0.0 for macOS 13.0 on arm64 (Homebrew)"
validations:
required: false
- type: textarea
attributes:
label: Description
description: Provide a detailed description of the issue you are facing.
validations:
required: true
- type: textarea
attributes:
label: Steps To Reproduce
description: Provide detailed steps to reproduce your issue. If necessary, please provide a GitHub repository to demonstrate your issue.
validations:
required: true

12 changes: 12 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
blank_issues_enabled: false
contact_links:
- name: Feature request
url: https://github.com/apiato/core/discussions
about: 'For ideas or feature requests, start a new discussion'
- name: Support Questions & Other
url: https://apiato.io/docs/prologue/contribution-guide#support-questions
about: 'This repository is only for reporting bugs. If you have a question or need help using the library, click:'
- name: Documentation issue
url: https://github.com/apiato/documentation
about: For documentation issues, open a pull request at the apiato/documentation repository

15 changes: 15 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## Description
[//]: # (Please include a summary of the change and which issue is fixed. )
[//]: # (Please also include relevant motivation and context. )
[//]: # (List any dependencies that are required for this change.)

## Type of change
[//]: # (Please put an x in the box that apply.)

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] Refactor (refactoring a current feature, method, etc...)
- [ ] Code Coverage (adding/removing/updating/refactoring tests)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Remove feature (non-breaking change which removes functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

12 changes: 12 additions & 0 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Security Policy

**PLEASE DON'T DISCLOSE SECURITY-RELATED ISSUES PUBLICLY, [SEE BELOW](#reporting-a-vulnerability).**

## Supported Versions

Please see [our support policy](https://apiato.io/docs/prologue/release-notes#support-policy) for information on supported versions for security releases.

## Reporting a Vulnerability

If you discover a security vulnerability within Apiato, please email Mohammad Alavi at mohammad.alavi1990@gmail.com.
All security vulnerabilities will be promptly addressed.
6 changes: 6 additions & 0 deletions .github/SUPPORT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Support Questions

The Apiato support guide can be found in the [Apiato documentation](http://apiato.io/docs/prologue/contribution-guide#support-questions).

For paid professional support or consulting,
you can pick one of our [support packages](http://apiato.io/docs/consulting).
28 changes: 28 additions & 0 deletions .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
on: [push, pull_request]
name: Check & fix styling
jobs:
php-cs-fixer:
name: PHP-CS-Fixer
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Use Cache
uses: actions/cache@v3
with:
path: .php-cs-fixer.cache
key: ${{ runner.OS }}-${{ github.repository }}-phpcsfixer-${{ github.sha }}
restore-keys: |
${{ runner.OS }}-${{ github.repository }}-phpcsfixer-
- name: Run PHP CS Fixer
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --config=.php-cs-fixer.dist.php
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "style: apply automated php-cs-fixer changes"
17 changes: 17 additions & 0 deletions .github/workflows/phpmd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
on: [push, pull_request]
name: PHPMD
jobs:
phpmd:
name: PHPMD
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup PHP environment
uses: shivammathur/setup-php@v2
with:
coverage: none
tools: phpmd
- name: Run PHPMD
run: phpmd . github ruleset.xml --exclude 'Tests/*,vendor/*'
32 changes: 32 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

$finder = Symfony\Component\Finder\Finder::create()
->in([
__DIR__,
])
->name('*.php')
->notName('*.blade.php')
->ignoreDotFiles(true)
->notPath('/vendor')
->ignoreVCS(true);

return (new PhpCsFixer\Config())
->setRules([
'@Symfony' => true,
'concat_space' => ['spacing' => 'one'],
'method_argument_space' => [
'on_multiline' => 'ensure_fully_multiline',
],
'phpdoc_align' => [
'align' => 'left',
],
'trailing_comma_in_multiline' => [
'elements' => ['arguments', 'arrays', 'match', 'parameters'],
],
'blank_line_before_statement' => [
'statements' => ['return', 'throw', 'try'],
],
'nullable_type_declaration_for_default_null_value' => ['use_nullable_type_declaration' => true],
'nullable_type_declaration' => ['syntax' => 'union'],
])
->setFinder($finder);
1 change: 0 additions & 1 deletion Abstracts/Actions/SubAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@

abstract class SubAction extends Action
{

}
1 change: 0 additions & 1 deletion Abstracts/Criterias/Criteria.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@

abstract class Criteria implements PrettusCriteria
{

}
20 changes: 6 additions & 14 deletions Abstracts/Exceptions/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,29 @@
use Exception as BaseException;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Log;
use Throwable;

abstract class Exception extends BaseException
{
protected string $environment;
protected array $errors = [];

public function __construct(
?string $message = null,
?int $code = null,
Throwable $previous = null
null|string $message = null,
null|int $code = null,
null|\Throwable $previous = null,
) {
// Detect and set the running environment
$this->environment = Config::get('app.env');

parent::__construct($this->prepareMessage($message), $this->prepareStatusCode($code), $previous);
}

/**
* @param string|null $message
* @return string
*/
private function prepareMessage(?string $message = null): string
private function prepareMessage(null|string $message = null): string
{
return is_null($message) ? $this->message : $message;
}

private function prepareStatusCode(?int $code = null): int
private function prepareStatusCode(null|int $code = null): int
{
return is_null($code) ? $this->code : $code;
}
Expand All @@ -41,9 +36,6 @@ private function prepareStatusCode(?int $code = null): int
* Help developers debug the error without showing these details to the end user.
* Usage: `throw (new MyCustomException())->debug($e)`.
*
* @param $error
* @param bool $force
*
* @return $this
*/
public function debug($error, bool $force = false): Exception

Check warning on line 41 in Abstracts/Exceptions/Exception.php

View workflow job for this annotation

GitHub Actions / PHPMD

The method debug has a boolean flag argument $force, which is a certain sign of a Single Responsibility Principle violation.
Expand All @@ -52,7 +44,7 @@ public function debug($error, bool $force = false): Exception
$error = $error->getMessage();
}

if ($this->environment !== 'testing' || $force === true) {
if ('testing' !== $this->environment || true === $force) {
Log::error('[DEBUG] ' . $error);
}

Expand Down
1 change: 0 additions & 1 deletion Abstracts/Factories/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@

abstract class Factory extends LaravelFactory
{

}
1 change: 0 additions & 1 deletion Abstracts/Listeners/Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@

abstract class Listener
{

}
1 change: 0 additions & 1 deletion Abstracts/Middlewares/Middleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@

abstract class Middleware
{

}
1 change: 0 additions & 1 deletion Abstracts/Policies/Policy.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@

abstract class Policy
{

}
4 changes: 0 additions & 4 deletions Abstracts/Providers/AuthServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,9 @@ abstract class AuthServiceProvider extends LaravelAuthServiceProvider

/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot(): void
{
$this->registerPolicies();

//
}
}
1 change: 0 additions & 1 deletion Abstracts/Providers/BroadcastServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@

abstract class BroadcastServiceProvider extends LaravelBroadcastServiceProvider
{

}
1 change: 0 additions & 1 deletion Abstracts/Providers/EventServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@

abstract class EventServiceProvider extends LaravelEventServiceProvider
{

}
5 changes: 0 additions & 5 deletions Abstracts/Providers/MainServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ abstract class MainServiceProvider extends LaravelAppServiceProvider

/**
* Register any application services.
*
* @return void
*/
public function register(): void
{
Expand All @@ -24,11 +22,8 @@ public function register(): void

/**
* Bootstrap any application services.
*
* @return void
*/
public function boot(): void
{

}
}
1 change: 1 addition & 0 deletions Abstracts/Providers/MiddlewareServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ abstract class MiddlewareServiceProvider extends MainServiceProvider

/**
* Perform post-registration booting of services.
*
* @throws BindingResolutionException
*/
public function boot(): void
Expand Down
18 changes: 8 additions & 10 deletions Abstracts/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,17 @@ abstract class RouteServiceProvider extends LaravelRouteServiceProvider

/**
* Define your route model bindings, pattern filters, etc.
*
* @return void
*/
public function boot(): void
{
// $this->routes(function () {
// Route::middleware('api')
// ->prefix('api')
// ->group(base_path('routes/api.php'));
//
// Route::middleware('web')
// ->group(base_path('routes/web.php'));
// });
// $this->routes(function () {
// Route::middleware('api')
// ->prefix('api')
// ->group(base_path('routes/api.php'));
//
// Route::middleware('web')
// ->group(base_path('routes/web.php'));
// });
}

/**
Expand Down
Loading

0 comments on commit 4f23361

Please sign in to comment.