-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c06b565
Showing
12 changed files
with
4,047 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/vendor/ | ||
.idea | ||
.php_cs.cache |
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,71 @@ | ||
<?php | ||
|
||
return PhpCsFixer\Config::create() | ||
->setRiskyAllowed(true) | ||
->setRules([ | ||
'array_syntax' => ['syntax' => 'short'], | ||
'declare_strict_types' => true, | ||
'no_useless_return' => true, | ||
'logical_operators' => true, | ||
'lowercase_constants' => true, | ||
'new_with_braces' => false, | ||
'align_multiline_comment' => true, | ||
'blank_line_after_opening_tag' => false, | ||
'blank_line_before_return' => true, | ||
'blank_line_before_statement' => true, | ||
'class_attributes_separation' => ['elements' => ['method']], | ||
'compact_nullable_typehint' => true, | ||
'concat_space' => ['spacing' => 'one'], | ||
'function_typehint_space' => true, | ||
'is_null' => true, | ||
'yoda_style' => true, | ||
'lowercase_keywords' => true, | ||
'lowercase_static_reference' => true, | ||
'method_argument_space' => true, | ||
'modernize_types_casting' => true, | ||
'native_constant_invocation' => true, | ||
'native_function_invocation' => true, | ||
'no_blank_lines_after_class_opening' => true, | ||
'no_blank_lines_after_phpdoc' => true, | ||
'no_closing_tag' => true, | ||
'no_empty_comment' => true, | ||
'no_leading_import_slash' => true, | ||
'no_spaces_around_offset' => true, | ||
'no_trailing_comma_in_singleline_array' => true, | ||
'no_unused_imports' => true, | ||
'no_useless_else' => true, | ||
'no_whitespace_before_comma_in_array' => true, | ||
'object_operator_without_whitespace' => true, | ||
'ordered_class_elements' => [ | ||
'order' => [ | ||
'use_trait', | ||
'constant_public', | ||
'constant_protected', | ||
'constant_private', | ||
'property_public', | ||
'property_protected', | ||
'property_private', | ||
'construct', | ||
'destruct', | ||
'magic', | ||
'method_public', | ||
'method_protected', | ||
'method_private', | ||
], | ||
], | ||
'psr0' => true, | ||
'psr4' => true, | ||
'return_type_declaration' => ['space_before' => 'none'], | ||
'short_scalar_cast' => true, | ||
'single_quote' => true, | ||
'standardize_not_equals' => true, | ||
'strict_comparison' => true, | ||
'ternary_to_null_coalescing' => true, | ||
'visibility_required' => ['elements' => ['property', 'method', 'const']], | ||
'void_return' => true, | ||
]) | ||
->setFinder( | ||
PhpCsFixer\Finder::create() | ||
->in(__DIR__ . '/src') | ||
->files() | ||
); |
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,10 @@ | ||
check: php-cs-fixer phpstan phpunit | ||
|
||
php-cs-fixer: | ||
./vendor/bin/php-cs-fixer fix | ||
|
||
phpstan: | ||
./vendor/bin/phpstan analyse | ||
|
||
phpunit: | ||
./vendor/bin/phpunit |
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,49 @@ | ||
## Docplanner Bank | ||
|
||
#### Cel zadania | ||
1. Zaimplementuj bank, który udostępnia interfejs `Bank\BankService`. | ||
2. Przykładowy scenariusz testowy: | ||
```gherkin | ||
(Given) Klient wpłacił depozyt 500 w dniu 02-02-2015 | ||
(And) wpłacił 1000 w dniu 15-02-2015 | ||
(And) wypłacił 200 w dniu 17-02-2015 | ||
(When) wyświetlił listę transakcji, | ||
(Then) zobaczył: | ||
Data || Kwota || Saldo | ||
17/02/2015 || -200 || 1300 | ||
15/02/2015 || 1000 || 1500 | ||
02/02/2015 || 500 || 500 | ||
``` | ||
|
||
#### Założenia | ||
1. Nie możesz zmienić wystawionego interfejsu banku. | ||
2. Do skalarnego przedstawienia kwot używaj typu `integer` zamiast `float`. | ||
3. Do wyświetlania danych możesz użyć nawet prostej instrukcji `echo` do konsoli. | ||
4. Pokryj implementację testami tam gdzie uważasz, że będą przydatne. | ||
|
||
#### Porady | ||
1. W projekcie zainstalowany jest PHPStan do analizy statycznej i PHPCSFixer do poprawiania CodeStyle-u. Możesz je uruchomić za pomocą komendy `make phpstan` oraz `make php-cs-fixer`. Więcej informacji znajdziesz w pliku `Makefile`. | ||
2. Możesz uruchomić PHPUnit za pomocą `make phpunit`. | ||
3. Nie zwracaj uwagi na liczbę spacji w wyświetlanej tabelce. Nie musi być idealna. :) | ||
4. Gdy istnieje taka możliwość staraj się pracować na obiektach zamiast typach prostych. | ||
|
||
#### Przykład odpalenia | ||
Nie martw się, nie potrzebujesz żadnego frameworka ani dodatkowych narzędzi, by móc odpalać zadanie. Dla nas wystarczy jak napiszesz przykład wywołania banku jako zwykły plik `php` - dociągnij potrzebne pliki, stwórz obiekty i odpal metody. Przykład znajduje się poniżej. | ||
|
||
```php | ||
<?php | ||
// Some magic | ||
// new Bank(); etc | ||
// Tutaj możesz sobie dociągnąć wymagane pliki, zbudować wszelkie klasy i ich użyć. | ||
$bank->deposit(500); | ||
$bank->deposit(1000); | ||
$bank->withdraw(200); | ||
$bank->printStatement(); | ||
|
||
>> OUTPUT: | ||
Data || Kwota || Saldo | ||
17/02/2015 || -200 || 1300 | ||
15/02/2015 || 1000 || 1500 | ||
02/02/2015 || 500 || 500 | ||
``` |
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,37 @@ | ||
{ | ||
"name": "patrykwozinski/dp-bank", | ||
"type": "project", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Patryk Woziński", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"autoload": { | ||
"psr-4": { | ||
"Bank\\": "src/" | ||
}, | ||
"psr-0": { | ||
"": "src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Tests\\Bank\\": "tests/" | ||
} | ||
}, | ||
"require": { | ||
"php": "^7.2.0" | ||
}, | ||
"require-dev": { | ||
"phpstan/phpstan": "^0.11.15", | ||
"phpstan/extension-installer": "^1.0", | ||
"phpstan/phpstan-deprecation-rules": "^0.11.2", | ||
"phpstan/phpstan-strict-rules": "^0.11.1", | ||
"phpstan/phpstan-phpunit": "^0.11.2", | ||
"localheinz/phpstan-rules": "^0.11.0", | ||
"friendsofphp/php-cs-fixer": "^2.15", | ||
"phpunit/phpunit": "^7.5" | ||
} | ||
} |
Oops, something went wrong.