Skip to content

Commit

Permalink
Merge pull request #19 from irazasyed/master
Browse files Browse the repository at this point in the history
  • Loading branch information
irazasyed authored Oct 2, 2020
2 parents 106de5a + 9437089 commit 8602e56
Show file tree
Hide file tree
Showing 13 changed files with 253 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
/.gitattributes export-ignore
/.github export-ignore
/.gitignore export-ignore
/.php_cs.dist export-ignore
76 changes: 76 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to make participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies within all project spaces, and it also applies when
an individual is representing the project or its community in public spaces.
Examples of representing a project or community include using an official
project e-mail address, posting via an official social media account, or acting
as an appointed representative at an online or offline event. Representation of
a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at `syed at lukonet.com`. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
37 changes: 37 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Contributing Guide

We welcome contributions to this project. Please read the following guide before posting an issue or sending in pull requests.
Please also read our [Code of Conduct](CODE_OF_CONDUCT.md) before contributing or engaging in discussions.

## Issues

- **Feature requests** need to describe as thoroughly as possible and perhaps contain some info on how you would implement it.
- **Bug reports** need to be described in detail what the problem is, how it was triggered and perhaps contain a possible solution.
- **Questions** are free to be asked about the internals of the codebase and about the project, check out [Support](SUPPORT.md) for more details.

## Pull Requests

