-
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
Showing
12 changed files
with
3,403 additions
and
1 deletion.
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 @@ | ||
coverage_clover: clover.xml | ||
json_path: upload.json | ||
service_name: travis-ci |
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 @@ | ||
.idea | ||
composer.phar | ||
vendor/ |
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 @@ | ||
build: | ||
environment: | ||
php: "7.0.8" | ||
|
||
tests: | ||
before: | ||
- "phpunit" | ||
|
||
before_commands: | ||
- "composer install --no-interaction --prefer-source" |
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 @@ | ||
language: php | ||
|
||
php: | ||
- '7.0' | ||
- '7.1' | ||
|
||
before_install: | ||
- composer require satooshi/php-coveralls:dev-master | ||
- composer install --dev | ||
|
||
install: | ||
- composer install --no-interaction --prefer-source | ||
|
||
after_script: | ||
- php vendor/bin/coveralls -v | ||
|
||
script: phpunit --coverage-clover clover.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 +1,33 @@ | ||
# spiral-array-paginable | ||
# spiral-array-paginable | ||
|
||
Small helper, that grants ability to paginate arrays in RecordSource way. Created for [Spiral Framework](https://github.com/spiral) | ||
|
||
## Usage | ||
```php | ||
//Example input data | ||
$data = [ | ||
'one' => 10, | ||
'two' => 20, | ||
'three' => 30, | ||
'four' => 40, | ||
'five' => 50, | ||
'six' => 60, | ||
'seven' => 70, | ||
'eight' => 80, | ||
'nine' => 90, | ||
'ten' => 100, | ||
]; | ||
|
||
$paginable = new PaginableArray($data); | ||
$paginable->paginate(5); | ||
|
||
//Implements `\Iterator` so you can just use it in foreach cycle | ||
foreach ($paginable as $value) { | ||
echo $value; // 10, 20, 30, 40, 50 for first page | ||
} | ||
|
||
//Also preserves keys. To access them during foreach cycle use `iterate()` method | ||
foreach ($paginable->iterate() as $key => $value) { | ||
echo $key; // one, two, three, four, five for first page | ||
} | ||
``` |
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,29 @@ | ||
{ | ||
"name": "vvval/spiral-array-paginable", | ||
"description": "Vault component dedicated to store internal system statistics.", | ||
"authors": [ | ||
{ | ||
"name": "Valentin V / vvval", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"php": ">=7.0", | ||
"spiral/common": "^0.9.3", | ||
"spiral/pagination": "^1.0" | ||
}, | ||
"require-dev": { | ||
"spiral/framework": "^0.9.10", | ||
"phpunit/phpunit": "~6.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Vvval\\Spiral\\": "source/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Vvval\\Spiral\\Tests\\": "tests/" | ||
} | ||
} | ||
} |
Oops, something went wrong.