Skip to content

Commit b7f23a3

Browse files
committed
Integration of image-storage v0.5
1 parent fa646f7 commit b7f23a3

File tree

148 files changed

+3714
-3599
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+3714
-3599
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
.gitignore export-ignore
33
.php_cs.dist export-ignore
44
.travis.yml export-ignore
5+
.scrutinizer.yml export-ignore
56
tests export-ignore

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
composer.lock
2-
/vendor
31
/.idea
2+
composer.lock
3+
vendor

.php_cs.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
$finder = PhpCsFixer\Finder::create()
44
->in(__DIR__ . '/src')
55
->in(__DIR__ . '/tests')
6+
->exclude('temp')
67
;
78

89
return PhpCsFixer\Config::create()

.scrutinizer.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
checks:
2+
php:
3+
remove_extra_empty_lines: true
4+
remove_php_closing_tag: true
5+
remove_trailing_whitespace: true
6+
fix_use_statements:
7+
remove_unused: true
8+
preserve_multiple: false
9+
preserve_blanklines: true
10+
order_alphabetically: true
11+
fix_php_opening_tag: true
12+
fix_linefeed: true
13+
fix_line_ending: true
14+
fix_identation_4spaces: true
15+
fix_doc_comments: true
16+
17+
tools:
18+
external_code_coverage: true
19+
php_analyzer: true
20+
php_code_coverage: true
21+
22+
23+
before_commands:

.travis.yml

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,47 @@
11
language: php
22

33
php:
4-
- 7.1
4+
- 7.3
5+
- 7.4
56

67
env:
78
- TESTER_PHP_BIN="php-cgi"
89

910
before_install:
1011
- composer self-update
1112

12-
install:
13-
- composer install --no-interaction --prefer-source
14-
15-
before_script:
16-
- travis_retry composer update
17-
- travis_retry composer create-project nette/code-checker temp/code-checker ~2.5 --no-interaction
18-
1913
script:
20-
# check coding standard for our code
21-
- vendor/bin/php-cs-fixer fix --config=.php_cs.dist -v --dry-run
22-
- vendor/bin/tester -p $TESTER_PHP_BIN -s ./tests # -c ./tests/php.ini
23-
- vendor/bin/tester ./tests --coverage coverage.xml --coverage-src ./src -d zend_extension=xdebug.so
14+
- composer run tests
2415

2516
after_failure:
26-
# print content of output files *.actual
2717
- for i in $(find ./tests -name \*.actual); do echo "--- $i"; cat $i; echo; echo; done
2818

29-
after_script:
30-
# get scrutinizer for coverage upload
31-
- wget https://scrutinizer-ci.com/ocular.phar
32-
- php ocular.phar code-coverage:upload --format=php-clover coverage.xml
19+
jobs:
20+
include:
21+
- name: Nette Code Checker
22+
install:
23+
- travis_retry composer create-project nette/code-checker temp/code-checker ~3.2 --no-progress
24+
script:
25+
- php temp/code-checker/code-checker --strict-types --short-arrays
26+
27+
- name: Php-Cs-Fixer
28+
install:
29+
- travis_retry composer install --no-progress --prefer-dist
30+
script:
31+
- vendor/bin/php-cs-fixer fix --config=.php_cs.dist -v --dry-run
32+
33+
- stage: Code Coverage
34+
install:
35+
- travis_retry composer install --no-progress --prefer-dist
36+
script:
37+
- vendor/bin/tester -p phpdbg tests -s --coverage ./coverage.xml --coverage-src ./src -d zend_extension=xdebug.so
38+
after_script:
39+
- wget https://scrutinizer-ci.com/ocular.phar
40+
- php ocular.phar code-coverage:upload --format=php-clover coverage.xml
41+
42+
allow_failures:
43+
- name: Nette Code Checker
3344

3445
cache:
35-
directories:
36-
- $HOME/.composer/cache
46+
directories:
47+
- $HOME/.composer/cache

LICENSE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ Copyright (c) 2019 '68 Publishers
88
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
99
> copies of the Software, and to permit persons to whom the Software is
1010
> furnished to do so, subject to the following conditions:
11-
>
11+
>
1212
> The above copyright notice and this permission notice shall be included in all
1313
> copies or substantial portions of the Software.
14-
>
14+
>
1515
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1616
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1717
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
# Image Bundle
1+
# File Bundle
22

