Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Merge branch 'feature/15' into develop
Browse files Browse the repository at this point in the history
Close #15
Close #17
  • Loading branch information
weierophinney committed Dec 22, 2015
2 parents 4f95c9d + df2b66e commit 9d98b41
Show file tree
Hide file tree
Showing 26 changed files with 898 additions and 703 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ matrix:
- php: 7
- php: hhvm
allow_failures:
- php: 7
- php: hhvm

notifications:
Expand Down
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Changelog

All notable changes to this project will be documented in this file, in reverse chronological order by release.

## 3.0.0 - TBD

### Added

- Nothing.

### Deprecated

- Nothing.

### Removed

- Nothing.

### Fixed

- [#15](https://github.com/zendframework/zend-filter/pull/15) updates the
component to use the v3 versions of zend-servicemanager and zend-crypt.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
},
"require-dev": {
"zendframework/zend-config": "~2.5",
"zendframework/zend-crypt": "~2.5",
"zendframework/zend-crypt": "dev-develop as 2.7",
"zendframework/zend-i18n": "~2.5",
"zendframework/zend-loader": "~2.5",
"zendframework/zend-servicemanager": "~2.5",
"zendframework/zend-servicemanager": "dev-develop as 2.7",
"zendframework/zend-uri": "~2.5",
"fabpot/php-cs-fixer": "1.7.*",
"phpunit/PHPUnit": "~4.0"
Expand Down
3 changes: 2 additions & 1 deletion src/FilterChain.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

use Countable;
use Traversable;
use Zend\ServiceManager\ServiceManager;
use Zend\Stdlib\PriorityQueue;

class FilterChain extends AbstractFilter implements Countable
Expand Down Expand Up @@ -108,7 +109,7 @@ public function count()
public function getPluginManager()
{
if (!$this->plugins) {
$this->setPluginManager(new FilterPluginManager());
$this->setPluginManager(new FilterPluginManager(new ServiceManager()));
}
return $this->plugins;
}
Expand Down
350 changes: 262 additions & 88 deletions src/FilterPluginManager.php

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/Inflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
namespace Zend\Filter;

use Traversable;
use Zend\ServiceManager\ServiceManager;
use Zend\Stdlib\ArrayUtils;

/**
Expand Down Expand Up @@ -86,7 +87,7 @@ public function __construct($options = null)
public function getPluginManager()
{
if (!$this->pluginManager instanceof FilterPluginManager) {
$this->setPluginManager(new FilterPluginManager());
$this->setPluginManager(new FilterPluginManager(new ServiceManager()));
}

return $this->pluginManager;
Expand Down
9 changes: 4 additions & 5 deletions src/StaticFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

namespace Zend\Filter;

use Zend\ServiceManager\ServiceManager;

class StaticFilter
{
/**
Expand All @@ -24,10 +26,6 @@ class StaticFilter
*/
public static function setPluginManager(FilterPluginManager $manager = null)
{
// Don't share by default to allow different arguments on subsequent calls
if ($manager instanceof FilterPluginManager) {
$manager->setShareByDefault(false);
}
static::$plugins = $manager;
}

Expand All @@ -39,8 +37,9 @@ public static function setPluginManager(FilterPluginManager $manager = null)
public static function getPluginManager()
{
if (null === static::$plugins) {
static::setPluginManager(new FilterPluginManager());
static::setPluginManager(new FilterPluginManager(new ServiceManager()));
}

return static::$plugins;
}

Expand Down
44 changes: 6 additions & 38 deletions src/Word/Service/SeparatorToSeparatorFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,20 @@

namespace Zend\Filter\Word\Service;

use Interop\Container\ContainerInterface;
use Zend\Filter\Word\SeparatorToSeparator;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\MutableCreationOptionsInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use Zend\ServiceManager\Factory\FactoryInterface;

class SeparatorToSeparatorFactory implements
FactoryInterface,
MutableCreationOptionsInterface
class SeparatorToSeparatorFactory implements FactoryInterface
{
/**
* @var array
*/
protected $creationOptions = [];

/**
* Set creation options
*
* @param array $creationOptions
* @return void
*/
public function setCreationOptions(array $creationOptions)
{
$this->creationOptions = $creationOptions;
}

/**
* Get creation options
*
* @return array
*/
public function getCreationOptions()
{
return $this->creationOptions;
}

/**
* {@inheritDoc}
*
* @return SeparatorToSeparator
* @throws ServiceNotCreatedException if Controllermanager service is not found in application service locator
*/
public function createService(ServiceLocatorInterface $plugins)
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
return new SeparatorToSeparator(
isset($this->creationOptions['search_separator']) ? $this->creationOptions['search_separator'] : ' ',
isset($this->creationOptions['replacement_separator']) ? $this->creationOptions['replacement_separator'] : '-'
isset($options['search_separator']) ? $options['search_separator'] : ' ',
isset($options['replacement_separator']) ? $options['replacement_separator'] : '-'
);
}
}
3 changes: 2 additions & 1 deletion test/BlacklistTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

