-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/improve implementation #2
Open
nyamsprod
wants to merge
17
commits into
multiavatar:master
Choose a base branch
from
bakame-php:feature/improve-implementation
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
0ebedbf
Adding static analysis
nyamsprod 44d934c
Update package settings
nyamsprod bebb383
Upgrade the implementation
nyamsprod 453f19d
Improve implementation
nyamsprod b021fc4
Adding PHPUnit as a development dependency
nyamsprod 3f29973
Adding demo page for testing visual rendering
nyamsprod 48bd8c6
Updating package settings
nyamsprod 239e66c
Introducing the Multiavatar namespace and the options parameter
nyamsprod 5959431
Adding PHP7.2 support
nyamsprod 0c71ae7
bugfix filter name
nyamsprod 0e54964
BugFix themes colors
nyamsprod 81aab9a
Update documentation
nyamsprod f2cee28
bugfix docblock
nyamsprod 0c0b636
Update documentation
nyamsprod 6848752
Adding missing tests
nyamsprod 84c2b90
Improve internal svg generation method
nyamsprod 8ca1c62
Refactor the implementation to easily add/expand functionnality
nyamsprod File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 4 | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.neon] | ||
indent_size = 2 | ||
|
||
[*.xml.dist] | ||
indent_size = 2 | ||
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,11 @@ | ||
* text=auto | ||
|
||
/demo export-ignore | ||
/.editorconfig export-ignore | ||
/.gitattributes export-ignore | ||
/.gitignore export-ignore | ||
/.github export-ignore | ||
/phpstan.neon export-ignore | ||
/phpunit.xml.dist export-ignore | ||
/README.md export-ignore | ||
/**/*Test.php 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,26 @@ | ||
--- | ||
name: build | ||
on: | ||
push: ~ | ||
pull_request: ~ | ||
|
||
jobs: | ||
phpunit: | ||
name: PHPUnit tests on ${{ matrix.php }} ${{ matrix.composer-flags }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
php: ['7.2', '7.3', '7.4', '8.0' ] | ||
composer-flags: [ '' ] | ||
phpunit-flags: [ '--coverage-text' ] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
coverage: xdebug | ||
tools: composer:v2 | ||
- run: composer update --no-progress ${{ matrix.composer-flags }} | ||
- run: composer phpstan | ||
if: ${{ matrix.php == '7.4' }} | ||
- run: vendor/bin/phpunit ${{ matrix.phpunit-flags }} |
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,5 @@ | ||
build | ||
vendor | ||
.idea | ||
.phpunit.result.cache | ||
composer.lock |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
spl_autoload_register(function ($class) { | ||
|
||
$prefix = 'Multiavatar\\'; | ||
if (0 !== strpos($class, $prefix)) { | ||
return; | ||
} | ||
|
||
$file = __DIR__.'/src/'.str_replace('\\', '/', substr($class, strlen($prefix))).'.php'; | ||
if (!is_readable($file)) { | ||
return; | ||
} | ||
|
||
require $file; | ||
}); |
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,61 @@ | ||
<?php | ||
|
||
use Multiavatar\Multiavatar; | ||
|
||
require dirname(__DIR__).'/autoload.php'; | ||
|
||
$multiavatar = new Multiavatar(); | ||
$avatarList = []; | ||
foreach (range(0, 15) as $part) { | ||
foreach (['a', 'b', 'c'] as $theme) { | ||
$avatarList[$part.'-'.$theme] = $multiavatar('a', ['ver'=> ['part' => $part, 'theme' => $theme]]); | ||
} | ||
} | ||
?> | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="x-ua-compatible" content="ie=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> | ||
<title>Multiavatar - All 48 Initial Avatar Designs</title> | ||
<style> | ||
body, html { | ||
width:100%; | ||
height:100%; | ||
} | ||
|
||
body { | ||
background-color: #fff; | ||
overflow-x: hidden; | ||
padding:0px; | ||
margin:0px; | ||
} | ||
|
||
* { | ||
box-sizing: border-box; | ||
} | ||
|
||
.container { | ||
width: 100%; | ||
height: 100%; | ||
padding: 20px; | ||
} | ||
|
||
.avatar { | ||
width: 110px; | ||
height:110px; | ||
float:left; | ||
margin: 10px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div id="container" class="container"> | ||
<?php foreach ($avatarList as $id => $svg): ?> | ||
<div id="<?=$id?>" class="avatar"><?=$svg?></div> | ||
<?php endforeach; ?> | ||
</div> | ||
<div style="height:40px;clear:both;"></div> | ||
</body> | ||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
includes: | ||
- vendor/phpstan/phpstan-strict-rules/rules.neon | ||
- vendor/phpstan/phpstan-phpunit/rules.neon | ||
parameters: | ||
level: max | ||
checkMissingIterableValueType: false | ||
ignoreErrors: | ||
reportUnmatchedIgnoredErrors: 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" | ||
bootstrap="vendor/autoload.php" | ||
backupGlobals="false" | ||
backupStaticAttributes="false" | ||
colors="true" | ||
verbose="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false"> | ||
<coverage> | ||
<include> | ||
<directory suffix=".php">src</directory> | ||
</include> | ||
<exclude> | ||
<directory suffix="Test.php">src</directory> | ||
</exclude> | ||
<report> | ||
<clover outputFile="build/clover.xml"/> | ||
<html outputDirectory="build/coverage"/> | ||
<xml outputDirectory="build/coverage-xml"/> | ||
</report> | ||
</coverage> | ||
<testsuites> | ||
<testsuite name="Multiavatar Test Suite"> | ||
<directory suffix="Test.php">src</directory> | ||
</testsuite> | ||
</testsuites> | ||
<logging> | ||
<junit outputFile="build/junit.xml"/> | ||
</logging> | ||
</phpunit> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you base this off of what the current file was or did you just make it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. This is based on how to easily autoformat the package files on IDE. It is used as a baseline so that PHPStorm or Vscode or any IDE can easily format the file on saving or on editing. Most PHP libraries comes with those to have a unify coding practice/style.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know what
.editorconfig
is, I was just asking how you came up with the values for the configuration.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The value are the on I use ... the default is set for PHP according to PHP standard coding style from PSR-1
The other also stem form standard practices in PHP world
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, makes sense.