3-
:city_sunset: Simple image management based on our [image-storage](https://github.com/68publishers/image-storage) for Nette Framework.
3+
:city_sunset: File management bundle based on our [file-storage](https://github.com/68publishers/file-storage) for Nette Framework.
44

55
## Installation
66

7-
The best way to install 68publishers/image-bundle is using Composer:
7+
The best way to install 68publishers/file-bundle is using Composer:
88

99
```bash
10-
composer require 68publishers/image-bundle
10+
composer require 68publishers/file-bundle
1111
```
1212

1313
## Contributing

composer.json

Lines changed: 50 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "68publishers/image-bundle",
3-
"description": "Simple image management based on our image-storage for Nette Framework.",
4-
"keywords": ["68publishers", "image", "images", "image-bundle", "nette"],
2+
"name": "68publishers/file-bundle",
3+
"description": "File management bundle based on our file-storage for Nette Framework.",
4+
"keywords": ["68publishers", "files", "file-bundle", "images", "nette"],
55
"license": "MIT",
66
"authors": [
77
{
@@ -10,35 +10,61 @@
1010
}
1111
],
1212
"require": {
13-
"php": "^7.1",
14-
"nette/di": "^2.4",
15-
"nette/utils": "^2.4",
16-
"nette/application": "^2.4",
17-
"nette/forms": "^2.4",
18-
"ramsey/uuid": "^3.8",
19-
"68publishers/smart-nette-component": "^0.1",
20-
"68publishers/doctrine-persistence": "^0.1",
21-
"68publishers/image-storage": "^0.4",
22-
"symfony/event-dispatcher": "^4.0",
23-
"kdyby/doctrine": "^3.0",
24-
"kdyby/translation": "^2.4"
13+
"php": "^7.3",
14+
"ext-fileinfo": "*",
15+
"68publishers/doctrine-bridge": "^0.1.1",
16+
"68publishers/doctrine-persistence": "^0.2",
17+
"68publishers/event-dispatcher-extra": "^1.0",
18+
"68publishers/file-storage": "^0.1",
19+
"68publishers/smart-nette-component": "^0.2",
20+
"68publishers/translation-bridge": "^1.2",
21+
"nette/application": "^3.0.6",
22+
"nette/di": "^3.0.3",
23+
"nette/forms": "^3.0",
24+
"nette/utils": "^3.0",
25+
"ramsey/uuid": "^4.0"
2526
},
2627
"require-dev": {
28+
"roave/security-advisories": "dev-master",
2729
"friendsofphp/php-cs-fixer": "^2.0",
28-
"nette/tester": "^1.7",
29-
"68publishers/notification-bundle": "^0.1",
30-
"gedmo/doctrine-extensions": "^2.4"
30+
"nette/tester": "^2.3.4",
31+
"68publishers/notification-bundle": "^0.2",
32+
"gedmo/doctrine-extensions": "^2.4",
33+
"68publishers/image-storage": "^0.5"
3134
},
3235
"suggest": {
33-
"gedmo/doctrine-extensions": "If you want to use soft-deletable images.",
34-
"68publishers/notification-bundle": "For automatic notifications (flash message, toastr) on image upload, deletion etc."
36+
"gedmo/doctrine-extensions": "If you want to use soft-deletable files.",
37+
"68publishers/notification-bundle": "For automatic notifications (flash message, toastr) on file upload, deletion etc.",
38+
"68publishers/image-storage": "Use combination of file-storage and image-storage to better management of images!"
39+
},
40+
"conflict": {
41+
"68publishers/image-storage": "<0.5"
3542
},
3643
"autoload": {
37-
"classmap": ["src/"],
38-
"files": []
44+
"psr-4": {
45+
"SixtyEightPublishers\\FileBundle\\": "src/"
46+
}
3947
},
4048
"autoload-dev": {
41-
"classmap": ["tests/"],
42-
"files": []
49+
"psr-4": {
50+
"SixtyEightPublishers\\FileBundle\\Tests\\": "tests/"
51+
}
52+
},
53+
"config": {
54+
"sort-packages": true
55+
},
56+
"scripts": {
57+
"tests": [
58+
"@tests:lowest",
59+
"@tests:highest"
60+
],
61+
"tests:lowest" : [
62+
"@composer update --no-progress --prefer-dist --prefer-lowest --prefer-stable",
63+
"vendor/bin/tester ./tests"
64+
],
65+
"tests:highest" : [
66+
"@composer update --no-progress --prefer-dist --prefer-stable",
67+
"vendor/bin/tester ./tests"
68+
]
4369
}
4470
}

src/Action/AbstractAction.php

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22

33
declare(strict_types=1);
44

5-
namespace SixtyEightPublishers\ImageBundle\Action;
5+
namespace SixtyEightPublishers\FileBundle\Action;
66

7-
use Nette;
8-
use SixtyEightPublishers;
7+
use SixtyEightPublishers\FileBundle\Entity\FileInterface;
8+
use SixtyEightPublishers\FileBundle\Storage\DataStorageInterface;
99

10-
abstract class AbstractAction implements IAction
10+
abstract class AbstractAction implements ActionInterface
1111
{
12-
use Nette\SmartObject;
13-
1412
/** @var string|NULL */
1513
protected $label;
1614

@@ -22,13 +20,6 @@ public function __construct(?string $label = NULL)
2220
$this->label = $label;
2321
}
2422

25-
/**
26-
* @return string
27-
*/
28-
abstract protected function getManipulatorClass(): string;
29-
30-
/*************** interface \AppBundle\Control\ImageManager\Action\AbstractAction ***************/
31-
3223
/**
3324
* {@inheritdoc}
3425
*/
@@ -40,10 +31,23 @@ public function getLabel(): string
4031
/**
4132
* {@inheritdoc}
4233
*/
43-
public function canBeUsed(SixtyEightPublishers\ImageBundle\Storage\IDataStorage $dataStorage): bool
34+
public function isImplemented(DataStorageInterface $dataStorage): bool
4435
{
4536
$manipulatorClass = $this->getManipulatorClass();
4637

4738
return $dataStorage->hasManipulator($manipulatorClass);
4839
}
40+
41+
/**
42+
* {@inheritdoc}
43+
*/
44+
public function isApplicableOnFile(FileInterface $file, DataStorageInterface $dataStorage): bool
45+
{
46+
return TRUE;
47+
}
48+
49+
/**
50+
* @return string
51+
*/
52+
abstract protected function getManipulatorClass(): string;
4953
}

