Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d36ef9c

Browse files
:octocat: dependency update
1 parent 3915f17 commit d36ef9c

File tree

8 files changed

+53
-36
lines changed

8 files changed

+53
-36
lines changed

‎composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
"php": "^7.2",
2424
"psr/log": "^1.0",
2525
"psr/simple-cache": "^1.0",
26-
"chillerlan/php-traits": "^1.1"
26+
"chillerlan/php-settings-container": "^1.0"
2727
},
2828
"require-dev": {
29-
"phpunit/phpunit": "^7.1",
30-
"chillerlan/php-database": "^2.0",
29+
"phpunit/phpunit": "^7.5",
30+
"chillerlan/php-database": "^3.0",
3131
"ezyang/htmlpurifier": "^4.10"
3232
},
3333
"autoload": {

‎src/BBCode.php

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,17 @@
1313
namespace chillerlan\BBCode;
1414

1515
use chillerlan\BBCode\Output\BBCodeOutputInterface;
16-
use chillerlan\Traits\{
17-
ClassLoader, ContainerInterface
18-
};
16+
use chillerlan\Settings\SettingsContainerInterface;
1917
use Psr\Log\{
2018
LoggerAwareInterface, LoggerAwareTrait, LoggerInterface, NullLogger
2119
};
2220
use Psr\SimpleCache\CacheInterface;
2321

2422
class BBCode implements LoggerAwareInterface{
25-
use ClassLoader, LoggerAwareTrait;
23+
use LoggerAwareTrait;
2624

2725
/**
28-
* @var \chillerlan\BBCode\BBCodeOptions|\chillerlan\Traits\ContainerInterface
26+
* @var \chillerlan\BBCode\BBCodeOptions|\chillerlan\Settings\SettingsContainerInterface
2927
*/
3028
protected $options;
3129

@@ -67,11 +65,11 @@ class BBCode implements LoggerAwareInterface{
6765
/**
6866
* BBCode constructor.
6967
*
70-
* @param \chillerlan\Traits\ContainerInterface|null $options
71-
* @param \Psr\SimpleCache\CacheInterface|null $cache
72-
* @param \Psr\Log\LoggerInterface|null $logger
68+
* @param \chillerlan\Settings\SettingsContainerInterface|null $options
69+
* @param \Psr\SimpleCache\CacheInterface|null $cache
70+
* @param \Psr\Log\LoggerInterface|null $logger
7371
*/
74-
public function __construct(ContainerInterface $options = null, CacheInterface $cache = null, LoggerInterface $logger = null){
72+
public function __construct(SettingsContainerInterface $options = null, CacheInterface $cache = null, LoggerInterface $logger = null){
7573
$this
7674
->setCache($cache ?? new BBCache)
7775
->setLogger($logger ?? new NullLogger);
@@ -112,12 +110,12 @@ public function setCache(CacheInterface $cache):BBCode{
112110
/**
113111
* @todo
114112
*
115-
* @param \chillerlan\Traits\ContainerInterface $options
113+
* @param \chillerlan\Settings\SettingsContainerInterface $options
116114
*
117115
* @throws \chillerlan\BBCode\BBCodeException
118116
* @return \chillerlan\BBCode\BBCode
119117
*/
120-
public function setOptions(ContainerInterface $options):BBCode{
118+
public function setOptions(SettingsContainerInterface $options):BBCode{
121119
$this->options = $options;
122120

123121
mb_internal_encoding('UTF-8');
@@ -138,16 +136,28 @@ public function setOptions(ContainerInterface $options):BBCode{
138136
}
139137

140138
if($this->options->sanitizeInput || $this->options->sanitizeOutput){
141-
$this->sanitizerInterface = $this->loadClass($this->options->sanitizerInterface, SanitizerInterface::class, $this->options);
139+
$this->sanitizerInterface = new $this->options->sanitizerInterface($this->options);
140+
141+
if(!$this->sanitizerInterface instanceof SanitizerInterface){
142+
throw new BBcodeException('invalid SanitizerInterface');
143+
}
142144
}
143145

144146

145147

146148
if($this->options->preParse || $this->options->postParse){
147-
$this->parserMiddleware = $this->loadClass($this->options->parserMiddlewareInterface, ParserMiddlewareInterface::class, $this->options, $this->cache, $this->logger);
149+
$this->parserMiddleware = new $this->options->parserMiddlewareInterface($this->options, $this->cache, $this->logger);
150+
151+
if(!$this->parserMiddleware instanceof ParserMiddlewareInterface){
152+
throw new BBcodeException('invalid ParserMiddlewareInterface');
153+
}
148154
}
149155

150-
$this->outputInterface = $this->loadClass($this->options->outputInterface, BBCodeOutputInterface::class, $this->options, $this->cache, $this->logger);
156+
$this->outputInterface = new $this->options->outputInterface($this->options, $this->cache, $this->logger);
157+
158+
if(!$this->outputInterface instanceof BBCodeOutputInterface){
159+
throw new BBcodeException('invalid BBCodeOutputInterface');
160+
}
151161

152162
$this->tags = $this->outputInterface->getTags();
153163
$this->noparse = $this->outputInterface->getNoparse();

‎src/BBCodeOptions.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212

1313
namespace chillerlan\BBCode;
1414

15-
use chillerlan\Traits\ContainerAbstract;
15+
16+
use chillerlan\Settings\SettingsContainerAbstract;
1617

1718
/**
1819
* @property string $sanitizerInterface
@@ -32,6 +33,6 @@
3233
* @property array $allowedTags
3334
* @property bool $allowAvailableTags
3435
*/
35-
class BBCodeOptions extends ContainerAbstract{
36+
class BBCodeOptions extends SettingsContainerAbstract{
3637
use BBCodeOptionsTrait;
3738
}

‎src/Output/BBCodeModuleAbstract.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
namespace chillerlan\BBCode\Output;
1414

15-
use chillerlan\Traits\ContainerInterface;
15+
use chillerlan\Settings\SettingsContainerInterface;
1616
use Psr\Log\LoggerInterface;
1717
use Psr\SimpleCache\CacheInterface;
1818

@@ -60,7 +60,14 @@ abstract class BBCodeModuleAbstract implements BBCodeModuleInterface{
6060
*/
6161
protected $logger;
6262

63-
public function __construct(ContainerInterface $options, CacheInterface $cache, LoggerInterface $logger){
63+
/**
64+
* BBCodeModuleAbstract constructor.
65+
*
66+
* @param \chillerlan\Settings\SettingsContainerInterface $options
67+
* @param \Psr\SimpleCache\CacheInterface $cache
68+
* @param \Psr\Log\LoggerInterface $logger
69+
*/
70+
public function __construct(SettingsContainerInterface $options, CacheInterface $cache, LoggerInterface $logger){
6471
$this->options = $options;
6572
$this->cache = $cache;
6673
$this->logger = $logger;

‎src/Output/BBCodeModuleInterface.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
namespace chillerlan\BBCode\Output;
1414

15-
use chillerlan\Traits\ContainerInterface;
15+
use chillerlan\Settings\SettingsContainerInterface;
1616
use Psr\Log\LoggerInterface;
1717
use Psr\SimpleCache\CacheInterface;
1818

@@ -21,11 +21,11 @@ interface BBCodeModuleInterface{
2121
/**
2222
* BBCodeModuleInterface constructor.
2323
*
24-
* @param \chillerlan\Traits\ContainerInterface $options
24+
* @param \chillerlan\Settings\SettingsContainerInterface $options
2525
* @param \Psr\SimpleCache\CacheInterface $cache
2626
* @param \Psr\Log\LoggerInterface $logger
2727
*/
28-
public function __construct(ContainerInterface $options, CacheInterface $cache, LoggerInterface $logger);
28+
public function __construct(SettingsContainerInterface $options, CacheInterface $cache, LoggerInterface $logger);
2929

3030
/**
3131
* @return array

‎src/Output/BBCodeOutputAbstract.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212

1313
namespace chillerlan\BBCode\Output;
1414

15-
use chillerlan\Traits\{
16-
ClassLoader, ContainerInterface
17-
};
15+
use chillerlan\Settings\SettingsContainerInterface;
1816
use Psr\Log\LoggerInterface;
1917
use Psr\SimpleCache\CacheInterface;
2018

@@ -73,11 +71,11 @@ abstract class BBCodeOutputAbstract implements BBCodeOutputInterface{
7371
/**
7472
* BBCodeOutputInterface constructor.
7573
*
76-
* @param \chillerlan\Traits\ContainerInterface $options
74+
* @param \chillerlan\Settings\SettingsContainerInterface $options
7775
* @param \Psr\SimpleCache\CacheInterface $cache
7876
* @param \Psr\Log\LoggerInterface $logger
7977
*/
80-
public function __construct(ContainerInterface $options, CacheInterface $cache, LoggerInterface $logger){
78+
public function __construct(SettingsContainerInterface $options, CacheInterface $cache, LoggerInterface $logger){
8179
$options->replacement_eol = $options->replacement_eol ?? $this->eol;
8280

8381
$this->options = $options;
@@ -86,7 +84,8 @@ public function __construct(ContainerInterface $options, CacheInterface $cache,
8684

8785
foreach($this->modules as $module){
8886
/** @var \chillerlan\BBCode\Output\BBCodeModuleInterface $moduleInterface */
89-
$moduleInterface = $this->loadClass($module, BBCodeModuleInterface::class, $this->options, $this->cache, $this->logger);
87+
$moduleInterface = new $module($this->options, $this->cache, $this->logger);
88+
9089
foreach($moduleInterface->getTags() as $tag){
9190
$this->tagmap[$tag] = $module;
9291
}

‎src/Output/BBCodeOutputInterface.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
namespace chillerlan\BBCode\Output;
1414

15-
use chillerlan\Traits\ContainerInterface;
15+
use chillerlan\Settings\SettingsContainerInterface;
1616
use Psr\Log\LoggerInterface;
1717
use Psr\SimpleCache\CacheInterface;
1818

@@ -21,11 +21,11 @@ interface BBCodeOutputInterface{
2121
/**
2222
* BBCodeOutputInterface constructor.
2323
*
24-
* @param \chillerlan\Traits\ContainerInterface $options
24+
* @param \chillerlan\Settings\SettingsContainerInterface $options
2525
* @param \Psr\SimpleCache\CacheInterface $cache
2626
* @param \Psr\Log\LoggerInterface $logger
2727
*/
28-
public function __construct(ContainerInterface $options, CacheInterface $cache, LoggerInterface $logger);
28+
public function __construct(SettingsContainerInterface $options, CacheInterface $cache, LoggerInterface $logger);
2929

3030
/**
3131
* returns a list of tags the output interface is able to process

‎src/SanitizerAbstract.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
namespace chillerlan\BBCode;
1414

15-
use chillerlan\Traits\ContainerInterface;
15+
use chillerlan\Settings\SettingsContainerInterface;
1616

1717
abstract class SanitizerAbstract implements SanitizerInterface{
1818

@@ -24,9 +24,9 @@ abstract class SanitizerAbstract implements SanitizerInterface{
2424
/**
2525
* SanitizerInterface constructor.
2626
*
27-
* @param \chillerlan\Traits\ContainerInterface $options
27+
* @param \chillerlan\Settings\SettingsContainerInterface $options
2828
*/
29-
public function __construct(ContainerInterface $options){
29+
public function __construct(SettingsContainerInterface $options){
3030
$this->options = $options;
3131
}
3232

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /