This repository was archived by the owner on Aug 13, 2023. It is now read-only.
-
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
11 changed files
with
483 additions
and
3 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,5 @@ | ||
composer.phar | ||
composer.lock | ||
/vendor/ | ||
.idea/ | ||
build/ |
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,28 @@ | ||
build: | ||
environment: | ||
php: | ||
version: 5.6 | ||
tests: | ||
override: | ||
- | ||
command: 'phpunit --coverage-clover=some-file' | ||
coverage: | ||
file: 'some-file' | ||
format: 'clover' | ||
filter: | ||
excluded_paths: [demo/*, tests/*, docs/*] | ||
checks: | ||
php: | ||
remove_extra_empty_lines: true | ||
remove_php_closing_tag: true | ||
remove_trailing_whitespace: true | ||
fix_use_statements: | ||
remove_unused: true | ||
preserve_multiple: false | ||
preserve_blanklines: true | ||
order_alphabetically: true | ||
fix_php_opening_tag: true | ||
fix_linefeed: true | ||
fix_line_ending: true | ||
fix_identation_4spaces: true | ||
fix_doc_comments: 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,21 @@ | ||
language: php | ||
php: | ||
- '5.6' | ||
- '7.0' | ||
- '7.1' | ||
- nightly | ||
|
||
before_script: | ||
- "composer require codeclimate/php-test-reporter --dev" | ||
- "composer install" | ||
|
||
script: | ||
- "phpunit --coverage-text --coverage-clover build/logs/clover.xml" | ||
|
||
after_script: | ||
- CODECLIMATE_REPO_TOKEN="5b094ff7156e13f6d3ceaa2553e5a09a50ee9b483adba253caebe3e9ed7781f3" vendor/bin/test-reporter --stdout > codeclimate.json | ||
- "sh -c 'if [ \"$TRAVIS_PHP_VERSION\" != \"hhvm\" ]; then curl -X POST -d @codeclimate.json -H \"Content-Type: application/json\" -H \"User-Agent: Code Climate (PHP Test Reporter v0.1.1)\" https://codeclimate.com/test_reports ; fi'" | ||
|
||
addons: | ||
code_climate: | ||
repo_token: 5b094ff7156e13f6d3ceaa2553e5a09a50ee9b483adba253caebe3e9ed7781f3 |
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,2 +1,10 @@ | ||
# Slice | ||
Deimos Slice | ||
# DeimosSlice | ||
|
||
[](https://packagist.org/packages/deimos/slice) | ||
[](https://packagist.org/packages/deimos/slice) | ||
[](https://packagist.org/packages/deimos/slice) | ||
[](https://packagist.org/packages/deimos/slice) | ||
|
||
[](https://scrutinizer-ci.com/g/DeimosProject/Slice/?branch=master) | ||
[](https://scrutinizer-ci.com/g/DeimosProject/Slice/?branch=master) | ||
[](https://scrutinizer-ci.com/g/DeimosProject/Slice/build-status/master) |
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 @@ | ||
source: | ||
- ./src | ||
destination: ./docs | ||
internal: yes | ||
php: no | ||
tree: no | ||
deprecated: yes | ||
todo: yes | ||
sourceCode: no | ||
quiet: no |
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,28 @@ | ||
{ | ||
"name": "deimos/slice", | ||
"description": "Deimos Slice.", | ||
"keywords": [ | ||
"deimos", | ||
"slice" | ||
], | ||
"homepage": "https://github.com/DeimosProject/Slice", | ||
"license": "MIT", | ||
"type": "library", | ||
"authors": [ | ||
{ | ||
"name": "rez1dent3", | ||
"email": "maksim.babichev95@gmail.com" | ||
} | ||
], | ||
"require": { | ||
"deimos/helper": "~1.0" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "5.7.5" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Deimos\\": "src/" | ||
} | ||
} | ||
} |
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,46 @@ | ||
<?php | ||
|
||
include_once dirname(__DIR__) . '/vendor/autoload.php'; | ||
|
||
$builder = new \Deimos\Builder\Builder(); | ||
$helper = new \Deimos\Helper\Helper($builder); | ||
|
||
$slice = new \Deimos\Slice\Slice($helper, [ | ||
'dir' => [ | ||
'images' => [ | ||
'my' => ['image.jpg'], | ||
'collection' => [ | ||
'2017' => [ | ||
'praga' => '%collection.2017.praga%' | ||
] | ||
] | ||
] | ||
] | ||
], [ | ||
'collection' => [ | ||
'2017' => [ | ||
'praga' => ['image1.jpg', 'image2.jpg', 'image3.jpg'] | ||
] | ||
] | ||
]); | ||
|
||
var_dump($slice); | ||
|
||
$slice['dir.images.collection.2016'] = [ | ||
'praga' => ['image13.jpg', 'image4.jpg'] | ||
]; | ||
|
||
var_dump($slice['dir.images.collection']); | ||
|
||
unset($slice['dir.images.collection.2016']); | ||
|
||
var_dump($slice->getSlice('dir.images')); | ||
var_dump($slice->getData('dir.images')); | ||
|
||
var_dump(isset($slice['dir.images.collection.2016'])); | ||
var_dump(isset($slice['dir.images.collection.2017'])); | ||
|
||
foreach ($slice->getSlice('dir.images') as $key => $slouse) | ||
{ | ||
var_dump([$key => $slouse]); | ||
} |
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,23 @@ | ||
<phpunit bootstrap="tests/bootstrap.php"> | ||
|
||
<testsuites> | ||
<testsuite name="Config"> | ||
<directory>tests/Test</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<filter> | ||
<whitelist | ||
addUncoveredFilesFromWhitelist="true" | ||
processUncoveredFilesFromWhitelist="true"> | ||
|
||
<directory suffix=".php">./src/Config/</directory> | ||
</whitelist> | ||
</filter> | ||
|
||
<logging> | ||
<log type="coverage-html" target="./build/html/"/> | ||
<log type="coverage-clover" target="./build/logs/clover.xml"/> | ||
</logging> | ||
|
||
</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,95 @@ | ||
<?php | ||
|
||
namespace Deimos\Slice; | ||
|
||
use Deimos\Helper\Helper; | ||
|
||
class Iterator implements \Countable, \Iterator, \Serializable | ||
{ | ||
|
||
/** | ||
* @var Helper | ||
*/ | ||
protected $helper; | ||
|
||
/** | ||
* @var [] | ||
*/ | ||
protected $storage; | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function count() | ||
{ | ||
return count($this->storage); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function current() | ||
{ | ||
return current($this->storage); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function next() | ||
{ | ||
return next($this->storage); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function key() | ||
{ | ||
return key($this->storage); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function valid() | ||
{ | ||
return $this->key() !== null; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function rewind() | ||
{ | ||
reset($this->storage); | ||
} | ||
|
||
public function __sleep() | ||
{ | ||
return ['storage']; | ||
} | ||
|
||
public function __wakeup() | ||
{ | ||
$builder = new \Deimos\Builder\Builder(); | ||
$this->helper = new \Deimos\Helper\Helper($builder); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function serialize() | ||
{ | ||
return serialize($this->storage); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function unserialize($serialized) | ||
{ | ||
$this->storage = unserialize($serialized, []); | ||
} | ||
|
||
} |
Oops, something went wrong.