src/Action/ActionInterface.php

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace SixtyEightPublishers\FileBundle\Action;
6+
7+
use SixtyEightPublishers\FileBundle\Entity\FileInterface;
8+
use SixtyEightPublishers\FileBundle\Storage\DataStorageInterface;
9+
10+
interface ActionInterface
11+
{
12+
/**
13+
* @return string
14+
*/
15+
public function getName(): string;
16+
17+
/**
18+
* @return string
19+
*/
20+
public function getLabel(): string;
21+
22+
/**
23+
* @param \SixtyEightPublishers\FileBundle\Storage\DataStorageInterface $storage
24+
*
25+
* @return bool
26+
*/
27+
public function isImplemented(DataStorageInterface $storage): bool;
28+
29+
/**
30+
* @param \SixtyEightPublishers\FileBundle\Entity\FileInterface $file
31+
* @param \SixtyEightPublishers\FileBundle\Storage\DataStorageInterface $dataStorage
32+
*
33+
* @return bool
34+
*/
35+
public function isApplicableOnFile(FileInterface $file, DataStorageInterface $dataStorage): bool;
36+
37+
/**
38+
* @param \SixtyEightPublishers\FileBundle\Storage\DataStorageInterface $dataStorage
39+
* @param \SixtyEightPublishers\FileBundle\Entity\FileInterface $file
40+
*
41+
* @return void
42+
* @throws \SixtyEightPublishers\FileBundle\Exception\FileManipulationException
43+
*/
44+
public function run(DataStorageInterface $dataStorage, FileInterface $file): void;
45+
}

0 commit comments

Comments
 (0)