use Zend\Filter\FilterPluginManager;
use Zend\Filter\Blacklist as BlacklistFilter;
use Zend\ServiceManager\ServiceManager;
use Zend\Stdlib\ArrayObject;

/**
Expand Down Expand Up @@ -39,7 +40,7 @@ public function testConstructorDefaults()

public function testWithPluginManager()
{
$pluginManager = new FilterPluginManager();
$pluginManager = new FilterPluginManager(new ServiceManager());
$filter = $pluginManager->get('blacklist');

$this->assertInstanceOf('Zend\Filter\Blacklist', $filter);
Expand Down
12 changes: 8 additions & 4 deletions test/Compress/Bz2Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,21 @@
*/
class Bz2Test extends \PHPUnit_Framework_TestCase
{
public $target;

public function setUp()
{
if (!extension_loaded('bz2')) {
$this->markTestSkipped('This adapter needs the bz2 extension');
}

$this->target = sprintf('%s/%s.bz2', sys_get_temp_dir(), uniqid('zfilter'));
}

public function tearDown()
{
if (file_exists(__DIR__ . '/../_files/compressed.bz2')) {
unlink(__DIR__ . '/../_files/compressed.bz2');
if (file_exists($this->target)) {
unlink($this->target);
}
}

Expand Down Expand Up @@ -119,7 +123,7 @@ public function testBz2GetSetArchive()
public function testBz2CompressToFile()
{
$filter = new Bz2Compression();
$archive = __DIR__ . '/../_files/compressed.bz2';
$archive = $this->target;
$filter->setArchive($archive);

$content = $filter->compress('compress me');
Expand Down Expand Up @@ -154,7 +158,7 @@ public function testBz2ToString()
public function testBz2DecompressArchive()
{
$filter = new Bz2Compression();
$archive = __DIR__ . '/../_files/compressed.bz2';
$archive = $this->target;
$filter->setArchive($archive);

$content = $filter->compress('compress me');
Expand Down
10 changes: 7 additions & 3 deletions test/Compress/GzTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,21 @@
*/
class GzTest extends \PHPUnit_Framework_TestCase
{
public $target;

public function setUp()
{
if (!extension_loaded('zlib')) {
$this->markTestSkipped('This adapter needs the zlib extension');
}

$this->target = sprintf('%s/%s.gz', sys_get_temp_dir(), uniqid('zfilter'));
}

public function tearDown()
{
if (file_exists(__DIR__ . '/../_files/compressed.gz')) {
unlink(__DIR__ . '/../_files/compressed.gz');
if (file_exists($this->target)) {
unlink($this->target);
}
}

Expand Down Expand Up @@ -137,7 +141,7 @@ public function testGzGetSetArchive()
public function testGzCompressToFile()
{
$filter = new GzCompression();
$archive = __DIR__ . '/../_files/compressed.gz';
$archive = $this->target;
$filter->setArchive($archive);

$content = $filter->compress('compress me');
Expand Down
Loading

0 comments on commit 9d98b41

Please sign in to comment.