- **Feature requests** first need to be discussed and accepted through an issue before sending in a pull request.
- **Bug fixes** should contain [regression tests](https://laracasts.com/lessons/regression-testing).
- **[Coding standards](#coding-standards)** should be followed.
- **Add tests** Ensure that the current tests pass, and if you've added something new, add the tests where relevant.
- **Document any change in behaviour** - Make sure the relevant documentation are up-to-date.
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](https://semver.org/). Randomly breaking public APIs is not an option.
- **Create feature branches** - Don't ask us to pull from your master branch.
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful.

## Coding Standards

- [PSR-12 Coding Standard](https://www.php-fig.org/psr/psr-12/) will automatically be applied by Github Actions.
- Make sure to typehint and declare return type where applicable.

## Testing

All tests can be run with the following command.

``` bash
$ composer test
```

**Happy coding**!
28 changes: 28 additions & 0 deletions .github/ISSUE_TEMPLATE/1_Bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
name: 🐛 Bug Report
about: Report errors and problems.

---

- **Library Version**: #.#.#
- **Lumen Version**: #.#.#
- **PHP Version**: #.#.#

**Description**
<!-- A clear and concise description of the problem. -->

**Steps To Reproduce**
<!-- Steps, Code, and/or config needed to reproduce the problem. -->

**Possible Solution**
<!--- Optional: only if you have suggestions on a fix/reason for the bug -->

**Additional Context**
<!-- Optional: any other context about the problem: log messages, screenshots, etc. -->

<details>
<summary>Logs</summary>
<!-- PLEASE PASTE YOUR LOG FILE(S) DATA HERE -->
<!-- MAKE SURE TO REDACT TOKEN & OTHER SENSITIVE INFO -->

</details>
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/2_Feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: 🚀 Feature Request
about: RFC and ideas for new features and improvements
---

**Description**
<!-- A clear and concise description of the new feature. -->

**Example**
<!-- A simple example of the new feature in action (include PHP code, sample snippets, etc.)
If the new feature changes an existing feature, include a simple before/after comparison. -->
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: PHP Chat Community on Slack
url: https://phpchat.co
about: 'For any help and support from the community on Slack'
- name: PHP Chat Community on Telegram
url: https://t.me/PHPChatCo
about: 'For any help and support from the community on Telegram'
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

We take security very seriously. We follow the rule of [responsible disclosure](https://en.wikipedia.org/wiki/Responsible_disclosure), and we
encourage the community to as well.

## Supported Versions

After each new major release, the previous release will be supported for no less than 6 months, unless explicitly stated otherwise. This may mean there are multiple supported versions at any given time.

## Reporting a Vulnerability

If you discover a security vulnerability within this package, please email Syed at `syed at lukonet.com`. All security vulnerabilities will be promptly addressed. Please do not disclose security-related issues publicly until a fix has been announced.
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

Larasupport's GitHub issue trackers are not intended to provide help or support. Instead, use one of the following channels:

- [PHP Chat](https://phpchat.co/?utm_source=larasupport-gh) Community on Slack.
- [PHP Chat](https://t.me/PHPChatCo) Community on Telegram.
25 changes: 25 additions & 0 deletions .github/workflows/code-style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Code Style

on: [push]

jobs:
php-cs-fixer:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}

- name: Run PHP CS Fixer
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --config=.php_cs.dist --allow-risky=yes

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Apply PHP CS Fixer changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
vendor
composer.lock
.php_cs.cache
38 changes: 38 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

$finder = PhpCsFixer\Finder::create()->in(__DIR__);

return PhpCsFixer\Config::create()
->setRules([
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'not_operator_with_successor_space' => true,
'no_extra_blank_lines' => [
'curly_brace_block',
'extra',
'parenthesis_brace_block',
'throw',
'use',
],
'no_unused_imports' => true,
'ordered_imports' => ['sortAlgorithm' => 'alpha'],
'ternary_operator_spaces' => true,
'single_blank_line_before_namespace' => true,

// PSR-12
'blank_line_after_opening_tag' => true,
'braces' => ['allow_single_line_closure' => true],
'compact_nullable_typehint' => true,
'concat_space' => ['spacing' => 'one'],
'declare_equal_normalize' => ['space' => 'none'],
'function_typehint_space' => true,
'new_with_braces' => true,
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
'no_empty_statement' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_whitespace_in_blank_line' => true,
'return_type_declaration' => ['space_before' => 'none'],
'single_trait_insert_per_statement' => true,
])
->setFinder($finder);
9 changes: 5 additions & 4 deletions src/Console/VendorPublishCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ protected function publishTag($tag)
protected function pathsToPublish($tag)
{
return ServiceProvider::pathsToPublish(
$this->provider, $tag
$this->provider,
$tag
);
}

Expand Down Expand Up @@ -245,8 +246,8 @@ protected function publishDirectory($from, $to)
protected function moveManagedFiles($manager)
{
foreach ($manager->listContents('from://', true) as $file) {
if ($file['type'] === 'file' && (! $manager->has('to://'.$file['path']) || $this->option('force'))) {
$manager->put('to://'.$file['path'], $manager->read('from://'.$file['path']));
if ($file['type'] === 'file' && (! $manager->has('to://' . $file['path']) || $this->option('force'))) {
$manager->put('to://' . $file['path'], $manager->read('from://' . $file['path']));
}
}
}
Expand Down Expand Up @@ -278,6 +279,6 @@ protected function status($from, $to, $type)

$to = str_replace(base_path(), '', realpath($to));

$this->line('<info>Copied '.$type.'</info> <comment>['.$from.']</comment> <info>To</info> <comment>['.$to.']</comment>');
$this->line('<info>Copied ' . $type . '</info> <comment>[' . $from . ']</comment> <info>To</info> <comment>[' . $to . ']</comment>');
}
}
10 changes: 5 additions & 5 deletions src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function route_parameter($name, $default = null)
*/
function app_path($path = '')
{
return env('APP_PATH', base_path('app')).($path ? DIRECTORY_SEPARATOR.ltrim($path, DIRECTORY_SEPARATOR) : $path);
return env('APP_PATH', base_path('app')) . ($path ? DIRECTORY_SEPARATOR . ltrim($path, DIRECTORY_SEPARATOR) : $path);
}
}

Expand Down Expand Up @@ -69,7 +69,7 @@ function database_path($path = '')
*/
function public_path($path = '')
{
return env('PUBLIC_PATH', base_path('public')).($path ? DIRECTORY_SEPARATOR.ltrim($path, DIRECTORY_SEPARATOR) : $path);
return env('PUBLIC_PATH', base_path('public')) . ($path ? DIRECTORY_SEPARATOR . ltrim($path, DIRECTORY_SEPARATOR) : $path);
}
}

Expand Down Expand Up @@ -106,7 +106,7 @@ function elixir($file, $buildDirectory = 'build')
$buildBase = ($buildDirectory !== 'build') ? $buildDirectory : env('ELIXIR_BUILD_PATH', $buildDirectory);

if (empty($manifest) || $manifestPath !== $buildBase) {
$path = public_path($buildBase.'/rev-manifest.json');
$path = public_path($buildBase . '/rev-manifest.json');

if (file_exists($path)) {
$manifest = json_decode(file_get_contents($path), true);
Expand All @@ -117,13 +117,13 @@ function elixir($file, $buildDirectory = 'build')
$file = ltrim($file, '/');

if (isset($manifest[$file])) {
return '/'.trim($buildBase.'/'.$manifest[$file], '/');
return '/' . trim($buildBase . '/' . $manifest[$file], '/');
}

$unversioned = public_path($file);

if (file_exists($unversioned)) {
return '/'.trim($file, '/');
return '/' . trim($file, '/');
}

throw new InvalidArgumentException("File {$file} not defined in asset manifest.");
Expand Down

0 comments on commit 8602e56

Please sign in to comment.