This repository has been archived by the owner on Aug 13, 2021. It is now read-only.
-
-
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.
- Loading branch information
0 parents
commit 40c929e
Showing
19 changed files
with
861 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,36 @@ | ||
# Model | ||
|
||
View-model and model tools for Nette Framework. | ||
|
||
## Content | ||
|
||
- [Collections](#collections) | ||
- [Values](#values) | ||
|
||
## Collections | ||
|
||
### LazyCollection | ||
|
||
Initializes data only when required. | ||
|
||
```php | ||
use Contributte\Model\ViewModel\Collections\LazyCollection; | ||
|
||
$items = LazyCollection::fromCallback(callback $datasource); | ||
|
||
foreach($items as $item) { // Datasource callback is called on first access | ||
|
||
} | ||
``` | ||
|
||
## Values | ||
|
||
|
||
```php | ||
use Contributte\Model\Values\Email; | ||
|
||
$email = new Email('foo@example.com'); // Validate email format | ||
$value = $email->get(); // Get value | ||
$equal = $email->equal(new Email('foo@example.com')); // Compare values of objects | ||
``` |
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,20 @@ | ||
# EditorConfig is awesome: http://EditorConfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
indent_style = tab | ||
indent_size = tab | ||
tab_width = 4 | ||
|
||
[*.md] | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[{composer.json,package.json,.travis.yml}] | ||
indent_style = space | ||
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 @@ | ||
# Not archived | ||
.docs export-ignore | ||
tests export-ignore | ||
.editorconfig export-ignore | ||
.gitattributes export-ignore | ||
.gitignore export-ignore | ||
.travis.yml export-ignore | ||
LICENSE export-ignore | ||
README.md export-ignore | ||
phpstan.neon export-ignore | ||
ruleset.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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# IDE | ||
/.idea | ||
|
||
# Composer | ||
/vendor | ||
/composer.lock | ||
|
||
# Tests | ||
/temp/ | ||
/tests/*.log | ||
/tests/tmp | ||
/tests/coverage.html | ||
/coverage.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 |
---|---|---|
@@ -0,0 +1,65 @@ | ||
language: php | ||
|
||
php: | ||
- 7.1 | ||
- 7.2 | ||
|
||
before_install: | ||
# turn off XDebug | ||
- phpenv config-rm xdebug.ini || return 0 | ||
|
||
install: | ||
# Composer | ||
- travis_retry composer install --no-progress --prefer-dist | ||
|
||
script: | ||
# Nette/Tester | ||
- composer run-script tester | ||
|
||
jobs: | ||
include: | ||
- env: title="Lowest Dependencies 7.1" | ||
php: 7.1 | ||
install: | ||
- travis_retry composer update --no-progress --prefer-dist --prefer-lowest | ||
script: | ||
- composer run-script tester | ||
|
||
- env: title="Lowest Dependencies 7.2" | ||
php: 7.2 | ||
install: | ||
- travis_retry composer update --no-progress --prefer-dist --prefer-lowest | ||
script: | ||
- composer run-script tester | ||
|
||
- stage: Quality Assurance | ||
php: 7.2 | ||
script: | ||
- composer run-script qa | ||
|
||
- stage: Test Coverage | ||
php: 7.2 | ||
script: | ||
- composer run-script coverage | ||
after_script: | ||
- wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.0.0/php-coveralls.phar | ||
- php php-coveralls.phar --verbose --config tests/.coveralls.yml | ||
|
||
- stage: Phpstan | ||
php: 7.2 | ||
script: | ||
- composer run-script phpstan-install | ||
- composer run-script phpstan | ||
|
||
allow_failures: | ||
- stage: Test Coverage | ||
|
||
after_failure: | ||
# Print *.actual content | ||
- for i in $(find tests -name \*.actual); do echo "--- $i"; cat $i; echo; echo; done | ||
|
||
sudo: false | ||
|
||
cache: | ||
directories: | ||
- $HOME/.composer/cache |
Oops, something went wrong.