-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Rework version 2 * uppdate readme file * update more helper files * Remove badges * Update changelog * Added funding and composer normalizer * Improve travis
- Loading branch information
Showing
17 changed files
with
187 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
; This file is for unifying the coding style for different editors and IDEs. | ||
; More information at https://editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 4 | ||
indent_style = space | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[Makefile] | ||
indent_style = tab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
/.editorconfig export-ignore | ||
/.gitattributes export-ignore | ||
/.github/ export-ignore | ||
/.gitignore export-ignore | ||
/.php_cs export-ignore | ||
/.scrutinizer.yml export-ignore | ||
/.styleci.yml export-ignore | ||
/.travis.yml export-ignore | ||
/phpunit.xml.dist export-ignore | ||
/tests/ export-ignore | ||
# Path-based git attributes | ||
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html | ||
|
||
# Ignore all test and documentation with "export-ignore". | ||
/.github export-ignore | ||
/bin export-ignore | ||
/tests export-ignore | ||
|
||
/.editorconfig export-ignore | ||
/.gitattributes export-ignore | ||
/.gitignore export-ignore | ||
/.php_cs export-ignore | ||
/.travis.yml export-ignore | ||
/Makefile export-ignore | ||
/phpunit.xml.dist export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# These are supported funding model platforms | ||
|
||
github: [gmponos, sagikazarmark] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
/build/ | ||
/composer.lock | ||
/phpunit.xml | ||
/vendor/ | ||
|
||
### phpunit | ||
.phpunit.result.cache | ||
/phpunit.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,64 @@ | ||
<?php | ||
|
||
require_once __DIR__.'/vendor/sllh/php-cs-fixer-styleci-bridge/autoload.php'; | ||
$finder = PhpCsFixer\Finder::create() | ||
->in([ | ||
__DIR__ . '/src', | ||
__DIR__ . '/tests', | ||
]); | ||
|
||
use SLLH\StyleCIBridge\ConfigBridge; | ||
|
||
return ConfigBridge::create(); | ||
return PhpCsFixer\Config::create() | ||
->setRiskyAllowed(true) | ||
->setUsingCache(false) | ||
->setRules([ | ||
'declare_strict_types' => true, | ||
'final_class' => true, | ||
'final_static_access' => true, | ||
'function_to_constant' => true, | ||
'native_constant_invocation' => true, | ||
'native_function_invocation' => ['include' => ['@all']], | ||
'no_alternative_syntax' => true, | ||
'no_empty_phpdoc' => true, | ||
'no_extra_blank_lines' => true, | ||
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true], | ||
'no_trailing_comma_in_singleline_array' => true, | ||
'no_trailing_whitespace' => true, | ||
'no_trailing_whitespace_in_comment' => true, | ||
'no_unneeded_control_parentheses' => true, | ||
'no_useless_else' => true, | ||
'no_useless_return' => true, | ||
'no_whitespace_before_comma_in_array' => true, | ||
'no_whitespace_in_blank_line' => true, | ||
'normalize_index_brace' => true, | ||
'php_unit_construct' => true, | ||
'php_unit_dedicate_assert' => ['target' => 'newest'], | ||
'php_unit_dedicate_assert_internal_type' => ['target' => 'newest'], | ||
'php_unit_mock' => ['target' => 'newest'], | ||
'php_unit_mock_short_will_return' => true, | ||
'php_unit_ordered_covers' => true, | ||
'php_unit_set_up_tear_down_visibility' => true, | ||
'php_unit_test_annotation' => ['style' => 'annotation', 'case' => 'camel'], | ||
'php_unit_test_case_static_method_calls' => ['call_type' => 'this'], | ||
'phpdoc_align' => ['align' => 'left'], | ||
'phpdoc_line_span' => ['method' => 'multi', 'property' => 'multi'], | ||
'phpdoc_no_package' => true, | ||
'phpdoc_no_useless_inheritdoc' => true, | ||
'phpdoc_scalar' => true, | ||
'phpdoc_single_line_var_spacing' => true, | ||
'phpdoc_trim' => true, | ||
'phpdoc_trim_consecutive_blank_line_separation' => true, | ||
'phpdoc_types' => true, | ||
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'], | ||
'phpdoc_var_annotation_correct_order' => true, | ||
'phpdoc_var_without_name' => true, | ||
'protected_to_private' => true, | ||
'random_api_migration' => true, | ||
'return_assignment' => true, | ||
'single_trait_insert_per_statement' => true, | ||
'standardize_not_equals' => true, | ||
'static_lambda' => true, | ||
'ternary_to_null_coalescing' => true, | ||
'trim_array_spaces' => true, | ||
'void_return' => true, | ||
'whitespace_after_comma_in_array' => true, | ||
]) | ||
->setFinder($finder); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
lint-php: | ||
@files=$$(find . -type f -name "*.php" | grep -v '/vendor/'); \ | ||
for f in $${files}; do \ | ||
php -l $$f; \ | ||
done | ||
|
||
php-cs-fixer: | ||
php ./bin/php-cs-fixer.phar fix -v | ||
|
||
php-cs-fixer-dry: | ||
php bin/php-cs-fixer.phar fix -v --dry-run --diff --diff-format=udiff | ||
|
||
composer-normalize: | ||
php bin/composer-normalize.phar --no-update-lock | ||
|
||
phpunit: | ||
php vendor/bin/phpunit --colors=always |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,45 @@ | ||
{ | ||
"name": "gravatarphp/twig-integration", | ||
"description": "Integrates Gravatar into Twig templating engine", | ||
"license": "MIT", | ||
"keywords": ["gravatar", "twig"], | ||
"keywords": [ | ||
"gravatar", | ||
"twig" | ||
], | ||
"homepage": "http://gravatarphp.com", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Márk Sági-Kazár", | ||
"email": "[email protected]" | ||
}, | ||
{ | ||
"name": "George Mponos", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"php": ">=5.4", | ||
"gravatarphp/gravatar": "^1.0", | ||
"twig/twig": "^1.18" | ||
"php": ">=7.2", | ||
"gravatarphp/gravatar": "^2.0", | ||
"twig/twig": "^1.43 || ^2.13 || ^3.0" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^4.8 || ^5.0", | ||
"sllh/php-cs-fixer-styleci-bridge": "^2.0", | ||
"friendsofphp/php-cs-fixer": "^1.11" | ||
"phpunit/phpunit": "^8.5.8 || ^9.2.0" | ||
}, | ||
"extra": { | ||
"branch-alias": { | ||
"dev-master": "2.0-dev" | ||
} | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Gravatar\\Twig\\": "src/" | ||
} | ||
}, | ||
"scripts": { | ||
"test": "vendor/bin/phpunit", | ||
"test-ci": "vendor/bin/phpunit --coverage-text --coverage-clover=build/coverage.xml" | ||
}, | ||
"extra": { | ||
"branch-alias": { | ||
"dev-master": "1.0-dev" | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Gravatar\\Twig\\Tests\\": "tests" | ||
} | ||
}, | ||
"prefer-stable": true, | ||
"minimum-stability": "dev" | ||
"minimum-stability": "dev", | ||
"prefer-stable": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,39 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Gravatar\Twig; | ||
|
||
use Gravatar\Gravatar; | ||
use Twig\Extension\AbstractExtension; | ||
use Twig\TwigFilter; | ||
|
||
/** | ||
* Gravatar Twig extension. | ||
* | ||
* @author Márk Sági-Kazár <[email protected]> | ||
*/ | ||
class GravatarExtension extends \Twig_Extension | ||
final class GravatarExtension extends AbstractExtension | ||
{ | ||
/** | ||
* @var Gravatar | ||
*/ | ||
protected $gravatar; | ||
private $gravatar; | ||
|
||
/** | ||
* @param Gravatar $gravatar | ||
*/ | ||
public function __construct(Gravatar $gravatar) | ||
{ | ||
$this->gravatar = $gravatar; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getFilters() | ||
public function getFilters(): array | ||
{ | ||
return [ | ||
new \Twig_SimpleFilter('gravatar_avatar', [$this->gravatar, 'avatar']), | ||
new \Twig_SimpleFilter('gravatar_profile', [$this->gravatar, 'profile']), | ||
new \Twig_SimpleFilter('gravatar_vcard', [$this->gravatar, 'vcard']), | ||
new \Twig_SimpleFilter('gravatar_qrCode', [$this->gravatar, 'qrCode']), | ||
new TwigFilter('gravatar_avatar', [$this->gravatar, 'avatar']), | ||
new TwigFilter('gravatar_profile', [$this->gravatar, 'profile']), | ||
new TwigFilter('gravatar_vcard', [$this->gravatar, 'vcard']), | ||
new TwigFilter('gravatar_qrCode', [$this->gravatar, 'qrCode']), | ||
]; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getName() | ||
public function getName(): string | ||
{ | ||
return 'gravatar'; | ||
} | ||
|
Oops, something went wrong.